70 lines
2.2 KiB
PHP
70 lines
2.2 KiB
PHP
<?php
|
|
include_once(__DIR__."/../../../core.php");
|
|
/*
|
|
MOVIMENTI MAGAZZINO
|
|
*/
|
|
echo "<h3>Movimenti</h3>\n";
|
|
|
|
//Calcolo la quantità dai movimenti in magazzino
|
|
$rst = $dbo->fetchArray("SELECT SUM(qta) AS qta_totale FROM mg_movimenti WHERE idarticolo='".$id_record."'");
|
|
$qta_totale = $rst[0]['qta_totale'];
|
|
echo "<p>Quantità calcolata dai movimenti: ".number_format( $qta_totale, get_var("Cifre decimali"), ",", "." )." ".$rs[0]['unita_misura']."</p>\n";
|
|
|
|
|
|
//Elenco movimenti magazzino
|
|
$query = "SELECT * FROM mg_movimenti WHERE idarticolo='".$id_record."'";
|
|
|
|
( !isset($_GET['show_all1']) || $_GET['show_all1']=='' ) ? $show_all='0' : $show_all=$_GET['show_all1'];
|
|
$query .= " ORDER BY data DESC";
|
|
if( $show_all=='0' )
|
|
$query .= " LIMIT 0, 20";
|
|
|
|
$rs2 = $dbo->fetchArray($query);
|
|
|
|
if( sizeof($rs2)==0 ){
|
|
echo "<p>"._("Nessun movimento")."...</p>\n";
|
|
echo "<a href='".$rootdir."/editor.php?id_module=".$id_module."&id_record=".$id_record."&show_all1=1#tab_2'>[ Mostra tutti i movimenti ]</a>\n";
|
|
}
|
|
else{
|
|
if( $_GET['show_all1']=='1' )
|
|
echo "<a href='".$rootdir."/editor.php?id_module=".$id_module."&id_record=".$id_record."&show_all1=0#tab_2'>[ Mostra solo gli ultimi 20 movimenti ]</a>\n";
|
|
else
|
|
echo "<a href='".$rootdir."/editor.php?id_module=".$id_module."&id_record=".$id_record."&show_all1=1#tab_2'>[ Mostra tutti i movimenti ]</a>\n";
|
|
|
|
echo "<br /><br />\n";
|
|
echo "<table class=\"table table-striped table-condensed table-bordered\">\n";
|
|
echo "<tr><th class='text-center' width='100'>\n";
|
|
echo "Q.tà\n";
|
|
echo "</th>\n";
|
|
|
|
echo "<th width='720'>\n";
|
|
echo "Causale\n";
|
|
echo "</th>\n";
|
|
|
|
echo "<th>\n";
|
|
echo "Data\n";
|
|
echo "</th></tr>\n";
|
|
|
|
for( $i=0; $i<sizeof($rs2); $i++ ){
|
|
//Quantità
|
|
echo "<tr><td class='text-right'>\n";
|
|
echo "<span>".number_format( $rs2[$i]['qta'], get_var("Cifre decimali"), ",", "." )."</span>\n";
|
|
echo "</td>\n";
|
|
|
|
|
|
//Causale
|
|
echo "<td class='table_cell'>\n";
|
|
echo "<span>".$rs2[$i]['movimento']."</span>\n";
|
|
echo "</td>\n";
|
|
|
|
|
|
//Data
|
|
echo "<td class='table_cell center'>\n";
|
|
echo "<span>".date( "d/m/Y H:i:s", strtotime($rs2[$i]['data']) )."</span>\n";
|
|
echo "</td></tr>\n";
|
|
}
|
|
echo "</table>\n";
|
|
}
|
|
echo "<br/><br/>\n";
|
|
?>
|