gest366/modules/ordini/add_serial.php

89 lines
2.4 KiB
PHP
Raw Normal View History

2021-02-24 20:40:04 +00:00
<?php
$dir = 'uscita';
$module_name = 'Ordini fornitore';
include_once(__DIR__."/../../core.php");
$idordine = $html->form('idordine');
$idriga = $html->form('idriga');
//Info ordine
$q = "SELECT * FROM or_ordini WHERE id='".$idordine."'";
$rs = $dbo->fetchArray($q);
( $rs[0]['numero_esterno'] != '' ) ? $numero=$rs[0]['numero_esterno'] : $numero=$rs[0]['numero'];
$idanagrafica = $rs[0]['idanagrafica'];
//Info riga inserita
$q = "SELECT * FROM or_righe_ordini WHERE idordine='".$idordine."' AND id='".$idriga."'";
$rsr = $dbo->fetchArray($q);
$serials = array_column($dbo->fetchArray('SELECT serial FROM mg_prodotti WHERE serial IS NOT NULL AND id_riga_ordine='.($idriga )), 'serial');
/*
Form di modifica riga ordine
*/
echo "<label>Ordine numero ".$numero."</label><br><br>\n";
echo "<form id=\"link_form\" action=\"".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$idordine."\" method=\"post\">\n";
echo " <input type='hidden' name='op' value='add_seriale'>\n";
echo " <input type='hidden' name='idriga' value='".$idriga."'>\n";
echo " <input type='hidden' name='backto' value='record-edit'>\n";
echo " <input type='hidden' name='dir' value='".$dir."'>\n";
//Descrizione
echo " <div class='row'>\n";
echo " <div class='col-md-12'>\n";
echo " <label>Descrizione</label>\n";
echo " <textarea name=\"descrizione\" id=\"descrizione\" class='form-control' >".$rsr[0]['descrizione']."</textarea>\n";
echo " </div>\n";
echo " </div>\n";
echo " <div class='row'>\n";
for( $i=0; $i<$rsr[0]['qta']; $i++ ){
//Seriale da inserire
$num=$i+1;
echo " <div class='col-md-3'>\n";
echo " <div class='form-group'>\n";
echo " <label>Articolo - $num</label>\n";
echo " <div class='input-group'>\n";
echo " <input type='text' class='form-control' id='ser_[".$i."]' name='ser_[".$i."]' value=\"".$serials[$i]."\">\n";
echo " </div>\n";
echo " </div>\n";
echo " </div>\n";
}
echo " </div>\n";
//PULSANTI
echo "<a onclick='addriga();' class='btn btn-primary'><i class='fa fa-edit'></i> "._('Inserisci')."</button>\n";
echo "</form>\n";
?>
<script type="text/javascript">
function addriga(){
if( $('#descrizione').val()!='' && $('#idiva option:selected').val()!='' ){
$("#link_form").submit();
}
}
$(document).ready( function(){
start_superselect();
start_inputmask();
});
</script>
<div class="clearfix"></div>