Exemplo n.º 1
0
$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();
Exemplo n.º 2
0
}
$linetotales = split('Traslado', $f->xml);
//echo $linetotales[2];
$arrelinetotales = split('"', $linetotales[2]);
//echo "xxxxx".$arrelinetotales[1];
$subtotal = $subtgeneral;
$ivatotal = $arrelinetotales[1];
//$ivaret   	 = $arrelinetotales[1];
$total = $arrelinetotales[1] + $subtgeneral - $ivaret;
$numalet = new CNumeroaletra();
$numalet->setNumero(round($total, 2));
$pdf->addNumeroLetra($numalet->letra());
$fecha = substr($xml[23], 0, 16);
//$fecha = $fec[2]."/".$fec[1]."/".$fec[0];
$pfolio = split("folio", $f->xml);
$pfolio = split('"', $pfolio[1]);
$pdf->addCadreEurosFrancs($fecha, $pfolio[1], $f->lasucursal);
$pdf->addTotales(number_format(round($subtotal, 2), 2, '.', ','), number_format(round($ivatotal, 2), 2, '.', ','), number_format(round($ivaret, 2), 2, '.', ','), number_format(round($total, 2), 2, '.', ','));
$aproba = split(" noAprobacion=", $f->xml);
$aproba = split('"', $aproba[1]);
$serie = split(" serie=", $f->xml);
$serie = split('"', $serie[1]);
$anoAp = split(" anoAprobacion=", $f->xml);
$anoAp = split('"', $anoAp[1]);
$pdf->tituloFactura("FACTURA");
$pdf->addSerieAprobacion($serie[1], $aproba[1], $anoAp[1]);
$pdf->addNumeroAno($f->tipopago, $f->tipofactura);
$pdf->addCertificado($f->seriefactura);
$pdf->addDirSucursal("EMITIDA EN {$f->nombresucursal}", "{$f->calle} {$f->numero}, CP {$f->cp}, {$f->colonia}");
$pdf->addLeyenda(utf8_decode("Este Documento es una representación impresa de un CFD"));
$pdf->Output();
Exemplo n.º 3
0
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))));
}
Exemplo n.º 4
0
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");
}
 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();
 }