Modifiche a causali bilanci libro giornale
git-svn-id: svn://10.65.10.50/trunk@314 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b677c3edf9
commit
1aa60d0476
354
cg/cg0500.cpp
354
cg/cg0500.cpp
@ -153,11 +153,12 @@ void TRighe_rcaus::set_descr(int i, const char * dfi, char tipocf)
|
||||
|
||||
if (r == NULL)
|
||||
{
|
||||
r = new Riga_rcaus (tc,dfi,tipocf);
|
||||
// r = new Riga_rcaus (tc,dfi,tipocf);
|
||||
r = new Riga_rcaus (tc,dfi);
|
||||
add(r,i);
|
||||
}
|
||||
r->add(dfi, 0);
|
||||
r->add(tipocf, 1);
|
||||
// r->add(tipocf, 1);
|
||||
}
|
||||
|
||||
bool filtra_reg(const TRelation * r);
|
||||
@ -249,7 +250,7 @@ bool CG0500_application::leggi_riga(int r, KEY k)
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
TToken_string &riga = app()->ss().row(r);
|
||||
const int g = riga.get_int(3);
|
||||
const int g = riga.get_int(2);
|
||||
if (g == 0) // riga azzerata
|
||||
{
|
||||
riga.add("", 1); // pulisco tipo C/F
|
||||
@ -263,27 +264,34 @@ bool CG0500_application::leggi_riga(int r, KEY k)
|
||||
|
||||
bool filtra_reg(const TRelation * r)
|
||||
{
|
||||
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 TString codtab(r->lfile().get("CODTAB"));
|
||||
int tiporeg = r->lfile().get_int("I0");
|
||||
bool corrisp = r->lfile().get_bool("B0");
|
||||
|
||||
switch (app()->_filtro)
|
||||
{
|
||||
case 1:
|
||||
return (tiporeg == 1);
|
||||
case 2:
|
||||
return (tiporeg == 1 && corrisp);
|
||||
case 3:
|
||||
return (tiporeg == 2);
|
||||
case 4: // tiporeg 1 senza corrisp OPPURE 2 (NC ST ND AF)
|
||||
return ( (tiporeg == 1 && !corrisp) || tiporeg == 2 );
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
const int anno = atoi(codtab.left(4));
|
||||
|
||||
switch (app()->_filtro)
|
||||
{
|
||||
case 1:
|
||||
if (anno == anno_iva() && tiporeg == 1)
|
||||
return TRUE;
|
||||
break;
|
||||
case 2:
|
||||
if (anno == anno_iva() && tiporeg == 1 && corrisp)
|
||||
return TRUE;
|
||||
break;
|
||||
case 3:
|
||||
if (anno == anno_iva() && tiporeg == 2)
|
||||
return TRUE;
|
||||
break;
|
||||
case 4: // tiporeg 1 senza corrisp OPPURE 2 (NC ST ND AF)
|
||||
if (anno == anno_iva())
|
||||
if ( (tiporeg == 1 && !corrisp) || tiporeg == 2 )
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -358,31 +366,6 @@ bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
}
|
||||
}
|
||||
/**************************************************************
|
||||
// Cambio il filtro sui registri: con tipo=1
|
||||
if (val == "FV" || val == "FF" || val == "FS") {
|
||||
app()->_filtro = 1;
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
} else
|
||||
// con tipo=1 e corrisp="X"
|
||||
if (val == "CN" || val == "RN" || val == "CR" ||
|
||||
val == "SC" || val == "RF" || val == "SN") {
|
||||
app()->_filtro = 2;
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
} else
|
||||
// Possono essere 1 o 2
|
||||
if (val == "NC" || val == "ST" || val == "ND" ||
|
||||
val == "AF") {
|
||||
app()->_filtro = 4;
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
} else
|
||||
// con tipo=2
|
||||
if (val == "FA" || val == "BD") {
|
||||
app()->_filtro = 3;
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
}
|
||||
**************************************************************/
|
||||
|
||||
}
|
||||
else // TIPODOC vuoto || IN || PG || AN
|
||||
{
|
||||
@ -398,25 +381,25 @@ bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
// Ma davvero esiste il registro ?
|
||||
const TString16 codreg=f.mask().get(F_COD_REG);
|
||||
TString16 codreg=f.mask().get(F_COD_REG);
|
||||
if (codreg.not_empty())
|
||||
{
|
||||
const TRegistro registro(codreg, anno_iva());
|
||||
if (!registro.ok())
|
||||
return f.error_box("Non esiste il registro %s per l'anno %d",
|
||||
(const char*)codreg, anno_iva());
|
||||
TRegistro registro(codreg, anno_iva());
|
||||
if (!registro.read(codreg, anno_iva()))
|
||||
return f.warning_box("Non esiste il registro %s per l'anno %d",
|
||||
(const char *)codreg, anno_iva());
|
||||
}
|
||||
|
||||
app()->MostraCampi(f);
|
||||
app()->fill_sheet(f.mask());
|
||||
if (f.focusdirty())
|
||||
app()->fill_sheet(f.mask());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
if (k == K_SPACE) {
|
||||
app()->MostraCampi(f);
|
||||
if (f.focusdirty()) app()->fill_sheet(f.mask());
|
||||
}
|
||||
@ -427,15 +410,14 @@ bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k)
|
||||
// essere puramente contabile (= codreg vuoto e tpm = Nessuno
|
||||
bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
const TString16 causim(f.get());
|
||||
if (f.to_check(k)) {
|
||||
TString16 causim(f.get());
|
||||
TLocalisamfile& caus = app()->_rel->lfile(LF_CAUSALI);
|
||||
caus.zero();
|
||||
caus.put(CAU_CODCAUS, causim);
|
||||
if (caus.read() == NOERR)
|
||||
{
|
||||
const int tpm = caus.get_int(CAU_TIPOMOV);
|
||||
const int tpm = caus.get_int(CAU_TIPOMOV);
|
||||
TString16 codreg = caus.get(CAU_REG);
|
||||
if (codreg.not_empty() || tpm != 0)
|
||||
return f.warning_box("La causale per l'incasso immediato specificata (%s) deve essere puramente contabile",
|
||||
@ -449,8 +431,8 @@ bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
|
||||
bool CG0500_application::MostraCampi(TMask_field& f)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const int tpm = m.get_int(F_TIPO_MOV);
|
||||
const TString16 codreg = m.get(F_COD_REG);
|
||||
const int tpm = m.get_int(F_TIPO_MOV);
|
||||
TString16 codreg = m.get(F_COD_REG);
|
||||
if (codreg.empty())
|
||||
{
|
||||
m.hide(F_AUTO_FAT);
|
||||
@ -458,15 +440,14 @@ bool CG0500_application::MostraCampi(TMask_field& f)
|
||||
m.hide(F_FAT_RITARDO);
|
||||
m.hide(F_OP_INTRACOM);
|
||||
m.hide(F_VALINTRA);
|
||||
if (salda_conto())
|
||||
m.hide(F_COD_CAUS_IM);
|
||||
switch (tpm)
|
||||
{
|
||||
if (salda_conto()) m.hide(F_COD_CAUS_IM);
|
||||
|
||||
switch (tpm) {
|
||||
case 0:
|
||||
m.show(F_OP_FINE_ANNO);
|
||||
m.show(F_COLL_CESP);
|
||||
m.show(F_M_770);
|
||||
m.hide(F_MOV_VALU);
|
||||
if (salda_conto()) m.hide(F_MOV_VALU);
|
||||
m.hide(F_MOV_SEZ);
|
||||
break;
|
||||
case 3:
|
||||
@ -482,8 +463,7 @@ bool CG0500_application::MostraCampi(TMask_field& f)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // codreg non vuoto
|
||||
else { // codreg non vuoto
|
||||
m.hide(F_OP_FINE_ANNO);
|
||||
m.hide(F_MOV_SEZ);
|
||||
if (gestione_valuta()) m.show(F_MOV_VALU);
|
||||
@ -500,11 +480,9 @@ bool CG0500_application::MostraCampi(TMask_field& f)
|
||||
|
||||
bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB)
|
||||
{
|
||||
if (k == K_TAB) {
|
||||
app()->MostraCampi(f);
|
||||
if (f.focusdirty())
|
||||
app()->fill_sheet(f.mask());
|
||||
if (f.focusdirty()) app()->fill_sheet(f.mask());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -526,53 +504,13 @@ bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
||||
i = (TipoIVA)tabtpd.get_int("I0"); // IVA acquisti, vendite, generica
|
||||
const TipoIVA ri = grog.iva();
|
||||
if (i == iva_generica) i = ri;
|
||||
if (i != ri)
|
||||
{
|
||||
if (i != ri) {
|
||||
return f.warning_box("Tipo documento incompatibile con tipo registro");
|
||||
i = iva_errata;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (tpd.not_empty() && tpd != "AN" && tpd != "PG" && tpd != "IN")
|
||||
{
|
||||
if (codreg.empty())
|
||||
return f.warning_box("Manca il codice del registro");
|
||||
}
|
||||
else
|
||||
{
|
||||
// con tipo=1
|
||||
if (tpd == "FV" || tpd == "FS" || tpd == "FS")
|
||||
{
|
||||
if (tipo != 1) ok = FALSE;
|
||||
} else
|
||||
|
||||
// con tipo=1 e corrisp="X"
|
||||
if (tpd == "CN" || tpd == "RN" || tpd == "CR" ||
|
||||
tpd == "SC" || tpd == "RF" || tpd == "SN")
|
||||
{
|
||||
if (tipo != 1 || !corrisp) ok = FALSE;
|
||||
} else
|
||||
// Possono essere 1 o 2
|
||||
if (tpd == "NC" || tpd == "ST" || tpd == "ND" ||
|
||||
tpd == "AF")
|
||||
{
|
||||
if (tipo != 1 && tipo != 2) ok = FALSE;
|
||||
} else
|
||||
|
||||
// con tipo=2
|
||||
if (tpd == "FA" || tpd == "BD")
|
||||
{
|
||||
if (tipo != 2) ok = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
return f.warning_box("Il registro (tipo %d) non e' compatibile con il tipo di documento (%s)",
|
||||
tipo, (const char*)tpd);
|
||||
}
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -580,9 +518,9 @@ bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Handler della maschera dello spreadsheet
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Se specifico il conto deve essere non vuoto il gruppo
|
||||
bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
// Se specifico il conto deve essere non vuoto il gruppo
|
||||
if (f.to_check(k))
|
||||
{
|
||||
int io = f.dlg();
|
||||
@ -593,7 +531,7 @@ bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
||||
if (g == 0)
|
||||
return f.warning_box("Non accetto un conto senza gruppo");
|
||||
}
|
||||
// Controllo: << solo la riga 1 o 7 possono essere C/F >>
|
||||
// Controllo: << se e' fattura solo la riga 1 o 7 possono essere C/F >>
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
char scarta = '\0';
|
||||
@ -601,52 +539,50 @@ bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
||||
char cf = f.mask().get(SS_TIPOCF)[0];
|
||||
TMask_field& cfld = f.mask().field(SS_TIPOCF);
|
||||
const int tpr = app()->main_mask()->get_int(F_TIPO_REG);
|
||||
|
||||
bool puramente_contabile = FALSE;
|
||||
|
||||
switch (tpr)
|
||||
{
|
||||
case 1:
|
||||
scarta = 'F';
|
||||
break;
|
||||
case 2:
|
||||
scarta = 'C';
|
||||
break;
|
||||
case 0:
|
||||
scarta = 'Z'; // Accetto tutto
|
||||
switch (app()->_tipo_des)
|
||||
{
|
||||
case incasso_pagamento:
|
||||
ultima = 11;
|
||||
break;
|
||||
case incasso_pagamento_gesval:
|
||||
ultima = 12;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (app()->_riga > ultima) // se sono nelle righe libere accetto tutto
|
||||
return TRUE;
|
||||
else
|
||||
if (app()->_riga == 0 || app()->_riga == 6)
|
||||
{
|
||||
if (cf == scarta)
|
||||
return cfld.warning_box(
|
||||
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
||||
cf == 'C' ? "cliente" : "fornitore",
|
||||
tpr == 1 ? "vendite" : "acquisti", app()->_riga+1);
|
||||
}
|
||||
case 1: scarta = 'F'; break;
|
||||
case 2: scarta = 'C'; break;
|
||||
case 0:
|
||||
scarta = 'Z'; // Accetto tutto
|
||||
puramente_contabile = TRUE;
|
||||
switch (app()->_tipo_des)
|
||||
{
|
||||
case incasso_pagamento: ultima = 11; break;
|
||||
case incasso_pagamento_gesval: ultima = 12; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!puramente_contabile)
|
||||
{
|
||||
if (app()->_riga > ultima) // se sono nelle righe libere accetto TUTTO..
|
||||
return TRUE;
|
||||
else
|
||||
if (cf != '\0')
|
||||
return cfld.warning_box(
|
||||
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
||||
cf == 'C' ? "cliente" : "fornitore",
|
||||
tpr == 1 ? "vendite" : "acquisti", app()->_riga+1);
|
||||
if (app()->_riga == 0 || app()->_riga == 6)
|
||||
{
|
||||
if (cf == scarta)
|
||||
return cfld.warning_box(
|
||||
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
||||
cf == 'C' ? "cliente" : "fornitore",
|
||||
tpr == 1 ? "vendite" : "acquisti", app()->_riga+1);
|
||||
}
|
||||
else
|
||||
if (cf == 'C' || cf == 'F')
|
||||
return cfld.warning_box(
|
||||
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
||||
cf == 'C' ? "cliente" : "fornitore",
|
||||
tpr == 1 ? "vendite" : "acquisti", app()->_riga+1);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Se specifico il sottoconto devono essere non vuoti gruppo e conto
|
||||
bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
||||
// 1. Se specifico il sottoconto devono essere non vuoti gruppo e conto
|
||||
// 2. g-c-s devono esistere
|
||||
bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
@ -658,6 +594,10 @@ bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
||||
if (s > 0)
|
||||
if (g == 0 || c == 0)
|
||||
return f.warning_box("Non accetto un sottoconto con gruppo o conto vuoti");
|
||||
|
||||
TConto tc(g,c,s);
|
||||
if (!tc.read())
|
||||
return f.warning_box("Conto inesistente");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -706,15 +646,15 @@ void TRighe_rcaus::CausaleAcquisti()
|
||||
int i=0;
|
||||
app()->_tipo_des = acquisto;
|
||||
// set_descr( i++, "C Fornitori", 'F');
|
||||
set_descr( i++, "C Fornitori", ' ');
|
||||
set_descr(i++, "C Di costo", ' ');
|
||||
set_descr(i++, "C Iva acquisti", ' ');
|
||||
set_descr(i++, "C Iva non detraibile", ' ');
|
||||
set_descr(i++, "C Imp. esenti", ' ');
|
||||
set_descr(i++, "C Imp. non imponibili", ' ');
|
||||
set_descr(i++, "C Imp. non soggetti", ' ');
|
||||
set_descr(i++, "C Ritenute fiscali", ' ');
|
||||
set_descr(i++, "C Ritenute soc.", ' ');
|
||||
set_descr( i++, "C Fornitori");
|
||||
set_descr(i++, "C Di costo");
|
||||
set_descr(i++, "C Iva acquisti");
|
||||
set_descr(i++, "C Iva non detraibile");
|
||||
set_descr(i++, "C Imp. esenti");
|
||||
set_descr(i++, "C Imp. non imponibili");
|
||||
set_descr(i++, "C Imp. non soggetti");
|
||||
set_descr(i++, "C Ritenute fiscali");
|
||||
set_descr(i++, "C Ritenute soc.");
|
||||
CaricaRigheLibere();
|
||||
}
|
||||
|
||||
@ -764,8 +704,7 @@ void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int
|
||||
{
|
||||
if (salda_conto())
|
||||
{
|
||||
switch (tpm)
|
||||
{
|
||||
switch (tpm) {
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
@ -774,8 +713,7 @@ void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int
|
||||
case 0:
|
||||
if (m770 == 6)
|
||||
_righe_rcaus.CausaleRitenutaOccas();
|
||||
else
|
||||
{
|
||||
else {
|
||||
_forcedCopy = TRUE;
|
||||
_righe_rcaus.ClearDescr();
|
||||
_righe_rcaus.CaricaRigheLibere();
|
||||
@ -788,8 +726,7 @@ void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // NO saldaconto
|
||||
else { // NO saldaconto
|
||||
_forcedCopy = TRUE;
|
||||
_righe_rcaus.ClearDescr();
|
||||
_righe_rcaus.CaricaRigheLibere();
|
||||
@ -833,9 +770,13 @@ void CG0500_application::add_riga(int numrig,
|
||||
{
|
||||
TSheet_field& cs = ss();
|
||||
TToken_string & riga = cs.row(numrig);
|
||||
riga.add(cf, 1); riga.add(tc.gruppo(), 2);
|
||||
riga.add(tc.conto(), 3); riga.add(tc.sottoconto(),4);
|
||||
riga.add(sz, 5); riga.add(d, 6); riga.add(da,7);
|
||||
riga.add(cf, 1);
|
||||
riga.add(tc.gruppo(), 2);
|
||||
riga.add(tc.conto(), 3);
|
||||
riga.add(tc.sottoconto(),4);
|
||||
riga.add(sz, 5);
|
||||
riga.add(d, 6);
|
||||
riga.add(da,7);
|
||||
riga.add(riva ? "X" : "", 8);
|
||||
riga.add(civa, 9);
|
||||
}
|
||||
@ -850,12 +791,16 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
|
||||
_rel->update(); // chiamo position_rels()
|
||||
|
||||
const TString cod(_rel->lfile().get(RCA_CODCAUS));
|
||||
|
||||
_righe_gia_presenti.reset();
|
||||
// _righe_rcaus.destroy();
|
||||
|
||||
rcaus.zero();
|
||||
rcaus.put(RCA_CODCAUS, cod);
|
||||
int e = rcaus.read(_isgteq);
|
||||
|
||||
bool ok = _rel->is_first_match(LF_RCAUSALI);
|
||||
while (ok)
|
||||
while (e == NOERR && rcaus.get(RCA_CODCAUS) == cod)
|
||||
{
|
||||
numrig = rcaus.get_int(RCA_NRIGA);
|
||||
CHECK(numrig > 0, "Causale con numero riga nullo");
|
||||
@ -865,7 +810,6 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
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);
|
||||
@ -873,8 +817,8 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
|
||||
add_riga(numrig-1, cf, sz, d, da, riva, civa, tc);
|
||||
|
||||
_righe_gia_presenti.set(numrig);
|
||||
ok = _rel->next_match(LF_RCAUSALI);
|
||||
_righe_gia_presenti.set(numrig);
|
||||
e = rcaus.next();
|
||||
}
|
||||
}
|
||||
|
||||
@ -915,22 +859,18 @@ bool CG0500_application::descr2array(TMask& m, bool fromHandler)
|
||||
int tpm, m770, tpr;
|
||||
|
||||
// if (m.mode() == MODE_MOD && !fromHandler)
|
||||
if (fromHandler)
|
||||
{
|
||||
if (fromHandler) {
|
||||
codreg = m.field(F_COD_REG).get();
|
||||
tpd = m.field(F_TIPO_DOC).get();
|
||||
tpm = m.get_int(F_TIPO_MOV);
|
||||
m770 = m.get_int(F_M_770);
|
||||
}
|
||||
else if (m.mode() == MODE_MOD)
|
||||
{
|
||||
} else if (m.mode() == MODE_MOD) {
|
||||
codreg = caus.get("REG");
|
||||
tpd = caus.get("TIPODOC");
|
||||
tpm = caus.get_int("TIPOMOV");
|
||||
m770 = caus.get_int("M770");
|
||||
}
|
||||
else
|
||||
{ // sono in inserimento e prima di entrare negli handler
|
||||
else { // sono in inserimento e prima di entrare negli handler
|
||||
codreg = m.field(F_COD_REG).get();
|
||||
tpd = m.field(F_TIPO_DOC).get();
|
||||
tpm = m.get_int(F_TIPO_MOV);
|
||||
@ -939,13 +879,12 @@ bool CG0500_application::descr2array(TMask& m, bool fromHandler)
|
||||
|
||||
if (fromHandler)
|
||||
tpr = m.get_int(F_TIPO_REG);
|
||||
else
|
||||
{
|
||||
else {
|
||||
TString16 chiave; chiave << anno_iva() << codreg;
|
||||
TTable reg("REG");
|
||||
reg.put("CODTAB", chiave);
|
||||
reg.read();
|
||||
tpr = reg.get_int("I0");
|
||||
tpr = reg.get_int("I0");
|
||||
}
|
||||
|
||||
// carico le descrizioni fisse nell'array Righe_rcaus
|
||||
@ -957,7 +896,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();
|
||||
|
||||
@ -988,10 +927,10 @@ int CG0500_application::rewrite(const TMask& m)
|
||||
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);
|
||||
TString80 desc;
|
||||
TString16 coddesc;
|
||||
TLocalisamfile& caus = _rel->lfile(LF_CAUSALI);
|
||||
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
|
||||
m.autosave(_rel);
|
||||
|
||||
@ -1004,14 +943,13 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
||||
TToken_string &riga = cs.row(i);
|
||||
if (riga.empty_items()) continue;
|
||||
|
||||
desc = riga.get(0);
|
||||
const char tipo_cf = riga.get_char();
|
||||
const int g = riga.get_int();
|
||||
const int c = riga.get_int();
|
||||
long s = riga.get_long();
|
||||
char sezione = riga.get_char();
|
||||
desc = riga.get();
|
||||
coddesc = riga.get();
|
||||
const char tipo_cf = riga.get_char(1);
|
||||
const int g = riga.get_int(2);
|
||||
const int c = riga.get_int(3);
|
||||
long s = riga.get_long(4);
|
||||
char sezione = riga.get_char(5);
|
||||
desc = riga.get(6);
|
||||
coddesc = riga.get(7);
|
||||
|
||||
if (g > 0 || c > 0 || s > 0L)
|
||||
{
|
||||
@ -1035,7 +973,7 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
||||
}
|
||||
else
|
||||
rcaus.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rewrite)
|
||||
@ -1050,10 +988,12 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
||||
|
||||
bool CG0500_application::remove()
|
||||
{
|
||||
_rel->restore_status(); // senno' non riesco a leggere il cod. caus.
|
||||
_rel->update(); // chiamo position_rels()
|
||||
const TString cod(_rel->lfile().get(RCA_CODCAUS));
|
||||
const bool ok = TRelation_application::remove();
|
||||
if (ok)
|
||||
{
|
||||
const TString cod(_rel->lfile().get(RCA_CODCAUS));
|
||||
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
rcaus.zero();
|
||||
rcaus.put(RCA_CODCAUS, cod);
|
||||
@ -1101,15 +1041,13 @@ bool CG0500_application::user_create()
|
||||
|
||||
_msk = new TMask("cg0500a");
|
||||
|
||||
if (!salda_conto())
|
||||
{
|
||||
if (!salda_conto()) {
|
||||
_msk->hide (F_MOV_SEZ);
|
||||
_msk->hide (F_TIPO_MOV_1);
|
||||
_msk->hide (F_TIPO_MOV_2);
|
||||
_msk->show (F_COD_CAUS_IM);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
_msk->show (F_MOV_SEZ);
|
||||
_msk->hide (F_COD_CAUS_IM);
|
||||
}
|
||||
|
@ -81,9 +81,10 @@ BEGIN
|
||||
OUTPUT F_COD_REG CODTAB[5,7]
|
||||
OUTPUT F_TIPO_REG I0
|
||||
OUTPUT F_CORRISP B0
|
||||
HELP "Codice registro"
|
||||
HELP "Inserire il codice registro"
|
||||
WARNING "Non trovo il registro"
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "DU"
|
||||
FLAGS "DUZ"
|
||||
END
|
||||
|
||||
// Questo rimane sempre nascosto
|
||||
|
@ -11,15 +11,9 @@ END
|
||||
LISTBOX 102 1 11
|
||||
BEGIN
|
||||
PROMPT 33 1 "C/F "
|
||||
ITEM " |Conto"
|
||||
MESSAGE SHOW,105|HIDE,205|HIDE,305
|
||||
MESSAGE SHOW,107|HIDE,207|HIDE,307
|
||||
ITEM "C|Cliente"
|
||||
MESSAGE SHOW,205|HIDE,105|HIDE,305
|
||||
MESSAGE SHOW,207|HIDE,107|HIDE,307
|
||||
ITEM "F|Fornitore"
|
||||
MESSAGE SHOW,305|HIDE,105|HIDE,205
|
||||
MESSAGE SHOW,307|HIDE,107|HIDE,207
|
||||
ITEM " |Conto" MESSAGE SHOW,105|HIDE,205|HIDE,305|SHOW,107|HIDE,207|HIDE,307
|
||||
ITEM "C|Cliente" MESSAGE SHOW,205|HIDE,105|HIDE,305|SHOW,207|HIDE,107|HIDE,307
|
||||
ITEM "F|Fornitore" MESSAGE SHOW,305|HIDE,105|HIDE,205|SHOW,307|HIDE,107|HIDE,207
|
||||
FLAGS "DG"
|
||||
GROUP 1
|
||||
// FLAGS "U"
|
||||
@ -60,7 +54,10 @@ BEGIN
|
||||
OUTPUT 102 TMCF
|
||||
OUTPUT 104 CONTO
|
||||
OUTPUT 103 GRUPPO
|
||||
OUTPUT 107 DESCR
|
||||
OUTPUT 107 DESCR
|
||||
OUTPUT 207 DESCR
|
||||
OUTPUT 307 DESCR
|
||||
MESSAGE DIRTY,105|DIRTY,205|DIRTY,305
|
||||
WARNING "Conto inesistente o mancante"
|
||||
ADD RUN CG0 -0
|
||||
GROUP 1
|
||||
@ -85,6 +82,8 @@ BEGIN
|
||||
OUTPUT 107 DESCR
|
||||
ADD RUN CG0 -0
|
||||
CHECKTYPE NORMAL
|
||||
HELP "Inserire il sottoconto"
|
||||
WARNING "Sottoconto inesistente"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
@ -103,8 +102,19 @@ BEGIN
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
DISPLAY "Tipo C/F" TIPOCF
|
||||
OUTPUT 205 CODCF
|
||||
<<<<<<< cg0500b.uml
|
||||
OUTPUT 105 CODCF
|
||||
OUTPUT 207 RAGSOC
|
||||
OUTPUT 107 RAGSOC
|
||||
OUTPUT 307 RAGSOC
|
||||
=======
|
||||
OUTPUT 207 RAGSOC
|
||||
>>>>>>> 1.11
|
||||
CHECKTYPE NORMAL
|
||||
<<<<<<< cg0500b.uml
|
||||
FLAGS "H"
|
||||
=======
|
||||
>>>>>>> 1.11
|
||||
ADD RUN CG0 -1
|
||||
GROUP 1
|
||||
END
|
||||
@ -123,8 +133,20 @@ BEGIN
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
DISPLAY "Tipo C/F" TIPOCF
|
||||
OUTPUT 305 CODCF
|
||||
<<<<<<< cg0500b.uml
|
||||
OUTPUT 205 CODCF
|
||||
OUTPUT 105 CODCF
|
||||
OUTPUT 107 RAGSOC
|
||||
OUTPUT 207 RAGSOC
|
||||
OUTPUT 307 RAGSOC
|
||||
=======
|
||||
OUTPUT 307 RAGSOC
|
||||
>>>>>>> 1.11
|
||||
CHECKTYPE NORMAL
|
||||
<<<<<<< cg0500b.uml
|
||||
FLAGS "H"
|
||||
=======
|
||||
>>>>>>> 1.11
|
||||
ADD RUN CG0 -1
|
||||
GROUP 1
|
||||
END
|
||||
@ -154,6 +176,11 @@ BEGIN
|
||||
OUTPUT 104 CONTO
|
||||
OUTPUT 103 GRUPPO
|
||||
OUTPUT 107 DESCR
|
||||
<<<<<<< cg0500b.uml
|
||||
OUTPUT 207 DESCR
|
||||
OUTPUT 307 DESCR
|
||||
=======
|
||||
>>>>>>> 1.11
|
||||
ADD RUN CG0 -0
|
||||
GROUP 1
|
||||
END
|
||||
@ -171,8 +198,15 @@ BEGIN
|
||||
DISPLAY "Gruppo" GRUPPO
|
||||
DISPLAY "Conto" CONTO
|
||||
DISPLAY "Sottoconto" CODCF
|
||||
OUTPUT 105 CODCF
|
||||
OUTPUT 205 CODCF
|
||||
OUTPUT 305 CODCF
|
||||
OUTPUT 107 RAGSOC
|
||||
OUTPUT 207 RAGSOC
|
||||
<<<<<<< cg0500b.uml
|
||||
OUTPUT 307 RAGSOC
|
||||
=======
|
||||
>>>>>>> 1.11
|
||||
GROUP 1
|
||||
FLAGS "H"
|
||||
END
|
||||
@ -191,7 +225,14 @@ BEGIN
|
||||
DISPLAY "Conto" CONTO
|
||||
DISPLAY "Sottoconto" CODCF
|
||||
OUTPUT 305 CODCF
|
||||
OUTPUT 205 CODCF
|
||||
OUTPUT 105 CODCF
|
||||
OUTPUT 307 RAGSOC
|
||||
<<<<<<< cg0500b.uml
|
||||
OUTPUT 207 RAGSOC
|
||||
OUTPUT 107 RAGSOC
|
||||
=======
|
||||
>>>>>>> 1.11
|
||||
GROUP 1
|
||||
FLAGS "H"
|
||||
END
|
||||
@ -232,18 +273,18 @@ END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
PROMPT -13 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 ""
|
||||
PROMPT -23 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_NULL 9 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 "Azzera"
|
||||
MESSAGE RESET,1@
|
||||
PROMPT -33 -1 "Azzera"
|
||||
MESSAGE RESET,1@
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
1703
cg/cg1500.cpp
1703
cg/cg1500.cpp
File diff suppressed because it is too large
Load Diff
@ -203,7 +203,7 @@ BEGIN
|
||||
END
|
||||
*/
|
||||
|
||||
LIST F_ORDINAMENTO 12
|
||||
LIST F_ORDINAMENTO 11
|
||||
BEGIN
|
||||
PROMPT 2 11 "Tipo ordinamento "
|
||||
ITEM "1|Per codice"
|
||||
|
2385
cg/cg1600.cpp
2385
cg/cg1600.cpp
File diff suppressed because it is too large
Load Diff
516
cg/cg3400.cpp
516
cg/cg3400.cpp
@ -28,10 +28,10 @@
|
||||
#include "cg3400a.h"
|
||||
#include "cg3400b.h"
|
||||
|
||||
#define REAL_PICTURE "###.###.###.###"
|
||||
|
||||
HIDDEN const int RIGHE_MODULO = 66;
|
||||
HIDDEN const int RIGHE_FOOTER = 10;
|
||||
HIDDEN const char* REAL_PICTURE = "###.###.###.###";
|
||||
HIDDEN const char* REAL_TOT_PIC = "##.###.###.###.###.###";
|
||||
HIDDEN const int RIGHE_MODULO = 66;
|
||||
HIDDEN const int RIGHE_FOOTER = 10;
|
||||
|
||||
HIDDEN TString256 tmp;
|
||||
|
||||
@ -42,7 +42,8 @@ HIDDEN enum descr { causale, conto, operazione };
|
||||
class CG3400_application : public TPrintapp
|
||||
{
|
||||
static bool mask_a_cod_reg (TMask_field& f, KEY k);
|
||||
static bool mask_a_data (TMask_field& f, KEY k);
|
||||
static bool data_a_hndl (TMask_field& f, KEY k);
|
||||
static bool data_da_hndl (TMask_field& f, KEY k);
|
||||
static bool mask_b_ripristina(TMask_field& f, KEY k);
|
||||
|
||||
public:
|
||||
@ -55,9 +56,11 @@ public:
|
||||
TString80 _reg_descr;
|
||||
TDate _data_da, _data_a, _last_data;
|
||||
real _tot_dare, _tot_avere; // valori di partenza
|
||||
real _tot_dare_progr, _tot_avere_progr; // progressivi
|
||||
real _tot_dare_progr, _tot_avere_progr; // progressivi anno in corso
|
||||
real _tot_dare_progr_ap, _tot_avere_progr_ap; // progr. anno prec.
|
||||
real _tot_dare_gg , _tot_avere_gg ; // giornalieri
|
||||
real _tot_dare_ac , _tot_avere_ac ; // anno precedente
|
||||
real _tot_dare_ap , _tot_avere_ap ; // giornalieri anno precedente
|
||||
real _tot_dare_generale, _tot_avere_generale; // tot. generali
|
||||
long _nprog_da, _nprog_mov;
|
||||
int _num_rig, _stampa_width, _stampa_len;
|
||||
|
||||
@ -106,9 +109,11 @@ public:
|
||||
void setta_righe_valuta();
|
||||
void setta_righe_descr(TParagraph_string*, enum descr);
|
||||
void calcola_iva();
|
||||
void init_print();
|
||||
virtual bool cancel_hook();
|
||||
virtual bool set_print(int);
|
||||
|
||||
void init_totals();
|
||||
int stampa_intestazione_ditta();
|
||||
int set_header_132();
|
||||
int set_header_198();
|
||||
@ -123,7 +128,7 @@ public:
|
||||
const char* get_descr_caus (const char * codcaus);
|
||||
TRectype& look_com (const char * cod);
|
||||
|
||||
CG3400_application() : _tot_dare_progr(ZERO),_tot_avere_progr (ZERO) {};
|
||||
CG3400_application() {};
|
||||
virtual ~CG3400_application() {};
|
||||
};
|
||||
|
||||
@ -237,6 +242,7 @@ void CG3400_application::get_dati_ditta ()
|
||||
|
||||
void CG3400_application::user_create()
|
||||
{
|
||||
_ae = 0;
|
||||
_tabreg = new TTable ("REG");
|
||||
_tabval = new TTable ("%VAL");
|
||||
_tabes = new TTable ("ESC");
|
||||
@ -252,7 +258,7 @@ void CG3400_application::user_create()
|
||||
_descr_operazione = new TParagraph_string ("",28);
|
||||
_descr_causale = new TParagraph_string ("",20);
|
||||
|
||||
// disable_print_menu();
|
||||
// disable_print_menu();
|
||||
|
||||
_rel = new TRelation (LF_MOV);
|
||||
_rel->add (LF_RMOV, "NUMREG=NUMREG");
|
||||
@ -331,31 +337,34 @@ void CG3400_application::scrivi_numgio(long nprog)
|
||||
//
|
||||
void CG3400_application::set_totali_giorno(const TDate& data, const int righeiva)
|
||||
{
|
||||
int r = 1 + righeiva;
|
||||
TString dep(_stampa_width);
|
||||
|
||||
dep = "Operazioni del "; dep << data.string();
|
||||
int r = 1 + righeiva;
|
||||
TString dep(_stampa_width);
|
||||
TString16 frm;
|
||||
|
||||
if (_stampa_width == 132)
|
||||
set_row (r++, "@b@10g%s Dare: %r Avere: %r", (const char *)dep, &_tot_dare_gg, &_tot_avere_gg );
|
||||
else
|
||||
set_row (r++, "@b@10g%s Dare: %r Avere: %r", (const char *)dep, &_tot_dare_gg, &_tot_avere_gg );
|
||||
|
||||
if ( _tot_avere_ac != ZERO || _tot_dare_ac != ZERO )
|
||||
frm = "@b@10g";
|
||||
|
||||
if (_tot_avere_gg != ZERO || _tot_dare_gg != ZERO)
|
||||
{
|
||||
dep = "Operazioni del "; dep << data.string() << " " << "Anno precedente";
|
||||
dep = frm;
|
||||
dep << "Operazioni del "; dep << data.string();
|
||||
|
||||
if (_stampa_width == 132)
|
||||
set_row (r++, "@b@10g%s Dare: %r Avere: %r", (const char *)dep, &_tot_dare_ac, &_tot_avere_ac );
|
||||
else
|
||||
set_row (r++, "@b@10g%s Dare: %r Avere: %r", (const char *)dep, &_tot_dare_ac, &_tot_avere_ac );
|
||||
set_row (r++, "%s Dare: %r Avere: %r", (const char *)dep,
|
||||
&_tot_dare_gg, &_tot_avere_gg );
|
||||
_tot_dare_gg = _tot_avere_gg = ZERO;
|
||||
}
|
||||
|
||||
_tot_avere_ac = _tot_dare_ac = ZERO;
|
||||
if ( _tot_avere_ap != ZERO || _tot_dare_ap != ZERO )
|
||||
{
|
||||
dep = frm;
|
||||
dep << "Operazioni del "; dep << data.string() << " " << "Anno precedente";
|
||||
|
||||
set_row (r, "");
|
||||
set_row (r++, "%s Dare: %r Avere: %r", (const char *)dep, &_tot_dare_ap,
|
||||
&_tot_avere_ap );
|
||||
_tot_avere_ap = _tot_dare_ap = ZERO;
|
||||
}
|
||||
else
|
||||
set_row (r, ""); // Lascio una riga vuota dopo il totale
|
||||
|
||||
set_row (r, ""); // Lascio una riga vuota dopo il totale
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@ -371,23 +380,24 @@ void CG3400_application::set_page_132 (int file, int counter)
|
||||
case LF_MOV:
|
||||
if (_libro_giornale_iva_unico)
|
||||
{
|
||||
if (_stampa_definitiva)
|
||||
set_row(r,"Registrazione n. #-3ld del @d documento n. @3n del @d @s Anno di competenza %04d",
|
||||
&_nprog_mov,
|
||||
FLD(LF_MOV, MOV_DATAREG),
|
||||
FLD(LF_MOV, MOV_NUMDOC),
|
||||
FLD(LF_MOV, MOV_DATADOC),
|
||||
FLD(LF_MOV, MOV_DESCR),
|
||||
_ae);
|
||||
if (_stampa_definitiva)
|
||||
{
|
||||
set_row(r,"Operazione n. #-3ld", &_nprog_mov);
|
||||
set_row(r," del @d", FLD(LF_MOV, MOV_DATAREG) );
|
||||
set_row(r," documento n. @3pn", FLD(LF_MOV, MOV_NUMDOC, "###") );
|
||||
set_row(r," del @d @s", FLD(LF_MOV, MOV_DATADOC),
|
||||
FLD(LF_MOV, MOV_DESCR));
|
||||
set_row(r," Anno di competenza @4pn", FLD(LF_MOV, MOV_ANNOES, "@@@@") );
|
||||
}
|
||||
else
|
||||
set_row(r,"Registrazione n. @3,lpn del @d documento n. @7s del @d @s Anno di competenza %04d",
|
||||
FLD(LF_MOV, MOV_NUMREG, "#######"),
|
||||
FLD(LF_MOV, MOV_DATAREG),
|
||||
FLD(LF_MOV, MOV_NUMDOC),
|
||||
FLD(LF_MOV, MOV_DATADOC),
|
||||
FLD(LF_MOV, MOV_DESCR),
|
||||
_ae);
|
||||
|
||||
{
|
||||
set_row(r,"Operazione n. @3,lpn", FLD(LF_MOV, MOV_NUMREG, "###"));
|
||||
set_row(r," del @d", FLD(LF_MOV, MOV_DATAREG) );
|
||||
set_row(r," documento n. @3pn", FLD(LF_MOV, MOV_NUMDOC, "###") );
|
||||
set_row(r," del @d @s", FLD(LF_MOV, MOV_DATADOC),
|
||||
FLD(LF_MOV, MOV_DESCR));
|
||||
set_row(r," Anno di competenza @4pn", FLD(LF_MOV, MOV_ANNOES, "@@@@") );
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!_gia_settata_riga_mov)
|
||||
@ -404,12 +414,10 @@ void CG3400_application::set_page_132 (int file, int counter)
|
||||
if (!_stampa_definitiva)
|
||||
set_row (r, "%3d", _num_rig);
|
||||
|
||||
set_row (r, "@5g@3s@56g@pn@pn@pn",
|
||||
FLD(LF_MOV, MOV_CODCAUS),
|
||||
FLD(LF_RMOV, RMV_GRUPPO, "@@."),
|
||||
FLD(LF_RMOV, RMV_CONTO , "@@."),
|
||||
FLD(LF_RMOV, RMV_SOTTOCONTO, "@@@@@@")
|
||||
);
|
||||
// set_row (r, "@5g@3s", FLD(LF_MOV, MOV_CODCAUS));
|
||||
set_row (r, "@56g@pn", FLD(LF_RMOV, RMV_GRUPPO, "@@."));
|
||||
set_row (r, "@pn", FLD(LF_RMOV, RMV_CONTO , "@@."));
|
||||
set_row (r, "@pn", FLD(LF_RMOV, RMV_SOTTOCONTO, "@@@@@@"));
|
||||
}
|
||||
else // no libro_giornale_iva_unico
|
||||
{
|
||||
@ -425,8 +433,7 @@ void CG3400_application::set_page_132 (int file, int counter)
|
||||
);
|
||||
}
|
||||
break;
|
||||
case LF_RMOVIVA:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -516,24 +523,72 @@ void CG3400_application::postclose_print()
|
||||
|
||||
void CG3400_application::preprocess_footer()
|
||||
{
|
||||
TString16 dare = _tot_dare_progr.string("###.###.###.###");
|
||||
TString16 avere = _tot_avere_progr.string("###.###.###.###");
|
||||
int r=2;
|
||||
TString progr_dare_ap(22), progr_avere_ap(22);
|
||||
TString256 riga, frm;
|
||||
bool ap = FALSE;
|
||||
int r=2;
|
||||
|
||||
if (_tot_avere_progr_ap != ZERO || _tot_dare_progr_ap != ZERO)
|
||||
{
|
||||
progr_dare_ap = _tot_dare_progr_ap.string(REAL_TOT_PIC);
|
||||
progr_avere_ap = _tot_avere_progr_ap.string(REAL_TOT_PIC);
|
||||
ap = TRUE;
|
||||
}
|
||||
|
||||
if (_stampa_width == 132)
|
||||
set_footer (r, "@b@u@65gTotale progressivi generali@r @bDare: %s Avere: %s",
|
||||
(const char *) dare,
|
||||
(const char *) avere);
|
||||
frm = "@b@45g";
|
||||
else
|
||||
set_footer (r, "@b@100gTotale progressivi generali Totale dare %s Totale avere %s",
|
||||
(const char *) dare,
|
||||
(const char *) avere);
|
||||
frm = "@b@100g";
|
||||
|
||||
if (_cur->pos() >= _cur->items()-1) // se sono sull'ultimo
|
||||
{
|
||||
const TFixed_string progr_dare ( _tot_dare_progr.string(REAL_TOT_PIC));
|
||||
const TFixed_string progr_avere ( _tot_avere_progr.string(REAL_TOT_PIC));
|
||||
|
||||
riga = frm;
|
||||
riga << format("Totale progressivi Dare: %s Avere: %s",
|
||||
(const char *) progr_dare, (const char *) progr_avere);
|
||||
|
||||
set_footer (r++, (const char*) riga);
|
||||
|
||||
if (ap)
|
||||
{
|
||||
// riga = frm;
|
||||
riga.format("%sTotale progressivi anno precedente Dare: %s Avere: %s",
|
||||
(const char*) frm,
|
||||
(const char *) progr_dare_ap, (const char *) progr_avere_ap);
|
||||
set_footer (r++, (const char*) riga);
|
||||
}
|
||||
|
||||
_tot_dare_generale = _tot_dare_progr + _tot_dare_progr_ap;
|
||||
_tot_avere_generale = _tot_avere_progr + _tot_avere_progr_ap;
|
||||
const TFixed_string dts(_tot_dare_generale.string(REAL_TOT_PIC));
|
||||
const TFixed_string ats(_tot_avere_generale.string(REAL_TOT_PIC));
|
||||
|
||||
riga = frm;
|
||||
riga << format ("Totale progressivi generali Dare: %s Avere: %s", (const char *) dts, (const char *) ats);
|
||||
set_footer (r++, (const char*) riga);
|
||||
}
|
||||
else // Non ancora totale generale
|
||||
{
|
||||
real dt = _tot_dare_progr + _tot_dare_progr_ap;
|
||||
real at = _tot_avere_progr + _tot_avere_progr_ap;
|
||||
const TFixed_string dts(dt.string(REAL_TOT_PIC));
|
||||
const TFixed_string ats(at.string(REAL_TOT_PIC));
|
||||
|
||||
riga = frm;
|
||||
riga << format ("A riportare Dare: %s Avere: %s@r", (const char *) dts,
|
||||
(const char *) ats);
|
||||
set_footer (r++, (const char*) riga);
|
||||
}
|
||||
}
|
||||
|
||||
int CG3400_application::stampa_intestazione_ditta()
|
||||
{
|
||||
int r=1;
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
TString riga(_stampa_width);
|
||||
#endif
|
||||
|
||||
get_dati_ditta();
|
||||
|
||||
@ -557,6 +612,9 @@ int CG3400_application::stampa_intestazione_ditta()
|
||||
return r;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// HEADER 198
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CG3400_application::set_header_198()
|
||||
{
|
||||
int r=1;
|
||||
@ -566,9 +624,9 @@ int CG3400_application::set_header_198()
|
||||
|
||||
if (_stampa_intesta) r = stampa_intestazione_ditta();
|
||||
|
||||
set_header(r, "@iCodice libro: %s %s @40gdalla data: %s alla data: %s",
|
||||
set_header(r, "@bCodice libro:@r %s %s @bdalla data:@r %s @balla data:@r %s @bEsercizio:@r %04d",
|
||||
(const char *) _reg_cod, (const char *) _reg_descr,
|
||||
(const char *) data_da, (const char *) data_a);
|
||||
(const char *) data_da, (const char *) data_a, _ae);
|
||||
r++;
|
||||
|
||||
riga.fill('-');
|
||||
@ -629,13 +687,13 @@ int CG3400_application::set_header_132()
|
||||
set_header(r, riga);
|
||||
#endif
|
||||
|
||||
set_header(r++, "@bCodice libro:@r %s %s @50g@bdalla data:@r %s @balla data:@r %s",
|
||||
set_header(r++, "@bCodice libro:@r %s %s @50g@bdalla data:@r %s @balla data:@r %s @bEsercizio:@r %04d",
|
||||
(const char *) _reg_cod, (const char *) _reg_descr,
|
||||
(const char *) data_da, (const char *) data_a);
|
||||
(const char *) data_da, (const char *) data_a, _ae);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// LIBRO GIORNALE IVA UNICO
|
||||
////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// LIBRO GIORNALE IVA UNICO
|
||||
////////////////////////////////////////////////////////////////////
|
||||
if (_libro_giornale_iva_unico)
|
||||
{
|
||||
set_header(r, "Ri");
|
||||
@ -653,9 +711,9 @@ int CG3400_application::set_header_132()
|
||||
r++;
|
||||
}
|
||||
else
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// NO LIBRO GIORNALE IVA UNICO
|
||||
////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// NO LIBRO GIORNALE IVA UNICO
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
set_header(r, "Numero@12gDocumento@28gCodice@115gImporti@127g A S");
|
||||
r++;
|
||||
@ -678,23 +736,31 @@ int CG3400_application::set_header_132()
|
||||
|
||||
void CG3400_application::preprocess_header()
|
||||
{
|
||||
int pag = printer().getcurrentpage();
|
||||
TString dare = _tot_dare_progr.string(REAL_PICTURE);
|
||||
TString avere = _tot_avere_progr.string(REAL_PICTURE);
|
||||
int r = _last_header + 1;
|
||||
int r = _last_header + 1;
|
||||
int pag = printer().getcurrentpage();
|
||||
TString16 frm;
|
||||
real riporto_dare, riporto_avere;
|
||||
|
||||
if (pag > 0) // Stampa riporti
|
||||
{
|
||||
dare.right_just();
|
||||
avere.right_just();
|
||||
riporto_dare = _tot_dare_progr + _tot_dare_progr_ap;
|
||||
riporto_avere = _tot_avere_progr + _tot_avere_progr_ap;
|
||||
|
||||
TString dare(riporto_dare.string(REAL_TOT_PIC));
|
||||
TString avere(riporto_avere.string(REAL_TOT_PIC));
|
||||
|
||||
if (_stampa_width == 132)
|
||||
_riporto.format ("@b@86gRiporto: %15s %15s",
|
||||
(const char *) dare,
|
||||
(const char *) avere );
|
||||
frm = "@b@78g";
|
||||
else
|
||||
_riporto.format ("@b@100gRiporto %s @140g %s", (const char *) dare,
|
||||
(const char *) avere );
|
||||
frm = "@b@100g";
|
||||
|
||||
_riporto = frm;
|
||||
|
||||
_riporto << format ("Riporto: %15s %15s", (const char *) dare,
|
||||
(const char *) avere );
|
||||
|
||||
set_header (r++, "%s", (const char *) _riporto);
|
||||
|
||||
set_header (r, "");
|
||||
}
|
||||
}
|
||||
@ -724,14 +790,8 @@ bool CG3400_application::preprocess_print(int file, int counter)
|
||||
case LF_MOV:
|
||||
|
||||
_gia_settata_riga_mov = FALSE; // Stampa o no la riga di mov (solo se
|
||||
// NO stampa giornale_iva_unico
|
||||
_num_rig = 1;
|
||||
_tot_dare_ac = ZERO;
|
||||
_tot_avere_ac = ZERO;
|
||||
_tot_dare_gg = ZERO;
|
||||
_tot_avere_gg = ZERO;
|
||||
_tot_dare_progr = _tot_dare;
|
||||
_tot_avere_progr = _tot_avere;
|
||||
// NO stampa giornale_iva_unico
|
||||
_num_rig = 1;
|
||||
_iva_array.destroy();
|
||||
|
||||
if (_cur->items() == 0)
|
||||
@ -796,17 +856,12 @@ print_action CG3400_application::postprocess_page(int file, int counter)
|
||||
--(*_cur);
|
||||
_cur->restore_status();
|
||||
|
||||
// if (_data_corr != _data_succ || _cur->lastrec())
|
||||
// if (_data_corr != _data_succ || _cur->lastrec())
|
||||
if (_data_corr != _data_succ || _cur->pos() == _cur->items())
|
||||
{
|
||||
nuovo_mese = (_mese_succ != _mese_corr);
|
||||
|
||||
set_totali_giorno(_data_corr, righe_iva_settate);
|
||||
|
||||
_tot_dare_gg = _tot_avere_gg = ZERO;
|
||||
|
||||
_gia_settata_riga_mov = FALSE;
|
||||
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
else
|
||||
@ -814,7 +869,7 @@ print_action CG3400_application::postprocess_page(int file, int counter)
|
||||
|
||||
if (righe_iva_settate > 0)
|
||||
return REPEAT_PAGE;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case LF_RMOVIVA:
|
||||
@ -839,19 +894,22 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
int g, c;
|
||||
long s;
|
||||
bool gia_stampato=FALSE;
|
||||
static bool settata_causale=FALSE;
|
||||
TString80 rmv_descr;
|
||||
char sezione;
|
||||
real importo;
|
||||
TString16 frm;
|
||||
TConto tc;
|
||||
|
||||
|
||||
if (counter) return TRUE;
|
||||
|
||||
switch (file) {
|
||||
|
||||
|
||||
case LF_MOV:
|
||||
|
||||
_num_rig=1;
|
||||
settata_causale = FALSE;
|
||||
|
||||
_iva_array.destroy();
|
||||
|
||||
if (!_cur->is_first_match(LF_RMOV)) return FALSE;
|
||||
@ -911,25 +969,37 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
_descr_conto->set_width(198);
|
||||
}
|
||||
|
||||
*_descr_causale = get_descr_caus(_caus);
|
||||
*_descr_operazione = (const char *)rmv_descr;
|
||||
*_descr_conto = tc.descrizione();
|
||||
|
||||
setta_righe_descr (_descr_causale, causale);
|
||||
|
||||
// Il codice e descrizione della causale vanno solo sulla prima riga
|
||||
if (!settata_causale)
|
||||
{
|
||||
set_row (1, "@5g%3s", (const char*) _caus );
|
||||
*_descr_causale = get_descr_caus(_caus);
|
||||
setta_righe_descr (_descr_causale, causale);
|
||||
settata_causale = TRUE;
|
||||
}
|
||||
|
||||
setta_righe_descr (_descr_operazione, operazione);
|
||||
setta_righe_descr (_descr_conto, conto);
|
||||
|
||||
if (cf > ' ')
|
||||
if (_libro_cronologico)
|
||||
setta_righe_indirizzo(cf, s);
|
||||
|
||||
|
||||
if (sezione == 'D')
|
||||
{
|
||||
_tot_dare_progr += importo; // prog. generali
|
||||
if (_annoEsMov != _ae)
|
||||
_tot_dare_ac += importo; // prog. anno precedente
|
||||
{
|
||||
_tot_dare_ap += importo; // prog. anno precedente
|
||||
_tot_dare_progr_ap += importo;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tot_dare_gg += importo; // prog. giornalieri
|
||||
_tot_dare_progr += importo; // prog. generali
|
||||
}
|
||||
|
||||
if (_stampa_width == 132)
|
||||
frm = "@95g%r";
|
||||
@ -937,13 +1007,17 @@ bool CG3400_application::preprocess_page(int file, int counter)
|
||||
frm = "@142g%r";
|
||||
}
|
||||
else
|
||||
{
|
||||
_tot_avere_progr += importo;
|
||||
|
||||
{
|
||||
if (_annoEsMov != _ae)
|
||||
_tot_avere_ac += importo;
|
||||
{
|
||||
_tot_avere_ap += importo;
|
||||
_tot_avere_progr_ap += importo;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tot_avere_gg += importo;
|
||||
_tot_avere_progr += importo;
|
||||
}
|
||||
|
||||
if (_stampa_width == 132)
|
||||
frm = "@112g%r";
|
||||
@ -1040,14 +1114,14 @@ int CG3400_application::setta_righe_iva()
|
||||
{
|
||||
case 0 : set_row(r, "@73gDetraibile");
|
||||
break;
|
||||
case 1 : set_row(r, "@73gIndetraibile su op.es.");
|
||||
case 1 : set_row(r, "@73gIndetraibile su op.es.");
|
||||
break;
|
||||
case 3 : set_row(r, "@73gPassaggi interni");
|
||||
case 3 : set_row(r, "@73gPassaggi interni");
|
||||
break;
|
||||
case 9 : set_row(r, "@73gIndetraibile art.19");
|
||||
case 9 : set_row(r, "@73gIndetraibile art.19");
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
_iva_array.destroy();
|
||||
set_row (j+1, ""); // lascio una riga vuota dopo tutto cio'
|
||||
@ -1094,40 +1168,40 @@ void CG3400_application::setta_righe_indirizzo(char tipocf, long codcf)
|
||||
capcf = occ.get (OCC_CAP);
|
||||
comcf = occ.get (OCC_COM);
|
||||
}
|
||||
else
|
||||
{
|
||||
_clifo->zero();
|
||||
_clifo->put(CLI_CODCF, codcf);
|
||||
_clifo->put(CLI_TIPOCF, tipocf);
|
||||
else
|
||||
{
|
||||
_clifo->zero();
|
||||
_clifo->put(CLI_CODCF, codcf);
|
||||
_clifo->put(CLI_TIPOCF, tipocf);
|
||||
|
||||
if (_clifo->read() == NOERR)
|
||||
{
|
||||
viacf = _clifo->get(CLI_INDCF);
|
||||
civcf = _clifo->get(CLI_CIVCF);
|
||||
comcf = _clifo->get(CLI_COMCF);
|
||||
capcf = _clifo->get(CLI_CAPCF);
|
||||
statocf = _clifo->get(CLI_STATOCF);
|
||||
}
|
||||
}
|
||||
|
||||
TRectype dep = look_com (comcf);
|
||||
comune = dep.get(COM_DENCOM);
|
||||
prov = dep.get(COM_PROVCOM);
|
||||
|
||||
if (_libro_giornale_iva_unico)
|
||||
if (_clifo->read() == NOERR)
|
||||
{
|
||||
set_row (2, "@69g%s %s", (const char *)viacf, (const char *)civcf);
|
||||
set_row (3, "@69g%s %s %s", (const char *)capcf, (const char *)comune,
|
||||
(const char *)prov);
|
||||
}
|
||||
else // no libro iva unico. Cambia la colonna di inizio
|
||||
{
|
||||
set_row (2, "@26g%s %s", (const char *)viacf, (const char *)civcf);
|
||||
set_row (3, "@26g%s %s %s", (const char *)capcf, (const char *)comune,
|
||||
(const char *)prov);
|
||||
viacf = _clifo->get(CLI_INDCF);
|
||||
civcf = _clifo->get(CLI_CIVCF);
|
||||
comcf = _clifo->get(CLI_COMCF);
|
||||
capcf = _clifo->get(CLI_CAPCF);
|
||||
statocf = _clifo->get(CLI_STATOCF);
|
||||
}
|
||||
}
|
||||
|
||||
TRectype dep = look_com (comcf);
|
||||
comune = dep.get(COM_DENCOM);
|
||||
prov = dep.get(COM_PROVCOM);
|
||||
|
||||
if (_libro_giornale_iva_unico)
|
||||
{
|
||||
set_row (2, "@69g%s %s", (const char *)viacf, (const char *)civcf);
|
||||
set_row (3, "@69g%s %s %s", (const char *)capcf, (const char *)comune,
|
||||
(const char *)prov);
|
||||
}
|
||||
else // no libro iva unico. Cambia la colonna di inizio
|
||||
{
|
||||
set_row (2, "@26g%s %s", (const char *)viacf, (const char *)civcf);
|
||||
set_row (3, "@26g%s %s %s", (const char *)capcf, (const char *)comune,
|
||||
(const char *)prov);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Lettura/aggiornamento tabella registri
|
||||
//
|
||||
@ -1146,8 +1220,8 @@ void CG3400_application::aggiorna_tabreg(int partito_da, int stampate)
|
||||
_tabreg->put ("I1", _pagine_stampate + stampate);
|
||||
_tabreg->put ("I7", partito_da); // partito_da = -1 se stampa OK
|
||||
_tabreg->put ("I6", _nprog_mov);
|
||||
_tabreg->put ("R1", _tot_dare_progr);
|
||||
_tabreg->put ("R2", _tot_avere_progr);
|
||||
_tabreg->put ("R1", _tot_dare_generale);
|
||||
_tabreg->put ("R2", _tot_avere_generale);
|
||||
_tabreg->put ("D3", _data_a);
|
||||
_tabreg->rewrite();
|
||||
}
|
||||
@ -1205,15 +1279,19 @@ HIDDEN int date2esc(const TDate& d, int* prevesc)
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
bool CG3400_application::mask_a_data (TMask_field& f, KEY k)
|
||||
bool CG3400_application::data_a_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty() || k == K_ENTER)
|
||||
if (f.to_check(k))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const TDate data_a(f.get());
|
||||
TMask& m = f.mask();
|
||||
const TDate data_a(f.get());
|
||||
const TString16 codreg(m.get(CODREG));
|
||||
const int ae = date2esc(data_a); // Anno esercizio
|
||||
const bool definitiva = m.get_bool(STAMPA_DEF);
|
||||
const int ae = date2esc(data_a); // Anno esercizio
|
||||
const bool definitiva = m.get_bool(STAMPA_DEF);
|
||||
TString16 dep(data_a.string());
|
||||
|
||||
if (dep.empty())
|
||||
return TRUE;
|
||||
|
||||
app()->_ae = ae;
|
||||
|
||||
@ -1221,15 +1299,15 @@ bool CG3400_application::mask_a_data (TMask_field& f, KEY k)
|
||||
return f.error_box("La data specificata non appartiene a nessun esercizio");
|
||||
|
||||
TRegistro reg(codreg, ae);
|
||||
|
||||
|
||||
if (!reg.ok())
|
||||
return f.warning_box("Non trovo il libro giornale %s per l'esercizio %d",
|
||||
(const char *) codreg, ae);
|
||||
|
||||
|
||||
if (reg.tipo() != 5)
|
||||
return f.warning_box("Il registro %s per l'anno %d non e' di tipo libro giornale",
|
||||
(const char *) codreg, ae);
|
||||
|
||||
|
||||
const TDate data_da(m.get(DATA_DA));
|
||||
TString16 dtda(data_da.string());
|
||||
|
||||
@ -1237,15 +1315,35 @@ bool CG3400_application::mask_a_data (TMask_field& f, KEY k)
|
||||
{
|
||||
if (dtda.not_empty()) // senno' ci metto inizioEs
|
||||
if (data_da < app()->_inizioEs || data_a > app()->_fineEs);
|
||||
return f.warning_box("Le date specificate non appartengono allo stesso esercizio");
|
||||
return f.warning_box("Le date specificate non appartengono allo stesso esercizio");
|
||||
}
|
||||
else
|
||||
// se la stampa e' di prova DALLA_DATA e' obbligatoria
|
||||
if (dtda.empty())
|
||||
return f.warning_box("Manca la data di partenza");
|
||||
else
|
||||
if (data_da > data_a)
|
||||
return f.warning_box("La data di inizio non puo' essere maggiore della data finale");
|
||||
else
|
||||
// se la stampa e' di prova DALLA_DATA e' obbligatoria
|
||||
if (dtda.empty())
|
||||
return f.warning_box("Manca la data di partenza");
|
||||
else
|
||||
if (data_da > data_a)
|
||||
return f.warning_box("La data di inizio non puo' essere maggiore della data finale");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG3400_application::data_da_hndl(TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const TDate data_da (f.get());
|
||||
const TString16 data_a(m.get(DATA_A));
|
||||
const int ae_data_da = date2esc(data_da);
|
||||
const TString16 dep(data_da.string());
|
||||
|
||||
if (dep.empty() || data_a.empty())
|
||||
return TRUE;
|
||||
|
||||
if (app()->_ae != 0)
|
||||
if (app()->_ae != ae_data_da)
|
||||
return f.error_box("Le due date non appartengono allo stesso esercizio");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -1301,16 +1399,64 @@ bool CG3400_application::mask_b_ripristina (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG3400_application::init_print()
|
||||
{
|
||||
if (_stampa_len != 0)
|
||||
printer().formlen(_stampa_len);
|
||||
else
|
||||
printer().formlen(RIGHE_MODULO);
|
||||
|
||||
printer().footerlen(RIGHE_FOOTER);
|
||||
|
||||
reset_print();
|
||||
reset_header();
|
||||
reset_footer();
|
||||
set_background();
|
||||
|
||||
set_real_picture (REAL_PICTURE);
|
||||
set_print_zero(TRUE);
|
||||
|
||||
if (_stampa_width == 1)
|
||||
_stampa_width = 132;
|
||||
else
|
||||
_stampa_width = 198;
|
||||
|
||||
force_setpage(TRUE);
|
||||
|
||||
printer().set_from_page (_pagina_da);
|
||||
|
||||
if (_stampa_ok != -1) // la stampa precedente era andata male
|
||||
set_page_number (_stampa_ok);
|
||||
|
||||
if (_stampa_width == 132)
|
||||
_last_header = set_header_132();
|
||||
else
|
||||
_last_header = set_header_198();
|
||||
|
||||
}
|
||||
|
||||
void CG3400_application::init_totals()
|
||||
{
|
||||
_tot_dare_ap = ZERO;
|
||||
_tot_avere_ap = ZERO;
|
||||
_tot_dare_progr_ap = ZERO;
|
||||
_tot_avere_progr_ap = ZERO;
|
||||
_tot_dare_gg = ZERO;
|
||||
_tot_avere_gg = ZERO;
|
||||
_tot_dare_generale = ZERO;
|
||||
_tot_avere_generale = ZERO;
|
||||
_tot_dare_progr = _tot_dare;
|
||||
_tot_avere_progr = _tot_avere;
|
||||
}
|
||||
|
||||
bool CG3400_application::set_print(int)
|
||||
{
|
||||
TMask ma ("cg3400a");
|
||||
KEY tasto;
|
||||
|
||||
ma.set_handler (CODREG, mask_a_cod_reg);
|
||||
ma.set_handler (DATA_A, mask_a_data);
|
||||
|
||||
// m.set_handler (REG_ANNO, mask_set_pagina_da);
|
||||
// m.set_handler (REG_DESC, mask_set_pagina_da);
|
||||
ma.set_handler (DATA_A, data_a_hndl);
|
||||
ma.set_handler (DATA_DA, data_da_hndl);
|
||||
|
||||
tasto = ma.run();
|
||||
|
||||
@ -1327,8 +1473,8 @@ bool CG3400_application::set_print(int)
|
||||
_stampa_width = ma.get_int(STAMPA_WIDTH);
|
||||
_stampa_len = ma.get_int(STAMPA_LEN);
|
||||
|
||||
// Se stampa definita DALLA_DATA e' l'ultima data di stampa del
|
||||
// registro, se indicata, oppure la data di inizio esercizio
|
||||
// Se stampa definita DALLA_DATA e' l'ultima data di stampa del
|
||||
// registro, se indicata, oppure la data di inizio esercizio
|
||||
if (_stampa_definitiva)
|
||||
if (_last_data.ok())
|
||||
_data_da = _last_data;
|
||||
@ -1337,18 +1483,9 @@ bool CG3400_application::set_print(int)
|
||||
|
||||
leggi_tabreg(_reg_cod, _ae);
|
||||
|
||||
if (_stampa_len != 0)
|
||||
printer().formlen(_stampa_len);
|
||||
else
|
||||
printer().formlen(RIGHE_MODULO);
|
||||
|
||||
printer().footerlen(RIGHE_FOOTER);
|
||||
|
||||
if (_stampa_width == 1)
|
||||
_stampa_width = 132;
|
||||
else
|
||||
_stampa_width = 198;
|
||||
|
||||
init_print();
|
||||
init_totals();
|
||||
|
||||
TRectype da (_cur->file(LF_MOV).curr());
|
||||
TRectype a (_cur->file(LF_MOV).curr());
|
||||
|
||||
@ -1358,27 +1495,6 @@ bool CG3400_application::set_print(int)
|
||||
|
||||
_cur->setregion(da, a);
|
||||
|
||||
force_setpage(TRUE);
|
||||
|
||||
set_background();
|
||||
|
||||
reset_print();
|
||||
reset_header();
|
||||
reset_footer();
|
||||
|
||||
set_real_picture (REAL_PICTURE);
|
||||
set_print_zero(TRUE);
|
||||
|
||||
printer().set_from_page (_pagina_da);
|
||||
|
||||
if (_stampa_ok != -1) // la stampa precedente era andata male
|
||||
set_page_number (_stampa_ok);
|
||||
|
||||
if (_stampa_width == 132)
|
||||
_last_header = set_header_132();
|
||||
else
|
||||
_last_header = set_header_198();
|
||||
|
||||
if (_stampa_definitiva)
|
||||
{
|
||||
TMask mb("cg3400b");
|
||||
|
@ -25,7 +25,7 @@ typedef enum {stampagruppo, stampaconto, stampasottoconto, fine} tipo;
|
||||
class CG3500_application : public TPrintapp
|
||||
{
|
||||
TProgind * _prog;
|
||||
TClifo_list* _lista;
|
||||
TSaldi_list* _lista;
|
||||
TLocalisamfile* _com, * _pcn, * _clifo, * _saldi, * _nditte,* _anag;
|
||||
TIsamtempfile * _tmp_saldi;
|
||||
tipo _tp;
|
||||
@ -88,11 +88,11 @@ bool CG3500_application::riepilogo()
|
||||
g = _pcn->get_int (PCN_GRUPPO);
|
||||
c = _pcn->get_int (PCN_CONTO);
|
||||
s = _pcn->get_long(PCN_SOTTOCONTO);
|
||||
tipo_conto = _pcn->get(PCN_TMCF)[0];
|
||||
tipo_conto = _pcn->get_char(PCN_TMCF);
|
||||
|
||||
TConto conto (g,c,s,tipo_conto);
|
||||
|
||||
//il conto e' cambiato anche se e' rimasto invariato il conto ma e' cambiato il gruppo
|
||||
//il "conto" e' cambiato anche se e' rimasto invariato il conto ma e' cambiato il gruppo
|
||||
if ( (((cp != -1) && (conto.conto() != cp)) || ((gp != -1) && (conto.gruppo() != gp)))
|
||||
&& esiste_sc )
|
||||
{
|
||||
@ -230,10 +230,11 @@ bool CG3500_application::riepilogo()
|
||||
if (_richiesta == 1)
|
||||
sld.prg_attuali(_annoese,conto,indbil,prg_dare,prg_avere);
|
||||
else sld.prg_mov_eliminati(_annoese,conto,indbil,prg_dare,prg_avere);
|
||||
|
||||
saldo = prg_dare - prg_avere;
|
||||
|
||||
prg_conto_dare += prg_dare;
|
||||
prg_conto_avere += prg_avere;
|
||||
prg_conto_avere += prg_avere;
|
||||
|
||||
if (_scelta == 1) //riepilogo conti
|
||||
{
|
||||
@ -320,15 +321,15 @@ bool CG3500_application::ricerca_cf(TConto& conto,int indbil,real& prg_conto_dar
|
||||
long s;
|
||||
|
||||
real prg_dare, prg_avere, saldo;
|
||||
_lista = new TClifo_list (g,c,tipo);
|
||||
_lista = new TSaldi_list (g,c,_annoese);
|
||||
TRecnotype items = _lista->items();
|
||||
prg_conto_dare = 0.00;
|
||||
prg_conto_avere = 0.00;
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
_prog->addstatus(1);
|
||||
const TRectype& r = _lista->clifo(i);
|
||||
s = r.get_long(CLI_CODCF);
|
||||
const TRectype& r = _lista->saldi(i);
|
||||
s = r.get_long(SLD_SOTTOCONTO);
|
||||
esiste_sc = TRUE;
|
||||
prg_dare = 0.00;
|
||||
prg_avere = 0.00;
|
||||
@ -420,7 +421,9 @@ tipo CG3500_application::leggi_conti(int counter)
|
||||
{
|
||||
_ultima_data = UltimaData(_gcorr,_ccorr,_scorr,_annoese);
|
||||
_tmp_saldi->readat(pos);
|
||||
_tipo = _tmp_saldi->get(SLD_FLAGSALINI)[0];
|
||||
_tipo = _tmp_saldi->get_char(SLD_FLAGSALINI);
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
_tipo = ' ';
|
||||
TConto conto (_gcorr,_ccorr,_scorr,_tipo);
|
||||
_descr = conto.descrizione();
|
||||
_prg_dare = _tmp_saldi->get_real(SLD_PDARE);
|
||||
@ -442,7 +445,9 @@ tipo CG3500_application::leggi_conti(int counter)
|
||||
|
||||
_ultima_data = UltimaData(_gcorr,_ccorr,_scorr,_annoese);
|
||||
_tmp_saldi->readat(pos);
|
||||
_tipo = _tmp_saldi->get(SLD_FLAGSALINI)[0];
|
||||
_tipo = _tmp_saldi->get_char(SLD_FLAGSALINI);
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
_tipo = ' ';
|
||||
TConto conto (_gcorr,_ccorr,_scorr,_tipo);
|
||||
_descr = conto.descrizione();
|
||||
_prg_dare = _tmp_saldi->get_real(SLD_PDARE);
|
||||
@ -481,7 +486,9 @@ tipo CG3500_application::leggi_gruppi(int counter)
|
||||
{
|
||||
_tmp_saldi->readat(pos);
|
||||
_ultima_data = _tmp_saldi->get_date(SLD_DATAULMOV);
|
||||
_tipo = _tmp_saldi->get(SLD_FLAGSALINI)[0];
|
||||
_tipo = _tmp_saldi->get_char(SLD_FLAGSALINI);
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
_tipo = ' ';
|
||||
TConto conto (_gcorr,_ccorr,0l,_tipo);
|
||||
_descrconto = conto.descrizione();
|
||||
_prg_dare_conto = _tmp_saldi->get_real(SLD_PDARE);
|
||||
@ -499,7 +506,9 @@ tipo CG3500_application::leggi_gruppi(int counter)
|
||||
|
||||
_tmp_saldi->readat(pos);
|
||||
_ultima_data = _tmp_saldi->get_date(SLD_DATAULMOV);
|
||||
_tipo = _tmp_saldi->get(SLD_FLAGSALINI)[0];
|
||||
_tipo = _tmp_saldi->get_char(SLD_FLAGSALINI);
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
_tipo = ' ';
|
||||
TConto conto (_gcorr,_ccorr,0l,_tipo);
|
||||
_descrconto = conto.descrizione();
|
||||
_prg_dare_conto = _tmp_saldi->get_real(SLD_PDARE);
|
||||
@ -523,7 +532,9 @@ bool CG3500_application::CercaConto(int g, int c)
|
||||
{
|
||||
_gconto = _tmp_saldi->get_int(SLD_GRUPPO);
|
||||
_cconto = _tmp_saldi->get_int(SLD_CONTO);
|
||||
_tipo = _tmp_saldi->get(SLD_FLAGSALINI)[0];
|
||||
_tipo = _tmp_saldi->get_char(SLD_FLAGSALINI);
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
_tipo = ' ';
|
||||
if (_scelta == 2)
|
||||
_ultima_data = _tmp_saldi->get_date(SLD_DATAULMOV);
|
||||
TConto conto (_gconto,_cconto,0l,_tipo);
|
||||
@ -548,7 +559,9 @@ bool CG3500_application::CercaGruppo(int g)
|
||||
if (_tmp_saldi->read() == NOERR)
|
||||
{
|
||||
_ggruppo = _tmp_saldi->get_int(SLD_GRUPPO);
|
||||
_tipo = _tmp_saldi->get(SLD_FLAGSALINI)[0];
|
||||
_tipo = _tmp_saldi->get_char(SLD_FLAGSALINI);
|
||||
if (_tipo != 'C' && _tipo != 'F')
|
||||
_tipo = ' ';
|
||||
TConto conto (_ggruppo,0,0l,_tipo);
|
||||
_descrgruppo = conto.descrizione();
|
||||
_prg_dare_gruppo = _tmp_saldi->get_real(SLD_PDARE);
|
||||
@ -611,8 +624,8 @@ void CG3500_application::setta_riga_sottoconto()
|
||||
{
|
||||
TString udata = _ultima_data.string();
|
||||
|
||||
set_row(1,"%06ld", (const char*) _scorr);
|
||||
set_row(1," %.32s", (const char*) _descr);
|
||||
set_row(1,"%06ld", _scorr);
|
||||
set_row(1,"@i %.32s@r",(const char*) _descr);
|
||||
set_row(1,"@42g%s",(const char*) udata);
|
||||
set_row(1,"@57g%r@77g%r@97g%r@117g%r",&_prg_dare,&_prg_avere,&_saldo_dare,&_saldo_avere);
|
||||
}
|
||||
@ -629,13 +642,13 @@ void CG3500_application::setta_riga_conto()
|
||||
if (_scelta == 1)
|
||||
{
|
||||
set_row(r++,"%s",(const char*)riga);
|
||||
set_row(r,"**** Totali conto %03d.%03d",(const char*)_gconto,(const char*)_cconto);
|
||||
set_row(r," %.27s",(const char*)_descrconto);
|
||||
set_row(r,"@b**** Totali conto %03d.%03d",_gconto,_cconto);
|
||||
set_row(r,"@i %.27s@r",(const char*)_descrconto);
|
||||
}
|
||||
if (_scelta == 2)
|
||||
{
|
||||
set_row(r,"%03d", (const char*)_ccorr);
|
||||
set_row(r," %.32s",(const char*)_descrconto);
|
||||
set_row(r,"%03d", _ccorr);
|
||||
set_row(r,"@i %.32s@r",(const char*)_descrconto);
|
||||
set_row(r,"@42g%s",(const char*)udata);
|
||||
}
|
||||
set_row(r++,"@57g%r@77g%r@97g%r@117g%r",&_prg_dare_conto,&_prg_avere_conto,&_saldo_dare_conto,&_saldo_avere_conto);
|
||||
@ -655,8 +668,8 @@ void CG3500_application::setta_riga_gruppo()
|
||||
if (_scelta == 2)
|
||||
if (_tp == fine) r = 3;
|
||||
else r = 2;
|
||||
set_row(r,"**** TOTALI GRUPPO %03d-",(const char*)_ggruppo);
|
||||
set_row(r," %.30s",(const char*)_descrgruppo);
|
||||
set_row(r,"@b**** TOTALI GRUPPO %03d-",_ggruppo);
|
||||
set_row(r,"@i %.30s@r",(const char*)_descrgruppo);
|
||||
set_row(r++,"@57g%r@77g%r@97g%r@117g%r",&_prg_dare_gruppo,&_prg_avere_gruppo,&_saldo_dare_gruppo,&_saldo_avere_gruppo);
|
||||
set_row(r++,"%s",(const char*)riga);
|
||||
riga = "";
|
||||
@ -670,7 +683,7 @@ void CG3500_application::setta_riga_totale()
|
||||
_saldo_tot = _prg_dare_tot - _prg_avere_tot;
|
||||
if (_scelta == 1) r = 8;
|
||||
else r = 6;
|
||||
set_row(r,"**** TOTALE GENERALE @57g%r@77g%r",&_prg_dare_tot,&_prg_avere_tot);
|
||||
set_row(r,"@b**** TOTALE GENERALE @57g%r@77g%r",&_prg_dare_tot,&_prg_avere_tot);
|
||||
if (_saldo_tot > 0.00)
|
||||
set_row(r,"@97g%r",&_saldo_tot);
|
||||
else
|
||||
@ -682,7 +695,7 @@ void CG3500_application::setta_riga_totale()
|
||||
|
||||
TDate CG3500_application::UltimaData(int g, int c, long s, int anno)
|
||||
{
|
||||
TLocalisamfile saldi(LF_SALDI, FALSE); //il parametro a false permette di usare un record corrente del file saldi differente a quello del file tmp
|
||||
TLocalisamfile saldi(LF_SALDI, FALSE); //il parametro a false permette di usare un record corrente del file saldi differente a quello del file temporaneo
|
||||
TDate uldata;
|
||||
|
||||
saldi.zero();
|
||||
@ -703,13 +716,13 @@ TDate CG3500_application::UltimaData(int g, int c, long s, int anno)
|
||||
|
||||
void CG3500_application::user_create()
|
||||
{
|
||||
_clifo = new TLocalisamfile(LF_CLIFO);
|
||||
_com = new TLocalisamfile(LF_COMUNI);
|
||||
_pcn = new TLocalisamfile(LF_PCON);
|
||||
_saldi = new TLocalisamfile(LF_SALDI);
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_tmp_saldi = new TIsamtempfile (LF_SALDI);
|
||||
_clifo = new TLocalisamfile(LF_CLIFO);
|
||||
_com = new TLocalisamfile(LF_COMUNI);
|
||||
_pcn = new TLocalisamfile(LF_PCON);
|
||||
_saldi = new TLocalisamfile(LF_SALDI);
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_anag = new TLocalisamfile(LF_ANAG);
|
||||
_tmp_saldi = new TIsamtempfile (LF_SALDI);
|
||||
}
|
||||
|
||||
void CG3500_application::user_destroy()
|
||||
|
54
cg/cg3500.h
54
cg/cg3500.h
@ -1,27 +1,27 @@
|
||||
#ifndef __CG3500_H
|
||||
#define __CG3500_H
|
||||
|
||||
#define F_CODDITTA 101
|
||||
#define F_DATASTAMPA 102
|
||||
#define F_RAGSOC 103
|
||||
#define F_ANNO 104
|
||||
#define F_STAMPA 105
|
||||
#define F_RICHIESTA 106
|
||||
|
||||
#endif // __CG3500_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __CG3500_H
|
||||
#define __CG3500_H
|
||||
|
||||
#define F_CODDITTA 101
|
||||
#define F_DATASTAMPA 102
|
||||
#define F_RAGSOC 103
|
||||
#define F_ANNO 104
|
||||
#define F_STAMPA 105
|
||||
#define F_RICHIESTA 106
|
||||
|
||||
#endif // __CG3500_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
152
cg/cg3500a.uml
152
cg/cg3500a.uml
@ -1,77 +1,77 @@
|
||||
#include "cg3500.h"
|
||||
|
||||
PAGE "" -1 -1 71 16
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 2 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale @50" RAGSOC
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 2 2 "Ragione sociale "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_DATASTAMPA
|
||||
BEGIN
|
||||
PROMPT 43 1 "Data di stampa "
|
||||
FLAGS "A"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 3 "Anno esercizio "
|
||||
#include "cg3500.h"
|
||||
|
||||
PAGE "" -1 -1 71 16
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 2 1 "Ditta "
|
||||
FLAGS "FRD"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE REQUIRED
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale @50" RAGSOC
|
||||
OUTPUT F_CODDITTA CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 2 2 "Ragione sociale "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE F_DATASTAMPA
|
||||
BEGIN
|
||||
PROMPT 43 1 "Data di stampa "
|
||||
FLAGS "A"
|
||||
USE ESC
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Anno" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
OUTPUT F_ANNO CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "L'anno di esercizio deve essere presente nella tabella degli esercizi"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_STAMPA 26
|
||||
BEGIN
|
||||
PROMPT 2 5 "Scelta stampa "
|
||||
ITEM "1|Stampa riepilogo conti"
|
||||
ITEM "2|Stampa riepilogo gruppi"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_RICHIESTA 40
|
||||
BEGIN
|
||||
PROMPT 2 9 "Richiesta stampa "
|
||||
ITEM "1|Stampa progressivi attuali"
|
||||
ITEM "2|Stampa progressivi movimenti eliminati"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 3 "Anno esercizio "
|
||||
FLAGS "RZ"
|
||||
USE ESC
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Anno" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
OUTPUT F_ANNO CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "L'anno di esercizio deve essere presente nella tabella degli esercizi"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_STAMPA 26
|
||||
BEGIN
|
||||
PROMPT 2 5 "Scelta stampa "
|
||||
ITEM "1|Stampa riepilogo conti"
|
||||
ITEM "2|Stampa riepilogo gruppi"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_RICHIESTA 40
|
||||
BEGIN
|
||||
PROMPT 2 9 "Richiesta stampa "
|
||||
ITEM "1|Stampa progressivi attuali"
|
||||
ITEM "2|Stampa progressivi movimenti eliminati"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 9 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
48
cg/cglib.h
48
cg/cglib.h
@ -4,46 +4,49 @@
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ASSOC_H
|
||||
#include <assoc.h>
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
#ifndef __DATE_H
|
||||
#include <date.h>
|
||||
#endif
|
||||
|
||||
#include <assoc.h>
|
||||
#include "conto.h"
|
||||
|
||||
TLocalisamfile * get_descr_cf(TLocalisamfile * pconti,
|
||||
TLocalisamfile * clifo , int g, int c, long s);
|
||||
|
||||
class TClifo_list : public TArray
|
||||
class TSaldi_list : public TArray
|
||||
{
|
||||
public:
|
||||
TClifo_list(int g, int c, char tipocf);
|
||||
TRectype& clifo(int i)const { return(TRectype&)this->operator[](i); }
|
||||
TSaldi_list(int g, int c, int anno);
|
||||
TRectype& saldi(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;
|
||||
TRectype* _rec;
|
||||
int _annoes;
|
||||
TDate _inizioEs, _fineEs;
|
||||
TString16 _codcaus;
|
||||
TDate _datareg;
|
||||
TDate _datacomp;
|
||||
TString _provv;
|
||||
|
||||
bool _significativo;
|
||||
bool _movimentato;
|
||||
protected:
|
||||
void InFinEs(int);
|
||||
|
||||
public:
|
||||
public:
|
||||
bool movimentato() const { return _movimentato==TRUE; }
|
||||
bool significativo() const { return _significativo==TRUE; }
|
||||
const int EsePre (const int annocorr);
|
||||
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();
|
||||
@ -53,7 +56,7 @@ public:
|
||||
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);
|
||||
real calcola_saldo_iniziale(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);
|
||||
@ -61,8 +64,6 @@ public:
|
||||
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();
|
||||
@ -84,7 +85,8 @@ public:
|
||||
class TSaldo_agg : public TObject
|
||||
{
|
||||
TTab_conti _tab_conti;
|
||||
bool _movap; // se e' mov. d'apertura (aggiorno SALDO e FLAGSALINI in saldi)
|
||||
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
|
||||
@ -101,19 +103,19 @@ public:
|
||||
char sezione, bool somma=TRUE);
|
||||
|
||||
void set_anno_es(int anno) { _anno_es = anno; }
|
||||
int anno_es() const { return _anno_es; }
|
||||
int anno_es() { return _anno_es; }
|
||||
|
||||
void set_movap (bool movap) { _movap = movap; }
|
||||
bool movap() const { return _movap; }
|
||||
bool movap() { return _movap; }
|
||||
|
||||
void set_movprovv (bool p) { _provv = p; }
|
||||
bool movprovv() const { return _provv; }
|
||||
bool movprovv() { return _provv; }
|
||||
|
||||
void set_data_ulmov (const TDate& data) { _data_ulmov = data; }
|
||||
const TDate& data_ulmov() const { return _data_ulmov; }
|
||||
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() const { return _num_ulmov; }
|
||||
long num_ulmov() { return _num_ulmov; }
|
||||
|
||||
void reset(); // pulisce l'array dei conti
|
||||
TSaldo_agg();
|
||||
|
227
cg/cglib01.cpp
227
cg/cglib01.cpp
@ -6,6 +6,7 @@
|
||||
#include <real.h>
|
||||
#include <lffiles.h>
|
||||
#include <isam.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
#include <config.h>
|
||||
#include <rmov.h>
|
||||
@ -20,15 +21,15 @@ const MAXSTR = 128;
|
||||
static char __tmp [MAXSTR];
|
||||
static TFixed_string tmp (__tmp, MAXSTR);
|
||||
|
||||
TClifo_list::TClifo_list(int g, int c, char tipocf)
|
||||
TSaldi_list::TSaldi_list(int g, int c, int anno)
|
||||
{
|
||||
TLocalisamfile cf(LF_CLIFO);
|
||||
TLocalisamfile cf(LF_SALDI);
|
||||
destroy();
|
||||
cf.setkey(3);
|
||||
cf.setkey(1);
|
||||
cf.zero();
|
||||
cf.put(CLI_TIPOCF,tipocf);
|
||||
cf.put(CLI_GRUPPO,g);
|
||||
cf.put(CLI_CONTO,c);
|
||||
cf.put(SLD_ANNOES,anno);
|
||||
cf.put(SLD_GRUPPO,g);
|
||||
cf.put(SLD_CONTO,c);
|
||||
TRectype rec(cf.curr());
|
||||
cf.read(_isgteq);
|
||||
for ( ;!cf.eof();cf.next())
|
||||
@ -53,27 +54,56 @@ Saldo::Saldo()
|
||||
Saldo::~Saldo()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Cerca l'esercizio precedente di EseCorr
|
||||
// Se EseCorr e' gia' il primo ritorna 0
|
||||
// senno' ritorna, astutamente, EseCorr - 1
|
||||
//
|
||||
const int Saldo::EsePre(const int EseCorr)
|
||||
{
|
||||
TTable ese("ESC");
|
||||
TString16 first;
|
||||
TString codtab;
|
||||
|
||||
ese.first();
|
||||
first = ese.get("CODTAB");
|
||||
|
||||
codtab << EseCorr;
|
||||
codtab.format("%04d");
|
||||
|
||||
if (codtab == first)
|
||||
return 0;
|
||||
|
||||
return EseCorr - 1;
|
||||
}
|
||||
|
||||
real Saldo::saldofin_esprec(int annoes, int g, int c, long s)
|
||||
{
|
||||
real saldo,pdare,pavere,pdaresca,paveresca;
|
||||
char flag;
|
||||
TRectype app = ricerca_progr_prec(annoes-1, g, c, s);
|
||||
const int annoesprec = EsePre(annoes);
|
||||
|
||||
if (annoesprec == 0) return ZERO; // non ci sono esercizi prima del primo
|
||||
|
||||
TRectype app = ricerca_progr_prec(annoesprec, g, c, s);
|
||||
|
||||
flag = app.get(SLD_FLAGSALINI)[0];
|
||||
saldo = app.get_real(SLD_SALDO);
|
||||
pdare = app.get_real(SLD_PDARE);
|
||||
pavere = app.get_real(SLD_PAVERE);
|
||||
pdaresca = app.get_real(SLD_PDARESCA);
|
||||
paveresca = app.get_real(SLD_PAVERESCA);
|
||||
|
||||
pdaresca = app.get_real(SLD_PDARE);
|
||||
paveresca = app.get_real(SLD_PAVERE);
|
||||
|
||||
_significativo = (saldo != ZERO || pdare != ZERO || pavere != ZERO);
|
||||
|
||||
if (flag == 'D')
|
||||
return saldo+pdaresca-paveresca+pdare-pavere;
|
||||
return pdare-pavere+saldo;
|
||||
else
|
||||
return pdaresca-saldo-paveresca+pdare-pavere;
|
||||
return pdare-pavere-saldo;
|
||||
}
|
||||
|
||||
real Saldo::calcola_saldo_iniziale(int annoes,int g,int c,long s,int indbil)
|
||||
real Saldo::calcola_saldo_iniziale(int g,int c,long s,int indbil)
|
||||
{
|
||||
real saldoini, pdaresca, paveresca;
|
||||
char flag;
|
||||
@ -85,46 +115,38 @@ real Saldo::calcola_saldo_iniziale(int annoes,int g,int c,long s,int indbil)
|
||||
saldi.put(SLD_CONTO,c);
|
||||
if (s != 0)
|
||||
saldi.put(SLD_SOTTOCONTO,s);
|
||||
saldi.put(SLD_ANNOES,annoes);
|
||||
saldi.put(SLD_ANNOES,_annoes);
|
||||
|
||||
saldi.read();
|
||||
|
||||
if (saldi.bad()) saldi.zero();
|
||||
|
||||
flag = saldi.get(SLD_FLAGSALINI)[0];
|
||||
flag = saldi.get_char(SLD_FLAGSALINI);
|
||||
saldoini = saldi.get_real(SLD_SALDO);
|
||||
pdaresca = saldi.get_real(SLD_PDARESCA);
|
||||
paveresca = saldi.get_real(SLD_PAVERESCA);
|
||||
|
||||
if (saldoini != ZERO)
|
||||
if (flag == 'A') saldoini = -saldoini;
|
||||
|
||||
if (saldoini == ZERO) //e il conto e' patrimoniale o d'ordine
|
||||
if (saldoini == ZERO)
|
||||
if ( indbil == 1 || indbil == 2 || indbil == 5 )
|
||||
saldoini = saldofin_esprec(annoes, g, c, s);
|
||||
{
|
||||
saldoini = saldofin_esprec(_annoes, g, c, s);
|
||||
flag = 'D'; // Il segno DEVE essere quello del saldo precedente
|
||||
}
|
||||
|
||||
_saldo_iniziale = saldoini;
|
||||
|
||||
#ifdef DBG
|
||||
TString sldi(saldoini.string());
|
||||
#endif
|
||||
|
||||
if (flag == 'D')
|
||||
return saldoini+pdaresca-paveresca;
|
||||
else //if (flag == 'A')
|
||||
return pdaresca-saldoini-paveresca;
|
||||
}
|
||||
|
||||
/*
|
||||
bool Saldo::calcola(int annoes, int annoesprec,int g, int c, long s,
|
||||
const TDate& data_inf, const TDate& data_sup,
|
||||
int indbil, bool controllo_competenza, const TDate& inizio_es,
|
||||
const TDate& fine_es, const TDate& fine_es_prec,bool stp_prov)
|
||||
{
|
||||
if (data_sup.ok())
|
||||
{
|
||||
if (!calcola_data_limite(annoes, g, c, s, data_inf, data_sup, indbil,
|
||||
controllo_competenza, inizio_es, fine_es, fine_es_prec,stp_prov))
|
||||
return FALSE;
|
||||
}
|
||||
return pdaresca-paveresca+saldoini;
|
||||
else
|
||||
if (!calcola_ultima_immissione(annoes,annoesprec, g, c, s, indbil))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return pdaresca-paveresca-saldoini;
|
||||
}
|
||||
*/
|
||||
|
||||
const char* Saldo::causale_chiusura_es()
|
||||
{
|
||||
@ -202,17 +224,17 @@ bool Saldo::calcola_data_limite(int annoes, int g, int c, long s, const TDate& d
|
||||
if (gcs_corr != gcs_prec)
|
||||
{
|
||||
gcs_prec = gcs_corr;
|
||||
dep += calcola_saldo_iniziale(annoe,gruppo,conto,sottoconto,indbil);
|
||||
//dep += calcola_saldo_iniziale(annoe,gruppo,conto,sottoconto,indbil);
|
||||
}
|
||||
|
||||
//controllo sulle date
|
||||
if (annoe != annoes)
|
||||
if (annoe != annoes-1)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (controllo_competenza)
|
||||
if ( (annoe == annoes -1) && (data_sup != fine_es) )
|
||||
continue;
|
||||
continue;
|
||||
else
|
||||
if ( (data_rmv <= fine_es) && (data_rmv <= fine_es_prec) ||
|
||||
(data_rmv > fine_es) )
|
||||
@ -237,24 +259,6 @@ bool Saldo::calcola_data_limite(int annoes, int g, int c, long s, const TDate& d
|
||||
return esito;
|
||||
}
|
||||
|
||||
/*
|
||||
void Saldo::InFinEs(int ae)
|
||||
{
|
||||
TTable TabEs ("ESC");
|
||||
TString16 codtab;
|
||||
|
||||
TabEs.zero();
|
||||
|
||||
codtab.format ("%04d", ae);
|
||||
TabEs.put ("CODTAB", codtab);
|
||||
TabEs.read();
|
||||
if (TabEs.good())
|
||||
{
|
||||
_inizioEs = TabEs.get_date ("D0");
|
||||
_fineEs = TabEs.get_date ("D1");
|
||||
}
|
||||
}
|
||||
*/
|
||||
bool Saldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate& data_inf,
|
||||
const TDate& data_sup, int indbil, bool stp_prov)
|
||||
{
|
||||
@ -264,9 +268,10 @@ bool Saldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate
|
||||
long sottoconto, num_reg;
|
||||
TDate data_mov;
|
||||
char sezione;
|
||||
bool esito = FALSE;
|
||||
bool buono = FALSE;
|
||||
_saldo_iniziale = ZERO;
|
||||
TLocalisamfile rmov(LF_RMOV, FALSE);
|
||||
|
||||
|
||||
rmov.setkey(2);
|
||||
rmov.zero();
|
||||
rmov.put(RMV_GRUPPO,g);
|
||||
@ -275,6 +280,7 @@ bool Saldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate
|
||||
TRectype rec(rmov.curr());
|
||||
|
||||
rmov.read(_isgteq);
|
||||
|
||||
for ( ; !rmov.eof(); rmov.next())
|
||||
{
|
||||
if (rmov.curr() != rec) break;
|
||||
@ -301,8 +307,9 @@ bool Saldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate
|
||||
|
||||
// se la causale del movimento e' uguale a quella di chiusura,
|
||||
// il movimento non va considerato
|
||||
|
||||
if (_codcaus == causale_chiusura_es()) continue;
|
||||
|
||||
if (_codcaus.not_empty())
|
||||
if (_codcaus == causale_chiusura_es()) continue;
|
||||
|
||||
if (!stp_prov && _provv.trim().not_empty()) //se non e' richiesta stampa
|
||||
continue; //mov. provvisori li scarto
|
||||
@ -312,23 +319,30 @@ bool Saldo::data_limite_bilancio(int bilancio, int g, int c, long s, const TDate
|
||||
if (gcs_corr != gcs_prec)
|
||||
{
|
||||
gcs_prec = gcs_corr;
|
||||
dep += calcola_saldo_iniziale(_annoes,gruppo,conto,sottoconto,indbil);
|
||||
dep += calcola_saldo_iniziale(gruppo,conto,sottoconto,indbil);
|
||||
}
|
||||
|
||||
sezione = rmov.get_char(RMV_SEZIONE);
|
||||
importo = rmov.get_real(RMV_IMPORTO);
|
||||
#ifdef DBG
|
||||
TString dep1(dep.string());
|
||||
#endif
|
||||
sezione = rmov.get_char(RMV_SEZIONE);
|
||||
importo = rmov.get_real(RMV_IMPORTO);
|
||||
|
||||
if (importo == ZERO)
|
||||
continue;
|
||||
|
||||
esito = TRUE;
|
||||
buono = TRUE;
|
||||
|
||||
if (sezione == 'D') dep += importo;
|
||||
else dep -= importo;
|
||||
if (sezione == 'D')
|
||||
dep += importo;
|
||||
else
|
||||
dep -= importo;
|
||||
|
||||
}
|
||||
#ifdef DBG
|
||||
TString dep2(dep.string());
|
||||
#endif
|
||||
_saldo = dep;
|
||||
return esito;
|
||||
return buono;
|
||||
}
|
||||
|
||||
bool Saldo::calcola_ultima_immissione(int annoes, int annoesprec, int g, int c,
|
||||
@ -344,7 +358,7 @@ long s, int indbil)
|
||||
_saldo_iniziale = ZERO;
|
||||
_prg_dare = ZERO;
|
||||
_prg_avere = ZERO;
|
||||
_saldo = ZERO;
|
||||
_saldo = ZERO;
|
||||
|
||||
saldi.zero();
|
||||
|
||||
@ -368,32 +382,26 @@ long s, int indbil)
|
||||
|
||||
if (annoesprec == 0) //all'ultima immissione es.in corso
|
||||
{
|
||||
// if (indbil == 3 || indbil == 4)
|
||||
// return esito;
|
||||
|
||||
if (indbil == 1 || indbil == 2 || indbil == 5)
|
||||
if (_saldo_iniziale == ZERO)
|
||||
_saldo_iniziale += saldofin_esprec(annoes,gruppo,conto,sottoconto);
|
||||
|
||||
_saldo_iniziale += saldofin_esprec(annoes,gruppo,conto,sottoconto);
|
||||
|
||||
// i tre valori precedenti vengono utilizzati per la stampa bilancio
|
||||
// di verifica
|
||||
_saldo = _saldo_iniziale + _prg_dare - _prg_avere;
|
||||
}
|
||||
else //all'ultima immissione es.precedente
|
||||
{
|
||||
TRecnotype numrec = saldi.recno();
|
||||
TRectype app = ricerca_progr_prec(annoe-1, gruppo, conto, sottoconto);
|
||||
annoe = app.get_int (SLD_ANNOES);
|
||||
_prg_dare = app.get_real(SLD_PDARE);
|
||||
_prg_avere = app.get_real(SLD_PAVERE);
|
||||
#ifdef DBG
|
||||
TString16 pd, pa;
|
||||
pa = _prg_avere.string();
|
||||
pd = _prg_dare.string();
|
||||
warning_box ("pdare=%s pavere=%s", (const char*)pd, (const char *)pa);
|
||||
#endif
|
||||
saldi.readat(numrec);
|
||||
_saldo = _prg_dare - _prg_avere;
|
||||
const int annoesprec = EsePre(annoes);
|
||||
|
||||
if (annoesprec != 0)
|
||||
{
|
||||
TRectype app = ricerca_progr_prec(annoe-1, gruppo, conto, sottoconto);
|
||||
annoe = app.get_int (SLD_ANNOES);
|
||||
_prg_dare = app.get_real(SLD_PDARE);
|
||||
_prg_avere = app.get_real(SLD_PAVERE);
|
||||
}
|
||||
_saldo = _prg_dare - _prg_avere;
|
||||
}
|
||||
}
|
||||
return esito;
|
||||
@ -411,7 +419,7 @@ bool Saldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil)
|
||||
_saldo_iniziale = ZERO;
|
||||
_prg_dare = ZERO;
|
||||
_prg_avere = ZERO;
|
||||
_saldo = ZERO;
|
||||
_saldo = ZERO;
|
||||
|
||||
saldi.zero();
|
||||
|
||||
@ -430,15 +438,18 @@ bool Saldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil)
|
||||
_prg_dare = saldi.get_real(SLD_PDARE);
|
||||
_prg_avere = saldi.get_real(SLD_PAVERE);
|
||||
sezione = saldi.get_char(SLD_FLAGSALINI);
|
||||
|
||||
|
||||
if (_prg_dare == 0 && _prg_avere == 0)
|
||||
return esito;
|
||||
|
||||
if (sezione == 'A') _saldo_iniziale = -_saldo_iniziale;
|
||||
|
||||
// if (indbil == 3 || indbil == 4)
|
||||
// return esito;
|
||||
// return esito;
|
||||
|
||||
if (indbil == 1 || indbil == 2 || indbil == 5)
|
||||
if (_saldo_iniziale == ZERO)
|
||||
_saldo_iniziale += saldofin_esprec(annoes,gruppo,conto,sottoconto);
|
||||
_saldo_iniziale += saldofin_esprec(annoes,gruppo,conto,sottoconto);
|
||||
|
||||
// i tre valori precedenti vengono utilizzati per la stampa bilancio
|
||||
// di verifica
|
||||
@ -452,11 +463,12 @@ TRectype& Saldo::ricerca_progr_prec (int annoesprec, int g, int c, long s)
|
||||
{
|
||||
TLocalisamfile saldi(LF_SALDI, FALSE);
|
||||
// TRectype rec(LF_SALDI);
|
||||
|
||||
const int oldkey = saldi.getkey();
|
||||
|
||||
saldi.setkey(1);
|
||||
saldi.zero();
|
||||
|
||||
if (annoesprec != 0) saldi.put(SLD_ANNOES,annoesprec);
|
||||
saldi.put(SLD_ANNOES,annoesprec);
|
||||
if (g != 0) saldi.put(SLD_GRUPPO,g);
|
||||
if (c != 0) saldi.put(SLD_CONTO,c);
|
||||
if (s != 0) saldi.put(SLD_SOTTOCONTO,s);
|
||||
@ -464,7 +476,8 @@ TRectype& Saldo::ricerca_progr_prec (int annoesprec, int g, int c, long s)
|
||||
if (saldi.read() != NOERR) saldi.zero();
|
||||
|
||||
*_rec = saldi.curr();
|
||||
|
||||
saldi.setkey(oldkey);
|
||||
|
||||
return *_rec;
|
||||
}
|
||||
|
||||
@ -494,11 +507,11 @@ bool Saldo::prg_attuali(int annoes,TConto& conto,int indbil,real& prgdare,real&
|
||||
if ( (indbil == 1) || (indbil == 2) || (indbil == 5) )
|
||||
if (saldoini == 0)
|
||||
{
|
||||
saldoini = saldofin_esprec(annoes,conto.gruppo(),conto.conto(),conto.sottoconto());
|
||||
if (saldoini > 0.00)
|
||||
flagsalini = 'D';
|
||||
saldoini = saldofin_esprec(annoes,conto.gruppo(),conto.conto(),conto.sottoconto());
|
||||
if (saldoini > 0.00)
|
||||
flagsalini = 'D';
|
||||
else flagsalini = 'A';
|
||||
}
|
||||
}
|
||||
pdare = saldi.get_real(SLD_PDARE);
|
||||
pavere = saldi.get_real(SLD_PAVERE);
|
||||
pdaresca = saldi.get_real(SLD_PDARESCA);
|
||||
@ -539,11 +552,11 @@ bool Saldo::prg_mov_eliminati(int annoes,TConto& conto,int indbil,real& prgdare,
|
||||
if ( (indbil == 1) || (indbil == 2) || (indbil == 5) )
|
||||
if (saldoini == ZERO)
|
||||
{
|
||||
saldoini = saldofin_esprec(annoes,conto.gruppo(),conto.conto(),conto.sottoconto());
|
||||
if (saldoini > ZERO)
|
||||
flagsalini = 'D';
|
||||
saldoini = saldofin_esprec(annoes,conto.gruppo(),conto.conto(),conto.sottoconto());
|
||||
if (saldoini > ZERO)
|
||||
flagsalini = 'D';
|
||||
else flagsalini = 'A';
|
||||
}
|
||||
}
|
||||
pdaresca = saldi.get_real(SLD_PDARESCA);
|
||||
paveresca = saldi.get_real(SLD_PAVERESCA);
|
||||
if (flagsalini == 'D')
|
||||
@ -561,7 +574,7 @@ bool Saldo::prg_mov_eliminati(int annoes,TConto& conto,int indbil,real& prgdare,
|
||||
}
|
||||
|
||||
TLocalisamfile * get_descr_cf (TLocalisamfile * pconti,
|
||||
TLocalisamfile * clifo, int g, int c, long s)
|
||||
TLocalisamfile * clifo, int g, int c, long s)
|
||||
{
|
||||
pconti->zero();
|
||||
pconti->put (PCN_GRUPPO, g);
|
||||
|
Loading…
x
Reference in New Issue
Block a user