Corretta decodifica registri nelle causali
Allineato uso dei file isam temporanei nelle stampe Zerofillato mese nell'accesso a PIM e PLM in prima nota git-svn-id: svn://10.65.10.50/trunk@989 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
093b311205
commit
3d7dd11af5
@ -43,7 +43,8 @@ typedef enum { no_descr, acquisto, vendita, incasso_pagamento,
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
static bool filtra_reg(const TRelation * r);
|
static bool filtra_reg(const TRelation * r);
|
||||||
void set_reg_filter();
|
int calc_filter(const TString& tpd);
|
||||||
|
void set_reg_filter(int filtro);
|
||||||
|
|
||||||
static bool tipocf_hndl (TMask_field& f, KEY k);
|
static bool tipocf_hndl (TMask_field& f, KEY k);
|
||||||
static bool cod_reg_hndl (TMask_field& f, KEY k);
|
static bool cod_reg_hndl (TMask_field& f, KEY k);
|
||||||
@ -91,11 +92,11 @@ protected:
|
|||||||
// int cancella(long items);
|
// int cancella(long items);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tipo_descr _tipo_des; // Il tipo di causale corrente
|
tipo_descr _tipo_des; // Il tipo di causale corrente
|
||||||
|
|
||||||
void compila_array (const TString&, int, int, int);
|
void compila_array (const TString&, int, int, int);
|
||||||
|
|
||||||
TSheet_field& ss() const { return *_sheet; }
|
TSheet_field& ss() const { return *_sheet; }
|
||||||
TMask& ss_mask() const { return _sheet->sheet_mask(); }
|
TMask& ss_mask() const { return _sheet->sheet_mask(); }
|
||||||
|
|
||||||
void add_riga (int numrig, char sz, TConto& tc, const TString& d, const TString& da);
|
void add_riga (int numrig, char sz, TConto& tc, const TString& d, const TString& da);
|
||||||
@ -112,26 +113,26 @@ HIDDEN TCaus_app& app() { return (TCaus_app&) main_app(); }
|
|||||||
|
|
||||||
bool TCaus_app::filtra_reg(const TRelation * r)
|
bool TCaus_app::filtra_reg(const TRelation * r)
|
||||||
{
|
{
|
||||||
bool ok = FALSE;
|
bool ok = TRUE;
|
||||||
|
|
||||||
const TRectype& rec = r->lfile().curr();
|
const TRectype& rec = r->lfile().curr();
|
||||||
const int anno = atoi(rec.get("CODTAB").left(4));
|
const int anno = atoi(rec.get("CODTAB").left(4));
|
||||||
|
|
||||||
if (anno == app().anno_iva())
|
if (anno == app().anno_iva())
|
||||||
{
|
{
|
||||||
const int tiporeg = rec.get_int("I0");
|
const TipoIVA tiporeg = (TipoIVA)rec.get_int("I0");
|
||||||
const bool corrisp = rec.get_bool("B0");
|
const bool corrisp = rec.get_bool("B0");
|
||||||
|
|
||||||
switch (app()._filtro)
|
switch (app()._filtro)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
ok = tiporeg == 1; break;
|
ok = tiporeg == iva_vendite; break;
|
||||||
case 2:
|
case 2:
|
||||||
ok = (tiporeg == 1 && corrisp); break;
|
ok = (tiporeg == iva_vendite && corrisp); break;
|
||||||
case 3:
|
case 3:
|
||||||
ok = tiporeg == 2; break;
|
ok = tiporeg == iva_acquisti; break;
|
||||||
case 4: // tiporeg 1 senza corrisp OPPURE 2 (NC ST ND AF)
|
case 4: // tiporeg 1 senza corrisp OPPURE 2 (NC ST ND AF)
|
||||||
ok = tiporeg == 2 || (tiporeg == 1 && !corrisp) ; break;
|
ok = tiporeg == iva_acquisti || (tiporeg == iva_vendite && !corrisp) ; break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -276,8 +277,10 @@ bool TCaus_app::m770_hndl (TMask_field& f, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCaus_app::set_reg_filter()
|
void TCaus_app::set_reg_filter(int f)
|
||||||
{
|
{
|
||||||
|
_filtro = f;
|
||||||
|
|
||||||
TEdit_field& reg = _msk->efield(F_COD_REG);
|
TEdit_field& reg = _msk->efield(F_COD_REG);
|
||||||
reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
|
|
||||||
@ -285,6 +288,39 @@ void TCaus_app::set_reg_filter()
|
|||||||
des.browse()->cursor()->set_filterfunction(filtra_reg);
|
des.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int TCaus_app::calc_filter(const TString& tpd)
|
||||||
|
{
|
||||||
|
TTable tabtpd("%TPD");
|
||||||
|
tabtpd.put("CODTAB", tpd);
|
||||||
|
|
||||||
|
int filtro = 0;
|
||||||
|
|
||||||
|
if (tabtpd.read() == NOERR)
|
||||||
|
{
|
||||||
|
const TipoIVA i = (TipoIVA)tabtpd.get_int("I0"); // IVA acquisti, vendite, generica
|
||||||
|
const bool corrisp = tabtpd.get_bool("B0");
|
||||||
|
|
||||||
|
if (i == iva_vendite) // vendite
|
||||||
|
{
|
||||||
|
if (corrisp) // vendite con corrispettivi
|
||||||
|
filtro = 2;
|
||||||
|
else // vendite senza corrispettivi
|
||||||
|
filtro = 1;
|
||||||
|
} else
|
||||||
|
if ( i == iva_acquisti ) // acquisti
|
||||||
|
filtro = 3;
|
||||||
|
else
|
||||||
|
if ( i == 9 ) // sia acquisti che vendite
|
||||||
|
filtro = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_reg_filter(filtro);
|
||||||
|
|
||||||
|
return filtro;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
// Testo K_TAB perche' il controllo deve scattare anche all'inizio
|
// Testo K_TAB perche' il controllo deve scattare anche all'inizio
|
||||||
@ -302,39 +338,7 @@ bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
|
|||||||
|
|
||||||
field_reg.enable();
|
field_reg.enable();
|
||||||
m.enable(F_DES_REG);
|
m.enable(F_DES_REG);
|
||||||
|
app().calc_filter(val);
|
||||||
TTable tabtpd("%TPD");
|
|
||||||
tabtpd.put("CODTAB", val);
|
|
||||||
|
|
||||||
if (tabtpd.read() == NOERR)
|
|
||||||
{
|
|
||||||
const TipoIVA i = (TipoIVA)tabtpd.get_int("I0"); // IVA acquisti, vendite, generica
|
|
||||||
const bool corrisp = tabtpd.get_bool("B0");
|
|
||||||
|
|
||||||
if (i == 1) // vendite
|
|
||||||
{
|
|
||||||
if (corrisp) // vendite con corrispettivi
|
|
||||||
{
|
|
||||||
app()._filtro = 2;
|
|
||||||
app().set_reg_filter();
|
|
||||||
}
|
|
||||||
else // vendite senza corrispettivi
|
|
||||||
{
|
|
||||||
app()._filtro = 1;
|
|
||||||
app().set_reg_filter();
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
if ( i == 2 ) // acquisti
|
|
||||||
{
|
|
||||||
app()._filtro = 3;
|
|
||||||
app().set_reg_filter();
|
|
||||||
} else
|
|
||||||
if ( i == 9 ) // sia acquisti che vendite
|
|
||||||
{
|
|
||||||
app()._filtro = 4;
|
|
||||||
app().set_reg_filter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else // TIPODOC vuoto || IN || PG || AN
|
else // TIPODOC vuoto || IN || PG || AN
|
||||||
{
|
{
|
||||||
@ -667,6 +671,10 @@ int TCaus_app::read(TMask& m)
|
|||||||
m.autoload(_rel);
|
m.autoload(_rel);
|
||||||
read_rcaus(m);
|
read_rcaus(m);
|
||||||
fill_sheet(m);
|
fill_sheet(m);
|
||||||
|
|
||||||
|
const TString16 tpd = m.get(F_TIPO_DOC);
|
||||||
|
calc_filter(tpd);
|
||||||
|
|
||||||
return NOERR;
|
return NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ void CG1500_application::scrivic_file_temp()
|
|||||||
void CG1500_application::scrivis_file_temp(int g, int c, long s, real saldo)
|
void CG1500_application::scrivis_file_temp(int g, int c, long s, real saldo)
|
||||||
{
|
{
|
||||||
TIsamtempfile* tmp = NULL;
|
TIsamtempfile* tmp = NULL;
|
||||||
TString nome_campo(12);
|
TString16 nome_campo;
|
||||||
|
|
||||||
if (_indbil==1)
|
if (_indbil==1)
|
||||||
{
|
{
|
||||||
@ -778,17 +778,18 @@ bool CG1500_application::bil_sez_contr()
|
|||||||
bool esiste_conto=FALSE, esiste_sc = FALSE;
|
bool esiste_conto=FALSE, esiste_sc = FALSE;
|
||||||
bool movimentato = FALSE;
|
bool movimentato = FALSE;
|
||||||
|
|
||||||
_tmp_saldi_att->open("cg01");
|
CHECK(_tmp_saldi_att == NULL, "La minchia che riapro cg01");
|
||||||
|
_tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", 2);
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
_tmp_saldi_pass->open("cg02");
|
_tmp_saldi_pass = new TIsamtempfile(LF_SALDI, "cg02", 2);
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
_tmp_saldi_costi->open("cg03");
|
_tmp_saldi_costi = new TIsamtempfile(LF_SALDI, "cg03", 2);
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
_tmp_saldi_ricavi->open("cg04");
|
_tmp_saldi_ricavi = new TIsamtempfile(LF_SALDI, "cg04", 2);
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
_tmp_saldi_conti_uno->open("cg05");
|
_tmp_saldi_conti_uno = new TIsamtempfile(LF_SALDI, "cg05", 2);
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
_tmp_saldi_conti_due->open("cg06");
|
_tmp_saldi_conti_due = new TIsamtempfile(LF_SALDI, "cg06", 2);
|
||||||
_prog->addstatus(1);
|
_prog->addstatus(1);
|
||||||
|
|
||||||
_gp=-1;
|
_gp=-1;
|
||||||
@ -1120,7 +1121,8 @@ bool CG1500_application::bil_verifica()
|
|||||||
real mov_gruppo_dare, mov_gruppo_avere, prg_gruppo_dare, prg_gruppo_avere;
|
real mov_gruppo_dare, mov_gruppo_avere, prg_gruppo_dare, prg_gruppo_avere;
|
||||||
bool esiste_conto = FALSE, esiste_sc = FALSE, movimentato = FALSE;
|
bool esiste_conto = FALSE, esiste_sc = FALSE, movimentato = FALSE;
|
||||||
|
|
||||||
_tmp_saldi_att->open("cg01");
|
CHECK(_tmp_saldi_att == NULL, "La minchia che riapro cg01");
|
||||||
|
_tmp_saldi_att = new TIsamtempfile(LF_SALDI, "cg01", 2);
|
||||||
|
|
||||||
_gp=-1;
|
_gp=-1;
|
||||||
_cp=-1;
|
_cp=-1;
|
||||||
@ -2234,19 +2236,21 @@ void CG1500_application::postclose_print()
|
|||||||
{
|
{
|
||||||
if (_bilancio == 1)
|
if (_bilancio == 1)
|
||||||
{
|
{
|
||||||
_tmp_saldi_att->close();
|
delete _tmp_saldi_att; _tmp_saldi_att = NULL;
|
||||||
_tmp_saldi_pass->close();
|
delete _tmp_saldi_pass; _tmp_saldi_pass = NULL;
|
||||||
_tmp_saldi_costi->close();
|
delete _tmp_saldi_costi; _tmp_saldi_costi = NULL;
|
||||||
_tmp_saldi_ricavi->close();
|
delete _tmp_saldi_ricavi; _tmp_saldi_ricavi = NULL;
|
||||||
_tmp_saldi_conti_uno->close();
|
delete _tmp_saldi_conti_uno; _tmp_saldi_conti_uno = NULL;
|
||||||
_tmp_saldi_conti_due->close();
|
delete _tmp_saldi_conti_due; _tmp_saldi_conti_due = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_verifica == 3)
|
if (_verifica == 3)
|
||||||
delete _sort;
|
delete _sort;
|
||||||
else
|
else
|
||||||
_tmp_saldi_att->close();
|
{
|
||||||
|
delete _tmp_saldi_att; _tmp_saldi_att = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//return NEXT_PAGE;
|
//return NEXT_PAGE;
|
||||||
}
|
}
|
||||||
@ -2913,12 +2917,12 @@ bool CG1500_application::user_create()
|
|||||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||||
_anag = new TLocalisamfile(LF_ANAG);
|
_anag = new TLocalisamfile(LF_ANAG);
|
||||||
_esc = new TTable("ESC");
|
_esc = new TTable("ESC");
|
||||||
_tmp_saldi_att = new TIsamtempfile(LF_SALDI);
|
_tmp_saldi_att = NULL;
|
||||||
_tmp_saldi_pass = new TIsamtempfile(LF_SALDI);
|
_tmp_saldi_pass = NULL;
|
||||||
_tmp_saldi_costi = new TIsamtempfile(LF_SALDI);
|
_tmp_saldi_costi = NULL;
|
||||||
_tmp_saldi_ricavi = new TIsamtempfile(LF_SALDI);
|
_tmp_saldi_ricavi = NULL;
|
||||||
_tmp_saldi_conti_uno = new TIsamtempfile(LF_SALDI);
|
_tmp_saldi_conti_uno = NULL;
|
||||||
_tmp_saldi_conti_due = new TIsamtempfile(LF_SALDI);
|
_tmp_saldi_conti_due = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2935,12 +2939,13 @@ bool CG1500_application::user_destroy()
|
|||||||
delete _nditte;
|
delete _nditte;
|
||||||
delete _anag;
|
delete _anag;
|
||||||
delete _esc;
|
delete _esc;
|
||||||
delete _tmp_saldi_att;
|
|
||||||
delete _tmp_saldi_pass;
|
if (_tmp_saldi_att) delete _tmp_saldi_att;
|
||||||
delete _tmp_saldi_costi;
|
if (_tmp_saldi_pass) delete _tmp_saldi_pass;
|
||||||
delete _tmp_saldi_ricavi;
|
if (_tmp_saldi_costi) delete _tmp_saldi_costi;
|
||||||
delete _tmp_saldi_conti_uno;
|
if (_tmp_saldi_ricavi) delete _tmp_saldi_ricavi;
|
||||||
delete _tmp_saldi_conti_due;
|
if (_tmp_saldi_conti_uno) delete _tmp_saldi_conti_uno;
|
||||||
|
if (_tmp_saldi_conti_due) delete _tmp_saldi_conti_due;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,8 +189,7 @@ bool TMovimentoPN::controlla_liquidazione(const TDate& data, bool reset) const
|
|||||||
const int mese = date2liq(data);
|
const int mese = date2liq(data);
|
||||||
|
|
||||||
// Chiave di LIM: Anno (1-4), Mese (5-6)
|
// Chiave di LIM: Anno (1-4), Mese (5-6)
|
||||||
TString16 key;
|
TString16 key; key.format("%04d%02d", anno, mese);
|
||||||
key << anno << mese;
|
|
||||||
TTable lim("LIM");
|
TTable lim("LIM");
|
||||||
lim.setkey(1);
|
lim.setkey(1);
|
||||||
lim.put("CODTAB", key);
|
lim.put("CODTAB", key);
|
||||||
@ -285,7 +284,8 @@ int TMovimentoPN::registra(bool re, bool force)
|
|||||||
for (int a = 1; a <= att; a++)
|
for (int a = 1; a <= att; a++)
|
||||||
{
|
{
|
||||||
TString16 chiave;
|
TString16 chiave;
|
||||||
chiave << annoiva << registro.attivita() << a << date2liq(datareg);
|
chiave << annoiva << registro.attivita() << a
|
||||||
|
<< format("%02d", date2liq(datareg));
|
||||||
plm.put("CODTAB", chiave);
|
plm.put("CODTAB", chiave);
|
||||||
if (plm.read() == NOERR)
|
if (plm.read() == NOERR)
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <printapp.h>
|
#include <printapp.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <relation.h>
|
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
@ -74,9 +73,10 @@ bool CG3500_application::riepilogo()
|
|||||||
char tipo_conto = ' ';
|
char tipo_conto = ' ';
|
||||||
bool esiste_conto = FALSE, esiste_sc = FALSE;
|
bool esiste_conto = FALSE, esiste_sc = FALSE;
|
||||||
real saldo_conto,prg_conto_dare,prg_conto_avere,saldo_gruppo,prg_gruppo_dare,prg_gruppo_avere,prg_dare,prg_avere,saldo;
|
real saldo_conto,prg_conto_dare,prg_conto_avere,saldo_gruppo,prg_gruppo_dare,prg_gruppo_avere,prg_dare,prg_avere,saldo;
|
||||||
|
|
||||||
_tmp_saldi->open("cg01");
|
|
||||||
|
|
||||||
|
CHECK(_tmp_saldi == NULL, "La minchia che riapro cg01!");
|
||||||
|
_tmp_saldi = new TIsamtempfile(LF_SALDI, "cg01", 2);
|
||||||
|
|
||||||
gp=-1;
|
gp=-1;
|
||||||
cp=-1;
|
cp=-1;
|
||||||
_udata_max = 0l;
|
_udata_max = 0l;
|
||||||
@ -637,8 +637,9 @@ bool CG3500_application::preprocess_page(int file, int counter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CG3500_application::postclose_print()
|
void CG3500_application::postclose_print()
|
||||||
{
|
{
|
||||||
_tmp_saldi->close();
|
if (_tmp_saldi)
|
||||||
|
{ delete _tmp_saldi; _tmp_saldi = NULL; }
|
||||||
|
|
||||||
//return NEXT_PAGE;
|
//return NEXT_PAGE;
|
||||||
}
|
}
|
||||||
@ -761,7 +762,7 @@ bool CG3500_application::user_create()
|
|||||||
_saldi = new TLocalisamfile(LF_SALDI);
|
_saldi = new TLocalisamfile(LF_SALDI);
|
||||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||||
_anag = new TLocalisamfile(LF_ANAG);
|
_anag = new TLocalisamfile(LF_ANAG);
|
||||||
_tmp_saldi = new TIsamtempfile (LF_SALDI);
|
_tmp_saldi = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user