gest366/modules/my_impianti/row-list.php

71 lines
2.6 KiB
PHP
Raw Permalink Normal View History

2021-02-24 20:40:04 +00:00
<?php
if( $docroot == '' ){
die( _("Accesso negato!") );
}
/*
ARTICOLI + RIGHE GENERICHE
*/
$q_art = "SELECT *, IFNULL((SELECT codice FROM mg_articoli WHERE id=idarticolo),'') AS codice, IFNULL((SELECT descrizione FROM co_iva WHERE id=idiva),'') AS desc_iva FROM my_impianti_righe WHERE matricola='".$id_record."'";
$rs_art = $dbo->fetchArray( $q_art );
$tot_art = sizeof($rs_art);
//se ho almeno un articolo caricato mostro la riga
if( $tot_art>0 ){
for( $i=0; $i<$tot_art; $i++ ){
echo "<tr><td>\n";
if( $rs_art[$i]['idarticolo'] != '0' ){
echo " <a href='".$rootdir."/editor.php?id_module=".$modules_info['Articoli']['id']."&id_record=".$rs_art[$i]['idarticolo']."' target='_blank'>".nl2br( html_entity_decode($rs_art[$i]['codice']." - ".$rs_art[$i]['descrizione'], ENT_QUOTES, "utf-8") )."</a>\n";
} else {
echo nl2br( html_entity_decode($rs_art[$i]['descrizione'], ENT_QUOTES, "utf-8") )."\n";
}
echo "</td>\n";
//q.tà
echo "<td class='text-center'>\n";
echo " ".number_format($rs_art[$i]['qta']-$rs_art[$i]['qta_evasa'], get_var("Cifre decimali"), ",", ".")."\n";
echo "</td>\n";
//Seriale
echo "<td class='text-center'>\n";
echo " ".$rs_art[$i]['n_seriale']."\n";
echo "</td>\n";
//Possibilità di rimuovere una riga solo se il preventivo non è stato pagato
echo "<td class='text-center'>\n";
echo " </form><form action='".$rootdir."/editor.php?id_module=".$modules_info['Installazioni']['id']."&id_record=".$id_record."' method='post' id='delete-form-".$rs_art[$i]['id']."' role='form'>\n";
echo " <input type='hidden' name='backto' value='record-edit'>\n";
echo " <input type='hidden' name='id_record' value='".$id_record."'>\n";
echo " <input type='hidden' name='op' value='unlink_articolo'>\n";
echo " <input type='hidden' name='idriga' value='".$rs_art[$i]['id']."'>\n";
echo " <input type='hidden' name='idarticolo' value='".$rs_art[$i]['idarticolo']."'>\n";
echo " <div class='btn-group'>\n";
echo " <a class='btn btn-xs btn-warning' title='Modifica riga' onclick=\"launch_modal( 'Modifica riga', '".$rootdir."/modules/my_impianti/edit_riga.php?matricola=".$id_record."&idriga=".$rs_art[$i]['id']."', 1 );\"><i class='fa fa-edit'></i></a>\n";
echo " <a href='javascript:;' class='btn btn-xs btn-danger' title='Rimuovi questa riga' onclick=\"if( confirm('Rimuovere questa riga ?') ){ $('#delete-form-".$rs_art[$i]['id']."').submit(); }\"><i class='fa fa-trash-o'></i></a>\n";
echo " </div>\n";
echo " </form><form>\n";
echo "</td></tr>\n";
}
}
?>