diff --git a/tc/tc9300.cpp b/tc/tc9300.cpp index d27979896..d21a5a861 100755 --- a/tc/tc9300.cpp +++ b/tc/tc9300.cpp @@ -307,6 +307,7 @@ class TSISPAC_set : public TAS400_recordset { protected: void add_field(const char* name = "Filler", int from = -1, int len = 0, TFieldtypes t = _alfafld, const char* def = NULL); + virtual bool set_field(const TAS400_column_info& fi, const TVariant& var); public: TSISPAC_set(const char* header) : TAS400_recordset(header) {} @@ -342,6 +343,19 @@ void TSISPAC_set::add_field(const char* name, int from, int len, TFieldtypes t, create_field(fname, pos, len, t, required); } +bool TSISPAC_set::set_field(const TAS400_column_info& fi, const TVariant& var) +{ + if (var.is_date() && (fi._type == _intzerofld || fi._type == _longzerofld) && + (fi._width == 6 || fi._width == 8)) + { + long d = var.as_int(); + if (d && fi._width == 6) + d %= 1000000; + return TAS400_recordset::set_field(fi, d); + } + return TAS400_recordset::set_field(fi, var); +} + /////////////////////////////////////////////////////////// // TMovim_set /////////////////////////////////////////////////////////// @@ -592,7 +606,7 @@ TMovpart_set::TMovpart_set() : TSISPAC_set("AS400(322)") create_field("ARGOMENTO", -1, 1, _longzerofld); create_field("NUMPART", -1, 7, _longzerofld); create_field("NUMINT", -1, 3, _longzerofld); - create_field("DATAOP", -1, 8, _datefld); + create_field("DATAOP", -1, 8, _longzerofld); create_field("CODSCONT", -1, 6, _alfafld); create_field("CODCLIFO", -1, 6, _alfafld); create_field("TIPOREG", -1, 2, _longzerofld); @@ -605,7 +619,7 @@ TMovpart_set::TMovpart_set() : TSISPAC_set("AS400(322)") create_field("TIPOMOV", -1, 1, _alfafld); create_field("CODCAUS", -1, 5, _longzerofld); create_field("CODPAG", -1, 6, _alfafld); - create_field("DATASCAD", -1, 8, _datefld); + create_field("DATASCAD", -1, 8, _longzerofld); create_field("IMPTMOV", -1, 12, _longzerofld); create_field("SGNIMPT", -1, 1, _alfafld); create_field("CODAG", -1, 3, _alfafld); @@ -638,37 +652,37 @@ public: TMovanal_set::TMovanal_set() : TSISPAC_set("AS400(351)") { - create_field("COFI", -1, 16, _alfafld); - create_field("PAIV", -1, 11, _alfafld); - create_field("RAGSOC", -1, 50, _alfafld); - create_field("ESCOGE", -1, 4, _intzerofld); - create_field("NUMPART", -1, 7, _longzerofld); - create_field("NUMINT", -1, 3, _intzerofld); - create_field("PROGINT", -1, 3, _intzerofld); - create_field("DATAOP", -1, 8, _datefld); + create_field("COFI", -1, 16, _alfafld); // 1 + create_field("PAIV", -1, 11, _alfafld); // 17 + create_field("RAGSOC", -1, 50, _alfafld); // 28 + create_field("ESCOGE", -1, 4, _intzerofld); // 78 + create_field("NUMPART", -1, 7, _longzerofld); // 82 + create_field("NUMINT", -1, 3, _intzerofld); // 89 + create_field("PROGINT", -1, 3, _intzerofld); // 92 + create_field("DATAOP", -1, 8, _longzerofld); // 95 - create_field("CODCONTO", -1, 6, _alfafld); - create_field("SGNCONTIMP", -1, 1, _alfafld); - create_field("IMPORTO", -1, 12, _longzerofld); - create_field("SGNIMPT", -1, 1, _alfafld); + create_field("CODCONTO", -1, 6, _alfafld); // 103 + create_field("SGNCONTIMP", -1, 1, _alfafld); // 109 + create_field("IMPORTO", -1, 12, _longzerofld); // 110 + create_field("SGNIMPT", -1, 1, _alfafld); // 122 - create_field("PERC", -1, 5, _intzerofld); - create_field("ANNO", -1, 4, _intzerofld); - create_field("CODCAUS", -1, 5, _longzerofld); - create_field("NUMDOC", -1, 7, _alfafld); - create_field("DATADOC", -1, 8, _datefld); - create_field("NUMPROT", -1, 7, _longzerofld); - create_field("CDCCONT", -1, 6, _alfafld); + create_field("PERC", -1, 5, _intzerofld); // 123 + create_field("ANNO", -1, 4, _intzerofld); // 128 + create_field("CODCAUS", -1, 5, _longzerofld); // 132 + create_field("NUMDOC", -1, 7, _alfafld); // 137 + create_field("DATADOC", -1, 8, _longzerofld); // 144 + create_field("NUMPROT", -1, 7, _longzerofld); // 152 + create_field("CDCCONT", -1, 6, _alfafld); // 159 - create_field("COFIANAL", -1, 16, _alfafld); - create_field("PAIVANAL", -1, 11, _alfafld); - create_field("RAGSOCANAL", -1, 50, _alfafld); - create_field("NOTEANAL", -1, 50, _alfafld); - create_field("DATAOPANAL", -1, 8, _datefld); - create_field("DATAFIANAL", -1, 8, _datefld); - create_field("PDC", -1, 9, _alfafld); - create_field("CDC1", -1, 9, _alfafld); - create_field("CDC2", -1, 9, _alfafld); + create_field("COFIANAL", -1, 16, _alfafld); // 165 + create_field("PAIVANAL", -1, 11, _alfafld); // 181 + create_field("RAGSOCANAL", -1, 50, _alfafld); // 192 + create_field("NOTEANAL", -1, 50, _alfafld); // 242 + create_field("DATAOPANAL", -1, 8, _longzerofld); // 292 + create_field("DATAFIANAL", -1, 8, _longzerofld); // 300 + create_field("PDC", -1, 9, _alfafld); // 308 + create_field("CDC1", -1, 9, _alfafld); // 317 + create_field("CDC2", -1, 9, _alfafld); // 326 //create_field("LIBERO", -1, 15, _alfafld); create_field("FINEREC", 349, 2, _alfafld, true,"\r\n"); @@ -1452,8 +1466,8 @@ void TInvioSispac::sispac_movim() recset.set("NUMINT", var); recset.set("DATAOP", datareg.string(brief, '\0', full, full, amg_date)); - const TString16 codice = bill2code(input); - recset.set("CODCONTO", codice); + const TString16 codconto = bill2code(input); + recset.set("CODCONTO", codconto); recset.set("TIPOREG", treg); recset.set("CODREG", reg.right(2)); // in futuro campo su registro const long prot = input.get(SLF_MOV "." MOV_PROTIVA).as_int(); @@ -1551,20 +1565,21 @@ void TInvioSispac::sispac_movim() analset.set("NUMPART", recset.get("NUMPART")); analset.set("NUMINT", recset.get("NUMINT")); analset.set("PROGINT", "001"); - analset.set("DATAOP", recset.get("DATAOP")); + analset.set("DATAOP", datareg); analset.set("CODCONTO", recset.get("CODCONTO")); analset.set("SGNCONTIMP", recset.get("SGNCONTIMP")); analset.set("IMPORTO", recset.get("IMPORTO")); analset.set("SGNIMPT", recset.get("SGNIMPT")); analset.set("PERC", "10000"); - analset.set("ANNO", input.get(MOV_ANNOIVA)); + analset.set("ANNO", (long)datareg.year()); analset.set("CODCAUS", recset.get("CODCAUS")); analset.set("NUMDOC", recset.get("NUMDOC")); - analset.set("DATADOC", recset.get("DATADOC")); + analset.set("DATADOC", datadoc); analset.set("NUMPROT", recset.get("NUMPROT")); analset.set("CDCCONT", cdc); // Centro di costo contabile - analset.set("DATAOPANAL", recset.get("DATAOP")); - analset.set("CDC", recset.get("CODCONTO")); // Conto analitico = conto contabile + analset.set("DATAOPANAL", datareg); + analset.set("DATAFIANAL", "00000000"); // Come da mail del 01-10-2012 + analset.set("PDC", recset.get("CODCONTO")); // Conto analitico = conto contabile analset.set("CDC1", cms); // Centro di costo analitico analset.set("FINEREC", "\r\n"); }