fetchArray($q); $numero_ord = $rs[0]['numero']; $idcliente = $rs[0]['idanagrafica']; (!empty($rs[0]['numero_esterno'])) ? $numero = $rs[0]['numero_esterno'] : $numero = $rs[0]['numero']; // Lettura righe ordine $q2 = "SELECT * FROM or_righe_ordini WHERE idordine='".$idordine."'"; $righe = $dbo->fetchArray($q2); // carica report html $report = file_get_contents($docroot.'/templates/ordini/ordine.html'); $body = file_get_contents($docroot.'/templates/ordini/ordine_body.html'); include_once $docroot.'/templates/pdfgen_variables.php'; // Dati generici fattura $body .= "
".$rs[0]['tipo_doc']." no $numero | \n";
$body .= "Data: ".Translator::dateToLocale($rs[0]['data'])." | \n";
$body .= "Pagamento: ".$rs[0]['tipo_pagamento']." |
Descrizione | \n"; $body .= "Q.tà | \n"; $body .= "u.m. | \n"; $body .= "Costo unitario | \n"; $body .= "Iva | \n"; $body .= "Imponibile |
---|---|---|---|---|---|
\n";
$body .= nl2br($rs_art[$i]['descrizione']);
if ($rs_art[$i]['codice'] != '') {
$body .= ' '.$rs_art[$i]['codice']."\n"; } $body .= " | \n";
$body .= "\n"; $body .= Translator::numberToLocale($rs_art[$i]['sumqta'], 2)."\n"; $body .= " | \n"; $body .= "\n"; $body .= $rs_art[$i]['um']."\n"; $body .= " | \n"; $body .= "\n"; if ($show_costi) { $body .= Translator::numberToLocale($rs_art[$i]['subtotale'] / $rs_art[$i]['sumqta'], 2)." €\n"; } else { $body .= '-'; } $body .= " | \n"; // Iva $body .= "\n"; $iva = $rs_art[$i]['iva']; if ($show_costi) { $body .= Translator::numberToLocale($iva, 2)." €\n"; } else { $body .= '-'; } $body .= " | \n"; // Imponibile $body .= "\n";
if ($show_costi) {
$body .= Translator::numberToLocale($rs_art[$i]['subtotale'], 2)." €\n";
if ($rs_art[$i]['sconto'] > 0) {
$body .= " \n- sconto ".Translator::numberToLocale($rs_art[$i]['sconto'], 2)." €\n"; } } else { $body .= '-'; } $body .= " |
\n"; $body .= nl2br($rs_gen[$i]['descrizione']); $body .= " | \n"; $body .= "\n"; $body .= Translator::numberToLocale($rs_gen[$i]['qta'], 2)."\n"; $body .= " | \n"; $body .= "\n"; $body .= $rs_gen[$i]['um']."\n"; $body .= " | \n"; $body .= "\n"; if ($show_costi) { $body .= Translator::numberToLocale($rs_gen[$i]['subtotale'] / $rs_gen[$i]['qta'], 2)." €\n"; } else { $body .= '-'; } $body .= " | \n"; // Iva $body .= "\n"; $iva = $rs_gen[$i]['iva']; if ($show_costi) { $body .= Translator::numberToLocale($iva, 2)." €\n"; } else { $body .= '-'; } $body .= " | \n"; // Imponibile $body .= "\n";
if ($show_costi) {
$body .= Translator::numberToLocale($rs_gen[$i]['subtotale'], 2)." €\n";
if ($rs_gen[$i]['sconto'] > 0) {
$body .= " \n- sconto ".Translator::numberToLocale($rs_gen[$i]['sconto'], 2)." €\n"; } } else { $body .= '-'; } $body .= " |
\n"; $body .= 'Totale imponibile:'; $body .= " | \n"; $body .= "\n"; $body .= Translator::numberToLocale($imponibile_ordine, 2).' €'; $body .= " | ||||
\n"; $body .= 'Sconto:'; $body .= " | \n"; // Sconto $body .= "\n"; $body .= Translator::numberToLocale($sconto, 2).' €'; $body .= ' | '; $body .= "||||
\n"; $body .= 'Totale scontato:'; $body .= " | \n"; // Sconto $body .= "\n"; $totale_ordine = $imponibile_ordine - $sconto; $body .= Translator::numberToLocale($totale_ordine, 2).' €'; $body .= " | ||||
\n"; $body .= 'Rivalsa INPS:'; $body .= " | \n"; // Rivalsa INPS $body .= "\n"; $body .= Translator::numberToLocale($rs[0]['rivalsainps'], 2).' €'; $body .= " | ||||
\n"; $body .= 'Iva:'; $body .= " | \n"; // Iva $body .= "\n"; $body .= Translator::numberToLocale($totale_iva, 2)." €\n"; $body .= " | ||||
\n"; $body .= 'Totale ordine:'; $body .= " | \n"; $body .= "\n"; $body .= ''.Translator::numberToLocale($totale_ordine, 2)." €\n"; $body .= " | ||||
\n"; $body .= 'Marca da bollo:'; $body .= " | \n"; // Marca da bollo $body .= "\n"; $marca_da_bollo = str_replace(',', '.', $rs[0]['bollo']); $body .= Translator::numberToLocale($marca_da_bollo, 2).' €'; $body .= " | ||||
\n"; $body .= "Ritenuta d'acconto:"; $body .= " | \n"; // Ritenuta d'acconto $body .= "\n"; $body .= Translator::numberToLocale($rs[0]['ritenutaacconto'], 2).' €'; $body .= " | ||||
\n"; $body .= 'Netto a pagare:'; $body .= " | \n"; $body .= "\n"; $body .= ''.Translator::numberToLocale($netto_a_pagare, 2)." €\n"; $body .= " |
'.nl2br($rs[0]['note'])."
\n"; $report_name = 'Ordine_'.$numero_ord.'.pdf';