diff --git a/src/m770/771230.cpp b/src/m770/771230.cpp index 4efcde753..942d9067a 100755 --- a/src/m770/771230.cpp +++ b/src/m770/771230.cpp @@ -131,10 +131,6 @@ void TRighe_riepilogo::genera_la(TRectype& quadro, const TRectype& riga, const T quadro.put(QUD_CTINPSPERC, inps_perc); // AUXXX021 } - const TRectype& perc = cache().get_rec(LF_PERC, riga.get(SPR_CODDITTA), riga.get(SPR_TIPOA), riga.get(SPR_CODANAGR)); - quadro.put("ENTEPREV", perc.get("ENTEPREV")); // AUXXX029 / 32 - quadro.put("CATEGORIA", perc.get("CATEGORIA")); // AUXXX033 - if (somme.is_zero() && quadro.get(QUD_TOTALE) == quadro.get(QUD_IMPONIBILE)) { const TRectype& ca7 = cache().get("%CA7", codcaus); @@ -167,7 +163,9 @@ bool TRighe_riepilogo::add_riga_pag(const TRectype& riga, const TRectype& scheda if (rec == NULL) return false; - + + const TRectype& perc = cache().get_rec(LF_PERC, riga.get(SPR_CODDITTA), riga.get(SPR_TIPOA), riga.get(SPR_CODANAGR)); + rec->put(PAG_CODDITTA, riga.get(PAG_CODDITTA)); rec->put(PAG_TIPOA, riga.get(PAG_TIPOA)); rec->put(PAG_CODANAGR, riga.get(PAG_CODANAGR)); @@ -175,7 +173,12 @@ bool TRighe_riepilogo::add_riga_pag(const TRectype& riga, const TRectype& scheda rec->put("CODCAUS", codcaus); rec->put("CAUSALE", causqua); rec->put("ANNO", riga.get_date(PAG_DATAPAG).year()); - rec->put("GENERATA", true); + + // Spostati qua per due motivi: 1 -> sono dati del percipiente non vanno sommati; 2 -> Con l'operatore somma (riep += curr;) vengono persi. + rec->put("ENTEPREV", perc.get("ENTEPREV")); // AUXXX029 / 32 + rec->put("CATEGORIA", perc.get("CATEGORIA")); // AUXXX033 + /**********************************************************************/ + rec->put("GENERATA", true); i = add(rec); } @@ -1017,8 +1020,6 @@ void TQuadroC_E2::generazione() const char tipoa = scheda.get_char(SPR_TIPOA); const long codanagr = scheda.get_long(SPR_CODANAGR); - if(codanagr == 1404) - bool tolla = true; if (tipoa != last_type || codanagr != last_code) { if (righe.items() > 0) @@ -1062,7 +1063,11 @@ bool TQuadroC_E2::genera_handler(TMask_field& f, KEY key) { if (yesno_box("Il quadro verrà completamente eliminato:\n" "Confermare la generazione dalle schede")) + { app().generazione(); + message_box("Quadro generato!"); + } + } return TRUE; } diff --git a/src/m770/777200.cpp b/src/m770/777200.cpp index 78d766cec..57e07deb6 100755 --- a/src/m770/777200.cpp +++ b/src/m770/777200.cpp @@ -716,6 +716,7 @@ bool TTrasferimentoCU::append_record_h(const TRectype& qla, int modulo, TLog_rep { const char tipoanag = qla.get_char("TIPOA"); const long codanagr = qla.get_long("CODANAGR"); + if (tipoanag < 'F' && codanagr <= 0) { TString msg; msg.format(FR("Scartato percipiente non valido %c/%ld"), tipoanag, codanagr); @@ -784,45 +785,42 @@ bool TTrasferimentoCU::append_record_h(const TRectype& qla, int modulo, TLog_rep const real cdo = qla.get_real("CONTRDOV"); const real cve = qla.get_real("CONTRVER"); - if (!cce.is_zero() || !cal.is_zero() || !ccp.is_zero() || !cdo.is_zero() || !cve.is_zero()) + TString8 entprev = qla.get("ENTEPREV"); + TString4 cat = qla.get("CATEGORIA"); + TString cfep; + if (entprev.blank()) { - TString8 entprev = qla.get("ENTEPREV"); - TString4 cat = qla.get("CATEGORIA"); - TString cfep; - if (entprev.blank()) - { - const TRectype& aperc = cache().get_rec(LF_PERC, qla.get("CODDITTA"), qla.get("TIPOA"), qla.get("CODANAGR")); // Perchè prima era TIPO ? - entprev = aperc.get("ENTEPREV"); - cat = aperc.get("CATEGORIA"); - } - if (entprev.full()) - { - const TRectype& inps = cache().get("%ENT", entprev); - cfep << inps.get("S5"); - rec.np_put("AU001029", cfep); // codice fiscale ente previdenziale - rec.np_put("AU001030", inps.get("S0")); // denominazione ente previdenziale - //rec.np_put("AU001031", inps.get("S6")); // codice ente previdenziale (2, 4, A) - - TToken_string cod_az; cod_az.format("77ENT|%s|%05ld",(const char*)entprev, qla.get_long("CODDITTA")); - const TString& azienda = cache().get(LF_MULTIREL, cod_az, "DATA"); - if(cfep.full()) - rec.np_put("AU001032", azienda); // codice azienda presso ente previdenziale - } - // 2017: É stato aggiunto un controllo a AU001029, se è empty salto tutto questo pezzo - if(cfep.full()) - { - rec.np_put("AU001033", cat); - rec.np_put("AU001034", cce); // contributi a carico erogante - rec.np_put("AU001035", ccp); // contributi a carico percipiente - if (!cal.is_zero()) - { - rec.np_put("AU001036", true); // altri contributi? - rec.np_put("AU001037", cal); // importo altri contributi - } - rec.np_put("AU001038", cdo); // contributi dovuti - rec.np_put("AU001039", cve); // contributi versati - } + const TRectype& aperc = cache().get_rec(LF_PERC, qla.get("CODDITTA"), qla.get("TIPOA"), qla.get("CODANAGR")); // Perchè prima era TIPO ? + entprev = aperc.get("ENTEPREV"); + cat = aperc.get("CATEGORIA"); } + if (entprev.full()) + { + const TRectype& inps = cache().get("%ENT", entprev); + cfep << inps.get("S5"); + rec.np_put("AU001029", cfep); // codice fiscale ente previdenziale + rec.np_put("AU001030", inps.get("S0")); // denominazione ente previdenziale + //rec.np_put("AU001031", inps.get("S6")); // codice ente previdenziale (2, 4, A) + + TToken_string cod_az; cod_az.format("77ENT|%s|%05ld",(const char*)entprev, qla.get_long("CODDITTA")); + const TString& azienda = cache().get(LF_MULTIREL, cod_az, "DATA"); + if(cfep.full()) + rec.np_put("AU001032", azienda); // codice azienda presso ente previdenziale + } + // 2017: É stato aggiunto un controllo a AU001029, se è empty salto tutto questo pezzo + if(cfep.full()) + { + rec.np_put("AU001033", cat); + rec.np_put("AU001034", cce); // contributi a carico erogante + rec.np_put("AU001035", ccp); // contributi a carico percipiente + if (!cal.is_zero()) + { + rec.np_put("AU001036", true); // altri contributi? + rec.np_put("AU001037", cal); // importo altri contributi + } + rec.np_put("AU001038", cdo); // contributi dovuti + rec.np_put("AU001039", cve); // contributi versati + } _data.add(rec); return true;