From f362b8f4343487de11274007a8ae6733842db41b Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 15 Jul 2010 06:42:48 +0000 Subject: [PATCH] Patch level : 10.0 patch 776 Files correlati : ca0.exe ca2.exe Ricompilazione Demo : [ ] Commento : MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 0001669: Aggiungere un conto di contabilità di default alle commesse Aggiungere un conto di contabilità di default alle commesse git-svn-id: svn://10.65.10.50/trunk@20665 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/ca0500.cpp | 28 +++++++++++++++++- ca/ca0500a.h | 6 ++++ ca/ca0500a.uml | 9 ++++++ ca/ca0600.cpp | 21 ++++++++++++++ ca/ca0600a.h | 6 ++++ ca/ca0600a.uml | 9 ++++++ ca/ca0700.cpp | 28 +++++++++++++++++- ca/ca0700a.h | 5 ++++ ca/ca0700a.uml | 6 ++-- ca/ca2100.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++-- ca/calib01.cpp | 4 ++- ca/cdc.h | 1 + ca/commesse.h | 2 ++ ca/f146.dir | 2 +- ca/f146.trr | 3 +- ca/f147.dir | 2 +- ca/f147.trr | 3 +- ca/f148.dir | 2 +- ca/f148.trr | 3 +- ca/fasi.h | 1 + 20 files changed, 205 insertions(+), 14 deletions(-) diff --git a/ca/ca0500.cpp b/ca/ca0500.cpp index fc2708a14..75c122b33 100755 --- a/ca/ca0500.cpp +++ b/ca/ca0500.cpp @@ -16,9 +16,35 @@ protected: virtual int get_logicnum() const { return LF_CDC; } public: - TCdC_anal_msk() { read("ca0500a"); } + TCdC_anal_msk(); }; +TCdC_anal_msk::TCdC_anal_msk() +{ + read("ca0500a"); + + const bool use_pdcc = ca_config().get_bool("UsePdcc"); + const int nfields = ca_create_fields(*this, 1, use_pdcc ? LF_PCON : LF_PCONANA, 2, 2, F_CDCPDA1, F_CDCDES1, 0x0, CDC_CODCONTO); + int from = 1; + + for (int i = 0; i < nfields; i++) + { + TEdit_field & e = efield(F_CDCPDA1 + i); + + e.check_type(CHECK_NORMAL); + TFieldref * fr = (TFieldref *) e.field(); + if (fr != NULL) + { + fr->set_from(from); + if (i < 2) + from += 3; + else + from += 6; + fr->set_to(from - 1); + } + } +} + //////////////////////////////////////////////////////////////////////// //APPLICAZIONE //////////////////////////////////////////////////////////////////////// diff --git a/ca/ca0500a.h b/ca/ca0500a.h index cc5438e2a..0a8824fe1 100755 --- a/ca/ca0500a.h +++ b/ca/ca0500a.h @@ -9,3 +9,9 @@ #define H_CDC_MAG 207 #define F_CDC_DEP 208 #define F_CDC_DESCDEP 209 + +#define F_CDCPDA1 601 +#define F_CDCPDA4 605 + +#define F_CDCDES1 701 +#define F_CDCDES4 705 diff --git a/ca/ca0500a.uml b/ca/ca0500a.uml index a014d1acf..233d45fdf 100755 --- a/ca/ca0500a.uml +++ b/ca/ca0500a.uml @@ -94,4 +94,13 @@ END ENDPAGE +PAGE "Pagina 2" 0 0 0 2 + +GROUPBOX DLG_NULL 78 6 +BEGIN + PROMPT 1 0 "@bConto analitico" +END + +ENDPAGE + ENDMASK \ No newline at end of file diff --git a/ca/ca0600.cpp b/ca/ca0600.cpp index 8987b6a32..17c0d5708 100755 --- a/ca/ca0600.cpp +++ b/ca/ca0600.cpp @@ -23,6 +23,27 @@ TCms_anal_msk::TCms_anal_msk() { read("ca0600a"); ca_create_fields(*this, 2, LF_CDC, 1, 1, F_CMS_CDC1, F_CMS_CDCDES1, 0x0, COMMESSE_CODCOSTO); + + const bool use_pdcc = ca_config().get_bool("UsePdcc"); + const int nfields = ca_create_fields(*this, 3, use_pdcc ? LF_PCON : LF_PCONANA, 2, 2, F_CMSPDA1, F_CMSDES1, 0x0, COMMESSE_CODCONTO); + int from = 1; + + for (int i = 0; i < nfields; i++) + { + TEdit_field & e = efield(F_CMSPDA1 + i); + + e.check_type(CHECK_NORMAL); + TFieldref * fr = (TFieldref *) e.field(); + if (fr != NULL) + { + fr->set_from(from); + if (i < 2) + from += 3; + else + from += 6; + fr->set_to(from - 1); + } + } } //////////////////////////////////////////////////////////////////////// diff --git a/ca/ca0600a.h b/ca/ca0600a.h index 9852f67a3..f070703aa 100755 --- a/ca/ca0600a.h +++ b/ca/ca0600a.h @@ -73,3 +73,9 @@ #define F_CMS_CDCDES2 406 #define F_CMS_CDCDES3 407 #define F_CMS_CDCDES4 408 + +#define F_CMSPDA1 601 +#define F_CMSPDA4 605 + +#define F_CMSDES1 701 +#define F_CMSDES4 705 diff --git a/ca/ca0600a.uml b/ca/ca0600a.uml index ee40740a1..a9e8cf233 100755 --- a/ca/ca0600a.uml +++ b/ca/ca0600a.uml @@ -587,4 +587,13 @@ END ENDPAGE +PAGE "Pagina 4" 0 0 0 2 + +GROUPBOX DLG_NULL 78 6 +BEGIN + PROMPT 1 0 "@bConto analitico" +END + +ENDPAGE + ENDMASK \ No newline at end of file diff --git a/ca/ca0700.cpp b/ca/ca0700.cpp index 4f50d079c..0f2dc1700 100755 --- a/ca/ca0700.cpp +++ b/ca/ca0700.cpp @@ -19,7 +19,7 @@ protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: - TFsc_anal_msk() { read("ca0700a"); } + TFsc_anal_msk(); }; bool TFsc_anal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly) @@ -33,6 +33,32 @@ bool TFsc_anal_msk::on_field_event(TOperable_field& o, TField_event e, long joll return TSimple_anal_msk::on_field_event(o, e, jolly); } +TFsc_anal_msk::TFsc_anal_msk() +{ + read("ca0700a"); + + const bool use_pdcc = ca_config().get_bool("UsePdcc"); + const int nfields = ca_create_fields(*this, 0, use_pdcc ? LF_PCON : LF_PCONANA, 2 + compute_offset(), 8, F_FSCPDA1, F_FSCDES1, 0x0, FASI_CODCONTO); + int from = 1; + + for (int i = 0; i < nfields; i++) + { + TEdit_field & e = efield(F_FSCPDA1 + i); + + e.check_type(CHECK_NORMAL); + TFieldref * fr = (TFieldref *) e.field(); + if (fr != NULL) + { + fr->set_from(from); + if (i < 2) + from += 3; + else + from += 6; + fr->set_to(from - 1); + } + } +} + //////////////////////////////////////////////////////////////////////// //APPLICAZIONE //////////////////////////////////////////////////////////////////////// diff --git a/ca/ca0700a.h b/ca/ca0700a.h index ade0441af..aef3ae8ce 100755 --- a/ca/ca0700a.h +++ b/ca/ca0700a.h @@ -1,3 +1,8 @@ //id maschera ca0700a(file fasi) //campi normali +#define F_FSCPDA1 601 +#define F_FSCPDA4 605 + +#define F_FSCDES1 701 +#define F_FSCDES4 705 \ No newline at end of file diff --git a/ca/ca0700a.uml b/ca/ca0700a.uml index e092e29db..029193982 100755 --- a/ca/ca0700a.uml +++ b/ca/ca0700a.uml @@ -6,11 +6,11 @@ TOOLBAR "topbar" 0 0 0 2 ENDPAGE -PAGE "Fasi" 0 0 0 2 +PAGE "FASI" 0 0 0 2 -GROUPBOX DLG_NULL 77 7 +GROUPBOX DLG_NULL 78 6 BEGIN - PROMPT 1 0 "@bCodici" + PROMPT 1 7 "@bConto analitico" END ENDPAGE diff --git a/ca/ca2100.cpp b/ca/ca2100.cpp index 9073954c6..9d79b6e72 100755 --- a/ca/ca2100.cpp +++ b/ca/ca2100.cpp @@ -14,7 +14,9 @@ #include "rmovana.h" #include "rrip.h" #include "saldana.h" +#include "cdc.h" #include "commesse.h" +#include "fasi.h" class TMovanal_msk : public TAutomask @@ -25,6 +27,9 @@ class TMovanal_msk : public TAutomask short _cms_end; short _cdc_start; short _cdc_end; + short _pcon_start; + short _pcon_end; + TCache_ripartizioni _cache_rip; @@ -34,6 +39,7 @@ protected: virtual bool on_key(KEY key); const TToken_string& rec2key(const TRectype& rec) const; + void completa_conto(int r); void aggiorna_saldo_riga(int r); // Lettura movimento contabile @@ -514,6 +520,32 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly aggiorna_saldo_riga(r); } + if (e == se_notify_modify) + { + TSheet_field & s = sfield(F_RIGHE); + TMask & m = s.sheet_mask(); + const int r = int(jolly); + + completa_conto(r); + s.update_mask(r); + const bool pdc_req = ca_config().get_bool("PdciRequired"); + if (pdc_req) + { + for (short id = _pcon_start; id < _pcon_end; id++) + { + TEdit_field & e = m.efield(id); + + e.check_type(CHECK_REQUIRED); + e.set_dirty(); + + const bool ok = e.check(); + + e.check_type(CHECK_NORMAL); + if (!ok) + return error_box("Manca il conto analitico"); + } + } + } if (e == se_query_modify) { TSheet_field & s = sfield(F_RIGHE); @@ -807,6 +839,47 @@ TImporto& TMovanal_msk::saldo(const TRectype& rec) return *imp; } +void TMovanal_msk::completa_conto(int r) +{ + TRectype rec(LF_RMOVANA); + row2rec(r, rec); + TString conto = rec.get(RMOVANA_CODCONTO); + + if (conto.blank()) + { + TToken_string key; + const TString4 livsup = ca_config().get("FathFasi"); + + if (livsup.blank()) + key.add(""); + else + if (livsup == "CDC") + key.add(rec.get(RMOVANA_CODCCOSTO)); + else + key.add(rec.get(RMOVANA_CODCMS)); + key.add(rec.get(RMOVANA_CODFASE)); + conto = cache().get(LF_FASI, key, FASI_CODCONTO); + if (conto.blank()) + { + for (int i = 2; conto.blank()&& i > 0; i--) + { + const TString4 level = ca_config().get("Level", NULL, i); + + if (level == "CMS") + conto = cache().get(LF_COMMESSE, rec.get(RMOVANA_CODCMS), COMMESSE_CODCONTO); + else + if (level == "CDC") + conto = cache().get(LF_CDC, rec.get(RMOVANA_CODCCOSTO), CDC_CODCONTO); + } + } + if (conto.full()) + { + rec.put(RMOVANA_CODCONTO, conto); + rec2row(rec, r); + } + } +} + void TMovanal_msk::aggiorna_saldo_riga(int r) { TRectype rec(LF_RMOVANA); @@ -946,8 +1019,9 @@ void TMovanal_msk::create_sheet() create_sheet_fields(LF_FASI, y, dlg, fsc_req); _use_pdc = ini.get_bool("UsePdcc"); - const bool pdc_req = ini.get_bool("PdciRequired"); - create_sheet_fields(_use_pdc ? LF_PCON : LF_PCONANA, y, dlg, pdc_req); + _pcon_start = dlg; + create_sheet_fields(_use_pdc ? LF_PCON : LF_PCONANA, y, dlg, false); + _pcon_end = dlg; for (short id = S_CON4+100; id >= S_CDC1+100; id--) { diff --git a/ca/calib01.cpp b/ca/calib01.cpp index a79688635..f1fd93e15 100755 --- a/ca/calib01.cpp +++ b/ca/calib01.cpp @@ -635,7 +635,9 @@ int ca_create_fields(TMask& msk, int page, int logicnum, int x, int y, if (fieldname && *fieldname) { const TFieldref& fr = *kfld->field(); - TString80 str; str.format("%s[%d,%d]", fieldname, fr.from()+from+1, fr.to()+from); + + TString80 str; + str.format("%s[%d,%d]", fieldname, fr.from()+from+1, fr.to()+from); kfld->set_field(str); } } diff --git a/ca/cdc.h b/ca/cdc.h index e38c0bad6..56af7e660 100755 --- a/ca/cdc.h +++ b/ca/cdc.h @@ -7,5 +7,6 @@ #define CDC_ADDETTI "ADDETTI" #define CDC_GESTFASI "GESTFASI" #define CDC_APPOGGIO "APPOGGIO" +#define CDC_CODCONTO "CODCONTO" #endif \ No newline at end of file diff --git a/ca/commesse.h b/ca/commesse.h index bf01f6ff9..5be25a3bf 100755 --- a/ca/commesse.h +++ b/ca/commesse.h @@ -54,6 +54,8 @@ #define COMMESSE_CODMAG "CODMAG" #define COMMESSE_CODCOSTO "CODCOSTO" #define COMMESSE_INDETR "INDETR" +#define COMMESSE_CODCONTO "CODCONTO" + #endif diff --git a/ca/f146.dir b/ca/f146.dir index b00937354..eebea0175 100755 --- a/ca/f146.dir +++ b/ca/f146.dir @@ -1,3 +1,3 @@ 146 0 -$cdc|0|0|93|0|Archivio Centri di Costo||| +$cdc|||113|0|Archivio Centri di Costo||| diff --git a/ca/f146.trr b/ca/f146.trr index 791f7c253..53d46f4fd 100755 --- a/ca/f146.trr +++ b/ca/f146.trr @@ -1,5 +1,5 @@ 146 -7 +8 CODCOSTO|1|20|0|Codice Centro di Costo DESCRIZ|1|50|0|Descrizione DESCRAGG|11|10|0|Descrizione aggiuntiva @@ -7,6 +7,7 @@ ADDETTI|1|5|0|Numero Addetti GESTFASI|8|1|0|Gestione Fasi APPOGGIO|8|1|0|Centro di costo di appoggio CODMAG|1|5|0|Codice magazzino e deposito +CODCONTO|1|20|0|Codice Conto analitico 2 CODCOSTO| UPPER(DESCRIZ)|X diff --git a/ca/f147.dir b/ca/f147.dir index 256ce7625..c347a4124 100755 --- a/ca/f147.dir +++ b/ca/f147.dir @@ -1,3 +1,3 @@ 147 0 -$commesse|||446|0|Archivio Commesse||| +$commesse|||466|0|Archivio Commesse||| diff --git a/ca/f147.trr b/ca/f147.trr index 4d274e838..45c18356a 100755 --- a/ca/f147.trr +++ b/ca/f147.trr @@ -1,5 +1,5 @@ 147 -53 +54 CODCMS|1|20|0|Codice Commessa DESCRIZ|1|50|0|Descrizione DESCRAGG|11|10|0|Descrizione aggiuntiva @@ -53,6 +53,7 @@ SALMIN|1|20|0|Modalit CODMAG|1|5|0|Codice magazzino e deposito CODCOSTO|1|20|0|Codice Centro di Costo INDETR|1|1|0|Codice intetraibilita' IVA +CODCONTO|1|20|0|Codice Conto analitico 2 CODCMS| UPPER(DESCRIZ)|X diff --git a/ca/f148.dir b/ca/f148.dir index 24d9f3a55..08f308b1a 100755 --- a/ca/f148.dir +++ b/ca/f148.dir @@ -1,3 +1,3 @@ 148 0 -$fasi|11|11|105|0|Archivio Fasi||| +$fasi|||125|0|Archivio Fasi||| diff --git a/ca/f148.trr b/ca/f148.trr index eaa42600c..fa63e30cb 100755 --- a/ca/f148.trr +++ b/ca/f148.trr @@ -1,11 +1,12 @@ 148 -6 +7 CODCMSFAS|1|20|0|Codice Centro di Costo/ Commessa CODFASE|1|10|0|Codice Fase DESCRIZ|1|50|0|Descrizione DATAINIZIO|5|8|0|Data inizio DATAFINE|5|8|0|Data fine DATAPROR|5|8|0|Data proroga +CODCONTO|1|20|0|Codice Conto analitico 2 CODCMSFAS+CODFASE| UPPER(DESCRIZ)|X diff --git a/ca/fasi.h b/ca/fasi.h index 69b54fa42..53835dba5 100755 --- a/ca/fasi.h +++ b/ca/fasi.h @@ -7,5 +7,6 @@ #define FASI_DATAINIZIO "DATAINIZIO" #define FASI_DATAFINE "DATAFINE" #define FASI_DATAPROR "DATAPROR" +#define FASI_CODCONTO "CODCONTO" #endif