fetchArray($q); $numero_ord = $rs[0]['numero']; $idcliente = $rs[0]['idanagrafica']; ( $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( "pdfgen_variables.php" ); //Dati generici fattura $body .= "
".$rs[0]['tipo_doc']." no $numero | \n";
$body .= "Data: ".date( "d/m/Y", strtotime($rs[0]['data']) )." | \n";
$body .= "Pagamento: ".$rs[0]['tipo_pagamento']." | \n";
$consegna=$rsd[0]['datap'].date( "d/m/Y", strtotime($rs[0]['data_prevista_consegna']));
if( $consegna == '01/01/1970' ) $consegna="" ;
$body .= "- "." |
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_art']!='' ){ $body .= " Codice: ".$rs_art[$i]['codice_art']."\n"; } $body .= " | \n";
$body .= "\n"; $body .= number_format($rs_art[$i]['sumqta'], 1, ",", "")."\n"; $body .= " | \n"; $body .= "\n"; $body .= $rs_art[$i]['um']."\n"; $body .= " | \n"; $body .= "\n"; if( $show_costi ) $body .= number_format( $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 .= number_format( $iva, 2, ",", "." )." €\n"; else $body .= "-"; $body .= " | \n"; //Imponibile $body .= "\n";
if( $show_costi ){
$body .= number_format( $rs_art[$i]['subtotale'], 2, ",", "." )." €\n";
if( $rs_art[$i]['sconto']>0 )
$body .= " \n- sconto ".number_format( $rs_art[$i]['sconto'], 2, ",", "." )." €\n"; } else $body .= "-"; $body .= " |
\n"; $body .= nl2br( $rs_gen[$i]['descrizione'] ); $body .= " | \n"; $body .= "\n"; $body .= number_format($rs_gen[$i]['qta'], 1, ",", "")."\n"; $body .= " | \n"; $body .= "\n"; $body .= $rs_gen[$i]['um']."\n"; $body .= " | \n"; $body .= "\n"; if( $show_costi ) $body .= number_format( $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 .= number_format( $iva, 2, ",", "." )." €\n"; else $body .= "-"; $body .= " | \n"; //Imponibile $body .= "\n";
if( $show_costi ){
$body .= number_format( $rs_gen[$i]['subtotale'], 2, ",", "." )." €\n";
if( $rs_gen[$i]['sconto']>0 )
$body .= " \n- sconto ".number_format( $rs_gen[$i]['sconto'], 2, ",", "." )." €\n"; } else $body .= "-"; $body .= " |
\n"; $body .= "Totale imponibile:"; $body .= " | \n"; $body .= "\n"; $body .= number_format( $imponibile_ordine, 2, ",", "." )." €"; $body .= " | ||||
\n"; $body .= "Sconto:"; $body .= " | \n"; //Sconto $body .= "\n"; $body .= number_format( $sconto, 2, ",", "." )." €"; $body .= " | "; $body .= "||||
\n"; $body .= "Totale scontato:"; $body .= " | \n"; //Sconto $body .= "\n"; $totale_ordine = $imponibile_ordine-$sconto; $body .= number_format( $totale_ordine, 2, ",", "." )." €"; $body .= " | ||||
\n"; $body .= "Rivalsa INPS:"; $body .= " | \n"; //Rivalsa INPS $body .= "\n"; $body .= number_format( $rs[0]['rivalsainps'], 2, ",", "." )." €"; $body .= " | ||||
\n"; $body .= "Iva:"; $body .= " | \n"; //Iva $body .= "\n"; $body .= number_format( $totale_iva, 2, ",", "." )." €\n"; $body .= " | ||||
\n"; $body .= "Totale ordine:"; $body .= " | \n"; $body .= "\n"; $body .= "".number_format( $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 .= number_format( $marca_da_bollo, 2, ",", "." )." €"; $body .= " | ||||
\n"; $body .= "Ritenuta d'acconto:"; $body .= " | \n"; //Ritenuta d'acconto $body .= "\n"; $body .= number_format( $rs[0]['ritenutaacconto'], 2, ",", "." )." €"; $body .= " | ||||
\n"; $body .= "Netto a pagare:"; $body .= " | \n"; $body .= "\n"; $body .= "".number_format( $netto_a_pagare, 2, ",", "." )." €\n"; $body .= " |
".nl2br($rs[0]['note'])."
\n"; $report_name = "Ordine_".$numero_ord.".pdf"; ?>