Aggiornato uso di TRelation::lfile e main_app
Aggiunto programma cancellazione movimenti provvisori git-svn-id: svn://10.65.10.50/trunk@276 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5e9b747386
commit
ab754188c1
cg
Attic
cg0.cppcg0100.cppcg0200.cppcg0201.cppcg0201.hcg0400.cppcg0500.cppcg0500a.umlcg1300.cppcg1400.cppcg1700.cppcg2.cppcg2.hcg2.urlcg2100.cppcg2100b.umlcg2101.cppcg2101.hcg2102.cppcg2102.hcg2103.cppcg2103.hcg2200.cppcg2200.hcg2200a.umlcg3100.cppcg3200.cppcg3300.cppcg3301.cppcg3400.cppcg4300.cppcg4303.cppcg4304.cppcg4305.cppcg4400.cppcglib.hconto.cppconto.h@ -276,13 +276,13 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
chiave = d; chiave << format("%04d%02d%d", _anno, _mese, _tipo);
|
||||
delega.put("CODTAB", chiave);
|
||||
|
||||
f.cursor()->file()->read();
|
||||
f.cursor()->file().read();
|
||||
const bool cera = atoi(delega.get("S7")) != 0;
|
||||
if (!cera)
|
||||
{
|
||||
delega.put("S7", _azienda);
|
||||
delega.put("S8", _dipendenza);
|
||||
f.cursor()->file()->rewrite();
|
||||
f.cursor()->file().rewrite();
|
||||
}
|
||||
f.cursor()->read(); // Posiziona il cursore
|
||||
|
||||
@ -303,7 +303,7 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
scrivi = TRUE;
|
||||
}
|
||||
if (scrivi)
|
||||
f.cursor()->file()->rewrite();
|
||||
f.cursor()->file().rewrite();
|
||||
}
|
||||
printer().close();
|
||||
|
||||
|
92
cg/cg0.cpp
92
cg/cg0.cpp
@ -1,46 +1,46 @@
|
||||
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
//#include <stdlib.h>
|
||||
#include "cg0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int op = argc < 2 ? 0 : atoi(argv[1]+1)+1;
|
||||
int res = 1;
|
||||
switch (op)
|
||||
{
|
||||
case 1: res = cg0100(argc,argv) ; break;
|
||||
case 2: res = cg0200(argc,argv) ; break;
|
||||
case 3: res = cg0300(argc,argv) ; break;
|
||||
case 4: res = cg0400(argc,argv) ; break;
|
||||
case 5: res = cg0500(argc,argv) ; break;
|
||||
// case 6: res = cg0600(argc,argv) ; break;
|
||||
default: error_box(usage, argv[0]); break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
//#include <stdlib.h>
|
||||
#include "cg0.h"
|
||||
|
||||
#define usage "Error - usage : %s -{0|1|2|3|4|5}"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int op = argc < 2 ? 0 : atoi(argv[1]+1)+1;
|
||||
int res = 1;
|
||||
switch (op)
|
||||
{
|
||||
case 1: res = cg0100(argc,argv) ; break;
|
||||
case 2: res = cg0200(argc,argv) ; break;
|
||||
case 3: res = cg0300(argc,argv) ; break;
|
||||
case 4: res = cg0400(argc,argv) ; break;
|
||||
case 5: res = cg0500(argc,argv) ; break;
|
||||
// case 6: res = cg0600(argc,argv) ; break;
|
||||
default: error_box(usage, argv[0]); break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
bool CG0100_application::protected_record(TRectype &rec)
|
||||
{
|
||||
TMask* m = get_mask(MODE_MOD);
|
||||
TLocalisamfile& pconti = *_rel->lfile();
|
||||
TLocalisamfile& pconti = _rel->lfile();
|
||||
const int gruppo = atoi(m->get(FLD_CM1_GRUPPO));
|
||||
const int conto = atoi(m->get(FLD_CM1_CONTO));
|
||||
const long sottoc = atol(m->get(FLD_CM1_SOTTOCONTO));
|
||||
@ -138,7 +138,7 @@ void CG0100_application::init_insert_mode(TMask& m)
|
||||
else
|
||||
m.send_key(K_SHIFT + K_CTRL + 'h', -3);
|
||||
|
||||
TLocalisamfile& pconti = *_rel->lfile();
|
||||
TLocalisamfile& pconti = _rel->lfile();
|
||||
TString s(15), s2(1), s3(8), s4(2);
|
||||
int s1 = 0;
|
||||
|
||||
@ -229,7 +229,7 @@ HIDDEN bool gruppo_handler(TMask_field& f, KEY key)
|
||||
const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO));
|
||||
const TFixed_string descrizione(m.get(FLD_CM1_DESC));
|
||||
CG0100_application* app = (CG0100_application*) MainApp();
|
||||
TLocalisamfile& pconti = *app->get_relation()->lfile();
|
||||
TLocalisamfile& pconti = app->get_relation()->lfile();
|
||||
|
||||
if (gruppo == 0 && conto == 0 && sottoc == 0 && descrizione.not_empty())
|
||||
return TRUE;
|
||||
|
1262
cg/cg0200.cpp
1262
cg/cg0200.cpp
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,7 @@
|
||||
#include "cg0201.h"
|
||||
<<<<<<< cg0201.cpp
|
||||
=======
|
||||
#include <lffiles.h>
|
||||
|
||||
#include <clifo.h>
|
||||
#include <indsp.h>
|
||||
>>>>>>> 1.4
|
||||
|
||||
|
||||
extern bool gest_vend();
|
||||
// Definizione dei metodi relativi alla classe TClifoVI
|
||||
@ -36,7 +32,7 @@ TRectype& TClifoVI::indirizzo(int i)
|
||||
|
||||
int TClifoVI::read_indirizzi()
|
||||
{
|
||||
const TLocalisamfile* rind = lfile(LF_INDSP);
|
||||
const TLocalisamfile& rind = lfile(LF_INDSP);
|
||||
// Put here gest_vend() discrimination
|
||||
if (gest_vend())
|
||||
{
|
||||
@ -44,8 +40,8 @@ int TClifoVI::read_indirizzi()
|
||||
destroy_rows();
|
||||
for (bool ok=is_first_match(LF_INDSP); ok; ok=next_match(LF_INDSP))
|
||||
{
|
||||
const int nriga=rind->get_int(IND_CODIND) -1;
|
||||
indirizzo(nriga)=rind->curr();
|
||||
const int nriga=rind.get_int(IND_CODIND) -1;
|
||||
indirizzo(nriga)=rind.curr();
|
||||
}
|
||||
}
|
||||
_oldindirizzi=indirizzi_items();
|
||||
@ -54,55 +50,55 @@ int TClifoVI::read_indirizzi()
|
||||
|
||||
int TClifoVI::read(TIsamop op, TReclock lockop, TDate& atdate)
|
||||
{
|
||||
int err=file()->read(op,lockop,atdate);
|
||||
int err=file().read(op,lockop,atdate);
|
||||
if (err==NOERR) read_indirizzi();
|
||||
return err;
|
||||
}
|
||||
|
||||
int TClifoVI::write_rec(bool re, const TRectype& rec, TLocalisamfile* f)
|
||||
int TClifoVI::write_rec(bool re, const TRectype& rec, TLocalisamfile& f)
|
||||
{
|
||||
if (re)
|
||||
{
|
||||
const bool scrivi= (f->rewrite(rec)!=NOERR);
|
||||
if (scrivi) f->write(rec);
|
||||
const bool scrivi= (f.rewrite(rec)!=NOERR);
|
||||
if (scrivi) f.write(rec);
|
||||
} else
|
||||
f->write(rec);
|
||||
return f->status();
|
||||
f.write(rec);
|
||||
return f.status();
|
||||
}
|
||||
|
||||
int TClifoVI::cancella(TLocalisamfile* f, int da, int a)
|
||||
int TClifoVI::cancella(TLocalisamfile& f, int da, int a)
|
||||
{
|
||||
const char tipocf=lfile()->get(IND_TIPOCF)[0];
|
||||
const long codcf=lfile()->get_long(IND_CODCF);
|
||||
const char tipocf=lfile().get(IND_TIPOCF)[0];
|
||||
const long codcf=lfile().get_long(IND_CODCF);
|
||||
|
||||
for (int i=da; i<=a;i++)
|
||||
{
|
||||
f->zero();
|
||||
f->put(IND_TIPOCF,tipocf);
|
||||
f->put(IND_CODCF,codcf);
|
||||
f->put(IND_CODIND,i);
|
||||
if (f->read(_isequal,_lock)==NOERR)
|
||||
f->remove();
|
||||
f.zero();
|
||||
f.put(IND_TIPOCF,tipocf);
|
||||
f.put(IND_CODCF,codcf);
|
||||
f.put(IND_CODIND,i);
|
||||
if (f.read(_isequal,_lock)==NOERR)
|
||||
f.remove();
|
||||
}
|
||||
return f->status();
|
||||
return f.status();
|
||||
}
|
||||
|
||||
int TClifoVI::registra(bool re, bool force)
|
||||
{
|
||||
TLocalisamfile* c=lfile(LF_CLIFO);
|
||||
int err=write_rec(re,c->curr(),c);
|
||||
TLocalisamfile& c=lfile(LF_CLIFO);
|
||||
int err=write_rec(re,c.curr(),c);
|
||||
if (err!=NOERR) return err;
|
||||
|
||||
// Put here gest_vend() discrimination
|
||||
if (gest_vend())
|
||||
{
|
||||
TLocalisamfile* v=lfile(LF_CFVEN);
|
||||
err=write_rec(TRUE,v->curr(),v);
|
||||
TLocalisamfile& v=lfile(LF_CFVEN);
|
||||
err=write_rec(TRUE,v.curr(),v);
|
||||
if (err!=NOERR) return err;
|
||||
|
||||
TLocalisamfile* rind=lfile(LF_INDSP);
|
||||
const char tipocf=c->get(CLI_TIPOCF)[0];
|
||||
const long codcf=c->get_long(CLI_CODCF);
|
||||
TLocalisamfile& rind=lfile(LF_INDSP);
|
||||
const char tipocf=c.get(CLI_TIPOCF)[0];
|
||||
const long codcf=c.get_long(CLI_CODCF);
|
||||
|
||||
for (int i=0; i<indirizzi_items(); i++)
|
||||
{
|
||||
@ -134,19 +130,19 @@ int TClifoVI::rewrite(bool force, TDate&)
|
||||
|
||||
int TClifoVI::remove(TDate&)
|
||||
{
|
||||
TLocalisamfile* c=lfile(LF_CLIFO);
|
||||
TLocalisamfile& c=lfile(LF_CLIFO);
|
||||
|
||||
c->remove();
|
||||
c.remove();
|
||||
|
||||
// Put here gest_vend() discrimination
|
||||
if (gest_vend())
|
||||
{
|
||||
TLocalisamfile* v=lfile(LF_CFVEN);
|
||||
TLocalisamfile* rind=lfile(LF_INDSP);
|
||||
TLocalisamfile& v=lfile(LF_CFVEN);
|
||||
TLocalisamfile& rind=lfile(LF_INDSP);
|
||||
cancella(rind,1,_oldindirizzi);
|
||||
v->remove();
|
||||
v.remove();
|
||||
}
|
||||
_oldindirizzi=0;
|
||||
|
||||
return c->status();
|
||||
return c.status();
|
||||
}
|
||||
|
70
cg/cg0201.h
70
cg/cg0201.h
@ -1,35 +1,35 @@
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
class TClifoVI:public TRelation
|
||||
{
|
||||
// @DPRIV
|
||||
TArray _indirizzi;
|
||||
int _oldindirizzi;
|
||||
// @END
|
||||
protected:
|
||||
// @FPROT
|
||||
int write_rec(bool re, const TRectype& r, TLocalisamfile* f);
|
||||
int cancella(TLocalisamfile* f, int da, int a);
|
||||
int registra(bool re, bool force);
|
||||
int read_indirizzi();
|
||||
// @END
|
||||
public:
|
||||
virtual int next(TReclock lockop=_nolock) {return (lfile()->next(lockop) || read_indirizzi());}
|
||||
virtual int prev(TReclock lockop=_nolock) {return (lfile()->prev(lockop) || read_indirizzi());}
|
||||
virtual int first(TReclock lockop=_nolock) {return (lfile()->first(lockop) || read_indirizzi());}
|
||||
virtual int last(TReclock lockop=_nolock) {return (lfile()->last(lockop) || read_indirizzi());}
|
||||
virtual int skip(TReclock lockop=_nolock) {return (lfile()->skip(lockop) || read_indirizzi());}
|
||||
virtual int read(TIsamop = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&) botime);
|
||||
virtual int write(bool force=TRUE, TDate& atdate = (TDate&) botime);
|
||||
virtual int rewrite(bool force=TRUE, TDate& atdate = (TDate&) botime);
|
||||
virtual int remove(TDate& atdate = (TDate&) botime);
|
||||
|
||||
TRectype& indirizzo(int i);
|
||||
int indirizzi_items() const {return _indirizzi.items();}
|
||||
void destroy_rows();
|
||||
|
||||
TClifoVI();
|
||||
virtual ~TClifoVI() {}
|
||||
};
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
class TClifoVI:public TRelation
|
||||
{
|
||||
// @DPRIV
|
||||
TArray _indirizzi;
|
||||
int _oldindirizzi;
|
||||
// @END
|
||||
protected:
|
||||
// @FPROT
|
||||
int write_rec(bool re, const TRectype& r, TLocalisamfile& f);
|
||||
int cancella(TLocalisamfile& f, int da, int a);
|
||||
int registra(bool re, bool force);
|
||||
int read_indirizzi();
|
||||
// @END
|
||||
public:
|
||||
virtual int next(TReclock lockop=_nolock) {return (lfile().next(lockop) || read_indirizzi());}
|
||||
virtual int prev(TReclock lockop=_nolock) {return (lfile().prev(lockop) || read_indirizzi());}
|
||||
virtual int first(TReclock lockop=_nolock) {return (lfile().first(lockop) || read_indirizzi());}
|
||||
virtual int last(TReclock lockop=_nolock) {return (lfile().last(lockop) || read_indirizzi());}
|
||||
virtual int skip(TReclock lockop=_nolock) {return (lfile().skip(lockop) || read_indirizzi());}
|
||||
virtual int read(TIsamop = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&) botime);
|
||||
virtual int write(bool force=TRUE, TDate& atdate = (TDate&) botime);
|
||||
virtual int rewrite(bool force=TRUE, TDate& atdate = (TDate&) botime);
|
||||
virtual int remove(TDate& atdate = (TDate&) botime);
|
||||
|
||||
TRectype& indirizzo(int i);
|
||||
int indirizzi_items() const {return _indirizzi.items();}
|
||||
void destroy_rows();
|
||||
|
||||
TClifoVI();
|
||||
virtual ~TClifoVI() {}
|
||||
};
|
||||
|
836
cg/cg0400.cpp
836
cg/cg0400.cpp
@ -1,418 +1,418 @@
|
||||
#include <applicat.h>
|
||||
#include <date.h>
|
||||
#include <lffiles.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
#include <printapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <nditte.h>
|
||||
#include <anagr.h>
|
||||
#include <comuni.h>
|
||||
#include "cg0.h"
|
||||
#include "cg0400.h"
|
||||
|
||||
|
||||
class CG0400_application : public TPrintapp
|
||||
{
|
||||
|
||||
TTable* _tabpim, * _tabreg;
|
||||
TLocalisamfile* _nditte, * _attiv, * _anag, * _com;
|
||||
TMask* _msk;
|
||||
TDate _data;
|
||||
int _i, _sospmsk, _tipoprog, _livelloprog, _tipo_crmsk;
|
||||
TString _cap,_cofi,_paiva,_ragsoc,_comunefis,_provfis,_viafis,_codivamsk,_codattmsk;
|
||||
bool _vuoilordi;
|
||||
real _imponibile, _imposta, _lordo, _imponibile_v, _imposta_v, _lordo_v;
|
||||
real _imponibile_vs, _imposta_vs, _lordo_vs, _totimponibile_v, _totimposta_v;
|
||||
real _totlordo_v, _totimponibile_vs, _totimposta_vs, _totlordo_vs, _imponibile_acq;
|
||||
real _imposta_acq, _lordo_acq, _totimponibile_acq, _totimposta_acq, _totlordo_acq;
|
||||
|
||||
public:
|
||||
void user_create();
|
||||
void user_destroy();
|
||||
bool set_print(int);
|
||||
|
||||
bool menu(MENU_TAG m) { return TPrintapp::menu(m); }
|
||||
|
||||
virtual void preprocess_header();
|
||||
virtual bool preprocess_page(int,int);
|
||||
virtual print_action postprocess_page(int,int);
|
||||
virtual bool preprocess_print(int,int);
|
||||
|
||||
void fai_ricerca(int);
|
||||
void get_dati_ditta();
|
||||
int stampa_intestazione_ditta();
|
||||
|
||||
public:
|
||||
CG0400_application(){};
|
||||
};
|
||||
|
||||
|
||||
void CG0400_application::user_create()
|
||||
{
|
||||
_tabpim = new TTable(TAB_PIM);
|
||||
_tabreg = new TTable(TAB_REG);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_attiv = new TLocalisamfile(LF_ATTIV);
|
||||
_com = new TLocalisamfile(LF_COMUNI);
|
||||
_msk = new TMask("cg0400a");
|
||||
}
|
||||
|
||||
void CG0400_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _tabpim;
|
||||
delete _tabreg;
|
||||
delete _anag;
|
||||
delete _nditte;
|
||||
delete _com;
|
||||
delete _attiv;
|
||||
}
|
||||
|
||||
void CG0400_application::fai_ricerca(int i)
|
||||
{
|
||||
TString codtab,codreg,dep,codiva,codatt;
|
||||
int mese;
|
||||
long anno;
|
||||
|
||||
_imponibile=0;
|
||||
_imponibile_v=0;
|
||||
_imponibile_vs=0;
|
||||
_imposta=0;
|
||||
_imposta_v=0;
|
||||
_imposta_vs=0;
|
||||
_lordo=0;
|
||||
_lordo_v=0;
|
||||
_lordo_vs=0;
|
||||
_imponibile_acq=0;
|
||||
_imposta_acq=0;
|
||||
_lordo_acq=0;
|
||||
|
||||
_tabpim->first();
|
||||
while (!_tabpim->eof()) //Scorre tutti i record della tabella PIM
|
||||
{
|
||||
_imponibile = 0;
|
||||
_imposta = 0;
|
||||
_lordo = 0;
|
||||
codtab = _tabpim->curr().get("CODTAB");
|
||||
mese = atoi(codtab.mid(12,2));
|
||||
if (_livelloprog == 1) //Se si tratta di una aliquota
|
||||
{
|
||||
codiva = codtab.mid(15,3);
|
||||
codatt = codtab.mid(4,5);
|
||||
}
|
||||
else //altrimenti se si tratta di una attivita'
|
||||
{
|
||||
codatt = codtab.mid(4,5);
|
||||
codiva = codtab.mid(55,3);
|
||||
}
|
||||
if (((mese==i)&&(codiva==_codivamsk))||((mese==i)&&(codatt==_codattmsk)))
|
||||
{
|
||||
codreg = codtab.mid(9,3);
|
||||
anno = atoi(codtab.mid(0,4));
|
||||
_tabreg->curr().zero();
|
||||
dep = format("%04d", anno);
|
||||
dep << format("%3s", (const char*)codreg);
|
||||
_tabreg->curr().put("CODTAB", (const char*)dep);
|
||||
_tabreg->read();
|
||||
if (_tabreg->bad())
|
||||
_tabreg->curr().zero();
|
||||
int tipo = atoi(_tabreg->curr().get("I0"));
|
||||
if ((tipo == 1) && (_tipoprog == 1)) //Se si tratta di una vendita
|
||||
{
|
||||
int tipo_importo = (int) _tabreg->curr().get_long("I0");
|
||||
bool sosp = _tabreg->curr().get_bool("B0");
|
||||
if (tipo_importo == 1) // 1=importo netto 2=importo lordo
|
||||
{
|
||||
_imponibile = _tabpim->curr().get_real("R0");
|
||||
|
||||
_imposta = _tabpim->curr().get_real("R1");
|
||||
}
|
||||
else
|
||||
_lordo = _tabpim->curr().get_real("R2");
|
||||
if (sosp) //Se e' una vendita in sospensione d'imposta
|
||||
{
|
||||
_imponibile_vs += _imponibile;
|
||||
_imposta_vs += _imposta;
|
||||
_lordo_vs += _lordo;
|
||||
}
|
||||
else
|
||||
{
|
||||
_imponibile_v += _imponibile;
|
||||
_imposta_v += _imposta;
|
||||
_lordo_v += _lordo;
|
||||
}
|
||||
}
|
||||
else if ((tipo == 2) && (_tipoprog == 2)) //Se si tratta di un acquisto
|
||||
{
|
||||
int tipo_importo = atoi(codtab.mid(15,1));
|
||||
int tipo_cr = atoi(codtab.mid(14,1));
|
||||
if (_tipo_crmsk == tipo_cr)
|
||||
{
|
||||
if (tipo_importo == 1) // 1=importo netto 2=importo lordo
|
||||
{
|
||||
_imponibile = _tabpim->curr().get_real("R0");
|
||||
|
||||
_imposta = _tabpim->curr().get_real("R1");
|
||||
}
|
||||
else
|
||||
_lordo = _tabpim->curr().get_real("R2");
|
||||
|
||||
_imponibile_acq += _imponibile;
|
||||
_imposta_acq += _imposta;
|
||||
_lordo_acq += _lordo;
|
||||
}
|
||||
}
|
||||
}
|
||||
_tabpim->next();
|
||||
}
|
||||
|
||||
_totimponibile_v+=_imponibile_v;
|
||||
_totimposta_v+=_imposta_v;
|
||||
_totlordo_v+=_lordo_v;
|
||||
_totimponibile_vs+=_imponibile_vs;
|
||||
_totimposta_vs+=_imposta_vs;
|
||||
_totlordo_vs+=_lordo_vs;
|
||||
_totimponibile_acq+= _imponibile_acq;
|
||||
_totimposta_acq+= _imposta_acq;
|
||||
_totlordo_acq+= _lordo_acq;
|
||||
}
|
||||
|
||||
bool CG0400_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_sospmsk = atoi(_msk->get(F_TIPOTAB));
|
||||
_vuoilordi = (bool)(_msk->get(F_VUOILORDI) == "X");
|
||||
_tipoprog = atoi(_msk->get(F_TIPO));
|
||||
_livelloprog = atoi(_msk->get(F_LIVELLO));
|
||||
if (_livelloprog == 1) //Se si tratta di una aliquota
|
||||
{
|
||||
_codivamsk = _msk->get(F_CODIVA);
|
||||
_tipo_crmsk = atoi(_msk->get(F_TIPOTABE));
|
||||
}
|
||||
else //altrimenti se si tratta di una attivita'
|
||||
{
|
||||
_codattmsk = _msk->get(F_ATTIVITA);
|
||||
_tipo_crmsk = atoi(_msk->get(F_TIPOTABEL));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool CG0400_application::preprocess_print(int file,int counter)
|
||||
{
|
||||
set_real_picture("###.###.###.###");
|
||||
set_print_zero();
|
||||
_totimponibile_v = 0;
|
||||
_totimposta_v = 0;
|
||||
_totlordo_v = 0;
|
||||
_totimponibile_vs = 0;
|
||||
_totimposta_vs = 0;
|
||||
_totlordo_vs = 0;
|
||||
_totimponibile_acq = 0;
|
||||
_totimposta_acq = 0;
|
||||
_totlordo_acq = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG0400_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
const char* mese;
|
||||
reset_print();
|
||||
|
||||
if (counter)
|
||||
_i++;
|
||||
else
|
||||
_i = 1;
|
||||
|
||||
fai_ricerca(_i);
|
||||
mese = itom(_i);
|
||||
set_row(1,"%s", mese);
|
||||
if (_tipoprog == 1)
|
||||
{
|
||||
if (_sospmsk == 1)
|
||||
{
|
||||
set_row(1,"@16g%r", &_imponibile_v);
|
||||
set_row(1,"@32g%r", &_imposta_v);
|
||||
if (_vuoilordi)
|
||||
set_row(1,"@48g%r", &_lordo_v);
|
||||
}
|
||||
else if (_sospmsk == 2)
|
||||
{
|
||||
set_row(1,"@16g%r", &_imponibile_vs);
|
||||
set_row(1,"@32g%r", &_imposta_vs);
|
||||
if (_vuoilordi)
|
||||
set_row(1,"@48g%r",&_lordo_vs);
|
||||
}
|
||||
}
|
||||
else if (_tipoprog == 2)
|
||||
{
|
||||
set_row(1,"@16g%r", &_imponibile_acq);
|
||||
set_row(1,"@32g%r", &_imposta_acq);
|
||||
if (_vuoilordi)
|
||||
set_row(1,"@48g%r", &_lordo_acq);
|
||||
}
|
||||
|
||||
if (_i == 12)
|
||||
{
|
||||
TString dep = "";
|
||||
set_row(2,(const char*) dep);
|
||||
set_row(3,"@10gTotale");
|
||||
if (_tipoprog == 1)
|
||||
{
|
||||
if (_sospmsk == 1)
|
||||
{
|
||||
set_row(3,"@16g%r", &_totimponibile_v);
|
||||
set_row(3,"@32g%r", &_totimposta_v);
|
||||
if (_vuoilordi)
|
||||
set_row(3,"@48g%r", &_totlordo_v);
|
||||
}
|
||||
else if (_sospmsk == 2)
|
||||
{
|
||||
set_row(3,"@16g%r", &_totimponibile_vs);
|
||||
set_row(3,"@32g%r", &_totimposta_vs);
|
||||
if (_vuoilordi)
|
||||
set_row(3,"@48g%r", &_totlordo_vs);
|
||||
}
|
||||
}
|
||||
else if (_tipoprog == 2)
|
||||
{
|
||||
set_row(3,"@16g%r", &_totimponibile_acq);
|
||||
set_row(3,"@32g%r", &_totimposta_acq);
|
||||
if (_vuoilordi)
|
||||
set_row(3,"@48g%r", &_totlordo_acq);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TRectype& look_com (const char * cod, TLocalisamfile *comuni)
|
||||
{
|
||||
comuni->zero();
|
||||
comuni->put(COM_COM, cod);
|
||||
comuni->read();
|
||||
if (comuni->bad())
|
||||
comuni->zero();
|
||||
|
||||
return comuni->curr();
|
||||
}
|
||||
|
||||
void CG0400_application::get_dati_ditta()
|
||||
{
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TString codanagr;
|
||||
TString tipoa;
|
||||
|
||||
nditte.zero();
|
||||
nditte.put(NDT_CODDITTA, get_firm());
|
||||
nditte.read();
|
||||
|
||||
if (nditte.bad()) nditte.zero();
|
||||
|
||||
codanagr = nditte.get(NDT_CODANAGR);
|
||||
tipoa = nditte.get(NDT_TIPOA);
|
||||
_ragsoc = nditte.get(NDT_RAGSOC);
|
||||
|
||||
anag.setkey(1);
|
||||
anag.zero();
|
||||
anag.put (ANA_TIPOA, tipoa);
|
||||
anag.put (ANA_CODANAGR, codanagr);
|
||||
anag.read();
|
||||
if (anag.bad()) anag.zero();
|
||||
|
||||
_cofi = anag.get(ANA_COFI);
|
||||
_paiva = anag.get(ANA_PAIV);
|
||||
//_ragsoc = anag.get(ANA_RAGSOC);
|
||||
_comunefis = anag.get(ANA_COMRF);
|
||||
|
||||
if (_comunefis.empty())
|
||||
_comunefis = anag.get(ANA_COMRES);
|
||||
|
||||
TRectype dep = look_com (_comunefis, _com);
|
||||
|
||||
_comunefis = dep.get(COM_DENCOM);
|
||||
_provfis = dep.get(COM_PROVCOM);
|
||||
_cap = dep.get(COM_CAPCOM);
|
||||
if (_comunefis.empty())
|
||||
{
|
||||
_viafis = anag.get(ANA_INDRF);
|
||||
_viafis.rtrim();
|
||||
_viafis << " " << anag.get (ANA_CIVRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
_viafis = anag.get(ANA_INDRES);
|
||||
_viafis.rtrim();
|
||||
_viafis << " " << anag.get (ANA_CIVRES);
|
||||
}
|
||||
}
|
||||
|
||||
int CG0400_application::stampa_intestazione_ditta()
|
||||
{
|
||||
int r = 3;
|
||||
TString codice_ditta;
|
||||
TString riga(132);
|
||||
|
||||
get_dati_ditta();
|
||||
codice_ditta << get_firm();
|
||||
|
||||
set_header (r, "Ditta %s %s Via %s %s %s %s", (const char*)codice_ditta,
|
||||
(const char*)_ragsoc, (const char*)_viafis,
|
||||
(const char*)_cap, (const char*)_comunefis,
|
||||
(const char*)_provfis);
|
||||
r++;
|
||||
printer().setdate(_data);
|
||||
riga = "Data @< Pag. @#";
|
||||
riga.right_just(127);
|
||||
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
|
||||
set_header (r, "%s", (const char*) riga);
|
||||
r++;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void CG0400_application::preprocess_header()
|
||||
{
|
||||
int r = 1;
|
||||
|
||||
reset_header();
|
||||
if (_livelloprog == 1)
|
||||
set_header(1, "@30gProgressivi IVA per Aliquota");
|
||||
else set_header(1, "@30gProgressivi IVA per Attivita'");
|
||||
|
||||
r = stampa_intestazione_ditta();
|
||||
|
||||
if (_tipoprog == 1)
|
||||
set_header(r, "Vendite");
|
||||
else set_header(r, "Acquisti");
|
||||
if (_livelloprog == 1)
|
||||
set_header(r++, "@10gIVA %s",(const char*) _codivamsk);
|
||||
else set_header(r++, "@10gCod.attivita' %s",(const char*)_codattmsk);
|
||||
r++;
|
||||
if (_vuoilordi)
|
||||
set_header(r, "@21gImponibile@40gImposta@50gImporto lordo");
|
||||
else set_header(r, "@21gImponibile@40gImposta");
|
||||
}
|
||||
|
||||
print_action CG0400_application::postprocess_page(int file, int counter)
|
||||
{
|
||||
if (_i < 12) return REPEAT_PAGE;
|
||||
else return NEXT_PAGE;
|
||||
}
|
||||
|
||||
int cg0400(int argc,char* argv[])
|
||||
{
|
||||
CG0400_application a;
|
||||
a.run(argc, argv, "Riepilogo progressivi IVA");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <applicat.h>
|
||||
#include <date.h>
|
||||
#include <lffiles.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
#include <printapp.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <nditte.h>
|
||||
#include <anagr.h>
|
||||
#include <comuni.h>
|
||||
#include "cg0.h"
|
||||
#include "cg0400.h"
|
||||
|
||||
|
||||
class CG0400_application : public TPrintapp
|
||||
{
|
||||
|
||||
TTable* _tabpim, * _tabreg;
|
||||
TLocalisamfile* _nditte, * _attiv, * _anag, * _com;
|
||||
TMask* _msk;
|
||||
TDate _data;
|
||||
int _i, _sospmsk, _tipoprog, _livelloprog, _tipo_crmsk;
|
||||
TString _cap,_cofi,_paiva,_ragsoc,_comunefis,_provfis,_viafis,_codivamsk,_codattmsk;
|
||||
bool _vuoilordi;
|
||||
real _imponibile, _imposta, _lordo, _imponibile_v, _imposta_v, _lordo_v;
|
||||
real _imponibile_vs, _imposta_vs, _lordo_vs, _totimponibile_v, _totimposta_v;
|
||||
real _totlordo_v, _totimponibile_vs, _totimposta_vs, _totlordo_vs, _imponibile_acq;
|
||||
real _imposta_acq, _lordo_acq, _totimponibile_acq, _totimposta_acq, _totlordo_acq;
|
||||
|
||||
public:
|
||||
void user_create();
|
||||
void user_destroy();
|
||||
bool set_print(int);
|
||||
|
||||
bool menu(MENU_TAG m) { return TPrintapp::menu(m); }
|
||||
|
||||
virtual void preprocess_header();
|
||||
virtual bool preprocess_page(int,int);
|
||||
virtual print_action postprocess_page(int,int);
|
||||
virtual bool preprocess_print(int,int);
|
||||
|
||||
void fai_ricerca(int);
|
||||
void get_dati_ditta();
|
||||
int stampa_intestazione_ditta();
|
||||
|
||||
public:
|
||||
CG0400_application(){};
|
||||
};
|
||||
|
||||
|
||||
void CG0400_application::user_create()
|
||||
{
|
||||
_tabpim = new TTable(TAB_PIM);
|
||||
_tabreg = new TTable(TAB_REG);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_attiv = new TLocalisamfile(LF_ATTIV);
|
||||
_com = new TLocalisamfile(LF_COMUNI);
|
||||
_msk = new TMask("cg0400a");
|
||||
}
|
||||
|
||||
void CG0400_application::user_destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _tabpim;
|
||||
delete _tabreg;
|
||||
delete _anag;
|
||||
delete _nditte;
|
||||
delete _com;
|
||||
delete _attiv;
|
||||
}
|
||||
|
||||
void CG0400_application::fai_ricerca(int i)
|
||||
{
|
||||
TString codtab,codreg,dep,codiva,codatt;
|
||||
int mese;
|
||||
long anno;
|
||||
|
||||
_imponibile=0;
|
||||
_imponibile_v=0;
|
||||
_imponibile_vs=0;
|
||||
_imposta=0;
|
||||
_imposta_v=0;
|
||||
_imposta_vs=0;
|
||||
_lordo=0;
|
||||
_lordo_v=0;
|
||||
_lordo_vs=0;
|
||||
_imponibile_acq=0;
|
||||
_imposta_acq=0;
|
||||
_lordo_acq=0;
|
||||
|
||||
_tabpim->first();
|
||||
while (!_tabpim->eof()) //Scorre tutti i record della tabella PIM
|
||||
{
|
||||
_imponibile = 0;
|
||||
_imposta = 0;
|
||||
_lordo = 0;
|
||||
codtab = _tabpim->curr().get("CODTAB");
|
||||
mese = atoi(codtab.mid(12,2));
|
||||
if (_livelloprog == 1) //Se si tratta di una aliquota
|
||||
{
|
||||
codiva = codtab.mid(15,3);
|
||||
codatt = codtab.mid(4,5);
|
||||
}
|
||||
else //altrimenti se si tratta di una attivita'
|
||||
{
|
||||
codatt = codtab.mid(4,5);
|
||||
codiva = codtab.mid(55,3);
|
||||
}
|
||||
if (((mese==i)&&(codiva==_codivamsk))||((mese==i)&&(codatt==_codattmsk)))
|
||||
{
|
||||
codreg = codtab.mid(9,3);
|
||||
anno = atoi(codtab.mid(0,4));
|
||||
_tabreg->curr().zero();
|
||||
dep = format("%04d", anno);
|
||||
dep << format("%3s", (const char*)codreg);
|
||||
_tabreg->curr().put("CODTAB", (const char*)dep);
|
||||
_tabreg->read();
|
||||
if (_tabreg->bad())
|
||||
_tabreg->curr().zero();
|
||||
int tipo = atoi(_tabreg->curr().get("I0"));
|
||||
if ((tipo == 1) && (_tipoprog == 1)) //Se si tratta di una vendita
|
||||
{
|
||||
int tipo_importo = (int) _tabreg->curr().get_long("I0");
|
||||
bool sosp = _tabreg->curr().get_bool("B0");
|
||||
if (tipo_importo == 1) // 1=importo netto 2=importo lordo
|
||||
{
|
||||
_imponibile = _tabpim->curr().get_real("R0");
|
||||
|
||||
_imposta = _tabpim->curr().get_real("R1");
|
||||
}
|
||||
else
|
||||
_lordo = _tabpim->curr().get_real("R2");
|
||||
if (sosp) //Se e' una vendita in sospensione d'imposta
|
||||
{
|
||||
_imponibile_vs += _imponibile;
|
||||
_imposta_vs += _imposta;
|
||||
_lordo_vs += _lordo;
|
||||
}
|
||||
else
|
||||
{
|
||||
_imponibile_v += _imponibile;
|
||||
_imposta_v += _imposta;
|
||||
_lordo_v += _lordo;
|
||||
}
|
||||
}
|
||||
else if ((tipo == 2) && (_tipoprog == 2)) //Se si tratta di un acquisto
|
||||
{
|
||||
int tipo_importo = atoi(codtab.mid(15,1));
|
||||
int tipo_cr = atoi(codtab.mid(14,1));
|
||||
if (_tipo_crmsk == tipo_cr)
|
||||
{
|
||||
if (tipo_importo == 1) // 1=importo netto 2=importo lordo
|
||||
{
|
||||
_imponibile = _tabpim->curr().get_real("R0");
|
||||
|
||||
_imposta = _tabpim->curr().get_real("R1");
|
||||
}
|
||||
else
|
||||
_lordo = _tabpim->curr().get_real("R2");
|
||||
|
||||
_imponibile_acq += _imponibile;
|
||||
_imposta_acq += _imposta;
|
||||
_lordo_acq += _lordo;
|
||||
}
|
||||
}
|
||||
}
|
||||
_tabpim->next();
|
||||
}
|
||||
|
||||
_totimponibile_v+=_imponibile_v;
|
||||
_totimposta_v+=_imposta_v;
|
||||
_totlordo_v+=_lordo_v;
|
||||
_totimponibile_vs+=_imponibile_vs;
|
||||
_totimposta_vs+=_imposta_vs;
|
||||
_totlordo_vs+=_lordo_vs;
|
||||
_totimponibile_acq+= _imponibile_acq;
|
||||
_totimposta_acq+= _imposta_acq;
|
||||
_totlordo_acq+= _lordo_acq;
|
||||
}
|
||||
|
||||
bool CG0400_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
tasto = _msk->run();
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_sospmsk = atoi(_msk->get(F_TIPOTAB));
|
||||
_vuoilordi = (bool)(_msk->get(F_VUOILORDI) == "X");
|
||||
_tipoprog = atoi(_msk->get(F_TIPO));
|
||||
_livelloprog = atoi(_msk->get(F_LIVELLO));
|
||||
if (_livelloprog == 1) //Se si tratta di una aliquota
|
||||
{
|
||||
_codivamsk = _msk->get(F_CODIVA);
|
||||
_tipo_crmsk = atoi(_msk->get(F_TIPOTABE));
|
||||
}
|
||||
else //altrimenti se si tratta di una attivita'
|
||||
{
|
||||
_codattmsk = _msk->get(F_ATTIVITA);
|
||||
_tipo_crmsk = atoi(_msk->get(F_TIPOTABEL));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool CG0400_application::preprocess_print(int file,int counter)
|
||||
{
|
||||
set_real_picture("###.###.###.###");
|
||||
set_print_zero();
|
||||
_totimponibile_v = 0;
|
||||
_totimposta_v = 0;
|
||||
_totlordo_v = 0;
|
||||
_totimponibile_vs = 0;
|
||||
_totimposta_vs = 0;
|
||||
_totlordo_vs = 0;
|
||||
_totimponibile_acq = 0;
|
||||
_totimposta_acq = 0;
|
||||
_totlordo_acq = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG0400_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
const char* mese;
|
||||
reset_print();
|
||||
|
||||
if (counter)
|
||||
_i++;
|
||||
else
|
||||
_i = 1;
|
||||
|
||||
fai_ricerca(_i);
|
||||
mese = itom(_i);
|
||||
set_row(1,"%s", mese);
|
||||
if (_tipoprog == 1)
|
||||
{
|
||||
if (_sospmsk == 1)
|
||||
{
|
||||
set_row(1,"@16g%r", &_imponibile_v);
|
||||
set_row(1,"@32g%r", &_imposta_v);
|
||||
if (_vuoilordi)
|
||||
set_row(1,"@48g%r", &_lordo_v);
|
||||
}
|
||||
else if (_sospmsk == 2)
|
||||
{
|
||||
set_row(1,"@16g%r", &_imponibile_vs);
|
||||
set_row(1,"@32g%r", &_imposta_vs);
|
||||
if (_vuoilordi)
|
||||
set_row(1,"@48g%r",&_lordo_vs);
|
||||
}
|
||||
}
|
||||
else if (_tipoprog == 2)
|
||||
{
|
||||
set_row(1,"@16g%r", &_imponibile_acq);
|
||||
set_row(1,"@32g%r", &_imposta_acq);
|
||||
if (_vuoilordi)
|
||||
set_row(1,"@48g%r", &_lordo_acq);
|
||||
}
|
||||
|
||||
if (_i == 12)
|
||||
{
|
||||
TString dep = "";
|
||||
set_row(2,(const char*) dep);
|
||||
set_row(3,"@10gTotale");
|
||||
if (_tipoprog == 1)
|
||||
{
|
||||
if (_sospmsk == 1)
|
||||
{
|
||||
set_row(3,"@16g%r", &_totimponibile_v);
|
||||
set_row(3,"@32g%r", &_totimposta_v);
|
||||
if (_vuoilordi)
|
||||
set_row(3,"@48g%r", &_totlordo_v);
|
||||
}
|
||||
else if (_sospmsk == 2)
|
||||
{
|
||||
set_row(3,"@16g%r", &_totimponibile_vs);
|
||||
set_row(3,"@32g%r", &_totimposta_vs);
|
||||
if (_vuoilordi)
|
||||
set_row(3,"@48g%r", &_totlordo_vs);
|
||||
}
|
||||
}
|
||||
else if (_tipoprog == 2)
|
||||
{
|
||||
set_row(3,"@16g%r", &_totimponibile_acq);
|
||||
set_row(3,"@32g%r", &_totimposta_acq);
|
||||
if (_vuoilordi)
|
||||
set_row(3,"@48g%r", &_totlordo_acq);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TRectype& look_com (const char * cod, TLocalisamfile *comuni)
|
||||
{
|
||||
comuni->zero();
|
||||
comuni->put(COM_COM, cod);
|
||||
comuni->read();
|
||||
if (comuni->bad())
|
||||
comuni->zero();
|
||||
|
||||
return comuni->curr();
|
||||
}
|
||||
|
||||
void CG0400_application::get_dati_ditta()
|
||||
{
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TString codanagr;
|
||||
TString tipoa;
|
||||
|
||||
nditte.zero();
|
||||
nditte.put(NDT_CODDITTA, get_firm());
|
||||
nditte.read();
|
||||
|
||||
if (nditte.bad()) nditte.zero();
|
||||
|
||||
codanagr = nditte.get(NDT_CODANAGR);
|
||||
tipoa = nditte.get(NDT_TIPOA);
|
||||
_ragsoc = nditte.get(NDT_RAGSOC);
|
||||
|
||||
anag.setkey(1);
|
||||
anag.zero();
|
||||
anag.put (ANA_TIPOA, tipoa);
|
||||
anag.put (ANA_CODANAGR, codanagr);
|
||||
anag.read();
|
||||
if (anag.bad()) anag.zero();
|
||||
|
||||
_cofi = anag.get(ANA_COFI);
|
||||
_paiva = anag.get(ANA_PAIV);
|
||||
//_ragsoc = anag.get(ANA_RAGSOC);
|
||||
_comunefis = anag.get(ANA_COMRF);
|
||||
|
||||
if (_comunefis.empty())
|
||||
_comunefis = anag.get(ANA_COMRES);
|
||||
|
||||
TRectype dep = look_com (_comunefis, _com);
|
||||
|
||||
_comunefis = dep.get(COM_DENCOM);
|
||||
_provfis = dep.get(COM_PROVCOM);
|
||||
_cap = dep.get(COM_CAPCOM);
|
||||
if (_comunefis.empty())
|
||||
{
|
||||
_viafis = anag.get(ANA_INDRF);
|
||||
_viafis.rtrim();
|
||||
_viafis << " " << anag.get (ANA_CIVRF);
|
||||
}
|
||||
else
|
||||
{
|
||||
_viafis = anag.get(ANA_INDRES);
|
||||
_viafis.rtrim();
|
||||
_viafis << " " << anag.get (ANA_CIVRES);
|
||||
}
|
||||
}
|
||||
|
||||
int CG0400_application::stampa_intestazione_ditta()
|
||||
{
|
||||
int r = 3;
|
||||
TString codice_ditta;
|
||||
TString riga(132);
|
||||
|
||||
get_dati_ditta();
|
||||
codice_ditta << get_firm();
|
||||
|
||||
set_header (r, "Ditta %s %s Via %s %s %s %s", (const char*)codice_ditta,
|
||||
(const char*)_ragsoc, (const char*)_viafis,
|
||||
(const char*)_cap, (const char*)_comunefis,
|
||||
(const char*)_provfis);
|
||||
r++;
|
||||
printer().setdate(_data);
|
||||
riga = "Data @< Pag. @#";
|
||||
riga.right_just(127);
|
||||
riga.overwrite (format ("Partita iva %s Codice fiscale %s", (const char*)_paiva, (const char*)_cofi));
|
||||
set_header (r, "%s", (const char*) riga);
|
||||
r++;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void CG0400_application::preprocess_header()
|
||||
{
|
||||
int r = 1;
|
||||
|
||||
reset_header();
|
||||
if (_livelloprog == 1)
|
||||
set_header(1, "@30gProgressivi IVA per Aliquota");
|
||||
else set_header(1, "@30gProgressivi IVA per Attivita'");
|
||||
|
||||
r = stampa_intestazione_ditta();
|
||||
|
||||
if (_tipoprog == 1)
|
||||
set_header(r, "Vendite");
|
||||
else set_header(r, "Acquisti");
|
||||
if (_livelloprog == 1)
|
||||
set_header(r++, "@10gIVA %s",(const char*) _codivamsk);
|
||||
else set_header(r++, "@10gCod.attivita' %s",(const char*)_codattmsk);
|
||||
r++;
|
||||
if (_vuoilordi)
|
||||
set_header(r, "@21gImponibile@40gImposta@50gImporto lordo");
|
||||
else set_header(r, "@21gImponibile@40gImposta");
|
||||
}
|
||||
|
||||
print_action CG0400_application::postprocess_page(int file, int counter)
|
||||
{
|
||||
if (_i < 12) return REPEAT_PAGE;
|
||||
else return NEXT_PAGE;
|
||||
}
|
||||
|
||||
int cg0400(int argc,char* argv[])
|
||||
{
|
||||
CG0400_application a;
|
||||
a.run(argc, argv, "Riepilogo progressivi IVA");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -263,12 +263,12 @@ bool CG0500_application::leggi_riga(int r, KEY k)
|
||||
|
||||
bool filtra_reg(const TRelation * r)
|
||||
{
|
||||
TFixed_string codtab(r->lfile()->get("CODTAB"));
|
||||
TFixed_string codtab(r->lfile().get("CODTAB"));
|
||||
const int anno = atoi(codtab.cut(4));
|
||||
if (anno == anno_iva())
|
||||
{
|
||||
const int tiporeg = r->lfile()->get_int("I0");
|
||||
const bool corrisp = r->lfile()->get_bool("B0");
|
||||
const int tiporeg = r->lfile().get_int("I0");
|
||||
const bool corrisp = r->lfile().get_bool("B0");
|
||||
|
||||
switch (app()->_filtro)
|
||||
{
|
||||
@ -430,7 +430,7 @@ bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
|
||||
if (f.to_check(k))
|
||||
{
|
||||
const TString16 causim(f.get());
|
||||
TLocalisamfile& caus = *app()->_rel->lfile(LF_CAUSALI);
|
||||
TLocalisamfile& caus = app()->_rel->lfile(LF_CAUSALI);
|
||||
caus.zero();
|
||||
caus.put(CAU_CODCAUS, causim);
|
||||
if (caus.read() == NOERR)
|
||||
@ -847,7 +847,7 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
TString d(50), da(3), civa(3);
|
||||
char sz, cf;
|
||||
bool riva;
|
||||
TLocalisamfile * rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
|
||||
_rel->update(); // chiamo position_rels()
|
||||
|
||||
@ -857,18 +857,18 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
bool ok = _rel->is_first_match(LF_RCAUSALI);
|
||||
while (ok)
|
||||
{
|
||||
numrig = rcaus->get_int(RCA_NRIGA);
|
||||
numrig = rcaus.get_int(RCA_NRIGA);
|
||||
CHECK(numrig > 0, "Causale con numero riga nullo");
|
||||
g = rcaus->get_int(RCA_GRUPPO);
|
||||
c = rcaus->get_int(RCA_CONTO);
|
||||
s = rcaus->get_long(RCA_SOTTOCONTO);
|
||||
sz = rcaus->get_char(RCA_SEZIONE);
|
||||
d = rcaus->get(RCA_DESC);
|
||||
da = rcaus->get(RCA_CODDESC);
|
||||
// cf = rcaus->get(RCA_TIPOCF)[0];
|
||||
cf = rcaus->get_char(RCA_TIPOCF);
|
||||
riva = rcaus->get_bool(RCA_RIGAIVA);
|
||||
civa = rcaus->get(RCA_CODIVA);
|
||||
g = rcaus.get_int(RCA_GRUPPO);
|
||||
c = rcaus.get_int(RCA_CONTO);
|
||||
s = rcaus.get_long(RCA_SOTTOCONTO);
|
||||
sz = rcaus.get_char(RCA_SEZIONE);
|
||||
d = rcaus.get(RCA_DESC);
|
||||
da = rcaus.get(RCA_CODDESC);
|
||||
// cf = rcaus.get(RCA_TIPOCF)[0];
|
||||
cf = rcaus.get_char(RCA_TIPOCF);
|
||||
riva = rcaus.get_bool(RCA_RIGAIVA);
|
||||
civa = rcaus.get(RCA_CODIVA);
|
||||
TConto tc(g,c,s,cf);
|
||||
|
||||
add_riga(numrig-1, cf, sz, d, da, riva, civa, tc);
|
||||
@ -910,7 +910,7 @@ void CG0500_application::array2sheet()
|
||||
|
||||
bool CG0500_application::descr2array(TMask& m, bool fromHandler)
|
||||
{
|
||||
TLocalisamfile& caus = *_rel->lfile();
|
||||
TLocalisamfile& caus = _rel->lfile();
|
||||
TString16 tpd, codreg;
|
||||
int tpm, m770, tpr;
|
||||
|
||||
@ -957,7 +957,7 @@ bool CG0500_application::descr2array(TMask& m, bool fromHandler)
|
||||
void CG0500_application::togli_dal_file(const TString& cau)
|
||||
{
|
||||
long i;
|
||||
TLocalisamfile *rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
TLocalisamfile &rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
long last = _righe_gia_presenti.last_one();
|
||||
long start = _righe_gia_presenti.first_one();
|
||||
|
||||
@ -965,11 +965,11 @@ void CG0500_application::togli_dal_file(const TString& cau)
|
||||
{
|
||||
if (_righe_gia_presenti[i])
|
||||
{
|
||||
rcaus->zero();
|
||||
rcaus->put(RCA_CODCAUS,cau);
|
||||
rcaus->put(RCA_NRIGA, i);
|
||||
// if (rcaus->read() == NOERR)
|
||||
rcaus->remove();
|
||||
rcaus.zero();
|
||||
rcaus.put(RCA_CODCAUS,cau);
|
||||
rcaus.put(RCA_NRIGA, i);
|
||||
// if (rcaus.read() == NOERR)
|
||||
rcaus.remove();
|
||||
_righe_gia_presenti.reset(i);
|
||||
}
|
||||
}
|
||||
@ -990,8 +990,8 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
||||
const TString16 cau(m.get(F_COD_CAUS));
|
||||
TString80 desc;
|
||||
TString16 coddesc;
|
||||
TLocalisamfile *caus = _rel->lfile(LF_CAUSALI);
|
||||
TLocalisamfile *rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
TLocalisamfile &caus = _rel->lfile(LF_CAUSALI);
|
||||
TLocalisamfile &rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
|
||||
m.autosave(_rel);
|
||||
|
||||
@ -1015,36 +1015,36 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
||||
|
||||
if (g > 0 || c > 0 || s > 0L)
|
||||
{
|
||||
rcaus->zero();
|
||||
rcaus->put (RCA_CODCAUS, (const char *)cau);
|
||||
rcaus->put (RCA_NRIGA, i+1); // Numerare da uno!
|
||||
rcaus->put (RCA_GRUPPO , g);
|
||||
rcaus->put (RCA_CONTO , c);
|
||||
rcaus->put (RCA_SOTTOCONTO, s);
|
||||
rcaus->put (RCA_SEZIONE, sezione);
|
||||
rcaus->put (RCA_DESC , (const char *)desc);
|
||||
rcaus->put (RCA_CODDESC, (const char *)coddesc);
|
||||
rcaus->put (RCA_TIPOCF, tipo_cf);
|
||||
rcaus.zero();
|
||||
rcaus.put (RCA_CODCAUS, (const char *)cau);
|
||||
rcaus.put (RCA_NRIGA, i+1); // Numerare da uno!
|
||||
rcaus.put (RCA_GRUPPO , g);
|
||||
rcaus.put (RCA_CONTO , c);
|
||||
rcaus.put (RCA_SOTTOCONTO, s);
|
||||
rcaus.put (RCA_SEZIONE, sezione);
|
||||
rcaus.put (RCA_DESC , (const char *)desc);
|
||||
rcaus.put (RCA_CODDESC, (const char *)coddesc);
|
||||
rcaus.put (RCA_TIPOCF, tipo_cf);
|
||||
if (rewrite) {
|
||||
if (_righe_gia_presenti[i+1]) {
|
||||
rcaus->rewrite();
|
||||
rcaus.rewrite();
|
||||
_righe_gia_presenti.reset(i+1);
|
||||
}
|
||||
else
|
||||
rcaus->write();
|
||||
rcaus.write();
|
||||
}
|
||||
else
|
||||
rcaus->write();
|
||||
rcaus.write();
|
||||
}
|
||||
}
|
||||
|
||||
if (rewrite)
|
||||
{
|
||||
togli_dal_file(cau); // Elimina dal file le righe rimaste nel bitarray
|
||||
return caus->rewrite();
|
||||
return caus.rewrite();
|
||||
}
|
||||
else
|
||||
return caus->write();
|
||||
return caus.write();
|
||||
}
|
||||
|
||||
|
||||
@ -1053,8 +1053,8 @@ bool CG0500_application::remove()
|
||||
const bool ok = TRelation_application::remove();
|
||||
if (ok)
|
||||
{
|
||||
const TString cod(_rel->lfile()->get(RCA_CODCAUS));
|
||||
TLocalisamfile& rcaus = *_rel->lfile(LF_RCAUSALI);
|
||||
const TString cod(_rel->lfile().get(RCA_CODCAUS));
|
||||
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
rcaus.zero();
|
||||
rcaus.put(RCA_CODCAUS, cod);
|
||||
int e = rcaus.read(_isgteq);
|
||||
|
@ -83,7 +83,7 @@ BEGIN
|
||||
OUTPUT F_CORRISP B0
|
||||
HELP "Codice registro"
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "D"
|
||||
FLAGS "DU"
|
||||
END
|
||||
|
||||
// Questo rimane sempre nascosto
|
||||
@ -201,6 +201,7 @@ END
|
||||
STRING F_COD_CAUS_IM 3
|
||||
BEGIN
|
||||
PROMPT 34 6 "Codice causale per l'incasso immediato "
|
||||
FLAGS "U"
|
||||
FIELD LF_CAUSALI->CODCAUSIM
|
||||
COPY USE F_COD_CAUS
|
||||
INPUT CODCAUS F_COD_CAUS_IM
|
||||
|
196
cg/cg1300.cpp
196
cg/cg1300.cpp
@ -1,98 +1,98 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <form.h>
|
||||
#include <utility.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
class TEdit_form : public TApplication
|
||||
{
|
||||
const char* _name;
|
||||
TMaskmode _mode;
|
||||
TForm* _form;
|
||||
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG);
|
||||
|
||||
public:
|
||||
TEdit_form(const char* name, TMaskmode mode);
|
||||
const char* name() const { return _name; }
|
||||
};
|
||||
|
||||
|
||||
TEdit_form::TEdit_form(const char* name, TMaskmode mode)
|
||||
: _name(name), _mode(mode), _form(NULL)
|
||||
{}
|
||||
|
||||
|
||||
bool TEdit_form::create()
|
||||
{
|
||||
_form = new TForm(name());
|
||||
dispatch_e_menu(MENU_ITEM(2));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TEdit_form::destroy()
|
||||
{
|
||||
delete _form;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TEdit_form::menu(MENU_TAG tag)
|
||||
{
|
||||
int sec = 1;
|
||||
switch(tag)
|
||||
{
|
||||
case MENU_ITEM(1): sec = 0; break;
|
||||
case MENU_ITEM(3): sec = 2; break;
|
||||
default : sec = 1; break;
|
||||
}
|
||||
_form->edit(_mode, sec);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int cg1300(int argc, char* argv[])
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
error_box("Specificare il nome del profilo di stampa");
|
||||
return 1;
|
||||
}
|
||||
|
||||
TFilename form(argv[2]); form.ext("frm");
|
||||
|
||||
const char mode = argc > 3 ? toupper(argv[3][1]) : ' ';
|
||||
|
||||
const bool crea = (mode == 'C') || !fexist(form);
|
||||
if (crea)
|
||||
{
|
||||
TFilename base(form.left(3)); base.ext("frm");
|
||||
if (!fexist(base))
|
||||
{
|
||||
error_box("Non esiste il file %s", (const char*)base);
|
||||
return 1;
|
||||
}
|
||||
if (!fcopy(base, form))
|
||||
{
|
||||
error_box("Impossibile copiare %s in %s", (const char*)base, (const char*)form);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fexist(form))
|
||||
{
|
||||
error_box("Non esiste il file %s", (const char*)form);
|
||||
return 1;
|
||||
}
|
||||
|
||||
TEdit_form a(form, (mode == 'I') ? MODE_INS : MODE_MOD);
|
||||
TString title(40);
|
||||
title << "Modifica modello: " << a.name();
|
||||
a.run(argc, argv, title);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <form.h>
|
||||
#include <utility.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
class TEdit_form : public TApplication
|
||||
{
|
||||
const char* _name;
|
||||
TMaskmode _mode;
|
||||
TForm* _form;
|
||||
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG);
|
||||
|
||||
public:
|
||||
TEdit_form(const char* name, TMaskmode mode);
|
||||
const char* name() const { return _name; }
|
||||
};
|
||||
|
||||
|
||||
TEdit_form::TEdit_form(const char* name, TMaskmode mode)
|
||||
: _name(name), _mode(mode), _form(NULL)
|
||||
{}
|
||||
|
||||
|
||||
bool TEdit_form::create()
|
||||
{
|
||||
_form = new TForm(name());
|
||||
dispatch_e_menu(MENU_ITEM(2));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TEdit_form::destroy()
|
||||
{
|
||||
delete _form;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool TEdit_form::menu(MENU_TAG tag)
|
||||
{
|
||||
int sec = 1;
|
||||
switch(tag)
|
||||
{
|
||||
case MENU_ITEM(1): sec = 0; break;
|
||||
case MENU_ITEM(3): sec = 2; break;
|
||||
default : sec = 1; break;
|
||||
}
|
||||
_form->edit(_mode, sec);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int cg1300(int argc, char* argv[])
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
error_box("Specificare il nome del profilo di stampa");
|
||||
return 1;
|
||||
}
|
||||
|
||||
TFilename form(argv[2]); form.ext("frm");
|
||||
|
||||
const char mode = argc > 3 ? toupper(argv[3][1]) : ' ';
|
||||
|
||||
const bool crea = (mode == 'C') || !fexist(form);
|
||||
if (crea)
|
||||
{
|
||||
TFilename base(form.left(3)); base.ext("frm");
|
||||
if (!fexist(base))
|
||||
{
|
||||
error_box("Non esiste il file %s", (const char*)base);
|
||||
return 1;
|
||||
}
|
||||
if (!fcopy(base, form))
|
||||
{
|
||||
error_box("Impossibile copiare %s in %s", (const char*)base, (const char*)form);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fexist(form))
|
||||
{
|
||||
error_box("Non esiste il file %s", (const char*)form);
|
||||
return 1;
|
||||
}
|
||||
|
||||
TEdit_form a(form, (mode == 'I') ? MODE_INS : MODE_MOD);
|
||||
TString title(40);
|
||||
title << "Modifica modello: " << a.name();
|
||||
a.run(argc, argv, title);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -276,13 +276,13 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
chiave = d; chiave << format("%04d%02d%d", _anno, _mese, _tipo);
|
||||
delega.put("CODTAB", chiave);
|
||||
|
||||
f.cursor()->file()->read();
|
||||
f.cursor()->file().read();
|
||||
const bool cera = atoi(delega.get("S7")) != 0;
|
||||
if (!cera)
|
||||
{
|
||||
delega.put("S7", _azienda);
|
||||
delega.put("S8", _dipendenza);
|
||||
f.cursor()->file()->rewrite();
|
||||
f.cursor()->file().rewrite();
|
||||
}
|
||||
f.cursor()->read(); // Posiziona il cursore
|
||||
|
||||
@ -303,7 +303,7 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
scrivi = TRUE;
|
||||
}
|
||||
if (scrivi)
|
||||
f.cursor()->file()->rewrite();
|
||||
f.cursor()->file().rewrite();
|
||||
}
|
||||
printer().close();
|
||||
|
||||
|
@ -178,7 +178,7 @@ bool CG1700_application::preprocess_page(int file,int count)
|
||||
switch (file)
|
||||
{
|
||||
case LF_CAUSALI:
|
||||
cau_descr = current_cursor()->file(LF_CAUSALI)->get(CAU_DESCR);
|
||||
cau_descr = current_cursor()->file(LF_CAUSALI).get(CAU_DESCR);
|
||||
*_descr_causale = (const char*) cau_descr;
|
||||
setta_righe_descr(_descr_causale,causale);
|
||||
set_row(1, "@0g@3s", FLD(LF_CAUSALI,CAU_CODCAUS));
|
||||
@ -196,7 +196,7 @@ bool CG1700_application::preprocess_page(int file,int count)
|
||||
set_row(1, "@130g@f", FLD(LF_CAUSALI,CAU_RITFATT));
|
||||
break;
|
||||
case LF_RCAUSALI:
|
||||
rcau_descr = current_cursor()->file(LF_RCAUSALI)->get(RCA_DESC);
|
||||
rcau_descr = current_cursor()->file(LF_RCAUSALI).get(RCA_DESC);
|
||||
*_descr_conto = (const char*) rcau_descr;
|
||||
setta_righe_descr(_descr_conto,conto);
|
||||
set_row (1, "@35g@3n", FLD(LF_RCAUSALI,RCA_GRUPPO));
|
||||
|
28
cg/cg2.cpp
28
cg/cg2.cpp
@ -1,10 +1,18 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "cg2.h"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
return cg2100(argc,argv) ;
|
||||
}
|
||||
|
||||
|
||||
#include <xvt.h>
|
||||
|
||||
#include "cg2.h"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = (argc > 1) ? (argv[1][1]-'0') : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
cg2200(argc, argv); break;
|
||||
default:
|
||||
cg2100(argc,argv); break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
1
cg/cg2.h
1
cg/cg2.h
@ -2,6 +2,7 @@
|
||||
#define __CG2_H
|
||||
|
||||
int cg2100(int argc, char** argv);
|
||||
int cg2200(int argc, char** argv);
|
||||
|
||||
#endif // __CG2_H
|
||||
|
||||
|
14
cg/cg2.url
14
cg/cg2.url
@ -1,4 +1,10 @@
|
||||
#include <default.url>
|
||||
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
#include <default.url>
|
||||
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
MENU MENU_BAR(1)
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
@ -118,8 +118,8 @@ bool TPrimanota_application::user_create()
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
|
||||
_rel = new TMovimentoPN;
|
||||
_rel->lfile()->last();
|
||||
_lastreg = _rel->lfile()->get_long(MOV_NUMREG); // Init last registration number
|
||||
_rel->lfile().last();
|
||||
_lastreg = _rel->lfile().get_long(MOV_NUMREG); // Init last registration number
|
||||
|
||||
set_search_field(F_NUMREG); // Set field for default search
|
||||
|
||||
@ -204,9 +204,9 @@ bool TPrimanota_application::changing_mask(int mode)
|
||||
read_caus(causale, annoiva);
|
||||
break;
|
||||
case MODE_MOD:
|
||||
annoes = _rel->lfile()->get_int("ANNOES");
|
||||
annoiva = _rel->lfile()->get_int("ANNOIVA");
|
||||
causale = _rel->lfile()->get("CODCAUS");
|
||||
annoes = _rel->lfile().get_int("ANNOES");
|
||||
annoiva = _rel->lfile().get_int("ANNOIVA");
|
||||
causale = _rel->lfile().get("CODCAUS");
|
||||
giornale().read(annoes);
|
||||
read_caus(causale, annoiva);
|
||||
break;
|
||||
@ -304,7 +304,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
|
||||
init_mask(m);
|
||||
_saldi.reset(); // Inizializza saldi
|
||||
_saldi.set_movprovv(_rel->lfile()->get_char("PROVVIS") > ' ' ? TRUE : FALSE);
|
||||
_saldi.set_movprovv(_rel->lfile().get_char("PROVVIS") > ' ' ? TRUE : FALSE);
|
||||
_saldi.set_movap(_causale.apertura());
|
||||
_saldi.set_anno_es(m.get_int(F_ANNOES));
|
||||
_saldi.set_num_ulmov(m.get_long(F_NUMREG));
|
||||
@ -336,7 +336,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
||||
const int nriga = rcaus->get_int(RCA_NRIGA);
|
||||
if (nriga < 1) continue; // Considera solo righe reali (non riempimenti)
|
||||
|
||||
TConto tc; _causale.bill(nriga, tc);
|
||||
TBill tc; _causale.bill(nriga, tc);
|
||||
if (tc.conto() < 1) continue; // Considera solo conti validi
|
||||
|
||||
char sezione = rcaus->get_char(RCA_SEZIONE);
|
||||
@ -382,14 +382,14 @@ void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
}
|
||||
|
||||
|
||||
bool TPrimanota_application::get_conto(const TRectype& r, TConto& c) const
|
||||
bool TPrimanota_application::get_conto(const TRectype& r, TBill& c) const
|
||||
{
|
||||
c.set(r.get_int("GRUPPO"), r.get_int("CONTO"),
|
||||
r.get_long("SOTTOCONTO"), r.get_char("TIPOC"));
|
||||
return c.ok();
|
||||
}
|
||||
|
||||
void TPrimanota_application::put_conto(TRectype& r, const TConto& c) const
|
||||
void TPrimanota_application::put_conto(TRectype& r, const TBill& c) const
|
||||
{
|
||||
r.put("TIPOC", c.tipo());
|
||||
r.put("GRUPPO", c.gruppo());
|
||||
@ -413,7 +413,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
|
||||
if (_iva != nessuna_iva)
|
||||
{
|
||||
const TString16 occode(_rel->lfile()->get("OCFPI"));
|
||||
const TString16 occode(_rel->lfile().get("OCFPI"));
|
||||
occas_mask().set(O_CODICE, occode);
|
||||
|
||||
const char clifo = toupper(m.get(F_CLIFO)[0]);
|
||||
@ -434,7 +434,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
cgs.reset();
|
||||
|
||||
_saldi.reset(); // Azzera saldi
|
||||
_saldi.set_movprovv(_rel->lfile()->get_char("PROVVIS") > ' ' ? TRUE : FALSE);
|
||||
_saldi.set_movprovv(_rel->lfile().get_char("PROVVIS") > ' ' ? TRUE : FALSE);
|
||||
_saldi.set_movap(_causale.apertura());
|
||||
_saldi.set_anno_es(m.get_int(F_ANNOES));
|
||||
_saldi.set_num_ulmov(m.get_long(F_NUMREG));
|
||||
@ -506,7 +506,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
riga.add(r.get("TIPODET")); // Detrazione 103
|
||||
riga.add(r.get("IMPOSTA")); // Imposta 104
|
||||
|
||||
TConto c; get_conto(r, c);
|
||||
TBill c; get_conto(r, c);
|
||||
if (c.ok())
|
||||
c.add_to(riga, 4, 0x7); // 105-110
|
||||
else
|
||||
@ -525,7 +525,7 @@ int TPrimanota_application::read(TMask& m)
|
||||
|
||||
void TPrimanota_application::mask2rel(const TMask& m)
|
||||
{
|
||||
_rel->lfile()->zero();
|
||||
_rel->lfile().zero();
|
||||
m.autosave(_rel);
|
||||
|
||||
const long numreg = m.get_long(F_NUMREG);
|
||||
@ -571,7 +571,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
r.put("DESCR", row.get()); // Descrizione riga
|
||||
|
||||
int rcontr = 0; // Riga contropartita
|
||||
const TConto contro(row, -1, 0x3); // Conto contropartita
|
||||
const TBill contro(row, -1, 0x3); // Conto contropartita
|
||||
if (contro.ok())
|
||||
{
|
||||
rcontr = bill2contr(contro, n.sezione())+1;
|
||||
@ -593,7 +593,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
|
||||
if (causale().corrispettivi())
|
||||
{
|
||||
TRectype& rec = _rel->lfile()->curr();
|
||||
TRectype& rec = _rel->lfile().curr();
|
||||
rec.put("TIPO", "");
|
||||
rec.put("CODCF", ""); // Azzera il cliente nei movimenti dei corrispettivi
|
||||
}
|
||||
@ -611,11 +611,11 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
err = occas.rewrite();
|
||||
|
||||
if (err == NOERR)
|
||||
_rel->lfile()->put("OCFPI", occas_mask().get(O_CODICE));
|
||||
_rel->lfile().put("OCFPI", occas_mask().get(O_CODICE));
|
||||
else
|
||||
error_box("Errore di scrittura sul file dei clienti/fornitori occasionali: %d", err);
|
||||
}
|
||||
if (err) _rel->lfile()->zero("OCFPI");
|
||||
if (err) _rel->lfile().zero("OCFPI");
|
||||
}
|
||||
|
||||
const bool to_swap = test_swap(FALSE);
|
||||
@ -642,7 +642,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
r.put("IMPOSTA", row.get());
|
||||
r.put("TIPOCR", row.get());
|
||||
|
||||
const TConto c(row, -1, 0x1);
|
||||
const TBill c(row, -1, 0x1);
|
||||
const int rimp = bill2pos(c, 'I')+1;
|
||||
r.put("RIGAIMP", rimp);
|
||||
put_conto(r, c);
|
||||
@ -729,7 +729,7 @@ void TPrimanota_application::genera_incasso(const char* causimm)
|
||||
TRectype r(_rel->cg(0)); // Copia la prima riga contabile
|
||||
m.autosave(&inc);
|
||||
|
||||
inc.lfile()->put("REG", ""); // Annulla eventuale registro IVA
|
||||
inc.lfile().put("REG", ""); // Annulla eventuale registro IVA
|
||||
|
||||
const real imp(m.get(F_TOTALE));
|
||||
const char sez = r.get_char("SEZIONE");
|
||||
@ -741,7 +741,7 @@ void TPrimanota_application::genera_incasso(const char* causimm)
|
||||
r.put("SEZIONE", sez == 'A' ? 'D' : 'A');
|
||||
inc.cg(0) = r;
|
||||
|
||||
TConto conto; caus.bill(2, conto); // Conto della seconda riga della causale
|
||||
TBill conto; caus.bill(2, conto); // Conto della seconda riga della causale
|
||||
|
||||
r.put("TIPOC", conto.tipo());
|
||||
r.put("GRUPPO", conto.gruppo());
|
||||
@ -753,7 +753,7 @@ void TPrimanota_application::genera_incasso(const char* causimm)
|
||||
inc.cg(1) = r;
|
||||
|
||||
while (inc.write() == _isreinsert) // In caso di riscrittura
|
||||
inc.lfile()->put("NUMREG", ++_lastreg); // Incrementa numero registrazione
|
||||
inc.lfile().put("NUMREG", ++_lastreg); // Incrementa numero registrazione
|
||||
}
|
||||
}
|
||||
|
||||
|
416
cg/cg2100b.uml
416
cg/cg2100b.uml
@ -1,208 +1,208 @@
|
||||
#include "cg2100.h"
|
||||
|
||||
TOOLBAR "" 0 20 0 2
|
||||
|
||||
#include <toolbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "OPERAZIONE DI PRIMA NOTA" -1 -1 77 20
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 0 "@BMovimento di sola contabilita'"
|
||||
END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 17 1 "Ragione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_NUMREG 7
|
||||
BEGIN
|
||||
PROMPT 57 3 "Operazione n."
|
||||
FIELD NUMREG
|
||||
FLAGS "RD"
|
||||
KEY 1
|
||||
END
|
||||
|
||||
DATE F_DATAREG
|
||||
BEGIN
|
||||
PROMPT 1 3 "Data operazione "
|
||||
FIELD DATAREG
|
||||
END
|
||||
|
||||
|
||||
DATE F_DATACOMP
|
||||
BEGIN
|
||||
PROMPT 1 4 "Data di competenza "
|
||||
FIELD DATACOMP
|
||||
END
|
||||
|
||||
NUMBER F_ANNOES 4
|
||||
BEGIN
|
||||
PROMPT 57 4 "Esercizio "
|
||||
FIELD ANNOES
|
||||
FLAGS "DRZ"
|
||||
END
|
||||
|
||||
DATE F_DATADOC
|
||||
BEGIN
|
||||
PROMPT 1 5 "Data del documento "
|
||||
FIELD DATADOC
|
||||
WARNING "Specificare una data del documento non superiore a quella di registrazione"
|
||||
VALIDATE DATE_CMP_FUNC <= F_DATAREG
|
||||
END
|
||||
|
||||
STRING F_NUMDOC 7
|
||||
BEGIN
|
||||
PROMPT 57 5 "Documento n. "
|
||||
FIELD NUMDOC
|
||||
WARNING "La causale impone di specificare il numero documento"
|
||||
END
|
||||
|
||||
NUMBER F_ANNOIVA 4
|
||||
BEGIN
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
STRING F_DESCAGG 5
|
||||
BEGIN
|
||||
PROMPT 1 6 "Descrizione "
|
||||
FLAGS "U"
|
||||
USE %DPN
|
||||
INPUT CODTAB F_DESCAGG
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_DESCAGG CODTAB
|
||||
OUTPUT F_DESCR S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESCR 50
|
||||
BEGIN
|
||||
PROMPT 25 6 ""
|
||||
FIELD DESCR
|
||||
USE %DPN KEY 2
|
||||
INPUT S0 F_DESCR
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_DESCAGG
|
||||
END
|
||||
|
||||
LIST F_PROVVISORIO 1 25
|
||||
BEGIN
|
||||
PROMPT 1 7 "Movimento provvisorio "
|
||||
FIELD PROVVIS
|
||||
ITEM " |No (movimento normale)"
|
||||
ITEM "P|Si (cancellabile)"
|
||||
ITEM "N|Si (non cancellabile)"
|
||||
END
|
||||
|
||||
STRING F_CODCAUS 3
|
||||
BEGIN
|
||||
PROMPT 1 8 "Causale "
|
||||
FLAGS "U"
|
||||
FIELD CODCAUS
|
||||
USE LF_CAUSALI KEY 1
|
||||
INPUT CODCAUS F_CODCAUS
|
||||
DISPLAY "Codice" CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_CODCAUS CODCAUS
|
||||
OUTPUT F_DESCRCAUS DESCR
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg0 -4
|
||||
END
|
||||
|
||||
STRING F_DESCRCAUS 50
|
||||
BEGIN
|
||||
PROMPT 23 8 ""
|
||||
USE LF_CAUSALI KEY 2
|
||||
INPUT DESCR F_DESCRCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Codice" CODCAUS
|
||||
COPY OUTPUT F_CODCAUS
|
||||
END
|
||||
|
||||
STRING F_VALUTA 3
|
||||
BEGIN
|
||||
PROMPT 1 9 "Valuta "
|
||||
FIELD CODVAL
|
||||
FLAGS "U"
|
||||
GROUP 3
|
||||
USE %VAL
|
||||
INPUT CODTAB F_VALUTA
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Nome@50" S0
|
||||
DISPLAY "Cambio corrente" R0
|
||||
OUTPUT F_VALUTA CODTAB
|
||||
OUTPUT F_CAMBIO R0
|
||||
END
|
||||
|
||||
NUMBER F_CAMBIO 10
|
||||
BEGIN
|
||||
PROMPT 16 9 "Cambio "
|
||||
FIELD CAMBIO
|
||||
FLAGS "RU"
|
||||
GROUP 3
|
||||
PICTURE ".3"
|
||||
END
|
||||
|
||||
BOOLEAN F_VISVAL
|
||||
BEGIN
|
||||
PROMPT 42 9 "Visualizza importi in valuta"
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEETCG
|
||||
BEGIN
|
||||
PROMPT 0 9 ""
|
||||
ITEM "Dare@17"
|
||||
ITEM "Avere@17"
|
||||
ITEM " @1"
|
||||
ITEM "Gr."
|
||||
ITEM "Co."
|
||||
ITEM "Sottoc."
|
||||
ITEM "Descrizione conto@50"
|
||||
ITEM "Codice"
|
||||
ITEM "Descrizione riga@50"
|
||||
ITEM " @1"
|
||||
ITEM "Gr./c"
|
||||
ITEM "Co./c"
|
||||
ITEM "Sottoc./c"
|
||||
ITEM "Descrizione contropartita@50"
|
||||
ITEM " @1"
|
||||
END
|
||||
|
||||
NUMBER F_DARE 17
|
||||
BEGIN
|
||||
PROMPT 1 -1 "Sbilancio Dare "
|
||||
FLAGS "DRV"
|
||||
PICTURE "."
|
||||
END
|
||||
|
||||
NUMBER F_AVERE 17
|
||||
BEGIN
|
||||
PROMPT 41 -1 "Sbilancio Avere "
|
||||
FLAGS "DRV"
|
||||
PICTURE "."
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
#include "cg21cg.uml"
|
||||
|
||||
#include "cg2100.h"
|
||||
|
||||
TOOLBAR "" 0 20 0 2
|
||||
|
||||
#include <toolbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "OPERAZIONE DI PRIMA NOTA" -1 -1 77 20
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 0 "@BMovimento di sola contabilita'"
|
||||
END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 17 1 "Ragione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_NUMREG 7
|
||||
BEGIN
|
||||
PROMPT 57 3 "Operazione n."
|
||||
FIELD NUMREG
|
||||
FLAGS "RD"
|
||||
KEY 1
|
||||
END
|
||||
|
||||
DATE F_DATAREG
|
||||
BEGIN
|
||||
PROMPT 1 3 "Data operazione "
|
||||
FIELD DATAREG
|
||||
END
|
||||
|
||||
|
||||
DATE F_DATACOMP
|
||||
BEGIN
|
||||
PROMPT 1 4 "Data di competenza "
|
||||
FIELD DATACOMP
|
||||
END
|
||||
|
||||
NUMBER F_ANNOES 4
|
||||
BEGIN
|
||||
PROMPT 57 4 "Esercizio "
|
||||
FIELD ANNOES
|
||||
FLAGS "DRZ"
|
||||
END
|
||||
|
||||
DATE F_DATADOC
|
||||
BEGIN
|
||||
PROMPT 1 5 "Data del documento "
|
||||
FIELD DATADOC
|
||||
WARNING "Specificare una data del documento non superiore a quella dell'operazione"
|
||||
VALIDATE DATE_CMP_FUNC <= F_DATAREG
|
||||
END
|
||||
|
||||
STRING F_NUMDOC 7
|
||||
BEGIN
|
||||
PROMPT 57 5 "Documento n. "
|
||||
FIELD NUMDOC
|
||||
WARNING "La causale impone di specificare il numero documento"
|
||||
END
|
||||
|
||||
NUMBER F_ANNOIVA 4
|
||||
BEGIN
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
STRING F_DESCAGG 5
|
||||
BEGIN
|
||||
PROMPT 1 6 "Descrizione "
|
||||
FLAGS "U"
|
||||
USE %DPN
|
||||
INPUT CODTAB F_DESCAGG
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_DESCAGG CODTAB
|
||||
OUTPUT F_DESCR S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_DESCR 50
|
||||
BEGIN
|
||||
PROMPT 25 6 ""
|
||||
FIELD DESCR
|
||||
USE %DPN KEY 2
|
||||
INPUT S0 F_DESCR
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_DESCAGG
|
||||
END
|
||||
|
||||
LIST F_PROVVISORIO 1 25
|
||||
BEGIN
|
||||
PROMPT 1 7 "Movimento provvisorio "
|
||||
FIELD PROVVIS
|
||||
ITEM " |No (movimento normale)"
|
||||
ITEM "P|Si (cancellabile)"
|
||||
ITEM "N|Si (non cancellabile)"
|
||||
END
|
||||
|
||||
STRING F_CODCAUS 3
|
||||
BEGIN
|
||||
PROMPT 1 8 "Causale "
|
||||
FLAGS "U"
|
||||
FIELD CODCAUS
|
||||
USE LF_CAUSALI KEY 1
|
||||
INPUT CODCAUS F_CODCAUS
|
||||
DISPLAY "Codice" CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_CODCAUS CODCAUS
|
||||
OUTPUT F_DESCRCAUS DESCR
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg0 -4
|
||||
END
|
||||
|
||||
STRING F_DESCRCAUS 50
|
||||
BEGIN
|
||||
PROMPT 23 8 ""
|
||||
USE LF_CAUSALI KEY 2
|
||||
INPUT DESCR F_DESCRCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Codice" CODCAUS
|
||||
COPY OUTPUT F_CODCAUS
|
||||
END
|
||||
|
||||
STRING F_VALUTA 3
|
||||
BEGIN
|
||||
PROMPT 1 9 "Valuta "
|
||||
FIELD CODVAL
|
||||
FLAGS "U"
|
||||
GROUP 3
|
||||
USE %VAL
|
||||
INPUT CODTAB F_VALUTA
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Nome@50" S0
|
||||
DISPLAY "Cambio corrente" R0
|
||||
OUTPUT F_VALUTA CODTAB
|
||||
OUTPUT F_CAMBIO R0
|
||||
END
|
||||
|
||||
NUMBER F_CAMBIO 10
|
||||
BEGIN
|
||||
PROMPT 16 9 "Cambio "
|
||||
FIELD CAMBIO
|
||||
FLAGS "RU"
|
||||
GROUP 3
|
||||
PICTURE ".3"
|
||||
END
|
||||
|
||||
BOOLEAN F_VISVAL
|
||||
BEGIN
|
||||
PROMPT 42 9 "Visualizza importi in valuta"
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEETCG
|
||||
BEGIN
|
||||
PROMPT 0 9 ""
|
||||
ITEM "Dare@17"
|
||||
ITEM "Avere@17"
|
||||
ITEM " @1"
|
||||
ITEM "Gr."
|
||||
ITEM "Co."
|
||||
ITEM "Sottoc."
|
||||
ITEM "Descrizione conto@50"
|
||||
ITEM "Codice"
|
||||
ITEM "Descrizione riga@50"
|
||||
ITEM " @1"
|
||||
ITEM "Gr./c"
|
||||
ITEM "Co./c"
|
||||
ITEM "Sottoc./c"
|
||||
ITEM "Descrizione contropartita@50"
|
||||
ITEM " @1"
|
||||
END
|
||||
|
||||
NUMBER F_DARE 17
|
||||
BEGIN
|
||||
PROMPT 1 -1 "Sbilancio Dare "
|
||||
FLAGS "DRV"
|
||||
PICTURE "."
|
||||
END
|
||||
|
||||
NUMBER F_AVERE 17
|
||||
BEGIN
|
||||
PROMPT 41 -1 "Sbilancio Avere "
|
||||
FLAGS "DRV"
|
||||
PICTURE "."
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
#include "cg21cg.uml"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <xvtmacro.h>
|
||||
|
||||
#include <xvtmacro.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "cg2101.h"
|
||||
@ -73,22 +73,22 @@ TRectype& TMovimentoPN::iva(int i)
|
||||
|
||||
int TMovimentoPN::read_mov_rows()
|
||||
{
|
||||
const TLocalisamfile* rm = lfile(LF_RMOV);
|
||||
const TLocalisamfile* ri = lfile(LF_RMOVIVA);
|
||||
const TLocalisamfile& rm = lfile(LF_RMOV);
|
||||
const TLocalisamfile& ri = lfile(LF_RMOVIVA);
|
||||
position_rels();
|
||||
|
||||
destroy_rows();
|
||||
for(bool ok = is_first_match(LF_RMOV); ok; ok = next_match(LF_RMOV))
|
||||
{
|
||||
const int row = rm->get_int(RMV_NUMRIG) - 1;
|
||||
cg(row) = rm->curr();
|
||||
const int row = rm.get_int(RMV_NUMRIG) - 1;
|
||||
cg(row) = rm.curr();
|
||||
}
|
||||
_oldcg = cg_items();
|
||||
|
||||
for(ok = is_first_match(LF_RMOVIVA); ok; ok = next_match(LF_RMOVIVA))
|
||||
{
|
||||
const int row = ri->get_int(RMI_NUMRIG) - 1;
|
||||
iva(row) = ri->curr();
|
||||
const int row = ri.get_int(RMI_NUMRIG) - 1;
|
||||
iva(row) = ri.curr();
|
||||
}
|
||||
_oldiva = iva_items();
|
||||
|
||||
@ -98,54 +98,54 @@ int TMovimentoPN::read_mov_rows()
|
||||
|
||||
int TMovimentoPN::read(TIsamop op, TReclock lockop, TDate& atdate)
|
||||
{
|
||||
int err = file()->read(op, lockop, atdate);
|
||||
int err = file().read(op, lockop, atdate);
|
||||
if (err == NOERR) err = read_mov_rows();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int TMovimentoPN::write_rec(bool re, const TRectype& rec, TLocalisamfile* f)
|
||||
int TMovimentoPN::write_rec(bool re, const TRectype& rec, TLocalisamfile& f)
|
||||
{
|
||||
if (re)
|
||||
{
|
||||
const bool scrivi = f->rewrite(rec) != NOERR;
|
||||
if (scrivi) f->write(rec);
|
||||
const bool scrivi = f.rewrite(rec) != NOERR;
|
||||
if (scrivi) f.write(rec);
|
||||
}
|
||||
else
|
||||
{
|
||||
f->write(rec);
|
||||
f.write(rec);
|
||||
}
|
||||
|
||||
return f->status();
|
||||
return f.status();
|
||||
}
|
||||
|
||||
|
||||
int TMovimentoPN::cancella(TLocalisamfile* f, int da, int a)
|
||||
int TMovimentoPN::cancella(TLocalisamfile& f, int da, int a)
|
||||
{
|
||||
const long numreg = lfile()->get_long("NUMREG");
|
||||
const long numreg = lfile().get_long(MOV_NUMREG);
|
||||
for (int i = da; i <= a; i++)
|
||||
{
|
||||
f->zero();
|
||||
f->put("NUMREG", numreg);
|
||||
f->put("NUMRIG", i);
|
||||
if (f->read(_isequal, _lock) == NOERR)
|
||||
f->remove();
|
||||
f.zero();
|
||||
f.put(MOV_NUMREG, numreg);
|
||||
f.put(RMV_NUMRIG, i);
|
||||
if (f.read(_isequal, _lock) == NOERR)
|
||||
f.remove();
|
||||
}
|
||||
return f->status();
|
||||
return f.status();
|
||||
}
|
||||
|
||||
|
||||
int TMovimentoPN::registra(bool re, bool force)
|
||||
{
|
||||
TLocalisamfile* m = lfile();
|
||||
TLocalisamfile& m = lfile();
|
||||
|
||||
const int err = write_rec(re, m->curr(), m);
|
||||
const int err = write_rec(re, m.curr(), m);
|
||||
if (err != NOERR) return err;
|
||||
|
||||
TLocalisamfile* rm = lfile(LF_RMOV);
|
||||
TLocalisamfile* ri = lfile(LF_RMOVIVA);
|
||||
TLocalisamfile& rm = lfile(LF_RMOV);
|
||||
TLocalisamfile& ri = lfile(LF_RMOVIVA);
|
||||
|
||||
const long numreg = m->get_long("NUMREG");
|
||||
const long numreg = m.get_long("NUMREG");
|
||||
|
||||
for (int i = 0 ; i < cg_items(); i++)
|
||||
{
|
||||
@ -174,7 +174,7 @@ int TMovimentoPN::registra(bool re, bool force)
|
||||
|
||||
int TMovimentoPN::write(bool force, TDate&)
|
||||
{
|
||||
const TLocalisamfile& r = *lfile();
|
||||
const TLocalisamfile& r = lfile();
|
||||
const int annoiva = r.get_int("ANNOIVA");
|
||||
const TString16 reg(r.get("REG"));
|
||||
TRegistro registro(reg, annoiva);
|
||||
@ -194,7 +194,7 @@ int TMovimentoPN::write(bool force, TDate&)
|
||||
const char tipo = r.get_char("TIPOC");
|
||||
if (tipo == ' ')
|
||||
{
|
||||
TConto c(r.get_int("GRUPPO"), r.get_int("CONTO"), r.get_long("SOTTOCONTO"));
|
||||
TBill c(r.get_int("GRUPPO"), r.get_int("CONTO"), r.get_long("SOTTOCONTO"));
|
||||
TRectype conto(LF_PCON); c.read(conto);
|
||||
const TIndbil ib = (TIndbil)conto.get_int("INDBIL");
|
||||
if (ib == ib_passivita || ib == ib_ricavi)
|
||||
@ -238,14 +238,14 @@ int TMovimentoPN::rewrite(bool force, TDate&)
|
||||
|
||||
int TMovimentoPN::remove(TDate&)
|
||||
{
|
||||
TLocalisamfile* m = lfile();
|
||||
TLocalisamfile* rm = lfile(LF_RMOV);
|
||||
TLocalisamfile* ri = lfile(LF_RMOVIVA);
|
||||
TLocalisamfile& m = lfile();
|
||||
TLocalisamfile& rm = lfile(LF_RMOV);
|
||||
TLocalisamfile& ri = lfile(LF_RMOVIVA);
|
||||
|
||||
cancella(rm, 1, _oldcg);
|
||||
cancella(ri, 1, _oldiva);
|
||||
m->remove();
|
||||
m.remove();
|
||||
_oldcg = _oldiva = 0;
|
||||
return m->status();
|
||||
return m.status();
|
||||
}
|
||||
|
||||
|
102
cg/cg2101.h
102
cg/cg2101.h
@ -1,51 +1,51 @@
|
||||
#ifndef __CG2101_H
|
||||
#define __CG2101_H
|
||||
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
|
||||
class TMovimentoPN : public TRelation
|
||||
{
|
||||
// class TMovimentoPN : public TRelation
|
||||
// @END
|
||||
|
||||
// @DPRIV
|
||||
TArray _cg, _iva;
|
||||
int _oldcg, _oldiva;
|
||||
real _balance;
|
||||
// @END
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
int write_rec(bool re, const TRectype&r, TLocalisamfile* f);
|
||||
int cancella(TLocalisamfile* f, int da, int a);
|
||||
int registra(bool re, bool force);
|
||||
int read_mov_rows();
|
||||
// @END
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
virtual int next(TReclock lockop = _nolock) { return (file()->next(lockop) || read_mov_rows()); }
|
||||
virtual int prev(TReclock lockop = _nolock) { return (file()->prev(lockop) || read_mov_rows()); }
|
||||
virtual int first(TReclock lockop = _nolock) { return (file()->first(lockop) || read_mov_rows()); }
|
||||
virtual int last(TReclock lockop = _nolock) { return (file()->last(lockop) || read_mov_rows()); }
|
||||
virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return (file()->skip(nrec, lockop) || read_mov_rows()); }
|
||||
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime);
|
||||
virtual int write (bool force = TRUE, TDate& atdate = (TDate&)botime);
|
||||
virtual int rewrite(bool force = TRUE, TDate& atdate = (TDate&)botime);
|
||||
virtual int remove (TDate& atdate = (TDate&)botime);
|
||||
|
||||
TRectype& cg(int i);
|
||||
TRectype& iva(int i);
|
||||
int cg_items() const { return _cg.items(); }
|
||||
int iva_items() const { return _iva.items(); }
|
||||
void destroy_rows();
|
||||
|
||||
TMovimentoPN();
|
||||
virtual ~TMovimentoPN() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef __CG2101_H
|
||||
#define __CG2101_H
|
||||
|
||||
#ifndef __RELATION_H
|
||||
#include <relation.h>
|
||||
#endif
|
||||
|
||||
int date2esc(const TDate& d, int* prevesc = NULL);
|
||||
|
||||
class TMovimentoPN : public TRelation
|
||||
{
|
||||
// class TMovimentoPN : public TRelation
|
||||
// @END
|
||||
|
||||
// @DPRIV
|
||||
TArray _cg, _iva;
|
||||
int _oldcg, _oldiva;
|
||||
real _balance;
|
||||
// @END
|
||||
|
||||
protected:
|
||||
// @FPROT
|
||||
int write_rec(bool re, const TRectype&r, TLocalisamfile& f);
|
||||
int cancella(TLocalisamfile& f, int da, int a);
|
||||
int registra(bool re, bool force);
|
||||
int read_mov_rows();
|
||||
// @END
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
virtual int next(TReclock lockop = _nolock) { return (file().next(lockop) || read_mov_rows()); }
|
||||
virtual int prev(TReclock lockop = _nolock) { return (file().prev(lockop) || read_mov_rows()); }
|
||||
virtual int first(TReclock lockop = _nolock) { return (file().first(lockop) || read_mov_rows()); }
|
||||
virtual int last(TReclock lockop = _nolock) { return (file().last(lockop) || read_mov_rows()); }
|
||||
virtual int skip(TRecnotype nrec, TReclock lockop = _nolock) { return (file().skip(nrec, lockop) || read_mov_rows()); }
|
||||
virtual int read(TIsamop op = _isgteq, TReclock lockop = _nolock, TDate& atdate = (TDate&)botime);
|
||||
virtual int write (bool force = TRUE, TDate& atdate = (TDate&)botime);
|
||||
virtual int rewrite(bool force = TRUE, TDate& atdate = (TDate&)botime);
|
||||
virtual int remove (TDate& atdate = (TDate&)botime);
|
||||
|
||||
TRectype& cg(int i);
|
||||
TRectype& iva(int i);
|
||||
int cg_items() const { return _cg.items(); }
|
||||
int iva_items() const { return _iva.items(); }
|
||||
void destroy_rows();
|
||||
|
||||
TMovimentoPN();
|
||||
virtual ~TMovimentoPN() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -88,10 +88,10 @@ bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k)
|
||||
const TEdit_field& c = (const TEdit_field&)f;
|
||||
const TBrowse* b = c.browse();
|
||||
CHECKD(b, "Can't check suspension of a edit-field without a USE ", f.dlg());
|
||||
const TLocalisamfile* i = b->cursor()->file();
|
||||
const TLocalisamfile& i = b->cursor()->file();
|
||||
|
||||
const char* sf = i->tab() ? "B2" : "SOSPESO";
|
||||
const bool suspended = i->get_bool(sf);
|
||||
const char* sf = i.tab() ? "B2" : "SOSPESO";
|
||||
const bool suspended = i.get_bool(sf);
|
||||
if (suspended)
|
||||
{
|
||||
sf = f.get();
|
||||
@ -141,7 +141,7 @@ int TPrimanota_application::type2pos(char tipo)
|
||||
}
|
||||
|
||||
|
||||
int TPrimanota_application::bill2pos(const TConto& conto, char tipo)
|
||||
int TPrimanota_application::bill2pos(const TBill& conto, char tipo)
|
||||
{
|
||||
TSheet_field& cg = app().cgs();
|
||||
for (int i = 0; i < cg.items(); i++)
|
||||
@ -149,7 +149,7 @@ int TPrimanota_application::bill2pos(const TConto& conto, char tipo)
|
||||
TToken_string& s = cg.row(i);
|
||||
if (s[s.len()-1] == tipo)
|
||||
{
|
||||
const TConto c(s, 3, 0x0);
|
||||
const TBill c(s, 3, 0x0);
|
||||
if (c == conto)
|
||||
return i;
|
||||
}
|
||||
@ -158,7 +158,7 @@ int TPrimanota_application::bill2pos(const TConto& conto, char tipo)
|
||||
}
|
||||
|
||||
|
||||
int TPrimanota_application::bill2contr(const TConto& conto, char sezione) const
|
||||
int TPrimanota_application::bill2contr(const TBill& conto, char sezione) const
|
||||
{
|
||||
const TArray& rows = cgs().rows_array();
|
||||
for (int i = 0; i < rows.items(); i++)
|
||||
@ -167,7 +167,7 @@ int TPrimanota_application::bill2contr(const TConto& conto, char sezione) const
|
||||
const char sez = row.get(0)[0] > ' ' ? 'D' : 'A';
|
||||
if (sez == sezione) // Devo cercare sezione contraria
|
||||
continue;
|
||||
const TConto c(row, 3, 0x0);
|
||||
const TBill c(row, 3, 0x0);
|
||||
if (conto == c)
|
||||
return i;
|
||||
}
|
||||
@ -176,7 +176,7 @@ int TPrimanota_application::bill2contr(const TConto& conto, char sezione) const
|
||||
|
||||
|
||||
// Controlla se un conto e' usato nelle righe IVA
|
||||
int TPrimanota_application::bill_used(const TConto& conto) const
|
||||
int TPrimanota_application::bill_used(const TBill& conto) const
|
||||
{
|
||||
int users = 0;
|
||||
|
||||
@ -186,7 +186,7 @@ int TPrimanota_application::bill_used(const TConto& conto) const
|
||||
TToken_string& row = (TToken_string&)rows[i];
|
||||
if (!row.empty_items())
|
||||
{
|
||||
const TConto c(row, 6, 0x0);
|
||||
const TBill c(row, 6, 0x0);
|
||||
if (conto == c) users++;
|
||||
}
|
||||
}
|
||||
@ -318,7 +318,7 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
|
||||
|
||||
|
||||
int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
|
||||
TConto& conto, const char* desc,
|
||||
TBill& conto, const char* desc,
|
||||
char tipo)
|
||||
{
|
||||
TSheet_field& cg = cgs();
|
||||
@ -333,7 +333,7 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
|
||||
int pos = 0;
|
||||
if (tipo == 'I' && (pos = type2pos('T')) >= 0)
|
||||
{
|
||||
TConto contro(cg.row(pos), 2, 0x3);
|
||||
TBill contro(cg.row(pos), 2, 0x3);
|
||||
row.add(contro.string(0x3));
|
||||
}
|
||||
else
|
||||
@ -461,9 +461,9 @@ bool TPrimanota_application::cg_notify(int r, KEY k)
|
||||
if (r == 0 && app().iva() == nessuna_iva && cg.row(1).empty_items())
|
||||
{
|
||||
TImporto i; i = row; i.swap_section();
|
||||
TConto contro(row, 9, 0x3);
|
||||
TBill contro(row, 9, 0x3);
|
||||
app().set_cgs_row(1, i, contro, "", ' ');
|
||||
TConto conto(row, 2, 0x3);
|
||||
TBill conto(row, 2, 0x3);
|
||||
conto.add_to(cg.row(1), 9, 0x3);
|
||||
app().cgs().force_update(1);
|
||||
}
|
||||
@ -513,7 +513,7 @@ TSheet_field& TPrimanota_application::ivas() const
|
||||
}
|
||||
|
||||
|
||||
void TPrimanota_application::set_ivas_row(int nriga, const char* codiva, TConto& tc,
|
||||
void TPrimanota_application::set_ivas_row(int nriga, const char* codiva, TBill& tc,
|
||||
const char* desc)
|
||||
{
|
||||
TToken_string& riga = ivas().row(nriga);
|
||||
@ -638,11 +638,11 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
|
||||
oldposiva = type2pos(tipod); // Tipodet 4
|
||||
if (oldposiva < 0 && oldiva != ZERO)
|
||||
{
|
||||
TConto c; app().causale().bill(tipod == 'D' ? 3 : 4, c);
|
||||
TBill c; app().causale().bill(tipod == 'D' ? 3 : 4, c);
|
||||
oldposiva = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, "", tipod);
|
||||
}
|
||||
|
||||
TConto oldconto(row, 5, 0x1); // t/g/c/s 5 6 7 8
|
||||
TBill oldconto(row, 5, 0x1); // t/g/c/s 5 6 7 8
|
||||
oldpos = bill2pos(oldconto, 'I');
|
||||
if (oldpos < 0 && oldconto.ok())
|
||||
oldpos = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), oldconto, "", 'I');
|
||||
@ -666,7 +666,7 @@ bool TPrimanota_application::iva_notify(int r, KEY k)
|
||||
|
||||
// Aggiorna conto sulla riga contabile
|
||||
real imp(row.get(0)); // Imponibile
|
||||
TConto conto(row, 5, 0x3);
|
||||
TBill conto(row, 5, 0x3);
|
||||
const int newpos = bill2pos(conto, 'I');
|
||||
|
||||
if (newpos < 0)
|
||||
@ -952,7 +952,7 @@ bool TPrimanota_application::occas_code_handler(TMask_field& f, KEY key)
|
||||
if (*code)
|
||||
{
|
||||
TRelation occas(LF_OCCAS);
|
||||
occas.lfile()->put("CFPI", code);
|
||||
occas.lfile().put("CFPI", code);
|
||||
if (occas.read() == NOERR)
|
||||
{
|
||||
f.mask().autoload(&occas);
|
||||
@ -996,14 +996,14 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
|
||||
// Se l'utente non ha ancora specificato un conto lo prendo dalla prima riga della causale
|
||||
if (conto == 0)
|
||||
{
|
||||
TConto bill; _causale.bill(1, bill);
|
||||
TBill bill; _causale.bill(1, bill);
|
||||
gruppo = bill.gruppo(); m.set(F_GRUPPOCLIFO, gruppo);
|
||||
conto = bill.conto(); m.set(F_CONTOCLIFO, conto);
|
||||
}
|
||||
|
||||
if (tipo == 'C' && causale().corrispettivi())
|
||||
tipo = ' ';
|
||||
TConto c(gruppo, conto, codice, tipo);
|
||||
TBill c(gruppo, conto, codice, tipo);
|
||||
real tot(m.get(F_TOTALE));
|
||||
|
||||
// Creazione/Aggiornamento riga totale
|
||||
@ -1055,7 +1055,7 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
|
||||
row.add(iva.codice(), 1); // codice IVA
|
||||
row.add(imposta.string(), 3); // imposta
|
||||
|
||||
TConto bill; // Conto della prima riga IVA
|
||||
TBill bill; // Conto della prima riga IVA
|
||||
const TString& tipo = iva.tipo();
|
||||
if (tipo.not_empty())
|
||||
{
|
||||
@ -1106,7 +1106,7 @@ void TPrimanota_application::add_cgs_rit(bool fiscali)
|
||||
if (pos < 0)
|
||||
{
|
||||
const int riga = fiscali ? 8 : 9;
|
||||
TConto conto; _causale.bill(riga, conto);
|
||||
TBill conto; _causale.bill(riga, conto);
|
||||
|
||||
TString80 desc("Ritenute ");
|
||||
desc << (fiscali ? "fiscali" : "sociali");
|
||||
|
16
cg/cg2102.h
16
cg/cg2102.h
@ -44,7 +44,7 @@ class TPrimanota_application : public TRelation_application
|
||||
|
||||
TMask* _msk[4]; // Maschere di query, cg, iva
|
||||
long _lastreg; // Numero ultima registrazione
|
||||
int _mode; // Modo maschera corrente
|
||||
int _mode; // Modo maschera corrente
|
||||
|
||||
static bool suspended_handler(TMask_field& f, KEY k);
|
||||
static bool num_handler(TMask_field& f, KEY key);
|
||||
@ -96,8 +96,8 @@ protected:
|
||||
TMask* load_mask(int n);
|
||||
TMask& occas_mask() { return *load_mask(3); }
|
||||
|
||||
bool get_conto(const TRectype& r, TConto& c) const;
|
||||
void put_conto(TRectype& r, const TConto& c) const;
|
||||
bool get_conto(const TRectype& r, TBill& c) const;
|
||||
void put_conto(TRectype& r, const TBill& c) const;
|
||||
|
||||
void mask2rel(const TMask& m);
|
||||
|
||||
@ -110,7 +110,7 @@ protected:
|
||||
TSheet_field& cgs() const;
|
||||
TSheet_field& ivas() const;
|
||||
|
||||
static int bill2pos(const TConto& conto, char tipo);
|
||||
static int bill2pos(const TBill& conto, char tipo);
|
||||
static TipoIVA reg2IVA(const char* registro, int anno);
|
||||
static TipoIVA cau2IVA(const char* causale, int anno);
|
||||
static int type2pos(char tipo);
|
||||
@ -118,8 +118,8 @@ protected:
|
||||
static real scorpora(real& imponibile, const real& percentuale);
|
||||
static bool detraibile(int tipodet);
|
||||
|
||||
int bill2contr(const TConto& c, char sezione) const;
|
||||
int bill_used(const TConto& conto) const;
|
||||
int bill2contr(const TBill& c, char sezione) const;
|
||||
int bill_used(const TBill& conto) const;
|
||||
int det_used(char detraib) const;
|
||||
|
||||
bool read_caus(const char* cod, int year);
|
||||
@ -139,8 +139,8 @@ protected:
|
||||
real calcola_saldo() const;
|
||||
real calcola_imp() const;
|
||||
|
||||
void set_ivas_row(int n, const char* codiva, TConto& tc, const char* desc);
|
||||
int set_cgs_row(int n, const TImporto& importo, TConto& conto, const char* desc, char tipo);
|
||||
void set_ivas_row(int n, const char* codiva, TBill& tc, const char* desc);
|
||||
int set_cgs_row(int n, const TImporto& importo, TBill& conto, const char* desc, char tipo);
|
||||
void disable_cgs_cells(int n, char tipo);
|
||||
void add_cgs_tot(TMask& m);
|
||||
void add_cgs_rit(bool fisc);
|
||||
|
@ -57,6 +57,7 @@ bool TRegistro::read(const char* cod, int year)
|
||||
_att.zero();
|
||||
if (err != NOERR)
|
||||
_rec.zero();
|
||||
|
||||
return err == NOERR;
|
||||
}
|
||||
|
||||
@ -200,7 +201,7 @@ bool TLibro_giornale::read(int y)
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
/* Now obsolete
|
||||
TDate TLibro_giornale::global_last_print() const
|
||||
{
|
||||
TTable reg("REG");
|
||||
@ -300,7 +301,7 @@ const TRectype& TCausale::row(int num) const
|
||||
}
|
||||
|
||||
|
||||
TConto& TCausale::bill(int num, TConto& conto) const
|
||||
TBill& TCausale::bill(int num, TBill& conto) const
|
||||
{
|
||||
const TRectype& rec = row(num);
|
||||
conto.set(rec.get_int("GRUPPO"), rec.get_int("CONTO"),
|
||||
|
@ -78,7 +78,7 @@ protected:
|
||||
const TRectype& row(int num) const;
|
||||
|
||||
public:
|
||||
TConto& bill(int num, TConto& c) const;
|
||||
TBill& bill(int num, TBill& c) const;
|
||||
|
||||
bool data_doc() const;
|
||||
bool num_doc() const;
|
||||
|
84
cg/cg2200.cpp
Executable file
84
cg/cg2200.cpp
Executable file
@ -0,0 +1,84 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include "cg2200.h"
|
||||
#include "cg2101.h"
|
||||
|
||||
#include <mov.h>
|
||||
#include <rmov.h>
|
||||
#include <rmoviva.h>
|
||||
|
||||
class TDeleteprovv_app : public TApplication
|
||||
{
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
|
||||
public:
|
||||
TDeleteprovv_app() {};
|
||||
};
|
||||
|
||||
bool TDeleteprovv_app::create()
|
||||
{
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TDeleteprovv_app::destroy()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TDeleteprovv_app::menu(MENU_TAG)
|
||||
{
|
||||
TLocalisamfile mov(LF_MOV), rmov(LF_RMOV), rmoviva(LF_RMOVIVA);
|
||||
TMask m("cg2200a");
|
||||
|
||||
while (m.run() != K_QUIT)
|
||||
{
|
||||
mov.setkey(2);
|
||||
rmov.setkey(1);
|
||||
rmoviva.setkey(1);
|
||||
|
||||
TRectype to(mov.curr());
|
||||
to.zero();
|
||||
to.put(MOV_DATAREG, m.get(F_TODATE));
|
||||
to.put(MOV_NUMREG, m.get(F_TOREG));
|
||||
|
||||
mov.zero();
|
||||
mov.put(MOV_DATAREG, m.get(F_FROMDATE));
|
||||
mov.put(MOV_NUMREG, m.get(F_FROMREG));
|
||||
for (mov.read(_isequal, _lock); mov.good(); mov.next())
|
||||
{
|
||||
if (mov.curr() > to) break;
|
||||
const long numreg = mov.get_long(MOV_NUMREG);
|
||||
for (int rig = 1; ; rig++)
|
||||
{
|
||||
rmov.put(RMV_NUMREG, numreg);
|
||||
rmov.put(RMV_NUMRIG, rig);
|
||||
if (rmov.read(_isequal, _lock) != NOERR) break;
|
||||
rmov.remove();
|
||||
}
|
||||
for (rig = 1; ; rig++)
|
||||
{
|
||||
rmov.put(RMI_NUMREG, numreg);
|
||||
rmoviva.put(RMI_NUMRIG, rig);
|
||||
if (rmoviva.read(_isequal, _lock) != NOERR) break;
|
||||
rmov.remove();
|
||||
}
|
||||
mov.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int cg2200(int argc, char** argv)
|
||||
{
|
||||
TDeleteprovv_app a;
|
||||
a.run(argc, argv, "Cancellazione movimenti provvisori");
|
||||
return 0;
|
||||
}
|
4
cg/cg2200.h
Executable file
4
cg/cg2200.h
Executable file
@ -0,0 +1,4 @@
|
||||
#define F_FROMDATE 101
|
||||
#define F_FROMREG 102
|
||||
#define F_TODATE 103
|
||||
#define F_TOREG 104
|
60
cg/cg2200a.uml
Executable file
60
cg/cg2200a.uml
Executable file
@ -0,0 +1,60 @@
|
||||
#include "cg2200.h"
|
||||
|
||||
PAGE "Eliminazione Movimenti Provvisori" -1 -1 44 9
|
||||
|
||||
GROUPBOX DLG_NULL 42 3
|
||||
BEGIN
|
||||
PROMPT 1 1 "Dal movimento"
|
||||
END
|
||||
|
||||
DATE F_FROMDATE
|
||||
BEGIN
|
||||
PROMPT 2 2 "Data "
|
||||
USE LF_MOV KEY 2 SELECT PROVVIS="P"
|
||||
INPUT DATAREG F_FROMDATE
|
||||
INPUT NUMREG F_FROMREG
|
||||
DISPLAY "Data@10" DATAREG
|
||||
DISPLAY "Numero@6" NUMREG
|
||||
DISPLAY "Causale" CODCAUS
|
||||
DISPLAY "Documento" NUMDOC
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_FROMDATE DATAREG
|
||||
OUTPUT F_FROMREG NUMREG
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
NUMBER F_FROMREG 5
|
||||
BEGIN
|
||||
PROMPT 22 2 "Operazione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 42 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "Al movimento"
|
||||
END
|
||||
|
||||
DATE F_TODATE
|
||||
BEGIN
|
||||
PROMPT 2 5 "Data "
|
||||
COPY ALL F_FROMDATE
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
NUMBER F_TOREG 5
|
||||
BEGIN
|
||||
PROMPT 22 5 "Operazione "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
271
cg/cg3100.cpp
271
cg/cg3100.cpp
@ -8,8 +8,6 @@
|
||||
#include <utility.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
|
||||
#include <mov.h>
|
||||
#include <rmov.h>
|
||||
#include <rmoviva.h>
|
||||
@ -102,7 +100,7 @@ public:
|
||||
void incrementa_totali();
|
||||
void compila_clifo();
|
||||
void compila_comuni();
|
||||
int my_next (TLocalisamfile*);
|
||||
int my_next (TLocalisamfile&);
|
||||
|
||||
CG3100_application() {}
|
||||
};
|
||||
@ -160,17 +158,17 @@ bool annoes(TMask_field& f, KEY k)
|
||||
|
||||
bool data_inizio(TMask_field& f, KEY k)
|
||||
{
|
||||
CG3100_application * app = (CG3100_application*)MainApp();
|
||||
CG3100_application &app = (CG3100_application&)main_app();
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
int decidi;
|
||||
int anno = f.mask().get_int (F_ANNO);
|
||||
TDate data = f.mask().get(F_DATAINI);
|
||||
if (app->_masc == "cg3100a")
|
||||
if (app._masc == "cg3100a")
|
||||
decidi = f.mask().get_int (F_DECIDI);
|
||||
if ( anno != 0 && ( (app->_masc == "cg3100b") ||
|
||||
((app->_masc == "cg3100a" ) && (decidi == 2)) ) )
|
||||
if ( anno != 0 && ( (app._masc == "cg3100b") ||
|
||||
((app._masc == "cg3100a" ) && (decidi == 2)) ) )
|
||||
{
|
||||
if (!data.ok()) //se la data e' vuota
|
||||
f.mask().field(F_DATAINI).set(InizioEsercizio(anno));
|
||||
@ -187,7 +185,7 @@ bool data_inizio(TMask_field& f, KEY k)
|
||||
|
||||
bool data_fine(TMask_field& f, KEY k)
|
||||
{
|
||||
CG3100_application * app = (CG3100_application*)MainApp();
|
||||
CG3100_application & app = (CG3100_application&)main_app();
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
@ -195,18 +193,18 @@ bool data_fine(TMask_field& f, KEY k)
|
||||
int anno = f.mask().get_int (F_ANNO);
|
||||
TDate dataini = f.mask().get(F_DATAINI);
|
||||
TDate datafin = f.mask().get(F_DATAFIN);
|
||||
if (app->_masc == "cg3100a")
|
||||
if (app._masc == "cg3100a")
|
||||
decidi = f.mask().get_int (F_DECIDI);
|
||||
if ( (app->_masc == "cg3100b") ||
|
||||
((app->_masc == "cg3100a" ) && (decidi == 2)) )
|
||||
if ( (app._masc == "cg3100b") ||
|
||||
((app._masc == "cg3100a" ) && (decidi == 2)) )
|
||||
if ( dataini.ok() && datafin.ok() )
|
||||
if (dataini > datafin)
|
||||
{
|
||||
f.error_box("La data iniziale non deve essere superiore alla data finale");
|
||||
return FALSE;
|
||||
}
|
||||
if ( anno != 0 && ( (app->_masc == "cg3100b") ||
|
||||
((app->_masc == "cg3100a" ) && (decidi == 2)) ) )
|
||||
if ( anno != 0 && ( (app._masc == "cg3100b") ||
|
||||
((app._masc == "cg3100a" ) && (decidi == 2)) ) )
|
||||
{
|
||||
TDate fine = FineEsercizio(anno + 1);
|
||||
if (fine == botime)
|
||||
@ -233,16 +231,16 @@ void CG3100_application::compila_clifo()
|
||||
_clifo->read();
|
||||
if (_clifo->bad())
|
||||
_clifo->zero();
|
||||
_alleg = _clifo->curr().get_int(CLI_ALLEG);
|
||||
_statocf = _clifo->curr().get(CLI_STATOCF);
|
||||
_comcf = _clifo->curr().get(CLI_COMCF);
|
||||
_ragsoc = _clifo->curr().get(CLI_RAGSOC);
|
||||
_indcf = _clifo->curr().get(CLI_INDCF);
|
||||
_civcf = _clifo->curr().get(CLI_CIVCF);
|
||||
_paiv = _clifo->curr().get(CLI_PAIV);
|
||||
_capcf = _clifo->curr().get(CLI_CAPCF);
|
||||
_cofi = _clifo->curr().get(CLI_COFI);
|
||||
_codalleg = _clifo->curr().get_long(CLI_CODALLEG);
|
||||
_alleg = _clifo->get_int(CLI_ALLEG);
|
||||
_statocf = _clifo->get(CLI_STATOCF);
|
||||
_comcf = _clifo->get(CLI_COMCF);
|
||||
_ragsoc = _clifo->get(CLI_RAGSOC);
|
||||
_indcf = _clifo->get(CLI_INDCF);
|
||||
_civcf = _clifo->get(CLI_CIVCF);
|
||||
_paiv = _clifo->get(CLI_PAIV);
|
||||
_capcf = _clifo->get(CLI_CAPCF);
|
||||
_cofi = _clifo->get(CLI_COFI);
|
||||
_codalleg = _clifo->get_long(CLI_CODALLEG);
|
||||
}
|
||||
|
||||
void CG3100_application::compila_comuni()
|
||||
@ -416,35 +414,35 @@ const int CodiceRegistro (const char* cod, int anno)
|
||||
|
||||
bool filter_func_fatture (const TRelation * rel)
|
||||
{
|
||||
CG3100_application * app = (CG3100_application*)MainApp();
|
||||
CG3100_application & app = (CG3100_application&)main_app();
|
||||
int tipo_reg;
|
||||
int ann_reg;
|
||||
TString cod_reg;
|
||||
TLocalisamfile * mov = rel->lfile(LF_MOV);
|
||||
TRectype from (mov->curr());
|
||||
TRectype to (mov->curr());
|
||||
ann_reg = mov->get_int (MOV_ANNOIVA);
|
||||
cod_reg = mov->get (MOV_REG);
|
||||
TLocalisamfile & mov = rel->lfile(LF_MOV);
|
||||
TRectype from (mov.curr());
|
||||
TRectype to (mov.curr());
|
||||
ann_reg = mov.get_int (MOV_ANNOIVA);
|
||||
cod_reg = mov.get (MOV_REG);
|
||||
tipo_reg = CodiceRegistro (cod_reg, ann_reg);
|
||||
from.zero();
|
||||
to.zero();
|
||||
if (app->_annoes != 0) //anno esercizio specificato nella maschera
|
||||
if (app._annoes != 0) //anno esercizio specificato nella maschera
|
||||
{
|
||||
from.put(MOV_ANNOES, app->_annoes);
|
||||
to.put(MOV_ANNOES, app->_annoes);
|
||||
from.put(MOV_ANNOES, app._annoes);
|
||||
to.put(MOV_ANNOES, app._annoes);
|
||||
}
|
||||
//if (app->_data_ini.ok())
|
||||
// from.put(MOV_DATAREG, app->_data_ini);
|
||||
from.put(MOV_TIPO, app->_tipo_ini);
|
||||
if (app->_codice_ini != 0)
|
||||
from.put(MOV_CODCF, app->_codice_ini);
|
||||
//if (app->_data_fin.ok())
|
||||
// to.put(MOV_DATAREG, app->_data_fin);
|
||||
to.put(MOV_TIPO, app->_tipo_fin);
|
||||
if (app->_codice_fin != 0)
|
||||
to.put(MOV_CODCF, app->_codice_fin);
|
||||
//if (app._data_ini.ok())
|
||||
// from.put(MOV_DATAREG, app._data_ini);
|
||||
from.put(MOV_TIPO, app._tipo_ini);
|
||||
if (app._codice_ini != 0)
|
||||
from.put(MOV_CODCF, app._codice_ini);
|
||||
//if (app._data_fin.ok())
|
||||
// to.put(MOV_DATAREG, app._data_fin);
|
||||
to.put(MOV_TIPO, app._tipo_fin);
|
||||
if (app._codice_fin != 0)
|
||||
to.put(MOV_CODCF, app._codice_fin);
|
||||
|
||||
if (((mov->curr() >= from) && (mov->curr() <= to)) &&
|
||||
if (((mov.curr() >= from) && (mov.curr() <= to)) &&
|
||||
((tipo_reg == 1) || (tipo_reg == 2)))
|
||||
return TRUE;
|
||||
|
||||
@ -453,47 +451,47 @@ bool filter_func_fatture (const TRelation * rel)
|
||||
|
||||
bool filter_func (const TRelation * rel)
|
||||
{
|
||||
CG3100_application * app = (CG3100_application*)MainApp();
|
||||
CG3100_application & app = (CG3100_application&)main_app();
|
||||
int tipo_reg, ann_reg;
|
||||
TString cod_reg, causale;
|
||||
TLocalisamfile * mov = rel->lfile(LF_MOV);
|
||||
TRectype from (mov->curr());
|
||||
TRectype to (mov->curr());
|
||||
switch (app->_scelta_stampa)
|
||||
TLocalisamfile & mov = rel->lfile(LF_MOV);
|
||||
TRectype from (mov.curr());
|
||||
TRectype to (mov.curr());
|
||||
switch (app._scelta_stampa)
|
||||
{
|
||||
case 0:
|
||||
ann_reg = mov->get_int(MOV_ANNOIVA);
|
||||
causale = mov->get (MOV_CODCAUS);
|
||||
ann_reg = mov.get_int(MOV_ANNOIVA);
|
||||
causale = mov.get (MOV_CODCAUS);
|
||||
from.zero();
|
||||
to.zero();
|
||||
if ( (app->_decidi == 2) && (app->_annoes != 0) )
|
||||
if ( (app._decidi == 2) && (app._annoes != 0) )
|
||||
{
|
||||
from.put(MOV_ANNOES, app->_annoes);
|
||||
to.put(MOV_ANNOES, app->_annoes);
|
||||
from.put(MOV_ANNOES, app._annoes);
|
||||
to.put(MOV_ANNOES, app._annoes);
|
||||
}
|
||||
from.put(MOV_CODCAUS, app->_causale_ini);
|
||||
to.put(MOV_CODCAUS, app->_causale_fin);
|
||||
from.put(MOV_REG, app->_registro_ini);
|
||||
to.put(MOV_REG, app->_registro_fin);
|
||||
if ((mov->curr() >= from) && (mov->curr() <= to))
|
||||
from.put(MOV_CODCAUS, app._causale_ini);
|
||||
to.put(MOV_CODCAUS, app._causale_fin);
|
||||
from.put(MOV_REG, app._registro_ini);
|
||||
to.put(MOV_REG, app._registro_fin);
|
||||
if ((mov.curr() >= from) && (mov.curr() <= to))
|
||||
return TRUE;
|
||||
break;
|
||||
case 1:
|
||||
cod_reg = mov->get (MOV_REG);
|
||||
ann_reg = mov->get_int (MOV_ANNOIVA);
|
||||
cod_reg = mov.get (MOV_REG);
|
||||
ann_reg = mov.get_int (MOV_ANNOIVA);
|
||||
tipo_reg = CodiceRegistro(cod_reg, ann_reg);
|
||||
causale = mov->get (MOV_CODCAUS);
|
||||
causale = mov.get (MOV_CODCAUS);
|
||||
from.zero();
|
||||
to.zero();
|
||||
if ( (app->_decidi == 2) && (app->_annoes != 0) )
|
||||
if ( (app._decidi == 2) && (app._annoes != 0) )
|
||||
{
|
||||
from.put(MOV_ANNOES, app->_annoes);
|
||||
to.put(MOV_ANNOES, app->_annoes);
|
||||
from.put(MOV_ANNOES, app._annoes);
|
||||
to.put(MOV_ANNOES, app._annoes);
|
||||
}
|
||||
from.put(MOV_CODCAUS, app->_causale_ini);
|
||||
to.put(MOV_CODCAUS, app->_causale_fin);
|
||||
from.put(MOV_CODCAUS, app._causale_ini);
|
||||
to.put(MOV_CODCAUS, app._causale_fin);
|
||||
|
||||
if (((mov->curr() >= from) && (mov->curr() <= to)) &&
|
||||
if (((mov.curr() >= from) && (mov.curr() <= to)) &&
|
||||
((tipo_reg != 1) && (tipo_reg != 2)))
|
||||
return TRUE;
|
||||
|
||||
@ -689,15 +687,15 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
_registro = current_cursor()->curr(LF_MOV).get(MOV_REG);
|
||||
_anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
|
||||
_tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
|
||||
_datareg = current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG);
|
||||
_datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG);
|
||||
_causale_gia_stampata = FALSE;
|
||||
|
||||
//TDate data_corrente (current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG));
|
||||
_tiporegistro = CodiceRegistro(_registro, _anno);
|
||||
|
||||
TLocalisamfile* fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
da.zero();
|
||||
a.zero();
|
||||
if (_annoes != 0)
|
||||
@ -710,7 +708,7 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
a.put(MOV_CODCAUS, _causale_fin);
|
||||
a.put(MOV_REG, _registro_fin);
|
||||
|
||||
if ((fl->curr() >= da) && (fl->curr() <= a))
|
||||
if ((fl.curr() >= da) && (fl.curr() <= a))
|
||||
//&&((_tiporegistro == 1)||(_tiporegistro == 2)))
|
||||
{
|
||||
_caus->setkey(1);
|
||||
@ -751,7 +749,7 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
|
||||
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
|
||||
_alleg = AllegClifo(gruppo, conto, sottoconto);
|
||||
_importo = current_cursor()->file(LF_RMOV)->get_real(RMV_IMPORTO);
|
||||
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
|
||||
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
||||
if (!_no_preprocess_page)
|
||||
{
|
||||
@ -772,7 +770,7 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
}
|
||||
else if ((_stampa_parte_iva)&&(file == LF_RMOVIVA))
|
||||
{
|
||||
TRectype iva(current_cursor()->file(LF_RMOVIVA)->curr());
|
||||
const TRectype iva(current_cursor()->file(LF_RMOVIVA).curr());
|
||||
_impo = iva.get_real(RMI_IMPONIBILE);
|
||||
_impos = iva.get_real(RMI_IMPOSTA);
|
||||
_tipocr = iva.get_int(RMI_TIPOCR);
|
||||
@ -796,9 +794,9 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
_anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOES);
|
||||
_tipodoc = current_cursor()->curr(LF_MOV).get(MOV_TIPODOC);
|
||||
|
||||
TLocalisamfile* fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
da.zero();
|
||||
a.zero();
|
||||
if (_annoes != 0)
|
||||
@ -809,7 +807,7 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
da.put(MOV_CODCAUS, _causale_ini);
|
||||
a.put(MOV_CODCAUS, _causale_fin);
|
||||
|
||||
if ((fl->curr() >= da) && (fl->curr() <= a))
|
||||
if ((fl.curr() >= da) && (fl.curr() <= a))
|
||||
/*
|
||||
if ((_annoes == _anno) || (_annoes == 0))
|
||||
if ((_causale >= _causale_ini) && (_causale <= _causale_fin))
|
||||
@ -835,7 +833,7 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
long sottoconto = atol(current_cursor()->curr(LF_RMOV).get(RMV_SOTTOCONTO));
|
||||
TString tipoc = current_cursor()->curr(LF_RMOV).get(RMV_TIPOC);
|
||||
_descr = DescrConto(gruppo, conto, sottoconto, tipoc);
|
||||
_importo = current_cursor()->file(LF_RMOV)->get_real(RMV_IMPORTO);
|
||||
_importo = current_cursor()->file(LF_RMOV).get_real(RMV_IMPORTO);
|
||||
_appoggio = current_cursor()->curr(LF_RMOV).get(RMV_SEZIONE);
|
||||
if (!_no_preprocess_page)
|
||||
{
|
||||
@ -885,9 +883,9 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
(_tipo_clifo_prec != "") && _salto_pagina)
|
||||
printer().formfeed();
|
||||
|
||||
TLocalisamfile* file = cur->file(LF_MOV);
|
||||
TRectype da (file->curr());
|
||||
TRectype a (file->curr());
|
||||
TLocalisamfile& file = cur->file(LF_MOV);
|
||||
TRectype da (file.curr());
|
||||
TRectype a (file.curr());
|
||||
da.zero();
|
||||
a.zero();
|
||||
|
||||
@ -907,7 +905,7 @@ bool CG3100_application::preprocess_page(int file,int counter)
|
||||
if (_codice_fin != 0)
|
||||
a.put(MOV_CODCF, _codice_fin);
|
||||
|
||||
if ((file->curr() >= da) && (file->curr() <= a))
|
||||
if ((file.curr() >= da) && (file.curr() <= a))
|
||||
{
|
||||
compila_clifo();
|
||||
compila_comuni();
|
||||
@ -1079,13 +1077,10 @@ print_action CG3100_application::postprocess_page(int file,int count)
|
||||
case fatture:
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
long numreg;
|
||||
_totdocumenti += _totdoc;
|
||||
TRecnotype pos, items;
|
||||
bool FINITO = FALSE;
|
||||
TLocalisamfile* mov;
|
||||
|
||||
mov = current_cursor()->file(LF_MOV);
|
||||
TLocalisamfile& mov = current_cursor()->file(LF_MOV);
|
||||
TCursor * cur = current_cursor();
|
||||
|
||||
pos = current_cursor()->pos();
|
||||
@ -1097,9 +1092,9 @@ print_action CG3100_application::postprocess_page(int file,int count)
|
||||
{
|
||||
cur->save_status();
|
||||
++(*cur);
|
||||
long numrsucc = cur->file(LF_MOV)->get_long(MOV_NUMREG);
|
||||
_tipoelsucc = cur->file(LF_MOV)->get(MOV_TIPO);
|
||||
_codclifosucc = cur->file(LF_MOV)->get_long(MOV_CODCF);
|
||||
long numrsucc = cur->file(LF_MOV).get_long(MOV_NUMREG);
|
||||
_tipoelsucc = cur->file(LF_MOV).get(MOV_TIPO);
|
||||
_codclifosucc = cur->file(LF_MOV).get_long(MOV_CODCF);
|
||||
--(*cur);
|
||||
cur->restore_status();
|
||||
}
|
||||
@ -1139,10 +1134,10 @@ print_action CG3100_application::postprocess_page(int file,int count)
|
||||
|
||||
_numreg = current_cursor()->file(LF_RMOVIVA)->get_long(MOV_NUMREG);
|
||||
|
||||
TRecnotype recno = rmoviva->recno();
|
||||
rmoviva->next();
|
||||
numrec = rmoviva->get_long(RMI_NUMREG);
|
||||
rmoviva->readat(recno);
|
||||
TRecnotype recno = rmoviva.recno();
|
||||
rmoviva.next();
|
||||
numrec = rmoviva.get_long(RMI_NUMREG);
|
||||
rmoviva.readat(recno);
|
||||
|
||||
if ( (_numreg != numrec) && (
|
||||
_settata_prima_riga = FALSE;
|
||||
@ -1164,39 +1159,39 @@ print_action CG3100_application::postprocess_page(int file,int count)
|
||||
}
|
||||
|
||||
|
||||
int CG3100_application::my_next(TLocalisamfile * mov)
|
||||
int CG3100_application::my_next(TLocalisamfile & mov)
|
||||
{
|
||||
int esito;
|
||||
TString cod_reg, causale;
|
||||
int tipo_reg;
|
||||
int ann_reg;
|
||||
|
||||
esito = mov->next();
|
||||
esito = mov.next();
|
||||
|
||||
switch (_scelta_stampa)
|
||||
{
|
||||
case 0:
|
||||
return esito;
|
||||
case 1:
|
||||
while (!mov->eof())
|
||||
while (!mov.eof())
|
||||
{
|
||||
cod_reg = mov->get (MOV_REG);
|
||||
ann_reg = mov->get_int (MOV_ANNOIVA);
|
||||
causale = mov->get (MOV_CODCAUS);
|
||||
cod_reg = mov.get (MOV_REG);
|
||||
ann_reg = mov.get_int (MOV_ANNOIVA);
|
||||
causale = mov.get (MOV_CODCAUS);
|
||||
|
||||
//if ( ( ( _annoes != 0l) && (ann_reg != _annoes) )
|
||||
// || ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) )
|
||||
if ( ( _annoes != 0l)
|
||||
|| ( (causale < (const char*)_causale_ini) || (causale > (const char*)_causale_fin)) )
|
||||
{
|
||||
esito=mov->next();
|
||||
esito=mov.next();
|
||||
continue;
|
||||
}
|
||||
tipo_reg = CodiceRegistro (cod_reg, ann_reg);
|
||||
if ( (tipo_reg != 1) && (tipo_reg != 2) )
|
||||
return esito;
|
||||
|
||||
esito=mov->next();
|
||||
esito=mov.next();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1227,17 +1222,16 @@ print_action CG3100_application::postprocess_print(int file,int count)
|
||||
if ((_scelta_stampa == 0)&&(_controllo_mov_errati != 3)&&(_tot_dare != _tot_avere))
|
||||
set_row(n++, "@11g%s", ERR_77);
|
||||
|
||||
TLocalisamfile* mov;
|
||||
mov=current_cursor()->file(LF_MOV);
|
||||
// nrec = mov->recno();
|
||||
TLocalisamfile& mov =current_cursor()->file(LF_MOV);
|
||||
// nrec = mov.recno();
|
||||
|
||||
pos = current_cursor()->pos();
|
||||
items = current_cursor()->items();
|
||||
|
||||
FINITO = (pos == items-1);
|
||||
|
||||
_datareg = current_cursor()->file(LF_MOV)->get_date(MOV_DATAREG);
|
||||
_numreg = current_cursor()->file(LF_MOV)->get_long(MOV_NUMREG);
|
||||
_datareg = current_cursor()->file(LF_MOV).get_date(MOV_DATAREG);
|
||||
_numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG);
|
||||
|
||||
TDate datarec (_datareg);
|
||||
if (!FINITO)
|
||||
@ -1245,7 +1239,7 @@ print_action CG3100_application::postprocess_print(int file,int count)
|
||||
TCursor * cur = current_cursor();
|
||||
cur->save_status();
|
||||
++(*cur);
|
||||
datarec = cur->file(LF_MOV)->get_date(MOV_DATAREG);
|
||||
datarec = cur->file(LF_MOV).get_date(MOV_DATAREG);
|
||||
--(*cur);
|
||||
cur->restore_status();
|
||||
}
|
||||
@ -1253,11 +1247,11 @@ print_action CG3100_application::postprocess_print(int file,int count)
|
||||
esito = my_next(mov);
|
||||
if (esito == NOERR)
|
||||
{
|
||||
long numrec = mov->get_long(MOV_NUMREG);
|
||||
datarec = mov->get_date(MOV_DATAREG);
|
||||
long numrec = mov.get_long(MOV_NUMREG);
|
||||
datarec = mov.get_date(MOV_DATAREG);
|
||||
}
|
||||
*/
|
||||
// mov->readat(nrec);
|
||||
// mov.readat(nrec);
|
||||
|
||||
_tot_avere_giornaliero += _tot_avere;
|
||||
_tot_dare_giornaliero += _tot_dare;
|
||||
@ -1342,23 +1336,21 @@ bool CG3100_application::segnala_errori_ogniriga()
|
||||
if ((_tiporegistro == 1)||(_tiporegistro == 2)) //movimento iva
|
||||
{
|
||||
long record, numreg;
|
||||
TLocalisamfile* rmoviva;
|
||||
|
||||
rmoviva = current_cursor()->file(LF_RMOVIVA);
|
||||
_numreg = current_cursor()->file(LF_MOV)->get_long(MOV_NUMREG);
|
||||
TLocalisamfile& rmoviva = current_cursor()->file(LF_RMOVIVA);
|
||||
_numreg = current_cursor()->file(LF_MOV).get_long(MOV_NUMREG);
|
||||
if (current_cursor()->is_first_match(LF_RMOVIVA))
|
||||
{
|
||||
record = rmoviva->recno();
|
||||
rmoviva->zero();
|
||||
rmoviva->put(RMI_NUMREG, _numreg);
|
||||
for (rmoviva->read(); !rmoviva->eof() ;rmoviva->next())
|
||||
record = rmoviva.recno();
|
||||
rmoviva.zero();
|
||||
rmoviva.put(RMI_NUMREG, _numreg);
|
||||
for (rmoviva.read(); !rmoviva.eof() ;rmoviva.next())
|
||||
{
|
||||
_cod = rmoviva->get(RMI_CODIVA);
|
||||
_tipod = rmoviva->get_int(RMI_TIPODET);
|
||||
_impo = rmoviva->get_real(RMI_IMPONIBILE);
|
||||
_impos = rmoviva->get_real(RMI_IMPOSTA);
|
||||
_tipocr = rmoviva->get_int(RMI_TIPOCR);
|
||||
numreg = rmoviva->get_long(RMI_NUMREG);
|
||||
_cod = rmoviva.get(RMI_CODIVA);
|
||||
_tipod = rmoviva.get_int(RMI_TIPODET);
|
||||
_impo = rmoviva.get_real(RMI_IMPONIBILE);
|
||||
_impos = rmoviva.get_real(RMI_IMPOSTA);
|
||||
_tipocr = rmoviva.get_int(RMI_TIPOCR);
|
||||
numreg = rmoviva.get_long(RMI_NUMREG);
|
||||
if (numreg != _numreg)
|
||||
break;
|
||||
else
|
||||
@ -1413,7 +1405,7 @@ bool CG3100_application::segnala_errori_ogniriga()
|
||||
}
|
||||
}
|
||||
} //for
|
||||
rmoviva->readat (record);
|
||||
rmoviva.readat (record);
|
||||
}
|
||||
}
|
||||
return trovato;
|
||||
@ -1424,9 +1416,9 @@ void CG3100_application::incrementa_totali()
|
||||
TString dep1;
|
||||
real imponibile, imposta;
|
||||
|
||||
imponibile = current_cursor()->file(LF_RMOVIVA)->get_real(RMI_IMPONIBILE);
|
||||
imposta = current_cursor()->file(LF_RMOVIVA)->get_real(RMI_IMPOSTA);
|
||||
TString codiva = current_cursor()->file(LF_RMOVIVA)->get(RMI_CODIVA);
|
||||
imponibile = current_cursor()->file(LF_RMOVIVA).get_real(RMI_IMPONIBILE);
|
||||
imposta = current_cursor()->file(LF_RMOVIVA).get_real(RMI_IMPOSTA);
|
||||
TString codiva = current_cursor()->file(LF_RMOVIVA).get(RMI_CODIVA);
|
||||
_tabiva->zero();
|
||||
dep1.format("%-4s",(const char*) codiva);
|
||||
_tabiva->put("CODTAB", (const char*)dep1);
|
||||
@ -1490,7 +1482,6 @@ bool CG3100_application::set_print(int m)
|
||||
if (msk.run() != K_ENTER) return FALSE;
|
||||
|
||||
reset_files();
|
||||
TLocalisamfile* fl;
|
||||
//_curr1->set_filterfunction (0);
|
||||
_curr1->set_filterfunction (filter_func);
|
||||
_curr2->set_filterfunction (filter_func);
|
||||
@ -1520,9 +1511,9 @@ bool CG3100_application::set_print(int m)
|
||||
if (!provvis)
|
||||
_curr1->setfilter("(PROVVIS=\"\")");
|
||||
else _curr1->setfilter("");
|
||||
fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
da.zero();
|
||||
a.zero();
|
||||
da.put(MOV_NUMREG, _numreg_ini);
|
||||
@ -1539,9 +1530,9 @@ bool CG3100_application::set_print(int m)
|
||||
_curr2->setfilter("(PROVVIS=\"\")");
|
||||
else
|
||||
_curr2->setfilter("");
|
||||
fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
da.zero();
|
||||
a.zero();
|
||||
if (_data_ini.ok())
|
||||
@ -1558,7 +1549,7 @@ bool CG3100_application::set_print(int m)
|
||||
|
||||
case fatture:
|
||||
{
|
||||
fl = current_cursor()->file(LF_MOV);
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_MOV);
|
||||
TString tipo = msk.get(F_TIPOELENCO);
|
||||
bool movprov = msk.get_bool(F_STAMPAMOVP);
|
||||
if (tipo=="C" || tipo=="F")
|
||||
@ -1572,7 +1563,7 @@ bool CG3100_application::set_print(int m)
|
||||
_codice_fin = atol(msk.get(F_CODICEFIN1));
|
||||
}
|
||||
|
||||
// _relmov->add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
|
||||
// _relmov.add(LF_MOV, "NUMREG=NUMREG",1, LF_RMOVIVA,100); //creo un alias per il file LF_MOV
|
||||
if (tipo == "E")
|
||||
{
|
||||
_tipo_ini = "C";
|
||||
@ -1587,8 +1578,8 @@ bool CG3100_application::set_print(int m)
|
||||
if (!movprov)
|
||||
_curr3->setfilter("(PROVVIS=\"\")");
|
||||
else _curr3->setfilter("");
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
da.zero();
|
||||
a.zero();
|
||||
if (_codice_ini != 0)
|
||||
|
217
cg/cg3200.cpp
217
cg/cg3200.cpp
@ -5,7 +5,6 @@
|
||||
#include <utility.h>
|
||||
#include <sort.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
#include <clifo.h>
|
||||
#include <pconti.h>
|
||||
#include <mov.h>
|
||||
@ -165,21 +164,19 @@ bool CG3200_application::almeno_un_record()
|
||||
long record,sottoc;
|
||||
int gruppo,conto;
|
||||
TDate datareg, datacomp;
|
||||
TLocalisamfile* rmov;
|
||||
|
||||
rmov = current_cursor()->file(LF_RMOV);
|
||||
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
||||
|
||||
if (current_cursor()->is_first_match(LF_RMOV))
|
||||
{
|
||||
record = rmov->recno();
|
||||
rmov->zero();
|
||||
rmov->put(RMV_GRUPPO,_gruppo);
|
||||
rmov->put(RMV_CONTO,_conto);
|
||||
rmov->put(RMV_SOTTOCONTO,_sottoc);
|
||||
for (rmov->read(); !rmov->eof() ;rmov->next())
|
||||
record = rmov.recno();
|
||||
rmov.zero();
|
||||
rmov.put(RMV_GRUPPO,_gruppo);
|
||||
rmov.put(RMV_CONTO,_conto);
|
||||
rmov.put(RMV_SOTTOCONTO,_sottoc);
|
||||
for (rmov.read(); !rmov.eof() ;rmov.next())
|
||||
{
|
||||
int annoes = rmov->get_int (RMV_ANNOES);
|
||||
long numreg = rmov->get_long(RMV_NUMREG);
|
||||
int annoes = rmov.get_int (RMV_ANNOES);
|
||||
long numreg = rmov.get_long(RMV_NUMREG);
|
||||
|
||||
_mov->setkey(1);
|
||||
_mov->curr().zero();
|
||||
@ -190,14 +187,14 @@ bool CG3200_application::almeno_un_record()
|
||||
datacomp = (_mov->curr().get(MOV_DATACOMP));
|
||||
|
||||
if (_annomsk == 0)
|
||||
datareg = rmov->get_date(RMV_DATAREG);
|
||||
datareg = rmov.get_date(RMV_DATAREG);
|
||||
else
|
||||
if (_annomsk != 0)
|
||||
datareg = datacomp;
|
||||
|
||||
gruppo = rmov->get_int(RMV_GRUPPO);
|
||||
conto = rmov->get_int(RMV_CONTO);
|
||||
sottoc = rmov->get_long(RMV_SOTTOCONTO);
|
||||
gruppo = rmov.get_int(RMV_GRUPPO);
|
||||
conto = rmov.get_int(RMV_CONTO);
|
||||
sottoc = rmov.get_long(RMV_SOTTOCONTO);
|
||||
if ((gruppo != _gruppo)&&(conto != _conto)&&(sottoc != _sottoc))
|
||||
break;
|
||||
else
|
||||
@ -207,7 +204,7 @@ bool CG3200_application::almeno_un_record()
|
||||
break;
|
||||
}
|
||||
}
|
||||
rmov->readat(record);
|
||||
rmov.readat(record);
|
||||
}
|
||||
return trovato;
|
||||
}
|
||||
@ -315,35 +312,34 @@ bool CG3200_application::data_fine(TMask_field& f, KEY k)
|
||||
|
||||
void CG3200_application::saldi_zero()
|
||||
{
|
||||
TLocalisamfile* rmov;
|
||||
real saldo_dare, saldo_avere;
|
||||
long record;
|
||||
|
||||
saldo_dare = saldo_avere = 0;
|
||||
|
||||
rmov = current_cursor()->file(LF_RMOV);
|
||||
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
||||
if (current_cursor()->is_first_match(LF_RMOV))
|
||||
{
|
||||
record = rmov->recno();
|
||||
record = rmov.recno();
|
||||
|
||||
while (!rmov->eof())
|
||||
while (!rmov.eof())
|
||||
{
|
||||
rmov->read();
|
||||
// char sezione = *(_rmov->curr().get(RMV_SEZIONE));
|
||||
TString sezione = rmov->curr().get(RMV_SEZIONE);
|
||||
real importo = rmov->curr().get_real(RMV_IMPORTO);
|
||||
int gruppo = atoi(rmov->get(RMV_GRUPPO));
|
||||
int conto = atoi(rmov->get(RMV_CONTO));
|
||||
long sottoc = atol(rmov->get(RMV_SOTTOCONTO));
|
||||
rmov.read();
|
||||
// char sezione = *(_rmov.curr().get(RMV_SEZIONE));
|
||||
TString sezione = rmov.curr().get(RMV_SEZIONE);
|
||||
real importo = rmov.curr().get_real(RMV_IMPORTO);
|
||||
int gruppo = atoi(rmov.get(RMV_GRUPPO));
|
||||
int conto = atoi(rmov.get(RMV_CONTO));
|
||||
long sottoc = atol(rmov.get(RMV_SOTTOCONTO));
|
||||
|
||||
if ((gruppo == _gruppo)&&(conto == _conto)&&(sottoc == _sottoc))
|
||||
if (sezione == "D")
|
||||
saldo_dare += importo;
|
||||
else if (sezione == "A")
|
||||
saldo_avere += importo;
|
||||
rmov->next();
|
||||
rmov.next();
|
||||
}
|
||||
rmov->readat(record);
|
||||
rmov.readat(record);
|
||||
}
|
||||
_totale_saldo = saldo_dare - saldo_avere;
|
||||
}
|
||||
@ -368,7 +364,6 @@ void CG3200_application::fai_stampa132()
|
||||
|
||||
void CG3200_application::fai_stampa198()
|
||||
{
|
||||
TLocalisamfile* rmov;
|
||||
long rec;
|
||||
TDate datasucc;
|
||||
TString datasuccstring,dataregrmovstring;
|
||||
@ -400,19 +395,19 @@ void CG3200_application::fai_stampa198()
|
||||
|
||||
//Gestire la stampa di saldo_progressivi nella postprocess_page di RMOV
|
||||
|
||||
rmov = current_cursor()->file(LF_RMOV);
|
||||
rec = rmov->recno();
|
||||
rmov->next();
|
||||
gruppof = rmov->get_int(RMV_GRUPPO);
|
||||
contof = rmov->get_int(RMV_CONTO);
|
||||
sottocf = rmov->get_int(RMV_SOTTOCONTO);
|
||||
datasucc = rmov->get_date(RMV_DATAREG);
|
||||
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
||||
rec = rmov.recno();
|
||||
rmov.next();
|
||||
gruppof = rmov.get_int(RMV_GRUPPO);
|
||||
contof = rmov.get_int(RMV_CONTO);
|
||||
sottocf = rmov.get_int(RMV_SOTTOCONTO);
|
||||
datasucc = rmov.get_date(RMV_DATAREG);
|
||||
datasuccstring=datasucc.string();
|
||||
if (((gruppof!=_gruppo)||(contof!=_conto)||(sottocf!=_sottoc))||(rmov->eof()))
|
||||
if (((gruppof!=_gruppo)||(contof!=_conto)||(sottocf!=_sottoc))||(rmov.eof()))
|
||||
datasucc = ("");
|
||||
if (datasucc != _dataregrmov)
|
||||
set_row (1,"@136g#t", &_saldo_progressivi_str);
|
||||
rmov->readat(rec);
|
||||
rmov.readat(rec);
|
||||
}
|
||||
|
||||
void CG3200_application::stampa_totali132()
|
||||
@ -468,7 +463,6 @@ void CG3200_application::stampa_totali198()
|
||||
|
||||
bool CG3200_application::preprocess_pconti(int file, int counter)
|
||||
{
|
||||
TLocalisamfile* rmov;
|
||||
long record;
|
||||
TString provvis = "";
|
||||
|
||||
@ -521,20 +515,20 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
||||
_numreg = atol (current_cursor()->curr(LF_RMOV).get(RMV_NUMREG));
|
||||
|
||||
int rcontr = atoi(current_cursor()->curr(LF_RMOV).get(RMV_RCONTR));
|
||||
rmov = current_cursor()->file(LF_RMOV);
|
||||
record = rmov->recno();
|
||||
rmov->setkey(1);
|
||||
rmov->curr().zero();
|
||||
rmov->curr().put(RMV_NUMREG,_numreg);
|
||||
rmov->curr().put(RMV_NUMRIG,rcontr);
|
||||
rmov->read();
|
||||
if (rmov->bad())
|
||||
rmov->curr().zero();
|
||||
_gruppocontr = rmov->curr().get(RMV_GRUPPO);
|
||||
_contocontr = rmov->curr().get(RMV_CONTO);
|
||||
_sottocontocontr = rmov->curr().get(RMV_SOTTOCONTO);
|
||||
rmov->setkey(2);
|
||||
rmov->readat(record);
|
||||
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
||||
record = rmov.recno();
|
||||
rmov.setkey(1);
|
||||
rmov.curr().zero();
|
||||
rmov.curr().put(RMV_NUMREG,_numreg);
|
||||
rmov.curr().put(RMV_NUMRIG,rcontr);
|
||||
rmov.read();
|
||||
if (rmov.bad())
|
||||
rmov.curr().zero();
|
||||
_gruppocontr = rmov.curr().get(RMV_GRUPPO);
|
||||
_contocontr = rmov.curr().get(RMV_CONTO);
|
||||
_sottocontocontr = rmov.curr().get(RMV_SOTTOCONTO);
|
||||
rmov.setkey(2);
|
||||
rmov.readat(record);
|
||||
|
||||
// Stampa solo quelli che hanno anno esercizio uguale a quello specificato
|
||||
// nella maschera. Se non viene specificato li stampa tutti
|
||||
@ -692,7 +686,6 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
||||
|
||||
bool CG3200_application::preprocess_clifo(int file, int counter)
|
||||
{
|
||||
TLocalisamfile* rmov;
|
||||
long record;
|
||||
TString provvis = "";
|
||||
|
||||
@ -745,20 +738,20 @@ bool CG3200_application::preprocess_clifo(int file, int counter)
|
||||
_numreg = atol (current_cursor()->curr(LF_RMOV).get(RMV_NUMREG));
|
||||
|
||||
int rcontr = atoi(current_cursor()->curr(LF_RMOV).get(RMV_RCONTR));
|
||||
rmov = current_cursor()->file(LF_RMOV);
|
||||
record = rmov->recno();
|
||||
rmov->setkey(1);
|
||||
rmov->curr().zero();
|
||||
rmov->curr().put(RMV_NUMREG,_numreg);
|
||||
rmov->curr().put(RMV_NUMRIG,rcontr);
|
||||
rmov->read();
|
||||
if (rmov->bad())
|
||||
rmov->curr().zero();
|
||||
_gruppocontr = rmov->curr().get(RMV_GRUPPO);
|
||||
_contocontr = rmov->curr().get(RMV_CONTO);
|
||||
_sottocontocontr = rmov->curr().get(RMV_SOTTOCONTO);
|
||||
rmov->setkey(2);
|
||||
rmov->readat(record);
|
||||
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
||||
record = rmov.recno();
|
||||
rmov.setkey(1);
|
||||
rmov.curr().zero();
|
||||
rmov.curr().put(RMV_NUMREG,_numreg);
|
||||
rmov.curr().put(RMV_NUMRIG,rcontr);
|
||||
rmov.read();
|
||||
if (rmov.bad())
|
||||
rmov.curr().zero();
|
||||
_gruppocontr = rmov.curr().get(RMV_GRUPPO);
|
||||
_contocontr = rmov.curr().get(RMV_CONTO);
|
||||
_sottocontocontr = rmov.curr().get(RMV_SOTTOCONTO);
|
||||
rmov.setkey(2);
|
||||
rmov.readat(record);
|
||||
|
||||
|
||||
// Stampa solo quelli che hanno anno esercizio uguale a quello specificato
|
||||
@ -1167,7 +1160,6 @@ bool CG3200_application::set_print(int)
|
||||
{
|
||||
KEY tasto;
|
||||
int crt;
|
||||
TLocalisamfile* fl;
|
||||
TString data1,data2;
|
||||
|
||||
_puoi_stampare = TRUE;
|
||||
@ -1180,7 +1172,7 @@ bool CG3200_application::set_print(int)
|
||||
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
_annomsk = atoi(_msk->get(F_ANNO));
|
||||
_annomsk = _msk->get_int(F_ANNO);
|
||||
|
||||
_stampaprogre = (bool)(_msk->get(F_STAMPAPROGRE) == "X");
|
||||
_stampatotiva = (bool)(_msk->get(F_STAMPATOTIVA) == "X");
|
||||
@ -1218,9 +1210,9 @@ bool CG3200_application::set_print(int)
|
||||
add_file(LF_RMOV,LF_PCON);
|
||||
|
||||
select_cursor(_cur1);
|
||||
fl = current_cursor()->file(LF_PCON);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_PCON);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
@ -1246,9 +1238,9 @@ bool CG3200_application::set_print(int)
|
||||
add_file(LF_CLIFO);
|
||||
add_file(LF_RMOV,LF_CLIFO);
|
||||
|
||||
fl = current_cursor()->file(LF_CLIFO);
|
||||
TRectype da (fl->curr());
|
||||
TRectype a (fl->curr());
|
||||
TLocalisamfile& fl = current_cursor()->file(LF_CLIFO);
|
||||
TRectype da (fl.curr());
|
||||
TRectype a (fl.curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
@ -1482,25 +1474,24 @@ void CG3200_application::calcola_progressivi_al()
|
||||
long record,sottoc,annoes;
|
||||
int gruppo,conto;
|
||||
TDate datareg, datacomp;
|
||||
TLocalisamfile* rmov;
|
||||
char sezione;
|
||||
real importo;
|
||||
TDate data;
|
||||
|
||||
rmov = current_cursor()->file(LF_RMOV);
|
||||
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
|
||||
|
||||
record = rmov->recno();
|
||||
rmov->zero();
|
||||
rmov->put(RMV_GRUPPO, _gruppo);
|
||||
rmov->put(RMV_CONTO, _conto);
|
||||
rmov->put(RMV_SOTTOCONTO, _sottoc);
|
||||
for (rmov->read();!rmov->eof() ;rmov->next())
|
||||
record = rmov.recno();
|
||||
rmov.zero();
|
||||
rmov.put(RMV_GRUPPO, _gruppo);
|
||||
rmov.put(RMV_CONTO, _conto);
|
||||
rmov.put(RMV_SOTTOCONTO, _sottoc);
|
||||
for (rmov.read();!rmov.eof() ;rmov.next())
|
||||
{
|
||||
annoes = rmov->get_int (RMV_ANNOES);
|
||||
datareg = rmov->get_date(RMV_DATAREG);
|
||||
sezione = rmov->get (RMV_SEZIONE)[0];
|
||||
importo = rmov->get_real(RMV_IMPORTO);
|
||||
long numreg = rmov->get_long(RMV_NUMREG);
|
||||
annoes = rmov.get_int (RMV_ANNOES);
|
||||
datareg = rmov.get_date(RMV_DATAREG);
|
||||
sezione = rmov.get (RMV_SEZIONE)[0];
|
||||
importo = rmov.get_real(RMV_IMPORTO);
|
||||
long numreg = rmov.get_long(RMV_NUMREG);
|
||||
|
||||
_mov->setkey(1);
|
||||
_mov->curr().zero();
|
||||
@ -1512,7 +1503,7 @@ void CG3200_application::calcola_progressivi_al()
|
||||
|
||||
if (_annomsk == 0)
|
||||
{
|
||||
datareg = rmov->get_date(RMV_DATAREG);
|
||||
datareg = rmov.get_date(RMV_DATAREG);
|
||||
data = _inizioEs;
|
||||
}
|
||||
else
|
||||
@ -1525,9 +1516,9 @@ void CG3200_application::calcola_progressivi_al()
|
||||
TString data2 = _data_ini.string();
|
||||
TString data3 = data.string();
|
||||
|
||||
gruppo = rmov->get_int(RMV_GRUPPO);
|
||||
conto = rmov->get_int(RMV_CONTO);
|
||||
sottoc = rmov->get_long(RMV_SOTTOCONTO);
|
||||
gruppo = rmov.get_int(RMV_GRUPPO);
|
||||
conto = rmov.get_int(RMV_CONTO);
|
||||
sottoc = rmov.get_long(RMV_SOTTOCONTO);
|
||||
if ((gruppo != _gruppo)||(conto != _conto)||(sottoc != _sottoc))
|
||||
break;
|
||||
else if (((annoes==_annomsk)||(_annomsk == 0))&&(datareg >= data)&&(datareg < _data_ini)) //Legge movimenti con data < data iniziale
|
||||
@ -1536,7 +1527,7 @@ void CG3200_application::calcola_progressivi_al()
|
||||
else if (sezione == 'A')
|
||||
_totale_prima_avere += importo;
|
||||
}
|
||||
rmov->readat(record);
|
||||
rmov.readat(record);
|
||||
}
|
||||
|
||||
void CG3200_application::calcola_progressivi()
|
||||
@ -1576,7 +1567,7 @@ void CG3200_application::calcola_progressivi()
|
||||
record.put(SLD_SOTTOCONTO, _sottoc);
|
||||
|
||||
if (_ricerca == 'P')
|
||||
indbil = atoi (current_cursor()->file(LF_PCON)->get(PCN_INDBIL));
|
||||
indbil = atoi (current_cursor()->file(LF_PCON).get(PCN_INDBIL));
|
||||
else
|
||||
{
|
||||
if ((_ricerca == 'C') || (_ricerca == 'F'))
|
||||
@ -1891,16 +1882,15 @@ void CG3200_application::ricerca_gruppo()
|
||||
|
||||
const char* CG3200_application::descrizione_gruppo()
|
||||
{
|
||||
TLocalisamfile* pconti;
|
||||
long record;
|
||||
|
||||
pconti = current_cursor()->file(LF_PCON);
|
||||
record = pconti->recno();
|
||||
pconti->curr().zero();
|
||||
pconti->curr().put(PCN_GRUPPO,_gruppo);
|
||||
pconti->read();
|
||||
tmp = pconti->curr().get(PCN_DESCR);
|
||||
pconti->readat(record);
|
||||
TLocalisamfile& pconti = current_cursor()->file(LF_PCON);
|
||||
record = pconti.recno();
|
||||
pconti.zero();
|
||||
pconti.put(PCN_GRUPPO,_gruppo);
|
||||
pconti.read();
|
||||
tmp = pconti.get(PCN_DESCR);
|
||||
pconti.readat(record);
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
@ -1908,17 +1898,16 @@ const char* CG3200_application::descrizione_gruppo()
|
||||
|
||||
const char* CG3200_application::descrizione_conto()
|
||||
{
|
||||
TLocalisamfile* pconti;
|
||||
long record;
|
||||
|
||||
pconti = current_cursor()->file(LF_PCON);
|
||||
record = pconti->recno();
|
||||
pconti->curr().zero();
|
||||
pconti->curr().put(PCN_GRUPPO,_gruppo);
|
||||
pconti->curr().put(PCN_CONTO,_conto);
|
||||
pconti->read();
|
||||
tmp = pconti->curr().get(PCN_DESCR);
|
||||
pconti->readat(record);
|
||||
TLocalisamfile& pconti = current_cursor()->file(LF_PCON);
|
||||
record = pconti.recno();
|
||||
pconti.curr().zero();
|
||||
pconti.curr().put(PCN_GRUPPO,_gruppo);
|
||||
pconti.curr().put(PCN_CONTO,_conto);
|
||||
pconti.read();
|
||||
tmp = pconti.curr().get(PCN_DESCR);
|
||||
pconti.readat(record);
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
|
4538
cg/cg3300.cpp
4538
cg/cg3300.cpp
File diff suppressed because it is too large
Load Diff
1168
cg/cg3301.cpp
1168
cg/cg3301.cpp
File diff suppressed because it is too large
Load Diff
@ -331,8 +331,8 @@ void CG3400_application::user_create()
|
||||
_rel->add (LF_RMOVIVA, "NUMREG=NUMREG");
|
||||
|
||||
_cur = new TCursor (_rel, "", 2); // usa la chiave 2 su MOV
|
||||
_RecPartoDa = new TRectype(_cur->file(LF_MOV));
|
||||
_RecArrivoA = new TRectype(_cur->file(LF_MOV));
|
||||
_RecPartoDa = new TRectype(_cur->file(LF_MOV).curr());
|
||||
_RecArrivoA = new TRectype(_cur->file(LF_MOV).curr());
|
||||
|
||||
add_cursor (_cur);
|
||||
|
||||
@ -388,11 +388,10 @@ void CG3400_application::aggiorna_mov()
|
||||
|
||||
void CG3400_application::scrivi_numgio(long nprog)
|
||||
{
|
||||
TLocalisamfile *mov = current_cursor()->file(LF_MOV);
|
||||
|
||||
mov->reread(_lock);
|
||||
mov->put (MOV_NUMGIO, nprog);
|
||||
mov->rewrite();
|
||||
TLocalisamfile &mov = current_cursor()->file(LF_MOV);
|
||||
mov.reread(_lock);
|
||||
mov.put (MOV_NUMGIO, nprog);
|
||||
mov.rewrite();
|
||||
}
|
||||
|
||||
void CG3400_application::stampa_totali_giorno(TDate data, bool ff)
|
||||
@ -581,7 +580,7 @@ print_action CG3400_application::postprocess_print(int file, int counter)
|
||||
case LF_MOV:
|
||||
{
|
||||
printer().formfeed();
|
||||
*_RecArrivoA = _cur->file(LF_MOV)->curr();
|
||||
*_RecArrivoA = _cur->file(LF_MOV).curr();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -811,7 +810,7 @@ bool CG3400_application::preprocess_print(int file, int counter)
|
||||
|
||||
_nprog_mov = _nprog_da;
|
||||
|
||||
*_RecPartoDa = _cur->file(LF_MOV)->curr();
|
||||
*_RecPartoDa = _cur->file(LF_MOV).curr();
|
||||
|
||||
for (i=1; i<RIGHE_FOOTER; i++)
|
||||
set_footer(i, "%s", " ");
|
||||
@ -880,7 +879,7 @@ print_action CG3400_application::postprocess_page(int file, int counter)
|
||||
}
|
||||
_cur->save_status();
|
||||
++(*_cur);
|
||||
_data_succ = _cur->file(LF_MOV)->get_date(MOV_DATAREG);
|
||||
_data_succ = _cur->file(LF_MOV).get_date(MOV_DATAREG);
|
||||
_mese_succ = _data_succ.month();
|
||||
--(*_cur);
|
||||
_cur->restore_status();
|
||||
@ -936,7 +935,7 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
|
||||
if (!current_cursor()->is_first_match(LF_RMOV)) return FALSE;
|
||||
|
||||
gia_stampato = current_cursor()->file(LF_MOV)->get_bool(MOV_STAMPATO);
|
||||
gia_stampato = current_cursor()->file(LF_MOV).get_bool(MOV_STAMPATO);
|
||||
if (gia_stampato)
|
||||
if (_stampa_definitiva)
|
||||
return FALSE;
|
||||
@ -945,10 +944,10 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
|
||||
if (_libro_giornale_iva_unico) _nprog_mov++;
|
||||
|
||||
_data_corr = _cur->file(LF_MOV)->get_date(MOV_DATAREG);
|
||||
_data_corr = _cur->file(LF_MOV).get_date(MOV_DATAREG);
|
||||
_mese_corr = _data_corr.month();
|
||||
_annoEsMov = _cur->file(LF_MOV)->get_int(MOV_ANNOES);
|
||||
caus = _cur->file(LF_MOV)->get(MOV_CODCAUS);
|
||||
_annoEsMov = _cur->file(LF_MOV).get_int(MOV_ANNOES);
|
||||
caus = _cur->file(LF_MOV).get(MOV_CODCAUS);
|
||||
|
||||
break;
|
||||
|
||||
@ -969,7 +968,7 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
_descr_causale->set_width(198);
|
||||
}
|
||||
setta_righe_descr(_descr_causale, causale);
|
||||
rmv_descr = current_cursor()->file(LF_RMOV)->get(RMV_DESCR);
|
||||
rmv_descr = current_cursor()->file(LF_RMOV).get(RMV_DESCR);
|
||||
if (_stampa_width == 132)
|
||||
{
|
||||
*_descr_operazione = (const char *)rmv_descr;
|
||||
@ -1026,8 +1025,8 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
}
|
||||
}
|
||||
|
||||
sezione = _cur->file(LF_RMOV)->get (RMV_SEZIONE);
|
||||
importo = _cur->file(LF_RMOV)->get_real (RMV_IMPORTO);
|
||||
sezione = _cur->file(LF_RMOV).get (RMV_SEZIONE);
|
||||
importo = _cur->file(LF_RMOV).get_real (RMV_IMPORTO);
|
||||
|
||||
// imp = importo.string ("######");
|
||||
if (sezione == "D")
|
||||
@ -1080,7 +1079,7 @@ void CG3400_application::calcola_iva()
|
||||
TString codiva;
|
||||
int tipocr, tipodet;
|
||||
real impo, impos;
|
||||
TRectype iva (_cur->file(LF_RMOVIVA)->curr());
|
||||
TRectype iva (_cur->file(LF_RMOVIVA).curr());
|
||||
|
||||
if (!iva.empty())
|
||||
{
|
||||
@ -1168,7 +1167,7 @@ void CG3400_application::setta_righe_valuta()
|
||||
TString simbolo, codval;
|
||||
bool intracom;
|
||||
|
||||
codval = current_cursor()->file(LF_MOV)->get(MOV_CODVAL);
|
||||
codval = current_cursor()->file(LF_MOV).get(MOV_CODVAL);
|
||||
intracom = current_cursor()->curr(LF_RMOVIVA).get_bool(RMI_INTRA);
|
||||
simbolo = SimboloValuta(codval);
|
||||
|
||||
@ -1201,12 +1200,12 @@ void CG3400_application::setta_righe_indirizzo()
|
||||
if (_occas)
|
||||
{
|
||||
TCursor * cur = current_cursor();
|
||||
TLocalisamfile * occ = cur->file(LF_OCCAS);
|
||||
TLocalisamfile & occ = cur->file(LF_OCCAS);
|
||||
|
||||
_viacf = occ->get (OCC_INDIR);
|
||||
_civcf = occ->get (OCC_CIV);
|
||||
_capcf = occ->get (OCC_CAP);
|
||||
_comcf = occ->get (OCC_COM);
|
||||
_viacf = occ.get (OCC_INDIR);
|
||||
_civcf = occ.get (OCC_CIV);
|
||||
_capcf = occ.get (OCC_CAP);
|
||||
_comcf = occ.get (OCC_COM);
|
||||
}
|
||||
|
||||
TRectype dep = look_com (_comcf, _com);
|
||||
@ -1425,8 +1424,8 @@ bool CG3400_application::set_print(int)
|
||||
if (_stampa_width == 1) _stampa_width = 132;
|
||||
else _stampa_width = 198;
|
||||
|
||||
TRectype da (_cur->file(LF_MOV));
|
||||
TRectype a (_cur->file(LF_MOV));
|
||||
TRectype da (_cur->file(LF_MOV).curr());
|
||||
TRectype a (_cur->file(LF_MOV).curr());
|
||||
|
||||
da.zero();
|
||||
a.zero();
|
||||
|
@ -57,8 +57,8 @@ void CG4300_App::user_create()
|
||||
_del = new TTable("%DEL");
|
||||
_lia = new TTable("LIA");
|
||||
|
||||
_mov = _cur->file(LF_MOV);
|
||||
_rmoviva = _cur->file(LF_RMOVIVA);
|
||||
_mov = &_cur->file(LF_MOV);
|
||||
_rmoviva = &_cur->file(LF_RMOVIVA);
|
||||
|
||||
_pim_r = &(_pim->curr());
|
||||
_plm_r = &(_plm->curr());
|
||||
|
252
cg/cg4303.cpp
252
cg/cg4303.cpp
@ -7,7 +7,7 @@
|
||||
#include "cg4300.h"
|
||||
|
||||
void CG4300_App::add_plafond(int month, const char* codatt, int type,
|
||||
real& howmuch, bool intra)
|
||||
real& howmuch, bool intra)
|
||||
{
|
||||
look_ppa(month,codatt,type);
|
||||
|
||||
@ -19,10 +19,10 @@ void CG4300_App::add_plafond(int month, const char* codatt, int type,
|
||||
|
||||
if (r2 < (r0+r1))
|
||||
describe_error("Acquisti in eccesso rispetto al plafond disponibile",
|
||||
codatt);
|
||||
codatt);
|
||||
|
||||
r2 -= (r0+r1);
|
||||
if (r2.sign() < 0) r2 = 0.0;
|
||||
if (r2.sign() < 0) r2 = 0.0;
|
||||
|
||||
_ppa_r->put("R0",r0);
|
||||
_ppa_r->put("R1",r1);
|
||||
@ -34,36 +34,36 @@ void CG4300_App::add_plafond(int month, const char* codatt, int type,
|
||||
void CG4300_App::zero_plafond (int month, const char* codatt)
|
||||
{
|
||||
for (int jj = 1; jj <= 3; jj++) // three types of plafond
|
||||
{
|
||||
real r;
|
||||
look_ppa(month,codatt,jj,TRUE);
|
||||
if (is_first_month(month))
|
||||
{
|
||||
real r;
|
||||
look_ppa(month,codatt,jj,TRUE);
|
||||
if (is_first_month(month))
|
||||
{
|
||||
r = (jj == 1 ? _p8 : (jj == 2 ? _p8b : _p9));
|
||||
}
|
||||
else
|
||||
{
|
||||
long rn = _ppa->recno();
|
||||
|
||||
// se non c'e' quello del mese prima c'e' poco da fare,
|
||||
// si ricalcola tutto
|
||||
if (!look_ppa(previous_month(month),codatt,jj))
|
||||
// mazza che bella chiamata ricorsiva
|
||||
{
|
||||
if (!update_att(previous_month(month),codatt, FALSE))
|
||||
describe_error("Progressivi plafond non ricalcolati per "
|
||||
"i mesi precedenti: possibili errori",
|
||||
codatt);
|
||||
look_ppa(previous_month(month),codatt,jj);
|
||||
}
|
||||
r = _ppa_r->get_real("R2");
|
||||
_ppa->readat(rn);
|
||||
}
|
||||
_ppa_r->put("R2",r);
|
||||
_ppa_r->put("R0","");
|
||||
_ppa_r->put("R1","");
|
||||
_ppa->rewrite();
|
||||
} // for tipo esenzione plafond
|
||||
r = (jj == 1 ? _p8 : (jj == 2 ? _p8b : _p9));
|
||||
}
|
||||
else
|
||||
{
|
||||
long rn = _ppa->recno();
|
||||
|
||||
// se non c'e' quello del mese prima c'e' poco da fare,
|
||||
// si ricalcola tutto
|
||||
if (!look_ppa(previous_month(month),codatt,jj))
|
||||
// mazza che bella chiamata ricorsiva
|
||||
{
|
||||
if (!update_att(previous_month(month),codatt, FALSE))
|
||||
describe_error("Progressivi plafond non ricalcolati per "
|
||||
"i mesi precedenti: possibili errori",
|
||||
codatt);
|
||||
look_ppa(previous_month(month),codatt,jj);
|
||||
}
|
||||
r = _ppa_r->get_real("R2");
|
||||
_ppa->readat(rn);
|
||||
}
|
||||
_ppa_r->put("R2",r);
|
||||
_ppa_r->put("R0","");
|
||||
_ppa_r->put("R1","");
|
||||
_ppa->rewrite();
|
||||
} // for tipo esenzione plafond
|
||||
}
|
||||
|
||||
void CG4300_App::describe_plafond(int month, const char* codatt)
|
||||
@ -74,24 +74,24 @@ void CG4300_App::describe_plafond(int month, const char* codatt)
|
||||
_DescrItem* d = new _DescrItem(PLAFOND);
|
||||
|
||||
for (int jj = 1; jj <= 3; jj++) // three types of plafond
|
||||
{
|
||||
t1 = 0.0; t2 = 0.0; t3 = 0.0;
|
||||
for (int m = 1; m <= month; m++)
|
||||
{
|
||||
t1 = 0.0; t2 = 0.0; t3 = 0.0;
|
||||
for (int m = 1; m <= month; m++)
|
||||
{
|
||||
if (look_ppa(m,codatt,jj))
|
||||
{
|
||||
t1 = _ppa->get_real("R0");
|
||||
t2 = _ppa->get_real("R1");
|
||||
t3 = _ppa->get_real("R2");
|
||||
}
|
||||
}
|
||||
switch (jj)
|
||||
{
|
||||
case 1: d->_r0 = t1; d->_r1 = t2; d->_r2 = t3; break;
|
||||
case 2: d->_r3 = t1; d->_r4 = t2; d->_r5 = t3; break;
|
||||
case 3: d->_r6 = t1; d->_r7 = t2; d->_r8 = t3; break;
|
||||
}
|
||||
} // for tipo esenzione plafond
|
||||
if (look_ppa(m,codatt,jj))
|
||||
{
|
||||
t1 = _ppa->get_real("R0");
|
||||
t2 = _ppa->get_real("R1");
|
||||
t3 = _ppa->get_real("R2");
|
||||
}
|
||||
}
|
||||
switch (jj)
|
||||
{
|
||||
case 1: d->_r0 = t1; d->_r1 = t2; d->_r2 = t3; break;
|
||||
case 2: d->_r3 = t1; d->_r4 = t2; d->_r5 = t3; break;
|
||||
case 3: d->_r6 = t1; d->_r7 = t2; d->_r8 = t3; break;
|
||||
}
|
||||
} // for tipo esenzione plafond
|
||||
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
@ -115,98 +115,98 @@ void CG4300_App::recalc_ventilation(int month, const char* codatt)
|
||||
_vent_arr.destroy();
|
||||
|
||||
for (m = 1; m <= month; m++)
|
||||
{
|
||||
if (is_month_ok(m))
|
||||
{
|
||||
if (is_month_ok(m))
|
||||
{
|
||||
// aggiunge gli acquisti del mese m operando sui pim
|
||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||
{
|
||||
// se e' acquisto beni per rivendita
|
||||
int tipocr = atoi(*_pim_tipocr);
|
||||
int mese = atoi(*_pim_mese);
|
||||
TString att(codatt);
|
||||
if (tipocr == 1 && mese == m &&
|
||||
att == (const char*)(*_pim_codatt))
|
||||
|
||||
{
|
||||
look_iva(*_pim_codiva);
|
||||
// aggiunge gli acquisti del mese m operando sui pim
|
||||
for (_pim->first(); !_pim->eof(); _pim->next())
|
||||
{
|
||||
// se e' acquisto beni per rivendita
|
||||
int tipocr = atoi(*_pim_tipocr);
|
||||
int mese = atoi(*_pim_mese);
|
||||
TString att(codatt);
|
||||
if (tipocr == 1 && mese == m &&
|
||||
att == (const char*)(*_pim_codatt))
|
||||
|
||||
{
|
||||
look_iva(*_pim_codiva);
|
||||
|
||||
// soltanto normali ed esenti IVA sono base di riparto
|
||||
if (_iva->get("S1").empty() ||
|
||||
_iva->get("S1") == "ES")
|
||||
{
|
||||
real lurd = _pim->get_real("R0");
|
||||
lurd += _pim->get_real("R1");
|
||||
real perc = _iva->get_real("R0");
|
||||
TString other = _iva->get("S6");
|
||||
if (!other.empty())
|
||||
{
|
||||
// ventila a un altro codice
|
||||
look_iva(other);
|
||||
perc = _iva->get_real("R0");
|
||||
}
|
||||
add_ventilation(perc/100.0, lurd, *_pim_codiva);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// soltanto normali ed esenti IVA sono base di riparto
|
||||
if (_iva->get("S1").empty() ||
|
||||
_iva->get("S1") == "ES")
|
||||
{
|
||||
real lurd = _pim->get_real("R0");
|
||||
lurd += _pim->get_real("R1");
|
||||
real perc = _iva->get_real("R0");
|
||||
TString other = _iva->get("S6");
|
||||
if (!other.empty())
|
||||
{
|
||||
// ventila a un altro codice
|
||||
look_iva(other);
|
||||
perc = _iva->get_real("R0");
|
||||
}
|
||||
add_ventilation(perc/100.0, lurd, *_pim_codiva);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2) calcola totale acquisti su tutte le aliquote
|
||||
real totacq = 0.0;
|
||||
real totven = 0.0;
|
||||
|
||||
for (int j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
totacq += vv->_totale;
|
||||
}
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
totacq += vv->_totale;
|
||||
}
|
||||
|
||||
// 3) ricalcola (solo per il mese in corso!) operando sull'array
|
||||
for (int i = 0; i < _vend_arr.items(); i++)
|
||||
{
|
||||
_VendItem* vi = (_VendItem*)&_vend_arr[i];
|
||||
if (vi->_month != month)
|
||||
continue;
|
||||
|
||||
// questo serve solo per il prospettino di m.
|
||||
totven += vi->_totale;
|
||||
|
||||
// 3.2) calcola percentuali di ripartizione e prepara l'affettatrice
|
||||
TDistrib dst(vi->_totale,ROUND_LIRA);
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VendItem* vi = (_VendItem*)&_vend_arr[i];
|
||||
if (vi->_month != month)
|
||||
continue;
|
||||
|
||||
// questo serve solo per il prospettino di m.
|
||||
totven += vi->_totale;
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
dst.add(vv->_totale/totacq);
|
||||
}
|
||||
|
||||
// 3.3) affetta l'importo
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
real imponibile = dst.get();
|
||||
real imposta = imponibile*vv->_aliquota;
|
||||
imposta.round(ROUND_LIRA);
|
||||
|
||||
// 3.2) calcola percentuali di ripartizione e prepara l'affettatrice
|
||||
TDistrib dst(vi->_totale,ROUND_LIRA);
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
dst.add(vv->_totale/totacq);
|
||||
}
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
ive += imposta;
|
||||
_plm->put("R0",ive);
|
||||
_plm->rewrite();
|
||||
|
||||
// Aggiorno i luridi pim
|
||||
look_pim(month, codatt, vi->_codreg, "0", vv->_codiva, TRUE);
|
||||
|
||||
// 3.3) affetta l'importo
|
||||
for (j = 0; j < _vent_arr.items(); j++)
|
||||
{
|
||||
_VentItem* vv = (_VentItem*)&_vent_arr[j];
|
||||
real imponibile = dst.get();
|
||||
real imposta = imponibile*vv->_aliquota;
|
||||
imposta.round(ROUND_LIRA);
|
||||
|
||||
// aggiusto l'IVA vendite nei plm
|
||||
look_plm(month, codatt);
|
||||
real ive = _plm->get_real("R0");
|
||||
ive += imposta;
|
||||
_plm->put("R0",ive);
|
||||
_plm->rewrite();
|
||||
|
||||
// Aggiorno i luridi pim
|
||||
look_pim(month, codatt, vi->_codreg, "0", vv->_codiva, TRUE);
|
||||
|
||||
imponibile += _pim->get_real("R0");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
// segnale per comodita'
|
||||
_pim->put("B1","X");
|
||||
_pim->rewrite();
|
||||
}
|
||||
}
|
||||
imponibile += _pim->get_real("R0");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
// segnale per comodita'
|
||||
_pim->put("B1","X");
|
||||
_pim->rewrite();
|
||||
}
|
||||
}
|
||||
// memorizza totali per il prospettino di m.
|
||||
look_ptm(month, codatt);
|
||||
_ptm->put("S4",totacq.string());
|
||||
|
2548
cg/cg4304.cpp
2548
cg/cg4304.cpp
File diff suppressed because it is too large
Load Diff
660
cg/cg4305.cpp
660
cg/cg4305.cpp
@ -1,330 +1,330 @@
|
||||
// cg4306: liquidazione IVA
|
||||
// funzionalita' accessorie (calcolo acconto, estrazione deleghe)
|
||||
|
||||
#include "cg4300.h"
|
||||
#include "cg4300b.h"
|
||||
#include "cg4300c.h"
|
||||
|
||||
static char buf[256];
|
||||
|
||||
// -------------------------------------------------- estrazione deleghe
|
||||
bool CG4300_App::set_deleghe()
|
||||
{
|
||||
TMask m("cg4300b.msk");
|
||||
int k = 0;
|
||||
long l, j;
|
||||
_calcall = FALSE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC)
|
||||
break;
|
||||
if (k == K_ENTER && (_calcall || _selected.ones() > 0l))
|
||||
break;
|
||||
k = m.run();
|
||||
|
||||
// _isprint = m.get_bool(CHK_CGB_PRINT);
|
||||
// _isbase = m.get_bool(CHK_CGB_BASE);
|
||||
// _basecalc = (tbc)m.get_long(RDB_CGB_BASE);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
_selected.reset();
|
||||
_ditte->destroy();
|
||||
|
||||
// build sheet
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
TString cod = _nditte_r->get("CODDITTA");
|
||||
TString vers = _nditte_r->get("FREQVIVA");
|
||||
|
||||
TToken_string d(" ");
|
||||
|
||||
// add record
|
||||
d.add(cod);
|
||||
d.add(_nditte_r->get("RAGSOC"));
|
||||
d.add(vers);
|
||||
|
||||
_ditte->add(d);
|
||||
if (_selected[l]) _ditte->check(l);
|
||||
}
|
||||
|
||||
// scegli ditte
|
||||
_ditte->run();
|
||||
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
|
||||
break;
|
||||
case BUT_CGB_ALL:
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
_year = m.get(FLD_CGB_YEAR);
|
||||
_month = atoi(m.get(FLD_CGB_MONTH));
|
||||
}
|
||||
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
bool CG4300_App::extract_deleghe()
|
||||
{
|
||||
long firm = TApplication::get_firm();
|
||||
_prind = new TProgind(_n_ditte,
|
||||
" Estrazione deleghe "
|
||||
"\n Preparazione archivi ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
long l;
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
|
||||
if (!(_calcall || _selected[l])) continue;
|
||||
|
||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||
sprintf (buf,"Estrazione deleghe (%d):\nditta %s",
|
||||
_month,
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
if (is_month_ok(_month))
|
||||
{
|
||||
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
||||
_freqviva = _nditte->curr().get("FREQVIVA");
|
||||
bool mens = _freqviva == "M";
|
||||
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
||||
(_month == 13 && (mens || _isbenzinaro));
|
||||
_isriepilogo = _month == 13;
|
||||
|
||||
extract_delega(_month);
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(firm);
|
||||
delete _prind;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4300_App::extract_delega(int month)
|
||||
{
|
||||
if (_isriepilogo && !_isannual)
|
||||
return FALSE;
|
||||
if (look_lim(month))
|
||||
{
|
||||
real topay = _lim->get_real("R0");
|
||||
if (topay.sign() <= 0) return TRUE;
|
||||
if (_isannual)
|
||||
{
|
||||
if (look_del(12,7))
|
||||
{
|
||||
topay -= _del->get_real("R0");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// importo rettifiche solo se non e' annuale
|
||||
topay += _lim->get_real("R5");
|
||||
}
|
||||
|
||||
if (topay.sign() > 0)
|
||||
{
|
||||
look_del(month, _isannual ? 2 : 1, TRUE);
|
||||
_del->put("R0",topay);
|
||||
_del->rewrite();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// -------------------------------------------- calcolo acconto dicembre
|
||||
bool CG4300_App::set_acconto()
|
||||
{
|
||||
TMask m("cg4300c.msk");
|
||||
m.set(CHK_CGC_PRINT,"X");
|
||||
|
||||
int k = 0;
|
||||
_calcall = FALSE;
|
||||
_selected.reset();
|
||||
long j;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC)
|
||||
break;
|
||||
if (k == K_ENTER && (_calcall || _selected.ones() > 0l))
|
||||
break;
|
||||
k = m.run();
|
||||
|
||||
_year = m.get(FLD_CGC_YEAR);
|
||||
_isprint = m.get_bool(CHK_CGC_PRINT);
|
||||
_isbase = m.get_bool(CHK_CGC_BASE);
|
||||
_basecalc = (tbc)m.get_long(RDB_CGC_BASE);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
_selected.reset();
|
||||
_ditte->destroy();
|
||||
|
||||
// build sheet
|
||||
long l;
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
TString cod = _nditte_r->get("CODDITTA");
|
||||
TString vers = _nditte_r->get("FREQVIVA");
|
||||
|
||||
TToken_string d(" ");
|
||||
|
||||
// add record
|
||||
d.add(cod);
|
||||
d.add(_nditte_r->get("RAGSOC"));
|
||||
d.add(vers);
|
||||
|
||||
_ditte->add(d);
|
||||
if (_selected[l]) _ditte->check(l);
|
||||
}
|
||||
|
||||
// scegli ditte
|
||||
_ditte->run();
|
||||
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
|
||||
break;
|
||||
case BUT_CGC_ALL:
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
|
||||
bool CG4300_App::recalc_acconti()
|
||||
{
|
||||
long l; bool onemade = FALSE;
|
||||
|
||||
long firm = TApplication::get_firm();
|
||||
_prind = new TProgind(_n_ditte,
|
||||
" Calcolo acconto "
|
||||
"\n Preparazione archivi ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
if (_calcall || _selected[l])
|
||||
{
|
||||
if (onemade == FALSE && _isprint)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(ACCHEAD);
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
|
||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||
sprintf (buf,"Calcolo acconto:\nditta %s",
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
recalc_acconto();
|
||||
onemade = TRUE;
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(firm);
|
||||
delete _prind;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4300_App::recalc_acconto()
|
||||
{
|
||||
real basecalcolo, acconto;
|
||||
bool isdifferita = FALSE;
|
||||
bool error = FALSE;
|
||||
|
||||
// this is absolutely fundamental
|
||||
|
||||
if (_basecalc == incorso)
|
||||
{
|
||||
// that's pazzesc but it turns out there's no better way
|
||||
_comp_acconto = TRUE;
|
||||
// force recalc of current month
|
||||
_recalc = one;
|
||||
update_firm(12);
|
||||
|
||||
// TBI calcola l'acconto!!!
|
||||
if (look_lim(12))
|
||||
{
|
||||
basecalcolo = _lim->get_real("R0");
|
||||
if (basecalcolo.sign() > 0)
|
||||
acconto = basecalcolo * ACCONTO_DICEMBRE;
|
||||
}
|
||||
else
|
||||
{
|
||||
acconto = real(-1);
|
||||
}
|
||||
// riaggiustati le palle
|
||||
_comp_acconto = FALSE;
|
||||
update_firm(12);
|
||||
}
|
||||
else if (_basecalc == precedente)
|
||||
{
|
||||
int yr = atoi(_year) - 1;
|
||||
_lim->zero();
|
||||
*_lim_anno = yr;
|
||||
*_lim_mese = 12;
|
||||
if (_lim->read() == NOERR)
|
||||
{
|
||||
basecalcolo = _lim->get_real("R0");
|
||||
if (basecalcolo.sign() > 0)
|
||||
acconto = basecalcolo * ACCONTO_DICEMBRE;
|
||||
}
|
||||
else error = TRUE;
|
||||
}
|
||||
|
||||
// sbatti l'acconto in LIA
|
||||
if (look_lia())
|
||||
{
|
||||
_lia->put("R4",acconto);
|
||||
isdifferita = _lia->get_bool("B1");
|
||||
_lia->rewrite();
|
||||
}
|
||||
|
||||
if (acconto.sign() > 0)
|
||||
{
|
||||
// crea o aggiorna delega
|
||||
look_del(12,7,TRUE);
|
||||
_del->put("R0", acconto);
|
||||
_del->rewrite();
|
||||
}
|
||||
|
||||
// per questa volta lasciamo perdere la describe_acconto
|
||||
if (_isprint)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(ACCONTO);
|
||||
d->_r0 = basecalcolo;
|
||||
d->_r1 = acconto;
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
d->_f2 = error;
|
||||
d->_f3 = isdifferita;
|
||||
d->_s0 = _nditte->curr().get("CODDITTA");
|
||||
d->_s1 = _nditte->curr().get("RAGSOC");
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// cg4306: liquidazione IVA
|
||||
// funzionalita' accessorie (calcolo acconto, estrazione deleghe)
|
||||
|
||||
#include "cg4300.h"
|
||||
#include "cg4300b.h"
|
||||
#include "cg4300c.h"
|
||||
|
||||
static char buf[256];
|
||||
|
||||
// -------------------------------------------------- estrazione deleghe
|
||||
bool CG4300_App::set_deleghe()
|
||||
{
|
||||
TMask m("cg4300b.msk");
|
||||
int k = 0;
|
||||
long l, j;
|
||||
_calcall = FALSE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC)
|
||||
break;
|
||||
if (k == K_ENTER && (_calcall || _selected.ones() > 0l))
|
||||
break;
|
||||
k = m.run();
|
||||
|
||||
// _isprint = m.get_bool(CHK_CGB_PRINT);
|
||||
// _isbase = m.get_bool(CHK_CGB_BASE);
|
||||
// _basecalc = (tbc)m.get_long(RDB_CGB_BASE);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
_selected.reset();
|
||||
_ditte->destroy();
|
||||
|
||||
// build sheet
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
TString cod = _nditte_r->get("CODDITTA");
|
||||
TString vers = _nditte_r->get("FREQVIVA");
|
||||
|
||||
TToken_string d(" ");
|
||||
|
||||
// add record
|
||||
d.add(cod);
|
||||
d.add(_nditte_r->get("RAGSOC"));
|
||||
d.add(vers);
|
||||
|
||||
_ditte->add(d);
|
||||
if (_selected[l]) _ditte->check(l);
|
||||
}
|
||||
|
||||
// scegli ditte
|
||||
_ditte->run();
|
||||
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
|
||||
break;
|
||||
case BUT_CGB_ALL:
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
_year = m.get(FLD_CGB_YEAR);
|
||||
_month = atoi(m.get(FLD_CGB_MONTH));
|
||||
}
|
||||
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
bool CG4300_App::extract_deleghe()
|
||||
{
|
||||
long firm = TApplication::get_firm();
|
||||
_prind = new TProgind(_n_ditte,
|
||||
" Estrazione deleghe "
|
||||
"\n Preparazione archivi ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
long l;
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
|
||||
if (!(_calcall || _selected[l])) continue;
|
||||
|
||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||
sprintf (buf,"Estrazione deleghe (%d):\nditta %s",
|
||||
_month,
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
if (is_month_ok(_month))
|
||||
{
|
||||
_isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4");
|
||||
_freqviva = _nditte->curr().get("FREQVIVA");
|
||||
bool mens = _freqviva == "M";
|
||||
_isannual = (_month == 12 && !mens && !_isbenzinaro) ||
|
||||
(_month == 13 && (mens || _isbenzinaro));
|
||||
_isriepilogo = _month == 13;
|
||||
|
||||
extract_delega(_month);
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(firm);
|
||||
delete _prind;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4300_App::extract_delega(int month)
|
||||
{
|
||||
if (_isriepilogo && !_isannual)
|
||||
return FALSE;
|
||||
if (look_lim(month))
|
||||
{
|
||||
real topay = _lim->get_real("R0");
|
||||
if (topay.sign() <= 0) return TRUE;
|
||||
if (_isannual)
|
||||
{
|
||||
if (look_del(12,7))
|
||||
{
|
||||
topay -= _del->get_real("R0");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// importo rettifiche solo se non e' annuale
|
||||
topay += _lim->get_real("R5");
|
||||
}
|
||||
|
||||
if (topay.sign() > 0)
|
||||
{
|
||||
look_del(month, _isannual ? 2 : 1, TRUE);
|
||||
_del->put("R0",topay);
|
||||
_del->rewrite();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// -------------------------------------------- calcolo acconto dicembre
|
||||
bool CG4300_App::set_acconto()
|
||||
{
|
||||
TMask m("cg4300c.msk");
|
||||
m.set(CHK_CGC_PRINT,"X");
|
||||
|
||||
int k = 0;
|
||||
_calcall = FALSE;
|
||||
_selected.reset();
|
||||
long j;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (k == K_ESC)
|
||||
break;
|
||||
if (k == K_ENTER && (_calcall || _selected.ones() > 0l))
|
||||
break;
|
||||
k = m.run();
|
||||
|
||||
_year = m.get(FLD_CGC_YEAR);
|
||||
_isprint = m.get_bool(CHK_CGC_PRINT);
|
||||
_isbase = m.get_bool(CHK_CGC_BASE);
|
||||
_basecalc = (tbc)m.get_long(RDB_CGC_BASE);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case DLG_SELECT:
|
||||
_selected.reset();
|
||||
_ditte->destroy();
|
||||
|
||||
// build sheet
|
||||
long l;
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
TString cod = _nditte_r->get("CODDITTA");
|
||||
TString vers = _nditte_r->get("FREQVIVA");
|
||||
|
||||
TToken_string d(" ");
|
||||
|
||||
// add record
|
||||
d.add(cod);
|
||||
d.add(_nditte_r->get("RAGSOC"));
|
||||
d.add(vers);
|
||||
|
||||
_ditte->add(d);
|
||||
if (_selected[l]) _ditte->check(l);
|
||||
}
|
||||
|
||||
// scegli ditte
|
||||
_ditte->run();
|
||||
|
||||
for (j = 0l; j < _ditte->items(); j++)
|
||||
if (_ditte->checked(j)) _selected.set(j);
|
||||
|
||||
break;
|
||||
case BUT_CGC_ALL:
|
||||
_calcall = TRUE;
|
||||
k = K_ENTER;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return k == K_ENTER;
|
||||
}
|
||||
|
||||
|
||||
bool CG4300_App::recalc_acconti()
|
||||
{
|
||||
long l; bool onemade = FALSE;
|
||||
|
||||
long firm = TApplication::get_firm();
|
||||
_prind = new TProgind(_n_ditte,
|
||||
" Calcolo acconto "
|
||||
"\n Preparazione archivi ",
|
||||
TRUE,TRUE,40);
|
||||
|
||||
for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next())
|
||||
{
|
||||
if (_prind->iscancelled())
|
||||
break;
|
||||
if (_calcall || _selected[l])
|
||||
{
|
||||
if (onemade == FALSE && _isprint)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(ACCHEAD);
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
|
||||
TApplication::set_firm(_nditte->curr().get_long("CODDITTA"));
|
||||
sprintf (buf,"Calcolo acconto:\nditta %s",
|
||||
(const char*)_nditte_r->get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
recalc_acconto();
|
||||
onemade = TRUE;
|
||||
}
|
||||
_prind->addstatus(1);
|
||||
}
|
||||
|
||||
TApplication::set_firm(firm);
|
||||
delete _prind;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4300_App::recalc_acconto()
|
||||
{
|
||||
real basecalcolo, acconto;
|
||||
bool isdifferita = FALSE;
|
||||
bool error = FALSE;
|
||||
|
||||
// this is absolutely fundamental
|
||||
|
||||
if (_basecalc == incorso)
|
||||
{
|
||||
// that's pazzesc but it turns out there's no better way
|
||||
_comp_acconto = TRUE;
|
||||
// force recalc of current month
|
||||
_recalc = one;
|
||||
update_firm(12);
|
||||
|
||||
// TBI calcola l'acconto!!!
|
||||
if (look_lim(12))
|
||||
{
|
||||
basecalcolo = _lim->get_real("R0");
|
||||
if (basecalcolo.sign() > 0)
|
||||
acconto = basecalcolo * ACCONTO_DICEMBRE;
|
||||
}
|
||||
else
|
||||
{
|
||||
acconto = real(-1);
|
||||
}
|
||||
// riaggiustati le palle
|
||||
_comp_acconto = FALSE;
|
||||
update_firm(12);
|
||||
}
|
||||
else if (_basecalc == precedente)
|
||||
{
|
||||
int yr = atoi(_year) - 1;
|
||||
_lim->zero();
|
||||
*_lim_anno = yr;
|
||||
*_lim_mese = 12;
|
||||
if (_lim->read() == NOERR)
|
||||
{
|
||||
basecalcolo = _lim->get_real("R0");
|
||||
if (basecalcolo.sign() > 0)
|
||||
acconto = basecalcolo * ACCONTO_DICEMBRE;
|
||||
}
|
||||
else error = TRUE;
|
||||
}
|
||||
|
||||
// sbatti l'acconto in LIA
|
||||
if (look_lia())
|
||||
{
|
||||
_lia->put("R4",acconto);
|
||||
isdifferita = _lia->get_bool("B1");
|
||||
_lia->rewrite();
|
||||
}
|
||||
|
||||
if (acconto.sign() > 0)
|
||||
{
|
||||
// crea o aggiorna delega
|
||||
look_del(12,7,TRUE);
|
||||
_del->put("R0", acconto);
|
||||
_del->rewrite();
|
||||
}
|
||||
|
||||
// per questa volta lasciamo perdere la describe_acconto
|
||||
if (_isprint)
|
||||
{
|
||||
_DescrItem* d = new _DescrItem(ACCONTO);
|
||||
d->_r0 = basecalcolo;
|
||||
d->_r1 = acconto;
|
||||
d->_f0 = _basecalc == incorso;
|
||||
d->_f1 = _isbase;
|
||||
d->_f2 = error;
|
||||
d->_f3 = isdifferita;
|
||||
d->_s0 = _nditte->curr().get("CODDITTA");
|
||||
d->_s1 = _nditte->curr().get("RAGSOC");
|
||||
_descr_arr.add(d);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
3216
cg/cg4400.cpp
3216
cg/cg4400.cpp
File diff suppressed because it is too large
Load Diff
258
cg/cglib.h
258
cg/cglib.h
@ -1,133 +1,125 @@
|
||||
#ifndef __CGLIB_H
|
||||
#define __CGLIB_H
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
#ifndef __DATE_H
|
||||
#include <date.h>
|
||||
#endif
|
||||
|
||||
#include <assoc.h>
|
||||
//#include <utility.h>
|
||||
//#include <config.h>
|
||||
//#include <applicat.h>
|
||||
|
||||
#include "conto.h"
|
||||
|
||||
TLocalisamfile * get_descr_cf(TLocalisamfile * pconti,
|
||||
TLocalisamfile * clifo , int g, int c, long s);
|
||||
|
||||
class TClifo_list : public TArray
|
||||
{
|
||||
public:
|
||||
TClifo_list(int g, int c, char tipocf);
|
||||
TRectype& clifo(int i)const { return(TRectype&)this->operator[](i); }
|
||||
};
|
||||
|
||||
//typedef enum {scalare = 1, verifica} bilancio;
|
||||
|
||||
class Saldo
|
||||
{
|
||||
real _saldo, _saldo_iniziale, _prg_dare, _prg_avere;
|
||||
int _indbil;
|
||||
TRectype* _rec;
|
||||
//bilancio _bilancio;
|
||||
int _annoes;
|
||||
TDate _inizioEs, _fineEs;
|
||||
TString16 _codcaus;
|
||||
TDate _datareg;
|
||||
TDate _datacomp;
|
||||
TString _provv;
|
||||
|
||||
protected:
|
||||
void InFinEs(int);
|
||||
|
||||
public:
|
||||
int annoes () const { return _annoes; }
|
||||
//bilancio bil () const { return _bilancio; }
|
||||
void set_annoes (int anno) { _annoes = anno; }
|
||||
//void set_bil (bilancio bil) { _bilancio = bil; }
|
||||
void leggi_mov(long);
|
||||
bool causale_mov(long, const TDate&, const TDate&, TString&);
|
||||
const char* causale_chiusura_es();
|
||||
const char* causale_apertura_es();
|
||||
bool calcola_data_limite(int,int,int,long,const TDate&,const TDate&,int,bool,
|
||||
const TDate&,const TDate&,const TDate&,bool);
|
||||
bool calcola_ultima_immissione(int, int, int, int, long, int);
|
||||
bool ultima_immissione_bilancio(int anno,int g,int c,long s,int indbil);
|
||||
bool data_limite_bilancio(int,int,int,long,const TDate&,const TDate&,int,bool);
|
||||
real calcola_saldo_iniziale(int, int, int, long, int);
|
||||
bool calcola_clifo(int, int, int, int, int);
|
||||
TRectype& ricerca_progr_prec(int, int, int, long);
|
||||
real saldofin_esprec(int,int,int,long);
|
||||
real saldo() {return _saldo;}
|
||||
real saldoini() {return _saldo_iniziale;}
|
||||
real prgdare() {return _prg_dare;}
|
||||
real prgavere() {return _prg_avere;}
|
||||
bool calcola(int,int,int,int,long,const TDate&,const TDate&,int,bool,
|
||||
const TDate&,const TDate&,const TDate&,bool);
|
||||
bool prg_attuali(int,TConto&,int,real&,real&);
|
||||
bool prg_mov_eliminati(int,TConto&,int,real&,real&);
|
||||
Saldo();
|
||||
~Saldo();
|
||||
};
|
||||
|
||||
class TTab_conti : public TAssoc_array
|
||||
{
|
||||
void do_agg(TConto* tc, int anno_es, const real& importo, char sezione,
|
||||
bool movap, bool provv, bool somma, const char* key);
|
||||
public:
|
||||
void aggiorna_conto(const TConto& tc, int anno_es, const real& importo,
|
||||
char sezione, bool movap, bool provv, bool somma);
|
||||
void aggiorna_conto (int gruppo, int conto, long sottoconto, int anno_es,
|
||||
const real& importo, char sezione, bool movap,
|
||||
bool provv, bool somma);
|
||||
};
|
||||
|
||||
class TSaldo_agg : public TObject
|
||||
{
|
||||
TTab_conti _tab_conti;
|
||||
bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in
|
||||
// saldi)
|
||||
bool _provv;
|
||||
int _anno_es; // anno esercizio
|
||||
TDate _data_ulmov; // data ultimo movimento
|
||||
long _num_ulmov; // numero ultimo movimento
|
||||
TRectype * _rec; // record corrente sui saldi
|
||||
TConto& tconti() { return *(TConto*)_tab_conti.get(); }
|
||||
|
||||
public:
|
||||
void clear_saldi(int year);
|
||||
void registra();
|
||||
void aggiorna (const TConto& tc, const real& importo, char sezione,
|
||||
bool somma=TRUE);
|
||||
void aggiorna (int gruppo, int conto, long sottoconto, const real& importo,
|
||||
char sezione, bool somma=TRUE);
|
||||
|
||||
void set_anno_es(int anno) { _anno_es = anno; }
|
||||
int anno_es() { return _anno_es; }
|
||||
|
||||
void set_movap (bool movap) { _movap = movap; }
|
||||
bool movap() { return _movap; }
|
||||
|
||||
void set_movprovv (bool p) { _provv = p; }
|
||||
bool movprovv() { return _provv; }
|
||||
|
||||
void set_data_ulmov (TDate& data) { _data_ulmov = data; }
|
||||
TDate& data_ulmov() { return _data_ulmov; }
|
||||
|
||||
void set_num_ulmov (long num) { _num_ulmov = num; }
|
||||
long num_ulmov() { return _num_ulmov; }
|
||||
|
||||
void reset(); // pulisce l'array dei conti
|
||||
TSaldo_agg();
|
||||
int items() const { return _tab_conti.items();}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __CGLIB_H
|
||||
#define __CGLIB_H
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ASSOC_H
|
||||
#include <assoc.h>
|
||||
#endif
|
||||
|
||||
#include "conto.h"
|
||||
|
||||
TLocalisamfile * get_descr_cf(TLocalisamfile * pconti,
|
||||
TLocalisamfile * clifo , int g, int c, long s);
|
||||
|
||||
class TClifo_list : public TArray
|
||||
{
|
||||
public:
|
||||
TClifo_list(int g, int c, char tipocf);
|
||||
TRectype& clifo(int i)const { return(TRectype&)this->operator[](i); }
|
||||
};
|
||||
|
||||
//typedef enum {scalare = 1, verifica} bilancio;
|
||||
|
||||
class Saldo
|
||||
{
|
||||
real _saldo, _saldo_iniziale, _prg_dare, _prg_avere;
|
||||
int _indbil;
|
||||
TRectype* _rec;
|
||||
//bilancio _bilancio;
|
||||
int _annoes;
|
||||
TDate _inizioEs, _fineEs;
|
||||
TString16 _codcaus;
|
||||
TDate _datareg;
|
||||
TDate _datacomp;
|
||||
TString _provv;
|
||||
|
||||
protected:
|
||||
void InFinEs(int);
|
||||
|
||||
public:
|
||||
int annoes () const { return _annoes; }
|
||||
//bilancio bil () const { return _bilancio; }
|
||||
void set_annoes (int anno) { _annoes = anno; }
|
||||
//void set_bil (bilancio bil) { _bilancio = bil; }
|
||||
void leggi_mov(long);
|
||||
bool causale_mov(long, const TDate&, const TDate&, TString&);
|
||||
const char* causale_chiusura_es();
|
||||
const char* causale_apertura_es();
|
||||
bool calcola_data_limite(int,int,int,long,const TDate&,const TDate&,int,bool,
|
||||
const TDate&,const TDate&,const TDate&,bool);
|
||||
bool calcola_ultima_immissione(int, int, int, int, long, int);
|
||||
bool ultima_immissione_bilancio(int anno,int g,int c,long s,int indbil);
|
||||
bool data_limite_bilancio(int,int,int,long,const TDate&,const TDate&,int,bool);
|
||||
real calcola_saldo_iniziale(int, int, int, long, int);
|
||||
bool calcola_clifo(int, int, int, int, int);
|
||||
TRectype& ricerca_progr_prec(int, int, int, long);
|
||||
real saldofin_esprec(int,int,int,long);
|
||||
real saldo() {return _saldo;}
|
||||
real saldoini() {return _saldo_iniziale;}
|
||||
real prgdare() {return _prg_dare;}
|
||||
real prgavere() {return _prg_avere;}
|
||||
bool calcola(int,int,int,int,long,const TDate&,const TDate&,int,bool,
|
||||
const TDate&,const TDate&,const TDate&,bool);
|
||||
bool prg_attuali(int,TConto&,int,real&,real&);
|
||||
bool prg_mov_eliminati(int,TConto&,int,real&,real&);
|
||||
Saldo();
|
||||
~Saldo();
|
||||
};
|
||||
|
||||
class TTab_conti : public TAssoc_array
|
||||
{
|
||||
void do_agg(TConto* tc, int anno_es, const real& importo, char sezione,
|
||||
bool movap, bool provv, bool somma, const char* key);
|
||||
public:
|
||||
void aggiorna_conto(const TConto& tc, int anno_es, const real& importo,
|
||||
char sezione, bool movap, bool provv, bool somma);
|
||||
void aggiorna_conto (int gruppo, int conto, long sottoconto, int anno_es,
|
||||
const real& importo, char sezione, bool movap,
|
||||
bool provv, bool somma);
|
||||
};
|
||||
|
||||
class TSaldo_agg : public TObject
|
||||
{
|
||||
TTab_conti _tab_conti;
|
||||
bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in saldi)
|
||||
bool _provv;
|
||||
int _anno_es; // anno esercizio
|
||||
TDate _data_ulmov; // data ultimo movimento
|
||||
long _num_ulmov; // numero ultimo movimento
|
||||
TRectype * _rec; // record corrente sui saldi
|
||||
TConto& tconti() { return *(TConto*)_tab_conti.get(); }
|
||||
|
||||
public:
|
||||
void clear_saldi(int year);
|
||||
void registra();
|
||||
void aggiorna (const TConto& tc, const real& importo, char sezione,
|
||||
bool somma=TRUE);
|
||||
void aggiorna (int gruppo, int conto, long sottoconto, const real& importo,
|
||||
char sezione, bool somma=TRUE);
|
||||
|
||||
void set_anno_es(int anno) { _anno_es = anno; }
|
||||
int anno_es() const { return _anno_es; }
|
||||
|
||||
void set_movap (bool movap) { _movap = movap; }
|
||||
bool movap() const { return _movap; }
|
||||
|
||||
void set_movprovv (bool p) { _provv = p; }
|
||||
bool movprovv() const { return _provv; }
|
||||
|
||||
void set_data_ulmov (const TDate& data) { _data_ulmov = data; }
|
||||
const TDate& data_ulmov() const { return _data_ulmov; }
|
||||
|
||||
void set_num_ulmov (long num) { _num_ulmov = num; }
|
||||
long num_ulmov() const { return _num_ulmov; }
|
||||
|
||||
void reset(); // pulisce l'array dei conti
|
||||
TSaldo_agg();
|
||||
int items() const { return _tab_conti.items();}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
33
cg/conto.cpp
33
cg/conto.cpp
@ -3,20 +3,11 @@
|
||||
|
||||
#include <isam.h>
|
||||
#include <utility.h>
|
||||
#include <lffiles.h>
|
||||
|
||||
#include "conto.h"
|
||||
|
||||
|
||||
// Certified 100%
|
||||
TConto::TConto(int g, int c, long s, char t, const char* d)
|
||||
: _tipo(toupper(t)), _gruppo(g), _conto(c), _sottoconto(s),
|
||||
_descrizione(d), _tipo_cr(-1)
|
||||
{}
|
||||
|
||||
|
||||
// Certified 90%
|
||||
TConto::TConto(TToken_string& s, int from, int mode)
|
||||
TBill::TBill(TToken_string& s, int from, int mode)
|
||||
: _tipo_cr(-1)
|
||||
{
|
||||
const char* first = s.get(from);
|
||||
@ -43,7 +34,7 @@ TConto::TConto(TToken_string& s, int from, int mode)
|
||||
|
||||
|
||||
// Certified 100%
|
||||
TConto& TConto::set(int g, int c, long s, char t, const char* d)
|
||||
const TBill& TBill::set(int g, int c, long s, char t, const char* d)
|
||||
{
|
||||
_tipo = (t > ' ') ? toupper(t) : ' ';
|
||||
_gruppo = g;
|
||||
@ -53,7 +44,7 @@ TConto& TConto::set(int g, int c, long s, char t, const char* d)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const TConto& TConto::add_to(TToken_string& ts, int from, int mode)
|
||||
const TBill& TBill::add_to(TToken_string& ts, int from, int mode)
|
||||
{
|
||||
if (mode & 0x4)
|
||||
{
|
||||
@ -72,16 +63,16 @@ const TConto& TConto::add_to(TToken_string& ts, int from, int mode)
|
||||
|
||||
|
||||
// Certified 100%
|
||||
bool TConto::ok() const
|
||||
bool TBill::ok() const
|
||||
{
|
||||
return _gruppo != 0 && _conto != 0 && _sottoconto != 0L;
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
int TConto::compare(const TSortable& s) const
|
||||
int TBill::compare(const TSortable& s) const
|
||||
{
|
||||
CHECK(class_name()==s.class_name(), "Can't compare TConto with TObject");
|
||||
const TConto& c = (const TConto&)s;
|
||||
CHECK(class_name()==s.class_name(), "Can't compare TBill with TObject");
|
||||
const TBill& c = (const TBill&)s;
|
||||
|
||||
int res = _gruppo - c._gruppo;
|
||||
if (res) return res;
|
||||
@ -98,7 +89,7 @@ int TConto::compare(const TSortable& s) const
|
||||
|
||||
|
||||
// Certified 90% (uses __tmp_string && isam)
|
||||
const char* TConto::describe()
|
||||
const char* TBill::describe()
|
||||
{
|
||||
int err = NOERR;
|
||||
const char* desc = NULL;
|
||||
@ -142,7 +133,7 @@ const char* TConto::describe()
|
||||
}
|
||||
|
||||
|
||||
bool TConto::read(TRectype &r)
|
||||
bool TBill::read(TRectype &r)
|
||||
{
|
||||
TLocalisamfile pcon(LF_PCON, FALSE);
|
||||
pcon.setkey(1);
|
||||
@ -165,7 +156,7 @@ bool TConto::read(TRectype &r)
|
||||
}
|
||||
|
||||
// Certified 99% (describe uses __tmp_string)
|
||||
const TString& TConto::descrizione()
|
||||
const TString& TBill::descrizione()
|
||||
{
|
||||
if (_descrizione.empty())
|
||||
{
|
||||
@ -178,7 +169,7 @@ const TString& TConto::descrizione()
|
||||
return _descrizione;
|
||||
}
|
||||
|
||||
int TConto::tipo_cr()
|
||||
int TBill::tipo_cr()
|
||||
{
|
||||
if (_tipo_cr < 0)
|
||||
{
|
||||
@ -190,7 +181,7 @@ int TConto::tipo_cr()
|
||||
|
||||
|
||||
// Certified 99% (uses __tmp_string)
|
||||
const char* TConto::string(int mode)
|
||||
const char* TBill::string(int mode)
|
||||
{
|
||||
TFixed_string s(&__tmp_string[256], 80);
|
||||
s.cut(0);
|
||||
|
56
cg/conto.h
56
cg/conto.h
@ -9,53 +9,63 @@
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
enum TIndbil { ib_null, ib_attivita, ib_passivita, ib_costi, ib_ricavi, ib_conti_ordine };
|
||||
|
||||
class TConto : public TSortable
|
||||
class TBill : public TSortable
|
||||
{
|
||||
char _tipo; // ' ' = Conto, 'C' = Cliente, 'F' = 'Fornitore'
|
||||
char _tipo; // ' ' = Conto, 'C' = Cliente, 'F' = 'Fornitore'
|
||||
int _gruppo, _conto;
|
||||
long _sottoconto; // Sottoconto, codice cliente o fornitore
|
||||
TString80 _descrizione; // Vuota fino alla chiamata di describe
|
||||
int _tipo_cr;
|
||||
real _dare, _avere;
|
||||
real _darepro, _averepro;
|
||||
real _saldo;
|
||||
long _sottoconto; // Sottoconto, codice cliente o fornitore
|
||||
TString80 _descrizione; // Vuota fino alla chiamata di describe
|
||||
int _tipo_cr; // Tipo costo/ricavo
|
||||
|
||||
protected:
|
||||
virtual int compare(const TSortable& s) const;
|
||||
virtual const char* class_name() const { return "Conto"; }
|
||||
|
||||
const char* describe();
|
||||
|
||||
public:
|
||||
TConto(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL);
|
||||
TConto(TToken_string& tgcsd, int from, int mode = 0);
|
||||
virtual ~TConto() {}
|
||||
TBill(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL)
|
||||
: _tipo(t), _gruppo(g), _conto(c), _sottoconto(s), _descrizione(d), _tipo_cr(-1) {}
|
||||
|
||||
TConto& set(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL);
|
||||
const TConto& add_to(TToken_string& ts, int from, int mode = 0);
|
||||
TBill(TToken_string& tgcsd, int from, int mode = 0);
|
||||
virtual ~TBill() {}
|
||||
|
||||
const TBill& set(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL);
|
||||
const TBill& add_to(TToken_string& ts, int from, int mode = 0);
|
||||
|
||||
virtual bool ok() const; // Gruppo, Conto e Sottoconto non nulli
|
||||
|
||||
real& dare() { return _dare; }
|
||||
real& avere() { return _avere; }
|
||||
real& darepro() { return _darepro; }
|
||||
real& averepro() { return _averepro; }
|
||||
real& saldo() { return _saldo; }
|
||||
|
||||
char tipo() const { return _tipo; }
|
||||
int gruppo() const { return _gruppo; }
|
||||
int conto() const { return _conto; }
|
||||
long sottoconto() const { return _sottoconto; }
|
||||
|
||||
const TString& descrizione();
|
||||
int TConto::tipo_cr();
|
||||
int tipo_cr();
|
||||
bool read(TRectype& r);
|
||||
|
||||
const char* string(int mode = 0);
|
||||
};
|
||||
|
||||
|
||||
enum TIndbil { ib_null, ib_attivita, ib_passivita, ib_costi, ib_ricavi, ib_conti_ordine };
|
||||
|
||||
class TConto : public TBill
|
||||
{
|
||||
real _dare, _avere, _darepro, _averepro, _saldo;
|
||||
|
||||
public:
|
||||
TConto(int g = 0, int c = 0, long s = 0L, char t = ' ', const char* d = NULL)
|
||||
: TBill(g, c, s, t, d) {}
|
||||
TConto (TToken_string& tgcsd, int from, int mode = 0)
|
||||
: TBill(tgcsd, from, mode) {};
|
||||
|
||||
real& dare() { return _dare; }
|
||||
real& avere() { return _avere; }
|
||||
real& darepro() { return _darepro; }
|
||||
real& averepro() { return _averepro; }
|
||||
real& saldo() { return _saldo; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user