205 lines
7.8 KiB
PHP
205 lines
7.8 KiB
PHP
|
<?php
|
||
|
$dir = 'uscita';
|
||
|
$module_name = 'Ordini fornitore';
|
||
|
|
||
|
include_once(__DIR__."/../../core.php");
|
||
|
$idordine = $html->form('idordine');
|
||
|
|
||
|
//Info documento
|
||
|
$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'];
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/*
|
||
|
Form di inserimento 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='addriga'>\n";
|
||
|
echo " <input type='hidden' name='dir' value='".$dir."'>\n";
|
||
|
echo " <input type='hidden' name='backto' value='record-edit'>\n";
|
||
|
|
||
|
//Descrizione
|
||
|
echo " <div class='row'>\n";
|
||
|
echo " <div class='col-md-12'>\n";
|
||
|
echo " <div class='form-group'>\n";
|
||
|
echo " <label>Descrizione</label>\n";
|
||
|
echo " <textarea name=\"descrizione\" id=\"descrizione\" class='form-control' ></textarea>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
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";
|
||
|
//Leggo l'iva predefinita dall'articolo e se non c'è leggo quella predefinita generica
|
||
|
//if( $dir=='entrata' )
|
||
|
$idiva_predefinita = get_var("Iva predefinita");
|
||
|
$query = "SELECT * FROM co_iva ORDER BY descrizione ASC";
|
||
|
$rs = $dbo->fetchArray($query);
|
||
|
for( $i=0; $i<sizeof($rs); $i++ ){
|
||
|
( $rs[$i]['id'] == $idiva_predefinita ) ? $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 " <label>Conto predefinito</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 ) ? $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 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'] == get_var("Percentuale rivalsa INPS") ) ? $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'] == get_var("Percentuale ritenuta d'acconto") ) ? $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 class='row'>\n";
|
||
|
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=\"1\">\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").'", "name": "um", "required": 0, "value": "", "ajax-source": "misure" ]}';
|
||
|
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=\"0,00\"><span class='input-group-addon'>€</span>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
|
||
|
echo " </div>\n";
|
||
|
|
||
|
|
||
|
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";
|
||
|
echo " <input type='text' class='form-control inputmask-decimal' id='sconto' name='sconto' value=\"0,00\" /><span class='input-group-addon'></span>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
//Sconto Extra
|
||
|
echo " <div class='col-md-3'>\n";
|
||
|
echo " <div class='form-group'>\n";
|
||
|
echo " <label>Extra Sconto</label>\n";
|
||
|
echo " <div class='input-group'>\n";
|
||
|
echo " <input type='text' class='form-control inputmask-decimal' id='sconto_extra' name='sconto_extra' value=\"0,00\" /><span class='input-group-addon'></span>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
echo " </div>\n";
|
||
|
//Sconto Extra1
|
||
|
echo " <div class='col-md-3'>\n";
|
||
|
echo " <div class='form-group'>\n";
|
||
|
echo " <label>Extra Sconto</label>\n";
|
||
|
echo " <div class='input-group'>\n";
|
||
|
echo " <input type='text' class='form-control inputmask-decimal' id='sconto_extra1' name='sconto_extra1' value=\"0,00\" /><span class='input-group-addon'></span>\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";
|
||
|
|
||
|
echo " <option value='1'>Fisso</option>\n";
|
||
|
for( $i=0; $i<sizeof($rs); $i++ ){
|
||
|
( $rs[$i]['id'] == "1" ) ? $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";
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
function addriga(){
|
||
|
if( $('#descrizione').val()!='' && $('#idiva option:selected').val()!='' ){
|
||
|
$("#link_form").submit();
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
<script src="<?php echo $rootdir; ?>/lib/init.js"></script>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
echo " <a onclick=\"addriga();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-plus\"></i> Aggiungi</a>\n";
|
||
|
echo "</form>\n";
|
||
|
|
||
|
?>
|
||
|
|
||
|
<div class="clearfix"></div>
|