From b86c25b722a70f002517fe9f36319362e6abb965 Mon Sep 17 00:00:00 2001 From: luca Date: Tue, 9 Jan 2007 09:44:55 +0000 Subject: [PATCH] Patch level :4.0 nopatch x ora Files correlati :cg7.exe Ricompilazione Demo : [ ] Commento :tentativo di correggere errori enrichettici git-svn-id: svn://10.65.10.50/trunk@14744 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg7200.cpp | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/cg/cg7200.cpp b/cg/cg7200.cpp index 14d0f8660..b9a797411 100755 --- a/cg/cg7200.cpp +++ b/cg/cg7200.cpp @@ -258,6 +258,7 @@ class TInvioP : public TSkeleton_application TDate _dataini, _datafin; long _nregcosto, _nregpag; real _importo; + char _accsal; TConfig* _configfile; TAssoc_array _fiscali,_sociali, _costi, _pagamenti; //array che contengono i conti @@ -288,9 +289,10 @@ protected: real& imponibile, real& totdoc, real& totpagato) const; public: - const real get_importo() {return _importo;}; - const long get_nregcosto() const {return _nregcosto;}; - const long get_nregpag() const {return _nregpag;}; + const real get_importo() {return _importo;} + const long get_nregcosto() const {return _nregcosto;} + const long get_nregpag() const {return _nregpag;} + const char get_accsal() const {return _accsal;} const TString& get_vocespesa(const TString& zio) const; TInvioP_file* apri_file(const char* nome); void chiudi_file(TInvioP_file* trasfile); @@ -333,10 +335,7 @@ void TInvioP_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TS } else if (code == "_FLAG") { - bool chiusa = true; - if (cur.file().num() == LF_PAGSCA) - chiusa = cur.curr().get_char(PAGSCA_ACCSAL) == 'S'; - if (chiusa) + if (app().get_accsal() == 'S') valore = "S"; else valore = "A"; @@ -1150,6 +1149,11 @@ long TInvioP::calcola_fattura_originale(long nreg) const return nreg; } +struct TPay_info : public TObject +{ + real _somma; + char _accsal; +}; bool TInvioP::i_proforma_pagamenti() { @@ -1221,18 +1225,22 @@ bool TInvioP::i_proforma_pagamenti() TString80 indice = curpag_rec.get(PAGSCA_ANNO); indice << '|' << curpag_rec.get(PAGSCA_NUMPART); indice << '|' << curpag_rec.get(PAGSCA_NRIGA); - real importo = ZERO; - bool is_key = pagame.is_key(indice); - real& somma = is_key ? (real&) pagame[indice] : importo; + + TPay_info* pi = (TPay_info*)pagame.objptr(indice); + if (pi == NULL) + { + pi = new TPay_info; + pi->_accsal = 'A'; + pagame.add(indice, pi); + } const real importo_pagato = calcola_pagamento(curpag_rec); //aggiunta nuova!!! - somma += importo_pagato; - if (!is_key) - pagame.add(indice, somma); + pi->_somma += importo_pagato; + if (curpag_rec.get_char(PAGSCA_ACCSAL) == 'S') + pi->_accsal = 'S'; } // scrivo i record risultanti - real* cp; - for (cp = (real*) pagame.first_item(); cp != NULL; cp = (real*) pagame.succ_item()) + for (TPay_info* pi = (TPay_info*)pagame.first_item(); pi != NULL; pi = (TPay_info*)pagame.succ_item()) { TToken_string keypart; keypart.add(curpart_rec.get(PART_TIPOCF)); @@ -1245,7 +1253,8 @@ bool TInvioP::i_proforma_pagamenti() //deve cercare la prima registrazione da cui deriva il pagamento.. const long nregfatt = fattura.get_long(PART_NREG); _nregcosto = calcola_fattura_originale(nregfatt); - _importo = *cp; + _importo = pi->_somma; + _accsal = pi->_accsal; TRecord_text recpag; recpag.set_type("G");