orrezioni da PARMA a causali mastrini chiusura e registri.
git-svn-id: svn://10.65.10.50/trunk@159 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
47dd388b62
commit
8f12c7fc4d
389
cg/cg0500.cpp
389
cg/cg0500.cpp
@ -64,9 +64,18 @@ HIDDEN int anno_iva()
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Le righe di causale:
|
||||
// Righe_rcaus e' un array di Riga_rcaus
|
||||
// Riga_rcaus e' una token_string corrispondente ad una riga dello spreadsheet
|
||||
//
|
||||
// Righe_rcaus e' un array di Riga_rcaus.
|
||||
//
|
||||
// - NB - Contiene solo le descrizioni fisse!
|
||||
//
|
||||
// I dati letti dal file sono memorizzati direttamente nello spreadsheet
|
||||
// Quando cambiano i campi tipodoc, codreg, tpm della testata le nuove
|
||||
// descrizioni vengono caricate in questo array e poi ricopiate (solo le
|
||||
// descrizioni) nello spreadsheet.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
class Riga_rcaus : public TToken_string
|
||||
{
|
||||
@ -89,35 +98,23 @@ Riga_rcaus::Riga_rcaus (TConto& tc,const char * df, char tipocf, char sez,
|
||||
bool rigaiva, const char * codiva)
|
||||
: TToken_string(80)
|
||||
{
|
||||
add(df);
|
||||
add(df); add(tipocf);
|
||||
// add(tc.tipo());
|
||||
add(tipocf);
|
||||
if (tc.ok())
|
||||
{
|
||||
add((long)tc.gruppo());
|
||||
add((long)tc.conto());
|
||||
if (tc.ok()) {
|
||||
add((long)tc.gruppo()); add((long)tc.conto());
|
||||
add((long)tc.sottoconto());
|
||||
}
|
||||
else
|
||||
{
|
||||
add("");
|
||||
add("");
|
||||
add("");
|
||||
else {
|
||||
add(""); add(""); add("");
|
||||
}
|
||||
add(sez);
|
||||
add(des);
|
||||
add(desagg);
|
||||
add((char)rigaiva);
|
||||
add(codiva);
|
||||
add(sez); add(des); add(desagg);
|
||||
add((char)rigaiva); add(codiva);
|
||||
}
|
||||
|
||||
class TRighe_rcaus : public TArray
|
||||
{
|
||||
public:
|
||||
void set_descr (int numrig=-1, const char * descr="", char tipocf=' ');
|
||||
void add_riga(int numrig, char tipocf,
|
||||
char sezione, const char * des, const char * desagg,
|
||||
bool rigaiva, const char * codiva, TConto& tc );
|
||||
void clear(int riga); // pulisce una riga in seguito ad Azzera
|
||||
void ClearDescr(); // cancella solo le descrizioni fisse
|
||||
void CaricaRigheLibere();
|
||||
@ -130,10 +127,8 @@ public:
|
||||
|
||||
void TRighe_rcaus::ClearDescr()
|
||||
{
|
||||
for (int i=0; i < items(); i++)
|
||||
{
|
||||
for (int i=0; i < items(); i++) {
|
||||
Riga_rcaus *r = (Riga_rcaus*)objptr(i);
|
||||
|
||||
if (r) r->add("", 0);
|
||||
}
|
||||
}
|
||||
@ -142,55 +137,19 @@ void TRighe_rcaus::clear(int row)
|
||||
{
|
||||
Riga_rcaus *r = (Riga_rcaus*)objptr(row);
|
||||
|
||||
if (r)
|
||||
{
|
||||
r->add("", 1);
|
||||
r->add(0, 2);
|
||||
r->add(0, 3);
|
||||
r->add(0L, 4);
|
||||
r->add("", 5);
|
||||
r->add("", 6);
|
||||
r->add("", 7);
|
||||
r->add("", 8);
|
||||
r->add("", 9);
|
||||
if (r) {
|
||||
r->add("", 1); r->add(0, 2); r->add(0, 3);
|
||||
r->add(0L, 4); r->add("", 5); r->add("", 6);
|
||||
r->add("", 7); r->add("", 8); r->add("", 9);
|
||||
}
|
||||
}
|
||||
|
||||
void TRighe_rcaus::add_riga(int i, char tipocf,
|
||||
char sez, const char * des, const char * desagg, bool rigaiva,
|
||||
const char * codiva, TConto& tc)
|
||||
{
|
||||
Riga_rcaus *r = (Riga_rcaus*)objptr(i);
|
||||
int g=0,c=0;
|
||||
long s=0L;
|
||||
|
||||
if (r == NULL)
|
||||
{
|
||||
r = new Riga_rcaus (tc,"",tipocf,sez,des,desagg,rigaiva,codiva);
|
||||
add(r,i); // ???
|
||||
}
|
||||
|
||||
g = tc.gruppo();
|
||||
c = tc.conto();
|
||||
s = tc.sottoconto();
|
||||
r->add(tipocf, 1);
|
||||
r->add((long)g, 2);
|
||||
r->add((long)c, 3);
|
||||
r->add((long)s, 4);
|
||||
r->add(sez, 5);
|
||||
r->add(des, 6);
|
||||
r->add(desagg, 7);
|
||||
r->add(rigaiva ? "X" : "", 8);
|
||||
r->add(codiva, 9);
|
||||
}
|
||||
|
||||
void TRighe_rcaus::set_descr(int i, const char * dfi, char tipocf)
|
||||
{
|
||||
Riga_rcaus *r = (Riga_rcaus*)objptr(i);
|
||||
TConto tc;
|
||||
|
||||
if (r == NULL)
|
||||
{
|
||||
if (r == NULL) {
|
||||
r = new Riga_rcaus (tc,dfi,tipocf);
|
||||
add(r,i);
|
||||
}
|
||||
@ -213,12 +172,12 @@ typedef enum { acquisto, vendita, incasso_pagamento,
|
||||
friend bool filtra_reg(const TRelation * r);
|
||||
|
||||
static bool tipocf_hndl (TMask_field& f, KEY k);
|
||||
// static bool m770_hndl (TMask_field& f, KEY k);
|
||||
static bool cod_reg_hndl (TMask_field& f, KEY k);
|
||||
static bool tipodoc_hndl (TMask_field& f, KEY k);
|
||||
static bool tipomov_hndl (TMask_field& f, KEY k);
|
||||
static bool conto_hndl (TMask_field& f, KEY k);
|
||||
static bool sottoconto_hndl (TMask_field& f, KEY k);
|
||||
static bool codcausim_hndl (TMask_field& f, KEY k);
|
||||
static bool leggi_riga (int r, KEY k);
|
||||
|
||||
TRelation * _rel;
|
||||
@ -231,11 +190,8 @@ typedef enum { acquisto, vendita, incasso_pagamento,
|
||||
void togli_dal_file(const TString&);
|
||||
|
||||
void read_rcaus(TMask&);
|
||||
bool descr2array(TMask&);
|
||||
bool descr2array2(TMask&);
|
||||
bool descr2array(TMask&, bool fromHandler = TRUE);
|
||||
bool fill_sheet(TMask&);
|
||||
static bool has_iva (const char * tpc);
|
||||
bool is_clifo(const char * tpc);
|
||||
|
||||
protected:
|
||||
virtual bool user_create();
|
||||
@ -264,9 +220,12 @@ public:
|
||||
void compilaarray (const TString&, int, int, int);
|
||||
void array2sheet(); // Copia le descrizioni dall'array allo sheet
|
||||
|
||||
TMask * main_mask() const { return _msk; }
|
||||
TMask & ss_mask() const { return ss().sheet_mask(); }
|
||||
TMask* main_mask() const { return _msk; }
|
||||
TMask& ss_mask() const { return ss().sheet_mask(); }
|
||||
TSheet_field& ss() const { return (TSheet_field&)_msk->field(F_SHEET_GCS);}
|
||||
void add_riga (int numrig, char cf, char sz, TString& d, TString& da,
|
||||
bool riva, TString& civa, TConto& tc);
|
||||
bool MostraCampi(TMask_field& f);
|
||||
|
||||
CG0500_application() {}
|
||||
};
|
||||
@ -330,78 +289,61 @@ bool filtra_reg(const TRelation * r)
|
||||
}
|
||||
|
||||
|
||||
bool CG0500_application::has_iva (const char * tpconto)
|
||||
{
|
||||
TFixed_string tpc(tpconto);
|
||||
|
||||
// Lascio abilitato codiva e rigaiva solo per i conti senza descr.fissa
|
||||
if (tpc.trim().empty())
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG0500_application::is_clifo (const char * tpconto)
|
||||
{
|
||||
TFixed_string tpc(tpconto);
|
||||
if ( (tpc == "C Clienti/Fornitori") || (tpc == "C Clienti") ||
|
||||
(tpc == "C Fornitori") )
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Handler della maschera principale
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
// if (k == K_TAB)
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
// if (k == K_TAB && f.focusdirty())
|
||||
// Testo K_TAB perche' il controllo deve scattare anche all'inizio
|
||||
// per vedere, per es., se il registro scritto nella causale
|
||||
// esiste ancora
|
||||
if (k == K_TAB)
|
||||
{
|
||||
const TString16 val(f.get());
|
||||
const int tpm = f.mask().get_int(F_TIPO_MOV);
|
||||
|
||||
TEdit_field& field_reg = (TEdit_field&)f.mask().field(F_COD_REG);
|
||||
|
||||
if (val.not_empty() && val != "IN" && val != "PG" && val != "AN")
|
||||
{
|
||||
f.mask().show(F_OP_FINE_ANNO);
|
||||
f.mask().show(F_M_770);
|
||||
if (salda_conto()) {
|
||||
f.mask().hide(F_TIPO_MOV_2);
|
||||
f.mask().show(F_TIPO_MOV_1);
|
||||
}
|
||||
f.mask().enable(F_COD_REG);
|
||||
field_reg.check_type(CHECK_REQUIRED);
|
||||
|
||||
// Cambio il filtro sui registri
|
||||
// con tipo=1
|
||||
if (val == "FV" || val == "FF" || val == "FS")
|
||||
{
|
||||
// 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")
|
||||
{
|
||||
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")
|
||||
{
|
||||
val == "AF") {
|
||||
app()->_filtro = 4;
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
}
|
||||
|
||||
} else
|
||||
// con tipo=2
|
||||
if (val == "FA" || val == "BD")
|
||||
{
|
||||
if (val == "FA" || val == "BD") {
|
||||
app()->_filtro = 3;
|
||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||
}
|
||||
|
||||
// Ma davvero esiste il registro ?
|
||||
TString16 codreg=f.mask().get(F_COD_REG);
|
||||
if (codreg.not_empty())
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
else // TIPODOC vuoto || IN || PG || AN
|
||||
{
|
||||
@ -410,50 +352,97 @@ bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
|
||||
|
||||
f.mask().set(F_COD_REG,"");
|
||||
f.mask().disable(F_COD_REG);
|
||||
if (salda_conto()) {
|
||||
f.mask().hide(F_TIPO_MOV_1);
|
||||
f.mask().show(F_TIPO_MOV_2);
|
||||
|
||||
if ( !salda_conto() || tpm == 0 )
|
||||
{
|
||||
f.mask().show(F_OP_FINE_ANNO);
|
||||
f.mask().show(F_M_770);
|
||||
}
|
||||
else
|
||||
{
|
||||
f.mask().hide(F_OP_FINE_ANNO);
|
||||
f.mask().hide(F_M_770);
|
||||
}
|
||||
}
|
||||
if (f.focusdirty()) {
|
||||
app()->fill_sheet(f.mask());
|
||||
app()->MostraCampi(f); // show-hide di diversi campi pilotati da codreg
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (f.to_check(k))
|
||||
{
|
||||
const int tpm = atoi(f.get());
|
||||
if (tpm > 0)
|
||||
{
|
||||
if ( (tpm == 3) || (tpm == 5) || (tpm == 6) )
|
||||
f.mask().enable(F_MOV_SEZ);
|
||||
else
|
||||
f.mask().disable(F_MOV_SEZ);
|
||||
}
|
||||
if (k == K_TAB)
|
||||
if (k == K_SPACE) {
|
||||
app()->MostraCampi(f);
|
||||
app()->fill_sheet(f.mask());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Il codice causale per incasso immediato, se specificato, deve
|
||||
// essere puramente contabile (= codreg vuoto e tpm = Nessuno
|
||||
bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
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);
|
||||
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",
|
||||
(const char *) causim);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
bool CG0500_application::MostraCampi(TMask_field& f)
|
||||
{
|
||||
const int tpm = f.mask().get_int(F_TIPO_MOV);
|
||||
TString16 codreg = f.mask().get(F_COD_REG);
|
||||
if (codreg.empty())
|
||||
{
|
||||
switch (tpm) {
|
||||
case 0:
|
||||
f.mask().show(F_OP_FINE_ANNO);
|
||||
f.mask().hide(F_MOV_VALU);
|
||||
f.mask().hide(F_MOV_SEZ);
|
||||
break;
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
f.mask().hide(F_OP_FINE_ANNO);
|
||||
f.mask().show(F_MOV_VALU);
|
||||
f.mask().show(F_MOV_SEZ);
|
||||
f.mask().hide(F_COLL_CESP);
|
||||
break;
|
||||
default:
|
||||
f.mask().show(F_COLL_CESP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { // codreg non vuoto
|
||||
f.mask().hide(F_OP_FINE_ANNO);
|
||||
f.mask().hide(F_MOV_SEZ);
|
||||
if (gestione_valuta())
|
||||
f.mask().show(F_MOV_VALU);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
app()->fill_sheet(f.mask());
|
||||
// if (k == K_TAB && f.focusdirty())
|
||||
if (k == K_TAB)
|
||||
{
|
||||
app()->MostraCampi(f);
|
||||
if (f.focusdirty()) app()->fill_sheet(f.mask());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// controllo di consistenza tra codice (tipo) registro e tipo documento
|
||||
if (k == K_ENTER && f.dirty())
|
||||
// if (k == K_ENTER && f.dirty())
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
|
||||
@ -464,7 +453,8 @@ bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
||||
|
||||
if (tpd.not_empty() && tpd != "AN" && tpd != "PG" && tpd != "IN")
|
||||
{
|
||||
if (codreg.empty()) ok = FALSE;
|
||||
if (codreg.empty())
|
||||
return f.warning_box("Manca il codice del registro");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -500,14 +490,6 @@ bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* ???
|
||||
bool CG0500_application::m770_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
app()->fill_sheet(f.mask());
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Handler della maschera dello spreadsheet
|
||||
@ -594,26 +576,17 @@ bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Handler del campo tipocf ? della maschera di edit dello sheet
|
||||
// Handler del campo tipocf della maschera di edit dello sheet
|
||||
// Abilita 109 e 110 (rigaiva e codiva) SOLO SE registro 1 o 2
|
||||
// Controlla all'uscita che il tipo C/F vada bene per la riga corrente
|
||||
// in questo modo:
|
||||
// se tpr==1 NON accetta nelle righe 1 o 7 il tipo F
|
||||
// se tpr==2 NON accetta nelle righe 1 o 7 il tipo C
|
||||
// nelle righe sopra la 10 sono libero
|
||||
//
|
||||
bool CG0500_application::tipocf_hndl (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TString16 cf(f.get());
|
||||
const int tpr = app()->main_mask()->get_int(F_TIPO_REG);
|
||||
if (tpr == 1 || tpr == 2)
|
||||
{
|
||||
if (tpr == 1 || tpr == 2) {
|
||||
f.mask().enable(109); f.mask().enable(110);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
f.mask().disable(109); f.mask().disable(110);
|
||||
}
|
||||
}
|
||||
@ -621,7 +594,7 @@ bool CG0500_application::tipocf_hndl (TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Funzioni che caricano le varie descrizioni fisse
|
||||
// Funzioni che caricano le varie descrizioni fisse nell'array
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void TRighe_rcaus::CausaleVendite()
|
||||
{
|
||||
@ -733,7 +706,7 @@ void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int
|
||||
|
||||
bool CG0500_application::fill_sheet(TMask& m)
|
||||
{
|
||||
descr2array2(m);
|
||||
descr2array(m);
|
||||
array2sheet();
|
||||
return TRUE;
|
||||
}
|
||||
@ -741,12 +714,25 @@ bool CG0500_application::fill_sheet(TMask& m)
|
||||
int CG0500_application::read(TMask& m)
|
||||
{
|
||||
m.autoload(_rel);
|
||||
descr2array(m);
|
||||
descr2array(m, FALSE);
|
||||
array2sheet();
|
||||
read_rcaus(m);
|
||||
return NOERR;
|
||||
}
|
||||
|
||||
void CG0500_application::add_riga(int numrig,
|
||||
char cf, char sz, TString& d, TString& da, bool riva,
|
||||
TString& civa, TConto& tc)
|
||||
{
|
||||
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(riva ? "X" : "", 8);
|
||||
riga.add(civa, 9);
|
||||
}
|
||||
|
||||
void CG0500_application::read_rcaus(TMask& m)
|
||||
{
|
||||
int numrig, g, c;
|
||||
@ -755,7 +741,6 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
char sz, cf;
|
||||
bool riva;
|
||||
TLocalisamfile * rcaus = _rel->lfile(LF_RCAUSALI);
|
||||
TSheet_field& cs = ss();
|
||||
|
||||
_rel->update(); // chiamo position_rels()
|
||||
|
||||
@ -770,22 +755,16 @@ void CG0500_application::read_rcaus(TMask& m)
|
||||
g = rcaus->get_int(RCA_GRUPPO);
|
||||
c = rcaus->get_int(RCA_CONTO);
|
||||
s = rcaus->get_long(RCA_SOTTOCONTO);
|
||||
sz = rcaus->get(RCA_SEZIONE)[0];
|
||||
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(RCA_TIPOCF)[0];
|
||||
cf = rcaus->get_char(RCA_TIPOCF);
|
||||
riva = rcaus->get_bool(RCA_RIGAIVA);
|
||||
civa = rcaus->get(RCA_CODIVA);
|
||||
TConto tc(g,c,s,cf);
|
||||
TToken_string & riga = cs.row(numrig-1);
|
||||
riga.add(cf, 1); riga.add(g, 2); riga.add(c, 3); riga.add(s,4);
|
||||
riga.add(sz, 5); riga.add(d, 6); riga.add(da,7);
|
||||
riga.add(riva ? "X" : "", 8);
|
||||
riga.add(civa, 9);
|
||||
|
||||
// _righe_rcaus.add_riga(numrig-1, cf, sz, d, da, riva, civa, tc);
|
||||
// g.right_just(3); c.right_just(3); s.right_just(6);
|
||||
// _righe_rcaus.add_riga(numrig-1,"",g,c,s,sz,d,da,tc,riva,civa);
|
||||
add_riga(numrig-1, cf, sz, d, da, riva, civa, tc);
|
||||
|
||||
_righe_gia_presenti.set(numrig);
|
||||
ok = _rel->next_match(LF_RCAUSALI);
|
||||
@ -802,7 +781,6 @@ void CG0500_application::array2sheet()
|
||||
for (int i = 0; i < _items; i++)
|
||||
{
|
||||
TToken_string & riga = ss().row(i);
|
||||
// Riga_rcaus * r = (Riga_rcaus*)_righe_rcaus.objptr(i);
|
||||
TToken_string * r = (TToken_string*)_righe_rcaus.objptr(i);
|
||||
if (r != NULL)
|
||||
{
|
||||
@ -815,37 +793,13 @@ void CG0500_application::array2sheet()
|
||||
ss().force_update();
|
||||
}
|
||||
|
||||
bool CG0500_application::descr2array2(TMask& m)
|
||||
bool CG0500_application::descr2array(TMask& m, bool fromHandler)
|
||||
{
|
||||
TLocalisamfile& caus = *_rel->lfile();
|
||||
TString16 tpd, codreg;
|
||||
int tpm, m770, tpr;
|
||||
|
||||
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);
|
||||
/*
|
||||
TString16 chiave; chiave << anno_iva() << codreg;
|
||||
TTable reg("REG");
|
||||
reg.put("CODTAB", chiave);
|
||||
reg.read();
|
||||
tpr = reg.get_int("I0");
|
||||
*/
|
||||
tpr = m.get_int(F_TIPO_REG);
|
||||
// carico le descrizioni fisse nell'array Righe_rcaus
|
||||
compilaarray(tpd,tpm,tpr,m770);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG0500_application::descr2array(TMask& m)
|
||||
{
|
||||
TLocalisamfile& caus = *_rel->lfile();
|
||||
TString16 tpd, codreg;
|
||||
int tpm, m770;
|
||||
|
||||
if (m.mode() == MODE_MOD)
|
||||
if (m.mode() == MODE_MOD && !fromHandler)
|
||||
{
|
||||
codreg = caus.get("REG");
|
||||
tpd = caus.get("TIPODOC");
|
||||
@ -860,11 +814,16 @@ bool CG0500_application::descr2array(TMask& m)
|
||||
m770 = m.get_int(F_M_770);
|
||||
}
|
||||
|
||||
if (fromHandler)
|
||||
tpr = m.get_int(F_TIPO_REG);
|
||||
else
|
||||
{
|
||||
TString16 chiave; chiave << anno_iva() << codreg;
|
||||
TTable reg("REG");
|
||||
reg.put("CODTAB", chiave);
|
||||
reg.read();
|
||||
int tpr = reg.get_int("I0");
|
||||
tpr = reg.get_int("I0");
|
||||
}
|
||||
|
||||
// carico le descrizioni fisse nell'array Righe_rcaus
|
||||
compilaarray(tpd,tpm,tpr,m770);
|
||||
@ -886,7 +845,9 @@ void CG0500_application::togli_dal_file(const TString& cau)
|
||||
rcaus->zero();
|
||||
rcaus->put(RCA_CODCAUS,cau);
|
||||
rcaus->put(RCA_NRIGA, i);
|
||||
if (rcaus->read() == NOERR)
|
||||
rcaus->remove();
|
||||
_righe_gia_presenti.reset(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -933,14 +894,14 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
||||
if (g > 0 || c > 0 || s > 0L)
|
||||
{
|
||||
rcaus->zero();
|
||||
rcaus->put (RCA_CODCAUS, cau);
|
||||
rcaus->put (RCA_CODCAUS, (const char *)cau);
|
||||
rcaus->put (RCA_NRIGA, i+1); // Numerare da uno!
|
||||
rcaus->put (RCA_GRUPPO , g);
|
||||
rcaus->put (RCA_CONTO , c);
|
||||
rcaus->put (RCA_SOTTOCONTO, s);
|
||||
rcaus->put (RCA_SEZIONE, sezione);
|
||||
rcaus->put (RCA_DESC , desc);
|
||||
rcaus->put (RCA_CODDESC, coddesc);
|
||||
rcaus->put (RCA_DESC , (const char *)desc);
|
||||
rcaus->put (RCA_CODDESC, (const char *)coddesc);
|
||||
rcaus->put (RCA_TIPOCF, tipo_cf);
|
||||
if (rewrite)
|
||||
{
|
||||
@ -1069,26 +1030,28 @@ 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);
|
||||
_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);
|
||||
}
|
||||
|
||||
if (!gestione_valuta()) _msk->hide (F_MOV_VALU);
|
||||
if (gestione_valuta())
|
||||
_msk->show (F_MOV_VALU);
|
||||
else
|
||||
_msk->hide (F_MOV_VALU);
|
||||
|
||||
_msk->set_handler(F_TIPO_DOC, tipodoc_hndl);
|
||||
_msk->set_handler(F_TIPO_MOV_1, tipomov_hndl);
|
||||
_msk->set_handler(F_TIPO_MOV_2, tipomov_hndl);
|
||||
_msk->set_handler(F_COD_REG, cod_reg_hndl);
|
||||
// _msk->set_handler(F_M_770, m770_hndl);
|
||||
_msk->set_handler(F_COD_CAUS_IM, codcausim_hndl);
|
||||
|
||||
//
|
||||
// Handler del campo GRUPPO della maschera di edit dello sheet.
|
||||
// Uso per abilitare il campo C/F per alcuni tipi di conti.
|
||||
//
|
||||
TSheet_field& cs = ss();
|
||||
cs.set_notify(leggi_riga);
|
||||
|
||||
|
@ -60,8 +60,8 @@ BEGIN
|
||||
OUTPUT F_TIPO_DOC CODTAB
|
||||
HELP "Tipo documento"
|
||||
CHECKTYPE NORMAL
|
||||
MESSAGE SHOW, 2@
|
||||
MESSAGE EMPTY HIDE, 2@
|
||||
// MESSAGE SHOW, 2@
|
||||
// MESSAGE EMPTY HIDE, 2@
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
@ -158,7 +158,7 @@ PAGE "" -1 -1 77 20
|
||||
|
||||
GROUPBOX DLG_NULL -1 3
|
||||
BEGIN
|
||||
PROMPT 1 0 "Campi obbligatori in caricamento documenti"
|
||||
PROMPT 1 0 "@BCampi obbligatori in caricamento documenti"
|
||||
END
|
||||
|
||||
BOOLEAN F_DATA_DOC
|
||||
@ -186,7 +186,7 @@ END
|
||||
|
||||
BOOLEAN F_ALLEGAT
|
||||
BEGIN
|
||||
PROMPT 34 4 "Documento in allegati"
|
||||
PROMPT 34 4 "Doc. non va in allegati fine anno"
|
||||
FIELD LF_CAUSALI->ALLEG
|
||||
GROUP 2
|
||||
END
|
||||
@ -207,7 +207,7 @@ BEGIN
|
||||
COPY DISPLAY F_COD_CAUS
|
||||
OUTPUT F_COD_CAUS_IM CODCAUS
|
||||
CHECKTYPE NORMAL
|
||||
MESSAGE CLEAR, F_M_770
|
||||
// MESSAGE CLEAR, F_M_770
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
@ -215,8 +215,8 @@ BOOLEAN F_OP_INTRACOM
|
||||
BEGIN
|
||||
PROMPT 2 8 "Operazione intracomunitaria"
|
||||
FIELD LF_CAUSALI->INTRACOM
|
||||
MESSAGE TRUE "X", F_MOV_VALU | DISABLE, F_MOV_VALU
|
||||
MESSAGE FALSE "", F_MOV_VALU | ENABLE, F_MOV_VALU
|
||||
// MESSAGE TRUE "X", F_MOV_VALU | DISABLE, F_MOV_VALU
|
||||
// MESSAGE FALSE "", F_MOV_VALU | ENABLE, F_MOV_VALU
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
@ -238,7 +238,7 @@ BOOLEAN F_MOV_SEZ
|
||||
BEGIN
|
||||
PROMPT 34 10 "Movimento solo sezionale"
|
||||
FIELD LF_CAUSALI->MOVSEZ
|
||||
FLAGS "D"
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
LISTBOX F_OP_FINE_ANNO 1 10
|
||||
@ -275,13 +275,13 @@ BEGIN
|
||||
PROMPT 2 16 "Collegamento Mod.770 "
|
||||
FIELD LF_CAUSALI->M770
|
||||
HELP "Inserire il tipo di collegamento Mod.770"
|
||||
ITEM " |Nessuno" MESSAGE ENABLE,F_COD_CAUS_IM
|
||||
ITEM "1|Ricevuta e/o pagamento fattura percip." MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "2|Versamento ritenute percip." MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "3|Versamento ritenute dipendente" MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "4|Versamento contributi dipendente" MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "5|Compensi non soggetti" MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "6|Ritenute per operazioni occasionali" MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM " |Nessuno" // MESSAGE ENABLE,F_COD_CAUS_IM
|
||||
ITEM "1|Ricevuta e/o pagamento fattura percip." // MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "2|Versamento ritenute percip." // MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "3|Versamento ritenute dipendente" // MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "4|Versamento contributi dipendente" // MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "5|Compensi non soggetti" // MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
ITEM "6|Ritenute per operazioni occasionali" // MESSAGE CLEAR,F_COD_CAUS_IM
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#include "cg0500.h"
|
||||
|
||||
PAGE "" -1 -1 68 11
|
||||
@ -39,7 +40,7 @@ BEGIN
|
||||
// CHECKTYPE REQUIRED
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 1
|
||||
ADD RUN CG0 -1
|
||||
ADD RUN CG0 -0
|
||||
END
|
||||
|
||||
NUMBER 104 3
|
||||
@ -59,7 +60,7 @@ BEGIN
|
||||
OUTPUT 103 GRUPPO
|
||||
OUTPUT 107 DESCR
|
||||
WARNING "Conto inesistente o mancante"
|
||||
ADD RUN CG0 -1
|
||||
ADD RUN CG0 -0
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
@ -80,7 +81,7 @@ BEGIN
|
||||
OUTPUT 104 CONTO
|
||||
OUTPUT 105 SOTTOCONTO
|
||||
OUTPUT 107 DESCR
|
||||
ADD RUN CG0 -1
|
||||
ADD RUN CG0 -0
|
||||
CHECKTYPE NORMAL
|
||||
GROUP 1
|
||||
END
|
||||
@ -137,6 +138,7 @@ BEGIN
|
||||
ITEM "A|Avere"
|
||||
FIELD LF_RCAUSALI->SEZIONE
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING 107 50
|
||||
|
@ -60,9 +60,8 @@ class CG3200_application : public TPrintapp
|
||||
|
||||
bool _stampaprogre,_stampatotiva,_stampatot,_prima_volta,_stampa_mov_prov;
|
||||
|
||||
int _annomsk,_annoesmsk,_annoes,_annomsksucc;
|
||||
long _sottoc,_numreg,_protiva,_numgio;
|
||||
|
||||
long _annomsk,_annoesmsk,_sottoc,_numreg,_annoes;
|
||||
long _annomsksucc,_numgio,_protiva;
|
||||
bool _stampa_progressivi_si,_competenza,_inizio_stampa,_puoi_stampare;
|
||||
int _tipocf;
|
||||
char _ricerca;
|
||||
@ -438,7 +437,7 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
||||
_mov->curr().zero();
|
||||
_mov->curr().put(MOV_NUMREG,_numreg);
|
||||
_mov->read();
|
||||
_annoes = _mov->get_int(MOV_ANNOES);
|
||||
_annoes = atol(_mov->curr().get(MOV_ANNOES));
|
||||
_regiva = _mov->curr().get(MOV_REG);
|
||||
|
||||
// Controlla se saldo e' diverso da 0
|
||||
@ -468,7 +467,7 @@ bool CG3200_application::preprocess_pconti(int file, int counter)
|
||||
_numdoc = _mov->curr().get(MOV_NUMDOC);
|
||||
descrizione_causale();
|
||||
_descrizionemov = _mov->curr().get(MOV_DESCR);
|
||||
_numgio = _mov->get_long(MOV_NUMGIO);
|
||||
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
|
||||
if (_sezione == "D")
|
||||
{
|
||||
_totale_periodo_dare += _importo;
|
||||
@ -592,7 +591,7 @@ bool CG3200_application::preprocess_clifo(int file, int counter)
|
||||
_mov->curr().zero();
|
||||
_mov->curr().put(MOV_NUMREG,_numreg);
|
||||
_mov->read();
|
||||
_annoes = _mov->get_int(MOV_ANNOES);
|
||||
_annoes = atol(_mov->curr().get(MOV_ANNOES));
|
||||
_regiva = _mov->curr().get(MOV_REG);
|
||||
|
||||
// Controlla se saldo e' diverso da 0
|
||||
@ -622,7 +621,7 @@ bool CG3200_application::preprocess_clifo(int file, int counter)
|
||||
_numdoc = _mov->curr().get(MOV_NUMDOC);
|
||||
descrizione_causale();
|
||||
_descrizionemov = _mov->curr().get(MOV_DESCR);
|
||||
_numgio = _mov->get_int(MOV_NUMGIO);
|
||||
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
|
||||
if (_sezione == "D")
|
||||
{
|
||||
_totale_periodo_dare += _importo;
|
||||
@ -929,7 +928,7 @@ bool CG3200_application::set_print(int)
|
||||
_data_ini = (_msk->get(F_DATAINI));
|
||||
_data_fine = (_msk->get(F_DATAFINE));
|
||||
|
||||
_annomsk = _msk->get_int(F_ANNO);
|
||||
_annomsk = atol(_msk->get(F_ANNO));
|
||||
|
||||
if (_annomsk == 0)
|
||||
if (_data_fine == botime) //Se data_fine e' vuota
|
||||
@ -1000,7 +999,7 @@ bool CG3200_application::set_print(int)
|
||||
a.put(PCN_CONTO,contofine);
|
||||
a.put(PCN_SOTTOCONTO,sottocontofine);
|
||||
|
||||
current_cursor()->setregion(da, a);
|
||||
current_cursor()->setregion(&da, &a);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1030,7 +1029,7 @@ bool CG3200_application::set_print(int)
|
||||
a.put(CLI_CONTO,contofine);
|
||||
a.put(CLI_CODCF,sottocontofine);
|
||||
|
||||
current_cursor()->setregion(da, a);
|
||||
current_cursor()->setregion(&da, &a);
|
||||
}
|
||||
|
||||
if (_stampatotiva)
|
||||
|
448
cg/cg4400.cpp
448
cg/cg4400.cpp
@ -6,7 +6,7 @@
|
||||
|
||||
TFixed_string TMP (__tmp, MAXSTR);
|
||||
|
||||
HIDDEN CG4400_application * app() { return (CG4400_application*) MainApp(); }
|
||||
CG4400_application * app() { return (CG4400_application*) MainApp(); }
|
||||
|
||||
bool filter_func (const TRelation * r)
|
||||
{
|
||||
@ -17,9 +17,11 @@ bool filter_func (const TRelation * r)
|
||||
if (codreg != app()->_codreg || annoes != app()->_annoes)
|
||||
return FALSE;
|
||||
|
||||
if (app()->_stampa_tutti_i_registri)
|
||||
if ( (app()->_tipo_reg != 1) && (app()->_tipo_reg != 2) )
|
||||
return FALSE;
|
||||
|
||||
//Non puo' essere che _tipo_reg sia diverso da 1 o 2, nel caso di stampa tutti i registri !
|
||||
//if (app()->_stampa_tutti_i_registri)
|
||||
// if ( (app()->_tipo_reg != 1) && (app()->_tipo_reg != 2) )
|
||||
// return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -36,9 +38,12 @@ HIDDEN int compare(const TObject** o1, const TObject** o2)
|
||||
{
|
||||
TRigaiva* r1 = (TRigaiva*)*o1;
|
||||
TRigaiva* r2 = (TRigaiva*)*o2;
|
||||
TString16 campo1; campo1.format("%d%4s", r1->_tipodet, (const char*)r1->_codiva);
|
||||
TString16 campo2; campo2.format("%d%4s", r2->_tipodet, (const char*)r2->_codiva);
|
||||
return (strcmp(campo1, campo2));
|
||||
TString campo1;
|
||||
TString campo2;
|
||||
|
||||
campo1.format("%d%4s", r1->_tipodet, (const char*)r1->_codiva);
|
||||
campo2.format("%d%4s", r2->_tipodet, (const char*)r2->_codiva);
|
||||
return (strcmp((const char*)campo1, (const char*)campo2));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -60,6 +65,8 @@ bool mask_select (TMask_field& f, KEY k)
|
||||
// build sheet
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
f.mask().field(DA_CODICE).set("");
|
||||
f.mask().field(A_CODICE).set("");
|
||||
app()->_ditte->destroy(); chk = 0l;
|
||||
for (i = 0; i < app()->_nomiditte.items(); i++)
|
||||
{
|
||||
@ -158,9 +165,9 @@ bool mask_cod (TMask_field& f, KEY k)
|
||||
TabLbu.read();
|
||||
if ( TabLbu.good() )
|
||||
{
|
||||
f.mask().set(MESE,TabLbu.get_long("I0")+1);
|
||||
// f.mask().set(MESE,TabLbu.get_long("I0")+1);
|
||||
f.mask().set(ULTIMO_MESE,TabLbu.get_long("I0"));
|
||||
f.mask().set(ULTIMA_PAGINA,TabLbu.get("I1"));
|
||||
f.mask().set(ULTIMA_PAGINA,TabLbu.get_long("I1"));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -168,7 +175,8 @@ bool mask_cod (TMask_field& f, KEY k)
|
||||
|
||||
bool mask_fino_a_mese (TMask_field& f, KEY k)
|
||||
{
|
||||
if ( (k == K_TAB) && f.mask().is_running() )
|
||||
//if ( (k == K_TAB) && f.mask().is_running() )
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
TTable TabReg ("REG");
|
||||
TString16 codtab;
|
||||
@ -188,7 +196,8 @@ bool mask_fino_a_mese (TMask_field& f, KEY k)
|
||||
--primo;
|
||||
giorni_del_mese = primo.day();
|
||||
}
|
||||
TDate datasup = format("%02d/%02d/%4d",giorni_del_mese,fino_a_mese,anno); if (codreg != "")
|
||||
TDate datasup = format("%02d/%02d/%4d",giorni_del_mese,fino_a_mese,anno);
|
||||
if (codreg != "")
|
||||
{
|
||||
TabReg.zero();
|
||||
codtab << anno << codreg;
|
||||
@ -199,7 +208,7 @@ bool mask_fino_a_mese (TMask_field& f, KEY k)
|
||||
TDate data = TabReg.get_date("D3");
|
||||
if (datasup < data)
|
||||
{
|
||||
TString16 datas = format("02d/%4d", data.month(), data.year());
|
||||
TString16 datas = format("%02d/%4d", data.month(), data.year());
|
||||
f.warning_box ("La data specificata non deve essere inferiore al %s (ultima data di stampa specificata sul registro)", (const char*)datas);
|
||||
return FALSE;
|
||||
}
|
||||
@ -221,7 +230,7 @@ bool mask_fino_a_mese (TMask_field& f, KEY k)
|
||||
TDate data = TabReg.get_date("D3");
|
||||
if (datasup > data)
|
||||
{
|
||||
TString16 datas = format("02d/%4d", data.month(), data.year());
|
||||
TString16 datas = format("%02d/%4d", data.month(), data.year());
|
||||
f.warning_box ("La data specificata non deve essere superiore al %s (ultima data di stampa del libro giornale)", (const char*)datas);
|
||||
return FALSE;
|
||||
}
|
||||
@ -295,7 +304,6 @@ const char * CG4400_application::descr_doc(const char * tipo)
|
||||
TString codtab = format ("%-2s", tipo);
|
||||
|
||||
tab_tpd.zero();
|
||||
|
||||
tab_tpd.put("CODTAB", codtab);
|
||||
if (tab_tpd.read()==NOERR)
|
||||
TMP = tab_tpd.get("S0");
|
||||
@ -311,7 +319,6 @@ const char * CG4400_application::descr_iva(const char * cod)
|
||||
TString codtab = format ("%-4s", cod);
|
||||
|
||||
tab_iva.zero();
|
||||
|
||||
tab_iva.put("CODTAB", codtab);
|
||||
if (tab_iva.read()==NOERR)
|
||||
TMP = tab_iva.get("S0");
|
||||
@ -378,13 +385,15 @@ void CG4400_application::user_create()
|
||||
_tab = new TLocalisamfile(LF_TAB);
|
||||
_tabcom = new TLocalisamfile(LF_TABCOM);
|
||||
_tabreg = new TTable("REG");
|
||||
_tablbu = new TTable("%LBU");
|
||||
_tabinl = new TTable("%INL");
|
||||
_clifo = new TLocalisamfile(LF_CLIFO);
|
||||
_occas = new TLocalisamfile(LF_OCCAS);
|
||||
_rel = new TRelation (LF_MOV);
|
||||
_rel->add(LF_CAUSALI,"CODCAUS=CODCAUS",1,LF_MOV);
|
||||
_rel->add(LF_RMOVIVA,"NUMREG=NUMREG",1,LF_MOV);
|
||||
_cur = new TCursor(_rel, "", 1);
|
||||
_cur->set_filterfunction(filter_func);
|
||||
//_cur->set_filterfunction(filter_func);
|
||||
|
||||
add_cursor(_cur);
|
||||
add_file(LF_MOV);
|
||||
@ -571,28 +580,98 @@ bool CG4400_application::controlla_liquidazione()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*controlla che i movimenti con data di registrazione compresa tra l'anno precednte e l'ultima data stampata siano tutti gia' stati stampati*/
|
||||
//controlla che i movimenti con data di registrazione compresa tra l'anno precedente e l'ultima data stampata siano tutti gia' stati stampati in forma definitiva*/
|
||||
bool CG4400_application::controlla_mov()
|
||||
{
|
||||
TLocalisamfile mov (LF_MOV);
|
||||
bool stampato, ok = TRUE;
|
||||
bool ok = TRUE;
|
||||
byte tipo;
|
||||
TDate udata;
|
||||
TDate data = format("01/01/%4d", _annoes - 1);
|
||||
TRecnotype rec = _tabreg->recno();
|
||||
for (mov.first(); !mov.eof(); mov.next())
|
||||
{
|
||||
TString16 reg = mov.get(MOV_REG);
|
||||
TDate datareg = mov.get_date(MOV_DATAREG);
|
||||
if (_stampa_tutti_i_registri)
|
||||
cerca_reg (reg, tipo, udata);
|
||||
else udata = _data_da;
|
||||
if ( (_stampa_tutti_i_registri && ((tipo == 1)||(tipo == 2)))
|
||||
|| ((!_stampa_tutti_i_registri)&&(reg == _codreg)) )
|
||||
if ( (datareg >= data) && (datareg <= udata) )
|
||||
{
|
||||
bool stampato = mov.get_bool(MOV_STAMPATO);
|
||||
long numreg = mov.get_long(MOV_NUMREG);
|
||||
if (!stampato)
|
||||
{
|
||||
warning_box("Il movimento con numero di registrazione %ld non e' ancora stato stampato in forma definitiva!", numreg);
|
||||
ok = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
_tabreg->readat(rec);
|
||||
return ok;
|
||||
}
|
||||
|
||||
void CG4400_application::cerca_reg(const TString& c, byte& t, TDate& d)
|
||||
{
|
||||
TString16 cod = "";
|
||||
|
||||
cod << _annoes << c;
|
||||
_tabreg->zero();
|
||||
_tabreg->put("CODTAB", cod);
|
||||
if (_tabreg->read() == NOERR)
|
||||
{
|
||||
t = _tabreg->get_int ("I0");
|
||||
d = _tabreg->get_date("D3");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool CG4400_application::controlla_mov()
|
||||
{
|
||||
bool ok = TRUE;
|
||||
|
||||
if (_stampa_tutti_i_registri)
|
||||
{
|
||||
TRecnotype rec = _tabreg->recno();//la first l'ho gia' fatta
|
||||
for (; !_tabreg->eof(); _tabreg->next())
|
||||
{
|
||||
TString codtab = _tabreg->get("CODTAB");
|
||||
int anno = atoi(codtab.mid(0,4));
|
||||
if (anno != _annoes) break;
|
||||
|
||||
TDate data_da = _tabreg->get_date("D3");
|
||||
TString16 codreg = codtab.mid(4,3);
|
||||
leggi_movimenti(data_da, codreg, ok);
|
||||
}
|
||||
_tabreg->readat(rec);
|
||||
}
|
||||
else
|
||||
leggi_movimenti(_data_da, _codreg, ok);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
void CG4400_application::leggi_movimenti(const TDate& d, const TString& cod, bool& ok)
|
||||
{
|
||||
TLocalisamfile mov (LF_MOV);
|
||||
bool stampato;
|
||||
long numreg;
|
||||
TString codreg;
|
||||
|
||||
TDate data = format("01/01/%4d", _annoes - 1);
|
||||
mov.zero();
|
||||
TRectype a (mov.curr());
|
||||
TDate data = format("01/01/%4d", _annoes - 1);
|
||||
mov.put(MOV_DATAREG, data);
|
||||
a.put (MOV_DATAREG, _data_da);
|
||||
a.put (MOV_DATAREG, d);
|
||||
mov.read(_isgteq);
|
||||
while (mov.curr() < a && !mov.eof())
|
||||
{
|
||||
stampato = mov.get_bool(MOV_STAMPATO);
|
||||
numreg = mov.get_long(MOV_NUMREG);
|
||||
if (!_stampa_tutti_i_registri)
|
||||
codreg = mov.get(MOV_REG);
|
||||
else codreg = "";
|
||||
if (codreg == _codreg)
|
||||
if (codreg == cod)
|
||||
if (!stampato)
|
||||
{
|
||||
warning_box("Il movimento con numero di registrazione %ld non e' ancora stato stampato in forma definitiva!", numreg);
|
||||
@ -600,8 +679,8 @@ bool CG4400_application::controlla_mov()
|
||||
}
|
||||
mov.next();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void CG4400_application::set_page_tot_reg()
|
||||
{
|
||||
@ -767,6 +846,93 @@ void CG4400_application::set_page_tot_reg()
|
||||
}
|
||||
}
|
||||
|
||||
bool CG4400_application::compila_reg()
|
||||
{
|
||||
byte tipo;
|
||||
int anno;
|
||||
long codditta = _nditte->get_long("CODDITTA");
|
||||
_codtab = "";
|
||||
|
||||
if (_codreg.trim().empty())
|
||||
{
|
||||
_stampa_tutti_i_registri = TRUE;
|
||||
for (_tabreg->first(); !_tabreg->eof(); _tabreg->next())
|
||||
{
|
||||
_codtab = _tabreg->get("CODTAB");
|
||||
tipo = _tabreg->get_int("I0");
|
||||
anno = atoi(_codtab.mid(0,4));
|
||||
if (anno > _annoes)
|
||||
{
|
||||
warning_box("Non esistono registri IVA della Ditta %ld per l'anno %d",
|
||||
codditta, _annoes);
|
||||
return FALSE;
|
||||
}
|
||||
if (anno == _annoes)
|
||||
{
|
||||
if ( tipo == 1 || tipo == 2 ) //registro iva
|
||||
{
|
||||
_codreg = _codtab.mid(4,3);
|
||||
_tipo_reg = _tabreg->get_int("I0");
|
||||
_pagine_stampate = _tabreg->get_int("I1");
|
||||
_data_da = _tabreg->get_date ("D3");
|
||||
_codatt = _tabreg->get("S8");
|
||||
_attivita = desc_attivita(_codatt);
|
||||
_desc_lib = _tabreg->get ("S0");
|
||||
break;
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // stampa un solo registro
|
||||
{
|
||||
_stampa_tutti_i_registri = FALSE;
|
||||
_codtab << _annoes << _codreg;
|
||||
_tabreg->zero();
|
||||
_tabreg->put("CODTAB", _codtab);
|
||||
if (_tabreg->read() == NOERR)
|
||||
{
|
||||
_tipo_reg = _tabreg->get_int("I0");
|
||||
_pagine_stampate = _tabreg->get_int("I1");
|
||||
//_pagine_numerate = tab_reg.get_int("I2");
|
||||
//_stampa_ok = tab_reg.get_int("I7");
|
||||
//_nprog_da = tab_reg.get_long ("I6");
|
||||
//_tot_dare = tab_reg.get_real ("R1")
|
||||
//_tot_avere = tab_reg.get_real ("R2");
|
||||
_data_da = _tabreg->get_date ("D3");
|
||||
//_stampa_intesta = _tabreg->get_bool ("B9");
|
||||
_codatt = _tabreg->get("S8");
|
||||
_attivita = desc_attivita(_codatt);
|
||||
_desc_lib = _tabreg->get ("S0");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
warning_box("Il registro IVA specificato non esiste nella \n Ditta %ld", codditta, _annoes);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;;
|
||||
}
|
||||
|
||||
bool CG4400_application::compila_lib()
|
||||
{
|
||||
TTable tab_lib ("%LBU");
|
||||
TString16 cod;
|
||||
|
||||
cod << _annoes << _codlib;
|
||||
tab_lib.zero();
|
||||
tab_lib.put("CODTAB", cod);
|
||||
|
||||
if (tab_lib.read() == NOERR)
|
||||
{
|
||||
_stampa_ind_ditta = tab_lib.get_bool("B1");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::preprocess_print(int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
@ -777,50 +943,31 @@ bool CG4400_application::preprocess_print(int file, int counter)
|
||||
_doc_array.destroy();
|
||||
_dataregp = "";
|
||||
_mov_empty = TRUE;
|
||||
_primast = get_page_number();
|
||||
set_print_zero();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::compila_reg()
|
||||
{
|
||||
TTable tab_reg ("REG");
|
||||
|
||||
tab_reg.zero();
|
||||
tab_reg.put("CODTAB", _codtab);
|
||||
|
||||
if (tab_reg.read() == NOERR)
|
||||
{
|
||||
_tipo_reg = tab_reg.get_int("I0");
|
||||
// _pagine_stampate = tab_reg.get_int("I1");
|
||||
// _pagine_numerate = tab_reg.get_int("I2");
|
||||
//_stampa_ok = tab_reg.get_int("I7");
|
||||
//_nprog_da = tab_reg.get_long ("I6");
|
||||
//_tot_dare = tab_reg.get_real ("R1")
|
||||
//_tot_avere = tab_reg.get_real ("R2");
|
||||
_data_da = tab_reg.get_date ("D3");
|
||||
//_stampa_intesta = tab_reg.get_bool ("B9");
|
||||
_codatt = tab_reg.get("S8");
|
||||
_attivita = desc_attivita(_codatt);
|
||||
_desc_lib = tab_reg.get ("S0");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
if (counter) return TRUE;
|
||||
int rr = 0;
|
||||
TString ragsoc;
|
||||
TString tipo_op = "";
|
||||
|
||||
TLocalisamfile* mov = _cur->file(LF_MOV);
|
||||
TLocalisamfile* caus = _cur->file(LF_CAUSALI);
|
||||
|
||||
long annoes = mov->get_long(MOV_ANNOES);
|
||||
TString16 codreg = mov->get(MOV_REG);
|
||||
_datareg = mov->get_date(MOV_DATAREG);
|
||||
|
||||
if (codreg != _codreg || annoes != _annoes)
|
||||
return FALSE;
|
||||
|
||||
if (_data_da.string() != "" && _data_a.string() != "")
|
||||
if ( (_datareg < _data_da || _datareg > _data_a) || (!_datareg.ok()) )
|
||||
return FALSE;
|
||||
@ -841,11 +988,20 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
char tipocf = mov->get(MOV_TIPO)[0];
|
||||
TString ocfpi = mov->get(MOV_OCFPI);
|
||||
long codcf = mov->get_long(MOV_CODCF);
|
||||
long numgio = mov->get_long(MOV_NUMGIO);
|
||||
bool stampato = mov->get_bool(MOV_STAMPATO);
|
||||
bool intra = caus->get_bool(CAU_INTRACOM);
|
||||
bool autof = caus->get_bool(CAU_AUTOFATT);
|
||||
TString descrcau = caus->get(CAU_DESCR);
|
||||
|
||||
//aggiornamento di mov
|
||||
if (_tipo_stampa != 3)
|
||||
if (!stampato)
|
||||
{
|
||||
mov->put(MOV_STAMPATO,TRUE);
|
||||
mov->rewrite();
|
||||
}
|
||||
|
||||
if ( intra && autof)
|
||||
tipo_op = "3";
|
||||
else if (intra)
|
||||
@ -903,31 +1059,163 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
if (stampato)
|
||||
set_row(_r, "@131g*");
|
||||
}
|
||||
if (_tipo_stampa == 4) //stampa con riferimento al libro giornale
|
||||
set_row(_r, "@125g%ld", numgio);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::aggiorna_reg()
|
||||
{
|
||||
TString16 codtab;
|
||||
TTable Tabreg ("REG");
|
||||
TTable TabInl ("%INL");
|
||||
long stampate, pag;
|
||||
|
||||
const word ultimast = get_page_number();
|
||||
|
||||
codtab << _annoes << _codreg;
|
||||
Tabreg.zero();
|
||||
Tabreg.put("CODTAB", codtab);
|
||||
if (Tabreg.read() == NOERR)
|
||||
{
|
||||
stampate = ultimast - _primast + 1;
|
||||
if (!_mov_empty) //cioe' se e' stata stampata almeno una pagina
|
||||
{
|
||||
pag = _pagine_stampate + stampate;
|
||||
Tabreg.put("I1", pag);
|
||||
}
|
||||
Tabreg.put("D3", _data_a);
|
||||
Tabreg.rewrite();
|
||||
}
|
||||
if (_tipo_stampa == 2) //stampa su libro unico
|
||||
//sulla tabella %inl (indice libro unico) devo generare una riga per ogni registro stampato
|
||||
{
|
||||
bool trovato = FALSE;
|
||||
codtab = "";
|
||||
codtab << _annoes << _codlib;
|
||||
TabInl.zero();
|
||||
TRectype nuovo (TabInl.curr());
|
||||
TRectype recprec (TabInl.curr());
|
||||
TabInl.put("CODTAB", codtab);
|
||||
|
||||
TRectype rec (TabInl.curr());
|
||||
TabInl.read (_isgteq);
|
||||
for (; !TabInl.eof(); TabInl.next())
|
||||
{
|
||||
if (TabInl.curr() != rec) break;
|
||||
|
||||
trovato = TRUE;
|
||||
recprec = TabInl.curr();
|
||||
}
|
||||
|
||||
TString16 cod;
|
||||
if (trovato)
|
||||
{
|
||||
TString16 cod_inl = recprec.get("CODTAB");
|
||||
long numero_riga = atol(cod_inl.mid(7,6));
|
||||
cod_inl = cod_inl.mid(0,7);
|
||||
nuovo = recprec;
|
||||
cod << cod_inl << numero_riga + 1;
|
||||
}
|
||||
else
|
||||
cod << codtab << 1L;
|
||||
|
||||
long numini = _pagine_stampate + 1;
|
||||
nuovo.put("CODTAB", cod);
|
||||
nuovo.put("I0", _annoes);
|
||||
nuovo.put("I1", _fino_a_mese);
|
||||
nuovo.put("I2", _primast);
|
||||
nuovo.put("I3", ultimast);
|
||||
nuovo.put("I4", get_firm());
|
||||
nuovo.put("S0", _codreg);
|
||||
nuovo.put("I5", numini);
|
||||
nuovo.put("I6", pag);
|
||||
|
||||
TabInl.write(nuovo);
|
||||
}
|
||||
}
|
||||
|
||||
void CG4400_application::aggiorna_lib()
|
||||
{
|
||||
TString16 cod;
|
||||
TTable lbu ("%LBU");
|
||||
|
||||
const word stampate = get_page_number();
|
||||
|
||||
cod << _annoes << _codlib;
|
||||
lbu.zero();
|
||||
lbu.put("CODTAB", cod);
|
||||
if (lbu.read() == NOERR)
|
||||
{
|
||||
lbu.put("I0", _fino_a_mese);
|
||||
lbu.put("I1", stampate);
|
||||
lbu.rewrite();
|
||||
}
|
||||
}
|
||||
|
||||
print_action CG4400_application::postprocess_page (int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
TLocalisamfile* mov = _cur->file(LF_MOV);
|
||||
_cur->save_status();
|
||||
++(*_cur);
|
||||
_dataregs = mov->get_date(MOV_DATAREG);
|
||||
--(*_cur);
|
||||
_cur->restore_status();
|
||||
|
||||
if (_dataregs.month() != _dataregp.month())
|
||||
{
|
||||
set_page_tot_reg();
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
}
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
print_action CG4400_application::postprocess_print(int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
//aggiorna registri solo se non e' stampa di prova
|
||||
if (_tipo_stampa != 3)
|
||||
aggiorna_reg();
|
||||
if (_stampa_tutti_i_registri)
|
||||
{
|
||||
TString16 codtab;
|
||||
int anno, tipo;
|
||||
//vado avanti dal punto in cui sono
|
||||
_tabreg->next();
|
||||
TString codtab = _tabreg->get("CODTAB");
|
||||
int anno = atoi(codtab.mid(0,4));
|
||||
for (; !_tabreg->eof(); _tabreg->next())
|
||||
{
|
||||
tipo = _tabreg->get_int("I0");
|
||||
if ( (tipo == 1) || (tipo == 2) ) //registro iva
|
||||
{
|
||||
codtab = _tabreg->get("CODTAB");
|
||||
anno = atoi(codtab.mid(0,4));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( (_tabreg->eof()) || (anno != _annoes) )
|
||||
{
|
||||
if (_tipo_stampa == 2) //stampa su libro unico
|
||||
aggiorna_lib();
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tipo_reg = _tabreg->get_int("I0");
|
||||
_desc_lib = _tabreg->get("S0");
|
||||
_data_da = _tabreg->get_date("D3");
|
||||
_pagine_stampate = _tabreg->get_int("I1");
|
||||
_codreg = codtab.mid(4,3);
|
||||
_primast = get_page_number();
|
||||
if (!_mov_empty )
|
||||
printer().formfeed();
|
||||
_cur->set_filterfunction(NULL);
|
||||
_cur->set_filterfunction(filter_func);
|
||||
// (*_cur) = 0L;
|
||||
_mov_empty = TRUE;
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
@ -951,8 +1239,8 @@ print_action CG4400_application::postprocess_print(int file, int counter)
|
||||
else if ( (_tipo_stampa == 1) || (_tipo_stampa == 4) )
|
||||
{
|
||||
TLocalisamfile* mov = _cur->file(LF_MOV);
|
||||
/*
|
||||
TDate dataregp = mov->get_date(MOV_DATAREG);
|
||||
|
||||
_cur->save_status();
|
||||
++(*_cur);
|
||||
TDate datareg = mov->get_date(MOV_DATAREG);
|
||||
@ -963,9 +1251,15 @@ print_action CG4400_application::postprocess_print(int file, int counter)
|
||||
set_page_tot_reg();
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_dataregp.month() != _dataregs.month())
|
||||
{
|
||||
set_page_tot_reg();
|
||||
return REPEAT_PAGE;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
@ -984,6 +1278,7 @@ bool CG4400_application::set_print(int n)
|
||||
else if (_tipo_stampa == 3) //stampa di prova
|
||||
_codreg = m.get(CODICE_LIBRO_PROVA);
|
||||
else _codreg = m.get(CODICE_LIBRO);
|
||||
/*
|
||||
if (_codreg.trim().empty())
|
||||
{
|
||||
_tabreg->first();
|
||||
@ -992,8 +1287,11 @@ bool CG4400_application::set_print(int n)
|
||||
_stampa_tutti_i_registri = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_codtab << _annoes << _codreg;
|
||||
_stampa_tutti_i_registri = FALSE;
|
||||
|
||||
}
|
||||
**/
|
||||
//Se stampa di prova l'utente indica data_da e data_a
|
||||
if (_tipo_stampa == 3)
|
||||
{
|
||||
@ -1011,8 +1309,12 @@ bool CG4400_application::set_print(int n)
|
||||
{
|
||||
if ( (_tipo_stampa == 1) || (_tipo_stampa == 4) )
|
||||
_fino_a_mese = m.get_int(FINO_A_MESE);
|
||||
else
|
||||
else //stampa su libro unico
|
||||
{
|
||||
_codlib = m.get(CODICE_LIB_UN);
|
||||
_fino_a_mese = m.get_int(MESE);
|
||||
set_page_number(m.get_int(ULTIMA_PAGINA) + 1);
|
||||
}
|
||||
if (_fino_a_mese == 12)
|
||||
giorni_del_mese = 31;
|
||||
else
|
||||
@ -1024,10 +1326,9 @@ bool CG4400_application::set_print(int n)
|
||||
_data_a=format("%02d/%02d/%4d",giorni_del_mese,_fino_a_mese,_annoes);
|
||||
// NB data_da viene letta nella preprocess_page
|
||||
}
|
||||
_codtab = format("%4d%-3s",_annoes, (const char *)_codreg);
|
||||
compila_reg();
|
||||
//if ( (_tipo_stampa == 1) || (_tipo_stampa == 4) )
|
||||
|
||||
// compila_reg();
|
||||
if (_tipo_stampa == 2)
|
||||
compila_lib();
|
||||
stampa_registri_IVA();
|
||||
}
|
||||
else warning_box("Nessuna ditta selezionata!");
|
||||
@ -1045,6 +1346,9 @@ void CG4400_application::stampa_registri_IVA()
|
||||
if (_selected[l])
|
||||
{
|
||||
TApplication::set_firm(_nditte->get_long("CODDITTA"));
|
||||
ok = compila_reg(); // cerca il primo registro valido (nel caso di stampa tutti i registri), senno' legge i dati del registro specificato
|
||||
if (!ok) continue;
|
||||
_cur->set_filterfunction(filter_func);
|
||||
_frequiva = _nditte->get("FREQVIVA")[0];
|
||||
if (_tipo_stampa != 3) //stampa definitiva
|
||||
ok = controlla_liquidazione() && controlla_mov();
|
||||
@ -1086,8 +1390,8 @@ bool CG4400_application::set_ditte(TMask& m)
|
||||
int CG4400_application::stampa_intestazione_ditta()
|
||||
{
|
||||
TDati_ditta tditta(get_firm(), _stampa_width);
|
||||
TString riga (tditta.prima_riga());
|
||||
int r=1;
|
||||
TString riga(tditta.prima_riga());
|
||||
|
||||
set_header (r, "%s", (const char *) riga);
|
||||
r++;
|
||||
@ -1152,9 +1456,13 @@ else
|
||||
else
|
||||
{
|
||||
set_header(r,"@10gNum.@19gDocumento@68gT Tipo@103gCod %s@121g@124gT", (const char*) nd1);
|
||||
if (_tipo_stampa == 4) //stampa definitiva con rif. al libro giornale
|
||||
set_header(r, "@127gNumero");
|
||||
r++;
|
||||
set_header(r, "Data reg. prot.@17gData@25gNumero Codice Ragione sociale/descrizione@68gO Doc.@76gTotale doc.@91gImponibile Iva %s@112gImposta@124g%s",
|
||||
(const char*) nd2, (const char*) cor);
|
||||
if (_tipo_stampa == 4)
|
||||
set_header(r, "@127goperaz");
|
||||
r++;
|
||||
}
|
||||
riga.fill('-');
|
||||
@ -1169,3 +1477,15 @@ int cg4400 (int argc, char * argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
20
cg/cg4400.h
20
cg/cg4400.h
@ -12,6 +12,7 @@
|
||||
#include <urldefid.h>
|
||||
#include <sheet.h>
|
||||
#include <config.h>
|
||||
|
||||
#include <nditte.h>
|
||||
#include <anagr.h>
|
||||
#include <comuni.h>
|
||||
@ -20,6 +21,7 @@
|
||||
#include <clifo.h>
|
||||
#include <occas.h>
|
||||
#include <causali.h>
|
||||
|
||||
#include "cglib03.h"
|
||||
|
||||
const int MAXSTR = 128;
|
||||
@ -68,23 +70,23 @@ class CG4400_application : public TPrintapp
|
||||
TCursor * _cur;
|
||||
TRelation *_rel;
|
||||
TLocalisamfile *_clifo, *_nditte, *_occas, *_tab, *_tabcom;
|
||||
TTable *_tabreg;
|
||||
TTable *_tabreg, *_tablbu, *_tabinl;
|
||||
TRigaiva_array _iva_array, _riga_rmi;
|
||||
TTipodoc_array _doc_array;
|
||||
TRiga_array _tot_iva_array;
|
||||
TArray_sheet *_ditte;
|
||||
TBit_array _selected;
|
||||
TArray _nomiditte; //array descrizioni ditte per sheet
|
||||
bool _riferim, _mov_empty;
|
||||
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri;
|
||||
char _frequiva;
|
||||
TDate _data_da, _data_a, _data_stampa, _dataregp, _datareg;
|
||||
TDate _data_da, _data_a, _data_stampa, _dataregp, _dataregs, _datareg;
|
||||
long _annoes, _n_ditte;
|
||||
int _riepil, _tipo_reg, _fino_a_mese, _tipo_stampa;
|
||||
word _primast;
|
||||
int _riepil, _tipo_reg, _fino_a_mese, _tipo_stampa, _pagine_stampate;
|
||||
int _r, _stampa_width; // riga corrente di stampa
|
||||
real _totale_doc;
|
||||
TString _codreg, _desc_lib, _codatt, _attivita;
|
||||
TString _codtab, _tipodoc, _descr_doc;
|
||||
bool _stampa_tutti_i_registri;
|
||||
TString _codtab, _tipodoc, _descr_doc, _codlib;
|
||||
|
||||
public:
|
||||
const char* desc_attivita (const char * codatt);
|
||||
@ -97,10 +99,15 @@ public:
|
||||
bool set_print(int);
|
||||
bool set_ditte(TMask&);
|
||||
bool compila_reg();
|
||||
bool compila_lib();
|
||||
bool controlla_liquidazione();
|
||||
bool controlla_mov();
|
||||
void cerca_reg(const TString&, byte&, TDate&);
|
||||
//void leggi_movimenti(const TDate&, const TString&, bool&);
|
||||
void stampa_registri_IVA();
|
||||
void set_page_tot_reg();
|
||||
void aggiorna_reg();
|
||||
void aggiorna_lib();
|
||||
void calcola_progressivi(real&, real&, const char*, const int);
|
||||
void user_create();
|
||||
void user_destroy();
|
||||
@ -108,6 +115,7 @@ public:
|
||||
int stampa_intestazione_ditta();
|
||||
bool preprocess_print(int, int);
|
||||
print_action postprocess_print(int, int);
|
||||
print_action postprocess_page (int, int);
|
||||
void preprocess_header();
|
||||
|
||||
CG4400_application() : TPrintapp(),_ditte(NULL),_selected(10000),
|
||||
|
@ -42,10 +42,11 @@ BEGIN
|
||||
PROMPT 21 2 "Da codice "
|
||||
HELP "Immettere codice ditta di partenza per la selezione"
|
||||
USE LF_NDITTE KEY 1
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODDITTA DA_CODICE
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
OUTPUT DA_CODICE CODDITTA
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
NUMBER A_CODICE 6
|
||||
@ -53,8 +54,9 @@ BEGIN
|
||||
PROMPT 21 3 "A codice "
|
||||
HELP "Immettere codice ditta di fine selezione"
|
||||
COPY USE DA_CODICE
|
||||
DISPLAY "Codice" CODDITTA
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODDITTA A_CODICE
|
||||
COPY DISPLAY DA_CODICE
|
||||
OUTPUT A_CODICE CODDITTA
|
||||
END
|
||||
|
||||
@ -99,7 +101,7 @@ STRING CODICE_LIBRO 3
|
||||
BEGIN
|
||||
PROMPT 20 7 "Codice libro "
|
||||
HELP "Specificare il codice libro di cui si chiede la stampa; nel caso in cui non si indichi nessun codice verranno stampati tutti i libri delle ditte selezionate"
|
||||
USE REG SELECT (I0<"3") && (S7=="") && (CODTAB[1,4]==#111)
|
||||
USE REG SELECT (I0<"3") && (S6=="") && (CODTAB[1,4]==#111)
|
||||
INPUT CODTAB[1,4] ANNO
|
||||
INPUT CODTAB[5,7] CODICE_LIBRO
|
||||
DISPLAY "Anno " CODTAB[1,4]
|
||||
@ -107,8 +109,8 @@ BEGIN
|
||||
DISPLAY "Descrizione @40" S0
|
||||
OUTPUT ANNO CODTAB[1,4]
|
||||
OUTPUT CODICE_LIBRO CODTAB[5,7]
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "R"
|
||||
//CHECKTYPE NORMAL
|
||||
FLAGS "UR"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
@ -124,14 +126,15 @@ BEGIN
|
||||
DISPLAY "Descrizione @40" S0
|
||||
OUTPUT ANNO CODTAB[1,4]
|
||||
OUTPUT CODICE_LIBRO CODTAB[5,7]
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "R"
|
||||
//CHECKTYPE NORMAL
|
||||
FLAGS "UR"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING CODICE_LIB_UN 3
|
||||
BEGIN
|
||||
PROMPT 20 7 "Cod.libro unico "
|
||||
HELP "Specificare il codice del libro unico su cui deve essere effettuata la stampa"
|
||||
USE %LBU SELECT CODTAB[1,4]==#111
|
||||
INPUT CODTAB[1,4] ANNO
|
||||
INPUT CODTAB[5,7] CODICE_LIB_UN
|
||||
@ -140,7 +143,7 @@ BEGIN
|
||||
DISPLAY "Descrizione @40" S0
|
||||
OUTPUT ANNO CODTAB[1,4]
|
||||
OUTPUT CODICE_LIB_UN CODTAB[5,7]
|
||||
FLAGS "R"
|
||||
FLAGS "UR"
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 2
|
||||
END
|
||||
@ -179,6 +182,7 @@ END
|
||||
LISTBOX TIPO_RIEPILOGATIVO 11
|
||||
BEGIN
|
||||
PROMPT 2 12 "Tipo riepilogativo "
|
||||
HELP "Selezionare Del periodo/Annuale a seconda che si desideri la stampa della liquidazione periodica/annuale"
|
||||
ITEM "P|Del periodo"
|
||||
ITEM "A|Annuale"
|
||||
GROUP 1
|
||||
@ -202,7 +206,7 @@ STRING CODICE_LIBRO_IVA 3
|
||||
BEGIN
|
||||
PROMPT 2 15 "Eventuale codice libro IVA "
|
||||
HELP "Se non viene indicato nessun cod. libro IVA, vengono stampati tutti i registri delle ditte selezionate"
|
||||
USE REG SELECT (I0<"3") && (S7=="") && (CODTAB[1,4]==#111)
|
||||
USE REG SELECT (I0<"3") && (S6=="") && (CODTAB[1,4]==#111)
|
||||
INPUT CODTAB[1,4] ANNO
|
||||
INPUT CODTAB[5,7] CODICE_LIBRO_IVA
|
||||
DISPLAY "Anno " CODTAB[1,4]
|
||||
@ -210,8 +214,8 @@ BEGIN
|
||||
DISPLAY "Descrizione @40" S0
|
||||
OUTPUT ANNO CODTAB[1,4]
|
||||
OUTPUT CODICE_LIBRO_IVA CODTAB[5,7]
|
||||
CHECKTYPE NORMAL
|
||||
FLAGS "R"
|
||||
//CHECKTYPE NORMAL
|
||||
FLAGS "UR"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
|
939
cg/cg4600.cpp
939
cg/cg4600.cpp
File diff suppressed because it is too large
Load Diff
120
cg/cglib01.cpp
120
cg/cglib01.cpp
@ -41,15 +41,16 @@ TClifo_list::TClifo_list(int g, int c, char tipocf)
|
||||
|
||||
Saldo::Saldo()
|
||||
{
|
||||
_saldo_iniziale = 0.00;
|
||||
_prg_dare = 0.00;
|
||||
_prg_avere = 0.00;
|
||||
_saldo = 0.00;
|
||||
_saldo_iniziale = ZERO;
|
||||
_prg_dare = ZERO;
|
||||
_prg_avere = ZERO;
|
||||
_saldo = ZERO;
|
||||
_indbil = 0;
|
||||
_saldi = new TLocalisamfile(LF_SALDI);
|
||||
_mov = new TLocalisamfile(LF_MOV);
|
||||
_rmov = new TLocalisamfile(LF_RMOV);
|
||||
_clifo = new TLocalisamfile(LF_CLIFO);
|
||||
_rec = new TRectype(LF_SALDI);
|
||||
}
|
||||
|
||||
Saldo::~Saldo()
|
||||
@ -58,13 +59,15 @@ Saldo::~Saldo()
|
||||
delete _mov;
|
||||
delete _rmov;
|
||||
delete _clifo;
|
||||
delete _rec;
|
||||
}
|
||||
|
||||
real Saldo::saldofin_esprec(int annoes, int g, int c, long s)
|
||||
{
|
||||
real saldo,pdare,pavere,pdaresca,paveresca;
|
||||
char flag;
|
||||
|
||||
TLocalisamfile& saldi = *_saldi;
|
||||
TRecnotype numrec = saldi.recno();
|
||||
TRectype app = ricerca_progr_prec(annoes-1, g, c, s);
|
||||
|
||||
flag = app.get(SLD_FLAGSALINI)[0];
|
||||
@ -73,9 +76,12 @@ real Saldo::saldofin_esprec(int annoes, int g, int c, long s)
|
||||
pavere = app.get_real(SLD_PAVERE);
|
||||
pdaresca = app.get_real(SLD_PDARESCA);
|
||||
paveresca = app.get_real(SLD_PAVERESCA);
|
||||
|
||||
saldi.readat(numrec);
|
||||
|
||||
if (flag == 'D')
|
||||
return saldo+pdaresca-paveresca+pdare-pavere;//saldo finale es. precedente;
|
||||
else //if (flag == 'A')
|
||||
return saldo+pdaresca-paveresca+pdare-pavere;
|
||||
else
|
||||
return pdaresca-saldo-paveresca+pdare-pavere;
|
||||
}
|
||||
|
||||
@ -256,26 +262,23 @@ bool Saldo::calcola_ultima_immissione(int annoes, int annoesprec, int g, int c,
|
||||
long s, int indbil)
|
||||
{
|
||||
//Si considerano i saldi e non piu' i movimenti
|
||||
|
||||
char sezione;
|
||||
int gruppo, conto, annoe;
|
||||
long sottoconto;
|
||||
real saldo, pdare, pavere;
|
||||
TLocalisamfile& saldi = *_saldi;
|
||||
bool esito = FALSE;
|
||||
bool esito = TRUE;
|
||||
|
||||
_saldo_iniziale = ZERO;
|
||||
_prg_dare = ZERO;
|
||||
_prg_avere = ZERO;
|
||||
_saldo = ZERO;
|
||||
|
||||
_saldo_iniziale = 0.00;
|
||||
_prg_dare = 0.00;
|
||||
_prg_avere = 0.00;
|
||||
saldi.zero();
|
||||
|
||||
if (annoes != 0)
|
||||
saldi.put(SLD_ANNOES,annoes);
|
||||
if (g != 0)
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
if (c != 0)
|
||||
saldi.put(SLD_CONTO,c);
|
||||
if (s != 0)
|
||||
saldi.put(SLD_SOTTOCONTO,s);
|
||||
if (annoes != 0) saldi.put(SLD_ANNOES,annoes);
|
||||
if (g != 0) saldi.put(SLD_GRUPPO,g);
|
||||
if (c != 0) saldi.put(SLD_CONTO,c);
|
||||
if (s != 0) saldi.put(SLD_SOTTOCONTO,s);
|
||||
|
||||
if (saldi.read() == NOERR)
|
||||
{
|
||||
@ -283,55 +286,41 @@ long s, int indbil)
|
||||
gruppo = saldi.get_int(SLD_GRUPPO);
|
||||
conto = saldi.get_int(SLD_CONTO);
|
||||
sottoconto = saldi.get_long(SLD_SOTTOCONTO);
|
||||
saldo = saldi.get_real(SLD_SALDO);
|
||||
pdare = saldi.get_real(SLD_PDARE);
|
||||
pavere = saldi.get_real(SLD_PAVERE);
|
||||
_saldo_iniziale = saldi.get_real(SLD_SALDO);
|
||||
_prg_dare = saldi.get_real(SLD_PDARE);
|
||||
_prg_avere = saldi.get_real(SLD_PAVERE);
|
||||
sezione = saldi.get_char(SLD_FLAGSALINI);
|
||||
|
||||
if (sezione == 'A') _saldo_iniziale = -_saldo_iniziale;
|
||||
|
||||
if (annoesprec == 0) //all'ultima immissione es.in corso
|
||||
{
|
||||
if ( (pdare == 0)&&(pavere == 0.0) )
|
||||
{
|
||||
if ( (indbil == 3) || (indbil == 4) )
|
||||
return esito;
|
||||
// if (indbil == 3 || indbil == 4)
|
||||
// return esito;
|
||||
|
||||
if ( (indbil == 1) || (indbil == 2) || (indbil == 5) )
|
||||
{
|
||||
if (saldo == 0)
|
||||
{
|
||||
saldo = saldofin_esprec(annoes,gruppo,conto,sottoconto);
|
||||
if (saldo == 0.00)
|
||||
return esito;
|
||||
}
|
||||
_saldo_iniziale = saldo;
|
||||
}
|
||||
}
|
||||
else _saldo_iniziale = saldo;
|
||||
|
||||
esito = TRUE;
|
||||
_prg_dare = pdare;
|
||||
_prg_avere = pavere;
|
||||
if (indbil == 1 || indbil == 2 || indbil == 5)
|
||||
if (_saldo_iniziale == ZERO)
|
||||
_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);
|
||||
pdare = app.get_real(SLD_PDARE);
|
||||
pavere = app.get_real(SLD_PAVERE);
|
||||
_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);
|
||||
if ( (pdare == 0) && (pavere == 0) )
|
||||
return esito;
|
||||
|
||||
esito = TRUE;
|
||||
_prg_dare = pdare;
|
||||
_prg_avere = pavere;
|
||||
_saldo = pdare - pavere;
|
||||
_saldo = _prg_dare - _prg_avere;
|
||||
}
|
||||
}
|
||||
return esito;
|
||||
@ -342,23 +331,18 @@ TRectype& Saldo::ricerca_progr_prec (int annoesprec, int g, int c, long s)
|
||||
TLocalisamfile& saldi = *_saldi;
|
||||
|
||||
saldi.zero();
|
||||
static TRectype rec(saldi.curr());
|
||||
// static TRectype rec(saldi.curr());
|
||||
|
||||
if (annoesprec != 0)
|
||||
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);
|
||||
if (annoesprec != 0) 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);
|
||||
|
||||
saldi.read();
|
||||
if (saldi.bad())
|
||||
saldi.zero();
|
||||
if (saldi.bad()) saldi.zero();
|
||||
|
||||
rec = saldi.curr();
|
||||
return rec;
|
||||
*_rec = saldi.curr();
|
||||
return *_rec;
|
||||
}
|
||||
|
||||
//calcolo dei progressivi attuali
|
||||
|
Loading…
x
Reference in New Issue
Block a user