Exemplo n.º 1
0
// (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,
Exemplo n.º 2
0
$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'];
}
$pdf->addNumTVA($p);
$cols = array("ID" => 13, $cfg['lang_description'] => 92, $cfg['lang_qty'] => 15, $cfg['lang_netprice'] => 20, $cfg['lang_taxes'] => 20, $cfg['lang_amount'] => 30);
$pdf->addCols($cols);
$cols = array("ID" => "L", $cfg['lang_description'] => "L", $cfg['lang_qty'] => "C", $cfg['lang_netprice'] => "C", $cfg['lang_taxes'] => "C", $cfg['lang_amount'] => "R");
$pdf->addLineFormat($cols);
$pdf->addLineFormat($cols);
$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, '%');
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
$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();
    $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);
 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();
 }
Exemplo n.º 6
0
               "Reading Start"     => $row['meter_reading_start'],
               "Reading  End"      => $row['meter_reading_end'],
               "Total Units" => $row['total_units'],
               "Amt"          => calculate_bill3($row['total_units'])
               );

  $size = $pdf->addLine( $y, $line );
  $y   += $size + 2;

  $totalunits += $row['total_units'];

  if($totalleng-$k) 
    $pdf->addEcheance($row['consumer_id']); 
    
  if($totalleng==$k)
    $pdf->addNumTVA($totalunits);
    
  $k++;
}





//$pdf->addCadreTVAs();
        
// invoice = array( "px_unit" => value,
//                  "qte"     => qte,
//                  "tva"     => code_tva );
// tab_tva = array( "1"       => 19.6,
//                  "2"       => 5.5, ... );