diff --git a/cg/cg0400.cpp b/cg/cg0400.cpp index 9a0adb43e..a201b1cf3 100755 --- a/cg/cg0400.cpp +++ b/cg/cg0400.cpp @@ -151,7 +151,7 @@ public: void prospetto_pagina(TGen_array&, TIva_array&); int stampa_intestazione_ditta(); const char* desc_attivita(const char*); - const char* desc_iva(const char*); + const char* desc_iva(const TString&); char look_lia(long ditta = 0l); void look_pim(); @@ -178,18 +178,26 @@ const char* TProgressivi_iva::desc_attivita(const char* codatt) return TMP; } -const char* TProgressivi_iva::desc_iva(const char* cod) +const char* TProgressivi_iva::desc_iva(const TString& cod) { - TTable tab_iva("%IVA"); - TString codtab(format("%-4s", cod)); - tab_iva.zero(); - tab_iva.put("CODTAB", codtab); - if (tab_iva.read()==NOERR) - TMP = tab_iva.get("S0"); + if (cod == "{AF") + TMP = "Artt.17c3/74c1"; + else if (cod == "{A36") + TMP = "Art.40c5/6/8 a.i."; else - TMP = ""; + { + TTable tab_iva("%IVA"); + TString codtab(format("%-4s", (const char*)cod)); + tab_iva.zero(); + tab_iva.put("CODTAB", codtab); + if (tab_iva.read()==NOERR) + TMP = tab_iva.get("S0"); + else + TMP = ""; + } + return TMP; } @@ -255,10 +263,12 @@ void TProgressivi_iva::look_pim() TTable reg("REG"); TString80 codtab; TString16 codatt,codiva,tipoiva,codreg; + TToken_string a36("",'!'); + real imponibile, imposta,afi,afv,a36i,a36v; for (pim.first(); !pim.eof(); pim.next()) { - real imponibile, imposta; + imponibile = imposta = afi = afv = a36i = a36v = ZERO; tiporec tipo; codtab = pim.get("CODTAB"); @@ -311,6 +321,19 @@ void TProgressivi_iva::look_pim() imponibile += ifs; imposta += vfs; } + if (_mese == 13) + { // Separa le autofatture non residenti(AF) e gli importi A36 + afi = pim.get_real("R7"); + afv = pim.get_real("R8"); + a36 = pim.get("S0"); + a36i = a36.get(0); + a36v = a36.get(1); + imponibile -= afi + a36i; + imposta -= afv + a36v; + _gen1_array.add_riga("{AF",afi,afv,ZERO,ZERO,ZERO,ZERO); // Mette '{' cosi' vengono stampati per ultimi + _gen1_array.add_riga("{A36",a36i,a36v,ZERO,ZERO,ZERO,ZERO); + } + if (_mese != 13) _gen_array.add_riga(codiva,imponibile,imposta,ZERO,ZERO,ZERO,ZERO); if ((_st_inizio_anno && mese == _mese) || _mese == 13) //lo metto in un array a parte @@ -738,6 +761,7 @@ void TProgressivi_iva::prospetto_pagina(TGen_array& gen, TIva_array& iva) real t_impov,t_imposv,t_impoa,t_imposa,t_impobd,t_imposbd; t_impov = t_imposv = t_impoa = t_imposa = t_impobd = t_imposbd = ZERO; int r = 1; + TString80 descr; set_row(++r, "Cod.@40gVENDITE@77gACQUISTI@113gIMPORTAZIONI"); set_row(++r, "IVA Descrizione@29gImponibile@48gImposta@67gImponibile@86gImposta@105gImponibile@124gImposta"); @@ -746,7 +770,8 @@ void TProgressivi_iva::prospetto_pagina(TGen_array& gen, TIva_array& iva) for (int k = 0; k < gen.items(); k++) { TRiga_gen& riga = (TRiga_gen&)gen[k]; - TString80 descr = desc_iva(riga._codiva); + descr = desc_iva(riga._codiva); + if (riga._codiva[0] == '{') riga._codiva.ltrim(1); if (riga._impoven != ZERO) set_row(r, "@24g%r", &riga._impoven); if (riga._imposven != ZERO)