fetchArray("SELECT *, mg_articoli.id AS id_articolo, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 0 AND mg_categorie.id = mg_articoli.id_categoria) AS categoria, (SELECT nome FROM mg_categorie WHERE mg_categorie.parent = 1 AND mg_categorie.id = mg_articoli.id_sottocategoria) AS subcategoria FROM mg_articoli WHERE ( replace(codice,'.','') LIKE \"%$search_codice%\" OR codice LIKE \"%$search_codice%\" ) AND replace(descrizione,'.','') LIKE \"%$search_descrizione%\" ".$add_where." AND qta > 0 HAVING CONCAT_WS( ' ', categoria, subcategoria ) LIKE \"%".$search_categoria.'%" ORDER BY codice ASC'); $totrows = sizeof($rs); $body .= '

INVENTARIO AL '.date('d/m/Y')."

\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; for ($r = 0; $r < sizeof($rs); ++$r) { $body .= "\n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= " \n"; $body .= "\n"; $totale_qta += $rs[$r]['qta']; $totale_acquisto += ($rs[$r]['prezzo_acquisto'] * $rs[$r]['qta']); } // Totali $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "\n"; $body .= "
CodiceDescrizionePrezzo di venditaQ.tàPrezzo di acquistoValore totale
".$rs[$r]['codice']."".$rs[$r]['descrizione']."".Translator::numberToLocale($rs[$r]['prezzo_vendita'])." €".$rs[$r]['um'].' '.Translator::numberToLocale($rs[$r]['qta'])."".Translator::numberToLocale($rs[$r]['prezzo_acquisto'])." €".Translator::numberToLocale(($rs[$r]['prezzo_acquisto'] * $rs[$r]['qta']))." €
TOTALE:".Translator::numberToLocale($totale_qta)."".Translator::numberToLocale($totale_acquisto)." €
\n"; $report_name = 'inventario.pdf';