<?php include_once(__DIR__."/../../core.php"); $dir = 'uscita'; $module_name = 'Ordini fornitore'; $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']; $idconto_fattura = $rs[0]['idconto']; //Info riga inserita $q = "SELECT * FROM or_righe_ordini WHERE idordine='".$idordine."' AND id='".$idriga."'"; $rsr = $dbo->fetchArray($q); $idconto_fattura = $rsr[0]['idconto']; /* Form di modifica riga documento */ echo "<label>Documento 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='editriga'>\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 "<br>"; echo "<div class='panel panel-primary'>"; echo "<div class='panel-body'>"; echo " <div class='row'>\n"; //Qta echo " <div class='col-md-3'>\n"; echo " <div class='form-group'>\n"; echo " <label>Q.tà</label>\n"; echo " <div class='input-group'>\n"; echo " <input type='text' class='form-control inputmask-decimal' id='qta' maxlength='8' name='qta' value=\"".$rsr[0]['qta']."\">\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; //Costo unitario echo " <div class='col-md-3'>\n"; echo " <div class='form-group'>\n"; echo " <label>Costo unitario</label>\n"; echo " <div class='input-group'>\n"; echo " <input type='text' class='form-control inputmask-decimal' id='subtot' name='subtot' value=\"".number_format($rsr[0]['subtotale']/$rsr[0]['qta'], get_var("Cifre decimali"), ".", "")."\"><span class='input-group-addon'>€</span>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; //Unità di misura echo " <div class='col-md-3'>\n"; echo ' {[ "type": "select", "label": "'. _("Unità di misura").'", "icon-after": "<button data-href=\"'.$rootdir.'/add.php?id_module='.$modules_info["Unità di misura"]["id"].'&ajax=yes&id_modules='.$id_module.'\" data-target=\"#bs-popup2\" data-title=\"'._("Aggiungi unità di misura").'...\" data-toggle=\"modal\" type=\"button\" class=\"btn\"><i class=\"fa fa-plus\"></i></button>", "name": "um", "required": 0, "value": "'.$rsr[0]['um'].'", "ajax-source": "misure" ]}'; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo "<div class='panel panel-primary'>"; echo "<div class='panel-body'>"; echo " <div class='row'>\n"; //Sconto echo " <div class='col-md-3'>\n"; echo " <div class='form-group'>\n"; echo " <label>Sconto</label>\n"; echo " <div class='input-group'>\n"; if($rsr[0]['tipo_sconto']=='2'){ echo " <input type='text' class='form-control text-right' id='sconto' name='sconto' value=\"".number_format($rsr[0]['sconto_primo'], get_var("Cifre decimali"), ".", "")."\" />\n"; }else{ echo " <input type='text' class='form-control inputmask-decimal' id='sconto' name='sconto' value=\"".number_format($rsr[0]['sconto']/$rsr[0]['qta'], get_var("Cifre decimali"), ".", "")."\" />\n"; } echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; //Sconto 1 echo " <div class='col-md-3'>\n"; echo " <div class='form-group'>\n"; echo " <label>Extra</label>\n"; echo " <div class='input-group'>\n"; if($rsr[0]['tipo_sconto']=='2'){ echo " <input type='text' class='form-control inputmask-decimal' id='sconto_extra' name='sconto_extra' value=\"".number_format($rsr[0]['sconto_extra'], get_var("Cifre decimali"), ".", "")."\" />\n"; }else{ echo " <input type='text' class='form-control inputmask-decimal' id='sconto_extra' name='sconto_extra' value=\"".number_format($rsr[0]['sconto_extra']/$rsr[0]['qta'], get_var("Cifre decimali"), ".", "")."\" />\n"; } echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; //Sconto echo " <div class='col-md-3'>\n"; echo " <div class='form-group'>\n"; echo " <label>Extra</label>\n"; echo " <div class='input-group'>\n"; if($rsr[0]['tipo_sconto']=='2'){ echo " <input type='text' class='form-control inputmask-decimal' id='sconto_extra1' name='sconto_extra1' value=\"".number_format($rsr[0]['sconto_extra1'], get_var("Cifre decimali"), ".", "")."\" />\n"; }else{ echo " <input type='text' class='form-control inputmask-decimal' id='sconto_extra1' name='sconto_extra1' value=\"".number_format($rsr[0]['sconto_extra1']/$rsr[0]['qta'], get_var("Cifre decimali"), ".", "")."\" />\n"; } echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; //Tipo Sconto $query = "SELECT * FROM co_tipisconto"; $rs = $dbo->fetchArray($query); echo " <div class='col-md-3'>\n"; echo " <label>Tipologia Sconto</label>\n"; echo " <select id='idtiposconto' class='superselect' name=\"idtiposconto\">\n"; if($rsr[0]['tipo_sconto']=='2'){ echo " <option value='2'>Percentuale</option>\n"; }else{ echo " <option value='1'>Fisso</option>\n"; } for( $i=0; $i<sizeof($rs); $i++ ){ echo " <option value='".$rs[$i]['id']."' $attr>".$rs[$i]['descrizione']."</option>\n"; } echo " </select>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo "<div class='panel panel-primary'>"; echo "<div class='panel-body'>"; echo " <div class='row'>\n"; //Iva echo " <div class='col-md-6'>\n"; echo " <label>Iva</label>\n"; echo " <select id='idiva' class='superselect' name=\"idiva\">\n"; echo " <option value='0'>- Seleziona un valore -</option>\n"; $query = "SELECT * FROM co_iva ORDER BY descrizione ASC"; $rs = $dbo->fetchArray($query); for( $i=0; $i<sizeof($rs); $i++ ){ ( $rs[$i]['id'] == $rsr[0]['idiva'] ) ? $attr=' selected="selected"' : $attr=''; echo " <option value='".$rs[$i]['id']."' $attr>".$rs[$i]['descrizione']."</option>\n"; } echo " </select>\n"; echo " </div>\n"; //Conto // echo " <div class='col-md-6'>\n"; // echo " <div class='form-group'>\n"; // echo " <label>Conto</label>\n"; // echo " <select id='idconto_riga' class='superselect' name=\"idconto_riga\">\n"; // $query = "SELECT co_pianodeiconti3.id, CONCAT_WS( ' ', co_pianodeiconti3.numero, co_pianodeiconti3.descrizione ) AS descrizione FROM co_pianodeiconti3 INNER JOIN (co_pianodeiconti2 INNER JOIN co_pianodeiconti1 ON co_pianodeiconti2.idpianodeiconti1=co_pianodeiconti1.id) ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE co_pianodeiconti1.descrizione='Economico' AND co_pianodeiconti3.dir = '".$dir."' ORDER BY co_pianodeiconti3.numero ASC"; // $rs = $dbo->fetchArray($query); // echo " <option value=''> - Seleziona un'opzione -</option>\n"; // for( $i=0; $i<sizeof($rs); $i++ ){ // ( $rs[$i]['id'] == $idconto_fattura ) ? $attr=' selected="selected"' : $attr=''; // echo " <option value='".$rs[$i]['id']."' $attr>".$rs[$i]['descrizione']."</option>\n"; // } // echo " </select>\n"; // echo " </div>\n"; // echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo "<div class='panel panel-primary'>"; echo "<div class='panel-body'>"; echo " <div class='row'>\n"; //Rivalsa INPS if( get_var("Percentuale rivalsa INPS") != "" ){ echo " <div class='col-md-6'>\n"; echo " <label>Rivalsa INPS:</label>\n"; echo " <select id='idrivalsainps' class='superselect' name=\"idrivalsainps\">\n"; echo " <option value=''>-</option>\n"; $query = "SELECT * FROM co_rivalsainps"; $rs = $dbo->fetchArray($query); for( $i=0; $i<sizeof($rs); $i++ ){ ( $rs[$i]['id'] == $rsr[0]['idrivalsainps'] ) ? $attr='selected="true"' : $attr=''; echo " <option value='".$rs[$i]['id']."' ".$attr.">".$rs[$i]['descrizione']."</option>\n"; } echo " </select>\n"; echo " </div>\n"; } //Ritenuta d'acconto if( get_var("Percentuale ritenuta d'acconto") != "" ){ echo " <div class='col-md-6'>\n"; echo " <label>Ritenuta d'acconto:</label>\n"; echo " <select id='idritenutaacconto' class='superselect' name=\"idritenutaacconto\">\n"; echo " <option value=''>-</option>\n"; $query = "SELECT * FROM co_ritenutaacconto"; $rs = $dbo->fetchArray($query); for( $i=0; $i<sizeof($rs); $i++ ){ ( $rs[$i]['id'] == $rsr[0]['idritenutaacconto'] ) ? $attr='selected="true"' : $attr=''; echo " <option value='".$rs[$i]['id']."' ".$attr.">".$rs[$i]['descrizione']."</option>\n"; } echo " </select>\n"; echo " </div>\n"; } echo " </div>\n"; echo " </div>\n"; echo " </div>\n"; echo " <a onclick=\"addriga();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-edit\"></i> Modifica</a>\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>