function facturaPDF($registro, $username, $direccion) { // (c) Xavier Nicolay // Exemple de génération de devis/facture PDF //ob_clean(); require '../../factura/invoice.php'; //ob_get_clean(); $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->addSociete("TTOUNKYO", "Dirección\n" . "07840 ESPAÑA\n" . "Calle Ignacio Walis s/n\n"); $pdf->fact_dev("Divisa", "001 "); $pdf->temporaire("FACTURA"); $pdf->addDate(date('d/m/Y')); $pdf->addClient($username); $pdf->addPageNumber("1"); $pdf->addClientAdresse($direccion); $pdf->addReglement("Compra atraves de tarjeta"); $pdf->addVencimiento(date('d/m/Y', strtotime('+1 year'))); $pdf->addNumNif($registro); $pdf->addReference("Detalle de la compra"); $cols = array("REFERENCIA" => 23, "DESIGNACIÓN" => 78, "CANTIDAD" => 22, "P.UNIDAD. HT" => 26, "TOTAL H.T." => 30, "I.V.A." => 11); $pdf->addCols($cols); $cols = array("REFERENCIA" => "L", "DESIGNACIÓN" => "L", "CANTIDAD" => "C", "P.UNIDAD. HT" => "R", "TOTAL H.T." => "R", "I.V.A." => "C"); $pdf->addLineFormat($cols); $pdf->addLineFormat($cols); $preu_final = 0; $y = 109; foreach ($_SESSION['carrito'] as $key => $value) { $line = array("REFERENCIA" => $value['titulo'], "DESIGNACIÓN" => $value['descripcion'], "CANTIDAD" => $value['cantidad'], "P.UNIDAD. HT" => $value['precio'] . " " . EURO, "TOTAL H.T." => $value['cantidad'] * $value['precio'] . " " . EURO, "I.V.A." => "1"); $size = $pdf->addLine($y, $line); $y += $size + 2; $preu_final += $value['cantidad'] * $value['precio']; } $pdf->addCadreTVAs(); $tot_prods = array(array("px_unit" => $preu_final, "qte" => 1, "tva" => 1), array("px_unit" => 0, "qte" => 1, "tva" => 1)); $tab_tva = array("1" => 21.0, "2" => 5.5); $params = array("RemiseGlobale" => 1, "remise_tva" => 1, "remise" => 0, "remise_percent" => 10, "FraisPort" => 1, "portTTC" => 0, "portHT" => 0, "portTVA" => 21.0, "AccompteExige" => 1, "accompte" => 0, "accompte_percent" => 15, "Remarque" => "Descuento del 15% en todos nuestros productos"); $pdf->addTVAs($params, $tab_tva, $tot_prods); $pdf->addCadreEurosFrancs(); // ob_get_clean(); $pdf->Output("../../factura/control/factura" . $registro . ".pdf", "F"); }
<?php // (c) Xavier Nicolay // Exemple de génération de devis/facture PDF require 'invoice.php'; $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->addSociete("MaSociete", "MonAdresse\n" . "75000 PARIS\n" . "R.C.S. PARIS B 000 000 007\n" . "Capital : 18000 " . EURO); $pdf->fact_dev("Devis ", "TEMPO"); $pdf->temporaire("Devis temporaire"); $pdf->addDate("03/12/2003"); $pdf->addClient("CL01"); $pdf->addPageNumber("1"); $pdf->addClientAdresse("Ste\nM. XXXX\n3ème étage\n33, rue d'ailleurs\n75000 PARIS"); $pdf->addReglement("Chèque à réception de facture"); $pdf->addEcheance("03/12/2003"); $pdf->addNumTVA("FR888777666"); $pdf->addReference("Devis ... du ...."); $cols = array("REFERENCE" => 23, "DESIGNATION" => 78, "QUANTITE" => 22, "P.U. HT" => 26, "MONTANT H.T." => 30, "TVA" => 11); $pdf->addCols($cols); $cols = array("REFERENCE" => "L", "DESIGNATION" => "L", "QUANTITE" => "C", "P.U. HT" => "R", "MONTANT H.T." => "R", "TVA" => "C"); $pdf->addLineFormat($cols); $pdf->addLineFormat($cols); $y = 109; $line = array("REFERENCE" => "REF1", "DESIGNATION" => "Carte Mère MSI 6378\n" . "Processeur AMD 1Ghz\n" . "128Mo SDRAM, 30 Go Disque, CD-ROM, Floppy, Carte vidéo", "QUANTITE" => "1", "P.U. HT" => "600.00", "MONTANT H.T." => "600.00", "TVA" => "1"); $size = $pdf->addLine($y, $line); $y += $size + 2; $line = array("REFERENCE" => "REF2", "DESIGNATION" => "Câble RS232", "QUANTITE" => "1", "P.U. HT" => "10.00", "MONTANT H.T." => "60.00", "TVA" => "1"); $size = $pdf->addLine($y, $line); $y += $size + 2; $pdf->addCadreTVAs();
function generate_facture($productos = array(), $client = array()) { $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->addSociete("TheCatLong", "Av. España N°76, Illes Balears.\n" . "07800 Eivissa, Illes Balea\n" . "Capital: 18000 " . EURO); $pdf->fact_dev("Devis ", "TEMPO"); $pdf->temporaire("Factura"); $pdf->addDate("03/12/2003"); $pdf->addClient("CL01"); $pdf->addPageNumber("1"); $pdf->addClientAdresse("Ste\nM. XXXX\n3ème étage\n33, rue d'ailleurs\n75000 PARIS"); $pdf->addReglement("Pago online"); $pdf->addEcheance("03/12/2003"); $pdf->addNumTVA("FR888777666"); $pdf->addReference("Devis ... du ...."); $cols = array("REFERENCIA" => 23, "DESCRIPCION" => 78, "CANTIDAD" => 22, "PRECIO UNI." => 26, "PRECIO TOTAL" => 30, "I.V.A." => 11); $pdf->addCols($cols); $cols = array("REFERENCIA" => "L", "DESCRIPCION" => "L", "CANTIDAD" => "C", "PRECIO UNI." => "R", "PRECIO TOTAL" => "R", "I.V.A." => "C"); $pdf->addLineFormat($cols); $pdf->addLineFormat($cols); $y = 109; $total = 0; foreach ($productos as $id => $pro) { $totalProducto = $pro["precio"] + $pro["precio"] * 0.21; $total += $totalProducto; $line = array("REFERENCIA" => "REF" . $pro['idproducto'], "DESCRIPCION" => ucfirst($pro['descripcion']), "CANTIDAD" => "1", "PRECIO UNI." => $pro["precio"] . " " . EURO, "PRECIO TOTAL" => $totalProducto, "I.V.A." => "21%"); $size = $pdf->addLine($y, $line); $y += $size + 2; } $pdf->addCadreTVAs(); $tot_prods = array(array("px_unit" => $totalProducto, "qte" => 1, "tva" => 1), array("px_unit" => 0, "qte" => 1, "tva" => 1)); $tab_tva = array("1" => 21, "2" => 5.5); $params = array("RemiseGlobale" => 1, "remise_tva" => 1, "remise" => 0, "remise_percent" => 0, "FraisPort" => 1, "portTTC" => 0, "portHT" => 0, "portTVA" => 21, "AccompteExige" => 1, "accompte" => 0, "accompte_percent" => 0, "Remarque" => ""); $pdf->addTVAs($params, $tab_tva, $tot_prods); $pdf->addCadreEurosFrancs(); $tmpFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid(time()) . 'factura.pdf'; $pdf->Output($tmpFile, 'F'); return sendEmail(true, array($client), 'Factura', 'Ya tiene disponible su factura. Grácias por su compra', array(array('absolute' => true, 'path' => $tmpFile), array('absolute' => true, 'path' => generate_ticket($productos, true)))); }
$id_invoice = $ex[0]; $res = mysql_query("select * from invoices where id='" . $id_invoice . "'") or die(mysql_error()); $info = mysql_fetch_array($res); $pdf = new PDF_Invoice('P', 'mm', $cfg['size']); $pdf->AddPage(); $pdf->AddFont('LucidaSansUnicode', '', 'lsansuni.php'); $pdf->SetFont('LucidaSansUnicode', '', 12); if ($cfg['display_logo']) { $pdf->Image(str_replace('inc', '', dirname(__FILE__)) . $cfg['logo'], 75, 15, 50); } $pdf->addSociete($cfg['name'], $cfg['name'] . "\n" . $cfg['website'] . "\n" . $cfg['lang_bank'] . ": " . $cfg['bank_name'] . "\n" . $cfg['lang_bank_account'] . ": " . $cfg['bank_account'] . "\n" . $cfg['address']); $pdf->fact_dev($cfg['name']); if ($cfg['watermark']) { $pdf->temporaire($cfg['watermark']); } $pdf->addDate(date('d/m/Y', $info['date'])); $pdf->addClient("#" . $info['id']); $pdf->addPageNumber("1"); $pdf->addClientAdresse($info['client_name'] . "\n" . $info['client_address'] . "\n" . $info['client_location']); $pdf->addReglement($info['payment_method']); $pdf->addEcheance(date('d/m/Y', $info['date'])); $rex = mysql_query("SELECT SUM(amount) as total FROM payments WHERE invoice='" . $info['id'] . "'") or die(mysql_error()); $r = mysql_fetch_array($rex); if ($r['total'] < $info['total'] && $r['total'] > 0) { $p = $cfg['lang_partial']; } elseif ($r['total'] == 0) { $p = $cfg['lang_unpaid']; } elseif ($r['total'] > $info['total']) { $p = $cfg['lang_paid']; } elseif ($r['total'] == $info['total']) { $p = $cfg['lang_paid'];
$IDcu = str_pad((int) $cu[0], "4", "0", STR_PAD_LEFT); $IDor = str_pad((int) $or[0], "5", "0", STR_PAD_LEFT); $discount = $or[6] == 0.0 ? 0 : $or[6]; $shipping = $or[7] == 'null' ? 0 : $or[7]; $ShippingCharge = $or[7] == 'null' ? 0 : 1; $ShipTTC = $setup[1] == 'null' ? $shipping : ($ShipTTC = 0); $ShipHT = $setup[1] == 1 ? $shipping : ($ShipHT = 0); $payment_method = html_entity_decode($or[12]); $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->addSociete("{$compagny}", "{$address}"); $pdf->fact_dev($lang["invoice_name"], $invoiceprefixe . $IDor); if ($comments != "null") { $pdf->temporaire($comments); } $pdf->addDate($dd); $pdf->addClient("{$customerprefixe}{$IDcu}"); $pdf->addClientAdresse("{$cu['5']}\n{$cu['3']} - {$cu['4']}\n{$cu['8']}\n{$cu['9']}\n{$cu['12']} {$cu['10']}"); $pdf->addReglement("{$payment_method}"); $pdf->addEcheance("{$dd}"); $pdf->addNumTVA("{$vat}"); $pdf->addReference($lang["invoice_shipping_methode"], $or[15]); $cols = array($lang["invoice_code"] => 23, $lang["invoice_description"] => 78, $lang["invoice_quantity"] => 22, $lang["invoice_unit_price"] => 26, $lang["invoice_amount"] => 30, $lang["invoice_tax"] => 11); $pdf->addCols($cols); $cols = array($lang["invoice_code"] => "L", $lang["invoice_description"] => "L", $lang["invoice_quantity"] => "C", $lang["invoice_unit_price"] => "R", $lang["invoice_amount"] => "R", $lang["invoice_tax"] => "C"); $pdf->addLineFormat($cols); $pdf->addLineFormat($cols); $y = 109; if (file_exists("../{$AdminFolder}/db/orders/sc/" . $or[0] . ".dat")) { $filename = "../{$AdminFolder}/db/orders/sc/" . $or[0] . ".dat"; $lines = array();
public function actionInvoice() { // (c) Xavier Nicolay // Exemple de génération de devis/facture PDF //require('invoice.php'); $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); $pdf->addSociete("MaSociete", "MonAdresse\n" . "75000 PARIS\n" . "R.C.S. PARIS B 000 000 007\n" . "Capital : 18000 " . EURO); $pdf->fact_dev("Devis ", "TEMPO"); $pdf->temporaire("Devis temporaire"); $pdf->addDate("03/12/2003"); $pdf->addClient("CL01"); $pdf->addPageNumber("1"); $pdf->addClientAdresse("Ste\nM. XXXX\n3ème étage\n33, rue d'ailleurs\n75000 PARIS"); $pdf->addReglement("Chèque à réception de facture"); $pdf->addEcheance("03/12/2003"); $pdf->addNumTVA("FR888777666"); $pdf->addReference("Devis ... du ...."); $cols = array("REFERENCE" => 23, "DESIGNATION" => 78, "QUANTITE" => 22, "P.U. HT" => 26, "MONTANT H.T." => 30, "TVA" => 11); $pdf->addCols($cols); $cols = array("REFERENCE" => "L", "DESIGNATION" => "L", "QUANTITE" => "C", "P.U. HT" => "R", "MONTANT H.T." => "R", "TVA" => "C"); $pdf->addLineFormat($cols); $pdf->addLineFormat($cols); $y = 109; $line = array("REFERENCE" => "REF1", "DESIGNATION" => "Carte Mère MSI 6378\n" . "Processeur AMD 1Ghz\n" . "128Mo SDRAM, 30 Go Disque, CD-ROM, Floppy, Carte vidéo", "QUANTITE" => "1", "P.U. HT" => "600.00", "MONTANT H.T." => "600.00", "TVA" => "1"); $size = $pdf->addLine($y, $line); $y += $size + 2; $line = array("REFERENCE" => "REF2", "DESIGNATION" => "Câble RS232", "QUANTITE" => "1", "P.U. HT" => "10.00", "MONTANT H.T." => "60.00", "TVA" => "1"); $size = $pdf->addLine($y, $line); $y += $size + 2; $pdf->addCadreTVAs(); // invoice = array( "px_unit" => value, // "qte" => qte, // "tva" => code_tva ); // tab_tva = array( "1" => 19.6, // "2" => 5.5, ... ); // params = array( "RemiseGlobale" => [0|1], // "remise_tva" => [1|2...], // {la remise s'applique sur ce code TVA} // "remise" => value, // {montant de la remise} // "remise_percent" => percent, // {pourcentage de remise sur ce montant de TVA} // "FraisPort" => [0|1], // "portTTC" => value, // montant des frais de ports TTC // // par defaut la TVA = 19.6 % // "portHT" => value, // montant des frais de ports HT // "portTVA" => tva_value, // valeur de la TVA a appliquer sur le montant HT // "AccompteExige" => [0|1], // "accompte" => value // montant de l'acompte (TTC) // "accompte_percent" => percent // pourcentage d'acompte (TTC) // "Remarque" => "texte" // texte $tot_prods = array(array("px_unit" => 600, "qte" => 1, "tva" => 1), array("px_unit" => 10, "qte" => 1, "tva" => 1)); $tab_tva = array("1" => 19.6, "2" => 5.5); $params = array("RemiseGlobale" => 1, "remise_tva" => 1, "remise" => 0, "remise_percent" => 10, "FraisPort" => 1, "portTTC" => 10, "portHT" => 0, "portTVA" => 19.6, "AccompteExige" => 1, "accompte" => 0, "accompte_percent" => 15, "Remarque" => "Avec un acompte, svp..."); $pdf->addTVAs($params, $tab_tva, $tot_prods); $pdf->addCadreEurosFrancs(); $pdf->Output(); }
// (c) Xavier Nicolay // Exemple de génération de devis/facture PDF require('invoice.php'); $pdf = new PDF_Invoice( 'P', 'mm', 'A4' ); $pdf->AddPage(); $pdf->addSociete( "TNEB", "RK Salai\n" . "Mylapore\n". "Chennai : 18000 " . EURO ); //$pdf->fact_dev( "Invoice #1234" ,0); //$pdf->temporaire( "Hackathon" ); $pdf->addDate( date("Y-m-d")); $pdf->addClient("TNEB"); $pdf->addPageNumber("1"); $pdf->addClientAdresse("Ste\nM. XXXX\n3ème étage\n33, rue d'ailleurs\n75000 PARIS"); $pdf->addReglement("Chèque à réception de facture"); $pdf->addEcheance("03/12/2003"); $pdf->addNumTVA("FR888777666"); $pdf->addReference("Devis ... du ...."); $cols=array( "REFERENCE" => 23, "DESIGNATION" => 78, "QUANTITE" => 22, "P.U. HT" => 26, "MONTANT H.T." => 30, "TVA" => 11 ); $pdf->addCols( $cols); $cols=array( "REFERENCE" => "L",
// (c) Xavier Nicolay // Exemple de génération de devis/facture PDF require 'invoice.php'; $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); // $pdf->addSociete( "MaSociete", // "MonAdresse\n" . // "75000 PARIS\n". // "R.C.S. PARIS B 000 000 007\n" . // "Capital : 18000 " . EURO ); //$pdf->fact_dev( "Devis ", "TEMPO" ); //$pdf->temporaire( "Devis temporaire" ); $date = "December 19,2015"; $invoice = "#01-150419-01"; $pdf->addDate($date); $pdf->addInvoice($invoice); //$pdf->addPageNumber("1"); //$pdf->addClientAdresse("Ste\nM. XXXX\n3ème étage\n33, rue d'ailleurs\n75000 PARIS"); //$pdf->addReglement("Chèque à réception de facture"); //$pdf->addEcheance("03/12/2003"); //$pdf->addNumTVA("FR888777666"); //$pdf->addReference("Devis ... du ...."); $name = "Laura Baugh"; $email = "*****@*****.**"; $post = "Brand Director"; $companyName = "Himalayan Dog Chew"; $streetName = "4480 Chennault Beach Road"; $address = "Mulkiteo, WA 98275"; $cols = array(); $cols[0] = $name;
if (!is_dir($repconstratlit)) { mkdir($repconstratlit); } //************************// $pdf = new PDF_Invoice('P', 'mm', 'A4'); $pdf->AddPage(); /*$pdf->addSociete( "MedicA Shop", "MonAdresse\n" . "75000 PARIS\n". "R.C.S. PARIS B 000 000 007\n" . "Capital : 18000" );*/ $pdf->addreflit("REF. DU LIT : " . "MM2- L" . $reflit . " - S", "REF. MOTEUR PRINCIPAL : " . "MM2- L" . $refmoteurpr . " - MP", "REF. MOTEUR R-B : " . "MM2- L" . $refmoteurpr . " - MA", "REF. TELECOMMANDE : " . "MM2- L" . $reftelecommande . " - MC"); //$pdf->fact_dev( "Constrat ", "TEMPO" ); $pdf->fact_dev("CONTRAT LIT DE LOCATION"); $pdf->temporaire("Technique"); $pdf->addDate("{$today}"); $pdf->addEtat("{$etatlitdesc}"); $pdf->Image('img/Sigle.jpg', 10, 10, -360); //$pdf->addClient("CL01"); //$pdf->addPageNumber("1"); //$pdf->addClientAdresse("Ste\nM. XXXX\n3�me �tage\n33, rue d'ailleurs\n75000 PARIS"); //$pdf->addReglement("Ch�que � r�ception de facture"); //$pdf->addEcheance("03/12/2003"); //$pdf->addNumTVA("FR888777666"); //$pdf->addReference("Devis ... du ...."); $cols = array("ETATS" => 67, "OBSERVATIONS" => 142); $pdf->addCols($cols); $cols = array("ETATS" => "L", "OBSERVATIONS" => "C"); $pdf->addLineFormat($cols); $pdf->addLineFormat($cols); $y = 109;