From 16ee7506d445dd3f1b6f64236f51cd1469feaa5b Mon Sep 17 00:00:00 2001 From: luca Date: Mon, 10 Jul 2006 13:27:22 +0000 Subject: [PATCH] Patch level :4.0 nopatch Files correlati : Ricompilazione Demo : [ ] Commento :stampa bilancio di commessa; commit di sicurezza;comincia a stampare le commesse in modo "umano" git-svn-id: svn://10.65.10.50/trunk@14140 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/ca3800.cpp | 122 ++++++++++++++++++++++++++++++++++++++----------- ca/ca3800.h | 10 ++++ ca/ca3800.uml | 21 +++++++-- ca/ca3800a.rep | 5 +- 4 files changed, 123 insertions(+), 35 deletions(-) diff --git a/ca/ca3800.cpp b/ca/ca3800.cpp index 8d71b004f..4c975970b 100755 --- a/ca/ca3800.cpp +++ b/ca/ca3800.cpp @@ -11,6 +11,7 @@ #include "calib02.h" #include "commesse.h" #include "panapdc.h" +#include "pconana.h" #include "saldana.h" //////////////////////////////////////////////////////// @@ -92,6 +93,46 @@ bool TPrint_bilancio_cms_mask::on_field_event(TOperable_field& o, TField_event e TPrint_bilancio_cms_mask::TPrint_bilancio_cms_mask() :TAnal_report_mask("ca3800") { + TConfig& cfg = ca_config(); + const bool use_pdcc = cfg.get_bool("UsePdcc"); + + const TMultilevel_code_info& pconana_info = ca_multilevel_code_info(LF_PCONANA); + const int pconana_levels = pconana_info.levels(); + + int prefix = cfg.get_int("PdcPrefix"); + if (prefix >= pconana_levels) + prefix = pconana_levels-1; + + // Controllo se voglio (e posso) usare il conto analitico come prefisso di quello contabile + if (use_pdcc && prefix > 0) + { + const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA); + const int levels = info.levels(); + if (levels >= 2 && prefix < levels && esistono_riclassificazioni()) + { + ca_create_fields(*this, 0, LF_PCONANA, 1, 13, F_PRE1, F_PREDES1, 0x0, PCONANA_CODCONTO); + + // Nascondi i campi che non fanno parte del prefisso + for (int i = 0; i < levels; i++) + { + if (i < prefix) + { + field(F_PRE1 + i).check_type(CHECK_REQUIRED); + field(F_PRE1 + i).set_group(6); + field(F_PREDES1 + i).set_group(6); + } + else + { + field(F_PRE1 + i).hide(); + field(F_PREDES1 + i).hide(); + } + } + } + } + + // setta gli handlers a tutti i campi generati della maschera;senza questa chiamata la on_field_event + // non puo' funzionare sui campi generati!!! + set_handlers(); } /////////////////////////////////////////////////////////////// @@ -100,12 +141,14 @@ TPrint_bilancio_cms_mask::TPrint_bilancio_cms_mask() class TIndbil_cache : public TCache { bool _usepdcc; + TString80 _prefix; protected: virtual TObject* key2obj(const char* key); public: int get_indbil(const TString& conto); + void set_prefix(const char* prefix); TIndbil_cache(); }; @@ -130,10 +173,25 @@ TObject* TIndbil_cache::key2obj(const char* key) panapdrec.put(PANAPDC_CONTO, co); if (i == 2) panapdrec.put(PANAPDC_SOTTOCONTO, so); - if (panapdc.read() == NOERR) + + //occhio al prefisso! + panapdrec.put(PANAPDC_CODCONTO, _prefix); + + if (panapdc.read(_isgteq) == NOERR) { - conto = panapdrec.get(PANAPDC_CODCONTO); - break; + bool found = panapdrec.get_int(PANAPDC_GRUPPO) == gr; + if (found) + found = panapdrec.get_int(PANAPDC_CONTO) == (i > 0 ? co : 0); + if (found) + found = panapdrec.get_long(PANAPDC_SOTTOCONTO) == (i > 1 ? so : 0L); + if (found && _prefix.full()) + found = panapdrec.get(PANAPDC_CODCONTO).starts_with(_prefix); + + if (found) + { + conto = panapdrec.get(PANAPDC_CODCONTO); + break; + } } } //se non trova il corrispondente conto analitico azzera il conto per il prossimo giro @@ -154,6 +212,15 @@ int TIndbil_cache::get_indbil(const TString& conto) return ib ? atoi(*ib) : 0; } +void TIndbil_cache::set_prefix(const char* prefix) +{ + if (_prefix != prefix) + { + _prefix = prefix; + destroy(); + } +} + TIndbil_cache::TIndbil_cache() { TConfig& cfg = ca_config(); @@ -165,7 +232,7 @@ TIndbil_cache::TIndbil_cache() /////////////////////////////////////////////////////////////// class TPrint_bilancio_cms_recordset : public TRecordset { - TString_array _righe; + TArray _righe; TRecnotype _curr; TArray _colonne; TIndbil_cache _indicatori; @@ -214,7 +281,7 @@ void TPrint_bilancio_cms_recordset::requery() if (!_vitaintera) query << "\nTO ANNO=" << _anno; - TISAM_recordset saldana(""); + TISAM_recordset saldana(query); for (bool ok = saldana.move_first(); ok; ok = saldana.move_next()) { const TString& conto = saldana.get(SALDANA_CONTO).as_string(); @@ -248,19 +315,20 @@ void TPrint_bilancio_cms_recordset::requery() if (riga_array == NULL) { riga_array = new TAssoc_array; - cms[indice].add(chiave, riga_array); TString4 str_indice; //l'indice va stringato per l'assoc_array str_indice << indice; - riga_array->add("INDICE", str_indice); + riga_array->add("LEVEL", str_indice); riga_array->add("CODCMS", codcms); riga_array->add("FASE", fase); riga_array->add("DESCRIZ", rec_commesse.get(COMMESSE_DESCRIZ)); + + //aggiunge la riga all'array-ino + cms[indice].add(chiave, riga_array); } } //if (datafine >= datainiesc &&... - } //if (indbil == 3 ||... } @@ -268,11 +336,9 @@ void TPrint_bilancio_cms_recordset::requery() _righe.destroy(); for (int i = 0; i < 4; i++) { - const int tot = cms[i].items(); - for (int j = 0; j < tot; j++) - { -// _righe.TArray::add(cms[i].remove(j)); - } + TAssoc_array& a = cms[i]; + FOR_EACH_ASSOC_OBJECT(a, h, k, r) + _righe.add(h->remove_obj()); // Copia nella destinazione la riga corrente } } @@ -285,8 +351,6 @@ const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) cons { if (_curr >= 0 && _curr < items()) { - TToken_string& riga = (TToken_string&)_righe.row(_curr); - if (*column_name == '#') column_name++; @@ -294,18 +358,13 @@ const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) cons if (strcmp(column_name, "ANNO") == 0) { var.set(_anno); - } else - if (strcmp(column_name, "LEVEL") == 0) + } + else { - var.set(riga.get_int(0)); - } else - if (strcmp(column_name, "CODCMS") == 0) - { - var = riga.get(1); - } else - if (strcmp(column_name, "DESCRIZ") == 0) - { - var = riga.get(2); + TAssoc_array& riga = (TAssoc_array&)_righe[_curr]; + const TString* val = (TString*)riga.objptr(column_name); + if (val) + var.set(*val); } return var; } @@ -315,8 +374,17 @@ const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) cons void TPrint_bilancio_cms_recordset::set_filter(const TPrint_bilancio_cms_mask& msk) { + //tira su un po' di parametri dalla maschera... _anno = msk.get_int(F_ESERCIZIO); - _tipostima = msk.get_bool(F_TIPOSTIMA); + _tipostima = msk.get(F_TIPOSTIMA)[0]; + _vitaintera = msk.get_bool(F_VITAINTERA); + _use_fasi = msk.get_bool(F_FASI); + //prende anche il prefix + TString80 prefix; + for (short id = F_PRE1; id <= F_PRE3 && msk.id2pos(id) > 0; id++) + prefix << msk.get(id); + + _indicatori.set_prefix(prefix); } //////////////////////////////////////////////////////// diff --git a/ca/ca3800.h b/ca/ca3800.h index 4ef27f320..561710e07 100755 --- a/ca/ca3800.h +++ b/ca/ca3800.h @@ -12,5 +12,15 @@ #define F_VITAINTERA 109 #define F_FASI 110 +//campi generati dai piani dei conti +#define F_PRE0 320 +#define F_PRE1 321 +#define F_PRE2 322 +#define F_PRE3 323 +#define F_PREDES0 324 +#define F_PREDES1 325 +#define F_PREDES2 326 +#define F_PREDES3 327 + #endif // __CA3800_H diff --git a/ca/ca3800.uml b/ca/ca3800.uml index 474c6705d..58b0ff20e 100755 --- a/ca/ca3800.uml +++ b/ca/ca3800.uml @@ -17,7 +17,7 @@ ENDPAGE PAGE "Stampa bilancio commessa" -1 -1 0 -3 -GROUPBOX DLG_NULL 74 4 +GROUPBOX DLG_NULL 76 4 BEGIN PROMPT 0 1 "" END @@ -72,22 +72,33 @@ BEGIN FLAGS "A" END +GROUPBOX DLG_NULL 76 5 +BEGIN + PROMPT 0 6 "@bParametri" +END + BOOLEAN F_FASI BEGIN PROMPT 2 7 "Esplodi Fasi" END -RADIOBUTTON F_TIPOSTIMA 22 +BOOLEAN F_VITAINTERA BEGIN - PROMPT 2 9 "Tipo di stima" + PROMPT 20 7 "Includi esercizi successivi (vita intera)" +END + +RADIOBUTTON F_TIPOSTIMA 1 22 +BEGIN + PROMPT 2 8 "Tipo di stima" FLAGS "Z" ITEM "T|Tempo" ITEM "C|Costi" END -BOOLEAN F_VITAINTERA +GROUPBOX F_PRE0 76 5 BEGIN - PROMPT 2 11 "Includi esercizi successivi (vita intera)" + PROMPT 0 12 "@bPrefisso del piano dei conti analitico:" + GROUP 6 END STRING F_REPORT 256 64 diff --git a/ca/ca3800a.rep b/ca/ca3800a.rep index a6e815c5c..763735479 100755 --- a/ca/ca3800a.rep +++ b/ca/ca3800a.rep @@ -5,10 +5,9 @@
- #SYSTEM.RAGSOC - + #SYSTEM.DATE @@ -22,7 +21,7 @@
- +