From 4ca8e85e3b74f5906cfd3d4a18a62966cbff247e Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 29 May 1995 10:28:33 +0000 Subject: [PATCH] Corretta formattazione git-svn-id: svn://10.65.10.50/trunk@1405 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg1300.h | 52 ++++---- cg/cg1300a.uml | 82 ++++++------- cg/cg1300b.uml | 152 +++++++++++------------ cg/cg1301.cpp | 168 +++++++++++++------------- cg/cg1301.h | 44 +++---- cg/cg1302.cpp | 318 ++++++++++++++++++++++++------------------------- cg/cg1302.h | 54 ++++----- cg/cg1303.cpp | 298 ++++++++++++++++++++++----------------------- cg/cg1303.h | 56 ++++----- 9 files changed, 612 insertions(+), 612 deletions(-) diff --git a/cg/cg1300.h b/cg/cg1300.h index 47a9468f3..20f5831ac 100755 --- a/cg/cg1300.h +++ b/cg/cg1300.h @@ -1,26 +1,26 @@ -#ifndef __CG1300_H -#define __CG1300_H - -#define F_CODDITTA 101 -#define F_RAGSOC 102 -#define F_ANNO 103 -#define F_REG 104 -#define F_PROT 105 - -#endif // __CG1300_H - - - - - - - - - - - - - - - - +#ifndef __CG1300_H +#define __CG1300_H + +#define F_CODDITTA 101 +#define F_RAGSOC 102 +#define F_ANNO 103 +#define F_REG 104 +#define F_PROT 105 + +#endif // __CG1300_H + + + + + + + + + + + + + + + + diff --git a/cg/cg1300a.uml b/cg/cg1300a.uml index e0e1cb640..28c60f3a0 100755 --- a/cg/cg1300a.uml +++ b/cg/cg1300a.uml @@ -1,41 +1,41 @@ -#include "cg1300.h" - -PAGE "" -1 -1 70 8 - -NUMBER F_CODDITTA 5 -BEGIN - PROMPT 1 1 "Ditta " - FLAGS "FRD" - USE LF_NDITTE KEY 1 - CHECKTYPE REQUIRED - INPUT CODDITTA F_CODDITTA - OUTPUT F_CODDITTA CODDITTA - OUTPUT F_RAGSOC RAGSOC -END - -STRING F_RAGSOC 50 -BEGIN - PROMPT 1 2 "Ragione sociale " - FLAGS "D" -END - -BUTTON DLG_OK 10 2 -BEGIN - PROMPT -12 -1 "" -END - -BUTTON DLG_CANCEL 10 2 -BEGIN - PROMPT -22 -1 "" -END - -ENDPAGE - -ENDMASK - - - - - - - +#include "cg1300.h" + +PAGE "" -1 -1 70 8 + +NUMBER F_CODDITTA 5 +BEGIN + PROMPT 1 1 "Ditta " + FLAGS "FRD" + USE LF_NDITTE KEY 1 + CHECKTYPE REQUIRED + INPUT CODDITTA F_CODDITTA + OUTPUT F_CODDITTA CODDITTA + OUTPUT F_RAGSOC RAGSOC +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 1 2 "Ragione sociale " + FLAGS "D" +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + +ENDMASK + + + + + + + diff --git a/cg/cg1300b.uml b/cg/cg1300b.uml index 8125862be..ed3dc758b 100755 --- a/cg/cg1300b.uml +++ b/cg/cg1300b.uml @@ -1,76 +1,76 @@ -#include "cg1300.h" - -PAGE "Rinumerazione numero protocollo" -1 -1 72 12 - -NUMBER F_CODDITTA 5 -BEGIN - PROMPT 1 1 "Ditta " - FLAGS "FRD" - USE LF_NDITTE KEY 1 - CHECKTYPE REQUIRED - INPUT CODDITTA F_CODDITTA - OUTPUT F_CODDITTA CODDITTA - OUTPUT F_RAGSOC RAGSOC -END - -STRING F_RAGSOC 50 -BEGIN - PROMPT 1 2 "Ragione sociale " - FLAGS "D" -END - -NUMBER F_ANNO 4 -BEGIN - PROMPT 1 4 "Anno " - HELP "Anno di riferimento" - //FLAGS "A" - VALIDATE FIXLEN_FUNC 4 - CHECKTYPE REQUIRED - WARNING "Indicare l'anno" -END - -STRING F_REG 3 -BEGIN - PROMPT 1 5 "Codice registro " - USE REG SELECT (I0<"3") && (CODTAB[1,4]==#103) - INPUT CODTAB[1,4] F_ANNO - INPUT CODTAB[5,7] F_REG - DISPLAY "Anno " CODTAB[1,4] - DISPLAY "Codice " CODTAB[5,7] - DISPLAY "Descrizione @40" S0 - OUTPUT F_ANNO CODTAB[1,4] - OUTPUT F_REG CODTAB[5,7] - FLAGS "U" - VALIDATE ZEROFILL_FUNC 3 - CHECKTYPE REQUIRED - WARNING "Indicare il codice registro" -END - -NUMBER F_PROT 5 -BEGIN - PROMPT 1 6 "Numero di protocollo " - HELP "Numero progressivo di protocollo IVA" - NUM_EXPR (#F_PROT>0) - WARNING "Inserire un numero maggiore di zero" -END - -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -12 -1 "" -END - -BUTTON DLG_CANCEL 9 2 -BEGIN - PROMPT -22 -1 "" -END - -ENDPAGE - -ENDMASK - - - - - - - +#include "cg1300.h" + +PAGE "Rinumerazione numero protocollo" -1 -1 72 12 + +NUMBER F_CODDITTA 5 +BEGIN + PROMPT 1 1 "Ditta " + FLAGS "FRD" + USE LF_NDITTE KEY 1 + CHECKTYPE REQUIRED + INPUT CODDITTA F_CODDITTA + OUTPUT F_CODDITTA CODDITTA + OUTPUT F_RAGSOC RAGSOC +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 1 2 "Ragione sociale " + FLAGS "D" +END + +NUMBER F_ANNO 4 +BEGIN + PROMPT 1 4 "Anno " + HELP "Anno di riferimento" + //FLAGS "A" + VALIDATE FIXLEN_FUNC 4 + CHECKTYPE REQUIRED + WARNING "Indicare l'anno" +END + +STRING F_REG 3 +BEGIN + PROMPT 1 5 "Codice registro " + USE REG SELECT (I0<"3") && (CODTAB[1,4]==#103) + INPUT CODTAB[1,4] F_ANNO + INPUT CODTAB[5,7] F_REG + DISPLAY "Anno " CODTAB[1,4] + DISPLAY "Codice " CODTAB[5,7] + DISPLAY "Descrizione @40" S0 + OUTPUT F_ANNO CODTAB[1,4] + OUTPUT F_REG CODTAB[5,7] + FLAGS "U" + VALIDATE ZEROFILL_FUNC 3 + CHECKTYPE REQUIRED + WARNING "Indicare il codice registro" +END + +NUMBER F_PROT 5 +BEGIN + PROMPT 1 6 "Numero di protocollo " + HELP "Numero progressivo di protocollo IVA" + NUM_EXPR (#F_PROT>0) + WARNING "Inserire un numero maggiore di zero" +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_CANCEL 9 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + +ENDMASK + + + + + + + diff --git a/cg/cg1301.cpp b/cg/cg1301.cpp index 50a218a32..bac00507d 100755 --- a/cg/cg1301.cpp +++ b/cg/cg1301.cpp @@ -1,84 +1,84 @@ -//************************************************** -//* Aggiornamento Flag Operazioni Intracomunitarie * -//************************************************** -#include -#include -#include -#include "cg2103.h" -#include "cg1301.h" - -bool TAgg_opintra::create() -{ - TApplication::create(); - - _causali = new TLocalisamfile(LF_ATTIV); - - dispatch_e_menu (BAR_ITEM(1)); - return TRUE; -} - -bool TAgg_opintra::destroy() -{ - delete _causali; - return TApplication::destroy(); -} - -bool TAgg_opintra::menu(MENU_TAG m) -{ - TMask msk("cg1300a"); - - while (msk.run() == K_ENTER) - { - look_mov(); - message_box("Aggiornamento completato"); - //return TRUE; - } - return FALSE; -} - -void TAgg_opintra::look_mov() -{ - TLocalisamfile caus(LF_CAUSALI); - - TRelation rel (LF_MOV); - rel.add(LF_RMOVIVA, "NUMREG=NUMREG",1); - TCursor cursor(&rel,"",1); - - TLocalisamfile& mov = rel.lfile(); - TLocalisamfile& rmoviva = rel.lfile(LF_RMOVIVA); - - long ditta = get_firm(); - cursor = 0L; - const long nitems = cursor.items(); - - TProgind p(nitems ? nitems : 1, "Aggiornamento in corso..." , TRUE, TRUE, 70); - - for (; cursor.pos() < cursor.items(); ++cursor) - { - p.addstatus(1); - const TString16 reg(mov.get(MOV_REG)); - if (reg.empty()) continue; - - const TDate datareg = mov.get_date(MOV_DATAREG); - if (datareg < "01-01-93") continue; - - const TString16 codcaus(mov.get(MOV_CODCAUS)); - if (codcaus.not_empty()) - { - caus.setkey(1); - caus.put(CAU_CODCAUS, codcaus); - if (caus.read() == NOERR) - { - bool intra = caus.get_bool(CAU_INTRACOM); - bool ok = rel.is_first_match(LF_RMOVIVA); - while (ok) - { - rmoviva.put(RMI_INTRA, intra); - rmoviva.rewrite(); - ok = rel.next_match(LF_RMOVIVA); - } - } - } - } -} - +//************************************************** +//* Aggiornamento Flag Operazioni Intracomunitarie * +//************************************************** +#include +#include +#include +#include "cg2103.h" +#include "cg1301.h" + +bool TAgg_opintra::create() +{ + TApplication::create(); + + _causali = new TLocalisamfile(LF_ATTIV); + + dispatch_e_menu (BAR_ITEM(1)); + return TRUE; +} + +bool TAgg_opintra::destroy() +{ + delete _causali; + return TApplication::destroy(); +} + +bool TAgg_opintra::menu(MENU_TAG m) +{ + TMask msk("cg1300a"); + + while (msk.run() == K_ENTER) + { + look_mov(); + message_box("Aggiornamento completato"); + //return TRUE; + } + return FALSE; +} + +void TAgg_opintra::look_mov() +{ + TLocalisamfile caus(LF_CAUSALI); + + TRelation rel (LF_MOV); + rel.add(LF_RMOVIVA, "NUMREG=NUMREG",1); + TCursor cursor(&rel,"",1); + + TLocalisamfile& mov = rel.lfile(); + TLocalisamfile& rmoviva = rel.lfile(LF_RMOVIVA); + + long ditta = get_firm(); + cursor = 0L; + const long nitems = cursor.items(); + + TProgind p(nitems ? nitems : 1, "Aggiornamento in corso..." , TRUE, TRUE, 70); + + for (; cursor.pos() < cursor.items(); ++cursor) + { + p.addstatus(1); + const TString16 reg(mov.get(MOV_REG)); + if (reg.empty()) continue; + + const TDate datareg = mov.get_date(MOV_DATAREG); + if (datareg < "01-01-93") continue; + + const TString16 codcaus(mov.get(MOV_CODCAUS)); + if (codcaus.not_empty()) + { + caus.setkey(1); + caus.put(CAU_CODCAUS, codcaus); + if (caus.read() == NOERR) + { + bool intra = caus.get_bool(CAU_INTRACOM); + bool ok = rel.is_first_match(LF_RMOVIVA); + while (ok) + { + rmoviva.put(RMI_INTRA, intra); + rmoviva.rewrite(); + ok = rel.next_match(LF_RMOVIVA); + } + } + } + } +} + diff --git a/cg/cg1301.h b/cg/cg1301.h index 0ad591bd3..80de6ace5 100755 --- a/cg/cg1301.h +++ b/cg/cg1301.h @@ -1,23 +1,23 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -class TAgg_opintra : public TApplication -{ - TLocalisamfile* _causali; - -public: - virtual bool create(); - virtual bool destroy(); - virtual bool menu(MENU_TAG m); - - void look_mov(); - - TAgg_opintra() {}; - virtual ~TAgg_opintra() {}; +#include +#include +#include +#include +#include +#include +#include +#include + +class TAgg_opintra : public TApplication +{ + TLocalisamfile* _causali; + +public: + virtual bool create(); + virtual bool destroy(); + virtual bool menu(MENU_TAG m); + + void look_mov(); + + TAgg_opintra() {}; + virtual ~TAgg_opintra() {}; }; \ No newline at end of file diff --git a/cg/cg1302.cpp b/cg/cg1302.cpp index 8e4163937..148db0c96 100755 --- a/cg/cg1302.cpp +++ b/cg/cg1302.cpp @@ -1,159 +1,159 @@ -//**************************** -//* 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, ""); -} \ No newline at end of file +//**************************** +//* 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, ""); +} diff --git a/cg/cg1302.h b/cg/cg1302.h index 24f816fb4..a6934a5f2 100755 --- a/cg/cg1302.h +++ b/cg/cg1302.h @@ -1,27 +1,27 @@ -#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() {}; -}; \ No newline at end of file +#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() {}; +}; diff --git a/cg/cg1303.cpp b/cg/cg1303.cpp index 18d995a8f..dc0b5c56d 100755 --- a/cg/cg1303.cpp +++ b/cg/cg1303.cpp @@ -1,149 +1,149 @@ -//*********************************** -//* Rinumerazione numero protocollo * -//*********************************** -#include -#include "cg1300.h" -#include "cg1303.h" - -HIDDEN TAgg_nprot& app() { return (TAgg_nprot&) main_app(); } - -bool TAgg_nprot::filtra_mov(const TRelation* r) -{ - TLocalisamfile& mov = r->lfile(); - - const int annoiva = mov.get_int(MOV_ANNOIVA); - const TString16 reg = mov.get(MOV_REG); - - if (app()._anno == annoiva && app()._reg == reg) - return TRUE; - - return FALSE; -} - -bool TAgg_nprot::create() -{ - TApplication::create(); - - _tabreg = new TTable("REG"); - - dispatch_e_menu (BAR_ITEM(1)); - return TRUE; -} - -bool TAgg_nprot::destroy() -{ - delete _tabreg; - - return TApplication::destroy(); -} - -bool TAgg_nprot::menu(MENU_TAG m) -{ - TMask msk("cg1300b"); - - TConfig conf(CONFIG_DITTA); - int annoiva = conf.get_int("AnLiIv"); - - msk.set(F_ANNO, annoiva); - - while (msk.run() == K_ENTER) - { - _anno = msk.get_int(F_ANNO); - _reg = msk.get(F_REG); - _prot = msk.get_long(F_PROT); - - rinumera_prot(); - - msk.reset(F_REG); - msk.reset(F_PROT); - //return TRUE; - } - - return FALSE; -} - -int TAgg_nprot::rinumera_prot() -{ - TRelation rel (LF_MOV); - TLocalisamfile& mov = rel.lfile(); - - //TString80 filter; - //filter.format("ANNOIVA=%04d && REG=\"%s\"", _anno, (const char*)_reg); - //TCursor cursor(&rel, filter, 2); - - TCursor cursor(&rel, "", 2); - cursor.set_filterfunction(filtra_mov); - - cursor = 0L; - const long nitems = cursor.items(); - - //TProgind p(nitems ? nitems : 1, "Elaborazione in corso..." , TRUE, TRUE, 70); - TProgind* p = NULL; - - if (nitems > 0L) - p = new TProgind (nitems, "Elaborazione in corso..." , TRUE, TRUE, 70); - - long protiva, uprotiva; - - for (; cursor.pos() < cursor.items(); ++cursor) - { - if (p) p->addstatus(1); - protiva = mov.get_long(MOV_PROTIVA); - uprotiva = mov.get_long(MOV_UPROTIVA); - if (protiva != _prot && uprotiva != _prot) continue; - else - { - if (uprotiva != 0l) - _prot = uprotiva; - break; - } - } - - if (protiva != _prot && uprotiva != _prot) //sono alla fine del file - { - delete p; - return message_box("Non trovato record con protocollo indicato: rinumerazione non avvenuta"); - } - - ++cursor; - - long nprot,uprot,dprot; - dprot = uprot = 0L; - nprot = _prot; - - for (; cursor.pos() < cursor.items(); ++cursor) - { - if (p) p->addstatus(1); - protiva = mov.get_long(MOV_PROTIVA); - uprotiva = mov.get_long(MOV_UPROTIVA); - - nprot = nprot+1+dprot; //stile RPG - dprot = 0L; - uprot = 0L; - dprot = (uprotiva == 0L) ? 0L : (uprotiva - protiva); - uprot = (uprotiva == 0L) ? 0L : (nprot + dprot); - - mov.put(MOV_PROTIVA, nprot); - mov.put(MOV_UPROTIVA, uprot); - mov.rewrite(); - } - - TTable reg("REG"); - TString16 s; s.format("%04d%s", _anno, (const char*)_reg); - reg.zero(); - reg.put("CODTAB", s); - if (reg.read() == NOERR) - { - reg.put("I5", nprot + dprot); - reg.rewrite(); - } - else - { - delete p; - return error_box("Impossibile leggere il registro %s anno %s", - (const char*)_reg, (const char*)_anno); - } - delete p; - return message_box("Rinumerazione numero protocollo completata"); -} - +//*********************************** +//* Rinumerazione numero protocollo * +//*********************************** +#include +#include "cg1300.h" +#include "cg1303.h" + +HIDDEN TAgg_nprot& app() { return (TAgg_nprot&) main_app(); } + +bool TAgg_nprot::filtra_mov(const TRelation* r) +{ + TLocalisamfile& mov = r->lfile(); + + const int annoiva = mov.get_int(MOV_ANNOIVA); + const TString16 reg = mov.get(MOV_REG); + + if (app()._anno == annoiva && app()._reg == reg) + return TRUE; + + return FALSE; +} + +bool TAgg_nprot::create() +{ + TApplication::create(); + + _tabreg = new TTable("REG"); + + dispatch_e_menu (BAR_ITEM(1)); + return TRUE; +} + +bool TAgg_nprot::destroy() +{ + delete _tabreg; + + return TApplication::destroy(); +} + +bool TAgg_nprot::menu(MENU_TAG m) +{ + TMask msk("cg1300b"); + + TConfig conf(CONFIG_DITTA); + int annoiva = conf.get_int("AnLiIv"); + + msk.set(F_ANNO, annoiva); + + while (msk.run() == K_ENTER) + { + _anno = msk.get_int(F_ANNO); + _reg = msk.get(F_REG); + _prot = msk.get_long(F_PROT); + + rinumera_prot(); + + msk.reset(F_REG); + msk.reset(F_PROT); + //return TRUE; + } + + return FALSE; +} + +int TAgg_nprot::rinumera_prot() +{ + TRelation rel (LF_MOV); + TLocalisamfile& mov = rel.lfile(); + + //TString80 filter; + //filter.format("ANNOIVA=%04d && REG=\"%s\"", _anno, (const char*)_reg); + //TCursor cursor(&rel, filter, 2); + + TCursor cursor(&rel, "", 2); + cursor.set_filterfunction(filtra_mov); + + cursor = 0L; + const long nitems = cursor.items(); + + //TProgind p(nitems ? nitems : 1, "Elaborazione in corso..." , TRUE, TRUE, 70); + TProgind* p = NULL; + + if (nitems > 0L) + p = new TProgind (nitems, "Elaborazione in corso..." , TRUE, TRUE, 70); + + long protiva, uprotiva; + + for (; cursor.pos() < cursor.items(); ++cursor) + { + if (p) p->addstatus(1); + protiva = mov.get_long(MOV_PROTIVA); + uprotiva = mov.get_long(MOV_UPROTIVA); + if (protiva != _prot && uprotiva != _prot) continue; + else + { + if (uprotiva != 0l) + _prot = uprotiva; + break; + } + } + + if (protiva != _prot && uprotiva != _prot) //sono alla fine del file + { + delete p; + return message_box("Non trovato record con protocollo indicato: rinumerazione non avvenuta"); + } + + ++cursor; + + long nprot,uprot,dprot; + dprot = uprot = 0L; + nprot = _prot; + + for (; cursor.pos() < cursor.items(); ++cursor) + { + if (p) p->addstatus(1); + protiva = mov.get_long(MOV_PROTIVA); + uprotiva = mov.get_long(MOV_UPROTIVA); + + nprot = nprot+1+dprot; //stile RPG + dprot = 0L; + uprot = 0L; + dprot = (uprotiva == 0L) ? 0L : (uprotiva - protiva); + uprot = (uprotiva == 0L) ? 0L : (nprot + dprot); + + mov.put(MOV_PROTIVA, nprot); + mov.put(MOV_UPROTIVA, uprot); + mov.rewrite(); + } + + TTable reg("REG"); + TString16 s; s.format("%04d%s", _anno, (const char*)_reg); + reg.zero(); + reg.put("CODTAB", s); + if (reg.read() == NOERR) + { + reg.put("I5", nprot + dprot); + reg.rewrite(); + } + else + { + delete p; + return error_box("Impossibile leggere il registro %s anno %s", + (const char*)_reg, (const char*)_anno); + } + delete p; + return message_box("Rinumerazione numero protocollo completata"); +} + diff --git a/cg/cg1303.h b/cg/cg1303.h index 658856b8f..eae6d93d9 100755 --- a/cg/cg1303.h +++ b/cg/cg1303.h @@ -1,29 +1,29 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -class TAgg_nprot : public TApplication -{ - TTable* _tabreg; - TString16 _reg; - int _anno; - long _prot; - -protected: - static bool filtra_mov(const TRelation*); - -public: - virtual bool create(); - virtual bool destroy(); - virtual bool menu(MENU_TAG m); - - int rinumera_prot(); - - TAgg_nprot() : _reg("") {}; - virtual ~TAgg_nprot() {}; +#include +#include +#include +#include +#include +#include +#include +#include + +class TAgg_nprot : public TApplication +{ + TTable* _tabreg; + TString16 _reg; + int _anno; + long _prot; + +protected: + static bool filtra_mov(const TRelation*); + +public: + virtual bool create(); + virtual bool destroy(); + virtual bool menu(MENU_TAG m); + + int rinumera_prot(); + + TAgg_nprot() : _reg("") {}; + virtual ~TAgg_nprot() {}; }; \ No newline at end of file