From 657dd8b432d8559ed9f122735e2c0da248aaeea2 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 1 May 2001 08:17:07 +0000 Subject: [PATCH] Patch level : xx.7.054 Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 1.7 patch 054 sul main trunk git-svn-id: svn://10.65.10.50/trunk@9658 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0.url | 2 +- cg/cg0100.cpp | 75 ++++----- cg/cg0100.h | 5 +- cg/cg0100a.uml | 22 ++- cg/cg0200.cpp | 164 ++++++++++++++++--- cg/cg0200.h | 6 +- cg/cg0200a.uml | 51 +++--- cg/cg0400.cpp | 15 +- cg/cg0500.cpp | 101 +++++++++--- cg/cg1.url | 2 +- cg/cg1500.cpp | 74 +++++---- cg/cg1600.cpp | 232 ++++++++++++++------------ cg/cg2.url | 15 +- cg/cg2100.cpp | 22 +++ cg/cg2100b.uml | 6 +- cg/cg2100c.uml | 2 +- cg/cg2100p.uml | 4 +- cg/cg2102.cpp | 98 ++++++++--- cg/cg2104.cpp | 13 +- cg/cg2105.cpp | 29 ++-- cg/cg3.url | 2 + cg/cg3100.cpp | 6 +- cg/cg3100a.uml | 8 +- cg/cg3100b.uml | 2 + cg/cg3200.cpp | 109 +++++------- cg/cg3200a.uml | 3 +- cg/cg3400.cpp | 2 +- cg/cg3400a.uml | 2 + cg/cg3600.cpp | 12 +- cg/cg4.url | 1 + cg/cg4300.h | 16 +- cg/cg4301.cpp | 180 ++++++++++++-------- cg/cg4302.cpp | 53 +++++- cg/cg4303.cpp | 34 +++- cg/cg4304.cpp | 282 ++++++++++++++++++++----------- cg/cg4305.cpp | 45 ++--- cg/cg4400.cpp | 6 +- cg/cg4501.cpp | 8 +- cg/cg4600.cpp | 100 ++++++----- cg/cg4600a.uml | 9 +- cg/cg4700.cpp | 16 +- cg/cg4900.cpp | 428 +++++++++++++++++++++++++++++++++++------------- cg/cg4900.h | 46 +++--- cg/cg4900b.uml | 12 +- cg/cg4900e.uml | 148 +++++++++++++++++ cg/cg4900f.uml | 138 ++++++++++++++++ cg/cg5.url | 2 +- cg/cg5300.cpp | 47 ++++-- cg/cg5300a.uml | 5 +- cg/cg5500.cpp | 110 +++++++------ cg/cg5500d.uml | 13 +- cg/cg5700.cpp | 104 ++++++++++-- cg/cg5700b.uml | 4 +- cg/cg6.cpp | 2 +- cg/cg6.url | 1 + cg/cg6100.cpp | 32 ++-- cg/cg6400.cpp | 27 +-- cg/cg6600.cpp | 2 - cg/cg6700.cpp | 26 +-- cg/cg6900.cpp | 2 +- cg/cg6900.h | 1 + cg/cg6902.cpp | 117 +++++++++---- cg/cg6904.cpp | 21 +-- cg/cglib01.cpp | 16 +- cg/cglib01.h | 2 + cg/cglib02.cpp | 10 +- cg/cglib02.h | 2 +- cg/cglib03.cpp | 2 +- cg/cglib04.cpp | 204 +++++++++++++++-------- cg/cgp1.url | 13 +- cg/cgp1100.cpp | 180 ++++++++++---------- cg/cgp1200.cpp | 76 +++++---- cg/cgsaldac.cpp | 10 +- cg/cgtrcpc.ini | 4 +- 74 files changed, 2424 insertions(+), 1217 deletions(-) create mode 100755 cg/cg4900e.uml create mode 100755 cg/cg4900f.uml diff --git a/cg/cg0.url b/cg/cg0.url index a8c25c557..d162431c9 100755 --- a/cg/cg0.url +++ b/cg/cg0.url @@ -1,2 +1,2 @@ #include - +#include diff --git a/cg/cg0100.cpp b/cg/cg0100.cpp index 76028cbb7..e6e1ea18e 100755 --- a/cg/cg0100.cpp +++ b/cg/cg0100.cpp @@ -87,38 +87,6 @@ int CG0100_application::rewrite(const TMask& m) r->lfile().put(PCN_SEZIVDOPP, sez); } const int err = r->rewrite(); - -/* Lasciamo stare i sottoconti che ci pensano da soli ad azzerare PCN_CODCBL - if (err == NOERR) - { - const long sottoconto = m.get_long(FLD_CM1_SOTTOCONTO); - if (sottoconto == 0) - { - const TString16 cod_anbi(m.get(FLD_CM1_CODTABANALISI)); - - if (cod_anbi.not_empty()) - { - r->save_status(); - TLocalisamfile & pcon = r->lfile(); - TRectype rec_pcon(r->curr()) ; - - rec_pcon.zero(); - rec_pcon.put(PCN_GRUPPO, m.get(FLD_CM1_GRUPPO)); - rec_pcon.put(PCN_CONTO, m.get(FLD_CM1_CONTO)); - pcon.curr() = rec_pcon; - for (pcon.read(_isgreat, _lock); pcon.good() && pcon.curr() <= rec_pcon; pcon.next(_lock)) - { - if (pcon.get(PCN_CODCBL).not_empty()) - { - pcon.zero(PCN_CODCBL); - pcon.rewrite(); - } - } - r->restore_status(); - } - } - } -*/ return err; } @@ -204,19 +172,12 @@ bool CG0100_application::protected_record(TRectype &rec) } void CG0100_application::init_query_mode(TMask& m) - { -/* m.show(-1); - m.show(-2); - m.show(-3); - m.hide(FLD_CM2_STSOTTAB); -*/ m.show_default(); m.hide(-3); } HIDDEN bool tmcf_handler(TMask_field& f, KEY key) - { if (f.active() && key == K_SPACE) { @@ -318,11 +279,25 @@ void CG0100_application::init_insert_mode(TMask& m) HIDDEN bool gruppo_handler(TMask_field& f, KEY key) { - TMask& m = f.mask(); + TMask& m = f.mask(); const int gruppo = m.get_int(FLD_CM1_GRUPPO); const int conto = m.get_int(FLD_CM1_CONTO); const long sottoc = m.get_long(FLD_CM1_SOTTOCONTO); - +/* + if (key == K_TAB && gruppo != 0 && conto == 0 && sottoc == 0 && + f.focusdirty() && m.is_running()) + { + TLocalisamfile& pconti = app().get_relation()->lfile(); + pconti.zero() ; + pconti.put(PCN_GRUPPO, gruppo) ; + pconti.setkey(1) ; + if (pconti.read() != NOERR) + { + m.notify_focus_field(FLD_CM1_DESC); + m.stop_run(K_AUTO_ENTER); + } + } +*/ if (key == K_ENTER) { TLocalisamfile& pconti = app().get_relation()->lfile(); @@ -336,6 +311,7 @@ HIDDEN bool gruppo_handler(TMask_field& f, KEY key) return f.warning_box ("Il gruppo non esiste"); } } + return TRUE; } @@ -345,7 +321,22 @@ HIDDEN bool conto_handler(TMask_field& f, KEY key) const int gruppo = m.get_int(FLD_CM1_GRUPPO); const int conto = m.get_int(FLD_CM1_CONTO); const long sottoc = m.get_long(FLD_CM1_SOTTOCONTO); - +/* + if (key == K_TAB && gruppo != 0 && conto != 0 && sottoc == 0 && + f.focusdirty() && m.is_running()) + { + TLocalisamfile& pconti = app().get_relation()->lfile(); + pconti.zero() ; + pconti.put(PCN_GRUPPO, gruppo); + pconti.put(PCN_CONTO, conto); + pconti.setkey(1) ; + if (pconti.read() != NOERR) + { + m.notify_focus_field(FLD_CM1_DESC); + m.stop_run(K_AUTO_ENTER); + } + } +*/ if (key == K_ENTER) { TLocalisamfile& pconti = app().get_relation()->lfile(); diff --git a/cg/cg0100.h b/cg/cg0100.h index 98e1a9dfc..4fa04c5a7 100755 --- a/cg/cg0100.h +++ b/cg/cg0100.h @@ -31,8 +31,9 @@ #define FLD_CM1_RICSER 123 #define FLD_CM1_DESCRANALISI 124 #define FLD_CM1_IVACOMP 125 -#define FLD_CM1_DESCIVD 126 -#define FLD_CM1_DESCIVDOPP 127 +#define FLD_CM1_DESCIVACOMP 126 +#define FLD_CM1_DESCIVD 127 +#define FLD_CM1_DESCIVDOPP 128 #define FLD_CM2_STSOTTBIL 200 #define FLD_CM2_STSOTTAB 201 diff --git a/cg/cg0100a.uml b/cg/cg0100a.uml index 9f5ecb1ad..68013c95a 100755 --- a/cg/cg0100a.uml +++ b/cg/cg0100a.uml @@ -1,12 +1,12 @@ #include "cg0100.h" -TOOLBAR "" 0 19 0 2 +TOOLBAR "" 0 -2 0 2 #include ENDPAGE -PAGE "Piano dei conti " 0 -1 0 19 +PAGE "Piano dei conti " 0 0 0 -2 GROUPBOX DLG_NULL 76 5 BEGIN @@ -110,7 +110,7 @@ BEGIN COPY OUTPUT FLD_CM1_SOTTOCONTO CHECKTYPE REQUIRED HELP "Descrizione del gruppo o del conto o del sottoconto" - WARNING "Manca la descrizione" + WARNING "Descrizione mancante" END NUMBER FLD_CM1_CODTABANALISI 10 @@ -363,10 +363,26 @@ BEGIN DISPLAY "Vent." S6 DISPLAY "Sospeso" B2 OUTPUT FLD_CM1_IVACOMP CODTAB + OUTPUT FLD_CM1_DESCIVACOMP S0 CHECKTYPE NORMAL VALIDATE ZEROFILL_FUNC 2 END +STRING FLD_CM1_DESCIVACOMP 50 38 +BEGIN + PROMPT 36 13 "" + USE %IVA KEY 2 + INPUT S0 FLD_CM1_DESCIVACOMP + DISPLAY "Descrizione@50" S0 + DISPLAY "Codice" CODTAB + DISPLAY "Tipo" S1 + DISPLAY "%@5" R0 + DISPLAY "Vent." S6 + DISPLAY "Sospeso" B2 + COPY OUTPUT FLD_CM1_IVACOMP + CHECKTYPE NORMAL +END + LIST FLD_CM1_TMCF 1 13 BEGIN PROMPT 1 13 "Tipo sottoconti " diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index 90ab3cc44..68805cdbb 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -57,9 +57,16 @@ protected: static void indsp_sheet_rebuilder(); static bool effetti_notify(TSheet_field& s, int r, KEY key); + void set_pnae(TMask& m, TToken_string& nonacc, TToken_string& nonscd); + void get_pnae(const TMask& m, TToken_string& nonacceff, TToken_string& nonscadeff); + virtual int write(const TMask& m); virtual int rewrite(const TMask& m); virtual int read(TMask& m); + + virtual void ini2mask(TConfig& ini, TMask&m, bool query); + virtual void mask2ini(const TMask& m, TConfig& ini); + TSheet_field& indsp_sheet() const; TString_array& field_sheet(short id) const; void reset_sheet(); @@ -305,10 +312,6 @@ bool TClifo_application::fax_handler(TMask_field& f, KEY k) bool ok = TRUE; if (k == K_SPACE) { -// TConfig ini(CONFIG_USER, "Link"); -// TFilename editor = ini.get("Editor", NULL, -1, "notepad"); -// TExternal_app app(editor); -// ok = app.run(TRUE, FALSE) == 0; TFilename msg; msg.temp(NULL, "txt"); ofstream msgf(msg); msgf.close(); goto_url(msg); @@ -356,7 +359,6 @@ bool TClifo_application::rsoc_handler(TMask_field& f, KEY k) HIDDEN bool alleg_handler(TMask_field& f, KEY key) - { if (f.to_check(key)) { @@ -454,7 +456,6 @@ void TClifo_application::init_pages(TMask& m) } void TClifo_application::init_query_mode(TMask& m) - { if (_gesven) reset_sheet(); @@ -465,15 +466,10 @@ void TClifo_application::init_query_mode(TMask& m) m.show(F_CODLIST1, !_liscatven); } -int TClifo_application::read(TMask& m) +void TClifo_application::set_pnae(TMask& m, TToken_string& nonacc, TToken_string& nonscd) { - TRelation_application::read(m); - TSheet_field& pnae = m.sfield(F_NONACCEFF); pnae.destroy(); - const TRectype& cfven = get_relation()->curr(LF_CFVEN); - TToken_string nonacc(cfven.get(CFV_NONACCEFF), ';'); - TToken_string nonscd(cfven.get(CFV_NONSCADEFF), ';'); TToken_string periodo(12, ','); int per = 0; for (bool good = nonacc.get(per, periodo); good; good = nonacc.get(++per, periodo)) @@ -485,6 +481,16 @@ int TClifo_application::read(TMask& m) row.replace('-', '|'); } pnae.force_update(); +} + +int TClifo_application::read(TMask& m) +{ + TRelation_application::read(m); + + const TRectype& cfven = get_relation()->curr(LF_CFVEN); + TToken_string nonacc(cfven.get(CFV_NONACCEFF), ';'); + TToken_string nonscd(cfven.get(CFV_NONSCADEFF), ';'); + set_pnae(m, nonacc, nonscd); if (_gesven) { @@ -528,6 +534,62 @@ int TClifo_application::read(TMask& m) return _rel->status(); } +void TClifo_application::ini2mask(TConfig& ini, TMask& m, bool query) +{ + TRelation_application::ini2mask(ini, m, query); + + if (!query) + { + ini.set_paragraph("17"); + TToken_string nonacc(ini.get(CFV_NONACCEFF), ';'); + TToken_string nonscd(ini.get(CFV_NONSCADEFF), ';'); + set_pnae(m, nonacc, nonscd); + + if (_gesven) + { + TToken_string riga(240); + indsp_sheet().reset(); + TString16 para; + for (int i=0; ;i++) + { + para.format("%d,%d", LF_INDSP, i+1); + if (!ini.set_paragraph(para)) + break; + + riga.cut(0); + riga.add(ini.get(IND_RAGSOC)); + riga.add(ini.get(IND_INDIR)); + riga.add(ini.get(IND_CIV)); + riga.add(ini.get(IND_LOCALITA)); + riga.add(ini.get(IND_CAP)); + riga.add(ini.get(IND_STATO)); + riga.add(ini.get(IND_COM)); + riga.add(ini.get(IND_PTEL)); + riga.add(ini.get(IND_TEL)); + riga.add(ini.get(IND_PFAX)); + riga.add(ini.get(IND_FAX)); + riga.add(ini.get(IND_IVARID)); + TString16 key(ini.get(IND_STATO)); key << '|' << ini.get(IND_COM); + const TRectype & com = cache().get(LF_COMUNI, key); + riga.add(com.get(COM_DENCOM)); + + indsp_sheet().row(i)=riga; + + // Load the sheets of CODINDDOC, CODINDSP, CODINDEFF. + riga.cut(0); + riga.add(ini.get(IND_CODIND)); + riga.add(ini.get(IND_RAGSOC)); + riga.add(ini.get(IND_INDIR)); + riga.add(ini.get(IND_CIV)); + riga.add(ini.get(IND_LOCALITA)); + field_sheet(F_CODINDDOC).add(riga); + field_sheet(F_CODINDSP).add(riga); + field_sheet(F_CODINDEFF).add(riga); + } + } + } +} + int TClifo_application::rewrite(const TMask& m) { common_f(m); @@ -540,6 +602,57 @@ int TClifo_application::write(const TMask& m) return TRelation_application::write(m); } +void TClifo_application::mask2ini(const TMask& m, TConfig& ini) +{ + TRelation_application::mask2ini(m, ini); + + TToken_string nonacceff(30, ';'), nonscadeff(30, ';'); + get_pnae(m, nonacceff, nonscadeff); + ini.set(CFV_NONACCEFF, nonacceff, "17"); + ini.set(CFV_NONSCADEFF, nonscadeff, "17"); + + if (_gesven) + { + const TString& tipocf = m.get(F_TIPOCF); + const long codcf = m.get_long(F_CODCF); + + TString_array& rows=indsp_sheet().rows_array(); + const int n_items = rows.items(); + + TString16 para; + for (int i = 0; i < n_items; i++) + { + para.format("%d,%d", LF_INDSP, i+1); + ini.set_paragraph(para); + + TToken_string& row=(TToken_string&)rows[i]; + ini.set(IND_TIPOCF,tipocf); + ini.set(IND_CODCF,codcf); + ini.set(IND_RAGSOC,row.get(0)); + ini.set(IND_INDIR,row.get()); + ini.set(IND_CIV,row.get()); + ini.set(IND_LOCALITA,row.get()); + ini.set(IND_CAP,row.get()); + ini.set(IND_STATO,row.get_int()); + ini.set(IND_COM,row.get()); + ini.set(IND_PTEL,row.get()); + ini.set(IND_TEL,row.get()); + ini.set(IND_PFAX,row.get()); + ini.set(IND_FAX,row.get()); + ini.set(IND_IVARID,row.get()); + ini.set(IND_CODIND,i+1); + } + for ( ; ; i++) + { + para.format("%d,%d", LF_INDSP, i+1); + if (ini.set_paragraph(para)) + ini.remove_all(); + else + break; + } + } +} + TString_array& TClifo_application::field_sheet(short id) const { TEdit_field& f = _msk->efield(id); @@ -549,13 +662,13 @@ TString_array& TClifo_application::field_sheet(short id) const TSheet_field& TClifo_application::indsp_sheet() const { - TSheet_field& o_sheet=(TSheet_field&) _msk->field(F_SHEET_G_VEN); + TSheet_field& o_sheet=_msk->sfield(F_SHEET_G_VEN); return o_sheet; } void TClifo_application::reset_sheet() { - const TToken_string nulla("|**Nessuno**||||"); + const char* nulla = "|**Nessuno**"; TClifo_application& a = app(); a.field_sheet(F_CODINDDOC).destroy(); @@ -580,10 +693,9 @@ void TClifo_application::indsp_pack() rows.pack(); } -void TClifo_application::common_f(const TMask& m) +void TClifo_application::get_pnae(const TMask& m, TToken_string& nonacceff, TToken_string& nonscadeff) { TSheet_field& pnae = m.sfield(F_NONACCEFF); - TToken_string nonacceff(30, ';'), nonscadeff(30, ';'); FOR_EACH_SHEET_ROW(pnae, re, row) if (!row->empty_items()) { TString16 p; @@ -596,10 +708,19 @@ void TClifo_application::common_f(const TMask& m) TRectype& cfven = get_relation()->curr(LF_CFVEN); int mass = cfven.length(CFV_NONACCEFF); - if (nonacceff.len() > mass) nonacceff.cut(mass); - cfven.put(CFV_NONACCEFF, nonacceff); + if (nonacceff.len() > mass) + nonacceff.cut(mass); mass = cfven.length(CFV_NONSCADEFF); - if (nonscadeff.len() > mass) nonscadeff.cut(mass); + if (nonscadeff.len() > mass) + nonscadeff.cut(mass); +} + +void TClifo_application::common_f(const TMask& m) +{ + TToken_string nonacceff(30, ';'), nonscadeff(30, ';'); + get_pnae(m, nonacceff, nonscadeff); + TRectype& cfven = get_relation()->curr(LF_CFVEN); + cfven.put(CFV_NONACCEFF, nonacceff); cfven.put(CFV_NONSCADEFF, nonscadeff); if (_gesven) @@ -644,11 +765,11 @@ void TClifo_application::indsp_sheet_rebuilder() const int n=righe.items(); a.reset_sheet(); // Rebuild Sheets + TToken_string rigav; for (int i=0; iTIPOCF FLAGS "D" GROUP 1 ITEM "C|Clienti" @@ -1070,7 +1069,6 @@ END NUMBER DLG_NULL 6 BEGIN PROMPT 2 2 "Codice " - FIELD LF_INDSP->CODCF FLAGS "RD" GROUP 2 END @@ -1149,7 +1147,7 @@ BEGIN PROMPT 1 0 "Dati identificativi" END -LIST F_TIPOCFVEN 1 11 +LIST DLG_NULL 1 11 BEGIN PROMPT 2 1 "Tipo " FIELD LF_CFVEN->TIPOCF @@ -1159,7 +1157,7 @@ BEGIN ITEM "F|Fornitori" END -NUMBER F_CODCFVEN 6 +NUMBER DLG_NULL 6 BEGIN PROMPT 2 2 "Codice " FIELD LF_CFVEN->CODCF @@ -1181,6 +1179,20 @@ BEGIN GROUP 6 END +STRING F_CODLEG 3 +BEGIN + PROMPT 2 4 "Codice Legale " + FIELD LF_CFVEN->CODLEG + GROUP 7 + USE %LEG + INPUT CODTAB F_CODLEG + DISPLAY "Codice legale" CODTAB + DISPLAY "Descrizione@30" S0 + OUTPUT F_CODLEG CODTAB + HELP "Codice legale per contenzioso" + CHECKTYPE NORMAL +END + STRING F_CODNOTE 2 BEGIN PROMPT 43 4 "Codice Note Cli/Fo " @@ -1197,18 +1209,12 @@ BEGIN CHECKTYPE NORMAL END -STRING F_CODLEG 3 +STRING F_CODPRCF 10 BEGIN - PROMPT 2 4 "Codice Legale " - FIELD LF_CFVEN->CODLEG + PROMPT 2 5 "Codice presso cliente " + FIELD LF_CFVEN->CODPRCF GROUP 7 - USE %LEG - INPUT CODTAB F_CODLEG - DISPLAY "Codice legale" CODTAB - DISPLAY "Descrizione@30" S0 - OUTPUT F_CODLEG CODTAB - HELP "Codice legale per contenzioso" - CHECKTYPE NORMAL + HELP "Codice meccanografico assegnato dal cliente" END STRING F_CODCATC 2 @@ -1224,14 +1230,6 @@ BEGIN CHECKTYPE NORMAL END -STRING F_CODPRCF 10 -BEGIN - PROMPT 2 5 "Codice presso cliente " - FIELD LF_CFVEN->CODPRCF - GROUP 7 - HELP "Codice meccanografico assegnato dal cliente" -END - GROUPBOX DLG_NULL 76 4 BEGIN PROMPT 1 7 "@bDati Agente" @@ -1396,7 +1394,7 @@ BEGIN FLAGS "U" INPUT CODTAB F_CODNOTESP1 DISPLAY "Codice" CODTAB - DISPLAY "Descrizione@30" S0 + DISPLAY "Descrizione@50" S0 OUTPUT F_CODNOTESP1 CODTAB HELP "Primo codice delle note del documento" CHECKTYPE NORMAL @@ -1444,6 +1442,7 @@ BEGIN DISPLAY "Codice vettore" CODTAB DISPLAY "Ragione sociale@50" S0 OUTPUT F_CODVETT1 CODTAB + CHECKTYPE NORMAL END NUMBER F_CODVETT2 6 @@ -1455,6 +1454,7 @@ BEGIN INPUT CODTAB F_CODVETT2 COPY DISPLAY F_CODVETT1 OUTPUT F_CODVETT2 CODTAB + CHECKTYPE NORMAL END NUMBER F_CODVETT3 6 @@ -1466,6 +1466,7 @@ BEGIN INPUT CODTAB F_CODVETT3 COPY DISPLAY F_CODVETT1 OUTPUT F_CODVETT3 CODTAB + CHECKTYPE NORMAL END STRING F_CODPORTO 3 @@ -1900,7 +1901,7 @@ END CURRENCY F_MINORD 18 BEGIN - PROMPT 40 16 "Importo minimo " + PROMPT 40 16 "Importo minimo " FIELD LF_CFVEN->MINORD GROUP 7 DRIVENBY F_CODVAL @@ -1909,7 +1910,7 @@ END CURRENCY F_MAXORD 18 BEGIN - PROMPT 40 17 "Importo massimo " + PROMPT 40 17 "Importo massimo " FIELD LF_CFVEN->MAXORD GROUP 7 DRIVENBY F_CODVAL diff --git a/cg/cg0400.cpp b/cg/cg0400.cpp index 946fb8425..4d827ea34 100755 --- a/cg/cg0400.cpp +++ b/cg/cg0400.cpp @@ -129,7 +129,7 @@ class TProgressivi_iva : public TPrintapp TAssoc_array _corr_array; TString _cap,_cofi,_paiva,_ragsoc,_comunefis,_provfis,_viafis,_codivamsk,_codattmsk; TString _datast, _cod_att; - Importi _mesi[13]; + Importi _mesi[14]; // Era 13: bestie! I mesi sono da 1 a 13 liste _tipo_lista; TString TMP; // Ex HIDDEN: bestie! @@ -273,6 +273,7 @@ bool TProgressivi_iva::user_create() _attiv = new TLocalisamfile(LF_ATTIV); set_real_picture("###.###.###.###"); + set_magic_currency(TRUE); set_print_zero(FALSE); printer().footerlen(5); @@ -483,9 +484,9 @@ void TProgressivi_iva::cerca_i_pim() tiporec tipo; codtab = pim.get("CODTAB"); - int anno = atoi(codtab.mid(0,4)); + const int anno = atoi(codtab.mid(0,4)); codatt = codtab.mid(4,5); - int mese = atoi(codtab.mid(13,2)); + const int mese = atoi(codtab.mid(13,2)); codreg.format("%d%-3s",anno, (const char*)codtab.mid(10,3)); codiva = codtab.mid(16,4); tipoiva = pim.get("S5"); @@ -1129,13 +1130,13 @@ int TProgressivi_iva::stampa_intestazione_ditta() (const char*)_cap, (const char*)_comunefis, (const char*)_provfis); r++; - riga = "Data @< Pag. @#"; - riga.right_just(127); + riga = "Data @> Pag. @#"; + riga.right_just(123); TString80 dep; dep.format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi); - riga.overwrite (dep); - set_header (r, "%s", (const char*) riga); + riga.overwrite(dep); + set_header (r, riga); r+=3; return r; diff --git a/cg/cg0500.cpp b/cg/cg0500.cpp index 7d3c0c4c8..eae9df658 100755 --- a/cg/cg0500.cpp +++ b/cg/cg0500.cpp @@ -83,7 +83,10 @@ protected: virtual void init_modify_mode(TMask& m) { init_query_mode(m); } virtual int rewrite(const TMask& m); virtual int write(const TMask& m); - virtual int read(TMask& m); + virtual int read(TMask& m); + virtual void ini2sheet(TConfig& ini, TSheet_field &sheet); + virtual void sheet2ini(TSheet_field &sheet,TConfig& ini); + void load_rcaus(TMask& m); int re_write(const TMask& m, bool re); @@ -213,7 +216,7 @@ void TCaus_app::causale_acquisti() if (_tipo_des != acquisto) { int i = 0; - set_descr( i++, "C Fornitori"); + set_descr(i++, "C Fornitori"); set_descr(i++, "C Di costo"); set_descr(i++, "C Iva acquisti"); set_descr(i++, "C Iva non detraibile"); @@ -245,19 +248,19 @@ void TCaus_app::causale_inc_pag() if (_tipo_des != incasso_pagamento) { int i = 0; - set_descr ( i++, "C Clienti/Fornitori"); - set_descr ( i++, "C Cassa o banca"); - set_descr ( i++, "C Tratta"); - set_descr ( i++, "C Ricevuta bancaria"); - set_descr ( i++, "C Cessione"); - set_descr ( i++, "C Paghero'"); - set_descr ( i++, "C Lettera di credito"); - set_descr ( i++, "C Tratta accettata"); - set_descr ( i++, "C Abbuoni pass./sc."); - set_descr ( i++, "C Abbuoni att./sc."); - set_descr ( i++, "C Spese e rimborsi"); - set_descr ( i++, "C Ritenute fiscali"); - set_descr ( i++, "C Differenza cambio"); + set_descr(i++, "C Clienti/Fornitori"); + set_descr(i++, "C Cassa o banca"); + set_descr(i++, "C Tratta"); + set_descr(i++, "C Ricevuta bancaria"); + set_descr(i++, "C Cessione"); + set_descr(i++, "C Paghero'"); + set_descr(i++, "C Lettera di credito"); + set_descr(i++, "C Tratta accettata"); + set_descr(i++, "C Abbuoni pass./sc."); + set_descr(i++, "C Abbuoni att./sc."); + set_descr(i++, "C Spese e rimborsi"); + set_descr(i++, "C Ritenute fiscali"); + set_descr(i++, "C Differenza cambio"); _tipo_des = incasso_pagamento; carica_righe_libere(i); } @@ -663,15 +666,13 @@ int TCaus_app::read(TMask& m) int err = TRelation_application::read(m); if (err == NOERR) { - TRectype r = _rcaus->curr(); - - r.zero(); + TRectype r(LF_RCAUSALI); r.put(RCA_CODCAUS, m.get(F_COD_CAUS)); _rcaus_rec->read(r); load_rcaus(m); fill_sheet(m); - const TString16 tpd = m.get(F_TIPO_DOC); + const TString& tpd = m.get(F_TIPO_DOC); calc_filter(tpd); } return err; @@ -721,11 +722,11 @@ void TCaus_app::load_rcaus(TMask& m) bool TCaus_app::fill_sheet(TMask& m) { - const TString16 codreg = m.get(F_COD_REG); - const TString16 tpd = m.get(F_TIPO_DOC); + const TString8 codreg = m.get(F_COD_REG); + const TString8 tpd = m.get(F_TIPO_DOC); const int tpm = m.get_int(F_TIPO_MOV); const int m770 = m.get_int(F_M_770); - int tpr = m.get_int(F_TIPO_REG); + int tpr = m.get_int(F_TIPO_REG); if (!m.is_running()) { @@ -793,6 +794,62 @@ bool TCaus_app::remove() return TRelation_application::remove() && _rcaus_rec->remove() == NOERR; } +void TCaus_app::ini2sheet(TConfig& ini, TSheet_field& sheet) +{ + TMask& m = sheet.mask(); + fill_sheet(m); + const TString& tpd = m.get(F_TIPO_DOC); + calc_filter(tpd); + + TString16 defpar, d; + TString da; + for (int i = 0; i < ss().items(); i++) + { + defpar.format("%d,%d", LF_RCAUSALI, i+1); + if (ini.set_paragraph(defpar)) + { + const char sz = ini.get(RCA_SEZIONE)[0]; + const char cf = ini.get(RCA_TIPOCF)[0]; + const int g = ini.get_int(RCA_GRUPPO); + const int c = ini.get_int(RCA_CONTO); + const long s = ini.get_long(RCA_SOTTOCONTO); + d = ini.get(RCA_CODDESC); + da = cache().get("%DPN", d, "S0"); + TBill tc(g,c,s,cf); + add_riga(i, sz, tc, d, da); + } + } +} + +void TCaus_app::sheet2ini(TSheet_field& sheet,TConfig& ini) +{ + TString16 defpar; + for (int i = 0; i < ss().items(); i++) + { + defpar.format("%d,%d", LF_RCAUSALI, i+1); + ini.set_paragraph(defpar); + + TToken_string &riga = ss().row(i); + const int g = riga.get_int(3); + if (g > 0) + { + const TString4 sezione = riga.get_char(1); + const TString4 tipo_cf = riga.get_char(); + const int c = riga.get_int(4); // Salta al conto + const long s = riga.get_long(); + const char* coddesc = riga.get(7); // Salta alla descrizione conto + ini.set(RCA_CODDESC, coddesc); + ini.set(RCA_SEZIONE, sezione); + ini.set(RCA_TIPOCF, tipo_cf); + ini.set(RCA_GRUPPO, g); + ini.set(RCA_CONTO, c); + ini.set(RCA_SOTTOCONTO, s); + } + else + ini.remove_all(); + } +} + void TCaus_app::init_mask(TMask& m) { m.set(F_ANNOES, _anno_iva); diff --git a/cg/cg1.url b/cg/cg1.url index a8c25c557..d162431c9 100755 --- a/cg/cg1.url +++ b/cg/cg1.url @@ -1,2 +1,2 @@ #include - +#include diff --git a/cg/cg1500.cpp b/cg/cg1500.cpp index 69c126f2c..82862b4e9 100755 --- a/cg/cg1500.cpp +++ b/cg/cg1500.cpp @@ -272,7 +272,7 @@ bool TStampa_bilanci::mask_anno(TMask_field& f, KEY k) tipo_stp = f.mask().get_int(F_STAMPA); else tipo_stp = f.mask().get_int(F_STAMPA1); - if (tipo_bil == 2 && tipo_stp == 1 && f.mask().get_int(F_ANNO) == 0) + if (tipo_bil == 2 && tipo_stp == 1 /* && f.mask().get_int(F_ANNO) == 0 */) f.mask().show(F_QUADRATURA); else { @@ -314,40 +314,43 @@ bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k) m.hide(96); m.hide(97); } -else -{ - if (bilancio == 2) - if (anno != 0) - { - m.show(F_DATADA); - m.show(F_DATAA); - //m.show(F_STAMPAMPROV); - m.show(96); - m.show(97); - m.hide(98); - m.hide(99); - } - else - { - m.show(F_DATADA); - m.show(F_DATAA); - //m.show(F_STAMPAMPROV); - m.show(98); - m.show(99); - m.hide(96); - m.hide(97); - } -} + else + { + if (bilancio == 2) + if (anno != 0) + { + m.show(F_DATADA); + m.show(F_DATAA); + //m.show(F_STAMPAMPROV); + m.show(96); + m.show(97); + m.hide(98); + m.hide(99); + } + else + { + m.show(F_DATADA); + m.show(F_DATAA); + //m.show(F_STAMPAMPROV); + m.show(98); + m.show(99); + m.hide(96); + m.hide(97); + } + } tipo_bil = f.mask().get_int(F_BILANCIO); if (tipo_bil == 1) tipo_stp = f.mask().get_int(F_STAMPA); else tipo_stp = f.mask().get_int(F_STAMPA1); - if (tipo_bil == 2 && tipo_stp == 1 && f.mask().get_int(F_ANNO) == 0) + if (tipo_bil == 2 && tipo_stp == 1 /* && f.mask().get_int(F_ANNO) == 0 */) f.mask().show(F_QUADRATURA); else + { + f.mask().set (F_QUADRATURA,""); f.mask().hide(F_QUADRATURA); + } } return TRUE; } @@ -407,10 +410,13 @@ bool TStampa_bilanci::mask_date(TMask_field& f, KEY k) if (anno) { TDate dataini = esc[anno].fine(); - if (data == dataini && bil == 2 && f.mask().get_int(F_ANNO) == 0) + if (data == dataini && bil == 2 /*&& f.mask().get_int(F_ANNO) == 0*/) f.mask().show(F_QUADRATURA); else + { + f.mask().reset(F_QUADRATURA); f.mask().hide(F_QUADRATURA); + } } } } @@ -1737,7 +1743,7 @@ bool TStampa_bilanci::calcola(int g, int c, long s) const TString& codcaus = mov.get(MOV_CODCAUS); const char causap = causali.decode(codcaus)[0]; - if (!_quadratura && causap == 'C') + if (!_quadratura && causap == 'C') { // Si tratta di causale di chiusura: // Non e' richiesta la quadratura con il Libro Giornale (Modifica @@ -1812,7 +1818,8 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin if (_tipo_stampa1 == 1) anno = _annoapp; - else anno = _annoes; + else + anno = _annoes; _lista = new TSaldi_list(g, c, anno); TRecnotype items = _lista->items(); @@ -3741,11 +3748,12 @@ bool TStampa_bilanci::set_print(int) if (_bilancio == 1) { + printer().footerlen(3); _prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE); _totali = m.get_bool(F_TOTALI); _codici = m.get_bool(F_CODICI); _saldo = m.get_bool(F_SALDO); - _tipo_stampa = atoi(m.get(F_STAMPA)); + _tipo_stampa = m.get_int(F_STAMPA); if (_tipo_stampa == 1) { @@ -3768,14 +3776,14 @@ bool TStampa_bilanci::set_print(int) else { printer().footerlen(5); - _stampa_width = atoi(m.get(F_MODULO)); + _stampa_width = m.get_int(F_MODULO); if (_stampa_width == 1) _stampa_width = 132; else _stampa_width = 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400) - _verifica = atoi(m.get(F_VERIFICA)); + _verifica = m.get_int(F_VERIFICA); if ( (_verifica == 1)||(_verifica == 2) ) _prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE); - _tipo_stampa1 = atoi(m.get(F_STAMPA1)); + _tipo_stampa1 = m.get_int(F_STAMPA1); if (_tipo_stampa1 == 1) { if (_annoes != 0) diff --git a/cg/cg1600.cpp b/cg/cg1600.cpp index 1a29edba9..c5ca413a3 100755 --- a/cg/cg1600.cpp +++ b/cg/cg1600.cpp @@ -260,6 +260,7 @@ public: const char* descr_sottoc_clifo(char,long); void setta_righe(const char*); void setta_righe_verifica(); + void stampa_risultato_prima_delle_imposte(bool raff = FALSE); void stampa_totali(); void stampa_totali_con_raffronto(); void stampa_totali_verifica(); @@ -922,10 +923,13 @@ void TStampa_IVdirettiva::riempi_record(const TString& sez, const real& sld_dare,const real& sld_avere, const real& mov_dare,const real& mov_avere,char tipocf,bool conto_dettagliato) { - set_bil_key(_bil, sez[0], let[0], numerorom, numero, FALSE, g, c, s, tipocf); - set_bil_val(_bil, saldo, saldorafr, sld_dare, sld_avere, mov_dare, mov_avere,conto_dettagliato); - _sort->sort ((const char*) _bil); - _items_sort++; + if (!(_stampamov && saldo.is_zero() && saldorafr.is_zero())) + { + set_bil_key(_bil, sez[0], let[0], numerorom, numero, FALSE, g, c, s, tipocf); + set_bil_val(_bil, saldo, saldorafr, sld_dare, sld_avere, mov_dare, mov_avere,conto_dettagliato); + _sort->sort ((const char*) _bil); + _items_sort++; + } } void TStampa_IVdirettiva::crea_sort_tabella() @@ -999,7 +1003,6 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_scalare() int gruppo_prec,conto_prec; real saldo,saldo_raf,saldo_conto,saldo_conto_raf; real saldo_conto_opp,saldo_conto_raf_opp; - TString saldostr,saldo_rafstr; c = 0; num_conto = 0; tmcf = ' '; @@ -1038,10 +1041,6 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_scalare() { if (no_sez_opposta) { - TString saldo_contostr,saldo_conto_rafstr; - - saldo_contostr = saldo_conto.string(); - saldo_conto_rafstr = saldo_conto_raf.string(); riempi_record(sez_conto,let_conto,numr_conto,num_conto,gruppo_prec,conto_prec,0,saldo_conto,saldo_conto_raf,ZERO,ZERO,ZERO,ZERO,tmcf,conto_dettagliato); saldo_conto = ZERO; saldo_conto_raf = ZERO; @@ -1155,8 +1154,6 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_scalare() // la classe. In caso affermativo anche questo sottoconto appena // letto avra' la stessa classe del conto. - saldostr = saldo.string(); - saldo_rafstr = saldo_raf.string(); bool stessa_sezione = (saldo * saldo_raf) > ZERO; if (classe_conto) @@ -1632,7 +1629,7 @@ void TStampa_IVdirettiva::crea_sort_piano_conti_verifica() else { if (sez != "0" && sez != "") - scrivi_record(sez,let,numerorom,numero,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tmcf); + scrivi_record(sez,let,numerorom,numero,g,c,s,saldo,ZERO,sld_prg_dare,sld_prg_avere,mov_dare,mov_avere,tmcf); } } } @@ -2186,14 +2183,40 @@ bool TStampa_IVdirettiva::set_print(int) return FALSE; } +void TStampa_IVdirettiva::stampa_risultato_prima_delle_imposte(bool raff) +{ + if (_risimp_fatto) // Ottimo flag che significa esattamente l'opposto! Grazie PRASSI! + { + if (_let_stamp != 'E') // Forse questo non ci va + { + const char* descr_lett = descrizione_lettera('9', 'E'); + set_row (_i++, "@0gE) %s", descr_lett); + } + + if (_let_da_stamp == 'E' && atoi(_num_da_stamp) > 21 && + !_totale_parziale.is_zero() && !_totale_parziale_raf.is_zero()) + { + set_row (_i,"@4gTotale delle partite straordinarie"); + set_row (_i,"@81g%r", &_totale_parziale); + if (raff) + set_row (_i,"@111g%r", &_totale_parziale_raf); + _i++; + } + + set_row (_i,"@4gRisultato prima delle imposte"); + set_row (_i,"@81g%r", &_totale_economico); + if (raff) + set_row (_i,"@111g%r", &_totale_economico_raf); + _i++; + _risimp_fatto = FALSE; + } +} + void TStampa_IVdirettiva::stampa_totali() { bool gia_stampato_conto_ord = FALSE; - TString16 diff_prod; - TString16 ris_imp; - - diff_prod.format("%c%c",'9','B'); - ris_imp.format ("%c%c%8s%2s",'9','E',"","21"); + const char* diff_prod = "9B"; + const char* ris_imp = "9E 21" ; TString16 classe; classe.format("%c%c%8s%2s", _sez_da_stamp,_let_da_stamp,(const char*)_numr_da_stamp,(const char*)_num_da_stamp); @@ -2218,7 +2241,7 @@ void TStampa_IVdirettiva::stampa_totali() if (_let_stamp != 'Z') { if (_sez_stamp != '5') - if (_cont_gcs != 0)//(_cont_gcs >= 2) + if (_cont_gcs != 0) // (_cont_gcs >= 2) { //Fai il totale del numero arabo e stampalo if (_num != 0) @@ -2228,21 +2251,25 @@ void TStampa_IVdirettiva::stampa_totali() } } } - if (_sez_stamp == '9') + + if (_sez_stamp == '9') // Conto economico { - if (classe > ris_imp && _risimp_fatto) + if (classe > ris_imp && _risimp_fatto) // Classe > 9E________21 { +/* Killed if (_num_tot == "20" || _num_tot == "21") { set_row (_i,"@4gTotale delle partite straordinarie"); set_row (_i++,"@81g%r", &_totale_parziale); - } + } set_row (_i,"@4gRisultato prima delle imposte"); set_row (_i++,"@81g%r", &_totale_economico); - _risimp_fatto = FALSE; + _risimp_fatto = FALSE; +*/ + stampa_risultato_prima_delle_imposte(); } } - + _cont_gcs = 0; _totale_numero = 0; } @@ -2597,6 +2624,7 @@ void TStampa_IVdirettiva::stampa_totali() set_row (_i++,"@81g%r", &_totale_ordine); _totale_ordine = ZERO; } + if (_sez_stamp == '9') { if (_buff == NULL) @@ -2608,6 +2636,7 @@ void TStampa_IVdirettiva::stampa_totali() } if (_risimp_fatto) { +/* Killed if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21")) { set_row (_i,"@4gTotale delle partite straordinarie"); @@ -2615,11 +2644,13 @@ void TStampa_IVdirettiva::stampa_totali() } if ( (classe > ris_imp && _risimp_fatto) || _buff == NULL) - { + { set_row (_i,"@4gRisultato prima delle imposte"); set_row (_i++,"@81g%r", &_totale_economico); _risimp_fatto = FALSE; } +*/ + stampa_risultato_prima_delle_imposte(); } } @@ -2668,37 +2699,40 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() if (_num_da_stamp!=_num_tot) { - if (_let_stamp != 'Z') { - if (_sez_stamp != '5') - if (_cont_gcs != 0)//(_cont_gcs >= 2) + if (_sez_stamp != '5' && _cont_gcs != 0) + { + //Fai il totale del numero arabo e stampalo + if (_num != 0) { - //Fai il totale del numero arabo e stampalo - if (_num != 0) - { - set_row (_i,"@18gTotale@25g%2d)", _num); - set_row (_i,"@81g%r", &_totale_numero); - set_row (_i++,"@111g%r", &_totale_num_raf); - } + set_row (_i,"@18gTotale %2d)", _num); + set_row (_i,"@81g%r", &_totale_numero); + set_row (_i++,"@111g%r", &_totale_num_raf); } - } + } + } + if (_sez_stamp == '9') { if (classe > ris_imp && _risimp_fatto) { +/* killed if (_num_tot == "20" || _num_tot == "21") { set_row (_i,"@4gTotale delle partite straordinarie"); set_row (_i,"@81g%r", &_totale_parziale); set_row (_i++,"@111g%r", &_totale_parziale_raf); - } + } set_row (_i,"@4gRisultato prima delle imposte"); set_row (_i,"@81g%r", &_totale_economico); set_row (_i++,"@111g%r", &_totale_economico_raf); _risimp_fatto = FALSE; +*/ + stampa_risultato_prima_delle_imposte(TRUE); } } + _cont_gcs = 0; _totale_numero = 0; _totale_num_raf = 0; @@ -2708,17 +2742,18 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() if (_let_stamp != 'Z') { if (_sez_stamp != '5') - { + { if (_cont_gcs != 0)//(_cont_gcs >= 2) { //Fai il totale del numero arabo e stampalo if (_num != 0) { - set_row (_i,"@18gTotale@25g%2d)", _num); + set_row (_i,"@18gTotale %2d)", _num); set_row (_i,"@81g%r", &_totale_numero); set_row (_i++,"@111g%r", &_totale_num_raf); } } + if (_cont_num != 0)//(_cont_num >= 2) { //Fai il totale del numero romano e stampalo @@ -2726,7 +2761,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() TString16 numrom = itor(numeror); if (numrom != "") { - set_row (_i,"@14gTotale@21g%s", (const char*) numrom); + set_row (_i,"@14gTotale %s", (const char*) numrom); set_row (_i,"@81g%r", &_totale_numr); set_row (_i++,"@111g%r", &_totale_numr_raf); } @@ -2753,7 +2788,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() //Fai il totale del numero arabo e stampalo if (_num != 0) { - set_row (_i,"@18gTotale@25g%2d)", _num); + set_row (_i,"@18gTotale %2d)", _num); set_row (_i++,"@81g%r", &_totale_numero); } } @@ -2764,7 +2799,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() TString numrom = itor(numeror); if (numrom != "") { - set_row (_i,"@14gTotale@21g%s", (const char*) numrom); + set_row (_i,"@14gTotale %s", (const char*) numrom); set_row (_i++,"@81g%r", &_totale_numr); } } @@ -2774,14 +2809,17 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() if (_let_stamp == 'D') set_row (_i,"@4gTotale delle rettifiche"); else + { if (_let != ' ') if (_sez_stamp == '9' && _let_stamp != 'E') - set_row (_i,"@3gTotale@10g%c)", _let); + set_row (_i,"@3gTotale %c)", _let); else if (_sez_stamp != '9') - set_row (_i,"@3gTotale@10g%c)", _let); + set_row (_i,"@3gTotale %c)", _let); + set_row (_i,"@3gTotale %c)", _let); + } if (_let != ' ') - { + { if (_sez_stamp == '9' && _let_stamp != 'E') { set_row (_i,"@81g%r", &_totale_lettera); @@ -2838,7 +2876,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() //Fai il totale della lettera e stampalo if (_let != ' ') { - set_row (_i,"@3gTotale@10g%c)", _let); + set_row (_i,"@3gTotale %c)", _let); set_row (_i,"@81g%r", &_totale_lettera); set_row (_i++,"@111g%r", &_totale_let_raf); } @@ -2936,7 +2974,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() //Fai il totale del numero arabo e stampalo if (_num != 0) { - set_row (_i,"@18gTotale@25g%2d)", _num); + set_row (_i,"@18gTotale %2d)", _num); set_row (_i,"@81g%r", &_totale_numero); set_row (_i++,"@111g%r", &_totale_num_raf); } @@ -2948,7 +2986,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() TString numrom = itor(numeror); if (numrom != "") { - set_row (_i,"@14gTotale@21g%s", (const char*) numrom); + set_row (_i,"@14gTotale %s", (const char*) numrom); set_row (_i++,"@81g%r", &_totale_numr); set_row (_i++,"@111g%r", &_totale_numr_raf); } @@ -2960,14 +2998,14 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() { if (_sez_stamp == '9' && _let_stamp != 'E') { - set_row (_i,"@3gTotale@10g%c)", _let); + set_row (_i,"@3gTotale %c)", _let); set_row (_i++,"@81g%r", &_totale_lettera); set_row (_i++,"@111g%r", &_totale_let_raf); } else if (_sez_stamp != '9') { - set_row (_i,"@3gTotale@10g%c)", _let); + set_row (_i,"@3gTotale %c)", _let); set_row (_i++,"@81g%r", &_totale_lettera); set_row (_i++,"@111g%r", &_totale_let_raf); } @@ -3124,6 +3162,7 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() set_row (_i++,"@4gDifferenza tra valore e costi della produzione@81g%r@111g%r", &_totale_economico,&_totale_economico_raf); _diffprod_fatto = FALSE; } +/* killed if (_risimp_fatto) { if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21")) @@ -3141,6 +3180,8 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto() _risimp_fatto = FALSE; } } +*/ + stampa_risultato_prima_delle_imposte(TRUE); } char app = ' '; set_row (_i++,"@0g%c", app); @@ -3599,8 +3640,10 @@ print_action TStampa_IVdirettiva::postprocess_page(int file, int counter) print_action TStampa_IVdirettiva::postprocess_print(int file, int counter) { if (_stampa != screenvis) + { delete _prog_stampa; - + _prog_stampa = NULL; + } return NEXT_PAGE; } @@ -3672,39 +3715,39 @@ bool TStampa_IVdirettiva::preprocess_stampa_scalare(int counter) } else { - _classe_stampata = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num); - _sez_stamp = bil->sez; - _let_stamp = bil->let; + _classe_stampata.format("%1c%1c%8s%2d",bil->sez,bil->let,(const char*)bil->numr,bil->num); + _sez_stamp = bil->sez; + _let_stamp = bil->let; _numr_stamp = bil->numr; _numr_stamp.ltrim(); _num_stamp = bil->num; _num_stamp.ltrim(); - _sez_tot = bil->sez; - _let_tot = bil->let; + _sez_tot = bil->sez; + _let_tot = bil->let; _numr_tot = bil->numr; _numr_tot.ltrim(); - _num_tot = bil->num; + _num_tot = bil->num; _num_tot.ltrim(); } } _buff = _sort->retrieve(); - if (_buff == NULL) + if (_buff == NULL) { if (_annoeserafr == 0 && _databilrafr == botime) - stampa_totali(); + stampa_totali(); else - stampa_totali_con_raffronto(); + stampa_totali_con_raffronto(); _sez_da_stamp = ' '; _sez_stamp = ' '; return TRUE; - } + } if (_buff != NULL) { bil = (struct bil_ivd*) _buff; - _classe_da_stampare = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num); + _classe_da_stampare.format("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num); _sez_da_stamp = bil->sez; _let_da_stamp = bil->let; _numr_da_stamp = bil->numr; @@ -3729,10 +3772,12 @@ bool TStampa_IVdirettiva::preprocess_stampa_scalare(int counter) if (counter) { if (fai) + { if (_annoeserafr == 0 && _databilrafr == botime) stampa_totali(); else stampa_totali_con_raffronto(); + } } //Fare ricerca di dataregmov @@ -4025,42 +4070,18 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) { if (bil->gruppo[0]=='Z') return FALSE; - - if (_stampamov) - { - if (_sale.is_zero()) - return FALSE; - } } else { if (bil->gruppo[0]=='Z') -// { if (_classe_da_stampare == _classe_stampata) -// { -// sprintf (bil->gruppo,"%s", " "); -// sprintf (bil->conto ,"%s", " "); -// sprintf (bil->sottoc,"%s", " "); -// } -// else return FALSE; -// } - - if (_stampamov) - { - if (_sale.is_zero()) - return FALSE; - } } + if (_stampamov && _sale.is_zero()) + return FALSE; if ((g != 0) && (c != 0) && (s == 0) && (conto_dettagliato)) { - //if (_sld_prg_avere < ZERO) - // _sld_prg_avere = -_sld_prg_avere; - - //if (_mov_avere < ZERO) - // _mov_avere = -_mov_avere; - if (_sale < ZERO) { _sale = -_sale; @@ -4080,12 +4101,6 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter) if (_let_da_stamp == 'E' && (_num_da_stamp == "20" || _num_da_stamp == "21")) _tot_parz_sld += _sale; - //if (_sld_prg_avere < ZERO) - // _sld_prg_avere = -_sld_prg_avere; - - //if (_mov_avere < ZERO) - // _mov_avere = -_mov_avere; - if (_sale < ZERO) { _sale = -_sale; @@ -4366,10 +4381,17 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo) if (stampa_classe) { if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9')) - { - set_row(_i,"@0g%c", bil->let); - *_descr = (const char*) descr_let; - setta_righe_descr(_descr,lettera1,lettera2); + { + if (_sez_da_stamp=='9' && bil->let=='E' && !_risimp_fatto) + { + // Non stampare E) ... se gia` stampato da totale prima delle imposte + } + else + { + set_row(_i,"@0g%c", bil->let); + *_descr = (const char*) descr_let; + setta_righe_descr(_descr,lettera1,lettera2); + } //set_row(_i++,"@1g)@3g%s", (const char*) descr_let); //_cont_let += 1; if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z')) @@ -4838,9 +4860,7 @@ void TStampa_IVdirettiva::setta_righe_descr_verifica(TParagraph_string* str,cons if (i > 1) set_row (_i,formato2,r); - set_row (_i,"@46g!@80g!@114g!"); - - _i++; + set_row (_i++ ,"@46g!@80g!@114g!"); i++; } } @@ -4882,13 +4902,13 @@ const char* TStampa_IVdirettiva::descrizione_lettera(char sezione, char lettera) const char* TStampa_IVdirettiva::descrizione_numeroromano(char sezione, char lettera, int numr) { TTable tabivd(TAB_IVD); - TString dep, dep2; + TString80 dep, dep2; tabivd.zero(); if (numr != 0) - dep = format("%1c%1c%04d", sezione, lettera, numr); + dep.format("%1c%1c%04d", sezione, lettera, numr); else - dep = format("%c%c ", sezione, lettera); + dep.format("%c%c ", sezione, lettera); tabivd.put("CODTAB", dep); tabivd.read(); @@ -4903,13 +4923,13 @@ const char* TStampa_IVdirettiva::descrizione_numeroromano(char sezione, char let const char* TStampa_IVdirettiva::descrizione_numero(char sezione, char lettera, int numr, int numero) { TTable tabivd(TAB_IVD); - TString dep,dep2; + TString80 dep,dep2; tabivd.zero(); if (numr != 0) - dep = format("%1c%1c%04d%02d",sezione, lettera, numr, numero); + dep.format("%1c%1c%04d%02d",sezione, lettera, numr, numero); else - dep = format("%c%c %02d",sezione,lettera,numero); + dep.format("%c%c %02d",sezione,lettera,numero); tabivd.put("CODTAB", dep); tabivd.read(); dep2 = tabivd.get("CODTAB"); diff --git a/cg/cg2.url b/cg/cg2.url index cef22d332..afc3ccf5b 100755 --- a/cg/cg2.url +++ b/cg/cg2.url @@ -2,16 +2,15 @@ // Prima nota -MENUBAR MENU_BAR(0) - -MENU MENU_BAR(0) - SUBMENU M_FILE "~File" - SUBMENU M_EDIT "~Modifica" - SUBMENU M_FONT "~Opzioni" - SUBMENU M_HELP "~Help" +#include +SUBMENU M_FONT "~Opzioni" MENU M_FONT - ITEM MENU_ITEM(1) "~Colori righe" + ITEM MENU_ITEM(1) "~Colori righe" + +MENU MENU_BAR(1) + SUBMENU M_FILE "~File" + SUBMENU M_HELP "~Help" diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index c5456ffd1..b57b48626 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -1573,6 +1573,7 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini) if (mov_cesp > ' ') { const char str_cesp[2] = { mov_cesp, '\0' }; + ini.set_paragraph(format("%d", LF_MOV)); ini.set("MOVCESP", str_cesp); ini.set("DESCRCAUS", msk.get(F_DESCRCAUS)); const TEsercizio& annoes = _esercizi[msk.get_int(F_ANNOES)]; @@ -1601,6 +1602,13 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini) const TBill french(rec, TRUE); ini.set("DESCRCONTOC", french.descrizione()); } + for ( ; ; i++) + { + if (ini.set_paragraph(format("%d,%d", LF_RMOV, i+1))) + ini.remove_all(); + else + break; + } for (i = 0; i < _rel->iva_items(); i++) { @@ -1613,6 +1621,13 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini) ini.set(name, rec.get(name)); } } + for ( ; ; i++) + { + if (ini.set_paragraph(format("%d,%d", LF_RMOVIVA, i+1))) + ini.remove_all(); + else + break; + } if (is_fattura()) { @@ -1634,6 +1649,13 @@ void TPrimanota_application::mask2ini(const TMask& msk, TConfig& ini) ini.set(name, rec.get(name)); } } + for ( ; ; i++) + { + if (ini.set_paragraph(format("%d,%d", LF_SCADENZE, i+1))) + ini.remove_all(); + else + break; + } } } } diff --git a/cg/cg2100b.uml b/cg/cg2100b.uml index 24af7aed8..b7a283457 100755 --- a/cg/cg2100b.uml +++ b/cg/cg2100b.uml @@ -193,11 +193,11 @@ BEGIN USE CAM INPUT CODTAB[1,3] SK_VALUTA SELECT INPUT CODTAB[4,11] SK_DATACAMBIO - DISPLAY "Valuta" CODTAB[1,3] + DISPLAY "Codice valuta" CODTAB[1,3] DISPLAY "Data@10" D0 - DISPLAY "Cambio@15" R10 + DISPLAY "Cambio@18R" S4 OUTPUT SK_DATACAMBIO D0 - OUTPUT SK_CAMBIO R10 + OUTPUT SK_CAMBIO S4 GROUP 3 5 CHECKTYPE SEARCH END diff --git a/cg/cg2100c.uml b/cg/cg2100c.uml index aa811a956..9dcee4ef6 100755 --- a/cg/cg2100c.uml +++ b/cg/cg2100c.uml @@ -539,7 +539,7 @@ BEGIN INPUT CODTAB F_VALUTAINTRA DISPLAY "Codice" CODTAB DISPLAY "Nome@50" S0 - DISPLAY "Cambio@15" R10 + DISPLAY "Cambio@15" S4 DISPLAY "Ultimo aggiornamento" D0 OUTPUT F_VALUTAINTRA CODTAB CHECKTYPE NORMAL diff --git a/cg/cg2100p.uml b/cg/cg2100p.uml index b7f3b158c..5ca1f9ed7 100755 --- a/cg/cg2100p.uml +++ b/cg/cg2100p.uml @@ -38,7 +38,7 @@ BEGIN USE CAM INPUT CODTAB[1,3] P_VALUTA SELECT INPUT CODTAB[4,11] P_DATACAMBIO - DISPLAY "Valuta" CODTAB[1,3] + DISPLAY "Codice valuta" CODTAB[1,3] DISPLAY "Data@10" D0 DISPLAY "Cambio@18R" S4 // DISPLAY "Contro Euro" B1 @@ -76,7 +76,7 @@ END STRING P_NUMERO 7 BEGIN PROMPT 15 3 "" - FLAGS "U" + FLAGS "U#" END CURRENCY P_RESIDUO 18 diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index b16819469..24c9574a4 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -547,7 +548,8 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va TImporto residuo(imptot); residuo -= cassa; residuo.normalize(imptot.sezione()); bool ok = TRUE; - if (!residuo.is_zero()) +// if (!residuo.is_zero()) + if (abs(residuo.valore()) >= 0.001) { TPrimanota_application& a = app(); const TMask& m = a.curr_mask(); @@ -1120,8 +1122,19 @@ bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key) { const real& percent = cod2IVA(m); const real imponibile(f.get()); - real imposta = abs(imponibile) * percent / 100.0; imposta.ceil(); - if (imponibile.sign() < 0) imposta = -imposta; + const int dec = TCurrency::get_firm_dec(); + real imposta; + if (dec == 0) + { + imposta = abs(imponibile) * percent / 100.0; + imposta.ceil(); + if (imponibile.sign() < 0) imposta = -imposta; + } + else + { + imposta = imponibile * percent / 100.0; + imposta.round(dec); + } m.set(104, imposta); } } @@ -1202,9 +1215,19 @@ bool TPrimanota_application::imposta_handler(TMask_field& f, KEY key) { const real imponibile(f.mask().get(101)); const real percent = app().causale().corrispettivi() ? ZERO : cod2IVA(f.mask()); - real imposta = abs(imponibile) * percent / 100.0; - imposta.ceil(TCurrency::get_firm_dec()); - if (imponibile.sign() < 0) imposta = -imposta; + const int dec = TCurrency::get_firm_dec(); + real imposta; + if (dec == 0) + { + imposta = abs(imponibile) * percent / 100.0; + imposta.ceil(); + if (imponibile.sign() < 0) imposta = -imposta; + } + else + { + imposta = imponibile * percent / 100.0; + imposta.round(dec); + } const real val(f.get()); if (val != imposta) @@ -1928,19 +1951,28 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key) // Certified 90% bool TPrimanota_application::data74ter_handler(TMask_field& f, KEY key) { - if (!f.to_check(key)) return TRUE; - bool ok = datacomp_handler(f, key); - if (ok) - { - const TDate d74(f.get()); - const TLibro_giornale& g = app().giornale(); - if (d74 < g.last_print()) - { - ok = f.error_box("La data per il 74/ter e' antecedente alla data di stampa " - "del libro giornale dell'esercizio %d", g.year()); - } + if (!f.to_check(key)) + return TRUE; + + const TDate dr(f.mask().get(F_DATAREG)); // Data operazione + const TDate d74(f.get()); // Data 74/ter + if (d74 > dr) + return TRUE; + + if (d74.year() < dr.year()-1) + return error_box("La data 74/ter non puo' essere antecedente all'anno %d", dr.year()-1); + + const TLibro_giornale g(d74.year()); + if (!g.ok()) + return error_box("La data 74/ter non appartiene ad un esercizio valido"); + + if (d74 < g.last_print()) + { + const char* lp = g.last_print().string(); + return f.error_box("La data 74/ter e' antecedente al %s,\n" + "data di stampa del libro giornale del %d", lp, g.year()); } - return ok; + return TRUE; } @@ -2497,6 +2529,24 @@ bool TPrimanota_application::ritsoc_handler(TMask_field& f, KEY key) return TRUE; } +HIDDEN void inventa_cambio_intra(TMask& m) +{ + const TString& codval = m.get(F_VALUTAINTRA); + if (codval.not_empty() && TCurrency::get_firm_val() != codval) + { + TTable cam("CAM"); + cam.put("CODTAB", codval); + int err = cam.read(_isgteq); + if (err == NOERR) + { + TString16 v = cam.get("CODTAB"); + v.cut(3).rtrim(); + if (v != codval) + m.set(F_CAMBIOINTRA, cache().get("%VAL", codval, "S4")); + } + } +} + // Handler of F_CORRLIRE // Certified 99% bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key) @@ -2526,12 +2576,12 @@ bool TPrimanota_application::corrlire_handler(TMask_field& f, KEY key) { if (cv.empty()) { + if (m.field(F_CAMBIOINTRA).empty()) + inventa_cambio_intra(m); const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA)); TCurrency imp(real(f.get())); imp.change_value(cambio); - cv.set(imp.string()); - if (m.field(F_CAMBIOINTRA).empty() && !cambio.is_firm_value()) // CM500208 - m.set(F_CAMBIOINTRA, cambio.get_base_change()); + cv.set(imp.get_num().string()); } } @@ -2561,12 +2611,12 @@ bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key) { if (cl.empty()) { + if (m.field(F_CAMBIOINTRA).empty()) + inventa_cambio_intra(m); const TExchange cambio(m.get(F_VALUTAINTRA), m.get_real(F_CAMBIOINTRA)); TCurrency imp(real(f.get()), cambio); imp.change_to_firm_val(); - cl.set(imp.string()); - if (m.field(F_CAMBIOINTRA).empty() && !cambio.is_firm_value()) // CM500208 - m.set(F_CAMBIOINTRA, cambio.get_base_change()); + cl.set(imp.get_num().string()); } } else diff --git a/cg/cg2104.cpp b/cg/cg2104.cpp index c57f20373..2bc5e7337 100755 --- a/cg/cg2104.cpp +++ b/cg/cg2104.cpp @@ -444,8 +444,8 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key) if (key == K_TAB && f.to_check(key, TRUE)) { TMask& m = f.mask(); - const TString16 val = f.get(); - const bool full = val.not_empty(); + const TString& val = f.get(); + const bool full = val.not_empty() && val != TCurrency::get_firm_val(); if (full) { @@ -463,11 +463,10 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key) TCursor& cur = *dc.browse()->cursor(); if (cur.items() == 0) // Uso cambio standard { - TCurrency std(1e6, val); // Converto un Marco ... - std.change_to_base_val(); // ... in lire - dc.set(cache().get("%VAL", val, "D0")); - m.enable(SK_CAMBIO); - m.set(SK_CAMBIO, real(std.get_num() / 1e6), TRUE); + const TRectype& recval = cache().get("%VAL", val); + dc.set(recval.get("D0")); + m.enable(SK_CAMBIO); // Abilito per far funzionare la prossima riga + m.set(SK_CAMBIO, recval.get("S4"), TRUE); } } diff --git a/cg/cg2105.cpp b/cg/cg2105.cpp index 658ad51f7..73cbc76b8 100755 --- a/cg/cg2105.cpp +++ b/cg/cg2105.cpp @@ -232,7 +232,8 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad, TRelation rel(LF_PAGSCA); // Working relation rel.add(LF_PARTITE, "ANNO==ANNO|NUMPART==NUMPART"); rel.curr() = oldpag; - rel.curr(LF_PARTITE) = sum; + rel.curr(LF_PARTITE) = sum; + set(S_CODVAL, fatt.get(PART_CODVAL)); // Importante settare la valuta per i TCurrency! CM500433 autoload(rel); // Load current record on mask TMask_field& group = field(S_RATA); @@ -741,8 +742,8 @@ bool TGame_mask::cambio_handler(TMask_field& f, KEY k) { TGame_mask& gm = (TGame_mask&)f.mask(); const bool needed = app().partite().mov2rig(gm._numreg, gm._numrig) > 0; - if (needed && yesno_box("Aggiornare gli importi dei pagamenti?")) - { + if (needed && yesno_box("Aggiornare il cambio di tutti i pagamenti effettuati in questa registrazione?")) + { const TValuta val(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO); gm.aggiorna_valuta(val); } @@ -783,6 +784,8 @@ void TGame_mask::aggiorna_residuo() _resval.normalize(sez); set(P_RESIDUOVAL, _resval.valore()); } + else + reset(P_RESIDUOVAL); #endif } @@ -1334,8 +1337,8 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k) const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO, P_CONTROEURO); if (parval != curval) { - TString c = parval.codice(); - if (c.empty()) c = "lire"; + TString16 c = parval.codice(); + if (c.empty()) c = TCurrency::get_firm_val(); if (was == NULL) giochi.destroy(game); return f.error_box("La fattura deve essere pagata in %s.", (const char*)c); @@ -1525,15 +1528,17 @@ void TGame_mask::add_importo(TToken_string& s, const TImporto& i, const char* va s.add("", pos); else { - TString80 v; TImporto n(i); n.normalize(); - - if (valuta == NULL || *valuta == '\0') - valuta = "_FIRM"; const TCurrency curr(n.valore(), valuta); - v = curr.string(FALSE); v.replace('.', ','); // Mette la virgola - v << ' ' << n.sezione(); - s.add(v, pos); + TString80 v = curr.string(FALSE); + if (!real::is_null(v)) + { + v.replace('.', ','); // Mette la virgola + v << ' ' << n.sezione(); + s.add(v, pos); + } + else + s.add("", pos); } } diff --git a/cg/cg3.url b/cg/cg3.url index 0b253223c..d2364be66 100755 --- a/cg/cg3.url +++ b/cg/cg3.url @@ -1,4 +1,6 @@ #include +#include + /* ---------------------------------------------------- * cg3 -2 diff --git a/cg/cg3100.cpp b/cg/cg3100.cpp index c0bcc90f8..25f0925b3 100755 --- a/cg/cg3100.cpp +++ b/cg/cg3100.cpp @@ -1213,6 +1213,8 @@ void TListaMov_application::print_intra(int& rr) const TString16 codval = mov.get(MOV_CODVALI); TString80 str; + rr++; + const TCurrency cl(mov.get_real(MOV_CORRLIRE)); str = cl.string(TRUE); str.right_just(19); set_row(rr,"Corr.in lire@14g%s", (const char*)str); @@ -1221,7 +1223,7 @@ void TListaMov_application::print_intra(int& rr) str = cv.string(TRUE); str.right_just(19); set_row(rr,"@34gCorr.in valuta@49g%s", (const char*)str); - set_row(rr++,"@70g%-3s", (const char*)codval); + set_row(rr,"@70g%-3s", (const char*)codval); } } @@ -2125,7 +2127,7 @@ void TListaMov_application::init_print(const TMask& msk) printer().footerlen(5); set_magic_currency(TRUE); - set_curr_codval(msk.get(F_CODVAL)); +// set_curr_codval(msk.get(F_CODVAL)); // Commentato in maschera switch (_tipo_lista) { diff --git a/cg/cg3100a.uml b/cg/cg3100a.uml index 1e455601f..484c6f3f2 100755 --- a/cg/cg3100a.uml +++ b/cg/cg3100a.uml @@ -226,12 +226,6 @@ BEGIN END /* -TEXT DLG_NULL -BEGIN - PROMPT 2 17 "N.B. se non indicato nessun valore stampa completa in ordine di data" -END -*/ - STRING F_CODVAL 3 BEGIN PROMPT 2 18 "Valuta " @@ -255,7 +249,7 @@ BEGIN COPY OUTPUT F_CODVAL CHECKTYPE NORMAL END - +*/ ENDPAGE diff --git a/cg/cg3100b.uml b/cg/cg3100b.uml index 063b05ed0..1fa10dcfe 100755 --- a/cg/cg3100b.uml +++ b/cg/cg3100b.uml @@ -218,6 +218,7 @@ BEGIN PROMPT 2 13 "Non stampare i separatori delle migliaia" END +/* STRING F_CODVAL 3 BEGIN PROMPT 2 14 "Valuta " @@ -229,6 +230,7 @@ BEGIN CHECKTYPE NORMAL FLAGS "U" END +*/ BUTTON DLG_PRINT 10 2 BEGIN diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index a8bd545a5..8cf3194c1 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -672,7 +672,7 @@ bool TMastrini_application::almeno_un_record() if (_mov->bad()) _mov->zero(); datacomp = (_mov->curr().get(MOV_DATACOMP)); - TString provvis (_mov->curr().get(MOV_PROVVIS)); + const TString16 provvis (_mov->curr().get(MOV_PROVVIS)); if (_annomsk == 0) datareg = rmov.get_date(RMV_DATAREG); @@ -685,7 +685,7 @@ bool TMastrini_application::almeno_un_record() if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc)) break; else - if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.trim().empty())) + if ( ((annoes==_annomsk) || (_annomsk==0)) && ((datareg>=_data_ini) && (datareg<=_data_fine)) && (_stampa_mov_prov || provvis.blank())) { trovato = TRUE; break; @@ -2427,7 +2427,7 @@ bool TMastrini_application::set_print(int) else _real_picture = "####.###.###.###"; set_real_picture(_real_picture); - set_curr_codval(_msk->get(F_VALUTA)); +// set_curr_codval(_msk->get(F_VALUTA)); // Commentato in maschera set_magic_currency(TRUE); if (tasto == K_ENTER) @@ -3133,15 +3133,15 @@ void TMastrini_application::calcola_progressivi_al(const TDate& data_fin) long numreg = rmov.get_long(RMV_NUMREG); _mov->setkey(1); - _mov->curr().zero(); - _mov->curr().put(MOV_NUMREG,numreg); + _mov->zero(); + _mov->put(MOV_NUMREG,numreg); _mov->read(); if (_mov->bad()) _mov->zero(); - datacomp = (_mov->curr().get(MOV_DATACOMP)); - TString provvis (_mov->curr().get(MOV_PROVVIS)); + datacomp = _mov->curr().get(MOV_DATACOMP); - if ((_stampa_mov_prov) || ((!_stampa_mov_prov) && (provvis.trim().empty()))) + const TString16 provvis (_mov->curr().get(MOV_PROVVIS)); + if (_stampa_mov_prov || (!_stampa_mov_prov && provvis.blank())) { if (_annomsk == 0) { @@ -3182,12 +3182,10 @@ void TMastrini_application::calcola_progressivi(bool finali) TLocalisamfile saldi(LF_SALDI); real progdare_attuale,progavere_attuale,progdare_prec,progavere_prec; - real saldo,progredare_eseprec,progreavere_eseprec,pdarep,paverep,saldoini_attuale,saldofine_attuale; + real saldo,progredare_eseprec,progreavere_eseprec,saldoini_attuale,saldofine_attuale; char salini,salini_attuale,salfine_attuale; - saldo = ZERO; - pdarep = ZERO; - paverep = ZERO; + saldo = ZERO; // Saldo iniziale (Guy: Ovvio no?) // Ricerca sull'archivio saldi dei record con gruppo,conto,sottoconto // uguali a quelli di rmov per il calcolo dei progressivi precedenti @@ -3198,20 +3196,25 @@ void TMastrini_application::calcola_progressivi(bool finali) saldi.put(SLD_CONTO, _conto); saldi.put(SLD_SOTTOCONTO, _sottoc); - TRectype record(saldi.curr()); + const TRectype record(saldi.curr()); for (saldi.read(_isgteq); saldi.good() && saldi.curr() == record; saldi.next()) { if (!saldi.get_bool(SLD_FLSCA)) { - int annoes_saldi = saldi.curr().get_int(SLD_ANNOES); + const int annoes_saldi = saldi.curr().get_int(SLD_ANNOES); //Calcola i progressivi dell'esercizio attuale - if (annoes_saldi == _anno_corrente) { progdare_attuale = saldi.get_real(SLD_PDARE); progavere_attuale = saldi.get_real(SLD_PAVERE); + if (_stampa_mov_prov) + { + progdare_attuale += saldi.get_real(SLD_PDAREPRO); + progavere_attuale += saldi.get_real(SLD_PAVEREPRO); + } + saldo = saldi.get_real(SLD_SALDO); salini = saldi.get(SLD_FLAGSALINI)[0]; _ultima_data_reg = saldi.get_date(SLD_DATAULMOV); @@ -3220,78 +3223,44 @@ void TMastrini_application::calcola_progressivi(bool finali) saldofine_attuale = saldi.get_real(SLD_SALDOFIN); salfine_attuale = saldi.get_char(SLD_FLAGSALFIN); } - -//Calcola i progressivi dell'esercizio precedente - - if (annoes_saldi == _anno_precedente) - { - pdarep = saldi.get_real(SLD_PDARE); - paverep = saldi.get_real(SLD_PAVERE); - - if (_stampa_mov_prov) - { - progredare_eseprec += saldi.get_real(SLD_PDAREPRO); - progreavere_eseprec += saldi.get_real(SLD_PAVEREPRO); - } - - // cerca eventuale record scaricati - } - -// Se il saldo dell'esercizio attuale e' diverso da 0 allora significa che -// quello corrisponde al saldo finale dell'esercizio precedente. Per ottenere -// i progressivi dell'esercizio precedente devo a questo punto sommare i -// progressivi dell'esercizio e i progressivi di quelli scaricati, tenendo -// conto del flag salini per sapere se il saldo e' dare oppure avere. - -/* - if (_annomsk != 0 && _anno_corrente == annoes_saldi) - { - if (saldo != ZERO) - { - if (salini == 'D') - { - progredare_eseprec = saldo;// + pdarescap + pdarep; - progdare_prec = saldo; - } - else if (salini == 'A') - { - progreavere_eseprec = saldo;// + paverescap + paverep; - progavere_prec = saldo; - } - } - } -*/ } // if (!saldi.get_bool(SLD_FLSCA)) } // FOR //Se il saldo dell'esercizio attuale non e' diverso da zero, allora il saldo // finale dell'esercizio precedente devo calcolarmelo tenendo conto dell'indbil - if (_annomsk != 0 /*&& saldo == ZERO*/) // Guy: Non capisco perche' sia commentato! + if (_annomsk != 0 /* && saldo == ZERO */) // Guy: Non capisco perche' sia commentato! { if ((_indbil == 1) || (_indbil == 2) || (_indbil == 5)) { const TRecnotype pos = saldi.recno(); // W96SALDI del 18-07-96 saldofin_esprec usa il flag TRUE xche' deve // considerare anche il saldo finale - saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE); + saldo = _sld->saldofin_esprec(_anno_corrente,_gruppo,_conto,_sottoc,TRUE, _stampa_mov_prov); saldi.readat(pos); - if (saldo> ZERO) + if (saldo > ZERO) { progredare_eseprec = saldo; progdare_prec = saldo; } else if (saldo < ZERO) - { - saldo = -saldo; - progreavere_eseprec = saldo; - progavere_prec = saldo; - } + { + saldo = -saldo; + progreavere_eseprec = saldo; + progavere_prec = saldo; + } } } - calcola_progressivi_al(finali ? _data_fine : _data_ini); + if (finali) + calcola_progressivi_al(_data_fine); + else + { + TDate giorno_prima = _data_ini; --giorno_prima; // CM500429 + calcola_progressivi_al(giorno_prima); + } + //Calcolo dei progressivi precedenti: somma di tutti quei movimenti di rmov //che hanno la data di registrazione inferiore alla data di inizio stampa, @@ -3315,12 +3284,12 @@ void TMastrini_application::calcola_progressivi(bool finali) if (salini_attuale == 'D') _totprogre_dare_al += saldoini_attuale; - else if (salini_attuale == 'A') - _totprogre_avere_al += saldoini_attuale; + else + _totprogre_avere_al += saldoini_attuale; if (salfine_attuale == 'D') _totprogre_dare_al += saldofine_attuale; - else if (salfine_attuale == 'A') - _totprogre_avere_al += saldofine_attuale; + else + _totprogre_avere_al += saldofine_attuale; } else { @@ -3334,7 +3303,7 @@ void TMastrini_application::calcola_progressivi(bool finali) if (salfine_attuale == 'D') _totprogre_dare_al += saldofine_attuale; else if (salfine_attuale == 'A') - _totprogre_avere_al += saldofine_attuale; + _totprogre_avere_al += saldofine_attuale; } } diff --git a/cg/cg3200a.uml b/cg/cg3200a.uml index 482bb9b80..d04332eb1 100755 --- a/cg/cg3200a.uml +++ b/cg/cg3200a.uml @@ -446,6 +446,7 @@ BEGIN ITEM "3|Completa" END +/* STRING F_VALUTA 3 BEGIN PROMPT 4 17 "Valuta di stampa " @@ -469,7 +470,7 @@ BEGIN COPY OUTPUT F_VALUTA CHECKTYPE NORMAL END - +*/ ENDPAGE diff --git a/cg/cg3400.cpp b/cg/cg3400.cpp index 14b50f4c8..c452a2c8b 100755 --- a/cg/cg3400.cpp +++ b/cg/cg3400.cpp @@ -1897,7 +1897,7 @@ bool TStampa_giornale::set_print(int) _stampa_len = ma.get_int(STAMPA_LEN); set_magic_currency(TRUE); - set_curr_codval(ma.get(F_CODVAL)); +// set_curr_codval(ma.get(F_CODVAL)); // Se stampa definitiva DALLA_DATA e' la data di inizio esercizio // e si scartano i movimenti gia' stampati su bollato diff --git a/cg/cg3400a.uml b/cg/cg3400a.uml index c1aca7fb9..fad1443e3 100755 --- a/cg/cg3400a.uml +++ b/cg/cg3400a.uml @@ -124,6 +124,7 @@ BEGIN MESSAGE FALSE ENABLE,DATA_DA END +/* STRING F_CODVAL 3 BEGIN PROMPT 1 10 "Valuta " @@ -136,6 +137,7 @@ BEGIN // Per ora non visibile FLAGS "HU" END +*/ BUTTON DLG_PRINT 10 2 BEGIN diff --git a/cg/cg3600.cpp b/cg/cg3600.cpp index 62dffd092..1bf2c233a 100755 --- a/cg/cg3600.cpp +++ b/cg/cg3600.cpp @@ -827,6 +827,10 @@ void TMastrino::read(const TBill& conto, _riga.append(r); } } + + // Mi sposto all'inizio per far funzionare bene da subito il metodo riga(0) + mov().first(); + rmov().first(); } void TMastrino::reread() @@ -2199,7 +2203,7 @@ void TMastrini_grid::destroy() HIDDEN const char* real2string(const real& r) { - TCurrency cur(r, "_FIRM"); + TCurrency cur(r); return cur.string(TRUE); } @@ -2292,14 +2296,16 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell) case 105: { const TRectype& rmov = _mastrino.riga(rec); - if (rmov.get_char(RMV_SEZIONE) == 'D') + const char sez = rmov.get_char(RMV_SEZIONE); + if (sez == 'D') cell = real2string(rmov.get_real(RMV_IMPORTO)); } break; case 106: { const TRectype& rmov = _mastrino.riga(rec); - if (rmov.get_char(RMV_SEZIONE) == 'A') + const char sez = rmov.get_char(RMV_SEZIONE); + if (sez == 'A') cell = real2string(rmov.get_real(RMV_IMPORTO)); } break; diff --git a/cg/cg4.url b/cg/cg4.url index a8c25c557..53ba6f885 100755 --- a/cg/cg4.url +++ b/cg/cg4.url @@ -1,2 +1,3 @@ #include +#include diff --git a/cg/cg4300.h b/cg/cg4300.h index f08ac1c3c..f34e9a36a 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -27,18 +27,13 @@ class TProgind; #define AGR_PCON1 201 #define AGR_PCON2 202 -// arrotondamento default -// da cambiare se la lira si appesantisce o in caso di inflazione polacca -#define ROUND_LIRA (0) -#define ROUND_MILLELIRE (-3) - // picture default per i reali // in caso di inflazione polacca occorrera' modificare la lunghezza // e quindi cambiare le set_row in cg4304.cpp onde evitare overlap #define REAL_PICTURE "###.###.###.###" // IVA a debito da non pagare ma riportare al mese successivo -#define IVA_DA_RIPORTARE real(50000.0) +// #define IVA_DA_RIPORTARE real(50500.0) // detrazione per detraibili 6% #define DETRAZIONE_6PERCENTO real(0.06) @@ -501,11 +496,15 @@ public: // i tipi delega passati (stile tokenstring) sommando // gli interessi se interesse = TRUE real versamenti_IVA(int month, const char* types, bool interesse = FALSE); + // Ritorna il valore dell'iva da riportare (solitamente 50500) + real iva_da_riportare(int month); - // Funzione personale di arrotondamento alle 1000 LIRE per l'annuale. + // Funzione personale di arrotondamento alle 1000 LIRE o all'euro. // Risolve il seguente problema: da 0 a 500 lire arrotonda alle mille inferiori // da 501 a 999 arrotonda alle mille superiori. void round_mille_lire(real& d); + // Funzione personale di arrotondamento alla lira o centesimo di euro. + void round_alla_lira(real& d, bool superiore = FALSE); // supporto stampa void describe_firm(int month); @@ -581,7 +580,8 @@ public: void set_grand_1999(_DescrItem& d, int &rw); void set_grand_2000(_DescrItem& d, int &rw); void set_pim_head(_DescrItem& d); - void set_liqacc(_DescrItem& d); + void set_liqacc_1999(_DescrItem& d); + void set_liqacc_2000(_DescrItem& d); // Utility per stampare nella colonna debito o credito void print_importo(int rw, const char* prompt, real imp, bool red = FALSE); diff --git a/cg/cg4301.cpp b/cg/cg4301.cpp index 6605e0b4d..bade327b5 100755 --- a/cg/cg4301.cpp +++ b/cg/cg4301.cpp @@ -262,7 +262,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) _isviaggio = _nditte->curr(LF_ATTIV).get_bool("REG74TER"); _isagricolo = _nditte->curr(LF_ATTIV).get_bool("REGAGR"); - _isagr98 = _isagricolo && atoi(_year) > 1997; + _isagr98 = _isagricolo && atoi(_year) >= 1998; _isvent = FALSE; if (!_recalc_regis && tipoatt == 1 && waspla && month == 13) @@ -280,6 +280,8 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) _pla->put("R12",""); _pla->put("R14",""); _pla->put("R15",""); + _pla->put("R16",""); + _pla->put("R17",""); _pla->put("S1","0"); _pla->put("S2","0"); _pla->put("S3","0"); @@ -403,11 +405,13 @@ bool TLiquidazione_app::update_firm(int month, bool recalc) //deve essere stampato il prospetto di liquidazione //dell'acconto in coda al resto if (_isregis && stliq) + { if ((month == 12 && _freqviva == "M") || (month == 12 && _isbenzinaro && _gest4) || (month == 13 && _freqviva == "T" && !_isbenzinaro) || (month == 13 && _isbenzinaro && !_gest4)) describe_liqacc(); + } } return ok || calc; } @@ -513,8 +517,8 @@ void TLiquidazione_app::zero_att(int month, const char* codatt) { for (_pia->first(); !_pia->eof(); _pia->next()) { - int m = atoi(*_pia_mese); - TString att = (const char*)*_pia_codatt; + const int m = atoi(*_pia_mese); + const TString16 att = (const char*)*_pia_codatt; if (m == month && att == codatt && (_year == *_pia_anno)) { _pia->put("R0",""); // Imponibile @@ -552,10 +556,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real acquisti_iva = 0.0; real vendite = 0.0; real vendite_iva = 0.0; - real esenti_b1 = 0.0; - real esenti_b2 = 0.0; - real esenti_b3 = 0.0; - real esenti_b4 = 0.0; + real esenti_c1 = 0.0; + real esenti_c2 = 0.0; + real esenti_c3 = 0.0; + real esenti_c1a = 0.0; + real esenti_c3_bam = 0.0; // Beni ammorizzabili esenti c3 + real esenti_c1a_bam = 0.0; // Beni ammorizzabili esenti c1a real esenti_b14 = 0.0; real vendite_vp1 = 0.0; real vendite_vp1a = 0.0; @@ -639,16 +645,15 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) TRectype from(_cur->curr()); from.zero(); TRectype to(from); - TDate f(1, 1, year_int); // Per le agenzie di viaggio si parte da inizio anno (sempre) + TDate f(1, month == 13 ? 1 : month, year_int); TDate t; // Spiegazione dell'arcano segreto sulle agenzie viaggio: // non viene applicato lo stesso metodo delle ditte normali perche' si deve - // tenere conto della DATA74TER se presente. - if (!_isviaggio) - { - f.set_month(month == 13 ? 1 : month); - } + // tenere conto della DATA74TER se presente. + // Per le agenzie di viaggio si parte da inizio anno precedente + if (_isviaggio) + f = TDate(1, 1, year_int-1); if (year_int < 1998 || _recalc_regis) // Vecchia selezione o calcolo progoressivi per stampa registri bollati { @@ -700,12 +705,17 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) const TString8 tipodoc = _mov->get(MOV_TIPODOC); const bool corrisp = _reg->get_bool("B0"); const tiporeg tipomov = (tiporeg)_reg->get_long("I0"); + // Controlla se la data del documento si riferisce all'anno precedente (PRORATA 1998) TDate datedoc(_mov->get(MOV_DATADOC)); - if (_isviaggio && tipomov == vendita && !(_mov->get(MOV_DATA74TER).empty())) - date = _mov->get_date(MOV_DATA74TER); - + if (_isviaggio) + { + if (tipomov == vendita && !(_mov->get(MOV_DATA74TER).empty())) + date = _mov->get_date(MOV_DATA74TER); + if (date.year() != year_int) // Controlla anno di appartenenza, altrimenti is_date_ok potrebbe non funzionare + continue; + } /* * check register present, rmoviva present and date OK * @@ -999,14 +1009,22 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) { if (sosp_imp != normale && sosp_imp != vol_affari) // CM500308 { - if (tipoes_v == "B1") - esenti_b1 += imponibile; - else if (tipoes_v == "B2") - esenti_b2 += imponibile; - else if (tipoes_v == "B3") - esenti_b3 += imponibile; - else if (tipoes_v == "B4") - esenti_b4 += imponibile; + if (tipoes_v == "B1") // C1 + esenti_c1 += imponibile; + else if (tipoes_v == "B2") // C2 + esenti_c2 += imponibile; + else if (tipoes_v == "B3") // C3 + { + esenti_c3 += imponibile; + if (tipocr == 4) + esenti_c3_bam += imponibile; + } + else if (tipoes_v == "B4") // C1A + { + esenti_c1a += imponibile; + if (tipocr == 4) + esenti_c1a_bam += imponibile; + } // se e' il caso sommare esenti per rimborso if (isrimbinfr) esni_rimb += imponibile; @@ -1315,6 +1333,18 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) if (liq) add_corrisp(month, reg, tot, perc, tipodet, codiva, codatt); } } + else if (tipodoc == "FF") // CM500415: prima non c'era questo if + { + // queste sono fatture fiscali + true_corrisp = TRUE; + + real perc = _iva->get_real("R0")/CENTO; + real tot = imponibile + imposta; + lor += tot; + lorcor += tot; + if (liq) + add_corrisp(month, reg, tot, perc, tipodet, codiva, codatt); + } else if (tipodoc == "FS") { // queste sono fatture che seguono scontrino, il lordo va detratto @@ -1546,7 +1576,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real perc = _iva->get_real("R0"); real new_iva = (_pim->get_real("R0") * perc)/CENTO; - new_iva.ceil(ROUND_LIRA); // TBC check ceil + round_alla_lira(new_iva, TRUE); if (new_iva != old_iva) { @@ -1577,7 +1607,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real perc = _iva->get_real("R0"); real iva = (_pia->get_real("R0") * perc)/CENTO; - iva.ceil(ROUND_LIRA); + round_alla_lira(iva, TRUE); agr_detIA += iva; _pia->put("R1",iva); // resetta in modo da non vederlo il mese dopo @@ -1687,7 +1717,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) real pdetr = (agr_2i / (agr_1i + agr_2i)); pdetr.round(2); acquisti_iva += agr_7 * pdetr; - acquisti_iva.round(ROUND_LIRA); + round_alla_lira(acquisti_iva, TRUE); } if (_isagr98) @@ -1726,10 +1756,12 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt) _pum->put("R1", cess_amm_iva); _pum->put("R2", ammort_6); _pum->put("R3", ammort_6_iva); - _pum->put("R4", esenti_b1); - _pum->put("R5", esenti_b2); - _pum->put("R6", esenti_b3); - _pum->put("R13", esenti_b4); + _pum->put("R4", esenti_c1); + _pum->put("R5", esenti_c2); + _pum->put("R6", esenti_c3); + _pum->put("R13", esenti_c1a); + _pum->put("S4", esenti_c3_bam); + _pum->put("S5", esenti_c1a_bam); _pum->put("R7", esenti_b14); _pum->put("R12", esni_rimb); _pum->put("R14", vendite_vp1); @@ -2704,7 +2736,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) { // calcolo credito costo, debito mensile, perc. ripart. perc_r = a_mCEE.is_zero() ? ZERO : (a_mCEE * CENTO)/(a_mCEE + a_meCEE); perc_r.round(2); - real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); + real ivm = (c_mCEE * perc_r)/CENTO; round_alla_lira(ivm, TRUE); real tc = (c_iCEE + ivm); real ta = (a_iCEE + a_mCEE); real bi = tc - ta - credito_costo_prec(month); @@ -2714,15 +2746,16 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) { cred_cost = abs(bi); if (atoi(_year) < 2000) - cred_cost.round(ROUND_LIRA); + round_alla_lira(cred_cost); else round_mille_lire(cred_cost); } else { - deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) * - (aliquota_agvia()/CENTO); - deb_mens.ceil(ROUND_LIRA); // ceil voluto MI3074 + const real ali_via = aliquota_agvia(); + // deb_mens = (bi /((CENTO + ali_via)/CENTO)) * (ali_via/CENTO); + deb_mens = bi * ali_via / (ali_via+CENTO); + round_alla_lira(deb_mens, TRUE); // ceil voluto MI3074 risultato += deb_mens; res_debt += deb_mens; iva_vend += deb_mens; @@ -2737,7 +2770,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) perc = imp_agr2.is_zero() ? ZERO : imp_agr2 / (imp_agr1 + imp_agr2); perc.round(2); iva_ded = acq_noCEE * perc; - iva_ded.round(ROUND_LIRA); + round_alla_lira(iva_ded); iva_acq += iva_ded; res_debt += iva_vend; res_cred += iva_acq; @@ -2826,11 +2859,13 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) vol_aff_t = vf1 + vf2; vol_aff_l += _pla->get_real("R0"); // volume affari lordo - real es_b1 = _pla->get_real("R1"); - real es_b2 = _pla->get_real("R2"); - real es_b3 = _pla->get_real("R3"); - real es_b4 = _pla->get_real("R15"); - real csamm = _pla->get_real("R4"); + real es_c1 = _pla->get_real("R1"); + real es_c2 = _pla->get_real("R2"); + real es_c3 = _pla->get_real("R3"); + real es_c1a = _pla->get_real("R15"); + real es_c3_am = _pla->get_real("R16"); + real es_c1a_am = _pla->get_real("R17"); + real csamm = _pla->get_real("R4"); real prorata = 0.0; real conguaglio = 0.0; @@ -2840,18 +2875,19 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) // calcola nuovo prorata per ogni attivita' (miste: 1+2) if (year_int > 1997) // Calcolo dal 1998 in poi { - const real rsa = ris - es_b4 - es_b3; - const real rsn = rsa - es_b1; + const real rsa = ris - (es_c1a-es_c1a_am) - (es_c3-es_c3_am); + const real rsn = rsa - es_c1; if (!rsa.is_zero()) prorata = CENTO - ((rsn/rsa) * CENTO); // Percentuale di indetraibilita: reciproco della percentuale di detraibilita' } else { if (!ris.is_zero()) - prorata = (es_b1/ris) * CENTO; + prorata = (es_c1/ris) * CENTO; } - prorata.round(ROUND_LIRA); + prorata.round(0); + //if (prorata != _prorata.current()) { // calcolo conguaglio -- se positivo e' a debito @@ -2928,7 +2964,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) look_lim(month+deltam,TRUE); // azzeriamo tutto (tranne r1, r5, s1, s0, s7) - TString codtab = _lim->get("CODTAB"); + const TString codtab = _lim->get("CODTAB"); real rimborso = _lim->get("R1"); real r5 = _lim->get("R5"); // Rettifiche @@ -2968,9 +3004,9 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) /* * acconto dicembre se previsto */ - if (((month+deltam) >= 12 && _freqviva == "M") || //solo freq. M puo' - (month == 12 && _isbenzinaro && _gest4) || //essere differita - (month == 13 && _freqviva == "T")) + if (((month+deltam) >= 12 && _freqviva == "M") || // solo freq. M puo' essere differita + (month == 12 && _isbenzinaro && _gest4) || + (month >= (atoi(_year) >= 2000 ? 12 : 13) && _freqviva == "T")) { acc_dec = versamenti_IVA(12,"7"); risultato -= acc_dec; @@ -2979,7 +3015,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) // in annuale si arrotondera' a 1000 in stampa // se no il conguaglio prorata fa casino - risultato.round(ROUND_LIRA); + round_alla_lira(risultato); _lim->put("R0",risultato); _lim->put("R2",cred_cost); @@ -3018,7 +3054,7 @@ void TLiquidazione_app::write_liq(int month, const char* codatts) const real interesse = interesse_trimestrale(_month); const real r = risultato - imposta_non_versata; // CM 26-09-2000 real ivi = r.sign() > 0 ? (r * interesse / CENTO) : ZERO; - ivi.ceil(ROUND_LIRA); + round_alla_lira(ivi, TRUE); _lim->put("R14", ivi); } @@ -3160,10 +3196,12 @@ void TLiquidazione_app::recalc_annual(const char* att) { // viene chiamata 2 volte per le att. miste; PLA e' stata // azzerata dove serve da update_firm se siamo all'annuale - real es_b1 = 0.0; - real es_b2 = 0.0; - real es_b3 = 0.0; - real es_b4 = 0.0; + real es_c1 = 0.0; + real es_c2 = 0.0; + real es_c3 = 0.0; + real es_c1a = 0.0; + real es_c3_am = 0.0; + real es_c1a_am= 0.0; real cess_amm = 0.0; real vendite = 0.0; real pro_pag = 0.0; @@ -3184,10 +3222,12 @@ void TLiquidazione_app::recalc_annual(const char* att) volaff1 = _pla->get_real("R14"); volaff2 = (const char*)_pla->get("S1"); vendite = _pla->get_real("R0"); - es_b1 = _pla->get_real("R1"); - es_b2 = _pla->get_real("R2"); - es_b3 = _pla->get_real("R3"); - es_b4 = _pla->get_real("R15"); + es_c1 = _pla->get_real("R1"); + es_c2 = _pla->get_real("R2"); + es_c3 = _pla->get_real("R3"); + es_c1a = _pla->get_real("R15"); + es_c3_am = _pla->get_real("R16"); + es_c1a_am= _pla->get_real("R17"); cess_amm = _pla->get_real("R4"); pro_pag = _pla->get_real("R12"); iva_acq = _pla->get_real("R11"); @@ -3273,10 +3313,12 @@ void TLiquidazione_app::recalc_annual(const char* att) { vendite += _pam->get_real("R1"); iva_acq += _plm->get_real("R1"); - es_b1 += _pum->get_real("R4"); - es_b2 += _pum->get_real("R5"); - es_b3 += _pum->get_real("R6"); - es_b4 += _pum->get_real("R13"); + es_c1 += _pum->get_real("R4"); + es_c2 += _pum->get_real("R5"); + es_c3 += _pum->get_real("R6"); + es_c1a += _pum->get_real("R13"); + es_c3_am += _pum->get_real("S4"); + es_c1a_am += _pum->get_real("S5"); cess_amm += _pum->get_real("R0"); // Nota: @@ -3291,10 +3333,12 @@ void TLiquidazione_app::recalc_annual(const char* att) } _pla->put("R0", vendite); - _pla->put("R1", es_b1); - _pla->put("R2", es_b2); - _pla->put("R3", es_b3); - _pla->put("R15", es_b4); + _pla->put("R1", es_c1); + _pla->put("R2", es_c2); + _pla->put("R3", es_c3); + _pla->put("R15", es_c1a); + _pla->put("R16", es_c3_am); + _pla->put("R17", es_c1a_am); _pla->put("R4", cess_amm); _pla->put("R11", iva_acq); _pla->put("R12", pro_pag); diff --git a/cg/cg4302.cpp b/cg/cg4302.cpp index fefc47b98..895b3b1d4 100755 --- a/cg/cg4302.cpp +++ b/cg/cg4302.cpp @@ -796,17 +796,33 @@ real TLiquidazione_app::result_liq(int month) r = _lim->get_real("R0"); return r; } - + +real TLiquidazione_app::iva_da_riportare(int month) +{ + real idr; + const int anno = atoi(_year); + if (month > 12) + { + if (_ver->read(anno, 12) == NOERR) + idr = _ver->get(I_ANNUALE); + } + else + { + if (_ver->read(anno, month) == NOERR) + idr = _ver->get(I_PERIODICO); + } + return idr; +} real TLiquidazione_app::debt_prec(int month) { - real r(0.0); + real r; if (!is_first_month(month)) { if (look_lim(previous_month(month))) { r = result_liq(previous_month(month)); - if (!(r.sign() > 0 && r < IVA_DA_RIPORTARE)) + if (!(r > ZERO && r < iva_da_riportare(month))) r = ZERO; } } @@ -929,12 +945,32 @@ void TLiquidazione_app::round_mille_lire(real& d) if (dec == 0) // lire { if (d % real(500.0) == ZERO) d -= 1.0; - d.round(ROUND_MILLELIRE); + d.round(-3); } else // Non si sa ancora come gestire l'euro + d.round(0); +} + +void TLiquidazione_app::round_alla_lira(real& d, bool sup) +{ + const int dec = TCurrency::get_firm_dec(); + if (dec == 0) // lire + { + if (sup) + { + if (d >= ZERO) + d.ceil(0); + else + d.floor(0); + } + else + d.round(0); + } + else d.round(dec); } + // Ritorna il parametro della liquidazione differita per la ditta corrente, cosi come // e' scritto sui parametri liquidazione (LIA) // Se si passa 0 (default) vede prende la ditta correntemente in corso di calcolo @@ -951,9 +987,11 @@ bool TLiquidazione_app::is_differita(long firm, int year) real TLiquidazione_app::aliquota_agvia() { - TConfig cnf(CONFIG_STUDIO); - look_iva(cnf.get("CodAgv")); - real r = _iva->get_real("R0"); + real r; + TConfig cnf(CONFIG_STUDIO, "cg"); + const TString& codagv = cnf.get("CodAgv"); + if (codagv.not_empty() && look_iva(codagv)) // Controlla se è vuoto! CM600475 + r = _iva->get_real("R0"); return r; } @@ -965,7 +1003,6 @@ real TLiquidazione_app::interesse_trimestrale(int month) return r; } - bool TLiquidazione_app::look_conc(TString& uffcon, TString& uffiva) { // piazza nelle TString passate: l'ufficio concessioni diff --git a/cg/cg4303.cpp b/cg/cg4303.cpp index d126e3928..847b354ba 100755 --- a/cg/cg4303.cpp +++ b/cg/cg4303.cpp @@ -331,7 +331,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt) { _VentItem* vv = (_VentItem*)&_vent_arr[j]; imponibile = vv->_totale * moltiplicatore; // Importo lordo vendite - imponibile.round(ROUND_LIRA); + round_alla_lira(imponibile); lordo2netto(imponibile, imposta, vv->_aliquota); // Scorpora l'iva // aggiusto l'IVA vendite nei plm look_plm(month, codatt); @@ -408,23 +408,39 @@ void TLiquidazione_app::recalc_viaggio(int month, const char* codatt) a_fCEE += _plm->get_real("R8"); // acquisti fuori CEE a_mfCEE += _plm->get_real("R11"); // acquisti misti parte fuori CEE } + if (month == 13) // Arrotondamento 13a liquidazione + { + round_mille_lire(c_CEE); + round_mille_lire(c_mCEE); + round_mille_lire(c_fCEE); + round_mille_lire(a_CEE); + round_mille_lire(a_mCEE); + round_mille_lire(a_fCEE); + round_mille_lire(a_mfCEE); + } + // calcolo debito mensile da aggiornare su tabella POM real perc_r = a_mCEE.is_zero() ? ZERO : (a_mCEE * CENTO)/(a_mCEE + a_mfCEE); perc_r.round(2); - real ivm = (c_mCEE * perc_r)/CENTO; ivm.round(ROUND_LIRA); - real tc = (c_CEE + ivm); - real ta = (a_CEE + a_mCEE); - real bi = tc - ta - credito_costo_prec(month); + real ivm = (c_mCEE * perc_r)/CENTO; + if (month == 13) + round_mille_lire(ivm); + else + round_alla_lira(ivm, TRUE); + + const real tc = c_CEE + ivm; + const real ta = a_CEE + a_mCEE; + const real bi = tc - ta - credito_costo_prec(month); real deb_mens; - if (bi.sign() > 0) + if (bi > ZERO) { - deb_mens = (bi /((CENTO + aliquota_agvia())/CENTO)) * - (aliquota_agvia()/CENTO); + const real alivia = aliquota_agvia(); + deb_mens = bi * alivia / (CENTO + alivia); if (month == 13) round_mille_lire(deb_mens); else - deb_mens.ceil(ROUND_LIRA); + round_alla_lira(deb_mens, TRUE); } if (look_plm(month,codatt)) { diff --git a/cg/cg4304.cpp b/cg/cg4304.cpp index f9c1449c8..8adc3f8cc 100755 --- a/cg/cg4304.cpp +++ b/cg/cg4304.cpp @@ -4,13 +4,13 @@ // fv 21-1-94 // ------------------------------------------------------------ +#include #include #include "cg4300.h" // flags per annuale #define IS_PRORATA 0x0001 - // minchietta per prospetto ventilazione class _vDesc : public TObject { @@ -71,8 +71,11 @@ void TLiquidazione_app::set_page(int file, int cnt) case THE_END: set_grand(d); break; - case LIQACC: - set_liqacc(d); + case LIQACC: + if (atoi(_year) >= 2000) + set_liqacc_2000(d); + else + set_liqacc_1999(d); break; case ACCONTO: set_acconto_p(d); @@ -345,7 +348,7 @@ void TLiquidazione_app::describe_ventilation(int month, const char* codatt) void TLiquidazione_app::describe_agricolo(int month, const char* codatt) { - _DescrItem* d = new _DescrItem(REGAGR); + _DescrItem* d = new _DescrItem(REGAGR); if (_isagr98) // Setta l'array interno con tutti gli items relativi alla tabella PIA { @@ -390,12 +393,11 @@ void TLiquidazione_app::describe_agricolo(int month, const char* codatt) // alias: // _r9 mantiene la percentuale (gia' arrotondata!) // _r10 mantiene l'iva detraibile calcolata! - d->_r9 = (d->_r8 / (d->_r7 + d->_r8)); + d->_r9 = d->_r8 / (d->_r7 + d->_r8); d->_r9.round(2); d->_r10 = d->_r6 * d->_r9; d->_r9 *= CENTO; - d->_r9.round(ROUND_LIRA); - d->_r10.round(ROUND_LIRA); + round_alla_lira(d->_r10, TRUE); _descr_arr.add(d); } @@ -440,10 +442,10 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) d->_r7 = d->_r4.is_zero() ? ZERO : (d->_r4 * CENTO)/(d->_r4 + d->_r6); d->_r7.round(2); // percentuale d->_r9 = (d->_r1 * d->_r7)/CENTO; - if (month==13) + if (month == 13) round_mille_lire(d->_r9); else - d->_r9.round(ROUND_LIRA); + round_alla_lira(d->_r9); // Calcola l'iva a debito, visto che servira' anche nel calcolo liquidazione (solo annuale) const real aliva = aliquota_agvia(); @@ -451,15 +453,16 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt) d->_r10 = (d->_r0 + d->_r9) - (d->_r3 + d->_r4 + d->_r8); // base imponibile lorda if (d->_r10.sign() > 0) { - d->_r11 = (d->_r10/(alcnt/CENTO)) * (aliva/CENTO); // iva dovuta +// d->_r11 = (d->_r10/(alcnt/CENTO)) * (aliva/CENTO); // iva dovuta + d->_r11 = d->_r10 * aliva / alcnt; // iva dovuta if (month == 13) round_mille_lire(d->_r11); - else d->_r11.ceil(ROUND_LIRA); + else + round_alla_lira(d->_r11, TRUE); } _descr_arr.add(d); } - void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool describe_pis) // le si passa una tokenstring (o un codatt) e lei, da brava, calcola // cumulando per tutte le attivita' nominatele @@ -765,8 +768,8 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool } corr_ann.destroy(); look_plm(month,att); - real iva74t = _pom->get_real("R13"); - if (!describe_pis && iva74t.sign() > 0) + const real iva74t = _pom->get_real("R13"); + if (!describe_pis && iva74t > ZERO) { if(iads == NULL) iads = new _DescrItem(PIM_ROW); iads->_s0 = "74TER"; // cosi' vollero @@ -962,22 +965,24 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool // calcolo del prorata o del nuovo plafond o .... if (look_pla(codatt)) { - real v1 = _pla->get_real("R14"); - real v2 = _pla->get_real("S1"); + real v1 = _pla->get_real("R14"); // Totale imponibile vendite + real v2 = _pla->get_real("S1"); // Volume d'affari II attività real ris = v1 + v2; - real e1 = _pla->get_real("R1"); - real e2 = _pla->get_real("R2"); - real e3 = _pla->get_real("R3"); - real e4 = _pla->get_real("R15"); - real am = _pla->get_real("R4"); + real e1 = _pla->get_real("R1"); // Totale vendite esenti C1 + real e2 = _pla->get_real("R2"); // Totale vendite esenti C2 + real e3 = _pla->get_real("R3"); // Totale vendite esenti C3 + real e4 = _pla->get_real("R15"); // Totale vendite esenti C1A + real e5 = _pla->get_real("R16"); // Totale vendite beni ammortizzabili esenti C3 + real e6 = _pla->get_real("R17"); // Totale vendite beni ammortizzabili esenti C1A + real bam = _pla->get_real("R4"); // Cessione beni ammortizzabili real iaq = _pla->get_real("R11"); // IVA acquisti real ppg = _pla->get_real("R12"); // pro-rata pagato // calcola nuovo prorata per ogni attivita' (miste: 1+2) - real pr(0.0); + real pr; if (atoi(_year) > 1997) // Calcolo dal 1998 in poi { - const real rsa = ris - e4 - e3; + const real rsa = ris - (e3-e5) - (e4-e6); const real rsn = rsa - e1; if (!rsa.is_zero()) pr = CENTO - ((rsn/rsa) * CENTO); // Percentuale di indetraibilita: reciproco della percentuale di detraibilita' @@ -987,10 +992,10 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool if (!ris.is_zero()) pr = (e1/ris) * CENTO; } + pr.round(0); real co = 0.0; real topay = 0.0; - pr.round(ROUND_LIRA); //if (pr != _prorata.current()) { // calcolo conguaglio -- se positivo e' a debito @@ -1005,23 +1010,29 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool _DescrItem* dd = new _DescrItem(ANNUAL); - // MonsterFish: arrotonda alle 1000 LIRE B1,B2,B3,B4 + // MonsterFish: arrotonda alle 1000 LIRE C1,C2,C3,C1A round_mille_lire(e1); round_mille_lire(e2); round_mille_lire(e3); round_mille_lire(e4); + round_mille_lire(e5); + round_mille_lire(e6); + round_mille_lire(bam); round_mille_lire(ris); - // prorata - if (!pr.is_zero()) + + // segna flag prorata + if ((e1+e2+e3+e4) > ZERO) dd->_f0 |= IS_PRORATA; dd->_r0 = ris; dd->_r1 = e1; - dd->_r2 = pr > ZERO ? pr : ZERO ; + dd->_r2 = pr > ZERO ? pr : ZERO; dd->_r3 = co; dd->_r4 = e2; dd->_r5 = e3; dd->_r6 = topay; dd->_r7 = e4; + dd->_r8 = e5; + dd->_r9 = e6; t->_arr.add(dd); } } @@ -1040,29 +1051,29 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts, _DescrItem* d = new _DescrItem(THE_END); // gli diamo la stessa struttura di LIM - d->_r0 = _lim->get_real("R0"); - d->_r1 = _lim->get_real("R1"); - d->_r2 = _lim->get_real("R2"); - d->_r3 = _lim->get_real("R3"); - d->_r4 = _lim->get_real("R4"); - d->_r5 = _lim->get_real("R5"); // rettifiche - d->_r6 = _lim->get_real("R6"); - d->_r7 = _lim->get_real("R14"); - d->_r9 = _lim->get_real("R9"); + d->_r0 = _lim->get_real("R0").round(); // Risultato + d->_r1 = _lim->get_real("R1").round(); // Rimborso + d->_r2 = _lim->get_real("R2").round(); + d->_r3 = _lim->get_real("R3").round(); + d->_r4 = _lim->get_real("R4").round(); + d->_r5 = _lim->get_real("R5").round(); // rettifiche + d->_r6 = _lim->get_real("R6").round(); + d->_r7 = _lim->get_real("R14").round(); + d->_r9 = _lim->get_real("R9").round(); if (atoi(_year) <= 1997) // Dal 1998 in poi il conguaglio prorata non va stampato, ma conglobato nell'iva acquisti - d->_r10 = _lim->get_real("R7"); // totale conguaglio prorata + d->_r10 = _lim->get_real("R7").round(); // totale conguaglio prorata TToken_string tt(80); - tt.add(_lam->get("R0")); - tt.add(_lam->get("R1")); - tt.add(_lam->get("R2")); - tt.add(_lam->get("R3")); - tt.add(_lam->get("R4")); + tt.add(_lam->get_real("R0").round().string()); // IVA Vendite + tt.add(_lam->get_real("R1").round().string()); // IVA Acquisti + tt.add(_lam->get_real("R2").round().string()); // Credito precedente + tt.add(_lam->get_real("R3").round().string()); // Debito precedente + tt.add(_lam->get_real("R4").round().string()); d->_s0 = tt; - d->_s1 = _lim->get("R11"); - d->_s2 = _lim->get("R12"); - d->_s3 = _lim->get("R13"); + d->_s1 = _lim->get_real("R11").round().string(); // Acc. dec. + d->_s2 = _lim->get_real("R12").round().string(); + d->_s3 = _lim->get_real("R13").round().string(); // descrizione rettifiche if (month < 13) @@ -1071,13 +1082,13 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts, d->_s5 = _lim->get("S1"); d->_s6 = _lim->get("S2"); } - d->_r11 = _lim->get_real("R10"); // tasso di interesse + d->_r11 = _lim->get_real("R10"); // tasso di interesse (Non arrotondare!) - d->_r15 = _lim->get_real("R15"); // Credito utilizzato IVA - d->_r16 = _lim->get_real("R16"); // Credito utilizzato F24 - d->_r17 = _lim->get_real("R17"); // Variazioni d'imposta - d->_r18 = _lim->get_real("R18"); // Imposta non versata - d->_r19 = _lim->get_real("R19"); // Crediti speciali + d->_r15 = _lim->get_real("R15").round(); // Credito utilizzato IVA + d->_r16 = _lim->get_real("R16").round(); // Credito utilizzato F24 + d->_r17 = _lim->get_real("R17").round(); // Variazioni d'imposta + d->_r18 = _lim->get_real("R18").round(); // Imposta non versata + d->_r19 = _lim->get_real("R19").round(); // Crediti speciali d->_f1 = is_first_month(month); @@ -1112,7 +1123,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) real iva = _lim->get_real("R0") + _lim->get_real("R14"); if (month == 13) round_mille_lire(iva); - if (iva >= IVA_DA_RIPORTARE) + if (iva >= iva_da_riportare(_month)) _stampa_vers = TRUE; } @@ -1140,6 +1151,7 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month) d->_d0 = _del->get_date("D0"); } // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano } + //prospettino acconto if ( (month == 12 && (_freqviva == "M" || (_isbenzinaro && _gest4))) || (month == 13 && _freqviva == "T" && !(_isbenzinaro && _gest4)) ) @@ -1372,7 +1384,7 @@ void TLiquidazione_app::set_plafond(_DescrItem& d) set_auto_ff(); } -void TLiquidazione_app::set_liqacc(_DescrItem& d) +void TLiquidazione_app::set_liqacc_1999(_DescrItem& d) { real r1 = d._r0 + d._r1 + d._r2 + d._r4; //real r2 = d._r5 + d._r10; @@ -1383,6 +1395,7 @@ void TLiquidazione_app::set_liqacc(_DescrItem& d) set_row(1,""); set_row(2,""); set_row(3,""); set_row(4,""); set_row(5,"@11gCALCOLO ACCONTO SU OPERAZIONI EFFETTUATE"); + set_row(6,""); set_row(7,"@72gCredito@90gDebito"); set_row(8,""); if (!_isdiffacc) @@ -1430,6 +1443,77 @@ void TLiquidazione_app::set_liqacc(_DescrItem& d) set_auto_ff(); } +void TLiquidazione_app::set_liqacc_2000(_DescrItem& d) +{ + set_row(1,""); set_row(2,""); set_row(3,""); set_row(4,""); + set_row(5,"@11gCALCOLO ACCONTO SU OPERAZIONI EFFETTUATE"); + if (!_isdiffacc) + set_row(5," FINO AL 20 DICEMBRE"); + + set_row(6,""); + set_row(7,"@72gCredito@90gDebito"); set_row(8,""); + + if (d._r3 > ZERO) + d._r0 += d._r3; // Aggiungi rettifiche a debito + if (!_isdiffacc) + set_row(9,"@11gIva esigibile fino al 20/12@81g%r", &d._r0); + else + set_row(9,"@11gIva sulle operazioni di vendita@81g%r", &d._r0); + int i = 10; + if (!_isdiffacc) + { + set_row(i++,"@11gIva esigibile fino al 20/12 di cui non fatturata@81g%r", &d._r1); + set_row(i++,"@11gIva esigibile fino al 20/12 di cui non annotata@81g%r", &d._r2); + } + + if (d._r3 < ZERO) + d._r5 -= d._r3; // Aggiungi rettifiche a credito + if (!_isdiffacc) + set_row(i++,"@11gIva che si detrae fino al 20/12@64g%r", &d._r5); + else + set_row(i++,"@11gIva sulle operazioni di acquisto@64g%r", &d._r5); + + set_row(i,"@11gIVA a debito/credito per il periodo"); + real iva_dov_cre = d._r0 + d._r1 + d._r2 - d._r5; + if (iva_dov_cre >= ZERO) + set_row(i++,"@81g%r", &iva_dov_cre); + else + { + const real tmp = -iva_dov_cre; + set_row(i++,"@64g%r", &tmp); + } + + set_row(i++, "@11gDebito/Credito da periodo precedente@64g%r", &d._r9); + + set_row(i,"@11gIVA Dovuta o a Credito"); + const real risultato = iva_dov_cre - d._r9; + if (risultato >= 0) + set_row(i++,"@64g%r", &risultato); + else + { + const real tmp = -risultato; + set_row(i++,"@81g%r", &tmp); + } + + // Acconto + if (d._r8 < ZERO) + { + const real ab = abs(d._r8); + set_row(i++,"@23gCREDITO DA EVIDENZIARE@64g%r", &ab); + } + else if (d._r8 > ZERO) + { + const real acconto_minimo = _ver->get(I_ACCONTOIVA); + if (d._r8 > acconto_minimo) + set_row(i++,"@23gACCONTO DA VERSARE@81g%r", &d._r8); + else + set_row(i++,"@23gACCONTO DA NON VERSARE@81g%r", &d._r8); + } + + set_auto_ff(); +} + + void TLiquidazione_app::set_pim_head(_DescrItem& d) { int r = 1; @@ -1879,7 +1963,7 @@ void TLiquidazione_app::set_grand_1999(_DescrItem& d, int& rw) set_row(rw++,""); set_row(rw++,""); } - if (iva >= IVA_DA_RIPORTARE || _isannual || _isriepilogo) + if (iva >= iva_da_riportare(_month)) set_row(rw++,"@23gIVA DA VERSARE@75g%r",&iva); else set_row(rw++,"@23gIVA A DEBITO DA NON VERSARE@75g%r",&iva); @@ -2045,9 +2129,9 @@ void TLiquidazione_app::set_grand_2000(_DescrItem& d, int &rw) } const real iva = risultato + interessi; - if (iva > ZERO) + if (iva > ZERO) { - if (iva >= IVA_DA_RIPORTARE || _isannual || _isriepilogo) + if (iva >= iva_da_riportare(_month)) set_row(rw++,"@23gIMPORTO DA VERSARE@75g%r",&iva); else set_row(rw++,"@23gIMPORTO DA NON VERSARE@75g%r",&iva); @@ -2144,7 +2228,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d) set_row(rw++,"1) Soggetto con quota di operazioni esenti e non" " imponibili superiore al 25%%"); - real perc = (di._r0/di._r1); perc *= CENTO; perc.ceil(ROUND_LIRA); + real perc = di._r0 * CENTO / di._r1; perc.round(0); TString sep(strlen(REAL_PICTURE)+2); sep.fill('-'); set_row(rw++,""); @@ -2215,7 +2299,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d) if (atof(vr) == 0.0 && vr[vr.len()-1] == '0') vr[vr.len()-1] = ' '; set_row(rw++, "- ACCONTO DICEMBRE -"); - set_row(rw, " Versamento di L. %s effettuato il %s", + set_row(rw, " Versamento di %s effettuato il %s", (const char*)vr, (const char*)dt); set_row(rw++, "@68gCod Conc.: %3s",(const char*)con); @@ -2228,7 +2312,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d) if (_stampa_vers) { - set_row(rw, " Versamento di L. %s effettuato il %s", + set_row(rw, " Versamento di %s effettuato il %s", (const char*)vr, (const char*)dt); set_row(rw++, "@68gCod Conc.: %3s",(const char*)di._s0); @@ -2279,8 +2363,9 @@ bool TLiquidazione_app::set_annual(_DescrItem& d) set_row(row++,"C1 - Operazioni esenti escluse da nr. 1 a 9 e 11 art. 10 @69g%r", &(d._r1)); set_row(row++,"C2 - Operazioni esenti di cui nr. 11 art. 10 @69g%r", &(d._r4)); set_row(row++,"C3 - Operazioni esenti da nr. 1 a 9 art. 10 @69g%r", &(d._r5)); + set_row(row++,"@6gdi cui cessione beni ammortizzabili @69g%r", &(d._r8)); set_row(row++,"C1A - Operazioni esenti di cui all'art.10 n. 27 quinquies @69g%r", &(d._r7)); - set_row(row++,"@6gdi cui cessione beni ammortizzabili"); + set_row(row++,"@6gdi cui cessione beni ammortizzabili @69g%r", &(d._r9)); set_row(row++,"Volume d'affari @69g%r", &(d._r0)); set_row(row++,"Detraibilita' @69g%r%%", &perc_det); } @@ -2358,11 +2443,18 @@ void TLiquidazione_app::set_ventila(_DescrItem& d) set_auto_ff(TRUE); } +static void real2string(const real& r, TString& str) +{ + TCurrency cur(r); + str = cur.string(TRUE); +} + void TLiquidazione_app::set_regagr(_DescrItem& d) { set_print_zero(TRUE); - const bool is1998 = atoi(_year) == 1998; + const bool is1998 = atoi(_year) >= 1998; + CHECK(is1998 == _isagr98, "Mucca pazza!"); real& agr_1 = d._r0; real& agr_2 = d._r1; @@ -2387,7 +2479,6 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) set_row(r++,"@50gPROSPETTO REGIME AGRICOLO"); set_row(r++,""); - // percentuale detraibilita' set_row(r++, "Iva vendite beni I parte Tabella A @56g%r",&agr_1); @@ -2404,18 +2495,19 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) set_row(r++, "Iva acquisti ad uso promiscuo@56g%r",&agr_7); TString dn,riga; - riga = agr_2i.string("."); if (agr_1i != ZERO) - dn << agr_1i.string(".") << " + "; + { + real2string(agr_1i, riga); + dn << riga << " + "; + } + real2string(agr_2i, riga); dn << riga; int ln = max(riga.len(),dn.len()) + 2; int corr = ln % 2 == 0 ? 0 : 1; TString middle(ln); middle.fill('-'); int xl = 71 - riga.len()/2; int times_sign = xl + ln/2 + 3; // per allineare i segni moltiplicativi - middle << "@" << times_sign; - middle << "gx 100 = " << pdetr.string("."); - middle << " %"; + middle << "@" << times_sign << "gx 100 = " << pdetr.string(".") << " %"; set_row(r++, ""); set_row(r++, "@56g%r",&agr_2i); @@ -2425,19 +2517,18 @@ void TLiquidazione_app::set_regagr(_DescrItem& d) riga.format("@%dg%%s",xl - corr - dn.len()/2); set_row(r++, riga, (const char*)dn); - riga = agr_7.string("."); + real2string(agr_7, riga); dn = "100"; ln = max(riga.len(),dn.len()) + 2; xl = 71 - riga.len()/2; corr = ln % 2 == 0 ? 0 : 1; middle.fill('-',ln); - middle << "@" << times_sign; - middle << "gx " << pdetr.string("###"); - middle << " = " << ivadt.string("."); + middle << "@" << times_sign << "gx " << pdetr.string("."); + middle << " = " << TCurrency(ivadt).string(TRUE); set_row(r++, ""); - set_row(r++, "@56g%r", &agr_7, &pdetr); + set_row(r++, "@56g%r", &agr_7); riga.format("Iva ammessa in detrazione sugli acquisti promiscui@%dg%%s",xl - corr - ln/2); set_row(r++, riga, (const char*)middle); corr = dn.len() % 2 == 0 ? 0 : 1; @@ -2517,7 +2608,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) real tco = acq_CEE + acq_noCEE + acq_misCEE + acq_misnoCEE; real tma = acq_CEE + acq_misCEE; - set_print_zero(TRUE); set_bookmark("Prospetto 74 ter", _att_bookmark); @@ -2550,7 +2640,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) " parte fuori CEE) .............................@100g%r", &(acq_misnoCEE)); - set_row(14,""); set_row(15,"@64gTotale costi@100g%r", &tco); @@ -2560,20 +2649,21 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) set_row(18,""); // la bella frazioncina della percentuale di ripartizione - TString tmp(acq_misCEE.string(REAL_PICTURE)); tmp.ltrim(); + TString tmp; real2string(acq_misCEE, tmp); TString up = tmp; up << " x 100"; TString dn = tmp; - tmp = acq_misnoCEE.string(REAL_PICTURE); tmp.ltrim(); + real2string(acq_misnoCEE, tmp); dn << " + " << tmp; int ln = max(up.len(), dn.len()) + 2; TString den(ln); den.fill('-'); up.center_just(ln); dn.center_just(ln); // la bella frazioncina degli imponibili viaggi misti - TString tmp2 = corr_misCEE.string(REAL_PICTURE); tmp2.ltrim(); - TString up2 = tmp2; - up2 << " x " << perc_r.string(2); + TString tmp2; real2string(corr_misCEE, tmp2); + TString up2 = tmp2; + const TString16 perc_r_str = perc_r.string("###,@@"); + up2 << " x" << perc_r_str; TString dn2 = "100"; int ln2 = max(up2.len(), 3) + 2; TString den2(ln2); den2.fill('-'); @@ -2586,13 +2676,12 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) int rem2 = pos1+ den.len() + 11; int pos2 = rem2 + 20; - set_row(19,format("@%dg%%t@%dg%%t", pos1, pos2), &up, &up2); - set_row(20,format("@%dgPerc. rip. = %%t = %%5.2r; @%dg" + set_row(20,format("@%dgPerc. rip. = %%t = %%t; @%dg" "Imp. viaggi misti = %%t = @100g%%r", rem1, rem2), - &den, &perc_r, &den2, &ivm); + &den, &perc_r_str, &den2, &ivm); set_row(21,format("@%dg%%t@%dg%%t", pos1, pos2), &dn, &dn2); @@ -2600,9 +2689,9 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) // whew, come dicono su Topolino - tmp = corr_CEE.string(REAL_PICTURE); tmp.ltrim(); + real2string(corr_CEE, tmp); up = "("; up << tmp << " + "; - tmp = ivm.string(REAL_PICTURE); tmp.ltrim(); + real2string(ivm, tmp); up << tmp << ")"; den.fill('.',59-up.len()); set_row(23,"Ammontare dei corrispettivi imponibili@40g%t %t@100g%r", @@ -2611,9 +2700,9 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) // se e' l'annuale non ha senso altro if (d._f1) return; - tmp = acq_CEE.string(REAL_PICTURE); tmp.ltrim(); + real2string(acq_CEE, tmp); up = "("; up << tmp << " + "; - tmp = acq_misCEE.string(REAL_PICTURE); tmp.ltrim(); + real2string(acq_misCEE, tmp); up << tmp << ")"; den.fill('.',59-up.len()); set_row(24,"Ammontare dei costi deducibili@40g%t %t@100g%r", @@ -2621,26 +2710,26 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) den.fill('.',60); set_row(25,"Credito di costo precedente @40g%t@100g%r", &den, &(cred_cos)); - tmp = tmr.string(REAL_PICTURE); tmp.ltrim(); + real2string(tmr, tmp); up = "["; up << tmp << " - ("; - tmp = tma.string(REAL_PICTURE); tmp.ltrim(); + real2string(tma, tmp); up << tmp << " + "; - tmp = d._r8.string(REAL_PICTURE); tmp.ltrim(); + real2string(d._r8, tmp); up << tmp << ")]"; den.fill('.',59-up.len()); set_row(26,"Base imponibile lorda@40g%t %t@100g%r", &up, &den, &bi); set_row(27,""); - if (bi.sign() > 0) + if (bi > ZERO) { - real aliva = aliquota_agvia(); - real alcnt = aliva + CENTO; + const real aliva = aliquota_agvia(); + const real alcnt = aliva + CENTO; - tmp = bi.string(REAL_PICTURE); tmp.ltrim(); + real2string(bi, tmp); up = tmp; - up << " x " << aliva.string(5,2); - dn = alcnt.string(); + up << " x" << aliva.string("###,@@"); + dn = alcnt.string("###,@@"); ln = max(up.len(), 3) + 2; den.fill('-',ln); up.center_just(ln); dn.center_just(ln); @@ -2664,7 +2753,6 @@ void TLiquidazione_app::set_viaggio(_DescrItem& d) void TLiquidazione_app::set_acconto_p(_DescrItem& d) { - const char* errmsg[3] = { {"manca la tabella risultati liquidazione per l'anno corrente"}, {"manca la tabella risultati liquidazione per l'anno precedente"}, diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index e364daaed..7d80799a2 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -1,6 +1,7 @@ // cg4305: liquidazione IVA // funzionalita' accessorie (calcolo acconto, estrazione deleghe) +#include #include #include #include @@ -100,10 +101,9 @@ bool TLiquidazione_app::extract_deleghe() _month, (const char*)_nditte_r->get("RAGSOC")); _prind->set_text(buf); - if (is_month_ok_strict(_month) || _month == 13) { - bool mens = _freqviva == "M"; + const bool mens = _freqviva == "M"; _isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74_4"); _isriepilogo = _month == 13; _isendliq = _isannual || _isriepilogo; @@ -173,7 +173,7 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) real intr = _lim->get_real("R14"); topay += intr; // lo vogliono registrato con interessi real nrnd = topay; - topay.round(-3); // importo totale del versamento arrotondato + round_mille_lire(topay); // importo totale del versamento arrotondato bool wasdel = look_del(month, 1); @@ -440,10 +440,9 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) real iva_pro = 0.0; real cre_pre = 0.0; real acq_intr = 0.0; - bool isdifferita = FALSE; - int error = FALSE; - // MI3262... - isdifferita = is_differita(); + const bool isdifferita = is_differita(); // MI3262... + bool error = FALSE; + TString16 tipo_acc; // TBI rewrite from scratch @@ -455,7 +454,7 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) real divide_by_three = 1.0; char thh = *_freqviva; - TString16 thyear = _year; + const TString16 thyear = _year; _year.format("%d", atoi(_year)-1); if (!look_lia()) @@ -544,7 +543,8 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) if (bc.sign() > 0) //debito { acc = ((bc / divide_by_three) * _ver->get(isdifferita ? B_LIQ_DIFF : B_LIQ_NORM))/CENTO; - acc.round(ROUND_LIRA); + // acc.round(ROUND_LIRA); + acc.round(TCurrency::get_firm_dec()); } tipo_acc = "S"; @@ -565,15 +565,15 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) need_refresh = TRUE; break; } - if (need_refresh && yesno_box("Alcuni mesi precedenti non " - "risultano ricalcolati. E' consigliabile il ricalcolo. " - "Si desidera eseguirlo?")) + if (need_refresh && yesno_box("Alcuni mesi precedenti non risultano ricalcolati:\n" + "è consigliabile il ricalcolo. Si desidera eseguirlo?")) _recalc = ever; for (int m = 1; m <= _month; m++) if (is_month_plain(m) || _recalc == ever) { - if (_prind->iscancelled()) break; + if (_prind->iscancelled()) + break; update_firm(m); } @@ -581,15 +581,17 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) if (look_lim(12)) //posiziona anche la tabella lam { cre = _lim->get_real("R12"); - - //quando calcolo la 12° ci vado a sommare il - //versa. dovuto all'acconto - //allora devo ricalcolarmi l'effettivo credito - cre -= _lim->get_real("R11"); + cre -= _lim->get_real("R19"); + deb = _lim->get_real("R13") + inf + ina; + deb -= _lim->get_real("R18") + _lim->get_real("R1"); // CM600446 + + if (_lim->get_real("R17") > ZERO) + deb -= _lim->get_real("R17"); + else + cre += _lim->get_real("R17"); bc = deb - cre; - if (bc.sign() > 0) acc = bc; iva_ven = _lam->get_real("R0"); //iva sulle vendite annotate fino al 20/12 @@ -636,8 +638,8 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) _lim->rewrite(); if (look_lim(13)) { - _lim->put("B0",""); - _lim->rewrite(); + _lim->put("B0",""); + _lim->rewrite(); } //fine _isprint = TRUE; @@ -705,6 +707,7 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) d->_f3 = isdifferita; d->_s0 = _nditte->curr().get("CODDITTA"); d->_s1 = _nditte->curr().get("RAGSOC"); + _descr_arr.add(d); } return TRUE; diff --git a/cg/cg4400.cpp b/cg/cg4400.cpp index 6637dc3ef..7396b9953 100755 --- a/cg/cg4400.cpp +++ b/cg/cg4400.cpp @@ -269,7 +269,7 @@ void TStampa_registri_app::get_dati_ditta() unloc.read(); if (unloc.read() == NOERR) { - const TRectype & dep =look_comuni (unloc.get(ULC_COMULC)); + const TRectype& dep = look_comuni (unloc.get(ULC_COMULC)); _comunefis = dep.get(COM_DENCOM); _provfis = dep.get(COM_PROVCOM); _cap = unloc.get(ULC_CAPULC); @@ -3448,7 +3448,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m) TString16 config; const long codditta = get_firm(); const char* reg = (const char*)_codreg; - config.format("REG%05ld%03s", codditta, reg); + config.format("REG%05ld%s", codditta, reg); printer().read_configuration(config); _mov_empty = TRUE; @@ -3570,7 +3570,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m) TString16 config; const long codditta = get_firm(); const char* reg = (const char*)_codreg; - config.format("REG%05ld%03s", codditta, reg); + config.format("REG%05ld%s", codditta, reg); printer().read_configuration(config); _mov_empty = TRUE; diff --git a/cg/cg4501.cpp b/cg/cg4501.cpp index 8e3a56fc6..076a69c0a 100755 --- a/cg/cg4501.cpp +++ b/cg/cg4501.cpp @@ -133,7 +133,7 @@ bool TAp_iva::apertura_iva() TabReg.zero(); TabReg.put ("CODTAB", annoiva); - TRectype rr (TabReg.curr()); + const TRectype rr (TabReg.curr()); TabReg.read(_isgteq); @@ -142,7 +142,7 @@ bool TAp_iva::apertura_iva() if (TabReg.curr() != rr) break; int tiporeg = TabReg.get_int("I0"); - if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg == 3) ) + if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg == 3)||(tiporeg==9)) TabReg.remove(); } @@ -151,7 +151,7 @@ bool TAp_iva::apertura_iva() TRectype nuovo (TabReg.curr()); TabReg.put ("CODTAB", _annop); - TRectype recc (TabReg.curr()); + const TRectype recc (TabReg.curr()); TabReg.read(_isgteq); @@ -165,7 +165,7 @@ bool TAp_iva::apertura_iva() //TDate data_vid = TabReg.get_date("D0"); //data_vid.addyear(); cod_reg = cod_reg.mid(4,3); - if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg==3) ) + if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg==3)||(tiporeg==9)) { ok = TRUE; nuovo = TabReg.curr(); diff --git a/cg/cg4600.cpp b/cg/cg4600.cpp index d79dbd26a..7135cd327 100755 --- a/cg/cg4600.cpp +++ b/cg/cg4600.cpp @@ -114,49 +114,53 @@ HIDDEN bool anni_contigui (int annoch, int annoap) return TRUE; } -HIDDEN TRectype& cerca_esercizio(int anno,TMask_field& f) +HIDDEN const TRectype& cerca_esercizio(int anno,TMask_field& f) { -// TTable TabEs ("ESC"); TTable& TabEs = *(app()._esc); - TString16 dep (format("%04d", anno)); - TabEs.zero(); + TString16 dep; dep.format("%04d", anno); TabEs.put("CODTAB", dep); - if (TabEs.read() == NOERR) - return TabEs.curr(); - else + if (TabEs.read() != NOERR) + { f.warning_box("Esercizio non presente in tabella esercizi"); - - TabEs.zero(); - + TabEs.zero(); + } return TabEs.curr(); } -bool TApertura_chiusura::mask_datac (TMask_field& f, KEY k) +bool TApertura_chiusura::mask_datac(TMask_field& f, KEY k) { - TTable TabReg("REG"); - TString annos (4); - int anno = 0;; bool ok = TRUE; - TRectype TabEsch(LF_TAB); - TRectype TabEsap(LF_TAB); - int annoch = 0; - int annoap = 0; + if ( k == K_TAB && f.focusdirty() ) + { + TEsercizi_contabili esc; + TDate data = f.get(); + int anno = esc.date2esc(data); + + if (anno != 0) + { + if(f.mask().get_int(F_ANNOCH) == 0) + f.mask().set(F_ANNOCH, anno); // Esercizio di chiusura + } + else + return f.error_box("Esercizio non presente in tabella esercizi"); + } + if ( (k == K_ENTER) && f.to_check(k) ) { - annoch = f.mask().get_int(F_ANNOCH); - annoap = f.mask().get_int(F_ANNO); + int annoch = f.mask().get_int(F_ANNOCH); + int annoap = f.mask().get_int(F_ANNO); if (!anni_contigui(annoch,annoap)) return FALSE; - TabEsch = cerca_esercizio(annoap,f); + const TRectype& TabEsch = cerca_esercizio(annoap,f); TDate inizio = TabEsch.get_date("D0"); TDate fine = TabEsch.get_date("D1"); TDate scarico = TabEsch.get_date("D2"); - TabEsap = cerca_esercizio(annoch,f); + const TRectype& TabEsap = cerca_esercizio(annoch,f); TDate iniziop = TabEsap.get_date("D0"); TDate finep = TabEsap.get_date("D1"); TDate data = f.get(); @@ -175,13 +179,16 @@ bool TApertura_chiusura::mask_datac (TMask_field& f, KEY k) { f.warning_box ("La data di chiusura non puo' essere inferiore o uguale alla data di scarico"); return FALSE; - } + } + + int anno = 0; if ( (data >= inizio) && (data <= fine) ) //la data di chiusura e' cioe' relativa all'esercizio in corso anno = fine.year(); else if ( (data >= iniziop) && (data <= finep) ) //la data di chiusura e' cioe' relativa all'esercizio precedente - anno = finep.year(); + anno = finep.year(); - TabReg.zero(); + TTable TabReg("REG"); + TString16 annos (4); annos = format ("%04d", anno); TabReg.put ("CODTAB", annos); TRectype r (TabReg.curr()); @@ -212,53 +219,39 @@ bool TApertura_chiusura::mask_datac (TMask_field& f, KEY k) bool TApertura_chiusura::mask_dataap (TMask_field& f, KEY k) { -// TTable TabEs ("ESC"); - TEsercizi_contabili esc; - - TTable TabReg("REG"); - int anno = 0; - TString annos (4); bool ok = TRUE; - TRectype TabEsch(LF_TAB); - TRectype TabEsap(LF_TAB); - int annoch = 0; - int annoap = 0; if ( k == K_TAB && f.focusdirty() ) { + TEsercizi_contabili esc; TDate data = f.mask().get_date(F_DATAAP); int anno = esc.date2esc(data); if (anno != 0) - f.mask().set(F_ANNO, anno); // Esercizio di apertura - - TabEsch = cerca_esercizio(anno,f); - TDate inizio = TabEsch.get_date("D0"); - - --inizio; - anno = esc.date2esc(inizio); - - if (anno != 0) { - f.mask().set(F_ANNOCH, anno); // Esercizio di chiusura - f.mask().set(F_DATAC, inizio); + const int pred = esc.pred(anno); + if (pred > 0) + f.mask().set(F_ANNOCH, pred); + f.mask().set(F_ANNO, anno); // Esercizio di apertura } + else + return f.error_box("Esercizio non presente in tabella esercizi"); } if ( (k == K_ENTER) && f.to_check(k) ) { - annoch = f.mask().get_int(F_ANNOCH); - annoap = f.mask().get_int(F_ANNO); + int annoch = f.mask().get_int(F_ANNOCH); + int annoap = f.mask().get_int(F_ANNO); if (!anni_contigui(annoch,annoap)) return FALSE; - TabEsch = cerca_esercizio(annoap,f); + const TRectype& TabEsch = cerca_esercizio(annoap,f); TDate inizio = TabEsch.get_date("D0"); TDate fine = TabEsch.get_date("D1"); TDate scarico = TabEsch.get_date("D2"); - TabEsap = cerca_esercizio(annoch,f); + const TRectype& TabEsap = cerca_esercizio(annoch,f); TDate iniziop = TabEsap.get_date("D0"); TDate finep = TabEsap.get_date("D1"); TDate data = f.get(); @@ -289,13 +282,14 @@ bool TApertura_chiusura::mask_dataap (TMask_field& f, KEY k) return FALSE; } + int anno = 0; if ( (data >= inizio) && (data <= fine) ) //la data di apertura e' cioe' relativa all'esercizio in corso anno = fine.year(); else if( (data >= iniziop) && (data <= finep) ) //la data di apertura e' cioe' relativa all'esercizio precedente - anno = finep.year(); + anno = finep.year(); - TabReg.zero(); - annos = format ("%04d", anno); + TTable TabReg("REG"); + TString16 annos = format ("%04d", anno); TabReg.put ("CODTAB", annos); TRectype r (TabReg.curr()); TabReg.read(_isgteq); diff --git a/cg/cg4600a.uml b/cg/cg4600a.uml index 4c8a56d4c..e01975237 100755 --- a/cg/cg4600a.uml +++ b/cg/cg4600a.uml @@ -26,13 +26,12 @@ STRING F_CHIUSURA 3 BEGIN PROMPT 2 4 "Codice causale chiusura " USE LF_CAUSALI KEY 1 SELECT MOVAP="C" - FLAGS "UZ" INPUT CODCAUS F_CHIUSURA DISPLAY "Codice" CODCAUS DISPLAY "Descrizione @50" DESCR OUTPUT F_CHIUSURA CODCAUS - CHECKTYPE REQUIRED - ADD RUN CG0 -4 + CHECKTYPE REQUIRED + FLAGS "UZ" END STRING F_APERTURA 3 @@ -41,9 +40,9 @@ BEGIN USE LF_CAUSALI KEY 1 SELECT MOVAP="A" FLAGS "UZ" INPUT CODCAUS F_APERTURA - COPY DISPLAY F_CHIUSURA + DISPLAY "Codice" CODCAUS + DISPLAY "Descrizione@50" DESCR OUTPUT F_APERTURA CODCAUS - ADD RUN CG0 -4 CHECKTYPE REQUIRED END diff --git a/cg/cg4700.cpp b/cg/cg4700.cpp index befb2bdd5..7f5bd80c6 100755 --- a/cg/cg4700.cpp +++ b/cg/cg4700.cpp @@ -3,6 +3,7 @@ //per frodare il fisco. #include #include +#include #include #include #include @@ -95,25 +96,26 @@ bool GesAcc_app::msk_credito(TMask_field& f, KEY k) bool GesAcc_app::msk_acconto(TMask_field& f, KEY k) { if (k == K_ENTER) - { - real credito (f.mask().get(F_CREDITO)); - real acconto (f.get()); + { + const TMask& m = f.mask(); TInteressi_IVA_table ver; - if (ver.read(f.mask().get_int(F_ANNO),12)!=NOERR) + if (ver.read(m.get_int(F_ANNO),12)!=NOERR) warning_box("Errore %d in lettura tabella versamenti ed interessi.",ver.status()); - real acconto_minimo = ver.get(I_ACCONTOIVA); + const TCurrency acconto_minimo = ver.get(I_ACCONTOIVA); + + const TCurrency acconto = real(f.get()); if (!acconto.is_zero()) { if (acconto.sign() < 0) return f.error_box("Introdurre un valore non negativo"); if (acconto < acconto_minimo) - return f.error_box("L'importo dell'acconto inserito deve essere superiore a lire %s", acconto_minimo.string(".")); + return f.error_box("L'importo dell'acconto inserito deve essere superiore a %s", acconto_minimo.string(TRUE)); } } return TRUE; } -TMask* GesAcc_app::get_mask(int mode) +TMask* GesAcc_app::get_mask(int /* mode */) { return _mask; } diff --git a/cg/cg4900.cpp b/cg/cg4900.cpp index 8ffee1c54..76d2f3323 100755 --- a/cg/cg4900.cpp +++ b/cg/cg4900.cpp @@ -1,5 +1,6 @@ //Visualizzazione liquidazione acconti #include +#include #include #include #include @@ -29,6 +30,8 @@ class LiqAcc_app : public TApplication bool _registra; TString16 _tipo_acc; + real _non_fat, _non_ann; + protected: virtual bool create(); virtual bool destroy(); @@ -40,7 +43,7 @@ protected: static bool ch_year_handler(TMask_field& f, KEY key); static bool msk_risul(TMask_field& f, KEY key); static bool msk_hide(TMask& m, KEY key); - + static bool msk_recalc_2000(TMask_field& f, KEY key); public: static LiqAcc_app& app() { return (LiqAcc_app&)main_app(); } @@ -48,7 +51,8 @@ public: void build_nomiditte(); void reset_fields(); bool vis_acc(); - bool video_vis(); + bool video_vis_1999(); + bool video_vis_2000(); bool select_butt(TMask& m); LiqAcc_app() : _ditte(NULL), _nomiditte(100), _registra(FALSE) {} @@ -354,7 +358,11 @@ bool LiqAcc_app::vis_acc() _ditta = m.get_long(F_CODDITTA); _year = m.get_int(F_YEAR); set_firm(_ditta); - video_vis(); + + if (_year >= 2000) + video_vis_2000(); + else + video_vis_1999(); } } _mask = NULL; @@ -363,7 +371,7 @@ bool LiqAcc_app::vis_acc() return FALSE; } -bool LiqAcc_app::video_vis() +bool LiqAcc_app::video_vis_1999() { TTable lia ("%LIA"); TString16 y; y.format("%05ld%04d", _ditta, _year); @@ -372,7 +380,7 @@ bool LiqAcc_app::video_vis() if (lia.read() != NOERR) //da verificare se e' giusto return FALSE; - TConfig cnf(CONFIG_DITTA, "cg"); + // TConfig cnf(CONFIG_DITTA, "cg"); // MI3262.. bool liqdiff = lia.get_bool("B1");//= cnf.get_bool("GeLiDi"); @@ -381,7 +389,7 @@ bool LiqAcc_app::video_vis() TInteressi_IVA_table ver; if (ver.read(_year,12)!=NOERR) warning_box("Errore %d in lettura tabella versamenti ed interessi.",ver.status()); - real acconto_min_da_versare = ver.get(I_ACCONTOIVA); + const real acconto_min_da_versare = ver.get(I_ACCONTOIVA); real acconto = ZERO; real iva_ven = ZERO; real iva_acq = ZERO; @@ -409,124 +417,137 @@ bool LiqAcc_app::video_vis() real cre_pre (ff.get(0)); real acq_intr (ff.get(1)); - // mask diverse per liq. differita oppure no - TMask m(liqdiff ? "cg4900c" : "cg4900b"); + TMask m(liqdiff ? "cg4900c" : "cg4900b"); m.field(F_IVAVEN).set(iva_ven.string()); if (!liqdiff) { - m.field(F_NONFAT).set(non_fat.string()); - m.field(F_NONANN).set(non_ann.string()); + m.set(F_NONFAT, non_fat); + m.set(F_NONANN, non_ann); } - real tmp = abs(iva_ret); - if (iva_ret.sign() <= 0) - m.field(F_IVAREC).set(tmp.string()); - else m.field(F_IVARED).set(iva_ret.string()); + if (iva_ret <= ZERO) + m.set(F_IVAREC, -iva_ret); + else + m.set(F_IVARED, iva_ret); - tmp = iva_acq;// + acq_intr; MI2213 - m.field(F_IVARIM).set(iva_rim.string()); - m.field(F_IVAACQ).set(tmp.string()); + m.set(F_IVARIM, iva_rim); + m.set(F_IVAACQ, iva_acq); if (per_pro.is_zero()) m.hide(F_PERPRO); else { m.show(F_PERPRO); - m.field(F_PERPRO).set(per_pro.string()); + m.set(F_PERPRO, per_pro); } - m.field(F_CREPRE).set(cre_pre.string()); - m.field(F_ULTDET).set(ult_det.string()); + m.set(F_CREPRE, cre_pre); + m.set(F_ULTDET, ult_det); - //risven = iva_ven + non_fat + non_ann + iva_ret + iva_rim; risven = iva_ven + non_fat + non_ann + iva_rim; if (iva_ret.sign() > 0) risven += iva_ret; - m.field(F_RISVEN).set(risven.string()); + m.set(F_RISVEN, risven); - //risacq = iva_acq + acq_intr + cre_pre + ult_det + abs(iva_ret); - //risacq = iva_acq + acq_intr + cre_pre + ult_det; risacq = iva_acq + cre_pre + ult_det; //MI2213 - if (iva_ret.sign() < 0) - risacq += abs(iva_ret); + if (iva_ret < ZERO) + risacq -= iva_ret; - m.field(F_RISACQ).set(risacq.string()); + m.set(F_RISACQ, risacq); diff = risacq - risven; - if (diff.sign() < 0) + if (diff < ZERO) { m.show(F_IVADEB); m.hide(F_IVACRE); if (liqdiff) //se no e' gestito da maschera - { - real tmp = abs(diff); - m.field(F_IVADEB).set(tmp.string()); - } + m.set(F_IVADEB, -diff); } -else if (diff.sign() > 0) -{ - m.hide(F_IVADEB); - m.show(F_IVACRE); - if (liqdiff) - m.field(F_IVACRE).set(diff.string()); -} -else -{ - m.hide(F_IVADEB); - m.hide(F_IVACRE); -} - -if (acconto.sign() < 0) -{ - m.show(F_CREEVI); - real tmp = abs(acconto); - m.field(F_CREEVI).set(tmp.string()); - m.hide(F_ACCVER); - m.hide(F_ACCNVER); -} -else if (acconto.sign() > 0 && acconto > acconto_min_da_versare) -{ - m.hide(F_CREEVI); - m.hide(F_ACCNVER); - m.show(F_ACCVER); - m.field(F_ACCVER).set(acconto.string()); -} -else if (acconto.sign() > 0 && acconto <= acconto_min_da_versare) -{ - m.hide(F_CREEVI); - m.show(F_ACCNVER); - m.hide(F_ACCVER); - m.field(F_ACCNVER).set(acconto.string()); -} -else //==0 -{ - m.hide(F_CREEVI); - m.hide(F_ACCNVER); - m.hide(F_ACCVER); -} - -if (!liqdiff) -{ - m.set_handler(F_NONFAT, msk_risul); - m.set_handler(F_NONANN, msk_risul); -} -m.set_handler(msk_hide); - -for (bool stop = FALSE; !stop;) -{ - KEY k = m.run(); - - switch(k) + else if (diff > ZERO) { - case K_ESC: - case K_QUIT: - if (m.dirty()) + m.hide(F_IVADEB); + m.show(F_IVACRE); + if (liqdiff) + m.set(F_IVACRE, diff); + } + else + { + m.hide(F_IVADEB); + m.hide(F_IVACRE); + } + + if (acconto.sign() < 0) + { + m.show(F_CREEVI); + real tmp = abs(acconto); + m.field(F_CREEVI).set(tmp.string()); + m.hide(F_ACCVER); + m.hide(F_ACCNVER); + } + else if (acconto.sign() > 0 && acconto > acconto_min_da_versare) + { + m.hide(F_CREEVI); + m.hide(F_ACCNVER); + m.show(F_ACCVER); + m.field(F_ACCVER).set(acconto.string()); + } + else if (acconto.sign() > 0 && acconto <= acconto_min_da_versare) + { + m.hide(F_CREEVI); + m.show(F_ACCNVER); + m.hide(F_ACCVER); + m.field(F_ACCNVER).set(acconto.string()); + } + else //==0 + { + m.hide(F_CREEVI); + m.hide(F_ACCNVER); + m.hide(F_ACCVER); + } + + if (!liqdiff) + { + m.set_handler(F_NONFAT, msk_risul); + m.set_handler(F_NONANN, msk_risul); + } + m.set_handler(msk_hide); + + for (bool stop = FALSE; !stop;) + { + KEY k = m.run(); + + switch(k) { - KEY k = yesnocancel_box("Registrazione modifiche effettuate?"); - - if (k == K_YES) + case K_ESC: + case K_QUIT: + if (m.dirty()) + { + KEY k = yesnocancel_box("Registrazione modifiche effettuate?"); + + if (k == K_YES) + { + if (!liqdiff) + { + real nf (m.get(F_NONFAT)); + real na (m.get(F_NONANN)); + if (nf != non_fat || na != non_ann) + message_box("Valori modificati: rieseguire il calcolo dell'acconto"); + lia.put("R13", nf); + lia.put("R14", na); + lia.rewrite(); + } + } + if (k == K_YES || k == K_NO) + stop = TRUE; + break; + } + else stop = TRUE; + break; + case K_SAVE: + _registra = TRUE; + if (m.dirty()) { if (!liqdiff) { @@ -537,33 +558,218 @@ for (bool stop = FALSE; !stop;) lia.put("R13", nf); lia.put("R14", na); lia.rewrite(); - } + } } - if (k == K_YES || k == K_NO) - stop = TRUE; - break; - } - else stop = TRUE; - break; - case K_SAVE: - _registra = TRUE; - if (m.dirty()) + break; + } + } + return TRUE; +} + +HIDDEN void set_fields(TMask& m , short pos, short neg, const real& val) +{ + switch (val.sign()) + { + case 0: + m.hide(pos); + m.hide(neg); + break; + case 1: + m.show(pos); + m.hide(neg); + m.set(pos, val); + break; + default: + m.hide(pos); + m.show(neg); + m.set(neg, -val); + break; + } +} + +HIDDEN void round_mille_lire(real& n) +{ + if (TCurrency::get_firm_dec() == 0) + { + n -= 1.0; + n.round(-3); + } + else + n.round(0); +} + +bool LiqAcc_app::msk_recalc_2000(TMask_field& f, KEY k) +{ + if (f.to_check(k)) + { + TMask& m = f.mask(); + real& non_fat = app()._non_fat; + real& non_ann = app()._non_ann; + + real periodo, risultato; + + if (m.field(F_IVADEB).shown()) + periodo += m.get_real(F_IVA_DEB); + if (m.field(F_IVA_CRE).shown()) + periodo -= m.get_real(F_IVA_CRE); + + if (m.field(F_IVADEB).shown()) + risultato += m.get_real(F_IVADEB); + if (m.field(F_IVACRE).shown()) + risultato -= m.get_real(F_IVACRE); + + periodo -= non_fat + non_ann; + risultato -= non_fat + non_ann; + + non_fat = m.get_real(F_NONFAT); round_mille_lire(non_fat); m.set(F_NONFAT, non_fat); + non_ann = m.get_real(F_NONANN); round_mille_lire(non_ann); m.set(F_NONANN, non_ann); + + periodo += non_fat + non_ann; + risultato += non_fat + non_ann; + + set_fields(m, F_IVA_DEB, F_IVA_CRE, periodo); + set_fields(m, F_IVADEB, F_IVACRE, risultato); + } + return TRUE; +} + +bool LiqAcc_app::video_vis_2000() +{ + TTable lia ("%LIA"); + TString16 key; key.format("%05ld%04d", _ditta, _year); + lia.put("CODTAB", key); + if (lia.read() != NOERR) + return FALSE; + + const bool liqdiff = lia.get_bool("B1"); // MI3262.. + + _tipo_acc = lia.get("S8"); + const TString16 freqviva = lia.get("S7"); + + TInteressi_IVA_table ver; + if (ver.read(_year,12)!=NOERR) + warning_box("Errore %d in lettura tabella versamenti ed interessi.", ver.status()); + + const real acconto_min_da_versare = ver.get(I_ACCONTOIVA); + real acconto = lia.get("R4"); // Acconto di Dicembre + real iva_ven = lia.get("R7"); // Iva vendite annotata fino al 20/12 + real iva_acq = lia.get("R8"); // Iva acquisti annotata fino al 20/12 + real iva_ret = lia.get("R9"); // Rettifiche + real iva_rim = lia.get_real("R10"); + real ult_det = lia.get_real("R11"); + + if (!liqdiff) + { + _non_fat = lia.get_real("R13"); // Iva non fatturata + _non_ann = lia.get_real("R14"); // Iva non annotata + } + else + _non_fat = _non_ann = ZERO; + + TToken_string ff(lia.get("S1"),'!'); + const real cre_pre = ff.get(0); + const real acq_intr = ff.get(1); + + TMask m(liqdiff ? "cg4900f" : "cg4900e"); + + if (iva_ret > ZERO) + iva_ven += iva_ret; + m.set(F_IVAVEN, iva_ven); + + if (!liqdiff) + { + m.set(F_NONFAT, _non_fat); + m.set(F_NONANN, _non_ann); + } + + if (iva_ret < ZERO) + iva_acq -= iva_ret; + m.set(F_IVA_DET, iva_acq); // Iva che si detrae fino al 20/12 + + const real iva_deb_cre = iva_ven + _non_fat + _non_ann - iva_acq; + set_fields(m, F_IVA_DEB, F_IVA_CRE, iva_deb_cre); + + m.set(F_CREPRE, cre_pre); + + const real risultato = iva_deb_cre - cre_pre; + set_fields(m, F_IVADEB, F_IVACRE, risultato); + + if (acconto < ZERO) + { + m.show(F_CREEVI); + m.set(F_CREEVI, -acconto); + m.hide(F_ACCVER); + m.hide(F_ACCNVER); + } + else if (acconto == ZERO) + { + m.hide(F_CREEVI); + m.hide(F_ACCNVER); + m.hide(F_ACCVER); + } + else if (acconto > acconto_min_da_versare) + { + m.hide(F_CREEVI); + m.hide(F_ACCNVER); + m.show(F_ACCVER); + m.set(F_ACCVER, acconto); + } + else if (acconto <= acconto_min_da_versare) + { + m.hide(F_CREEVI); + m.show(F_ACCNVER); + m.hide(F_ACCVER); + m.set(F_ACCNVER, acconto); + } + + if (!liqdiff) + { + m.set_handler(F_NONFAT, msk_recalc_2000); + m.set_handler(F_NONANN, msk_recalc_2000); + } + m.set_handler(msk_hide); + + for (bool stop = FALSE; !stop;) + { + KEY k = m.run(); + + switch(k) { - if (!liqdiff) + case K_ESC: + case K_QUIT: + if (!liqdiff && m.dirty()) { - real nf (m.get(F_NONFAT)); - real na (m.get(F_NONANN)); - if (nf != non_fat || na != non_ann) - message_box("Valori modificati: rieseguire il calcolo dell'acconto"); + KEY k = yesnocancel_box("Registrare le modifiche effettuate?"); + if (k == K_YES) + { + warning_box("E' necessario rieseguire il calcolo dell'acconto"); + const real nf = m.get(F_NONFAT); + const real na = m.get(F_NONANN); + lia.put("R13", nf); + lia.put("R14", na); + lia.rewrite(); + } + if (k == K_YES || k == K_NO) + stop = TRUE; + break; + } + else stop = TRUE; + break; + case K_SAVE: + _registra = TRUE; + if (!liqdiff && m.dirty()) + { + warning_box("E' necessario rieseguire il calcolo dell'acconto"); + const real nf = m.get(F_NONFAT); + const real na = m.get(F_NONANN); lia.put("R13", nf); lia.put("R14", na); lia.rewrite(); } + break; } - break; - } -} -return TRUE; + } + return TRUE; } int cg4900(int argc, char* argv[]) diff --git a/cg/cg4900.h b/cg/cg4900.h index 3f2237115..e5191d44e 100755 --- a/cg/cg4900.h +++ b/cg/cg4900.h @@ -1,21 +1,25 @@ -#define F_CODDITTA 101 -#define F_RAGSOC 102 -#define F_YEAR 103 -#define F_IVAVEN 104 -#define F_NONFAT 105 -#define F_NONANN 106 -#define F_IVARED 107 -#define F_IVARIM 108 -#define F_RISVEN 109 -#define F_IVAACQ 110 -#define F_PERPRO 111 -#define F_CREPRE 112 -#define F_ULTDET 113 -#define F_IVAREC 114 -#define F_RISACQ 115 -#define F_IVACRE 116 -#define F_CREEVI 117 -#define F_IVADEB 118 -#define F_ACCVER 119 -#define F_ACCNVER 120 -#define F_TIPO 121 \ No newline at end of file +#define F_CODDITTA 101 +#define F_RAGSOC 102 +#define F_YEAR 103 +#define F_IVAVEN 104 +#define F_NONFAT 105 +#define F_NONANN 106 +#define F_IVARED 107 +#define F_IVARIM 108 +#define F_RISVEN 109 +#define F_IVAACQ 110 +#define F_PERPRO 111 +#define F_CREPRE 112 +#define F_ULTDET 113 +#define F_IVAREC 114 +#define F_RISACQ 115 +#define F_IVACRE 116 +#define F_CREEVI 117 +#define F_IVADEB 118 +#define F_ACCVER 119 +#define F_ACCNVER 120 +#define F_TIPO 121 + +#define F_IVA_DET 201 +#define F_IVA_CRE 202 +#define F_IVA_DEB 203 diff --git a/cg/cg4900b.uml b/cg/cg4900b.uml index cf95b9d0e..aff3f70cf 100755 --- a/cg/cg4900b.uml +++ b/cg/cg4900b.uml @@ -137,12 +137,6 @@ BEGIN NUM_CALC {#F_RISACQ - #F_RISVEN} END -CURRENCY F_CREEVI 15 -BEGIN - PROMPT 6 17 "CREDITO DA EVIDENZIARE " - FLAGS "D" -END - CURRENCY F_IVADEB 15 BEGIN PROMPT 16 16 "IVA A DEBITO " @@ -150,6 +144,12 @@ BEGIN NUM_CALC {#F_RISVEN - #F_RISACQ} END +CURRENCY F_CREEVI 15 +BEGIN + PROMPT 6 17 "CREDITO DA EVIDENZIARE " + FLAGS "D" +END + CURRENCY F_ACCVER 15 BEGIN PROMPT 10 17 "ACCONTO DA VERSARE " diff --git a/cg/cg4900e.uml b/cg/cg4900e.uml new file mode 100755 index 000000000..caa6b1d94 --- /dev/null +++ b/cg/cg4900e.uml @@ -0,0 +1,148 @@ +#include "cg4900.h" + +TOOLBAR "" 0 20 0 2 + +BUTTON DLG_SAVEREC 10 2 +BEGIN +PROMPT -13 -1 "~Registra" +PICTURE BMP_SAVEREC +PICTURE BMP_SAVERECDN +MESSAGE EXIT,K_SAVE +END + +BUTTON DLG_CANCEL 10 2 +BEGIN +PROMPT -23 -1 "" +MESSAGE EXIT,K_ESC +END + +BUTTON DLG_QUIT 10 2 +BEGIN +PROMPT -33 -1 "" +MESSAGE EXIT,K_QUIT +END + +ENDPAGE + +PAGE "Acconto su operazioni effettuate" -1 -1 77 20 + +GROUPBOX DLG_NULL 78 3 +BEGIN + PROMPT 1 0 "@bDitta corrente" +END + +NUMBER F_CODDITTA 5 +BEGIN + PROMPT 3 1 "Codice " + FLAGS "DFR" + USE LF_NDITTE KEY 1 + INPUT CODDITTA F_CODDITTA + OUTPUT F_RAGSOC RAGSOC + CHECKTYPE REQUIRED +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 17 1 "Rag. Soc. " + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 48 3 "Credito" +END + +TEXT DLG_NULL +BEGIN + PROMPT 66 3 "Debito" +END + +CURRENCY F_IVAVEN 15 +BEGIN + PROMPT 1 4 "Iva esigibile fino al 20/12 " + FLAGS "D" +END + +CURRENCY F_NONFAT 15 +BEGIN + PROMPT 1 5 "Iva esigibile fino al 20/12 di cui non fatturata " +END + +CURRENCY F_NONANN 15 +BEGIN + PROMPT 1 6 "Iva esigibile fino al 20/12 di cui non annotata " +END + +CURRENCY F_IVA_DET 15 +BEGIN + PROMPT 1 7 "Iva che si detrae fino al 20/12 " + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 8 "Iva debito/credito per il periodo" +END + +CURRENCY F_IVA_CRE 15 +BEGIN + PROMPT 45 8 "" + FLAGS "D" +END + +CURRENCY F_IVA_DEB 15 +BEGIN + PROMPT 62 8 "" + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 10 "Iva debito/credito da periodo precedente" +END + +CURRENCY F_CREPRE 15 +BEGIN + PROMPT 45 10 "" + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 12 "Iva dovuta o a Credito" +END + +CURRENCY F_IVACRE 15 +BEGIN + PROMPT 45 12 "" + FLAGS "D" +END + +CURRENCY F_IVADEB 15 +BEGIN + PROMPT 62 12 "" + FLAGS "D" +END + +CURRENCY F_CREEVI 15 +BEGIN + PROMPT 21 17 "CREDITO DA EVIDENZIARE " + FLAGS "D" +END + +CURRENCY F_ACCVER 15 +BEGIN + PROMPT 21 17 "ACCONTO DA VERSARE " + FLAGS "D" +END + +CURRENCY F_ACCNVER 15 +BEGIN + PROMPT 21 17 "ACCONTO DA NON VERSARE " + FLAGS "D" +END + +ENDPAGE + +ENDMASK + diff --git a/cg/cg4900f.uml b/cg/cg4900f.uml new file mode 100755 index 000000000..0fdc5ee3e --- /dev/null +++ b/cg/cg4900f.uml @@ -0,0 +1,138 @@ +#include "cg4900.h" + +TOOLBAR "" 0 20 0 2 + +BUTTON DLG_SAVEREC 10 2 +BEGIN +PROMPT -13 -1 "~Registra" +PICTURE BMP_SAVEREC +PICTURE BMP_SAVERECDN +MESSAGE EXIT,K_SAVE +END + +BUTTON DLG_CANCEL 10 2 +BEGIN +PROMPT -23 -1 "" +MESSAGE EXIT,K_ESC +END + +BUTTON DLG_QUIT 10 2 +BEGIN +PROMPT -33 -1 "" +MESSAGE EXIT,K_QUIT +END + +ENDPAGE + +PAGE "Acconto su operazioni effettuate" -1 -1 77 20 + +GROUPBOX DLG_NULL 78 3 +BEGIN + PROMPT 1 0 "@bDitta corrente" +END + +NUMBER F_CODDITTA 5 +BEGIN + PROMPT 3 1 "Codice " + FLAGS "DFR" + USE LF_NDITTE KEY 1 + INPUT CODDITTA F_CODDITTA + OUTPUT F_RAGSOC RAGSOC + CHECKTYPE REQUIRED +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 17 1 "Rag. Soc. " + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 48 3 "Credito" +END + +TEXT DLG_NULL +BEGIN + PROMPT 66 3 "Debito" +END + +CURRENCY F_IVAVEN 15 +BEGIN + PROMPT 1 4 "Iva sulle operazioni di vendita " + FLAGS "D" +END + +CURRENCY F_IVA_DET 15 +BEGIN + PROMPT 1 6 "Iva sulle operazioni di acquisto " + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 8 "Iva debito/credito per il periodo" +END + +CURRENCY F_IVA_CRE 15 +BEGIN + PROMPT 45 8 "" + FLAGS "D" +END + +CURRENCY F_IVA_DEB 15 +BEGIN + PROMPT 62 8 "" + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 10 "Iva debito/credito da periodo precedente" +END + +CURRENCY F_CREPRE 15 +BEGIN + PROMPT 45 10 "" + FLAGS "D" +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 12 "Iva dovuta o a Credito" +END + +CURRENCY F_IVACRE 15 +BEGIN + PROMPT 45 12 "" + FLAGS "D" +END + +CURRENCY F_IVADEB 15 +BEGIN + PROMPT 62 12 "" + FLAGS "D" +END + +CURRENCY F_CREEVI 15 +BEGIN + PROMPT 21 17 "CREDITO DA EVIDENZIARE " + FLAGS "D" +END + +CURRENCY F_ACCVER 15 +BEGIN + PROMPT 21 17 "ACCONTO DA VERSARE " + FLAGS "D" +END + +CURRENCY F_ACCNVER 15 +BEGIN + PROMPT 21 17 "ACCONTO DA NON VERSARE " + FLAGS "D" +END + +ENDPAGE + +ENDMASK + diff --git a/cg/cg5.url b/cg/cg5.url index a8c25c557..d162431c9 100755 --- a/cg/cg5.url +++ b/cg/cg5.url @@ -1,2 +1,2 @@ #include - +#include diff --git a/cg/cg5300.cpp b/cg/cg5300.cpp index 10ec1cac0..b86941b2e 100755 --- a/cg/cg5300.cpp +++ b/cg/cg5300.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -129,6 +130,19 @@ bool TParaliq_app::agrmin_handler(TMask_field& f, KEY k) bool TParaliq_app::credres_handler(TMask_field& f, KEY k) { + if (f.to_check(k)) + { + real r(f.get()); + TCurrency cur(r, f.mask().get(F_CODVAL)); + const int ndec = cur.decimals(); // Decimali di questa valuta per gli importi + + // Arrotondamento alle migliaia nel caso il numero + // di decimali della ditta sia zero (come per le lire) + // altrimenti all'unità + r.round(ndec == 0 ? -3 : 0); + f.set(r.string()); + } + if (k == K_ENTER) // In uscita dalla maschera { const TMask& m = f.mask(); @@ -153,8 +167,8 @@ bool TParaliq_app::credpreccost_handler(TMask_field& f, KEY k) // Arrotondamento alle migliaia nel caso il numero // di decimali della ditta sia zero (come per le lire) - // altrimenti al numero di decimali impostato - r.round(ndec == 0 ? -3 : ndec); + // altrimenti all'unità + r.round(ndec == 0 ? -3 : 0); f.set(r.string()); } return TRUE; @@ -162,9 +176,9 @@ bool TParaliq_app::credpreccost_handler(TMask_field& f, KEY k) bool TParaliq_app::utcred_handler(TMask_field& f, KEY k) { - if ((k == K_TAB && f.focusdirty()) || !f.mask().is_running()) + TMask & m = f.mask(); + if ((k == K_TAB && f.focusdirty()) || !m.is_running()) { - TMask & m = f.mask(); const int anno_liq = m.get_int(F_YEAR); TString80 cod_mesi; TString des_mesi(128); @@ -178,7 +192,7 @@ bool TParaliq_app::utcred_handler(TMask_field& f, KEY k) m.enable(F_UTCR_IVA); cod_mesi = "0|-1"; des_mesi = " |Inizio Anno"; - mese = m.get_real(F_CRED_RES) != ZERO ? "-1" : "0"; + mese = !m.field(F_CRED_RES).empty() ? "-1" : "0"; } else { @@ -188,10 +202,14 @@ bool TParaliq_app::utcred_handler(TMask_field& f, KEY k) des_mesi = " |Gennaio|Febbraio|Marzo|Aprile|Maggio|Giugno|Luglio|Agosto|Settembre|Ottobre|Novembre|Dicembre"; mese = app().rel().lfile().get("I0"); if (!m.edit_mode() || atoi(mese) < 0) - mese.cut(0); + mese.cut(0); } + const TString16 oldmese = m.get(F_MESE_RES_AL); mese_res.replace_items(cod_mesi, des_mesi); - m.set(F_MESE_RES_AL, mese); + if (m.is_running()) + m.set(F_MESE_RES_AL, mese); + else + m.set(F_MESE_RES_AL, oldmese); } return TRUE; } @@ -296,7 +314,6 @@ bool TParaliq_app::user_create() _msk->set_handler(F_GELIDI,gelidi_handler); _msk->set_handler(F_AGRMIN,agrmin_handler); _msk->set_handler(F_CRED_RES,credres_handler); - _msk->set_handler(F_MESE_RES_AL,credres_handler); _msk->set_handler(F_CRED_PREC,credpreccost_handler); _msk->set_handler(F_CRED_COST,credpreccost_handler); _msk->set_handler(F_CODDITTA,ditta_handler); @@ -325,7 +342,7 @@ void TParaliq_app::init_query_mode(TMask& m) { // svuota tutto TSheet_field& sh = (TSheet_field&)m.field(F_SHEET_PLA); - //sh.reset(); + m.disable(DLG_DELREC); } void TParaliq_app::init_insert_mode(TMask& m) @@ -370,8 +387,10 @@ int TParaliq_app::rewrite(const TMask& m) { TToken_string& tt = sf.row(i); const TString16 att = tt.get(0); - const TString16 tips(tt.get(1)); - TString16 codtab(format("%05ld%4d%s", firm, year, (const char*)att)); + const TString16 tips = tt.get(1); + + TString16 codtab; + codtab.format("%05ld%4d%s", firm, year, (const char*)att); _pla->zero(); _pla->put("CODTAB", codtab); @@ -423,11 +442,11 @@ int TParaliq_app::rewrite(const TMask& m) } TTable& lia = (TTable&)_rel->lfile(); - lia.put("CODTAB", format("%05ld%d", firm, year)); + lia.put("CODTAB", format("%05ld%04d", firm, year)); was = lia.read() == NOERR; if (!was) lia.zero(); m.autosave(*_rel); - if (err == NOERR) err = (was ? lia.rewrite() : lia.write()); + if (err == NOERR) err = was ? lia.rewrite() : lia.write(); if (err == NOERR && year == _yearliq) { _ditte->put(NDT_CODDITTA, firm); @@ -447,7 +466,7 @@ int TParaliq_app::rewrite(const TMask& m) return err; } -int TParaliq_app::read(TMask& m) +int TParaliq_app::read(TMask& m) { // legge da LIA (si istanziano i campi credito prec. e Freq. Vers // prende le attivita' una per una da _atts e diff --git a/cg/cg5300a.uml b/cg/cg5300a.uml index 57e35d26f..771d60827 100755 --- a/cg/cg5300a.uml +++ b/cg/cg5300a.uml @@ -38,7 +38,6 @@ BEGIN DISPLAY "Codice" CODDITTA COPY OUTPUT F_CODDITTA CHECKTYPE REQUIRED - KEY 1 END NUMBER F_YEAR 4 @@ -46,10 +45,12 @@ BEGIN PROMPT 4 2 "Anno " FIELD CODTAB[6,9] USE %LIA + JOIN LF_NDITTE INTO CODDITTA=CODTAB[1,5] INPUT CODTAB[1,5] F_CODDITTA INPUT CODTAB[6,9] F_YEAR DISPLAY "Codice Ditta" CODTAB[1,5] DISPLAY "Anno Liquid.IVA" CODTAB[6,9] + DISPLAY "Ragione Sociale@50" LF_NDITTE->RAGSOC OUTPUT F_YEAR CODTAB[6,9] OUTPUT F_CODDITTA CODTAB[1,5] KEY 1 @@ -122,7 +123,7 @@ BEGIN WARNING "L'importo non puo' essere maggiore del Credito Precedente" END -LISTBOX F_MESE_RES_AL 14 +LISTBOX F_MESE_RES_AL 2 14 BEGIN PROMPT 57 9 "A " ITEM "0|" diff --git a/cg/cg5500.cpp b/cg/cg5500.cpp index 026188dc1..956c6adac 100755 --- a/cg/cg5500.cpp +++ b/cg/cg5500.cpp @@ -13,22 +13,15 @@ #include "cg5500.h" #include "cg5500a.h" -#define ROUND_MILLELIRE (-3) - -static const TString& print_value(const real& r) -{ - static TString s; - const TCurrency c(r); - s = c.string(TRUE); - s.right_just(15); - - return s; -} - static void round_mille_lire(real& d) { - if (d % real(500.0) == ZERO) d -= 1.0; - d.round(-3); + if (TCurrency::get_firm_dec() == 0) + { + if (d % real(500.0) == ZERO) d -= 1.0; + d.round(-3); + } + else + d.round(); } const char* Visliq_app::itoname(int m) @@ -707,7 +700,7 @@ bool Visliq_app::vis_one(int m) msk.field(F_DESCR1).set(desc1); msk.field(F_DESCR2).set(desc2); msk.field(F_DESCR3).set(desc3); - msk.field(F_ACCONTO).set(acconto.string()); + msk.set(F_ACCONTO, acconto); real varimp = _lim->get("R17"); real impnonver= _lim->get("R18"); @@ -937,6 +930,20 @@ real Visliq_app::credito_utilizzato(int year, int month) const return credito; } +HIDDEN void replace_number(TViswin* vsw, long rig, real num, int tab) +{ + TString16 str; + if (num.is_zero()) + str.spaces(15); + else + { + const TCurrency c(num); + str = c.string(TRUE); + str.right_just(15); + } + vsw->replace(rig, str, tab); +} + void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& vers, real& acc, real& varimp, real& impnonver, real & credspec, TString& d1, TString& d2, TString& d3, TDate& date, @@ -998,7 +1005,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (risul != ris) { #ifdef DBG - yesnofatal_box("Ostia vacca! Risultato non coincidente!"); + yesnofatal_box("Porca vacca: Risultato non coincidente!"); #endif _lim->put("B0", "X"); } @@ -1106,24 +1113,21 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver lvers = lrisc+1l; // ... seguita da una sburlata di replace - if (rimb.is_zero()) - vsw->replace(lrimb, " ", 75); - else - vsw->replace(lrimb, rimb.string("###.###.###.###"), 75); + replace_number(vsw, lrimb, rimb, 75); - vsw->replace(lrisd, risdb.string("###.###.###.###"), 75); - vsw->replace(lrisc, riscr.string("###.###.###.###"), 58); - vsw->replace(lacct, acc.string("###.###.###.###"), 58); + replace_number(vsw, lrisd, risdb, 75); + replace_number(vsw, lrisc, riscr, 58); + replace_number(vsw, lacct, acc, 58); if (rett.sign() > 0) { - vsw->replace(lrettd, print_value(rett), 75); + replace_number(vsw, lrettd, rett, 75); vsw->replace(lrettc, " ", 58); } else if (rett.sign() < 0) { real rabs = abs(rett); - vsw->replace(lrettc, print_value(rabs), 58); + replace_number(vsw, lrettd, rabs, 58); vsw->replace(lrettd, " ", 75); } else @@ -1143,7 +1147,8 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (v.is_zero()) vsw->replace(iadoc, " ", tab1); else - vsw->replace(iadoc, v.string("###.###.###.###"), tab1); + replace_number(vsw, iadoc, v, tab1); + vsw->replace(iadoc, " ", tab2); iadoc = vsw->search("IVA dovuta o a credito per il periodo",x,line,TRUE); @@ -1155,7 +1160,8 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (v.is_zero()) vsw->replace(iadoc, " ", tab1); else - vsw->replace(iadoc, v.string("###.###.###.###"), tab1); + replace_number(vsw, iadoc, v, tab1); + vsw->replace(iadoc, " ", tab2); TString256 ln; @@ -1164,7 +1170,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (credspec.is_zero()) vsw->replace(lcrs, " ", 58); else - vsw->replace(lcrs, credspec.string("###.###.###.###"), 58); + replace_number(vsw, lcrs, credspec, 58); const bool print_intr = _freqviva == "T" && intr != 0.0; const char* desc_inter = "Interessi dovuti per liquidazioni trimestrali"; @@ -1179,7 +1185,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver desc.format("%s %s%%", desc_inter, itt.stringa(6,2)); vsw->replace(lintr, desc, 11); } - vsw->replace(lintr, intr.string("###.###.###.###"), 75); + replace_number(vsw, lintr, intr, 75); risul += intr; } else @@ -1199,7 +1205,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (risul < IVA_DA_RIPORTARE && month < 13) ln << "NON "; ln << "VERSARE "; - vsw->replace(idv, risul.string("###.###.###.###"), 75); + replace_number(vsw, idv, risul, 75); } else ln.spaces(90); @@ -1212,9 +1218,11 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver ln.spaces(); ln.cut(136); if (risul.sign() < 0) // Significa che in questo momento il risultato e' a credito { - real rabs = abs(risul); + TCurrency rabs(-risul); + TString16 str = rabs.string(TRUE); str.right_just(15); + ln.overwrite("CREDITO ATTUALE", 23); - ln.overwrite(rabs.string("###.###.###.###"), 58); + ln.overwrite(str, 58); if (lintr > 0) // Quindi niente riga "Interessi " ... { vsw->replace(lintr," ",23); @@ -1246,15 +1254,18 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver vsw->replace(livdv, "IVA DOVUTA", 23); } if (lintr > 0) - vsw->replace(lintr, intr.string("###.###.###.###"), 75); + replace_number(vsw, lintr, intr, 75); if (livdv > 0) { - vsw->replace(livdv, risul.string("###.###.###.###"), 75); + replace_number(vsw, livdv, risul, 75); risul += intr; } } ln.overwrite("IVA DA VERSARE", 23); - ln.overwrite(risul.string("###.###.###.###"), 75); + + TCurrency rabs(risul); + TString16 str = rabs.string(TRUE); str.right_just(15); + ln.overwrite(str, 75); } vsw->replace(lvers, ln, 0); } @@ -1264,7 +1275,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (vers.is_zero()) vsw->replace(lrivr, " ", 58); else - vsw->replace(lrivr, vers.string("###.###.###.###"), 58); + replace_number(vsw, lrivr, vers, 58); } if (lvari >= 0) @@ -1278,7 +1289,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver tab2 = 75; } if (!v.is_zero()) - vsw->replace(lvari, v.string("###.###.###.###"), tab1); + replace_number(vsw, lvari, v, tab1); else vsw->replace(lvari, " ", tab1); vsw->replace(lvari, " ", tab2); @@ -1286,7 +1297,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (limnv >= 0) { if (!impnonver.is_zero()) - vsw->replace(limnv, impnonver.string("###.###.###.###"), 75); + replace_number(vsw, limnv, impnonver, 75); else vsw->replace(limnv, " ", 75); } @@ -1295,7 +1306,7 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver if (credito_utilizzato_iva.is_zero()) vsw->replace(lcicd, " ", 58); else - vsw->replace(lcicd, credito_utilizzato_iva.string("###.###.###.###"), 58); + replace_number(vsw, lcicd, credito_utilizzato_iva, 58); } vsw.refresh(); @@ -1574,14 +1585,14 @@ void Visliq_app::read_general(TMask& m) } // Sheet versamenti - TString nomemese(26); + TString nomemese; sv.destroy(); for (i = 1; i <= 13; i++) { if (!is_month_ok(i) && i != 13) continue; - TToken_string* tt = new TToken_string(80); + TToken_string tt; nomemese = itoname(i == 13 ? 12 : i); if (nomemese == "4 Trimestre") @@ -1590,14 +1601,14 @@ void Visliq_app::read_general(TMask& m) if (i == 12) nomemese << " acconto"; if (i == 13) nomemese << " saldo"; - tt->add(nomemese,0); // mese - tt->add(date[i-1].string(),1); // data vers. - tt->add(banche[i-1].get(0),2); // azienda - tt->add(banche[i-1].get(1),3); // dipendenza - tt->add(banche[i-1].get(2),4); // concessionaria - tt->add(versamenti[i-1].string(),5);// versamenti + tt.add(nomemese,0); // mese + tt.add(date[i-1].string(),1); // data vers. + tt.add(banche[i-1].get(0),2); // azienda + tt.add(banche[i-1].get(1),3); // dipendenza + tt.add(banche[i-1].get(2),4); // concessionaria + tt.add(versamenti[i-1].string(),5);// versamenti - sv.row(-1) = *tt; + sv.row(-1) = tt; if (i == 12) sv.enable_cell(sv.items() - 1, -1, FALSE); } @@ -1617,7 +1628,6 @@ void Visliq_app::read_general(TMask& m) m.field(F_VISLIQ2).set_dirty(_sv_dirty=FALSE); } - void Visliq_app::write_general(TMask& m) { TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1); @@ -1626,7 +1636,7 @@ void Visliq_app::write_general(TMask& m) if (m.field(F_CREDPREC).dirty()) { - real r(m.get(F_CREDPREC)); + const real r = m.get(F_CREDPREC); _lia->put("R0",r); _lia->rewrite(); } diff --git a/cg/cg5500d.uml b/cg/cg5500d.uml index ee3ad581d..095e79b0a 100755 --- a/cg/cg5500d.uml +++ b/cg/cg5500d.uml @@ -13,11 +13,6 @@ BEGIN PROMPT 0 0 "@bDitta corrente" END -//GROUPBOX DLG_NULL 78 5 -//BEGIN -// PROMPT 1 15 "" -//END - NUMBER F_CODDITTA 5 BEGIN @@ -205,7 +200,7 @@ END /* gruppo 6: edit Variazioni d'imposta */ -NUMBER F_VARIMP 15 +CURRENCY F_VARIMP 15 BEGIN PROMPT 2 17 "Variazioni d'imposta " PICTURE "." @@ -224,7 +219,7 @@ END /* gruppo 7: edit Imposta non versata*/ -NUMBER F_IMPNONVER 15 +CURRENCY F_IMPNONVER 15 BEGIN PROMPT 2 17 "Imposta non versata " PICTURE "." @@ -234,11 +229,11 @@ END /* gruppo 8: edit crediti speciali */ -NUMBER F_CREDSPEC 15 0 +CURRENCY F_CREDSPEC 15 0 BEGIN PROMPT 2 17 "Crediti speciali : " GROUP 8 - FLAGS "HR" + FLAGS "H" PICTURE "." END diff --git a/cg/cg5700.cpp b/cg/cg5700.cpp index 4c4cb39be..eec49dd71 100755 --- a/cg/cg5700.cpp +++ b/cg/cg5700.cpp @@ -216,6 +216,60 @@ bool TDich_periodica_selfirm_mask::on_field_event(TOperable_field& o, TField_eve } return TRUE; +} + +bool change_prompt(TString& p, int year) +{ + bool changed = FALSE; + if (p.left(2) == "VP") + { + const int vp = atoi(p.mid(2,2)); + if (year >= 2001) + { + if (vp >= 5) + { + switch (vp) + { + case 6: + p = "VP11 - IVA detratta per il periodo"; + break; + case 9: + p = "VP14 - IVA non versata o in eccesso da dich. prec."; + break; + default: + TString4 n; + n.format("%2d", vp+5); + p.overwrite(n, 2); + break; + } + changed = TRUE; + } + } + } + return changed; +} + + +class TDich_periodica_iva_form : public TForm +{ +public: + TDich_periodica_iva_form(int anno); +}; + +TDich_periodica_iva_form::TDich_periodica_iva_form(int anno) : TForm("cg5700a") +{ + if (anno > 2000) + { + TPrint_section& b = section('B', odd_page); + TString p; + for (int i = b.fields()-1; i > 0; i--) + { + TForm_item& f = b.field(i); + p = f.prompt(); + if (change_prompt(p, anno)) + f.set_prompt(p); + } + } } class TDich_periodica_iva_mask : public TAutomask @@ -241,6 +295,19 @@ TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask : TAutomask("cg5700b") { _sf = m; + + const int anno = _sf->get_int(F_YEAR); + if (anno > 2000) + { + TString p; + for (int i = fields()-1; i > 0; i--) + { + TMask_field& f = fld(i); + p = f.prompt(); + if (change_prompt(p, anno)) + f.set_prompt(p); + } + } } void TDich_periodica_iva_mask::search_versament() @@ -352,7 +419,7 @@ void TDich_periodica_iva_mask::read_iva_data() // Se espressi in lire o una valuta con 0 decimali, arrotonda alle 1000 TCurrency cur(vp1, get(F_CODVAL)); - const int ndec = cur.decimals() == 0 ? -3 : cur.decimals(); + const int ndec = cur.decimals() == 0 ? -3 : 0; vp1.round(ndec); vp1a.round(ndec); vp2.round(ndec); vp2a.round(ndec); vp3.round(ndec); vp3i.round(ndec); @@ -376,7 +443,7 @@ void TDich_periodica_iva_mask::read_iva_data() real vp13 = lim.get("R19"); // Crediti speciali real vp14 = lim.get("R14"); // Interessi dovuti per liquidazione trimestrale real vp15 = ZERO; - if (_sf->get_period() == 12) // Gli acconti ci sono solo a Dicembre + if (p == 12) // Gli acconti ci sono solo a Dicembre { if (f == 'T') { @@ -390,9 +457,13 @@ void TDich_periodica_iva_mask::read_iva_data() vp15 = lim.get_real("R11"); // Acconto versato } - real vp16 = lim.get_real("R0") + lim.get_real("R14"); // Importo da versare - if (vp16 < ZERO) vp16 = ZERO; - + real vp16; + if (f == 'M' || p < 12) // Escludere quarto trimestre ditte trimestrali + { + vp16 = lim.get_real("R0") + lim.get_real("R14"); // Importo da versare + if (vp16 < ZERO) vp16 = ZERO; + } + set(F_VP1, vp1); set(F_VP1A, vp1a); set(F_VP2, vp2); set(F_VP2A, vp2a); set(F_VP3, vp3); set(F_VP3I, vp3i); set(F_VP5, vp5); set(F_VP6, vp6); set(F_VP7, vp7); @@ -408,7 +479,8 @@ void TDich_periodica_iva_mask::print_prospect() if (_dirty_versament) write_versament(); - TForm frm("cg5700a"); + const int anno = _sf->get_int(F_YEAR); + TDich_periodica_iva_form frm(anno); frm.find_field('B', odd_page, FF_CODVAL).set(get(F_CODVAL)); frm.find_field('B', odd_page, FF_YEAR).set(get(F_YEAR)); @@ -441,7 +513,7 @@ void TDich_periodica_iva_mask::print_prospect() frm.find_field('B', odd_page, FF_VP15).set(get(F_VP15)); frm.find_field('B', odd_page, FF_VP16).set(get(F_VP16)); - // Se è stato creato il versamento ora o se è stato giò stampato + // Se è stato creato il versamento ora o se è stato già stampato // allora lo stampa, altrimenti lo nasconde. const bool b = _dirty_versament || get_bool(F_VP17_STAMPATO); @@ -535,7 +607,6 @@ bool TDich_periodica_iva_mask::on_field_event(TOperable_field& o, TField_event e class TDich_periodica_iva_app : public TSkeleton_application { TDich_periodica_selfirm_mask * _m1; - TDich_periodica_iva_mask * _m2; protected: virtual bool create(); @@ -549,15 +620,13 @@ public: bool TDich_periodica_iva_app::create() { - _m1 = new TDich_periodica_selfirm_mask(); - _m2 = new TDich_periodica_iva_mask(_m1); open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0); + _m1 = new TDich_periodica_selfirm_mask(); return TSkeleton_application::create(); } bool TDich_periodica_iva_app::destroy() { - delete _m2; delete _m1; return TSkeleton_application::destroy(); } @@ -576,13 +645,12 @@ void TDich_periodica_iva_app::main_loop() set_firm(_m1->get_long(F_CODDITTA)); - _m2->reset(); - _m2->enable_default(); - - _m2->set_prospect(); - - if (_m2->run() == K_ENTER) - _m2->print_prospect(); + TDich_periodica_iva_mask* m2 = new TDich_periodica_iva_mask(_m1); + m2->reset(); + m2->enable_default(); + m2->set_prospect(); + if (m2->run() == K_ENTER) + m2->print_prospect(); } set_firm(ditta); diff --git a/cg/cg5700b.uml b/cg/cg5700b.uml index 9c8d92115..328b9de5f 100755 --- a/cg/cg5700b.uml +++ b/cg/cg5700b.uml @@ -15,7 +15,7 @@ END ENDPAGE -PAGE "VP 1-12" -1 -1 78 20 +PAGE "Pag.1" -1 -1 78 20 GROUPBOX DLG_NULL 79 4 BEGIN @@ -174,7 +174,7 @@ END ENDPAGE -PAGE "VP 13-17" -1 -1 78 20 +PAGE "Pag.2" -1 -1 78 20 CURRENCY F_VP13 18 BEGIN diff --git a/cg/cg6.cpp b/cg/cg6.cpp index b1b494e4c..7f142f0e2 100755 --- a/cg/cg6.cpp +++ b/cg/cg6.cpp @@ -24,7 +24,7 @@ int main(int argc,char** argv) case 7: cg6800(argc, argv); break; case 8: - cg6900(argc, argv); break; + cg6900(argc, argv); break; // Invio archivi default: break; } diff --git a/cg/cg6.url b/cg/cg6.url index a8c25c557..1aa8af7fb 100755 --- a/cg/cg6.url +++ b/cg/cg6.url @@ -1,2 +1,3 @@ #include +#include diff --git a/cg/cg6100.cpp b/cg/cg6100.cpp index 09a80f962..e2c61a016 100755 --- a/cg/cg6100.cpp +++ b/cg/cg6100.cpp @@ -2,9 +2,10 @@ #include #include -#include #include #include +#include +#include #include "cglib04.h" @@ -49,21 +50,21 @@ void TRic_auto::stato_trasferimento(TString& std) void TRic_auto::main_loop() { - TString std = ""; - if (!controlli_preliminari()) return; set_flag(); + TString std; stato_trasferimento(std); if (std == "T") { TString appname = "cg6 -5 T A"; // Lancio il programma di ricezione delle tabelle // con il parametro A perche' si tratta di ricezione - TExternal_app a (appname); // in automatico + TExternal_app a(appname); // in automatico a.run(); + os_sleep(1000); } stato_trasferimento(std); @@ -73,8 +74,9 @@ void TRic_auto::main_loop() TString appname = "cg6 -6 A "; // Lancio il programma di lista controllo movimenti appname << _tipo; - TExternal_app a (appname); + TExternal_app a(appname); a.run(); + os_sleep(1000); TMailbox m; TMessage* msg = m.next_s(""); @@ -98,10 +100,11 @@ void TRic_auto::main_loop() if (std == "M") { - const char* appname = "cg6 -5 M A"; // Lancio il programma di ricezione dei movimenti + const char* appname = "cg6 -5 M A"; // Lancio il programma di ricezione dei movimenti // con il parametro A perche' si tratta di ricezione - TExternal_app a (appname); // in automatico - a.run(); + TExternal_app a(appname); // in automatico + a.run(); + os_sleep(1000); } stato_trasferimento(std); @@ -122,16 +125,16 @@ void TRic_auto::main_loop() bool TRic_auto::controlli_preliminari() { - TString std = ""; - - if (!prefix().exist(_ditta)) // Controllo esistenza - return error_box("Rilevati ERRORI GRAVI nel trasferimento"); // direttorio della ditta + if (!prefix().exist(_ditta)) // Controllo esistenza ditta + return error_box("Rilevati ERRORI GRAVI nel trasferimento:\n" + "non esiste la ditta %05ld", _ditta); set_firm(_ditta); + TString std; stato_trasferimento(std); - if (std == "") + if (std.empty()) { if (!leggi_trasfer()) // Controllo se esiste il file trasfer return error_box("Il file di trasferimento non e' presente nella directory %s",_tras_file->path(_ditta)); @@ -139,8 +142,9 @@ bool TRic_auto::controlli_preliminari() TString appname = "cg6 -3 "; // Lancio il programma che trasferisce appname << _trasfer << " A"; // i dati dal trasfer agli archivi temporanei - TExternal_app a (appname); + TExternal_app a(appname); a.run(); + os_sleep(1000); } if (!leggi_header()) // Controllo l'esistenza del record diff --git a/cg/cg6400.cpp b/cg/cg6400.cpp index 9ccd1b19e..a00361ff6 100755 --- a/cg/cg6400.cpp +++ b/cg/cg6400.cpp @@ -1,4 +1,4 @@ -// Ricezione dati da sistema +// Ricezione dati da sistema e da PC #include @@ -680,22 +680,25 @@ void TRic_archivi::trasfer2tempfile() { _trasfhard = _tras_file->path(_dittaric); _trasfhard << HEADER; - - if (_scelta == 'S') - _tras_file->fcopytemp(_trasf,_trasfhard); - else - if (_scelta == 'P') - _tras_file->fcopytemp_PC(_trasf,_trasfhard); + switch (_scelta) + { + case 'S': _tras_file->fcopytemp(_trasf,_trasfhard); break; + case 'P': _tras_file->fcopytemp_PC(_trasf,_trasfhard); break; + default: break; + } } void TRic_archivi::ditta_ricevente() { +/* TLocalisamfile nditte (LF_NDITTE); nditte.setkey(1); nditte.zero(); nditte.put(NDT_CODDITTA, _dittaric); if (nditte.read() == NOERR) _ragsoc_dittar = nditte.get(NDT_RAGSOC); +*/ + _ragsoc_dittar = cache().get(LF_NDITTE, _dittaric).get(NDT_RAGSOC); } long TRic_archivi::leggi_tabella_tras() @@ -708,7 +711,7 @@ long TRic_archivi::leggi_tabella_tras() tab_tra.zero(); dep.format("%10s%05ld", (const char*) _nomeid, _dittainv); - tab_tra.put("CODTAB", (const char*) dep); + tab_tra.put("CODTAB", dep); if (tab_tra.read() == NOERR) { ditta = tab_tra.get_long("I0"); @@ -861,12 +864,10 @@ bool TRic_archivi::set_flag() void TRic_archivi::aggiorna_tabella() { - TString dep(16); - TTable tab_tra ("%TRA"); - - tab_tra.zero(); + TTable tab_tra("%TRA"); + TString16 dep; dep.format("%10s%05ld", (const char*) _nomeid, _dittainv); - tab_tra.put("CODTAB", (const char*) dep); + tab_tra.put("CODTAB", dep); if (tab_tra.read() == NOERR) { tab_tra.put("I1", (long)_nultras); diff --git a/cg/cg6600.cpp b/cg/cg6600.cpp index 40293bb89..bcf8f7e9d 100755 --- a/cg/cg6600.cpp +++ b/cg/cg6600.cpp @@ -1179,8 +1179,6 @@ bool TRic_tab::occasionali(TString& ocfpi) void TRic_tab::scrivi_righeIVA(long numreg) { - TString str; - _triva->setkey(1); _triva->zero(); _triva->put(RMI_NUMREG, numreg); diff --git a/cg/cg6700.cpp b/cg/cg6700.cpp index 4dc61884f..d2db4def3 100755 --- a/cg/cg6700.cpp +++ b/cg/cg6700.cpp @@ -67,7 +67,7 @@ HIDDEN const char* err_msg[] = {"*** Data operazione non valida", "*** Flag abbuono attivo/passivo errato", "*** Codice valuta errato", "*** Tipo movimento causale non congruo con tipo movimento saldaconto", - "*** Tipo pagamento del codice di pagamento non congruo con tipo pagamento del saldaconto"}; + "--- Tipo pagamento del codice di pagamento non congruo con tipo pagamento del saldaconto"}; class TRic_ListaMov : public TPrintapp { @@ -851,11 +851,11 @@ bool TRic_ListaMov::controlla_rmov() rmov.zero(); rmov.setkey(1); rmov.put(RMV_NUMREG, _numero); - TRectype recc (rmov.curr()); for (rmov.read(_isgteq); !rmov.eof() ;rmov.next()) { - TRectype rec (rmov.curr()); - if (rec > recc) break; + const TRectype& rec = rmov.curr(); + if (rec.get_long(RMV_NUMREG) != _numero) + break; gruppo = rec.get_int(RMV_GRUPPO); conto = rec.get_int(RMV_CONTO); sottoconto = rec.get_long(RMV_SOTTOCONTO); @@ -924,10 +924,10 @@ bool TRic_ListaMov::controlla_rmov() return TRUE; } } - if (dare != avere) + if (dare.round(2) != avere.round(2)) { - rmov.readat(nrec); - return TRUE; + rmov.readat(nrec); + return TRUE; } rmov.readat(nrec); } @@ -1760,7 +1760,7 @@ void TRic_ListaMov::stampa_errori_scadenze(int riga) if (!cerca_tipopag_codpag(codpag,tipopag)) { - _errore_grave_SC = TRUE; + // _errore_grave_SC = TRUE; // CM700491 set_row(++riga, "@30g%s", (const char*) err_msg[40]); } } @@ -2213,8 +2213,8 @@ bool TRic_ListaMov::preprocess_page(int file,int counter) // Guy: Aggiunta stampa mese di liquidazione se presente const int meseliq = cur->curr(LF_MOV).get_int(MOV_MESELIQ); - if (meseliq > 0) - set_row(r, " mese liq. %d", meseliq); + if (meseliq > 0) + set_row(r, " mese liq. %d", meseliq); stampa_errori_mov(r); @@ -2476,7 +2476,7 @@ print_action TRic_ListaMov::postprocess_page(int file,int count) { reset_print(); _err.reset(); - int n = 1; + int n = 1; if (_tot_dare != _tot_avere) { _errore_grave = TRUE; @@ -3201,7 +3201,8 @@ bool TRic_ListaMov::set_print(int m) setta_parametri(" ", "C"); set_real_picture("###.###.###.###"); - + set_magic_currency(TRUE); + printer().footerlen(5); setta_intestazione(); @@ -3260,6 +3261,7 @@ bool TRic_ListaMov::set_print(int m) setta_parametri(" ", "C"); set_real_picture("###.###.###.###"); + set_magic_currency(TRUE); printer().footerlen(5); diff --git a/cg/cg6900.cpp b/cg/cg6900.cpp index 62be75d4b..9bd826b2c 100755 --- a/cg/cg6900.cpp +++ b/cg/cg6900.cpp @@ -268,7 +268,7 @@ void TInv_cont::main_loop() fclose(i); if (!continua) - return; // Nel caso in cui l'utente decida di annulla re l'operazione + return; // Nel caso in cui l'utente decida di annullare l'operazione setta_tabella_studio(*msk,FALSE); //Aggiorna la tabella studio per invio setta_tabella_ditta(*msk," ",FALSE); //Aggiorna la tabella ditta per invio diff --git a/cg/cg6900.h b/cg/cg6900.h index 3bab6b7bb..4f9804222 100755 --- a/cg/cg6900.h +++ b/cg/cg6900.h @@ -130,6 +130,7 @@ public: void negPC2negAS(TString& numero); void dec2integer(real& val, long dec); + void write_AS_imp(const real& importo, TString& record, int pos, int len = 11); void aggiorna_marker(TString& token, int pos); void calcola_totale_record(); diff --git a/cg/cg6902.cpp b/cg/cg6902.cpp index 22c8c23d7..79d8230a8 100755 --- a/cg/cg6902.cpp +++ b/cg/cg6902.cpp @@ -163,12 +163,14 @@ int TInv_cont::calcola_numero_dischi(TMask& msk,TString& floppy) return numdisc; } +// Invio a sistema bool TInv_cont::invio_contabilita() { + const int size = 256; + char sigla; TString nrec,files; bool header = TRUE; - int size = 256; _numrec_cau = 0; _numrec_clifo = 0; @@ -411,7 +413,7 @@ void TInv_cont::aggiorna_trasfer(TString& files) bool TInv_cont::invio_tab_cau() { - int size = 256; + const int size = 256; TString record(size); TString cod; @@ -632,7 +634,7 @@ void TInv_cont::cerca_dencom(TString& comcf,TString& dencom) bool TInv_cont::invio_clifo() { - int size = 256; + const int size = 256; TString record(size); long cicli = _tclifo->items(); @@ -772,7 +774,7 @@ bool TInv_cont::invio_clifo() bool TInv_cont::invio_pcon() { - int size = 256; + const int size = 256; TString record(size); long cicli = _tpcon->items(); @@ -1111,7 +1113,7 @@ void TInv_cont::sola_iva(TString& record, long nreg) bool TInv_cont::invio_mov_PN() { - int size = 256; + const int size = 256; TString record(size),head_descr; bool almeno_una_riga = FALSE; @@ -1130,7 +1132,6 @@ bool TInv_cont::invio_mov_PN() long nreg = _tmov->get_long(RMV_NUMREG); head_descr = _tmov->get(MOV_DESCR); // Descrizione di testata - testata_mov_PN(); @@ -1187,16 +1188,16 @@ bool TInv_cont::invio_mov_PN() str.format("%06ld", sottocc); record.overwrite(str,89); //Sottoconto di contropartita - real importo (_trmov->get_real(RMV_IMPORTO)); + const real importo (_trmov->get_real(RMV_IMPORTO)); +/* TString numero = importo.string(); if (importo.sign() < 0) negPC2negAS(numero); str.format("%011s", (const char*) numero); record.overwrite(str,97); //Importo riga di movimento +*/ + write_AS_imp(importo, record, 97); -// TString tipoc = _trmov->get(RMV_TIPOC); -// record.overwrite(tipoc,219); //Flag cliente/fornitore - _tras_file.write_control_rec(record,size); _numrec_pn++; } @@ -1283,9 +1284,10 @@ void TInv_cont::cerca_comune_occas(const TString& com) } } +// Invia a sistema un movimento IVA bool TInv_cont::invio_mov_IVA() { - int size = 256; + const int size = 256; TString record(size); long nreg_p; int numero_righe = 0; @@ -1330,25 +1332,31 @@ bool TInv_cont::invio_mov_IVA() real imponibile (_triva->get_real(RMI_IMPONIBILE)); if (_tipodoc == "NC" || _tipodoc == "ST") - imponibile = imponibile * -1; + imponibile = -imponibile; +/* TString numero = imponibile.string(); if (imponibile.sign() < 0) negPC2negAS(numero); str.format("%011s", (const char*) numero); record.overwrite(str,21); //Imponibile +*/ + write_AS_imp(imponibile, record, 21); - TString codiva (_triva->get(RMI_CODIVA)); + const TString16 codiva = _triva->get(RMI_CODIVA); str.format("%02s", (const char*) codiva); record.overwrite(str,32); //Codice iva real imposta (_triva->get_real(RMI_IMPOSTA)); if (_tipodoc == "NC" || _tipodoc == "ST") - imposta = imposta * -1; + imposta = -imposta; +/* numero = imposta.string(); if (imposta.sign() < 0) negPC2negAS(numero); str.format("%09s", (const char*) numero); record.overwrite(str,34); //Imposta +*/ + write_AS_imp(imposta, record, 34, 9); int tipocr = _triva->get_int(RMI_TIPOCR); str.format("%01d", tipocr); @@ -1403,28 +1411,32 @@ bool TInv_cont::invio_mov_IVA() else record.overwrite(" ",134); //Flag causale x acquisti intracomunitari +/* TString corrlire = _corrlire.string(); if (_corrlire.sign() < 0) negPC2negAS(corrlire); str.format("%011s", (const char*) corrlire); record.overwrite(str,135); //Corrispettivo in lire +*/ + write_AS_imp(_corrlire, record, 135); record.overwrite(_codvali,146); //Codice valuta - - dec2integer(_cambioi,100000L); + + /* Cambio intra con 5 decimali */ + dec2integer(_cambioi,100000L); TString cambioi = _cambioi.string(); if (_cambioi.sign() < 0) negPC2negAS(cambioi); str.format("%011s", (const char*) cambioi); record.overwrite(str,149); //Cambio - - dec2integer(_corrval,1000); + + dec2integer(_corrval,1000); TString corrval = _corrval.string(); if (_corrval.sign() < 0) negPC2negAS(corrval); str.format("%014s", (const char*) corrval); record.overwrite(str,160); //Corrispettivo in valuta - + _tmov->setkey(1); _tmov->put(MOV_NUMREG, nreg); if (_tmov->read() == NOERR) @@ -1539,6 +1551,7 @@ long TInv_cont::crea_record_riferimento_PN() return _ultima_nreg; } +// Invia un record partita a sistema void TInv_cont::partita2trasfer(TString& record, bool crea_record_riferimento) { TString str; @@ -1642,11 +1655,15 @@ void TInv_cont::partita2trasfer(TString& record, bool crea_record_riferimento) TString ws; real importo (_tpart->get_real(PART_IMPTOTDOC)); +/* ws = importo.string(); if (importo.sign() < 0) negPC2negAS(ws); str.format("%011s", (const char*) ws); record.overwrite(str,68); //Importo in lire tot documento +*/ + write_AS_imp(importo, record, 68); + _codval = _tpart->get(PART_CODVAL); str.format("%-3s", (const char*) _codval); @@ -1665,15 +1682,26 @@ void TInv_cont::partita2trasfer(TString& record, bool crea_record_riferimento) str.format("%013s", (const char*) ws); record.overwrite(str,82); //Importo in valuta tot documento +/* Vecchio modo a 5 decimali _cambio = _tpart->get_real(PART_CAMBIO); dec2integer(_cambio,100000L); - TString cambioi = _cambio.string(); + TString80 cambioi = _cambio.string(); if (_cambio.sign() < 0) negPC2negAS(cambioi); str.format("%011s", (const char*) cambioi); record.overwrite(str,95); //Cambio +*/ +// Nuovo modo a 6 decimali + _cambio = _tpart->get_real(PART_CAMBIO); + dec2integer(_cambio,1000000L); + TString80 cambioi = _cambio.string(); + if (_cambio.sign() < 0) + negPC2negAS(cambioi); + str.format("%011s", (const char*) cambioi); + record.overwrite(str,95); // Cambio + record.overwrite("6",160); // 6 decimali per cambio - TString datacam (_tpart->get_date(PART_DATACAM)); + TString16 datacam (_tpart->get_date(PART_DATACAM)); str = riconverti(datacam,FALSE); str.format("%06s", (const char*) str); record.overwrite(str,106); //Data cambio @@ -1768,19 +1796,25 @@ void TInv_cont::pagsca2trasfer(TString& record,real& importo,real& importoval) str.format("%02d", nrata); record.overwrite(str,35); //Numero di rata - + +/* TString numero = importo.string(); if (importo.sign() < 0) negPC2negAS(numero); str.format("%011s", (const char*) numero); record.overwrite(str,116); //Importo in lire pagamento - +*/ + write_AS_imp(importo, record, 116); + dec2integer(importoval,1000); +/* TString impvalstr = importoval.string(); if (importoval.sign() < 0) negPC2negAS(impvalstr); str.format("%013s", (const char*) impvalstr); record.overwrite(str,127); //Importo in valuta pagamento +*/ + write_AS_imp(importoval, record, 127, 13); TString codag (_tpagsca->get(PAGSCA_CODAG)); str.format("%-6s", (const char*) codag); @@ -1875,19 +1909,26 @@ bool TInv_cont::invio_mov_SC() record.overwrite(str,115); //Ulteriore classificazione real importo (_tscad->get_real(SCAD_IMPORTO)); +/* numero = importo.string(); if (importo.sign() < 0) negPC2negAS(numero); str.format("%011s", (const char*) numero); record.overwrite(str,116); //Importo in lire rata partita +*/ + write_AS_imp(importo, record, 116); real importoval (_tscad->get_real(SCAD_IMPORTOVAL)); dec2integer(importoval,1000); +/* impvalstr = importoval.string(); if (importoval.sign() < 0) negPC2negAS(impvalstr); str.format("%013s", (const char*) impvalstr); record.overwrite(str,127); //Importo in valuta rata partita +*/ + write_AS_imp(importoval, record, 127, 13); + datascad = _tscad->get_date(SCAD_DATASCAD); str = riconverti(datascad,FALSE); @@ -1973,12 +2014,8 @@ bool TInv_cont::invio_mov_SC() char sez = _tpart->get_char(PART_SEZ); if (diffcam < ZERO) { - diffcam = diffcam * -1; - if (sez == 'D') - sez = 'A'; - else - if (sez == 'A') - sez = 'D'; + diffcam = -diffcam; + sez = (sez == 'D') ? 'A' : 'D'; } str.format("%d", 4); record.overwrite(str,37); @@ -2011,19 +2048,33 @@ bool TInv_cont::invio_mov_SC() void TInv_cont::negPC2negAS(TString& numero) { numero.trim(); - numero = numero.mid(1); // Considero il numero senza il segno - + numero.ltrim(1); // Considero il numero senza il segno - int len = numero.len(); int cifra = atoi(numero.mid(len -1 ,1)); // Considero l'ultima cifra char carattere = _tabella[cifra]; - numero = numero.mid(0,len -1); // Considero il numero senza l'ultima cifra + numero.rtrim(1); // Considero il numero senza l'ultima cifra numero << carattere; -} +} void TInv_cont::dec2integer(real& val, long dec) { - val = val * dec; + val *= dec; val.round(); } + +void TInv_cont::write_AS_imp(const real& importo, TString& record, int pos, int len) +{ + const int dec = TCurrency::get_firm_dec(); + TString16 numero; + numero = importo.string(0, dec); + numero.strip("."); + + if (numero[0] == '-') + negPC2negAS(numero); + numero.right_just(len, '0'); + record.overwrite(numero, pos); +} + diff --git a/cg/cg6904.cpp b/cg/cg6904.cpp index b8354a5e9..ce59a76c1 100755 --- a/cg/cg6904.cpp +++ b/cg/cg6904.cpp @@ -1,4 +1,5 @@ #include +#include #include "cg6900.h" #include "cg6900a.h" @@ -8,7 +9,7 @@ bool TInv_cont::invio_contabilita_PC() char sigla; TString nrec,files; bool header = TRUE; - int size = 1024; + const int size = 1024; _numrec_cau = 0; _numrec_clifo = 0; @@ -664,9 +665,10 @@ void TInv_cont::invio_piano_conti() _tras_file.close(); } +// Invio testate a PC void TInv_cont::invio_testata_movimenti() { - int size = 1024; + const int size = 1024; TString record(size); TString datastr; @@ -789,7 +791,7 @@ void TInv_cont::invio_testata_movimenti() if (ritsoc.sign() < 0) { record.overwrite("-",210); - ritsoc = ritsoc * -1; + ritsoc = -ritsoc; } else record.overwrite("+",210); @@ -801,15 +803,14 @@ void TInv_cont::invio_testata_movimenti() record.overwrite(str,225); real cambioi (_tmov->get_real(MOV_CAMBIOI)); - dec2integer(cambioi,100000); - str.format("%014s", (const char*) cambioi.string()); + str.format("%014s", (const char*)cambioi.string(0, 6)); record.overwrite(str,228); real corrlire (_tmov->get_real(MOV_CORRLIRE)); if (corrlire.sign() < 0) { record.overwrite("-",242); - corrlire = corrlire * -1; + corrlire = -corrlire; } else record.overwrite("+",242); @@ -820,7 +821,7 @@ void TInv_cont::invio_testata_movimenti() if (corrvaluta.sign() < 0) { record.overwrite("-",257); - corrvaluta = corrvaluta * -1; + corrvaluta = -corrvaluta; } else record.overwrite("+",257); @@ -1116,9 +1117,10 @@ void TInv_cont::invio_righe_IVA() _tras_file.close(); } +// Invio partite a PC void TInv_cont::invio_partite() { - int size = 1024; + const int size = 1024; TString record(size); TString datastr; @@ -1267,8 +1269,7 @@ void TInv_cont::invio_partite() record.overwrite(str,211); //Codice valuta real cambio (_tpart->get_real(PART_CAMBIO)); - dec2integer(cambio,100000); - str.format("%014s", (const char*) cambio.string()); + str.format("%014s", (const char*) cambio.string(0, 6)); record.overwrite(str,214); //Cambio real importoval (_tpart->get_real(PART_IMPORTOVAL)); diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index d818caa5e..346d20fa9 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -94,6 +94,18 @@ int TEsercizi_contabili::date2esc(const TDate& d) const return i >= 0 ? esc(i).codice() : 0; } +int TEsercizi_contabili::date2prevesc(const TDate& d) const +{ + const int i = date2index(d); + return i > 0 ? esc(i - 1).codice() : 0; +} + +int TEsercizi_contabili::date2nextesc(const TDate& d) const +{ + const int i = date2index(d); + return i >=0 && i < items()-1 ? esc(i+1).codice() : 0; +} + int TEsercizi_contabili::first() const { check(); @@ -540,7 +552,8 @@ real TCodiceIVA::lordo(const real & imponibile, int ndec, const char * codval) c } bool handler_data_cambio(TMask_field& f, KEY k) -{ +{ +/* if (k == K_TAB && f.focusdirty()) { CHECK(f.is_edit(), "Campo non editabile come data cambio"); @@ -574,6 +587,7 @@ bool handler_data_cambio(TMask_field& f, KEY k) } } } +*/ return TRUE; } diff --git a/cg/cglib01.h b/cg/cglib01.h index d0914652f..554bc3033 100755 --- a/cg/cglib01.h +++ b/cg/cglib01.h @@ -53,6 +53,8 @@ public: const TEsercizio& operator [](int codice) const { return esercizio(codice); } int date2esc(const TDate& date) const; + int date2prevesc(const TDate& date) const; + int date2nextesc(const TDate& date) const; int pred(int codice) const; int next(int codice) const; int first() const; diff --git a/cg/cglib02.cpp b/cg/cglib02.cpp index f275e4831..086b433f9 100755 --- a/cg/cglib02.cpp +++ b/cg/cglib02.cpp @@ -91,7 +91,7 @@ TSaldo::TSaldo() : _saldi(LF_SALDI), _saldoiniziale(ZERO), _saldo_iniziale(ZERO) {} -real TSaldo::saldofin_esprec(int annoes, int g, int c, long s, bool saldo_chiusura) +real TSaldo::saldofin_esprec(int annoes, int g, int c, long s, bool saldo_chiusura, bool provvis) { const int annoesprec = EsePre(annoes); _significativo = FALSE; @@ -120,7 +120,13 @@ real TSaldo::saldofin_esprec(int annoes, int g, int c, long s, bool saldo_chiusu else // progressivi precedenti nella stampa mastrini, tot -= saldosf; // che e' l'unico programma ad usare la funzione } // passandogli come flag saldo_chiusura il valore TRUE. - + + if (provvis) + { + tot += pdarepro; + tot -= paverepro; + } + _significativo = (tot != 0); return tot; } diff --git a/cg/cglib02.h b/cg/cglib02.h index 74e6e3aba..0b56803c1 100755 --- a/cg/cglib02.h +++ b/cg/cglib02.h @@ -112,7 +112,7 @@ public: bool ricerca_progr_prec(int, int, int, long); - real saldofin_esprec(int,int,int,long,bool saldo_chiusura = FALSE); + real saldofin_esprec(int,int,int,long,bool saldo_chiusura = FALSE, bool provvisori = FALSE); bool prg_attuali(int i,TConto& c, real& p1, real& p2) { return prg_saldo(i, c, p1, p2, FALSE); } bool prg_mov_eliminati(int i, TConto& c, real& p1, real& p2) diff --git a/cg/cglib03.cpp b/cg/cglib03.cpp index 257bcced3..bc598ae6b 100755 --- a/cg/cglib03.cpp +++ b/cg/cglib03.cpp @@ -19,7 +19,7 @@ TInteressi_IVA_table::~TInteressi_IVA_table() int TInteressi_IVA_table::read(int anno, int mese) { TString16 k; - k.format("%d%02d",anno,mese); + k.format("%04d%02d",anno,mese); zero();put("CODTAB",k); if (TTable::read(_isgteq) == NOERR) { diff --git a/cg/cglib04.cpp b/cg/cglib04.cpp index bbc61e18a..d3e537647 100755 --- a/cg/cglib04.cpp +++ b/cg/cglib04.cpp @@ -27,7 +27,7 @@ HIDDEN TString TEMP; //ritorna falso se la causale non e' significativa bool look_causale (const char* codcaus) { - TString16 caus = codcaus; + const TFixed_string caus(codcaus); if (caus == "000") return FALSE; return !caus.blank(); @@ -1083,34 +1083,12 @@ const char* TTransfer_file::cerca_comune_cap(TString& field, const TString& loca const char* TTransfer_file::cerca_cap_comune(const TString& localita) { -/* - TLocalisamfile comuni (LF_COMUNI); - comuni.setkey(2); - comuni.zero(); - comuni.put(COM_DENCOM, localita); - if (comuni.read() == NOERR) - TEMP = comuni.get(COM_CAPCOM); - else - TEMP = ""; - return TEMP; -*/ const TRectype& rec = _comuni2.get(localita); return rec.get(COM_CAPCOM); } const char* TTransfer_file::cerca_comune_den(const TString& field) { -/* - TLocalisamfile comuni (LF_COMUNI); - comuni.setkey(2); - comuni.zero(); - comuni.put(COM_DENCOM, field); - if (comuni.read() == NOERR) - TEMP = comuni.get(COM_COM); - else - TEMP = ""; - return TEMP; -*/ const TRectype& rec = _comuni2.get(field); return rec.get(COM_COM); } @@ -1485,13 +1463,17 @@ int TTransfer_file::annoes_datacomp(const TString& record, TDate& datacomp) } void TTransfer_file::decimali(TString& campo, int dec) -{ - int l = campo.len(); - - if (!l) return; - - int p = l - dec; - campo.insert(".",p); +{ + if (dec > 0) + { + const int l = campo.len(); + if (l >= dec) + { + const int p = l - dec; + if (p == 0 || campo[p-1] != '.') + campo.insert(".", p); + } + } } int TTransfer_file::strip_zero(TString& importo) @@ -1548,6 +1530,13 @@ void TTransfer_file::negativo(TString& importo) } } +// Controlla se la ditta è in euro +static bool ditta_in_euro() +{ +// return TCurrency::get_firm_dec() != 0; + return is_euro_value(NULL); +} + void TTransfer_file::write_tmp_movPN(TString& record) { TString sigla,key,str,codreg; @@ -1613,23 +1602,32 @@ void TTransfer_file::write_tmp_movPN(TString& record) logicnum_p = logicnum; } - int from = trc.from(key); - int to = trc.to(key); - TString fname = trc.field_name(key); - TString field = record.sub(from-1,to); - int flag = trc.flag(key); - int dec = trc.flag_bis(key); + const int from = trc.from(key); + const int to = trc.to(key); + TString16 fname = trc.field_name(key); + TString field = record.sub(from-1,to); + int flag = trc.flag(key); + int dec = trc.flag_bis(key); TRecfield campo (*dep,fname); if (campo.type() == _realfld) + { negativo(field); + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } + } if (flag == 3) { if (dec > 0) decimali(field,dec); - - real appoggio (field); + // Non capisco a cosa serva ma mi adeguo: forse toglie gli zeri iniziali + real appoggio = field; field = appoggio.string(); } @@ -1674,7 +1672,7 @@ void TTransfer_file::write_tmp_movPN(TString& record) if (fname == "IMPORTO") { - real imp = real::ita2eng(field); + const real imp = field; importo = imp; } @@ -1710,7 +1708,7 @@ void TTransfer_file::write_tmp_movPN(TString& record) dep->put(MOV_NUMREG, _numreg); dep->put(MOV_DATAREG, _datareg); dep->put(MOV_DATACOMP, datacomp); - int annoiva = _datareg.year(); + const int annoiva = _datareg.year(); dep->put(MOV_ANNOIVA, annoiva); } if (flag == 2) @@ -1918,8 +1916,8 @@ void TTransfer_file::write_tmp_movIVA(TString& record) int from = trc.from(key); int to = trc.to(key); - TString fname = trc.field_name(key); - TString field = record.sub(from-1,to); + TString16 fname = trc.field_name(key); + TString80 field = record.sub(from-1,to); int flag = trc.flag(key); int dec = trc.flag_bis(key); @@ -1932,7 +1930,16 @@ void TTransfer_file::write_tmp_movIVA(TString& record) TRecfield campo (*dep,fname); if (campo.type() == _realfld) + { negativo(field); + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } + } if (flag == 3) { @@ -2077,12 +2084,12 @@ int TTransfer_file::ultima_riga_partita(TString& record) tpart.put(PART_ANNO, _annoSC); tpart.put(PART_NUMPART, _numpartSC); - TRectype partita (tpart.curr()); + const TRectype partita(tpart.curr()); for (tpart.read(_isgteq); !tpart.eof(); tpart.next()) { - TString part_rec = partita.get(PART_NUMPART); //CONF - TString part_file = tpart.get(PART_NUMPART); + TString16 part_rec = partita.get(PART_NUMPART); //CONF + TString16 part_file = tpart.get(PART_NUMPART); if (tpart.curr() != partita || part_file != part_rec) break; riga = tpart.get_int(PART_NRIGA); @@ -2138,23 +2145,26 @@ void TTransfer_file::calcola_imposta(TString& field, real& imposta) TIsamtempfile& tab = *_ttab; long nreg = atol(field); - TString app (format("%2s%06ld", (const char*) "U1", nreg)); + TString16 app; app.format("%2s%06ld", (const char*) "U1", nreg); TRic_recfield recf (tab.curr(), "S0", 0, 256); tab.zero(); tab.put("CODTAB", app); - TRectype rectab (tab.curr()); + const TRectype rectab (tab.curr()); for (tab.read(); !tab.eof(); tab.next()) { if (tab.curr() > rectab) break; - buffer = (const char*) recf; + buffer = (const char*)recf; - TString app (buffer.sub(34,43)); + app = buffer.sub(34,43); negativo(app); + if (ditta_in_euro()) + app.insert(".", app.len()-2); + real imp (app); imposta += imp; } @@ -2225,7 +2235,7 @@ void TTransfer_file::calcola_impdocval(long nreg,int nrig,TString& record) _tpart->setkey(key); } - +// Scrive partita da record di sistema a record di file temporaneo void TTransfer_file::partita(TString& record) { TMappa_trc& trc = mappa(); @@ -2260,14 +2270,29 @@ void TTransfer_file::partita(TString& record) { int from = trc.from(key); int to = trc.to(key); - TString fname = trc.field_name(key); + TString16 fname = trc.field_name(key); TString field = record.sub(from-1,to); int flag = trc.flag(key); int dec = trc.flag_bis(key); + + if (dec == 5 && fname == "CAMBIO") // CM500412 + { + if (record[160] == '6') + dec = 6; + } TRecfield campo (*_deppart,fname); if (campo.type() == _realfld) + { negativo(field); + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } + } if (flag == 3) { @@ -2293,7 +2318,7 @@ void TTransfer_file::partita(TString& record) } if (fname == "ANNO") { - TString app = field; + TString16 app = field; int anno = atoi(field); if (anno < 80) { @@ -2344,13 +2369,13 @@ void TTransfer_file::partita(TString& record) if (fname == "REG") { if (real::is_natural(field)) - field.format("%03s", (const char*) field); + field.format("%03s", (const char*)field); else - field.format("%-3s", (const char*) field); + field.format("%-3s", (const char*)field); } if (fname == "CODCAUS") - if (field == "000" || solo_saldaconto) + if (field == "000" /* || solo_saldaconto */) // Il codice causale serve! CM600476 field = ""; if (flag == 2) @@ -2442,8 +2467,17 @@ void TTransfer_file::scadenza(TString& record) TRecfield campo (*_depscad,fname); if (campo.type() == _realfld) + { negativo(field); - + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } + } + if (flag == 3) { if (dec > 0) @@ -2498,7 +2532,7 @@ void TTransfer_file::scadenza(TString& record) //di un numero va riempito con degli 0. Se si tratta di un alfa va allineato a destra. if (fname == "CODPAG") { - TString f = field; + TString16 f = field; field.format("%-4s", (const char*) f); } @@ -2835,7 +2869,15 @@ void TTransfer_file::pagsca(TString& record) { TRecfield campo (*_deppagsca,fname); if (campo.type() == _realfld) - negativo(field); + { + negativo(field); + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } + } } if (flag == 3) @@ -2995,7 +3037,7 @@ void TTransfer_file::pagsca(TString& record) if (accsal != "S") _tpagsca->put(PAGSCA_ACCSAL, _deppagsca->get(PAGSCA_ACCSAL)); if (caso == 'a') - _tpagsca->put(PAGSCA_PASSATT, _deppagsca->get(PAGSCA_PASSATT)); + _tpagsca->put(PAGSCA_PASSATT, _deppagsca->get(PAGSCA_PASSATT)); _tpagsca->put(PAGSCA_IMPORTO, importo); _tpagsca->put(PAGSCA_IMPORTOVAL, valuta); _tpagsca->put(PAGSCA_ABBUONI, abbuoni); @@ -3124,7 +3166,7 @@ bool TTransfer_file::ordina_trasfer(const char* orig) return ok; } -//Scarica su file temp il contenuto del trasfer +//Scarica su file temp il contenuto del trasfer da SISTEMA bool TTransfer_file::fcopytemp(const char* orig, const char* dest) { // conto i dischetti per l'apertura @@ -3248,7 +3290,6 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest) scrivi_PN(nrec_mov); if (sigle.find('U') >= 0) scrivi_IVA(nrec_moviva); - if (sigle.find('B') >= 0) scrivi_SC(nrec_salda); @@ -3532,7 +3573,7 @@ void TTransfer_file::scrivi_SC(long nrec) delete _deppagsca; } -//Scarica su file temp il contenuto del trasfer +//Scarica su file temp il contenuto del trasfer da PC bool TTransfer_file::fcopytemp_PC(const char* orig, const char* dest) { // conto i dischetti per l'apertura @@ -4150,7 +4191,7 @@ void TTransfer_file::write_testata_movimenti(TString& record) { int from = trc.from(key); int to = trc.to(key); - TString fname = trc.field_name(key); + TString16 fname = trc.field_name(key); TString field = record.sub(from-1,to); int flag = trc.flag(key); int dec = trc.flag_bis(key); @@ -4426,6 +4467,13 @@ void TTransfer_file::write_righe_contabili(TString& record) } else field = importo; + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } } if (flag == 3) @@ -4439,7 +4487,7 @@ void TTransfer_file::write_righe_contabili(TString& record) if (fname == RMV_IMPORTO) { - real imp = real::ita2eng(field); + real imp = field; importo = imp; } @@ -4563,6 +4611,13 @@ void TTransfer_file::write_righe_IVA(TString& record) } else field = importo; + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } } if (flag == 3) @@ -4760,6 +4815,13 @@ void TTransfer_file::write_partite(TString& record) } else field = importo; + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } } if (flag == 3) @@ -4892,6 +4954,13 @@ void TTransfer_file::write_scadenze(TString& record) } else field = importo; + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } } if (flag == 3) @@ -5033,6 +5102,13 @@ void TTransfer_file::write_pagsca(TString& record) } else field = importo; + + // Cerco di riconoscere gli importi in euro + if (dec == 0 && (to-from) >= 8 && record.size()<1024 && ditta_in_euro()) + { + flag = 3; + dec = 2; + } } if (flag == 3) diff --git a/cg/cgp1.url b/cg/cgp1.url index 1d4534717..5b9a20a00 100755 --- a/cg/cgp1.url +++ b/cg/cgp1.url @@ -1,15 +1,4 @@ #include - -/* cgp1 -0 Programma personalizzato per stampa mastrini per centri di costo */ - -MENU TASK_MENUBAR - SUBMENU MENU_FILE "~File" - -/* cgp1 -1 Programma personalizzato per stampa bilanci per centri di costo */ - -MENUBAR MENU_BAR(1) - -MENU MENU_BAR(1) - SUBMENU MENU_FILE "~File" +#include diff --git a/cg/cgp1100.cpp b/cg/cgp1100.cpp index 8bc1db066..9e607329e 100755 --- a/cg/cgp1100.cpp +++ b/cg/cgp1100.cpp @@ -22,8 +22,6 @@ #define RMOV_ALIAS 501 -TString256 TMP; - class TMastrini_application : public TPrintapp { static bool data_inizio (TMask_field& f, KEY k); @@ -92,6 +90,9 @@ class TMastrini_application : public TPrintapp int _rw, _conta_mastrini, _indice_array, _item, _item_lista, _indice_lista; int _ddociva_len; + TString TMP; + TString _picture; + protected: virtual bool user_create() ; virtual bool user_destroy(); @@ -1023,26 +1024,26 @@ void TMastrini_application::stampa_totali132() _saldo_periodo = _totale_periodo_dare - _totale_periodo_avere; _saldo_progre = _totprogre_dare - _totprogre_avere; _saldo_progre_al = _totprogre_dare_al - _totprogre_avere_al; - TString string = _saldo_periodo.string("###.###.###.###"); + TString string = _saldo_periodo.string(_picture); set_row (_rw,"@32gTOTALI PERIODO@69g%15s", (const char*)string); - string = _totale_periodo_dare.string("###.###.###.###"); + string = _totale_periodo_dare.string(_picture); set_row (_rw,"@85g%15s", (const char*)string); - string = _totale_periodo_avere.string("###.###.###.###"); + string = _totale_periodo_avere.string(_picture); set_row (_rw++,"@101g%15s", (const char*)string); - string = _saldo_progre.string("###.###.###.###"); + string = _saldo_progre.string(_picture); set_row (_rw,"@32gTOTALI PROGRESSIVI@69g%15s", (const char*)string); - string = _totprogre_dare.string("###.###.###.###"); + string = _totprogre_dare.string(_picture); set_row (_rw,"@85g%15s", (const char*)string); - string = _totprogre_avere.string("###.###.###.###"); + string = _totprogre_avere.string(_picture); set_row (_rw++,"@101g%15s", (const char*)string); if (_stampaprogre) //Progressivi attuali { - TString str = _saldo_progre_al.string("###.###.###.###"); + TString str = _saldo_progre_al.string(_picture); set_row (_rw,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); set_row (_rw,"@69g%15s", (const char*)str); - str = _totprogre_dare_al.string("###.###.###.###"); + str = _totprogre_dare_al.string(_picture); set_row (_rw,"@85g%15s", (const char*)str); - str = _totprogre_avere_al.string("###.###.###.###"); + str = _totprogre_avere_al.string(_picture); set_row (_rw,"@101g%15s", (const char*)str); } _devi_stampare_footer = FALSE; @@ -1075,16 +1076,16 @@ void TMastrini_application::carica_array_totali132() r = ""; r.add("@32gTOTALI PERIODO@69g%15s@85g%15s@101g%15s"); - r.add(_saldo_periodo.string("###.###.###.###")); - r.add(_totale_periodo_dare.string("###.###.###.###")); - r.add(_totale_periodo_avere.string("###.###.###.###")); + r.add(_saldo_periodo.string(_picture)); + r.add(_totale_periodo_dare.string(_picture)); + r.add(_totale_periodo_avere.string(_picture)); _lista.add(r); r = ""; r.add("@32gTOTALI PROGRESSIVI@69g%15s@85g%15s@101g%15s"); - r.add(_saldo_progre.string("###.###.###.###")); - r.add(_totprogre_dare.string("###.###.###.###")); - r.add(_totprogre_avere.string("###.###.###.###")); + r.add(_saldo_progre.string(_picture)); + r.add(_totprogre_dare.string(_picture)); + r.add(_totprogre_avere.string(_picture)); _lista.add(r); r = ""; @@ -1092,9 +1093,9 @@ void TMastrini_application::carica_array_totali132() { r.add("@32gTOTALI PROGRESSIVI AL@55g%s@69g%15s@85g%15s@101g%15s"); r.add(_ultima_data_reg.string()); - r.add(_saldo_progre_al.string("###.###.###.###")); - r.add(_totprogre_dare_al.string("###.###.###.###")); - r.add(_totprogre_avere_al.string("###.###.###.###")); + r.add(_saldo_progre_al.string(_picture)); + r.add(_totprogre_dare_al.string(_picture)); + r.add(_totprogre_avere_al.string(_picture)); _lista.add(r); r = ""; } @@ -1119,7 +1120,7 @@ void TMastrini_application::carica_array_totali132() r.add(fmt); r.add(riga._descrdoc); totale = riga._totdociva; - r.add(totale.string("###.###.###.###")); + r.add(totale.string(_picture)); _lista.add(r); r = ""; } @@ -1210,26 +1211,26 @@ void TMastrini_application::stampa_totali198() _totprogre_dare=_progredare+_totale_periodo_dare; _totprogre_avere=_progreavere+_totale_periodo_avere; - TString string = _totale_periodo_dare.string("###.###.###.###"); + TString string = _totale_periodo_dare.string(_picture); set_row (_rw,"@32gTOTALI PERIODO@101g%15s", (const char*)string); - string = _totale_periodo_avere.string("###.###.###.###"); + string = _totale_periodo_avere.string(_picture); set_row (_rw,"@117g%15s", (const char*)string); - string = _saldo_movimenti.string("###.###.###.###"); + string = _saldo_movimenti.string(_picture); set_row (_rw++,"@149g%15s", (const char*)string); - string = _totprogre_dare.string("###.###.###.###"); + string = _totprogre_dare.string(_picture); set_row (_rw,"@32gTOTALI PROGRESSIVI@101g%15s",(const char*)string); - string = _totprogre_avere.string("###.###.###.###"); + string = _totprogre_avere.string(_picture); set_row (_rw,"@117g%15s", (const char*)string); - string = _saldo_progressivi.string("###.###.###.###"); + string = _saldo_progressivi.string(_picture); set_row (_rw++,"@133g%15s", (const char*)string); if (_stampaprogre) //Progressivi attuali { set_row(_rw,"@32gTOTALI PROGRESSIVI AL@55g%s",(const char*)_ultima_data_reg.string()); - TString str = _totprogre_dare_al.string("###.###.###.###"); + TString str = _totprogre_dare_al.string(_picture); set_row (_rw,"@101g%15s", (const char*)str); - str = _totprogre_avere_al.string("###.###.###.###"); + str = _totprogre_avere_al.string(_picture); set_row (_rw,"@117g%15s", (const char*)str); - str = _saldo_progressivi.string("###.###.###.###"); + str = _saldo_progressivi.string(_picture); set_row (_rw,"@133g%15s", (const char*)str); } _devi_stampare_footer = FALSE; @@ -1259,16 +1260,16 @@ void TMastrini_application::carica_array_totali198() _totprogre_avere=_progreavere+_totale_periodo_avere; r.add("@32gTOTALI PERIODO@101g%15s@117g%15s@149g%15s"); - r.add(_totale_periodo_dare.string("###.###.###.###")); - r.add(_totale_periodo_avere.string("###.###.###.###")); - r.add(_saldo_movimenti.string("###.###.###.###")); + r.add(_totale_periodo_dare.string(_picture)); + r.add(_totale_periodo_avere.string(_picture)); + r.add(_saldo_movimenti.string(_picture)); _lista.add(r); r = ""; r.add("@32gTOTALI PROGRESSIVI@101g%15s@117g%15s@133g%15s"); - r.add(_totprogre_dare.string("###.###.###.###")); - r.add(_totprogre_avere.string("###.###.###.###")); - r.add(_saldo_progressivi.string("###.###.###.###")); + r.add(_totprogre_dare.string(_picture)); + r.add(_totprogre_avere.string(_picture)); + r.add(_saldo_progressivi.string(_picture)); _lista.add(r); r = ""; @@ -1276,9 +1277,9 @@ void TMastrini_application::carica_array_totali198() { r.add("@32gTOTALI PROGRESSIVI AL@55g%s@101g%15s@117g%15s@133g%15s"); r.add(_ultima_data_reg.string()); - r.add(_totprogre_dare_al.string("###.###.###.###")); - r.add(_totprogre_avere_al.string("###.###.###.###")); - r.add(_saldo_progressivi.string("###.###.###.###")); + r.add(_totprogre_dare_al.string(_picture)); + r.add(_totprogre_avere_al.string(_picture)); + r.add(_saldo_progressivi.string(_picture)); _lista.add(r); r = ""; } @@ -1303,7 +1304,7 @@ void TMastrini_application::carica_array_totali198() r.add(fmt); r.add(riga._descrdoc); totale = riga._totdociva; - r.add(totale.string("###.###.###.###")); + r.add(totale.string(_picture)); _lista.add(r); r = ""; } @@ -1554,7 +1555,7 @@ bool TMastrini_application::preprocess_page(int file, int counter) // nella maschera. Se non viene specificato li stampa tutti _importo = current_cursor()->curr(-RMOV_ALIAS).get_real(RMV_IMPORTO); - _importo_str = _importo.string("###.###.###.###"); + _importo_str = _importo.string(_picture); _mov->setkey(1); _mov->curr().zero(); _mov->curr().put(MOV_NUMREG,_numreg); @@ -1957,8 +1958,8 @@ bool TMastrini_application::preprocess_page(int file, int counter) if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) { - TString dare (dep_dare.string("###.###.###.###")); - TString avere (dep_avere.string("###.###.###.###")); + TString dare (dep_dare.string(_picture)); + TString avere (dep_avere.string(_picture)); if (_numcarat == 1) { set_row (_rw,"@32gA RIPORTO@85g%s", (const char*) dare); @@ -2018,8 +2019,8 @@ bool TMastrini_application::preprocess_page(int file, int counter) const int righe_rimaste = printer().rows_left(); _stampato = righe_rimaste >= 1; - _saldo_progressivi_str=_saldo_progressivi.string("###.###.###.###"); - _saldo_movimenti_str=_saldo_movimenti.string("###.###.###.###"); + _saldo_progressivi_str=_saldo_progressivi.string(_picture); + _saldo_movimenti_str=_saldo_movimenti.string(_picture); if (_numcarat == 2) { ricerca_regiva(); @@ -2301,7 +2302,7 @@ void TMastrini_application::stampa_totaliiva() TDociva& riga = (TDociva&)_b[j]; set_row(_rw+j, "@0g%s",(const char*) riga._descrdoc); totale = riga._totdociva; - TString string = totale.string("###.###.###.###"); + TString string = totale.string(_picture); set_row(_rw+j, fmt, (const char*)string); } @@ -2389,17 +2390,24 @@ bool TMastrini_application::preprocess_print(int file, int counter) bool TMastrini_application::set_print(int) { + if (TCurrency::get_firm_dec() == 0) + { + _picture = "###.###.###.###"; + set_real_picture(_picture); + } + else + { + _picture = "####.###.###,@@"; + set_real_picture(_picture); + } + _puoi_stampare = TRUE; - KEY tasto; + // Simula l'immediata pressione del tasto stampa senza nemmeno lanciare la maschera + KEY tasto = K_ENTER; // Controlla se esistono impostazioni di stampa in coda - if (sheet2mask()) - { - // Simula l'immediata pressione del tasto stampa senza nemmeno lanciare la maschera - tasto = K_ENTER; - } - else + if (!sheet2mask()) { tasto = _msk->run(); if (tasto == K_ENTER) @@ -2439,7 +2447,7 @@ bool TMastrini_application::set_print(int) _data_fine = _msk->get_date(F_DATAFINE); TEsercizi_contabili esc; - + if (_annomsk != 0) _anno_corrente = _annomsk; else @@ -2598,8 +2606,8 @@ void TMastrini_application::preprocess_footer() if (_nummast != 3 || dep_dare != ZERO || dep_avere != ZERO) { - TString dare (dep_dare.string("###.###.###.###")); - TString avere (dep_avere.string("###.###.###.###")); + TString dare (dep_dare.string(_picture)); + TString avere (dep_avere.string(_picture)); if (_numcarat == 1) { set_footer (2,"@32gA RIPORTO@85g%s", (const char*) dare); @@ -2820,20 +2828,20 @@ void TMastrini_application::crea_intestazione() { if (_numcarat == 1) { - TString string = _saldo_progre_prec.string("###.###.###.###"); + TString string = _saldo_progre_prec.string(_picture); set_header (r,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); - string = _progredare.string("###.###.###.###"); + string = _progredare.string(_picture); set_header (r,"@85g%15s",(const char*) string); - string = _progreavere.string("###.###.###.###"); + string = _progreavere.string(_picture); set_header (r++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = _progredare.string("###.###.###.###"); + TString string = _progredare.string(_picture); set_header (r,"@70gPROGRESSIVI PRECEDENTI@101g%15s",(const char*)string); - string = _progreavere.string("###.###.###.###"); + string = _progreavere.string(_picture); set_header (r,"@117g%15s",(const char*) string); - string = _saldo_progre_prec.string("###.###.###.###"); + string = _saldo_progre_prec.string(_picture); set_header (r++,"@133g%15s",(const char*) string); } _riporto_dare = _progredare; @@ -2855,16 +2863,16 @@ void TMastrini_application::crea_intestazione() { if (_numcarat == 1) { - TString string = dep_dare.string("###.###.###.###"); + TString string = dep_dare.string(_picture); set_header (r,"@32gA RIPORTO@85g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); + string = dep_avere.string(_picture); set_header (r++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = dep_dare.string("###.###.###.###"); + TString string = dep_dare.string(_picture); set_header (r,"@32gA RIPORTO@101g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); + string = dep_avere.string(_picture); set_header (r++,"@117g%15s",(const char*) string); } } @@ -3042,16 +3050,16 @@ void TMastrini_application::stampa_progre_riporto() { if (_numcarat == 1) { - TString string = dep_dare.string("###.###.###.###"); + TString string = dep_dare.string(_picture); set_row (_rw,"@32gA RIPORTO@85g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); + string = dep_avere.string(_picture); set_row (_rw++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = dep_dare.string("###.###.###.###"); + TString string = dep_dare.string(_picture); set_row (_rw,"@32gA RIPORTO@101g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); + string = dep_avere.string(_picture); set_row (_rw++,"@117g%15s",(const char*) string); } } @@ -3097,16 +3105,16 @@ int TMastrini_application::stampa_progre_riporto(int start_riga) { if (_numcarat == 1) { - TString string = dep_dare.string("###.###.###.###"); + TString string = dep_dare.string(_picture); set_row (r,"@32gA RIPORTO@85g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); + string = dep_avere.string(_picture); set_row (r++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = dep_dare.string("###.###.###.###"); + TString string = dep_dare.string(_picture); set_row (r,"@32gA RIPORTO@101g%15s",(const char*) string); - string = dep_avere.string("###.###.###.###"); + string = dep_avere.string(_picture); set_row (r++,"@117g%15s",(const char*) string); } } @@ -3460,21 +3468,21 @@ void TMastrini_application::stampa_progressivi() if (_numcarat == 1) { - TString string = _saldo_progre_prec.string("###.###.###.###"); + TString string = _saldo_progre_prec.string(_picture); set_row (_rw,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); - string = _progredare.string("###.###.###.###"); + string = _progredare.string(_picture); set_row (_rw,"@85g%15s",(const char*) string); - string = _progreavere.string("###.###.###.###"); + string = _progreavere.string(_picture); set_row (_rw++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = _progredare.string("###.###.###.###"); + TString string = _progredare.string(_picture); set_row (_rw,"@70gPROGRESSIVI PRECEDENTI@101g%15s",(const char*)string); - string = _progreavere.string("###.###.###.###"); + string = _progreavere.string(_picture); set_row (_rw,"@117g%15s",(const char*) string); - string = _saldo_progre_prec.string("###.###.###.###"); + string = _saldo_progre_prec.string(_picture); set_row (_rw++,"@133g%15s",(const char*) string); } } @@ -3485,21 +3493,21 @@ int TMastrini_application::stampa_progressivi(int start_riga) if (_numcarat == 1) { - TString string = _saldo_progre_prec.string("###.###.###.###"); + TString string = _saldo_progre_prec.string(_picture); set_row (r,"@42gPROGRESSIVI PRECEDENTI@69g%15s",(const char*) string); - string = _progredare.string("###.###.###.###"); + string = _progredare.string(_picture); set_row (r,"@85g%15s",(const char*) string); - string = _progreavere.string("###.###.###.###"); + string = _progreavere.string(_picture); set_row (r++,"@101g%15s",(const char*) string); } if (_numcarat == 2) { - TString string = _progredare.string("###.###.###.###"); + TString string = _progredare.string(_picture); set_row (r,"@70gPROGRESSIVI PRECEDENTI@101g%15s",(const char*)string); - string = _progreavere.string("###.###.###.###"); + string = _progreavere.string(_picture); set_row (r,"@117g%15s",(const char*) string); - string = _saldo_progre_prec.string("###.###.###.###"); + string = _saldo_progre_prec.string(_picture); set_row (r++,"@133g%15s",(const char*) string); } diff --git a/cg/cgp1200.cpp b/cg/cgp1200.cpp index 8d11ae64f..e1623939f 100755 --- a/cg/cgp1200.cpp +++ b/cg/cgp1200.cpp @@ -212,8 +212,6 @@ bool TCGPSaldo::data_limite_bilancio(int bilancio, int g, int c, long s, const T return _movimentato; } -extern TString256 TMP; - class TStampaBilanciCDC_application : public TPrintapp { static bool mask_anno (TMask_field& f, KEY k); @@ -299,6 +297,9 @@ class TStampaBilanciCDC_application : public TPrintapp //TString _causale_ap, _causale_chi; TArray _clienti, _fornitori; + TString TMP; + TString _extra_picture, _total_picture; + public: TDate _inizioEs, _fineEs; @@ -2770,7 +2771,19 @@ void TStampaBilanciCDC_application::leggi_files_avere(TIsamtempfile* file) bool TStampaBilanciCDC_application::preprocess_print(int file, int counter) { - set_real_picture ("###.###.###.###"); + if (TCurrency::get_firm_dec() == 0) + { + set_real_picture("###.###.###.###"); + _extra_picture = "#.###.###.###.###"; + _total_picture = "#############"; + } + else + { + set_real_picture("####.###.###,@@"); + _extra_picture = "##.###.###.###,@@"; + _total_picture = "##########,@@"; + } + if (_bilancio == 1) { set_print_zero(); @@ -3457,11 +3470,11 @@ void TStampaBilanciCDC_application::stampa_riga_totali(int r) strlen(_saldo_finale_tot.string()) > 12) { palla = TRUE; - if (!_saldo_dare_tot.is_zero()) sdt = _saldo_dare_tot.string("#############"); - if (!_saldo_avere_tot.is_zero()) sat = _saldo_avere_tot.string("#############"); - if (!_mov_dare_tot.is_zero()) mdt = _mov_dare_tot.string("#############"); - if (!_mov_avere_tot.is_zero()) mat = _mov_avere_tot.string("#############"); - if (!_saldo_finale_tot.is_zero()) sft = _saldo_finale_tot.string("#############"); + if (!_saldo_dare_tot.is_zero()) sdt = _saldo_dare_tot.string(_total_picture); + if (!_saldo_avere_tot.is_zero()) sat = _saldo_avere_tot.string(_total_picture); + if (!_mov_dare_tot.is_zero()) mdt = _mov_dare_tot.string(_total_picture); + if (!_mov_avere_tot.is_zero()) mat = _mov_avere_tot.string(_total_picture); + if (!_saldo_finale_tot.is_zero()) sft = _saldo_finale_tot.string(_total_picture); } if (_verifica == 2) @@ -3527,8 +3540,8 @@ void TStampaBilanciCDC_application::stampa_riga_totali(int r) if (strlen(_nuovo_tot_saldo_d.string()) > 12 || strlen(_nuovo_tot_saldo_a.string()) > 12) { - if (!_nuovo_tot_saldo_d.is_zero()) ntsd = _nuovo_tot_saldo_d.string("#############"); - if (!_nuovo_tot_saldo_a.is_zero()) ntsa = _nuovo_tot_saldo_a.string("#############"); + if (!_nuovo_tot_saldo_d.is_zero()) ntsd = _nuovo_tot_saldo_d.string(_total_picture); + if (!_nuovo_tot_saldo_a.is_zero()) ntsa = _nuovo_tot_saldo_a.string(_total_picture); //modifica del 21/11/1995 if (_tipo_stampa1 == 2) set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@85g%s@101g%s@114g!",(const char*)ntsd,(const char*)ntsa); @@ -3574,8 +3587,8 @@ void TStampaBilanciCDC_application::stampa_riga_totali(int r) if (strlen(_nuovo_tot_saldo_d.string()) > 12 || strlen(_nuovo_tot_saldo_a.string()) > 12) { - if (!_nuovo_tot_saldo_d.is_zero()) ntsd = _nuovo_tot_saldo_d.string("#############"); - if (!_nuovo_tot_saldo_a.is_zero()) ntsa = _nuovo_tot_saldo_a.string("#############"); + if (!_nuovo_tot_saldo_d.is_zero()) ntsd = _nuovo_tot_saldo_d.string(_total_picture); + if (!_nuovo_tot_saldo_a.is_zero()) ntsa = _nuovo_tot_saldo_a.string(_total_picture); if (_tipo_stampa1 == 2) set_row(r,"@1g****** ********@18gTOTALE CON SALDI INIZIALI@49g!@82g!@85g%s@102g%s@115g!@148g!",(const char*)ntsd,(const char*)ntsa); //else set_row(r,"@1g****** ********@18gTOTALE CON MOVIM. DI APERTURA@49g!@82g!@85g%s@102g%s@115g!@148g!",(const char*)ntsd,(const char*)ntsa); @@ -3614,15 +3627,16 @@ void TStampaBilanciCDC_application::stampa_totali() set_row(_i++, (const char*)dep); set_row(_i++, (const char*)dep); set_row(_i++, (const char*)dep); - set_row(_i++, (const char*)dep); - TString pal (_tot_dare.string("#.###.###.###.###")); - TString bal (_tot_avere.string("#.###.###.###.###")); + set_row(_i++, (const char*)dep); + + TString pal (_tot_dare.string(_extra_picture)); + TString bal (_tot_avere.string(_extra_picture)); //set_row(_i++, "@39gTOTALE@49g%r@107gTOTALE@117g%r", // &_tot_dare, &_tot_avere); set_row(_i++, "@39gTOTALE@47g%s@107gTOTALE@115g%s", (const char*)pal, (const char*)bal); - TString sb (sbilancio.string("#.###.###.###.###")); - TString pa (pareggio.string("#.###.###.###.###")); + TString sb (sbilancio.string(_extra_picture)); + TString pa (pareggio.string(_extra_picture)); if (_tot_dare > _tot_avere) { /* @@ -3680,8 +3694,8 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& set_row(_i++, (const char*)dep); set_row(_i++, (const char*)dep); set_row(_i++, (const char*)dep); - TString pal (_tot_dare.string("#.###.###.###.###")); - TString bal (_tot_avere.string("#.###.###.###.###")); + TString pal (_tot_dare.string(_extra_picture)); + TString bal (_tot_avere.string(_extra_picture)); set_row(_i++, "@39gTOTALE@47g%s@107gTOTALE@115g%s", (const char*)pal, (const char*)bal); /* @@ -3696,7 +3710,7 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& { //set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@117g%r", // &sbilprec); - TString sb (sbilprec.string("#.###.###.###.###")); + TString sb (sbilprec.string(_extra_picture)); set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@115g%s", (const char*)sb); } @@ -3705,8 +3719,8 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& &sbilancio); set_row(_i++, "@96gTOTALE A PAREGGIO@117g%r",&pareggio); */ - TString pal (sbilancio.string("#.###.###.###.###")); - TString bal (pareggio.string("#.###.###.###.###")); + TString pal (sbilancio.string(_extra_picture)); + TString bal (pareggio.string(_extra_picture)); set_row(_i++, "@85gSBILANCIO ESERCIZIO IN CORSO@115g%s", (const char*)pal); set_row(_i++, "@96gTOTALE A PAREGGIO@115g%s",(const char*)bal); @@ -3719,7 +3733,7 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& { //set_row(_i++, "@15gSBILANCIO ESERCIZIO PRECEDENTE@49g%r", // &sbilprec); - TString sb (sbilprec.string("#.###.###.###.###")); + TString sb (sbilprec.string(_extra_picture)); set_row(_i++, "@15gSBILANCIO ESERCIZIO PRECEDENTE@47g%s", (const char*)sb); } @@ -3728,8 +3742,8 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& &sbilancio); set_row(_i++, "@28gTOTALE A PAREGGIO@49g%r", &pareggio); */ - TString pal (sbilancio.string("#.###.###.###.###")); - TString bal (pareggio.string("#.###.###.###.###")); + TString pal (sbilancio.string(_extra_picture)); + TString bal (pareggio.string(_extra_picture)); set_row(_i++, "@17gSBILANCIO ESERCIZIO IN CORSO@47g%s", (const char*)pal); set_row(_i++, "@28gTOTALE A PAREGGIO@47g%s",(const char*)bal); @@ -3739,9 +3753,9 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& sbilprec = -sbilprec; if (sbilprec > ZERO) //va stampato sotto le passivita' { - TString pal (sbilprec.string("#.###.###.###.###")); + TString pal (sbilprec.string(_extra_picture)); pareggio = _tot_avere + sbilprec; - TString bal (pareggio.string("#.###.###.###.###")); + TString bal (pareggio.string(_extra_picture)); /* set_row(_i++, "@83gSBILANCIO ESERCIZIO PRECEDENTE@117g%r", &sbilprec); @@ -3755,8 +3769,8 @@ void TStampaBilanciCDC_application::stampa_totali_uno(const real& r1,const real& { sbilprec = -sbilprec; pareggio = _tot_dare + sbilprec; - TString pal (sbilprec.string("#.###.###.###.###")); - TString bal (pareggio.string("#.###.###.###.###")); + TString pal (sbilprec.string(_extra_picture)); + TString bal (pareggio.string(_extra_picture)); /* set_row(_i++, "@15gSBILANCIO ESERCIZIO PRECEDENTE@49g%r", &sbilprec); @@ -4154,6 +4168,7 @@ bool TStampaBilanciCDC_application::set_print(int) } } delete _prog; + //stampicchia print(); //return TRUE; @@ -4424,11 +4439,8 @@ void TStampaBilanciCDC_application::preprocess_header() int cgp1200 (int argc, char** argv) { - TStampaBilanciCDC_application a; - a.run(argc, argv, "Stampa bilanci"); - return 0; } diff --git a/cg/cgsaldac.cpp b/cg/cgsaldac.cpp index 7edc10895..41b30f0cb 100755 --- a/cg/cgsaldac.cpp +++ b/cg/cgsaldac.cpp @@ -748,7 +748,7 @@ bool TRiga_partite::in_valuta() const TImporto TRiga_partite::importo(bool valuta, int mode) const { CHECKD(mode > 0x0 && mode <= 0xF, "Bad importo mode ", mode); - const bool in_lire = !in_valuta(); + const bool in_lire = !in_valuta(); // Partita in lire if (valuta && in_lire) valuta = FALSE; @@ -780,11 +780,11 @@ TImporto TRiga_partite::importo(bool valuta, int mode) const TImporto abbuoni(get_char(PART_SEZABB), get_real(PART_ABBUONI)); if (!in_lire) // Converto in lire gli abbuoni che sono memorizzati in valuta { -// const real cambio(get(PART_CAMBIO)); + const real cambio(get(PART_CAMBIO)); // abbuoni.valore() *= cambio; // abbuoni.valore().round(); - TCurrency cur(abbuoni.valore(), "_FIRM"); - cur *= get_real(PART_CAMBIO); + TCurrency cur(abbuoni.valore(), codice_valuta(), cambio); + cur.change_to_firm_val(); abbuoni.valore() = cur.get_num(); } i += abbuoni; @@ -1012,7 +1012,7 @@ bool TPartita::read(const TBill& clifo, int year, const char* num) _anno = year; _num = num; - if (_conto.tipo() > ' ' && allineamento_corrente() > ' ') + if (allineamento_corrente() > ' ') { // Cerca la partita usando l'allineamento richiesto dall'utente if (!is_on_file()) diff --git a/cg/cgtrcpc.ini b/cg/cgtrcpc.ini index dbb5ea3c5..4703efb53 100755 --- a/cg/cgtrcpc.ini +++ b/cg/cgtrcpc.ini @@ -154,7 +154,7 @@ Z1|16|182|195|23|TOTDOC||| Z1|17|197|210|23|RITFIS||| Z1|18|212|225|23|RITSOC||| Z1|19|226|228|23|CODVALI||| -Z1|20|229|242|23|CAMBIOI|3|5| +Z1|20|229|242|23|CAMBIOI|3|6| Z1|21|244|257|23|CORRLIRE||| Z1|22|259|274|23|CORRVALUTA|3|3| Z1|23|275|290|23|OCFPI||| @@ -221,7 +221,7 @@ B1|22|168|181|28|IMPORTO||| B1|23|183|196|28|IMPOSTA||| B1|24|198|211|28|SPESE||| B1|25|212|214|28|CODVAL||| -B1|26|215|228|28|CAMBIO|3|5| +B1|26|215|228|28|CAMBIO|3|6| B1|27|230|245|28|IMPORTOVAL|3|3| B1|28|246|253|28|DATACAM|2|| B1|29|255|268|28|IMPTOTDOC|||