diff --git a/crpa/crpa.ini b/crpa/crpa.ini index 00a7711ab..f04690530 100755 --- a/crpa/crpa.ini +++ b/crpa/crpa.ini @@ -4,7 +4,7 @@ Password=pmc Connect=zen1 Run= -[23] +[107] TABLE=AGA_PRJDOC_T146_P UNICO= ARCH=!_FIRM,_MOV @@ -18,11 +18,11 @@ NUMDOCFIS=NUMDOC DTADOCFIS=!_D,DATADOC DTAPERT=!_D,DATACOMP AZIENDA=!_FIRM -TIPANA=TIPOCF -CODCF=CODCF +TIPANA=23->TIPOCF +CODCF=23->CODCF CODVAL=!_CODVAL -[24] +[108] TABLE=AGA_PRJDET_T147_P UNICO= ARCH=!_FIRM,_MOV @@ -37,7 +37,7 @@ IMPVAL=IMPORTO NUMCOMM=CODCMS CODATTCM= ELSPESA=!_ELSPESAMOV -CENTCOST=FASCMS +CENTCOST=CODFASE DTACONS= RIFRICH= RIFORD= diff --git a/crpa/crpa0.cpp b/crpa/crpa0.cpp index 4d89478a8..f7af05788 100755 --- a/crpa/crpa0.cpp +++ b/crpa/crpa0.cpp @@ -87,7 +87,7 @@ bool TIni2Sql::create() _inputfilename.ltrim(2); if (_inputfilename.exist()) { - open_files(LF_MOV, LF_RMOV, LF_RMOVIVA, LF_DOC, LF_RIGHEDOC, LF_CLIFO, LF_PCON, LF_ABPCON, LF_CFVEN, LF_TABCOM, LF_TAB, 0); + open_files(LF_MOV, LF_RMOV, LF_RMOVIVA, LF_DOC, LF_RIGHEDOC, LF_MOVANA, LF_RMOVANA, LF_CLIFO, LF_PCON, LF_ABPCON, LF_CFVEN, LF_TABCOM, LF_TAB, 0); _inputfile = new TConfig(_inputfilename); _configfile = new TConfig("crpa.ini"); _sqlfile = NULL; @@ -260,7 +260,7 @@ bool TIni2Sql::search_costo_ricavo(TBill& conto, const TRiga_documento& r) const char t = r.tipo().tipo(); // Istanzia la causale del documento corrente... - const TTipo_documento& tipo = _doc->tipo(); + const TTipo_documento& tipo = _doc->tipo(); // deve diventare tipo_riclassificato() TString16 codcaus(tipo.causale()); TToken_string key; @@ -535,7 +535,7 @@ void TIni2Sql::validate(const TString& elabfield, TString& str) str.format("%02ld%s", _firm, (const char*) tmpstr); } else if (code == "_UNICMOV") // campo UNICARCH nel caso di movimenti - str.format("%s-%s-%ld", (const char*) _inputfile->get("CODCAUS","23"), (const char*) _inputfile->get("ANNOES", "23"), _inputfile->get_long("NUMREG", "23")); + str.format("%s-%s-%ld", (const char*) _inputfile->get("CODCAUS","107"), (const char*) _inputfile->get("ANNOES", "107"), _inputfile->get_long("NUMREG", "107")); else if (code == "_UNICDOC") // campo UNICARCH nel caso di documenti str.format("%s-%s-%s", (const char*) _inputfile->get("CODNUM", "33"), (const char*) _inputfile->get("ANNO", "33"), (const char*) _inputfile->get("NDOC", "33")); else if (code == "_CODVAL") // campo codice valuta @@ -553,9 +553,10 @@ void TIni2Sql::validate(const TString& elabfield, TString& str) TToken_string key; if (code == "_ELSPESAMOV") // per righe movimenti { - key = _inputfile->get("GRUPPO"); - key.add(_inputfile->get("CONTO")); - key.add(_inputfile->get("SOTTOCONTO")); + key = _inputfile->get("CODCOSTO", "108"); + //key = _inputfile->get("GRUPPO"); + //key.add(_inputfile->get("CONTO")); + //key.add(_inputfile->get("SOTTOCONTO")); } else // per righe documenti key.format("%d|%d|%ld", _conto.gruppo(), _conto.conto(), _conto.sottoconto()); @@ -571,7 +572,7 @@ void TIni2Sql::validate(const TString& elabfield, TString& str) else if (code == "_DESRMOV") // campo DESART per righe movimenti { process_field("DESCR", tmpstr, -1, FALSE); - str.format("%s-%s", (const char*) _inputfile->get("CODCAUS","23"), (const char*) tmpstr); + str.format("%s-%s", (const char*) _inputfile->get("CODCAUS","107"), (const char*) tmpstr); } else if (code == "_DESMOV") // campo DESART per movimenti { @@ -579,12 +580,17 @@ void TIni2Sql::validate(const TString& elabfield, TString& str) str.format("%s (%s)", (const char*) tmpstr, (const char*) _inputfile->get("PROTIVA")); } else if (code == "_CODART") // campo CODART per movimenti - str.format("%s-%s-%s", (const char*) _inputfile->get("GRUPPO"), (const char*) _inputfile->get("CONTO"), (const char*) _inputfile->get("SOTTOCONTO")); + str = _inputfile->get("CODCOSTO", "108"); + //str.format("%s-%s-%s", (const char*) _inputfile->get("GRUPPO"), (const char*) _inputfile->get("CONTO"), (const char*) _inputfile->get("SOTTOCONTO")); else if (code == "_IMPORTORMOV") // campo importo per righe movimenti { real importo(_inputfile->get("IMPORTO")); - const int gruppo = atoi(_inputfile->get("GRUPPO")); - const int conto = atoi(_inputfile->get("CONTO")); + //const int gruppo = atoi(_inputfile->get("GRUPPO")); + //const int conto = atoi(_inputfile->get("CONTO")); + TString80 codcosto; + codcosto = _inputfile->get("CODCOSTO"); + const int gruppo = atoi(codcosto.sub(0,3)); + const int conto = atoi(codcosto.sub(3,3)); str = _inputfile->get("SEZIONE"); const char sezione = str[0]; if (test_swap_conto(gruppo, conto, sezione)) @@ -593,8 +599,12 @@ void TIni2Sql::validate(const TString& elabfield, TString& str) } else if (code == "_SEZIONERMOV") // campo sezione per righe movimenti { - const int gruppo = atoi(_inputfile->get("GRUPPO")); - const int conto = atoi(_inputfile->get("CONTO")); + //const int gruppo = atoi(_inputfile->get("GRUPPO")); + //const int conto = atoi(_inputfile->get("CONTO")); + TString80 codcosto; + codcosto = _inputfile->get("CODCOSTO"); + const int gruppo = atoi(codcosto.sub(0,3)); + const int conto = atoi(codcosto.sub(3,3)); str = _inputfile->get("SEZIONE"); const char sezione = str[0]; if (test_swap_conto(gruppo, conto, sezione)) @@ -1024,8 +1034,8 @@ void TIni2Sql::write_sqldelete() condizione.cut(0); if ( - (numpar == 23 || numpar == 33) || // Inizialmente era richiesto di cancellare solo le testate ... - ((numpar == 24 || numpar == 34) && numrig == 1) // ... ovviamente ora non pił + (numpar == 107 || numpar == 33) || // Inizialmente era richiesto di cancellare solo le testate ... + ((numpar == 108 || numpar == 34) && numrig == 1) // ... ovviamente ora non pił ) { cancella.format("DELETE FROM %s", (const char*) _configfile->get("TABLE", strpar));