Corretta formattazione

git-svn-id: svn://10.65.10.50/trunk@1405 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1995-05-29 10:28:33 +00:00
parent 2a1027fb60
commit 4ca8e85e3b
9 changed files with 612 additions and 612 deletions

View File

@ -1,26 +1,26 @@
#ifndef __CG1300_H #ifndef __CG1300_H
#define __CG1300_H #define __CG1300_H
#define F_CODDITTA 101 #define F_CODDITTA 101
#define F_RAGSOC 102 #define F_RAGSOC 102
#define F_ANNO 103 #define F_ANNO 103
#define F_REG 104 #define F_REG 104
#define F_PROT 105 #define F_PROT 105
#endif // __CG1300_H #endif // __CG1300_H

View File

@ -1,41 +1,41 @@
#include "cg1300.h" #include "cg1300.h"
PAGE "" -1 -1 70 8 PAGE "" -1 -1 70 8
NUMBER F_CODDITTA 5 NUMBER F_CODDITTA 5
BEGIN BEGIN
PROMPT 1 1 "Ditta " PROMPT 1 1 "Ditta "
FLAGS "FRD" FLAGS "FRD"
USE LF_NDITTE KEY 1 USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA INPUT CODDITTA F_CODDITTA
OUTPUT F_CODDITTA CODDITTA OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC OUTPUT F_RAGSOC RAGSOC
END END
STRING F_RAGSOC 50 STRING F_RAGSOC 50
BEGIN BEGIN
PROMPT 1 2 "Ragione sociale " PROMPT 1 2 "Ragione sociale "
FLAGS "D" FLAGS "D"
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 10 2 BUTTON DLG_CANCEL 10 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -1,76 +1,76 @@
#include "cg1300.h" #include "cg1300.h"
PAGE "Rinumerazione numero protocollo" -1 -1 72 12 PAGE "Rinumerazione numero protocollo" -1 -1 72 12
NUMBER F_CODDITTA 5 NUMBER F_CODDITTA 5
BEGIN BEGIN
PROMPT 1 1 "Ditta " PROMPT 1 1 "Ditta "
FLAGS "FRD" FLAGS "FRD"
USE LF_NDITTE KEY 1 USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA INPUT CODDITTA F_CODDITTA
OUTPUT F_CODDITTA CODDITTA OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC OUTPUT F_RAGSOC RAGSOC
END END
STRING F_RAGSOC 50 STRING F_RAGSOC 50
BEGIN BEGIN
PROMPT 1 2 "Ragione sociale " PROMPT 1 2 "Ragione sociale "
FLAGS "D" FLAGS "D"
END END
NUMBER F_ANNO 4 NUMBER F_ANNO 4
BEGIN BEGIN
PROMPT 1 4 "Anno " PROMPT 1 4 "Anno "
HELP "Anno di riferimento" HELP "Anno di riferimento"
//FLAGS "A" //FLAGS "A"
VALIDATE FIXLEN_FUNC 4 VALIDATE FIXLEN_FUNC 4
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Indicare l'anno" WARNING "Indicare l'anno"
END END
STRING F_REG 3 STRING F_REG 3
BEGIN BEGIN
PROMPT 1 5 "Codice registro " PROMPT 1 5 "Codice registro "
USE REG SELECT (I0<"3") && (CODTAB[1,4]==#103) USE REG SELECT (I0<"3") && (CODTAB[1,4]==#103)
INPUT CODTAB[1,4] F_ANNO INPUT CODTAB[1,4] F_ANNO
INPUT CODTAB[5,7] F_REG INPUT CODTAB[5,7] F_REG
DISPLAY "Anno " CODTAB[1,4] DISPLAY "Anno " CODTAB[1,4]
DISPLAY "Codice " CODTAB[5,7] DISPLAY "Codice " CODTAB[5,7]
DISPLAY "Descrizione @40" S0 DISPLAY "Descrizione @40" S0
OUTPUT F_ANNO CODTAB[1,4] OUTPUT F_ANNO CODTAB[1,4]
OUTPUT F_REG CODTAB[5,7] OUTPUT F_REG CODTAB[5,7]
FLAGS "U" FLAGS "U"
VALIDATE ZEROFILL_FUNC 3 VALIDATE ZEROFILL_FUNC 3
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
WARNING "Indicare il codice registro" WARNING "Indicare il codice registro"
END END
NUMBER F_PROT 5 NUMBER F_PROT 5
BEGIN BEGIN
PROMPT 1 6 "Numero di protocollo " PROMPT 1 6 "Numero di protocollo "
HELP "Numero progressivo di protocollo IVA" HELP "Numero progressivo di protocollo IVA"
NUM_EXPR (#F_PROT>0) NUM_EXPR (#F_PROT>0)
WARNING "Inserire un numero maggiore di zero" WARNING "Inserire un numero maggiore di zero"
END END
BUTTON DLG_OK 9 2 BUTTON DLG_OK 9 2
BEGIN BEGIN
PROMPT -12 -1 "" PROMPT -12 -1 ""
END END
BUTTON DLG_CANCEL 9 2 BUTTON DLG_CANCEL 9 2
BEGIN BEGIN
PROMPT -22 -1 "" PROMPT -22 -1 ""
END END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -1,84 +1,84 @@
//************************************************** //**************************************************
//* Aggiornamento Flag Operazioni Intracomunitarie * //* Aggiornamento Flag Operazioni Intracomunitarie *
//************************************************** //**************************************************
#include <mov.h> #include <mov.h>
#include <rmoviva.h> #include <rmoviva.h>
#include <caus.h> #include <caus.h>
#include "cg2103.h" #include "cg2103.h"
#include "cg1301.h" #include "cg1301.h"
bool TAgg_opintra::create() bool TAgg_opintra::create()
{ {
TApplication::create(); TApplication::create();
_causali = new TLocalisamfile(LF_ATTIV); _causali = new TLocalisamfile(LF_ATTIV);
dispatch_e_menu (BAR_ITEM(1)); dispatch_e_menu (BAR_ITEM(1));
return TRUE; return TRUE;
} }
bool TAgg_opintra::destroy() bool TAgg_opintra::destroy()
{ {
delete _causali; delete _causali;
return TApplication::destroy(); return TApplication::destroy();
} }
bool TAgg_opintra::menu(MENU_TAG m) bool TAgg_opintra::menu(MENU_TAG m)
{ {
TMask msk("cg1300a"); TMask msk("cg1300a");
while (msk.run() == K_ENTER) while (msk.run() == K_ENTER)
{ {
look_mov(); look_mov();
message_box("Aggiornamento completato"); message_box("Aggiornamento completato");
//return TRUE; //return TRUE;
} }
return FALSE; return FALSE;
} }
void TAgg_opintra::look_mov() void TAgg_opintra::look_mov()
{ {
TLocalisamfile caus(LF_CAUSALI); TLocalisamfile caus(LF_CAUSALI);
TRelation rel (LF_MOV); TRelation rel (LF_MOV);
rel.add(LF_RMOVIVA, "NUMREG=NUMREG",1); rel.add(LF_RMOVIVA, "NUMREG=NUMREG",1);
TCursor cursor(&rel,"",1); TCursor cursor(&rel,"",1);
TLocalisamfile& mov = rel.lfile(); TLocalisamfile& mov = rel.lfile();
TLocalisamfile& rmoviva = rel.lfile(LF_RMOVIVA); TLocalisamfile& rmoviva = rel.lfile(LF_RMOVIVA);
long ditta = get_firm(); long ditta = get_firm();
cursor = 0L; cursor = 0L;
const long nitems = cursor.items(); const long nitems = cursor.items();
TProgind p(nitems ? nitems : 1, "Aggiornamento in corso..." , TRUE, TRUE, 70); TProgind p(nitems ? nitems : 1, "Aggiornamento in corso..." , TRUE, TRUE, 70);
for (; cursor.pos() < cursor.items(); ++cursor) for (; cursor.pos() < cursor.items(); ++cursor)
{ {
p.addstatus(1); p.addstatus(1);
const TString16 reg(mov.get(MOV_REG)); const TString16 reg(mov.get(MOV_REG));
if (reg.empty()) continue; if (reg.empty()) continue;
const TDate datareg = mov.get_date(MOV_DATAREG); const TDate datareg = mov.get_date(MOV_DATAREG);
if (datareg < "01-01-93") continue; if (datareg < "01-01-93") continue;
const TString16 codcaus(mov.get(MOV_CODCAUS)); const TString16 codcaus(mov.get(MOV_CODCAUS));
if (codcaus.not_empty()) if (codcaus.not_empty())
{ {
caus.setkey(1); caus.setkey(1);
caus.put(CAU_CODCAUS, codcaus); caus.put(CAU_CODCAUS, codcaus);
if (caus.read() == NOERR) if (caus.read() == NOERR)
{ {
bool intra = caus.get_bool(CAU_INTRACOM); bool intra = caus.get_bool(CAU_INTRACOM);
bool ok = rel.is_first_match(LF_RMOVIVA); bool ok = rel.is_first_match(LF_RMOVIVA);
while (ok) while (ok)
{ {
rmoviva.put(RMI_INTRA, intra); rmoviva.put(RMI_INTRA, intra);
rmoviva.rewrite(); rmoviva.rewrite();
ok = rel.next_match(LF_RMOVIVA); ok = rel.next_match(LF_RMOVIVA);
} }
} }
} }
} }
} }

View File

@ -1,23 +1,23 @@
#include <applicat.h> #include <applicat.h>
#include <mask.h> #include <mask.h>
#include <relation.h> #include <relation.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <progind.h> #include <progind.h>
#include <urldefid.h> #include <urldefid.h>
#include <prefix.h> #include <prefix.h>
class TAgg_opintra : public TApplication class TAgg_opintra : public TApplication
{ {
TLocalisamfile* _causali; TLocalisamfile* _causali;
public: public:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG m); virtual bool menu(MENU_TAG m);
void look_mov(); void look_mov();
TAgg_opintra() {}; TAgg_opintra() {};
virtual ~TAgg_opintra() {}; virtual ~TAgg_opintra() {};
}; };

View File

@ -1,159 +1,159 @@
//**************************** //****************************
//* Aggiornamento Tipo Conto * //* Aggiornamento Tipo Conto *
//**************************** //****************************
#include <mov.h> #include <mov.h>
#include <rmoviva.h> #include <rmoviva.h>
#include <nditte.h> #include <nditte.h>
#include "conto.h" #include "conto.h"
#include "cg1302.h" #include "cg1302.h"
const int TAgg_tconto::look_reg (const char* cod, int anno) const int TAgg_tconto::look_reg (const char* cod, int anno)
{ {
TTable tab_reg("REG"); TTable tab_reg("REG");
TString codtab; TString codtab;
codtab.format("%4d%-3s", anno, cod); codtab.format("%4d%-3s", anno, cod);
int tipo_reg; int tipo_reg;
tab_reg.zero(); tab_reg.zero();
tab_reg.put("CODTAB", codtab); tab_reg.put("CODTAB", codtab);
if (tab_reg.read() == NOERR) if (tab_reg.read() == NOERR)
tipo_reg = tab_reg.get_int("I0"); tipo_reg = tab_reg.get_int("I0");
else else
tipo_reg = 0; tipo_reg = 0;
return tipo_reg; return tipo_reg;
} }
bool TAgg_tconto::user_create() bool TAgg_tconto::user_create()
{ {
_rel = new TRelation(LF_MOV); _rel = new TRelation(LF_MOV);
_rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1); _rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
_cur = new TCursor(_rel,"",1); _cur = new TCursor(_rel,"",1);
add_cursor(_cur); add_cursor(_cur);
add_file (LF_MOV); add_file (LF_MOV);
add_file (LF_RMOVIVA); add_file (LF_RMOVIVA);
_pcon = new TLocalisamfile(LF_PCON); _pcon = new TLocalisamfile(LF_PCON);
_nditte = new TLocalisamfile(LF_NDITTE); _nditte = new TLocalisamfile(LF_NDITTE);
_tabreg = new TTable("REG"); _tabreg = new TTable("REG");
return TRUE; return TRUE;
} }
bool TAgg_tconto::user_destroy() bool TAgg_tconto::user_destroy()
{ {
delete _rel; delete _rel;
delete _cur; delete _cur;
delete _pcon; delete _pcon;
delete _nditte; delete _nditte;
delete _tabreg; delete _tabreg;
return TRUE; return TRUE;
} }
bool TAgg_tconto::set_print(int) bool TAgg_tconto::set_print(int)
{ {
TMask msk("cg1300a"); TMask msk("cg1300a");
while (msk.run() == K_ENTER) while (msk.run() == K_ENTER)
{ {
setta_intestazione(); setta_intestazione();
printer().footerlen(5); printer().footerlen(5);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
bool TAgg_tconto::preprocess_page(int file,int counter) bool TAgg_tconto::preprocess_page(int file,int counter)
{ {
if (counter) return TRUE; if (counter) return TRUE;
TCursor* cur = current_cursor(); TCursor* cur = current_cursor();
if (file == LF_MOV) if (file == LF_MOV)
{ {
TString16 reg = cur->curr().get(MOV_REG); TString16 reg = cur->curr().get(MOV_REG);
if (reg.empty()) return FALSE; if (reg.empty()) return FALSE;
} }
else if (file == LF_RMOVIVA) else if (file == LF_RMOVIVA)
{ {
TRectype pcon(LF_PCON); TRectype pcon(LF_PCON);
int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO); int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO);
int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO); int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO); long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG); long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG);
int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP"); int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP");
TBill tc (gruppo,conto,0L); TBill tc (gruppo,conto,0L);
tc.read(pcon); tc.read(pcon);
if (!pcon.empty()) if (!pcon.empty())
if (pcon.get_char("TMCF") != '\0') if (pcon.get_char("TMCF") != '\0')
return FALSE; return FALSE;
tc.set(gruppo,conto,sottoconto); tc.set(gruppo,conto,sottoconto);
tc.read(pcon); tc.read(pcon);
if (!pcon.empty()) if (!pcon.empty())
{ {
if (tc.sospeso()) if (tc.sospeso())
{ {
set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto sospeso **", set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto sospeso **",
numreg, nrigimp, gruppo, conto, sottoconto); numreg, nrigimp, gruppo, conto, sottoconto);
return TRUE; return TRUE;
} }
TString16 reg = cur->curr().get(MOV_REG); TString16 reg = cur->curr().get(MOV_REG);
int annoiva = cur->curr().get_int(MOV_ANNOIVA); int annoiva = cur->curr().get_int(MOV_ANNOIVA);
if (look_reg(reg, annoiva) == 1) //cerca il tipo del registro if (look_reg(reg, annoiva) == 1) //cerca il tipo del registro
{ {
int t = tc.tipo_cr(); int t = tc.tipo_cr();
if (t == 2 || t == 3 || t == 8) if (t == 2 || t == 3 || t == 8)
{ {
_rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4); _rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4);
_rel->lfile(LF_RMOVIVA).rewrite(); _rel->lfile(LF_RMOVIVA).rewrite();
} }
} }
} }
else else
{ {
set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto inesistente **", set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto inesistente **",
numreg, nrigimp, gruppo, conto, sottoconto); numreg, nrigimp, gruppo, conto, sottoconto);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
void TAgg_tconto::setta_intestazione() void TAgg_tconto::setta_intestazione()
{ {
int soh = 1; int soh = 1;
TString sep(132); TString sep(132);
TString ragsoc(50); TString ragsoc(50);
TLocalisamfile nditte(LF_NDITTE); TLocalisamfile nditte(LF_NDITTE);
nditte.zero(); nditte.zero();
nditte.put(NDT_CODDITTA, get_firm()); nditte.put(NDT_CODDITTA, get_firm());
if (nditte.read() == NOERR) if (nditte.read() == NOERR)
ragsoc = nditte.get(NDT_RAGSOC); ragsoc = nditte.get(NDT_RAGSOC);
reset_header(); reset_header();
sep << "Ditta " << get_firm(); sep << "Ditta " << get_firm();
sep << " " << ragsoc; sep << " " << ragsoc;
sep.left_just(132); sep.left_just(132);
set_header (soh++, (const char*) sep); set_header (soh++, (const char*) sep);
sep = ""; sep = "";
sep << "Data @< Pag. @#"; sep << "Data @< Pag. @#";
sep.right_just(127); sep.right_just(127);
sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori"); sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori");
set_header (soh++, (const char*)sep); set_header (soh++, (const char*)sep);
sep.fill('-'); sep.fill('-');
set_header (soh++, (const char *) sep); set_header (soh++, (const char *) sep);
set_header (soh++, "Numero Registrazione Riga Gruppo Conto Sottoconto"); set_header (soh++, "Numero Registrazione Riga Gruppo Conto Sottoconto");
set_header (soh++, (const char *) sep); set_header (soh++, (const char *) sep);
set_header (soh, ""); set_header (soh, "");
} }

View File

@ -1,27 +1,27 @@
#include <printapp.h> #include <printapp.h>
#include <mask.h> #include <mask.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <progind.h> #include <progind.h>
#include <urldefid.h> #include <urldefid.h>
#include <prefix.h> #include <prefix.h>
class TAgg_tconto : public TPrintapp class TAgg_tconto : public TPrintapp
{ {
TLocalisamfile* _pcon,* _nditte; TLocalisamfile* _pcon,* _nditte;
TTable* _tabreg; TTable* _tabreg;
TRelation* _rel; TRelation* _rel;
TCursor* _cur; TCursor* _cur;
public: public:
virtual bool user_create(); virtual bool user_create();
virtual bool user_destroy(); virtual bool user_destroy();
virtual bool set_print(int i); virtual bool set_print(int i);
virtual bool preprocess_page(int, int); virtual bool preprocess_page(int, int);
void setta_intestazione(); void setta_intestazione();
const int look_reg(const char*, int); const int look_reg(const char*, int);
TAgg_tconto() {}; TAgg_tconto() {};
virtual ~TAgg_tconto() {}; virtual ~TAgg_tconto() {};
}; };

View File

@ -1,149 +1,149 @@
//*********************************** //***********************************
//* Rinumerazione numero protocollo * //* Rinumerazione numero protocollo *
//*********************************** //***********************************
#include <mov.h> #include <mov.h>
#include "cg1300.h" #include "cg1300.h"
#include "cg1303.h" #include "cg1303.h"
HIDDEN TAgg_nprot& app() { return (TAgg_nprot&) main_app(); } HIDDEN TAgg_nprot& app() { return (TAgg_nprot&) main_app(); }
bool TAgg_nprot::filtra_mov(const TRelation* r) bool TAgg_nprot::filtra_mov(const TRelation* r)
{ {
TLocalisamfile& mov = r->lfile(); TLocalisamfile& mov = r->lfile();
const int annoiva = mov.get_int(MOV_ANNOIVA); const int annoiva = mov.get_int(MOV_ANNOIVA);
const TString16 reg = mov.get(MOV_REG); const TString16 reg = mov.get(MOV_REG);
if (app()._anno == annoiva && app()._reg == reg) if (app()._anno == annoiva && app()._reg == reg)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
bool TAgg_nprot::create() bool TAgg_nprot::create()
{ {
TApplication::create(); TApplication::create();
_tabreg = new TTable("REG"); _tabreg = new TTable("REG");
dispatch_e_menu (BAR_ITEM(1)); dispatch_e_menu (BAR_ITEM(1));
return TRUE; return TRUE;
} }
bool TAgg_nprot::destroy() bool TAgg_nprot::destroy()
{ {
delete _tabreg; delete _tabreg;
return TApplication::destroy(); return TApplication::destroy();
} }
bool TAgg_nprot::menu(MENU_TAG m) bool TAgg_nprot::menu(MENU_TAG m)
{ {
TMask msk("cg1300b"); TMask msk("cg1300b");
TConfig conf(CONFIG_DITTA); TConfig conf(CONFIG_DITTA);
int annoiva = conf.get_int("AnLiIv"); int annoiva = conf.get_int("AnLiIv");
msk.set(F_ANNO, annoiva); msk.set(F_ANNO, annoiva);
while (msk.run() == K_ENTER) while (msk.run() == K_ENTER)
{ {
_anno = msk.get_int(F_ANNO); _anno = msk.get_int(F_ANNO);
_reg = msk.get(F_REG); _reg = msk.get(F_REG);
_prot = msk.get_long(F_PROT); _prot = msk.get_long(F_PROT);
rinumera_prot(); rinumera_prot();
msk.reset(F_REG); msk.reset(F_REG);
msk.reset(F_PROT); msk.reset(F_PROT);
//return TRUE; //return TRUE;
} }
return FALSE; return FALSE;
} }
int TAgg_nprot::rinumera_prot() int TAgg_nprot::rinumera_prot()
{ {
TRelation rel (LF_MOV); TRelation rel (LF_MOV);
TLocalisamfile& mov = rel.lfile(); TLocalisamfile& mov = rel.lfile();
//TString80 filter; //TString80 filter;
//filter.format("ANNOIVA=%04d && REG=\"%s\"", _anno, (const char*)_reg); //filter.format("ANNOIVA=%04d && REG=\"%s\"", _anno, (const char*)_reg);
//TCursor cursor(&rel, filter, 2); //TCursor cursor(&rel, filter, 2);
TCursor cursor(&rel, "", 2); TCursor cursor(&rel, "", 2);
cursor.set_filterfunction(filtra_mov); cursor.set_filterfunction(filtra_mov);
cursor = 0L; cursor = 0L;
const long nitems = cursor.items(); const long nitems = cursor.items();
//TProgind p(nitems ? nitems : 1, "Elaborazione in corso..." , TRUE, TRUE, 70); //TProgind p(nitems ? nitems : 1, "Elaborazione in corso..." , TRUE, TRUE, 70);
TProgind* p = NULL; TProgind* p = NULL;
if (nitems > 0L) if (nitems > 0L)
p = new TProgind (nitems, "Elaborazione in corso..." , TRUE, TRUE, 70); p = new TProgind (nitems, "Elaborazione in corso..." , TRUE, TRUE, 70);
long protiva, uprotiva; long protiva, uprotiva;
for (; cursor.pos() < cursor.items(); ++cursor) for (; cursor.pos() < cursor.items(); ++cursor)
{ {
if (p) p->addstatus(1); if (p) p->addstatus(1);
protiva = mov.get_long(MOV_PROTIVA); protiva = mov.get_long(MOV_PROTIVA);
uprotiva = mov.get_long(MOV_UPROTIVA); uprotiva = mov.get_long(MOV_UPROTIVA);
if (protiva != _prot && uprotiva != _prot) continue; if (protiva != _prot && uprotiva != _prot) continue;
else else
{ {
if (uprotiva != 0l) if (uprotiva != 0l)
_prot = uprotiva; _prot = uprotiva;
break; break;
} }
} }
if (protiva != _prot && uprotiva != _prot) //sono alla fine del file if (protiva != _prot && uprotiva != _prot) //sono alla fine del file
{ {
delete p; delete p;
return message_box("Non trovato record con protocollo indicato: rinumerazione non avvenuta"); return message_box("Non trovato record con protocollo indicato: rinumerazione non avvenuta");
} }
++cursor; ++cursor;
long nprot,uprot,dprot; long nprot,uprot,dprot;
dprot = uprot = 0L; dprot = uprot = 0L;
nprot = _prot; nprot = _prot;
for (; cursor.pos() < cursor.items(); ++cursor) for (; cursor.pos() < cursor.items(); ++cursor)
{ {
if (p) p->addstatus(1); if (p) p->addstatus(1);
protiva = mov.get_long(MOV_PROTIVA); protiva = mov.get_long(MOV_PROTIVA);
uprotiva = mov.get_long(MOV_UPROTIVA); uprotiva = mov.get_long(MOV_UPROTIVA);
nprot = nprot+1+dprot; //stile RPG nprot = nprot+1+dprot; //stile RPG
dprot = 0L; dprot = 0L;
uprot = 0L; uprot = 0L;
dprot = (uprotiva == 0L) ? 0L : (uprotiva - protiva); dprot = (uprotiva == 0L) ? 0L : (uprotiva - protiva);
uprot = (uprotiva == 0L) ? 0L : (nprot + dprot); uprot = (uprotiva == 0L) ? 0L : (nprot + dprot);
mov.put(MOV_PROTIVA, nprot); mov.put(MOV_PROTIVA, nprot);
mov.put(MOV_UPROTIVA, uprot); mov.put(MOV_UPROTIVA, uprot);
mov.rewrite(); mov.rewrite();
} }
TTable reg("REG"); TTable reg("REG");
TString16 s; s.format("%04d%s", _anno, (const char*)_reg); TString16 s; s.format("%04d%s", _anno, (const char*)_reg);
reg.zero(); reg.zero();
reg.put("CODTAB", s); reg.put("CODTAB", s);
if (reg.read() == NOERR) if (reg.read() == NOERR)
{ {
reg.put("I5", nprot + dprot); reg.put("I5", nprot + dprot);
reg.rewrite(); reg.rewrite();
} }
else else
{ {
delete p; delete p;
return error_box("Impossibile leggere il registro %s anno %s", return error_box("Impossibile leggere il registro %s anno %s",
(const char*)_reg, (const char*)_anno); (const char*)_reg, (const char*)_anno);
} }
delete p; delete p;
return message_box("Rinumerazione numero protocollo completata"); return message_box("Rinumerazione numero protocollo completata");
} }

View File

@ -1,29 +1,29 @@
#include <applicat.h> #include <applicat.h>
#include <mask.h> #include <mask.h>
#include <relation.h> #include <relation.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <progind.h> #include <progind.h>
#include <urldefid.h> #include <urldefid.h>
#include <config.h> #include <config.h>
class TAgg_nprot : public TApplication class TAgg_nprot : public TApplication
{ {
TTable* _tabreg; TTable* _tabreg;
TString16 _reg; TString16 _reg;
int _anno; int _anno;
long _prot; long _prot;
protected: protected:
static bool filtra_mov(const TRelation*); static bool filtra_mov(const TRelation*);
public: public:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual bool menu(MENU_TAG m); virtual bool menu(MENU_TAG m);
int rinumera_prot(); int rinumera_prot();
TAgg_nprot() : _reg("") {}; TAgg_nprot() : _reg("") {};
virtual ~TAgg_nprot() {}; virtual ~TAgg_nprot() {};
}; };