From e3da6f637816ef86ab6ac1ba10c53147b8b47f23 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 8 Aug 2005 14:08:52 +0000 Subject: [PATCH] Patch level : 2.2 Files correlati : ca3.exe ca3300c.rep ca3300d.rep Ricompilazione Demo : [ ] Commento : Aggiunte stampe bilancio di verifica e a sezioni contrapposte di raffronto git-svn-id: svn://10.65.10.50/trunk@13310 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/ca3300.cpp | 101 +++++++++++++++++++++++++++++++++++++---------- ca/ca3300c.rep | 104 +++++++++++++++++++++++++++++++++++++++++++++++++ ca/ca3300d.rep | 80 +++++++++++++++++++++++++++++++++++++ ca/calib02.cpp | 13 +++++++ ca/calib02.h | 10 +++++ 5 files changed, 288 insertions(+), 20 deletions(-) create mode 100755 ca/ca3300c.rep create mode 100755 ca/ca3300d.rep diff --git a/ca/ca3300.cpp b/ca/ca3300.cpp index 79c5903f1..cfde87dc4 100755 --- a/ca/ca3300.cpp +++ b/ca/ca3300.cpp @@ -414,9 +414,27 @@ TReport_bilancio_verifica::TReport_bilancio_verifica(const char* name) struct TSaldo_contrapposto : public TObject { TString _conto; - TImporto _saldo; + TImporto _saldo, _preventivo, _consuntivo; + + TSaldo_contrapposto& operator+=(const TSaldo_contrapposto& sc); + void reset(); }; +TSaldo_contrapposto& TSaldo_contrapposto::operator+=(const TSaldo_contrapposto& sc) +{ + _preventivo += sc._preventivo; + _consuntivo += sc._consuntivo; + _saldo += sc._saldo; + return *this; +} + +void TSaldo_contrapposto::reset() +{ + _preventivo.reset(); + _consuntivo.reset(); + _saldo.reset(); +} + class TRecordset_sezioni_contrapposte : public TRecordset { char _tipo_piano; @@ -434,9 +452,10 @@ protected: virtual const TVariant& get_fld(const TArray& a, int r, const char* field) const; TArray& conti(int indbil); - void add_conto(const TString& b, const TImporto& i, TArray& a, int n = -1); + void add_conto(const TString& b, const TImporto& s, const TImporto& p, const TImporto& c, TArray& a, int n = -1); void add_conto(int indbil, const TString& b); void calcola_totali(); + void get_section(const TImporto& imp, TVariant& var) const; public: virtual TRecnotype items() const; @@ -506,12 +525,15 @@ TArray& TRecordset_sezioni_contrapposte::conti(int indbil) return *ptar; } -void TRecordset_sezioni_contrapposte::add_conto(const TString& b, const TImporto& i, +void TRecordset_sezioni_contrapposte::add_conto(const TString& b, + const TImporto& s, const TImporto& p, const TImporto& c, TArray& a, int n) { TSaldo_contrapposto* sc = new TSaldo_contrapposto; - sc->_conto = b; - sc->_saldo = i; + sc->_conto = b; + sc->_saldo = s; sc->_saldo.normalize(); + sc->_preventivo = p; sc->_preventivo.normalize(); + sc->_consuntivo = c; sc->_consuntivo.normalize(); if (n < 0) a.add(sc); else @@ -524,11 +546,27 @@ void TRecordset_sezioni_contrapposte::add_conto(int indbil, const TString& b) { TAnal_bill bill(_filter); bill.set_conto(b); - const TSaldanal& sa = ca_saldo(bill, _da_data, _a_data, _tipimov); - if (!sa._fin.is_zero()) + + if ((_tipimov & _saldanal_qualsiasi) == _saldanal_qualsiasi) // Bilancio a sezioni contrapposte di raffronto { - TArray& a = conti(indbil); - add_conto(b, sa._fin, a); + const TSaldanal& sp = ca_saldo(bill, _da_data, _a_data, _saldanal_preventivi); + const TSaldanal& sc = ca_saldo(bill, _da_data, _a_data, _saldanal_consuntivo); + if (!sp._fin.is_zero() || !sc._fin.is_zero()) + { + TArray& a = conti(indbil); + TImporto s = sp._fin; s -= sc._fin; s.normalize(); + add_conto(b, s, sp._fin, sc._fin, a); + } + } + else + { + const TSaldanal& sa = ca_saldo(bill, _da_data, _a_data, _tipimov); + if (!sa._fin.is_zero()) + { + TImporto zero; + TArray& a = conti(indbil); + add_conto(b, sa._fin, zero, zero, a); + } } } } @@ -549,7 +587,7 @@ void TRecordset_sezioni_contrapposte::calcola_totali() TArray& a = conti(indbil); if (!a.empty()) { - TImporto totale[4]; // Totali dei 3 livelli intermedi (4 per fare conto pari) + TSaldo_contrapposto totale[4]; // Totali dei 3 livelli intermedi (4 per fare conto pari) TString80 last_conto; // Inserisci sentinella per far scattare il cambio del conto sull'ultimo record @@ -565,7 +603,9 @@ void TRecordset_sezioni_contrapposte::calcola_totali() if (sc._conto.compare(last_conto, cut) != 0) { const TString& intermedio = last_conto.left(cut); - add_conto(intermedio, totale[level], a, i+1); + add_conto(intermedio, + totale[level]._saldo, totale[level]._preventivo, totale[level]._consuntivo, + a, i+1); totale[level].reset(); } else @@ -574,7 +614,7 @@ void TRecordset_sezioni_contrapposte::calcola_totali() } last_conto = sc._conto; for (int l = 0; l < break_level; l++) - totale[l] += sc._saldo; + totale[l] += sc; } a.destroy(0, true); // Elimina sentinella } @@ -638,13 +678,24 @@ void TRecordset_sezioni_contrapposte::requery() } unsigned int TRecordset_sezioni_contrapposte::columns() const -{ return 9; } +{ return 1; } const TRecordset_column_info& TRecordset_sezioni_contrapposte::column_info(unsigned int column) const { return *(TRecordset_column_info*)NULL; } +void TRecordset_sezioni_contrapposte::get_section(const TImporto& imp, TVariant& var) const +{ + if (imp.is_zero()) + var = EMPTY_STRING; + else + { + const char sez[2] = { imp.sezione(), '\0' }; + var = sez; + } +} + const TVariant& TRecordset_sezioni_contrapposte::get_fld(const TArray& a, int r, const char* field) const { TVariant& var = get_tmp_var(); @@ -672,15 +723,25 @@ const TVariant& TRecordset_sezioni_contrapposte::get_fld(const TArray& a, int r, { var = sc._saldo.valore(); } else + if (fld == "SALDOC") + { + var = sc._consuntivo.valore(); + } else + if (fld == "SALDOP" || fld == "SALDOV") + { + var = sc._preventivo.valore(); + } else if (fld == "SEZIONE") { - if (sc._saldo.is_zero()) - var = EMPTY_STRING; - else - { - const char sez[2] = { sc._saldo.sezione(), '\0' }; - var = sez; - } + get_section(sc._saldo, var); + } else + if (fld == "SEZIONEC") + { + get_section(sc._consuntivo, var); + } + if (fld == "SEZIONEP" || fld == "SEZIONEV") + { + get_section(sc._preventivo, var); } } else diff --git a/ca/ca3300c.rep b/ca/ca3300c.rep new file mode 100755 index 000000000..dd2342e75 --- /dev/null +++ b/ca/ca3300c.rep @@ -0,0 +1,104 @@ + + + Bilancio a sezioni contrapposte + +
+ + #SYSTEM.RAGSOC + + + #SYSTEM.DATE + + + #REPORT.PAGE + + + + #COSTO + + + MESSAGE ISAMREAD,CDC,CODCOSTO=#COSTO,DESCRIZ + + + + #COMMESSA + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DESCRIZ + + + + #FASE + + + MESSAGE ISAMREAD,FASI,CODCMSFAS=#CMSCDC!CODFASE=#FASE,DESCRIZ + + +
+
+
+ SEZIONE + + IF(SEZIONE=="AP","ATTIVITA'","COSTI") + + + IF(SEZIONE=="AP","PASSIVITA'","RICAVI") + +
+
+
+ + LEFT:CONTO + CA_FORMAT_CONTO + + + LEFT:DESCR + + + LEFT:SALDOP + + + LEFT:SEZIONEP + + + RIGHT:CONTO + CA_FORMAT_CONTO + + + RIGHT:DESCR + + + RIGHT:SALDO + + + RIGHT:SEZIONE + + + LEFT:SALDOC + + + LEFT:SEZIONEC + + + RIGHT:SALDOC + + + RIGHT:SEZIONEC + + + LEFT:SALDO + + + LEFT:SEZIONE + + + RIGHT:SALDO + + + RIGHT:SEZIONE + +
+
+
+
+ \ No newline at end of file diff --git a/ca/ca3300d.rep b/ca/ca3300d.rep new file mode 100755 index 000000000..639265a10 --- /dev/null +++ b/ca/ca3300d.rep @@ -0,0 +1,80 @@ + + + Bilancio a sezioni contrapposte + +
+ + #SYSTEM.RAGSOC + + + #SYSTEM.DATE + + + #REPORT.PAGE + + + + #COSTO + + + MESSAGE ISAMREAD,CDC,CODCOSTO=#COSTO,DESCRIZ + + + + #COMMESSA + + + MESSAGE ISAMREAD,COMMESSE,CODCMS=#COMMESSA,DESCRIZ + + + + #FASE + + + MESSAGE ISAMREAD,FASI,CODCMSFAS=#CMSCDC!CODFASE=#FASE,DESCRIZ + + +
+
+
+ SEZIONE + + IF(SEZIONE=="AP","ATTIVITA'","COSTI") + + + IF(SEZIONE=="AP","PASSIVITA'","RICAVI") + +
+
+
+ + LEFT:CONTO + CA_FORMAT_CONTO + + + LEFT:DESCR + + + LEFT:SALDO + + + LEFT:SEZIONE + + + RIGHT:CONTO + CA_FORMAT_CONTO + + + RIGHT:DESCR + + + RIGHT:SALDO + + + RIGHT:SEZIONE + +
+
+
+
+ \ No newline at end of file diff --git a/ca/calib02.cpp b/ca/calib02.cpp index 8cb9ed4a4..33c77f8fe 100755 --- a/ca/calib02.cpp +++ b/ca/calib02.cpp @@ -13,6 +13,19 @@ #include "rmovana.h" #include "saldana.h" +/////////////////////////////////////////////////////////// +// TSaldanal +/////////////////////////////////////////////////////////// + +void TSaldanal::copy(const TSaldanal& sa) +{ + _ini = sa._ini; + _dare = sa._dare; + _avere = sa._avere; + _fin = sa._fin; + _movimentato = sa._movimentato; +} + /////////////////////////////////////////////////////////// // TPconana_recordset /////////////////////////////////////////////////////////// diff --git a/ca/calib02.h b/ca/calib02.h index 1af3b7a41..7c1e199a1 100755 --- a/ca/calib02.h +++ b/ca/calib02.h @@ -59,6 +59,16 @@ struct TSaldanal : public TObject { TImporto _ini, _dare, _avere, _fin; bool _movimentato; + +protected: + void copy(const TSaldanal& sa); + +public: + TObject* dup() const { return new TSaldanal(*this); } + const TSaldanal& operator=(const TSaldanal& sa) { copy(sa); return *this; } + + TSaldanal() { } + TSaldanal(const TSaldanal& sa) { copy(sa); } }; const TSaldanal& ca_saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi = _saldanal_consuntivo);