776 lines
24 KiB
JavaScript
776 lines
24 KiB
JavaScript
|
|
|
|
/**********************************************/
|
|
/**********************************************/
|
|
/* PER ?? STANDARD SU RIGA TESSUTO...*/
|
|
/**********************************************/
|
|
/**********************************************/
|
|
function addRigaTessuto() {
|
|
//prima cosa salvo le quantità sui campi hidden
|
|
//alert('pio');
|
|
//1 FT fatt vendita
|
|
//2 FB fattura accompagnatoria
|
|
//3 fa fattura acquisto
|
|
//4 bo bolla di accompagnamento
|
|
//5 prenotazione
|
|
//Ab.prendiElementoDaId("ADDRIGA").disable;
|
|
|
|
{
|
|
var f = document.main;
|
|
|
|
//checkBoxes();
|
|
f.action = f.actionPage.value;
|
|
var cf;
|
|
//gestione euro
|
|
Ab.aggiustaInputText(f.descrizioneRiga);
|
|
Ab.aggiustaInputText(f.notaRigaDocumento);
|
|
if (document.getElementById('notaBarcode'))
|
|
Ab.aggiustaInputText(f.notaBarcode);
|
|
|
|
//alert(f.flgTipologia.value);
|
|
//alert(f.flgClienteFornitore.value);
|
|
//aggiorniamo la quantiaa
|
|
//Tessuto SOLO MT!!!!!!!
|
|
|
|
|
|
$("#quantita").val($("#kgT").val());
|
|
if ($("#quantita").val() == 0) {
|
|
$("#quantita").val($("#mtT").val());
|
|
}
|
|
if ($("#quantita").val() == 0) {
|
|
$("#quantita").val($("#nrT").val());
|
|
}
|
|
|
|
|
|
//CONTROLLO CAMPI OBBLIGATORI
|
|
|
|
if (f.flgClienteFornitore.value == "F")
|
|
cf = checkTessutoF();
|
|
else if (f.flgClienteFornitore.value == "C")
|
|
cf = checkTessutoC();
|
|
else if (f.flgClienteFornitore.value == "A")
|
|
cf = checkTessutoA();
|
|
else {
|
|
cf = false;
|
|
alert("ERRORE! Tipo documento no valido");
|
|
}
|
|
|
|
|
|
if (cf) {
|
|
f.cmd.value = "addRigaTessuto";
|
|
//f.act.value="addRigaTessuto";
|
|
$("#currentFocus").val("searchArticolo");
|
|
//f.flgCaricaArticoli.value=1;
|
|
//Ab.popUp("ELAB");
|
|
// Ab.submitAj('main');
|
|
//
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a fornitori*/
|
|
function checkTessutoF() {
|
|
//alert('f');
|
|
var f = document.main;
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Lotto', 'R'))
|
|
return false;
|
|
//imponibile in rosso
|
|
if (f.imponibile.value == "0,00" || f.imponibile.value == "") {
|
|
var theIdStyle = document.getElementById('imponibile').style;
|
|
theIdStyle.backgroundColor = "#ff0000";
|
|
}
|
|
|
|
var checkMag = true;
|
|
if ($("#isMagPartenza").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#isMagArrivo").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArrivo', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Fornitore', 'RisNumKey', 'descrizioneRiga', 'Articolo', 'R', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a clienti*/
|
|
function checkTessutoC() {
|
|
//alert('C');
|
|
var f = document.main;
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Seriale articolo', 'R'))
|
|
return false;
|
|
//prezzoPubblicoConIva in rosso
|
|
if (f.prezzoPubblicoConIva.value == "0,00" || f.prezzoPubblicoConIva.value == "") {
|
|
var theIdStyle = document.getElementById('prezzoPubblicoConIva').style;
|
|
theIdStyle.backgroundColor = "#ff0000";
|
|
}
|
|
//
|
|
var checkMag = true;
|
|
if ($("#isMagPartenza").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#isMagArrivo").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArrivo', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'R', 'descrizioneRiga', 'Articolo', 'R', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
}
|
|
|
|
// else
|
|
// return false;
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a altro???*/
|
|
function checkTessutoA() {
|
|
//alert('A');
|
|
var checkMag = true;
|
|
if ($("#isMagPartenza").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#isMagArrivo").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArrivo', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'RisNumKey', 'id_articolo', 'Articolo', 'RisNumKey', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
////////////////////////////////////
|
|
// onFocusDescRiga
|
|
// determina che succede quando arriva il focus su descriga
|
|
// deve andare sulla qta giusta. Si attiva dopo il CR
|
|
////////////////////////////////////
|
|
function onFocusDescRigaTessuto() {
|
|
//checkBoxes();
|
|
/* if(Ab.prendiElementoDaId("id_articoloTessutoColore").value>0 && Ab.prendiElementoDaId("descrizioneRiga").value!="" && Ab.prendiElementoDaId('flgAutoAdd').value==1)
|
|
{
|
|
addRigaArticolo();
|
|
}
|
|
else
|
|
*/
|
|
{
|
|
//se non bolla fattura o nc allora il seriale non lo chiedo (es. ordine)flgTipologia!=3
|
|
//dovrei verificare getTipoCaricoScarico=0-- anagrafiche chiedo seriale tipoCaricoScarico==0
|
|
if (document.main.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3) {
|
|
$("#descrizioneRiga").select();
|
|
//Ab.prendiElementoDaId('descrizioneRiga').select();
|
|
//beep();
|
|
} else {
|
|
//Ab.prendiElementoDaId('quantita').focus() ;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**********************************************/
|
|
/**********************************************/
|
|
/* PER LAVORAZIONI TESSITURA (INSINNA)*/
|
|
/**********************************************/
|
|
/**********************************************/
|
|
function addRigaTessutoLav()
|
|
/////////////////////////////////////////////
|
|
{
|
|
//prima cosa salvo le quantità sui campi hidden
|
|
//alert('pio');
|
|
//1 FT fatt vendita
|
|
//2 FB fattura accompagnatoria
|
|
//3 fa fattura acquisto
|
|
//4 bo bolla di accompagnamento
|
|
//5 prenotazione
|
|
//Ab.prendiElementoDaId("ADDRIGA").disable;
|
|
|
|
{
|
|
var f = document.main;
|
|
|
|
//checkBoxes();
|
|
f.action = f.actionPage.value;
|
|
var cf;
|
|
//gestione euro
|
|
Ab.aggiustaInputText(f.descrizioneRiga);
|
|
Ab.aggiustaInputText(f.notaRigaDocumento);
|
|
if (document.getElementById('notaBarcode'))
|
|
Ab.aggiustaInputText(f.notaBarcode);
|
|
|
|
//alert(f.flgTipologia.value);
|
|
//alert(f.flgClienteFornitore.value);
|
|
//aggiorniamo la quantiaa
|
|
//Tessuto SOLO MT!!!!!!!
|
|
|
|
|
|
//$("#quantita").val($("#kgT").val());
|
|
$("#quantita").val($("#mtT").val());
|
|
|
|
|
|
//CONTROLLO CAMPI OBBLIGATORI
|
|
|
|
if (f.flgClienteFornitore.value == "F")
|
|
cf = checkTessutoFLAV();
|
|
else if (f.flgClienteFornitore.value == "C")
|
|
cf = checkTessutoCLAV();
|
|
else if (f.flgClienteFornitore.value == "A")
|
|
cf = checkTessutoALAV();
|
|
else {
|
|
cf = false;
|
|
alert("ERRORE! Tipo documento no valido");
|
|
}
|
|
|
|
|
|
if (cf) {
|
|
f.cmd.value = "addRigaTessuto";
|
|
//f.act.value="addRigaTessuto";
|
|
//da gestire se descrizioneCodiceRiga o descrizione riga
|
|
$("#currentFocus").val("descrizioneCodiceRiga"); //f.flgCaricaArticoli.value=1;
|
|
//Ab.popUp("ELAB");
|
|
// Ab.submitAj('main');
|
|
//
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a fornitori
|
|
caso lavorazioni*/
|
|
function checkTessutoFLAV() {
|
|
//alert('f');
|
|
var f = document.main;
|
|
if (document.getElementById('flgUsaSeriale')) {
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Lotto', 'R'))
|
|
return false;
|
|
}
|
|
//imponibile in rosso
|
|
|
|
var checkMag = true;
|
|
if ($("#magPartenzaDaScegliere").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#magArrivoDaScegliere").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArrivo', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Fornitore', 'RisNumKey', 'descrizioneRiga', 'Articolo', 'R', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
}
|
|
|
|
}
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a clienti
|
|
per lavorazioni*/
|
|
function checkTessutoCLAV() {
|
|
//alert('C');
|
|
var f = document.main;
|
|
if (document.getElementById('flgUsaSeriale')) {
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Seriale articolo', 'R'))
|
|
return false;
|
|
}
|
|
//prezzoPubblicoConIva in rosso
|
|
|
|
//corrispettivi.... se emetti fattura id_clifor2 obbligatorio flgEmettiFatturaScontrino
|
|
//s09-02-2010 viene chamato da add riga... non controllo id_clilfor2
|
|
// if(f.id_tipoDocumento.value!=1 || (f.id_tipoDocumento.value==1 && f.flgEmettiFatturaScontrino.value==0) ||(f.id_tipoDocumento.value==1 && //Ab.validateForm('id_clifor2','Cliente/Fornitore','RisNumKey')))
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'R', 'descrizioneRiga', 'Articolo', 'R', 'quantita', 'quantita', 'RisNum>0', 'numColpiDM', 'Numero Colpi Al dm', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
// else
|
|
// return false;
|
|
}
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a altro???
|
|
caso lavorazione*/
|
|
function checkTessutoALAV() {
|
|
//alert('A');
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'RisNumKey', 'id_articolo', 'Articolo', 'RisNumKey', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/*******************************************/
|
|
/* calcola tessuti totali */
|
|
/*******************************************/
|
|
/*******************************************/
|
|
function calcolaMtTotali() {
|
|
|
|
var stacchi = parseFloat($("#stacchi").val().replace(/[,]/, '.'));
|
|
var metriStacchi = parseFloat($("#metriStacchi").val());
|
|
console.log(stacchi + " " + metriStacchi + " " + stacchi * metriStacchi);
|
|
numeral.locale('it');
|
|
var mtString = numeral(stacchi * metriStacchi).format('0,0.00');
|
|
$("#mtT").val(mtString);
|
|
|
|
}
|
|
/*******************************************/
|
|
/*******************************************/
|
|
/* STAMPA CODICI A BARRE LAV. TESSITURA (INSINNA)
|
|
/******************************************/
|
|
/*******************************************/
|
|
function codBarreDispoTessitura() {
|
|
var f = document.main;
|
|
|
|
{
|
|
var debug = false;
|
|
var wwD = "700";
|
|
var whD = "500";
|
|
|
|
//+"&xxx="+f.xxx.value
|
|
theAction = f.actionPage.value + "?cmd=codBarreDispoTessitura" + "&id_documento=" + f.id_documento.value;
|
|
|
|
//
|
|
//var numLabels=prompt("Numero di etichette da stampare","1");
|
|
var blankLabels = prompt("Numero di etichette da saltare", "0");
|
|
theAction = theAction + "&blankLabels=" + blankLabels; //+"&numLabels="+numLabels;
|
|
if (debug == false) {
|
|
window.open(theAction, "Stampa_Codici_Barre_Dispo_Tessitura", "width=" + wwD + ",height=" + whD + ",status=no,resizable=yes,top=100,left=100,scrollbars=yes");
|
|
} else {
|
|
window.open(theAction);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
/*******************************************/
|
|
/*******************************************/
|
|
/* ordina per tela (insinna) */
|
|
/*******************************************/
|
|
/*******************************************/
|
|
function ordinaPerTela() {
|
|
Swal.fire({
|
|
title: "Ordina righe documento per tela ",
|
|
text: "Sei Sicuro?",
|
|
icon: "warning",
|
|
showDenyButton: true,
|
|
showCancelButton: false,
|
|
confirmButtonText: `Si`,
|
|
denyButtonText: `No`,
|
|
cancelButtonText: `Annulla`,
|
|
}).then((result) => {
|
|
/* Read more about isConfirmed, isDenied below */
|
|
if (result.isConfirmed) {
|
|
////////////////////////////////////////////////////////////////////
|
|
$("#main").attr("action", $("#actionPage").val());
|
|
//$("#flgReport").val("S");
|
|
$("#cmd", "#main").val("ordinaRighePerTela");
|
|
$("#act", "#main").val("");
|
|
$("#cmd2").val("");
|
|
$("#id_documento").val($("#id_documento").val());
|
|
//$("#pageNumber").val("1");
|
|
Ab.submitAj('main');
|
|
////////////////////////////////////////////////////////////////////
|
|
} else if (result.isDenied) {
|
|
//Swal.fire('Changes are not saved', '', 'info')
|
|
}
|
|
})
|
|
|
|
|
|
}
|
|
/*******************************************/
|
|
/*******************************************/
|
|
/* add riga tessuto disposizione per tessitura (sportex)*/
|
|
/*******************************************/
|
|
/*******************************************/
|
|
function addRigaTessutoDispoTessuto() {
|
|
//prima cosa salvo le quantità sui campi hidden
|
|
//alert('pio');
|
|
//1 FT fatt vendita
|
|
//2 FB fattura accompagnatoria
|
|
//3 fa fattura acquisto
|
|
//4 bo bolla di accompagnamento
|
|
//5 prenotazione
|
|
//Ab.prendiElementoDaId("ADDRIGA").disable;
|
|
|
|
{
|
|
var f = document.main;
|
|
|
|
//checkBoxes();
|
|
f.action = f.actionPage.value;
|
|
var cf;
|
|
//gestione euro
|
|
Ab.aggiustaInputText(f.descrizioneRiga);
|
|
Ab.aggiustaInputText(f.notaRigaDocumento);
|
|
|
|
//alert(f.flgTipologia.value);
|
|
//alert(f.flgClienteFornitore.value);
|
|
//aggiorniamo la quantiaa
|
|
//Tessuto SOLO MT!!!!!!!
|
|
|
|
|
|
$("#quantita").val($("#kgT").val());
|
|
//$("#quantita").val($("#mtT").val());
|
|
|
|
|
|
//CONTROLLO CAMPI OBBLIGATORI
|
|
|
|
if (f.flgClienteFornitore.value == "F")
|
|
cf = checkTessutoFDISPO();
|
|
else if (f.flgClienteFornitore.value == "C")
|
|
cf = checkTessutoCDISPO();
|
|
else if (f.flgClienteFornitore.value == "A")
|
|
cf = checkTessutoADISPO();
|
|
else {
|
|
cf = false;
|
|
alert("ERRORE! Tipo documento no valido");
|
|
}
|
|
|
|
|
|
if (cf) {
|
|
f.cmd.value = "addRigaTessuto";
|
|
//f.act.value="addRigaTessuto";
|
|
$("#currentFocus").val("searchArticolo");
|
|
//f.flgCaricaArticoli.value=1;
|
|
//Ab.popUp("ELAB");
|
|
// Ab.submitAj('main');
|
|
//
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a fornitori
|
|
caso lavorazioni*/
|
|
function checkTessutoFDISPO() {
|
|
|
|
var f = document.main;
|
|
if (document.getElementById('flgUsaSeriale')) {
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Lotto', 'R'))
|
|
return false;
|
|
}
|
|
//imponibile in rosso
|
|
|
|
var checkMag = true;
|
|
if ($("#magPartenzaDaScegliere").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#magArrivoDaScegliere").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArrivo', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
if (Ab.validateFormMandatory($("#lang").val())) {
|
|
return Ab.validateForm('id_clifor', 'Fornitore', 'RisNumKey', 'id_articoloTessuto', 'Tessuto', 'RisNumKey', 'id_colore', 'Colore', 'RisNumKey', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a clienti
|
|
per lavorazioni*/
|
|
function checkTessutoCDISPO() {
|
|
//alert('C');
|
|
var f = document.main;
|
|
if (document.getElementById('flgUsaSeriale')) {
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Seriale articolo', 'R'))
|
|
return false;
|
|
}
|
|
//prezzoPubblicoConIva in rosso
|
|
|
|
//corrispettivi.... se emetti fattura id_clifor2 obbligatorio flgEmettiFatturaScontrino
|
|
//s09-02-2010 viene chamato da add riga... non controllo id_clilfor2
|
|
// if(f.id_tipoDocumento.value!=1 || (f.id_tipoDocumento.value==1 && f.flgEmettiFatturaScontrino.value==0) ||(f.id_tipoDocumento.value==1 && //Ab.validateForm('id_clifor2','Cliente/Fornitore','RisNumKey')))
|
|
if (Ab.validateFormMandatory($("#lang").val())) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'R', 'id_articoloTessuto', 'Tessuto', 'RisNumKey', 'id_colore', 'Colore', 'RisNumKey', 'quantita', 'quantita', 'RisNum>0', 'numColpiDM', 'Numero Colpi Al dm', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a altro???
|
|
caso lavorazione*/
|
|
function checkTessutoADISPO() {
|
|
//alert('A');
|
|
if (Ab.validateFormMandatory($("#lang").val())) {
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'RisNumKey', 'id_articoloTessuto', 'Tessuto', 'RisNumKey', 'id_colore', 'Colore', 'RisNumKey', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/*******************************************/
|
|
/*******************************************/
|
|
/* dispo tess. scelgo il tessuto per poter inserire i filati (sportex)*/
|
|
/*******************************************/
|
|
/*******************************************/
|
|
function sceltaTessuto(l_id) {
|
|
var f = document.main;
|
|
//checkBoxes();
|
|
f.action = f.actionPage.value;
|
|
//f.action=$("#actionPage", "#main").val();
|
|
// FACCIO IL SUBMIT
|
|
f.cmd.value = "sceltaTessuto";
|
|
f.id_rigaDocumento.value = l_id;
|
|
//f.flgCaricaArticoli.value=1;
|
|
// Ab.submitAj('main');
|
|
//sweetAlert("aaaaa");
|
|
Ab.submitAj('main');
|
|
//sweetAlert("aaaaa");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* aggiunge riga tessuto a lavorazione tessuto*/
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function addRigaTessutoLavTessuto()
|
|
|
|
//prima cosa salvo le quantità sui campi hidden
|
|
//alert('pio');
|
|
//1 FT fatt vendita
|
|
//2 FB fattura accompagnatoria
|
|
//3 fa fattura acquisto
|
|
//4 bo bolla di accompagnamento
|
|
//5 prenotazione
|
|
//Ab.prendiElementoDaId("ADDRIGA").disable;
|
|
|
|
{
|
|
var f = document.main;
|
|
|
|
//checkBoxes();
|
|
f.action = f.actionPage.value;
|
|
var cf;
|
|
//gestione euro
|
|
Ab.aggiustaInputText(f.descrizioneRiga);
|
|
Ab.aggiustaInputText(f.notaRigaDocumento);
|
|
|
|
|
|
//alert(f.flgTipologia.value);
|
|
//alert(f.flgClienteFornitore.value);
|
|
//aggiorniamo la quantiaa
|
|
//FILATO SOLO KG!!!!!!!
|
|
|
|
if ($("#flgUdm").val() == 2)
|
|
$("#quantita").val($("#kgT").val());
|
|
else if ($("#flgUdm").val() == 3)
|
|
$("#quantita").val($("#mtT").val());
|
|
|
|
|
|
//CONTROLLO CAMPI OBBLIGATORI
|
|
|
|
if (f.flgClienteFornitore.value == "F")
|
|
cf = checkTessutoLavTessutoF();
|
|
else if (f.flgClienteFornitore.value == "C")
|
|
cf = checkTessutoLavTessutoC();
|
|
else if (f.flgClienteFornitore.value == "A")
|
|
cf = checkTessutoLavTessutoA();
|
|
else {
|
|
cf = false;
|
|
alert("ERRORE! Tipo documento no valido");
|
|
}
|
|
|
|
|
|
if (cf) {
|
|
f.cmd.value = "addRigaTessuto";
|
|
//f.act.value="addRigaFilato";
|
|
$("#currentFocus").val("searchArticolo");
|
|
//f.flgCaricaArticoli.value=1;
|
|
//Ab.popUp("ELAB");
|
|
// Ab.submitAj('main');
|
|
//
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a fornitori*/
|
|
function checkTessutoLavTessutoF() {
|
|
//alert('f');
|
|
var f = document.main;
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale', 'Lotto', 'R'))
|
|
return false;
|
|
//imponibile in rosso
|
|
|
|
var checkMag = true;
|
|
if ($("#magPartenzaDaScegliere").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#magArrivoDaScegliere").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArrivo', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Fornitore', 'RisNumKey', 'quantita', 'quantita', 'RisNum>0');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a clienti*/
|
|
function checkTessutoLavTessutoC() {
|
|
//alert('C');
|
|
var f = document.main;
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale2', 'Seriale articolo', 'R'))
|
|
return false;
|
|
//prezzoPubblicoConIva in rosso
|
|
if (f.prezzoPubblicoConIva.value == "0,00" || f.prezzoPubblicoConIva.value == "") {
|
|
var theIdStyle = document.getElementById('prezzoPubblicoConIva').style;
|
|
theIdStyle.backgroundColor = "#ff0000";
|
|
}
|
|
//corrispettivi.... se emetti fattura id_clifor2 obbligatorio flgEmettiFatturaScontrino
|
|
//s09-02-2010 viene chamato da add riga... non controllo id_clilfor2
|
|
// if(f.id_tipoDocumento.value!=1 || (f.id_tipoDocumento.value==1 && f.flgEmettiFatturaScontrino.value==0) ||(f.id_tipoDocumento.value==1 && //Ab.validateForm('id_clifor2','Cliente/Fornitore','RisNumKey')))
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'R', 'descrizioneRiga2', 'Articolo', 'R', 'quantita', 'quantita', 'RisNum>0', 'id_iva', 'codice iva', 'RisNumKey');
|
|
// else
|
|
// return false;
|
|
}
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* aggiunge riga tessuto a lavorazione tessuto*/
|
|
/***********************************************/
|
|
/***********************************************/
|
|
|
|
|
|
|
|
/***********************************************/
|
|
/***********************************************/
|
|
/* aggiunge riga tessuto a lavorazione tessuto 2*/
|
|
/***********************************************/
|
|
/***********************************************/
|
|
function addRigaTessutoLavTessuto2()
|
|
|
|
//prima cosa salvo le quantità sui campi hidden
|
|
//alert('pio');
|
|
//1 FT fatt vendita
|
|
//2 FB fattura accompagnatoria
|
|
//3 fa fattura acquisto
|
|
//4 bo bolla di accompagnamento
|
|
//5 prenotazione
|
|
//Ab.prendiElementoDaId("ADDRIGA").disable;
|
|
|
|
{
|
|
var f = document.main;
|
|
|
|
//checkBoxes();
|
|
f.action = f.actionPage.value;
|
|
var cf;
|
|
//gestione euro
|
|
Ab.aggiustaInputText(f.descrizioneRiga2);
|
|
Ab.aggiustaInputText(f.notaRigaDocumento2);
|
|
|
|
|
|
//alert(f.flgTipologia.value);
|
|
//alert(f.flgClienteFornitore.value);
|
|
//aggiorniamo la quantiaa
|
|
//FILATO SOLO KG!!!!!!!
|
|
//alert($("#flgUdm2").val());
|
|
|
|
if ($("#flgUdm2").val() == 2)
|
|
$("#quantita2").val($("#kgT2").val());
|
|
else if ($("#flgUdm2").val() == 3)
|
|
$("#quantita2").val($("#mtT2").val());
|
|
|
|
|
|
//CONTROLLO CAMPI OBBLIGATORI
|
|
|
|
if (f.flgClienteFornitore.value == "F")
|
|
cf = checkTessutoLavTessutoF2();
|
|
else if (f.flgClienteFornitore.value == "C")
|
|
cf = checkTessutoLavTessutoC2();
|
|
else if (f.flgClienteFornitore.value == "A")
|
|
cf = checkTessutoLavTessutoA2();
|
|
else {
|
|
cf = false;
|
|
alert("ERRORE! Tipo documento no valido");
|
|
}
|
|
|
|
|
|
if (cf) {
|
|
f.cmd.value = "addRigaTessuto2";
|
|
//f.act.value="addRigaFilato";
|
|
$("#currentFocus").val("searchArticolo");
|
|
//f.flgCaricaArticoli.value=1;
|
|
//Ab.popUp("ELAB");
|
|
// Ab.submitAj('main');
|
|
//
|
|
Ab.submitAj('main');
|
|
}
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a fornitori*/
|
|
function checkTessutoLavTessutoF2() {
|
|
//alert('f');
|
|
var f = document.main;
|
|
if (f.flgUsaSeriale2.value == 1 && document.main.flgTipologia2.value != 3 && !Ab.validateForm('seriale2', 'Lotto', 'R'))
|
|
return false;
|
|
//imponibile in rosso
|
|
|
|
var checkMag = true;
|
|
if ($("#magPartenzaDaScegliere2").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoPartenza2', 'Magazzino Partenza', 'RisNumKey');
|
|
}
|
|
|
|
if (checkMag) {
|
|
if ($("#magArrivoDaScegliere2").val() == "true") {
|
|
checkMag = Ab.validateForm('id_magFisicoArriv2o', 'Magazzino Arrivo', 'RisNumKey');
|
|
}
|
|
}
|
|
if (checkMag) {
|
|
|
|
return Ab.validateForm('id_clifor', 'Fornitore', 'RisNumKey', 'quantita2', 'quantita2', 'RisNum>0');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/*******************************************/
|
|
/* campi obbligatori per documenti a clienti*/
|
|
function checkTessutoLavTessutoC2() {
|
|
//alert('C');
|
|
var f = document.main;
|
|
if (f.flgUsaSeriale.value == 1 && document.main.flgTipologia.value != 3 && !Ab.validateForm('seriale2', 'Seriale articolo', 'R'))
|
|
return false;
|
|
//prezzoPubblicoConIva in rosso
|
|
if (f.prezzoPubblicoConIva.value == "0,00" || f.prezzoPubblicoConIva.value == "") {
|
|
var theIdStyle = document.getElementById('prezzoPubblicoConIva').style;
|
|
theIdStyle.backgroundColor = "#ff0000";
|
|
}
|
|
//corrispettivi.... se emetti fattura id_clifor2 obbligatorio flgEmettiFatturaScontrino
|
|
//s09-02-2010 viene chamato da add riga... non controllo id_clilfor2
|
|
// if(f.id_tipoDocumento.value!=1 || (f.id_tipoDocumento.value==1 && f.flgEmettiFatturaScontrino.value==0) ||(f.id_tipoDocumento.value==1 && //Ab.validateForm('id_clifor2','Cliente/Fornitore','RisNumKey')))
|
|
return Ab.validateForm('id_clifor', 'Cliente/Fornitore', 'R', 'descrizioneRiga2', 'Articolo', 'R', 'quantita2', 'quantita2', 'RisNum>0', 'id_iva2', 'codice iva', 'RisNumKey');
|
|
// else
|
|
// return false;
|
|
}
|
|
|