$nbFac = strlen($FAC_NUM); if ($row['FAC_NUM'] == "") { $pdf->fact_dev("Proforma", $FAC_NUM, $FAC_DATE, $entreprise['ENT_VILLE']); $pdf->temporaire("PROFORMA"); $nomfic = "impressions/" . $FAC_NUM . ".pdf"; } else { if ($row['FAC_AVO'] != "") { $pdf->fact_dev("Avoir", $FAC_NUM, $FAC_DATE, $entreprise['ENT_VILLE']); } else { $pdf->fact_dev("Facture", $FAC_NUM, $FAC_DATE, $entreprise['ENT_VILLE']); } $nomfic = "impressions/" . $FAC_NUM . "-" . $FAC_COMPTEUR . ".pdf"; } $pdf->addClient($FAC_NOMCLI, $FAC_ADR1, $FAC_ADR2, $FAC_CP, $FAC_VILLE); if ($row['FAC_AVO'] == "") { $pdf->addReference($FAC_NUMCMDE, $FAC_CODCLI, $FAC_NOMCTC, $FAC_CODFOU, $FAC_NOMCOM); } else { $pdf->addReference($FAC_NUMCMDE, $FAC_CODCLI, $FAC_NOMCTC, $FAC_CODFOU, $FAC_NOMCOM, $FAC_NUM); } //////////////////////////// //Ajout élément à facturer// //////////////////////////// // $y = 80; if ($row['FAC_AVO'] != "") { $size = $pdf->addLine($y, $line, $designation, $bottomLine, $FAC_COMMENTAIRE); } else { $size = $pdf->addLine($y, $line, $designation, $bottomLine); } //$pdf->conditionGeneral($FAC_CON_VENTE.' ', $FAC_PENALITE.' ', $contact, $banque, $entreprise, $FAC_REG); if ($row['FAC_AVO'] == "") {
// (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,
$f = mysql_fetch_object($r); $ivaret = $f->otrosivaretenido + $f->sobivaretenido + $f->ivaretenido; $pdf->addReglement5("Razón Social: " . strtoupper($f->nombre)); $pdf->addReglement6("Domicilio: " . strtoupper($f->calle1) . " No " . $f->n1); $pdf->addReglement7("Colonia: " . strtoupper($f->colonia1)); $pdf->addReglement8("CP: " . $f->cp1); $pdf->addReglement9("Población: " . strtoupper($f->p1) . ", " . $f->e1); $pdf->addReglement10("RFC: " . strtoupper($f->rfc)); $pdf->addCadenaOriginal($f->cadenaoriginal); $xml = split('"', $f->xml); //echo $cosa[19]; $pdf->addSelloOriginal($xml[19]); //$pdf->addSerie("15"); //$pdf->addEcheance("03/12/2003"); //$pdf->addNumTVA("FR888777666"); $pdf->addReference(""); # estaba IMPORTE 30 $cols = array("CANTIDAD" => 30, "CONCEPTO" => 110, "IMPORTE" => 50); $pdf->addCols($cols); $cols = array("CANTIDAD" => "C", "CONCEPTO" => "L", "IMPORTE" => "R"); $pdf->addLineFormat($cols); $conceptos = split('Concepto', $f->xml); $y = 95; $pdf->SetFont("Arial", "B", 7); $subtgeneral = 0; for ($i = 2; $i < count($conceptos) - 1; $i++) { $arreline = split('"', $conceptos[$i]); $line = array("CANTIDAD" => $arreline[1], "CONCEPTO" => $arreline[3] != "" ? $arreline[3] : "GUIA", "IMPORTE" => number_format($arreline[7], 2, '.', ','), "" => ""); // echo "$arreline[1] $arreline[3] $arreline[7]<br>"; // echo "pdf -> addLine( $y, $line )<br>"; $subtgeneral += $arreline[7];
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"); }
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)))); }
$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(); $lines = file($filename); foreach ($lines as $thisline) { $thisline = trim($thisline); if (!empty($thisline)) { list($id, $id_item, $category, $subcategory, $title, $filename, $digital, $folder, $currency, $weight, $price1, $quantity, $option1, $option2, $tax, $ship1, $discount1, $discount2, $ip_name) = explode('|', $thisline); $re = $price1 / (1 + $TaxSetup[1]);
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(); }