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
#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

View File

@ -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

View File

@ -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

View File

@ -1,84 +1,84 @@
//**************************************************
//* Aggiornamento Flag Operazioni Intracomunitarie *
//**************************************************
#include <mov.h>
#include <rmoviva.h>
#include <caus.h>
#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 <mov.h>
#include <rmoviva.h>
#include <caus.h>
#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);
}
}
}
}
}

View File

@ -1,23 +1,23 @@
#include <applicat.h>
#include <mask.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <prefix.h>
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 <applicat.h>
#include <mask.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <prefix.h>
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() {};
};

View File

@ -1,159 +1,159 @@
//****************************
//* Aggiornamento Tipo Conto *
//****************************
#include <mov.h>
#include <rmoviva.h>
#include <nditte.h>
#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 <mov.h>
#include <rmoviva.h>
#include <nditte.h>
#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, "");
}

View File

@ -1,27 +1,27 @@
#include <printapp.h>
#include <mask.h>
#include <tabutil.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <prefix.h>
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 <printapp.h>
#include <mask.h>
#include <tabutil.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <prefix.h>
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() {};
};

View File

@ -1,149 +1,149 @@
//***********************************
//* Rinumerazione numero protocollo *
//***********************************
#include <mov.h>
#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 <mov.h>
#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");
}

View File

@ -1,29 +1,29 @@
#include <applicat.h>
#include <mask.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <config.h>
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 <applicat.h>
#include <mask.h>
#include <relation.h>
#include <tabutil.h>
#include <utility.h>
#include <progind.h>
#include <urldefid.h>
#include <config.h>
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() {};
};