From 3821817225d5ae0825def52162a540e84c39db8e Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 27 Jul 1995 14:09:58 +0000 Subject: [PATCH] Corretto errore git-svn-id: svn://10.65.10.50/trunk@1653 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg1302.cpp | 322 +++++++++++++++++++++++++------------------------- cg/cg1302.h | 55 ++++----- 2 files changed, 191 insertions(+), 186 deletions(-) diff --git a/cg/cg1302.cpp b/cg/cg1302.cpp index 148db0c96..a07fbcf92 100755 --- a/cg/cg1302.cpp +++ b/cg/cg1302.cpp @@ -1,159 +1,163 @@ -//**************************** -//* Aggiornamento Tipo Conto * -//**************************** -#include -#include -#include -#include "conto.h" -#include "cg1302.h" - -const int TAgg_tconto::look_reg (const char* cod, int anno) -{ - TTable tab_reg("REG"); - TString codtab; - codtab.format("%4d%-3s", anno, cod); - int tipo_reg; - - tab_reg.zero(); - tab_reg.put("CODTAB", codtab); - if (tab_reg.read() == NOERR) - tipo_reg = tab_reg.get_int("I0"); - else - tipo_reg = 0; - - return tipo_reg; -} - -bool TAgg_tconto::user_create() -{ - _rel = new TRelation(LF_MOV); - _rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1); - _cur = new TCursor(_rel,"",1); - add_cursor(_cur); - - add_file (LF_MOV); - add_file (LF_RMOVIVA); - - _pcon = new TLocalisamfile(LF_PCON); - _nditte = new TLocalisamfile(LF_NDITTE); - _tabreg = new TTable("REG"); - - return TRUE; -} - -bool TAgg_tconto::user_destroy() -{ - delete _rel; - delete _cur; - delete _pcon; - delete _nditte; - delete _tabreg; - - return TRUE; -} - -bool TAgg_tconto::set_print(int) -{ - TMask msk("cg1300a"); - - while (msk.run() == K_ENTER) - { - setta_intestazione(); - printer().footerlen(5); - return TRUE; - } - return FALSE; -} - -bool TAgg_tconto::preprocess_page(int file,int counter) -{ - if (counter) return TRUE; - - TCursor* cur = current_cursor(); - if (file == LF_MOV) - { - TString16 reg = cur->curr().get(MOV_REG); - if (reg.empty()) return FALSE; - } - else if (file == LF_RMOVIVA) - { - TRectype pcon(LF_PCON); - int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO); - int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO); - long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO); - long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG); - int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP"); - - TBill tc (gruppo,conto,0L); - tc.read(pcon); - if (!pcon.empty()) - if (pcon.get_char("TMCF") != '\0') - return FALSE; - - tc.set(gruppo,conto,sottoconto); - tc.read(pcon); - if (!pcon.empty()) - { - if (tc.sospeso()) - { - set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto sospeso **", - numreg, nrigimp, gruppo, conto, sottoconto); - return TRUE; - } - TString16 reg = cur->curr().get(MOV_REG); - int annoiva = cur->curr().get_int(MOV_ANNOIVA); - if (look_reg(reg, annoiva) == 1) //cerca il tipo del registro - { - int t = tc.tipo_cr(); - if (t == 2 || t == 3 || t == 8) - { - _rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4); - _rel->lfile(LF_RMOVIVA).rewrite(); - } - } - } - else - { - set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto inesistente **", - numreg, nrigimp, gruppo, conto, sottoconto); - return TRUE; - } - return FALSE; - } - return TRUE; -} - -void TAgg_tconto::setta_intestazione() -{ - int soh = 1; - TString sep(132); - TString ragsoc(50); - - TLocalisamfile nditte(LF_NDITTE); - nditte.zero(); - nditte.put(NDT_CODDITTA, get_firm()); - if (nditte.read() == NOERR) - ragsoc = nditte.get(NDT_RAGSOC); - - reset_header(); - - sep << "Ditta " << get_firm(); - sep << " " << ragsoc; - - sep.left_just(132); - - set_header (soh++, (const char*) sep); - - sep = ""; - sep << "Data @< Pag. @#"; - - sep.right_just(127); - - sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori"); - set_header (soh++, (const char*)sep); - sep.fill('-'); - set_header (soh++, (const char *) sep); - set_header (soh++, "Numero Registrazione Riga Gruppo Conto Sottoconto"); - set_header (soh++, (const char *) sep); - set_header (soh, ""); -} +//**************************** +//* Aggiornamento Tipo Conto * +//**************************** +#include +#include +#include +#include "conto.h" +#include "cg1302.h" + +const int TAgg_tconto::look_reg (const char* cod, int anno) +{ + TTable tab_reg("REG"); + TString codtab; + codtab.format("%4d%-3s", anno, cod); + int tipo_reg; + + tab_reg.zero(); + tab_reg.put("CODTAB", codtab); + if (tab_reg.read() == NOERR) + tipo_reg = tab_reg.get_int("I0"); + else + tipo_reg = 0; + + return tipo_reg; +} + +bool TAgg_tconto::user_create() +{ + _rel = new TRelation(LF_MOV); + _rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1); + _cur = new TCursor(_rel,"",1); + add_cursor(_cur); + + add_file (LF_MOV); + add_file (LF_RMOVIVA); + + _pcon = new TLocalisamfile(LF_PCON); + _nditte = new TLocalisamfile(LF_NDITTE); + _tabreg = new TTable("REG"); + + return TRUE; +} + +bool TAgg_tconto::user_destroy() +{ + delete _rel; + delete _cur; + delete _pcon; + delete _nditte; + delete _tabreg; + + return TRUE; +} + +bool TAgg_tconto::set_print(int) +{ + TMask msk("cg1300a"); + + while (msk.run() == K_ENTER) + { + setta_intestazione(); + printer().footerlen(5); + return TRUE; + } + return FALSE; +} + +void TAgg_tconto::postclose_print() +{ + message_box("Aggiornamento tipo conto completato"); +} + +bool TAgg_tconto::preprocess_page(int file,int counter) +{ + if (counter) return TRUE; + + TCursor* cur = current_cursor(); + if (file == LF_MOV) + { + TString16 reg = cur->curr().get(MOV_REG); + if (reg.empty()) return FALSE; + } + else if (file == LF_RMOVIVA) + { + TRectype pcon(LF_PCON); + int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO); + int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO); + long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO); + long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG); + int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP"); + + TBill tc (gruppo,conto,0L); + tc.read(pcon); + if (!pcon.empty()) + if (pcon.get_char("TMCF") != '\0') + return FALSE; + + tc.set(gruppo,conto,sottoconto); + tc.read(pcon); + if (!pcon.empty()) + { + if (tc.sospeso()) + { + set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto sospeso **", + numreg, nrigimp, gruppo, conto, sottoconto); + return TRUE; + } + int t = tc.tipo_cr(); + TString16 reg = cur->curr().get(MOV_REG); + int annoiva = cur->curr().get_int(MOV_ANNOIVA); + const int tipo = look_reg(reg, annoiva); //cerca il tipo del registro + //aggiorno sul movimento iva il tipo costo/ricavo + //con quello letto dal piano conti + _rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, t); + if (tipo == 1 && (t == 2 || t == 3)) + _rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4); + _rel->lfile(LF_RMOVIVA).rewrite(); + } + else + { + set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto inesistente **", + numreg, nrigimp, gruppo, conto, sottoconto); + return TRUE; + } + return FALSE; + } + return TRUE; +} + +void TAgg_tconto::setta_intestazione() +{ + int soh = 1; + TString sep(132); + TString ragsoc(50); + + TLocalisamfile nditte(LF_NDITTE); + nditte.zero(); + nditte.put(NDT_CODDITTA, get_firm()); + if (nditte.read() == NOERR) + ragsoc = nditte.get(NDT_RAGSOC); + + reset_header(); + + sep << "Ditta " << get_firm(); + sep << " " << ragsoc; + + sep.left_just(132); + + set_header (soh++, (const char*) sep); + + sep = ""; + sep << "Data @< Pag. @#"; + + sep.right_just(127); + + sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori"); + set_header (soh++, (const char*)sep); + sep.fill('-'); + set_header (soh++, (const char *) sep); + set_header (soh++, "Numero Registrazione Riga Gruppo Conto Sottoconto"); + set_header (soh++, (const char *) sep); + set_header (soh, ""); +} diff --git a/cg/cg1302.h b/cg/cg1302.h index a6934a5f2..bdb998ae4 100755 --- a/cg/cg1302.h +++ b/cg/cg1302.h @@ -1,27 +1,28 @@ -#include -#include -#include -#include -#include -#include -#include - -class TAgg_tconto : public TPrintapp -{ - TLocalisamfile* _pcon,* _nditte; - TTable* _tabreg; - TRelation* _rel; - TCursor* _cur; - -public: - virtual bool user_create(); - virtual bool user_destroy(); - virtual bool set_print(int i); - virtual bool preprocess_page(int, int); - - void setta_intestazione(); - const int look_reg(const char*, int); - - TAgg_tconto() {}; - virtual ~TAgg_tconto() {}; -}; +#include +#include +#include +#include +#include +#include +#include + +class TAgg_tconto : public TPrintapp +{ + TLocalisamfile* _pcon,* _nditte; + TTable* _tabreg; + TRelation* _rel; + TCursor* _cur; + +public: + virtual bool user_create(); + virtual bool user_destroy(); + virtual bool set_print(int i); + virtual bool preprocess_page(int, int); + virtual void postclose_print(); + + void setta_intestazione(); + const int look_reg(const char*, int); + + TAgg_tconto() {}; + virtual ~TAgg_tconto() {}; +};