gest366/modules/documenti/add_righe_p.php

98 lines
3.1 KiB
PHP
Raw Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once(__DIR__."/../../core.php");
$module_name="Fatture di vendita";
echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".$js."/jquery.form.min.js\"></script>\n";
echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".$rootdir."/lib/init.js\"></script>\n";
$idintervento = $html->form('idintervento');
$idriga = $html->form('idriga');
$data_mov = $html->form('data_mov');
$op = "addriga_spese_pianifica";
$text_button = "<i class='fa fa-plus'></i> Aggiungi";
// valori default
$descrizione = "";
$qta = 1;
$prezzo_vendita = "0";
/*
Form di inserimento
*/
echo "<form id=\"add-righe\" action=\"".$rootdir."/modules/documenti/actions.php?id_record=".$idintervento."\" method=\"post\">\n";
// echo "<form id=\"link_form\" action=\"".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$idintervento."\" method=\"post\">\n";
echo " <input type='hidden' name='op' value='".$op."'>\n";
echo " <input type='hidden' name='idintervento' value='".$idintervento."'>\n";
echo " <input type='hidden' name='idriga' value='".$idriga."'>\n";
echo " <input type='hidden' name='data_mov' value='".$data_mov."'>\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 ' {[ "type": "textarea", "label": "'. _("Descrizione").'", "id": "descrizione_riga", "name": "descrizione", "required": 1, "value": "'.$descrizione.'" ]}';
echo " </div>\n";
echo " </div>\n";
echo " <br>\n";
//Quantità
echo " <div class='row'>\n";
echo " <div class='col-md-3'>\n";
echo ' {[ "type": "text", "label": "'. _("Q.tà").'", "class": "inputmask-decimal", "name": "qta", "required": 1, "value": "'.$qta.'" ]}';
echo " </div>\n";
//Prezzo di vendita
echo " <div class='col-md-3'>\n";
echo ' {[ "type": "text", "label": "'. _("Importo (un.)").'", "class": "inputmask-decimal", "name": "prezzo_vendita", "required": 1, "value": "'.$prezzo_vendita.'", "icon-after": "&euro;" ]}';
echo " </div>\n";
echo " </div>\n";
echo " <button type='submit' class='btn btn-primary pull-right'>".$text_button."</button>\n";
// echo "<a onclick=\"addarticolo_vendita();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-plus\"></i> Aggiungi</a>\n";
echo "</form>\n";
echo "<div class='clearfix'></div>\n";
?>
<script type="text/javascript">
function addarticolo_vendita(){
$("#link_form").submit();
}
$(document).ready(function() {
var options = {
beforeSubmit: function(){
return ( $('#descrizione_riga').val() != '' && $('#qta').val() != '' && $('#prezzo_vendita').val() != '' );
},
success: function(){
$('#bs-popup').modal('hide');
// ricarico la pagina ajax_referente
$('#righe').load('<?php echo $rootdir ?>/modules/documenti/ajax_righe.php?idintervento=<?php echo $idintervento ?>');
}
}
$('#add-righe').ajaxForm( options );
});
</script>