From 03060c3e0e3b7b8446e6c15ecf4e0b4f9795b4c1 Mon Sep 17 00:00:00 2001 From: mtollari Date: Fri, 30 Jun 2017 12:57:07 +0000 Subject: [PATCH] Patch level : 12.0 412 Files correlati : Commento : Aggiunta bolla doganale, ottimizzata funzione salvataggio record git-svn-id: svn://10.65.10.50/branches/R_10_00@23898 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/tf/tf0100.cpp | 77 +++++++++++++++++++++++----------------------- src/tf/tf0100a.h | 3 +- src/tf/tf0100a.uml | 7 ++++- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/tf/tf0100.cpp b/src/tf/tf0100.cpp index 6e9153628..471a00b7f 100644 --- a/src/tf/tf0100.cpp +++ b/src/tf/tf0100.cpp @@ -49,10 +49,10 @@ TString getTipoDoc(int id) case B_TIPO_STORDOC: ret = "ST"; break; - /* case B_TIPO_BOLLADOG: ret = "BD"; break; + /* case B_TIPO_CORRNINC: ret = "CN"; break; @@ -87,7 +87,7 @@ int getTipoDoc(TString id) { int ret = -1; if(id == "AF") ret = B_TIPO_AUTOFATT; - // else if(id == "BD") ret = B_TIPO_BOLLADOG; + else if(id == "BD") ret = B_TIPO_BOLLADOG; // else if(id == "CN") ret = B_TIPO_CORRNINC; // else if(id == "CR") ret = B_TIPO_CORR; else if(id == "FA") ret = B_TIPO_FATTACQ; @@ -165,8 +165,8 @@ static const char* decodTipo(TToken_string* strarr) TRectype mov = cache().get(LF_MOV, strarr->get(_numero)); TCausale caus(mov.get("CODCAUS"), mov.get_int("ANNOIVA")); TString tipodoc; tipodoc << strarr->get(_codnum); - // Le autofatture possono essere solo di tipo TDO1 - if(tipodoc == "AF") + // Le autofatture possono essere solo di tipo TDO1 e le bolle doganali nel dubbio pure + if(tipodoc == "AF" || tipodoc == "BD") return "TD01"; else if(tipodoc == "FA" || tipodoc == "FV") { @@ -233,35 +233,37 @@ static const char* decodTipo(TToken_string* strarr) /* Salvo il record modificato in TFCustom */ bool saveRec(TToken_string row, bool esportato) { + static TLocalisamfile trasfatt(LF_TRASFATT); // Devo inserire la riga in trasfatt - TRectype rCust(LF_TRASFATT); - if(strcmp(row.get(_spedita), "X") == 0) // Controllo che non sia già stata spedita prima - { - TString key = row.get(_numero); key << "|"<< row.get(_aliquota); - rCust = cache().get(LF_TRASFATT, key); - } - else - { - rCust.put("NUMREG", row.get(_numero)); - } - rCust.put("TIPO", row.get(_tipocf)); - rCust.put("CODCF", row.get(_codcf)); - rCust.put("OCCAS", row.get(_occas)); - rCust.put("TIPODOC", row.get(_codnum)); - rCust.put("NUMDOC", row.get(_numdoc)); - rCust.put("DATAREG", row.get(_datareg)); - rCust.put("DATADOC", row.get(_datadoc)); - rCust.put("IMPONIBILE", row.get(_imponibile)); - rCust.put("IMPOSTA", row.get(_importoIVA)); - rCust.put("CODIVA", row.get(_aliquota)); - rCust.put("AUTOFATT", row.get(_autofatt)); - if(esportato) - { - rCust.put("TFINVIO", true); - rCust.put("TFDATA", TDate(TODAY)); - } + TRectype rCust(LF_TRASFATT); + if(strcmp(row.get(_spedita), "X") == 0) // Controllo che non sia già stata spedita prima + { + TString key = row.get(_numero); key << "|"<< row.get(_aliquota); + rCust = cache().get(LF_TRASFATT, key); + } + // Controllo non si sa mai + if(rCust.empty()) + { + rCust.put("NUMREG", row.get(_numero)); + } + rCust.put("TIPO", row.get(_tipocf)); + rCust.put("CODCF", row.get(_codcf)); + rCust.put("OCCAS", row.get(_occas)); + rCust.put("TIPODOC", row.get(_codnum)); + rCust.put("NUMDOC", row.get(_numdoc)); + rCust.put("DATAREG", row.get(_datareg)); + rCust.put("DATADOC", row.get(_datadoc)); + rCust.put("IMPONIBILE", row.get(_imponibile)); + rCust.put("IMPOSTA", row.get(_importoIVA)); + rCust.put("CODIVA", row.get(_aliquota)); + rCust.put("AUTOFATT", row.get(_autofatt)); + if(esportato) + { + rCust.put("TFINVIO", true); + rCust.put("TFDATA", TDate(TODAY)); + } - return rCust.write_rewrite(TLocalisamfile(LF_TRASFATT)) == NOERR; + return rCust.write_rewrite(trasfatt) == NOERR; } ///////////////////////////////////////////////////////////////////////////////////// @@ -1461,7 +1463,8 @@ bool TTrFa_app::send(TTrFa_mask* msk) { message_box("Ho esportato correttamente!"); // Imposto l'esportazione - //setEsportato(sheet); + if(yesno_box("Vuoi segnare i record esportati?")) + setEsportato(sheet); } else message_box("Errore durante il salvataggio delle modifiche"); @@ -1809,9 +1812,6 @@ bool TTrFa_app::tff0700(TSheet_field& sheet) return false; if(strcmp(strarr->get(_invio), "X") != 0) continue; // Non mi interessa se non è selezionata - if(strcmp(strarr->get(_numero), "86709") == 0 || strcmp(strarr->get(_numero), "86772") == 0) - bool tolla = true; - TString checkFatt; checkFatt << strarr->get_char(_tipocf) << "|" << strarr->get_long(_codcf) << "|" << strarr->get(_numdoc); if(fattSent.get_pos(checkFatt) < 0) { @@ -1863,7 +1863,8 @@ bool TTrFa_app::tff2200(TToken_string* strarr, int nriga) tff2200f.set("PL_IMPONIBILE", real(strarr->get(_imponibile))); // Se li converto in real una volta passati vengono parsati da var2str nel formato che vuole l'agenzia delle entrate tff2200f.set("PL_IMPOSTA", real(strarr->get(_importoIVA))); - tff2200f.set("PL_ALIQUOTAIVA", strarr->get(_aliquota)); + real aliquota = cache().get("%IVA", strarr->get(_aliquota), "R0"); + tff2200f.set("PL_ALIQUOTAIVA", aliquota); tff2200f.set("PL_NATURA", strarr->get(_natura)); real det(strarr->get(_detraibile)); // Nella conversione la vigola viene persa e 100,00 diventa 10.000 quindi divido @@ -1938,10 +1939,10 @@ bool TTrFa_app::setEsportato(TSheet_field& sheet) } else { - TRectype row = cache().get(LF_RMOV, TString(strarr->get(_numero))); + TRectype row = cache().get(LF_MOV, TString(strarr->get(_numero))); row.put("TFINVIO", "X"); row.put("TFDATA", TDate(TODAY).string()); - ok = row.rewrite(TLocalisamfile(LF_RMOV)) == NOERR; + ok = row.rewrite(TLocalisamfile(LF_MOV)) == NOERR; if(!ok) return false; } } diff --git a/src/tf/tf0100a.h b/src/tf/tf0100a.h index 2d5013a8a..04278fc6c 100644 --- a/src/tf/tf0100a.h +++ b/src/tf/tf0100a.h @@ -15,7 +15,8 @@ #define B_TIPO_FATTVEN 410 #define B_TIPO_NOTC 411 #define B_TIPO_NOTD 412 -#define B_TIPO_STORDOC 413 +#define B_TIPO_BOLLADOG 413 +#define B_TIPO_STORDOC 414 #define END_BOOLEAN 413 diff --git a/src/tf/tf0100a.uml b/src/tf/tf0100a.uml index a60ce486d..7445c456d 100644 --- a/src/tf/tf0100a.uml +++ b/src/tf/tf0100a.uml @@ -127,9 +127,14 @@ BEGIN PROMPT 45 8 "Nota Deb" FLAGS "" END +BOOLEAN B_TIPO_BOLLADOG +BEGIN + PROMPT 60 8 "Bolla Dog" + FLAGS "" +END BOOLEAN B_TIPO_STORDOC BEGIN - PROMPT 60 8 "Storno Doc" + PROMPT 75 8 "Storno Doc" FLAGS "" END