Aggiornamento quantità inventario

This commit is contained in:
Thomas Zilio 2018-09-04 10:56:03 +02:00
parent 4fd9f1e57e
commit 1b1d3753cf
1 changed files with 4 additions and 2 deletions

View File

@ -50,11 +50,13 @@ include_once $docroot.'/templates/pdfgen_variables.php';
// LEFT OUTER JOIN mg_unitamisura ON mg_unitamisura.id=mg_articoli.idum // LEFT OUTER JOIN mg_unitamisura ON mg_unitamisura.id=mg_articoli.idum
// mg_unitamisura.valore AS um // mg_unitamisura.valore AS um
// LEFT OUTER JOIN mg_categorie ON (mg_categorie.id=mg_articoli.id_categoria AND mg_categorie.parent = 0) OR (mg_categorie.id=mg_articoli.id_sottocategoria AND mg_categorie.parent = 1) // LEFT OUTER JOIN mg_categorie ON (mg_categorie.id=mg_articoli.id_categoria AND mg_categorie.parent = 0) OR (mg_categorie.id=mg_articoli.id_sottocategoria AND mg_categorie.parent = 1)
$query = '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 1=1 '.$add_where.' AND qta > 0 HAVING 2=2 '.$add_having.' ORDER BY codice ASC'; $period_end = $_SESSION['period_end'];
$query = '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, (SELECT SUM(qta) FROM mg_movimenti WHERE mg_movimenti.idarticolo=mg_articoli.id AND (mg_movimenti.idintervento IS NULL OR mg_movimenti.idautomezzo = 0) AND data <= '.prepare($period_end).' ) AS qta FROM mg_articoli WHERE 1=1 '.$add_where.' HAVING 2=2 '.$add_having.' ORDER BY codice ASC';
$rs = $dbo->fetchArray($query); $rs = $dbo->fetchArray($query);
$totrows = sizeof($rs); $totrows = sizeof($rs);
$body .= '<h3>INVENTARIO AL '.date('d/m/Y')."</h3>\n"; $body .= '<h3>INVENTARIO AL '.Translator::dateToLocale($period_end)."</h3>\n";
$body .= "<table cellspacing='0' style='table-layout:fixed;'>\n"; $body .= "<table cellspacing='0' style='table-layout:fixed;'>\n";
$body .= "<col width='100'><col width='230'><col width='70'><col width='70'><col width='70'><col width='90'>\n"; $body .= "<col width='100'><col width='230'><col width='70'><col width='70'><col width='70'><col width='90'>\n";