$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();
$pdf->SetFont("Arial", "B", 9); $pdf->SetXY(121, 241.5); $pdf->Cell($longitud, 2, "\$ {$valortotal}"); $pdf->SetFont("Arial", "B", 5); $pdf->SetXY(158, 225); $pdf->Cell($longitud, 2, utf8_decode("-PAGUE ÚNICAMENTE EN EFECTIVO-")); $pdf->SetFont("Arial", "B", 6); $pdf->SetXY(67, 248.5); $pdf->Cell($longitud, 2, "-COPIA ESTUDIANTE-"); $pdf->SetFont("Arial", "", 7); $pdf->SetXY(154, 248.5); $pdf->Cell($longitud, 2, "-Espacio para timbre o sello del Banco-"); $pdf->SetFont("helvetica", "i", 8); $pdf->SetXY(14, 252); $pdf->Cell($longitud, 2, utf8_decode("Le informamos que una vez matriculado por ningún motivo se hará devolución del dinero ni cambio de grupo.")); $pdf->SetFont("Arial", "B", 6); $pdf->SetFont("helvetica", "i", 8); $pdf->SetXY(14, 256); $pdf->Cell($longitud, 2, utf8_decode("El USUARIO al cancelar el presente servicio manifiesta conocer y aceptar las condiciones aquí dispuestas.")); $pdf->SetFont("Arial", "B", 6); $_SESSION["olvidable"] = 1; $nombre_recibo = "recibos_generados/" . $_POST[cedula] . "_" . $numatricula . ".pdf"; $pdf->Output($nombre_recibo, 'F'); mysql_query("INSERT INTO `recibos` (`id`, `nombre`, `identificacion`, `num_inscripcion`, `programa`, `periodo`, `nivel`, `grupo`, `carne`, `valor`, `archivo`) VALUES (NULL, '" . $nombrecompletoestudiante . "', '" . $_POST[cedula] . "', '" . $numatricula . "', '" . $nombreprograma . "', '" . $recibonumeroperiodo . "', '" . $recibonombrenivel . "', '" . $numerogrupo . "', '" . $recibocarne . "', '" . $valortotal . "', '" . $nombre_recibo . "')", $link); echo "<center><b>" . $nombrecompletoestudiante . " Su recibo se generó adecuadamente, si necesita una copia vaya al link de consulta de recibo.<br>"; echo "<a href=" . $nombre_recibo . ">DESCARGAR RECIBO</a></b><br></center>"; //$pdf->Output(); ?>
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"); }
} else { $size = $pdf->addLine($y, $line, $designation, $bottomLine); } //$pdf->conditionGeneral($FAC_CON_VENTE.' ', $FAC_PENALITE.' ', $contact, $banque, $entreprise, $FAC_REG); if ($row['FAC_AVO'] == "") { $pdf->conditionGeneral($entreprise['ENT_LOGOPIED'], $entreprise, $titre[0], $pave[0], $titre[1], $pave[1], $contact, $banque, $reg); } else { $pdf->conditionGeneral($entreprise['ENT_LOGOPIED'], $entreprise); } if ($row['FAC_NUM'] != '') { switch ($FAC_COMPTEUR) { case 0: $nom = 'Exemplaire client'; break; case 1: $nom = 'Exemplaire ' . $entreprise['ENT_NOM']; break; default: $nom = 'DUPLICATA'; break; } $pdf->compteur($nom); } $pdf->Output($nomfic, 'IF'); // Mise à jour du compteur d'impression de facture if ($row['FAC_NUM'] != '') { // SI ON ARRIVE LA, C'EST QUE LA FACTURE EST IMPRIMEE CORRECTEMENT $FAC_COMPTEUR = $FAC_COMPTEUR + 1; $qmajfac = 'UPDATE FACTURE SET FAC_COMPTEUR="' . $FAC_COMPTEUR . '" WHERE FAC_NO=' . $row['FAC_NO']; $rmajfac = $GLOBALS['connexion']->query($qmajfac); }
$y = 109; $res = mysql_query("select * from products where invoice='" . $info['id'] . "' order by id asc") or die(mysql_error()); $i = 1; while ($rand = mysql_fetch_array($res)) { unset($tx); $tx = array(); $taxprod = 0; $tx = explode(',', $rand['taxes']); foreach ($tx as $tax) { $pos1 = strpos($tax, '%'); $tm = str_replace('%', '', $tax); if ($pos1 !== false) { $taxprod += $tm * $rand['price'] * $rand['qty'] / 100; } else { $taxprod += $tm; } } $line = array("ID" => $i, $cfg['lang_description'] => substr($rand['title'], 0, 200) . "\n" . substr($rand['description'], 0, 180), $cfg['lang_qty'] => $rand['qty'], $cfg['lang_netprice'] => $rand['price'] * $rand['qty'] . ' ' . $info['currency'], $cfg['lang_taxes'] => $taxprod . ' ' . $info['currency'], $cfg['lang_amount'] => $rand['price'] * $rand['qty'] + $taxprod . " " . $info['currency']); $size = $pdf->addLine($y, $line); $y += $size + 2; $totals += $rand['qty'] * $rand['price']; $taxes += $taxprod; $i++; } $pdf->addTVAs($totals, $taxes, $i); $pdf->addCadreEurosFrancs(); if ($cfg['footer']) { $pdf->footerNote($cfg['footer']); } $pdf->Output(dirname(__FILE__) . '/invoices/' . $_GET['id'] . ".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)))); }
$y = 109; $res = mysql_query("select * from products where invoice='" . $info['id'] . "' order by id asc") or die(mysql_error()); $i = 1; while ($rand = mysql_fetch_array($res)) { unset($tx); $tx = array(); $taxprod = 0; $tx = explode(',', $rand['taxes']); foreach ($tx as $tax) { $pos1 = stripos($tax, '%'); $tm = str_replace('%', '', $tax); if ($pos1 !== false) { $taxprod += $tm * $rand['price'] * $rand['qty'] / 100; } else { $taxprod += $tm; } } $line = array("ID" => $i, $cfg['lang_description'] => $rand['title'] . "\n" . $rand['description'], $cfg['lang_qty'] => $rand['qty'], $cfg['lang_netprice'] => $rand['price'] * $rand['qty'] . ' ' . $info['currency'], $cfg['lang_taxes'] => $taxprod . ' ' . $info['currency'], $cfg['lang_amount'] => $rand['price'] * $rand['qty'] + $taxprod . " " . $info['currency']); $size = $pdf->addLine($y, $line); $y += $size + 2; $totals += $rand['qty'] * $rand['price']; $taxes += $taxprod; $i++; } $pdf->addTVAs($totals, $taxes, $i); $pdf->addCadreEurosFrancs(); if ($cfg['footer']) { $pdf->footerNote($cfg['footer']); } $pdf->Output('../inc/invoices/' . $_GET['id'] . ".pdf", 'F');
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(); }
$y = 109; $res = mysql_query("select * from products where invoice='" . $info['id'] . "' order by id asc") or die(mysql_error()); $i = 1; while ($rand = mysql_fetch_array($res)) { unset($tx); $tx = array(); $taxprod = 0; $tx = explode(',', $rand['taxes']); foreach ($tx as $tax) { $pos1 = strpos($tax, '%'); $tm = str_replace('%', '', $tax); if ($pos1 !== false) { $taxprod += $tm * $rand['price'] * $rand['qty'] / 100; } else { $taxprod += $tm; } } $line = array("ID" => $i, $cfg['lang_description'] => substr($rand['title'], 0, 200) . "\n" . substr($rand['description'], 0, 180), $cfg['lang_qty'] => $rand['qty'], $cfg['lang_netprice'] => $rand['price'] * $rand['qty'] . ' ' . $info['currency'], $cfg['lang_taxes'] => $taxprod . ' ' . $info['currency'], $cfg['lang_amount'] => $rand['price'] * $rand['qty'] + $taxprod . " " . $info['currency']); $size = $pdf->addLine($y, $line); $y += $size + 2; $totals += $rand['qty'] * $rand['price']; $taxes += $taxprod; $i++; } $pdf->addTVAs($totals, $taxes, $i); $pdf->addCadreEurosFrancs(); if ($cfg['footer']) { $pdf->footerNote($cfg['footer']); } $pdf->Output('Invoice' . $id_invoice . ".pdf", 'D');