From 6f72a76dcc9f8b9adbeb9e5b75f6080e51d2233f Mon Sep 17 00:00:00 2001 From: angelo Date: Fri, 15 Nov 1996 09:07:08 +0000 Subject: [PATCH] Correzione errore MI2232, relativo al cambio di segno sugli importi delle note di credito nel caso la lista controllo movimenti venga lanciata un numero pari di volte. git-svn-id: svn://10.65.10.50/trunk@3900 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg6700.cpp | 9 ------- cg/cglib04.cpp | 67 +++++++++++++++++++++++++------------------------- cg/cglib04.h | 2 +- 3 files changed, 35 insertions(+), 43 deletions(-) diff --git a/cg/cg6700.cpp b/cg/cg6700.cpp index 7e3942e32..6b7066351 100755 --- a/cg/cg6700.cpp +++ b/cg/cg6700.cpp @@ -2695,8 +2695,6 @@ void TRic_ListaMov::aggiorna_mov() if (mov.get(MOV_TIPOMOV).empty()) mov.put(MOV_TIPOMOV, _tipom_cau); mov.put(MOV_CODPAG, _codpag_scad); - if (_tipodoc == "NC" || _tipodoc == "ST") - _tot_doc = _tot_doc * -1; mov.put(MOV_TOTDOC, _tot_doc); if (_is_salda) { @@ -2732,13 +2730,6 @@ void TRic_ListaMov::aggiorna_iva(char tipo) if (_anno == 0) riva.put(RMI_ANNOES, _annoese); - if (_tipodoc == "NC" || _tipodoc == "ST") - { - _impo = _impo * -1; - _impos = _impos * -1; - } - riva.put(RMI_IMPONIBILE, _impo); - riva.put(RMI_IMPOSTA, _impos); riva.put(RMI_TIPOC, tipo); riva.rewrite(); diff --git a/cg/cglib04.cpp b/cg/cglib04.cpp index f915f339c..1cfeceb04 100755 --- a/cg/cglib04.cpp +++ b/cg/cglib04.cpp @@ -1727,21 +1727,18 @@ void TTransfer_file::write_tmp_movPN(TString& record,bool create) int TTransfer_file::trasfer_data_mov(TIsamtempfile& file, TRectype& dep) { + const int ln = file.num(); file.zero(); file.curr() = dep; - if (file.read() == NOERR) - { - file.zero(); - file.curr() = dep; + const bool ok = file.read() == NOERR; + file.zero(); + file.curr() = dep; + + if (ok) file.rewrite(); - } else - { - file.zero(); - file.curr() = dep; file.write(); - } return 0; } @@ -1871,7 +1868,7 @@ void TTransfer_file::write_tmp_movIVA(TString& record, bool create) { if (logicnum_p) { - trasfer_data_moviva(*file, *dep, logicnum_p); + trasfer_data_moviva(*file, *dep, logicnum_p, tipodoc); delete file; delete dep; } @@ -1962,22 +1959,40 @@ void TTransfer_file::write_tmp_movIVA(TString& record, bool create) while (trc.is_key((const char*) key)); _prog->addstatus(1); - trasfer_data_moviva(*file, *dep, logicnum_p); + trasfer_data_moviva(*file, *dep, logicnum_p, tipodoc); delete file; delete dep; } // if (trc.is_key((const char*) key)) } -int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln) +int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln, TString& tipodoc) { file.zero(); file.curr() = dep; - - if (file.read() == NOERR) - { - if (ln == LF_MOV) - { + + const bool ok = file.read() == NOERR; + if (ln != LF_MOV) + { + file.zero(); + file.curr() = dep; + + if (tipodoc == "NC" || tipodoc == "ST") + { + real imp = file.get_real(RMI_IMPONIBILE); + real iva = file.get_real(RMI_IMPOSTA); + imp = imp * -1; + iva = iva * -1; + file.put(RMI_IMPONIBILE,imp); + file.put(RMI_IMPOSTA,iva); + } + + if (ok) file.rewrite(); + else file.write(); + } + else + if (ok) + { TDate data74ter (dep.get_date(MOV_DATA74TER)); TString codval (dep.get (MOV_CODVALI)); TString ocfpi (dep.get (MOV_OCFPI)); @@ -1985,7 +2000,7 @@ int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int real cambioi (dep.get_real(MOV_CAMBIOI)); real corrlire (dep.get_real(MOV_CORRLIRE)); real corrvaluta(dep.get_real(MOV_CORRVALUTA)); - + file.put(MOV_DATA74TER, data74ter); file.put(MOV_CODVALI, codval); file.put(MOV_OCFPI, ocfpi); @@ -1993,23 +2008,9 @@ int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int file.put(MOV_CAMBIOI, cambioi); file.put(MOV_CORRLIRE, corrlire); file.put(MOV_CORRVALUTA,corrvaluta); - + file.rewrite(); } - else - { - file.zero(); - file.curr() = dep; - file.rewrite(); - } - } - else - { - file.zero(); - file.curr() = dep; - file.write(); - } - return 0; } diff --git a/cg/cglib04.h b/cg/cglib04.h index 57824ba6c..b2c0e6fd4 100755 --- a/cg/cglib04.h +++ b/cg/cglib04.h @@ -213,7 +213,7 @@ private: void write_tmp_movPN(TString& record, bool create); int trasfer_data_mov(TIsamtempfile& file, TRectype& dep); void write_tmp_movIVA(TString& record, bool create); - int trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln); + int trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln, TString& tipodoc); // Funzioni per la ricezione del Saldaconto da Sistema void write_tmp_movSC(TString& record, bool create); void new_key(TString& key, int tipo, TString& buffer);