diff --git a/tc/tc9300.cpp b/tc/tc9300.cpp index c122a14e2..4415707d1 100755 --- a/tc/tc9300.cpp +++ b/tc/tc9300.cpp @@ -45,6 +45,8 @@ public: const TString & sdecode_caureg(const TString& cod); const TString & sdecode_caugiro(const TString& cod); const TString & sdecode_contov(const TString& cod); + const TString & sdecode_caucon(const TString& cod); + const TString & sdecode_sezcon(const TString& cod); bool sdecode_rc(const TString& cod); TRiclassifica_cache() : _multirel(LF_MULTIREL) { _multirel.setkey(2);} }; @@ -158,6 +160,48 @@ const TString & TRiclassifica_cache::sdecode_caugiro(const TString& cod) return codricl; } +const TString & TRiclassifica_cache::sdecode_caucon(const TString& cod) +{ + TString & codricl = get_tmp_string(); + TToken_string tok; + + tok.add("SCCAU"); + tok.add(cod); + const TString* ric = (const TString*) objptr(tok); + if (ric && *ric) + { + _multirel.setkey(1); + _multirel.put(MULTI_COD, "SCCAU"); + _multirel.put(MULTI_FIRST, cod); + _multirel.put(MULTI_SECOND, *ric); + int err = _multirel.read(_isequal); + if (err == NOERR) + codricl = _multirel.get(MULTI_DATA).smid(28, 5); + } + return codricl; +} + +const TString & TRiclassifica_cache::sdecode_sezcon(const TString& cod) +{ + TString & codricl = get_tmp_string(); + TToken_string tok; + + tok.add("SCCAU"); + tok.add(cod); + const TString* ric = (const TString*) objptr(tok); + if (ric && *ric) + { + _multirel.setkey(1); + _multirel.put(MULTI_COD, "SCCAU"); + _multirel.put(MULTI_FIRST, cod); + _multirel.put(MULTI_SECOND, *ric); + int err = _multirel.read(_isequal); + if (err == NOERR) + codricl = _multirel.get(MULTI_DATA).smid(33, 1); + } + return codricl; +} + const TString & TRiclassifica_cache::sdecode_contov(const TString& cod) { TString & codricl = get_tmp_string(); @@ -717,6 +761,8 @@ protected: const TString & scod2ricl(const char* tab, const TVariant& cod); const TString & scod2caureg(const TString& cod); const TString & scod2caugiro(const TString& cod); + const TString & scod2caucon(const TString& cod); + const TString & scod2sezcon(const TString& cod); const TString & scod2contov(const TString& cod); bool scod2rc(const TString& cod); const long cod2ricl(const char* tab, const TString& cod); @@ -744,7 +790,6 @@ const TString & TInvioSispac::scod2ricl(const char* tab, const TString& cod) } const TString & TInvioSispac::scod2caucf(const TString& cod) { - if (cod.full()) return _tabelle->sdecode_caufor(cod); return EMPTY_STRING; @@ -768,6 +813,25 @@ const TString & TInvioSispac::scod2caugiro(const TString& cod) return codricl; } +const TString & TInvioSispac::scod2caucon(const TString& cod) +{ + TString & codricl = get_tmp_string(); + + if (cod.full()) + codricl = _tabelle->sdecode_caucon(cod); + return codricl; +} + + +const TString & TInvioSispac::scod2sezcon(const TString& cod) +{ + TString & codricl = get_tmp_string(); + + if (cod.full()) + codricl = _tabelle->sdecode_sezcon(cod); + return codricl; +} + const TString & TInvioSispac::scod2contov(const TString& cod) { @@ -1266,6 +1330,7 @@ void TInvioSispac::sispac_movim() for (bool ok = input.move_first(); ok ; ok = input.move_next()) { long nmov =input.get(RMV_NUMREG).as_int(); + TString4 sezione(input.get(RMV_SEZIONE).as_string()); if (nmov != lastmov) { @@ -1289,7 +1354,7 @@ void TInvioSispac::sispac_movim() rdare = 0; ravere = 0; } - if (input.get(RMV_SEZIONE).as_string() == "D") + if (sezione == "D") rdare++; else ravere++; @@ -1320,6 +1385,7 @@ void TInvioSispac::sispac_movim() const long numreg = input.get(RMV_NUMREG).as_int(); const TDate datareg(input.get(SLF_MOV "." MOV_DATAREG).as_date()); const bool comp = codes != esc.date2esc(datareg); + TString4 sezione(input.get(RMV_SEZIONE).as_string()); if (numregrev < 0L && scod2rc(ccaus)) numregrev = numreg; @@ -1412,13 +1478,21 @@ void TInvioSispac::sispac_movim() TString8 codcaus = scod2ricl("SCCAU", ccaus); const TString4 tipocf = input.get(RMV_TIPOC).as_string(); + const TString8 codcauscf = scod2caucf(ccaus); + const TString8 codcauscon = scod2caucon(ccaus); + const TString4 sezcon = scod2sezcon(ccaus); if (tipocf == "C" || tipocf == "F") { - const TString8 codcauscf = scod2caucf(ccaus); if (codcauscf.full()) codcaus = codcauscf; + else + if (sezcon == sezione && codcauscon.full()) + codcaus = codcauscon; } + else + if (sezcon == sezione && codcauscon.full()) + codcaus = codcauscon; var = "R"; if (codcaus == "00255") var = "S"; diff --git a/tc/tcsc.h b/tc/tcsc.h index 0c9a81f1c..12d86935e 100755 --- a/tc/tcsc.h +++ b/tc/tcsc.h @@ -8,3 +8,5 @@ #define F_COD_CAUSRG 108 #define F_COD_CAUSGC 109 #define F_COD_CONTOV 110 +#define F_COD_CAUSCO 111 +#define F_COD_SEZCO 112 diff --git a/tc/tcsccau.uml b/tc/tcsccau.uml index c7dc6618a..f787bcb44 100755 --- a/tc/tcsccau.uml +++ b/tc/tcsccau.uml @@ -124,9 +124,25 @@ BEGIN GROUP 5 END +NUMBER F_COD_CAUSCO 5 +BEGIN + PROMPT 2 14 "Causale Sispac Contropar." + FIELD DATA[29,33] + FLAGS "Z" +END + +LIST F_COD_SEZCO 5 +BEGIN + PROMPT 40 14 "Sezione " + FIELD DATA[34,34] + ITEM "|" + ITEM "A|Avere" + ITEM "D|Dare" +END + NUMBER F_COD_CONTOV 12 BEGIN - PROMPT 2 13 "Conto Sispac Vendite " + PROMPT 2 16 "Conto Sispac Vendite " FIELD DATA[17,28] FLAGS "Z" GROUP 5