Corretto errore 1176 sulle causali (cambiamento da FV a FA o viceversa)
1126 (gestione conti sulle righe) Corretta registrazione tipo attivita nelle righe IVA della prima nota git-svn-id: svn://10.65.10.50/trunk@450 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7f3881bc8e
commit
93bd116018
333
cg/cg0500.cpp
333
cg/cg0500.cpp
@ -57,7 +57,7 @@ HIDDEN int anno_iva()
|
|||||||
if (_anno_iva < 1900)
|
if (_anno_iva < 1900)
|
||||||
{
|
{
|
||||||
_anno_iva = TDate(TODAY).year();
|
_anno_iva = TDate(TODAY).year();
|
||||||
error_box("Anno liquidazione IVA non specificato: assumo %d", _anno_iva);
|
error_box("Nei parametri ditta manca l'anno liquidazione IVA: assumo %d", _anno_iva);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _anno_iva;
|
return _anno_iva;
|
||||||
@ -67,7 +67,7 @@ HIDDEN int anno_iva()
|
|||||||
//
|
//
|
||||||
// Le righe di causale:
|
// Le righe di causale:
|
||||||
//
|
//
|
||||||
// Righe_rcaus e' un array di Riga_rcaus.
|
// Righe_rcaus e' un array di TRiga_caus.
|
||||||
//
|
//
|
||||||
// - NB - Contiene solo le descrizioni fisse!
|
// - NB - Contiene solo le descrizioni fisse!
|
||||||
//
|
//
|
||||||
@ -77,46 +77,48 @@ HIDDEN int anno_iva()
|
|||||||
// descrizioni) nello spreadsheet.
|
// descrizioni) nello spreadsheet.
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
class Riga_rcaus : public TToken_string
|
class TRiga_caus : public TToken_string
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const TString& operator = (const TString& s)
|
const TString& operator = (const TString& s)
|
||||||
{return TToken_string::operator=(s);}
|
{return TToken_string::operator=(s);}
|
||||||
|
|
||||||
Riga_rcaus (TConto& tc, // il conto
|
TRiga_caus (TConto& tc, // il conto
|
||||||
const char *df="", // descrizione fissa
|
const char *df="", // descrizione fissa
|
||||||
char tipocf=' ', // tipo C/F
|
char tipocf=' ', // tipo C/F
|
||||||
char sezione=' ', // dare/avere
|
char sezione=' ', // dare/avere
|
||||||
const char * des="", // descrizione del conto
|
const char * des="", // descrizione del conto
|
||||||
const char * desagg="", // codice descr. aggiuntiva
|
const char * desagg="", // codice descr. aggiuntiva
|
||||||
bool rigaiva=' ', // se e' una riga iva
|
char rigaiva=' ', // se e' una riga iva
|
||||||
const char * codiva=""); // codice iva
|
const char * codiva=""); // codice iva
|
||||||
};
|
};
|
||||||
|
|
||||||
Riga_rcaus::Riga_rcaus (TConto& tc,const char * df, char tipocf, char sez,
|
TRiga_caus::TRiga_caus (TConto& tc,const char * df, char tipocf, char sez,
|
||||||
const char * des, const char * desagg,
|
const char * des, const char * desagg,
|
||||||
bool rigaiva, const char * codiva)
|
char rigaiva, const char * codiva)
|
||||||
: TToken_string(128)
|
: TToken_string(128)
|
||||||
{
|
{
|
||||||
add(df); add(tipocf);
|
add(df); add(tipocf);
|
||||||
// add(tc.tipo());
|
// add(tc.tipo());
|
||||||
if (tc.ok()) {
|
if (tc.ok())
|
||||||
add((long)tc.gruppo()); add((long)tc.conto());
|
{
|
||||||
add((long)tc.sottoconto());
|
add(tc.gruppo());
|
||||||
|
add(tc.conto());
|
||||||
|
add(tc.sottoconto());
|
||||||
}
|
}
|
||||||
else {
|
else add(" | | ");
|
||||||
add(""); add(""); add("");
|
add(sez); add(des);
|
||||||
}
|
add(desagg);
|
||||||
add(sez); add(des); add(desagg);
|
add(rigaiva);
|
||||||
add((char)rigaiva); add(codiva);
|
add(codiva);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TRighe_rcaus : public TArray
|
class TRighe_rcaus : public TArray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void set_descr (int numrig=-1, const char * descr="", char tipocf=' ');
|
void set_descr (int numrig=-1, const char * descr="");
|
||||||
void clear(int riga); // pulisce una riga in seguito ad Azzera
|
void clear(int riga); // pulisce una riga in seguito ad Azzera
|
||||||
void ClearDescr(); // cancella solo le descrizioni fisse
|
void clear_descr(); // cancella solo le descrizioni fisse
|
||||||
void CaricaRigheLibere();
|
void CaricaRigheLibere();
|
||||||
void CausaleIncassoPagamento();
|
void CausaleIncassoPagamento();
|
||||||
void CausaleRitenutaOccas ();
|
void CausaleRitenutaOccas ();
|
||||||
@ -125,40 +127,42 @@ public:
|
|||||||
TRighe_rcaus() : TArray(20) {}
|
TRighe_rcaus() : TArray(20) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TRighe_rcaus::ClearDescr()
|
void TRighe_rcaus::clear_descr()
|
||||||
{
|
{
|
||||||
for (int i=0; i < items(); i++)
|
for (int i=0; i < items(); i++)
|
||||||
{
|
{
|
||||||
Riga_rcaus *r = (Riga_rcaus*)objptr(i);
|
TRiga_caus *r = (TRiga_caus*)objptr(i);
|
||||||
if (r) r->add("", 0);
|
if (r) r->add("", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRighe_rcaus::clear(int row)
|
void TRighe_rcaus::clear(int row)
|
||||||
{
|
{
|
||||||
Riga_rcaus *r = (Riga_rcaus*)objptr(row);
|
TRiga_caus* r = (TRiga_caus*)objptr(row);
|
||||||
|
|
||||||
if (r)
|
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("", 1); r->add(0, 2); r->add(0, 3);
|
||||||
r->add("", 7); r->add("", 8); r->add("", 9);
|
r->add(0L, 4); r->add("", 5); r->add("", 6);
|
||||||
|
r->add("", 7); r->add("", 8); r->add("", 9);
|
||||||
|
*/
|
||||||
|
*r = r->get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRighe_rcaus::set_descr(int i, const char * dfi, char tipocf)
|
void TRighe_rcaus::set_descr(int i, const char * dfi)
|
||||||
{
|
{
|
||||||
Riga_rcaus *r = (Riga_rcaus*)objptr(i);
|
TRiga_caus *r = (TRiga_caus*)objptr(i);
|
||||||
TConto tc;
|
|
||||||
|
|
||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
{
|
{
|
||||||
// r = new Riga_rcaus (tc,dfi,tipocf);
|
TConto tc;
|
||||||
r = new Riga_rcaus (tc,dfi);
|
r = new TRiga_caus(tc, dfi);
|
||||||
add(r,i);
|
add(r,i);
|
||||||
}
|
}
|
||||||
r->add(dfi, 0);
|
else
|
||||||
// r->add(tipocf, 1);
|
r->add(dfi, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool filtra_reg(const TRelation * r);
|
bool filtra_reg(const TRelation * r);
|
||||||
@ -166,7 +170,7 @@ bool filtra_reg(const TRelation * r);
|
|||||||
typedef enum { acquisto, vendita, incasso_pagamento,
|
typedef enum { acquisto, vendita, incasso_pagamento,
|
||||||
ritenuta_occas, incasso_pagamento_gesval } tipo_descr;
|
ritenuta_occas, incasso_pagamento_gesval } tipo_descr;
|
||||||
|
|
||||||
class CG0500_application : public TRelation_application
|
class TCaus_app : public TRelation_application
|
||||||
{
|
{
|
||||||
int _filtro; // tipo di filtro su tab. reg.
|
int _filtro; // tipo di filtro su tab. reg.
|
||||||
// 1 vendite senza corrisp
|
// 1 vendite senza corrisp
|
||||||
@ -199,7 +203,7 @@ typedef enum { acquisto, vendita, incasso_pagamento,
|
|||||||
void togli_dal_file(const TString&);
|
void togli_dal_file(const TString&);
|
||||||
|
|
||||||
void read_rcaus(TMask&);
|
void read_rcaus(TMask&);
|
||||||
bool descr2array(TMask&, bool fromHandler = TRUE);
|
bool descr2array(TMask&, bool fromHandler);
|
||||||
bool fill_sheet(TMask&);
|
bool fill_sheet(TMask&);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -235,66 +239,64 @@ public:
|
|||||||
TSheet_field& ss() const { return (TSheet_field&)_msk->field(F_SHEET_GCS);}
|
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,
|
void add_riga (int numrig, char cf, char sz, TString& d, TString& da,
|
||||||
bool riva, TString& civa, TConto& tc);
|
bool riva, TString& civa, TConto& tc);
|
||||||
bool MostraCampi(TMask_field& f);
|
bool mostra_campi(TMask_field& f);
|
||||||
TLocalisamfile & conti() { return *_conti; }
|
TLocalisamfile & conti() { return *_conti; }
|
||||||
|
|
||||||
CG0500_application() {}
|
TCaus_app() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
HIDDEN CG0500_application * app() { return (CG0500_application*) MainApp(); }
|
HIDDEN TCaus_app& app() { return (TCaus_app&) main_app(); }
|
||||||
|
|
||||||
// Per sapere su che riga sono dello spreadsheet. v. set_notify piu' sotto
|
// Per sapere su che riga sono dello spreadsheet. v. set_notify piu' sotto
|
||||||
// e per pulire la sezione Dare/avere in caso di riga azzerata
|
// e per pulire la sezione Dare/avere in caso di riga azzerata
|
||||||
bool CG0500_application::leggi_riga(int r, KEY k)
|
bool TCaus_app::leggi_riga(int r, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE) app()->_riga = r;
|
if (k == K_SPACE)
|
||||||
|
app()._riga = r;
|
||||||
|
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
{
|
{
|
||||||
TToken_string &riga = app()->ss().row(r);
|
TToken_string &riga = app().ss().row(r);
|
||||||
const int g = riga.get_int(2);
|
const int g = riga.get_int(2);
|
||||||
if (g == 0) // riga azzerata
|
if (g == 0) // riga azzerata
|
||||||
{
|
{
|
||||||
riga.add("", 1); // pulisco tipo C/F
|
riga.add("", 1); // pulisco tipo C/F
|
||||||
riga.add("", 5); // pulisco Dare/Avere
|
riga.add("", 5); // pulisco Dare/Avere
|
||||||
app()->_righe_rcaus.clear(r); // pulisco la riga anche nell'array
|
app()._righe_rcaus.clear(r); // pulisco la riga anche nell'array
|
||||||
app()->ss().force_update(r);
|
app().ss().force_update(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool filtra_reg(const TRelation * r)
|
bool filtra_reg(const TRelation * r)
|
||||||
{
|
{
|
||||||
const TString codtab(r->lfile().get("CODTAB"));
|
bool ok = FALSE;
|
||||||
int tiporeg = r->lfile().get_int("I0");
|
|
||||||
bool corrisp = r->lfile().get_bool("B0");
|
|
||||||
|
|
||||||
const int anno = atoi(codtab.left(4));
|
const TRectype& rec = r->lfile().curr();
|
||||||
|
const int anno = atoi(rec.get("CODTAB").left(4));
|
||||||
|
|
||||||
switch (app()->_filtro)
|
if (anno == anno_iva())
|
||||||
{
|
{
|
||||||
case 1:
|
const int tiporeg = rec.get_int("I0");
|
||||||
if (anno == anno_iva() && tiporeg == 1)
|
const bool corrisp = rec.get_bool("B0");
|
||||||
return TRUE;
|
|
||||||
break;
|
switch (app()._filtro)
|
||||||
case 2:
|
{
|
||||||
if (anno == anno_iva() && tiporeg == 1 && corrisp)
|
case 1:
|
||||||
return TRUE;
|
ok = tiporeg == 1; break;
|
||||||
break;
|
case 2:
|
||||||
case 3:
|
ok = (tiporeg == 1 && corrisp); break;
|
||||||
if (anno == anno_iva() && tiporeg == 2)
|
case 3:
|
||||||
return TRUE;
|
ok = tiporeg == 2; break;
|
||||||
break;
|
case 4: // tiporeg 1 senza corrisp OPPURE 2 (NC ST ND AF)
|
||||||
case 4: // tiporeg 1 senza corrisp OPPURE 2 (NC ST ND AF)
|
ok = (tiporeg == 1 && !corrisp) || tiporeg == 2; break;
|
||||||
if (anno == anno_iva())
|
default:
|
||||||
if ( (tiporeg == 1 && !corrisp) || tiporeg == 2 )
|
break;
|
||||||
return TRUE;
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -307,32 +309,31 @@ bool filtra_reg(const TRelation * r)
|
|||||||
2. cassa/banca
|
2. cassa/banca
|
||||||
3. erario
|
3. erario
|
||||||
************/
|
************/
|
||||||
bool CG0500_application::m770_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::m770_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE)
|
if (k == K_TAB)
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
const int m770 = m.get_int(F_M_770);
|
const int m770 = m.get_int(F_M_770);
|
||||||
if (m770 == 6) app()->fill_sheet(m);
|
if (m770 == 6)
|
||||||
|
app().fill_sheet(m);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::tipodoc_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
// Testo K_TAB perche' il controllo deve scattare anche all'inizio
|
// Testo K_TAB perche' il controllo deve scattare anche all'inizio
|
||||||
// per vedere, per es., se il registro scritto nella causale esiste ancora
|
// per vedere, per es., se il registro scritto nella causale esiste ancora
|
||||||
if (k == K_TAB)
|
if (k == K_TAB)
|
||||||
{
|
{
|
||||||
const TString16 val(f.get());
|
const TString16 val(f.get());
|
||||||
TEdit_field& field_reg = (TEdit_field&)f.mask().field(F_COD_REG);
|
TEdit_field& field_reg = f.mask().efield(F_COD_REG);
|
||||||
|
|
||||||
if (val.not_empty() && val != "IN" && val != "PG" && val != "AN")
|
if (val.not_empty() && val != "IN" && val != "PG" && val != "AN")
|
||||||
{
|
{
|
||||||
// if (f.to_check(k)) {
|
|
||||||
f.mask().hide(F_TIPO_MOV_2);
|
f.mask().hide(F_TIPO_MOV_2);
|
||||||
if (salda_conto()) f.mask().show(F_TIPO_MOV_1);
|
if (salda_conto()) f.mask().show(F_TIPO_MOV_1);
|
||||||
// }
|
|
||||||
|
|
||||||
f.mask().enable(F_COD_REG);
|
f.mask().enable(F_COD_REG);
|
||||||
field_reg.check_type(CHECK_REQUIRED);
|
field_reg.check_type(CHECK_REQUIRED);
|
||||||
@ -349,75 +350,71 @@ bool CG0500_application::tipodoc_hndl (TMask_field& f, KEY k)
|
|||||||
if (i == 1) // vendite
|
if (i == 1) // vendite
|
||||||
{
|
{
|
||||||
if (corrisp) { // vendite con corrispettivi
|
if (corrisp) { // vendite con corrispettivi
|
||||||
app()->_filtro = 2;
|
app()._filtro = 2;
|
||||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
}
|
}
|
||||||
else { // vendite senza corrispettivi
|
else { // vendite senza corrispettivi
|
||||||
app()->_filtro = 1;
|
app()._filtro = 1;
|
||||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if ( i == 2 ) // acquisti
|
if ( i == 2 ) // acquisti
|
||||||
{
|
{
|
||||||
app()->_filtro = 3;
|
app()._filtro = 3;
|
||||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
} else
|
} else
|
||||||
if ( i == 9 ) // sia acquisti che vendite
|
if ( i == 9 ) // sia acquisti che vendite
|
||||||
{
|
{
|
||||||
app()->_filtro = 4;
|
app()._filtro = 4;
|
||||||
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
field_reg.browse()->cursor()->set_filterfunction(filtra_reg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // TIPODOC vuoto || IN || PG || AN
|
else // TIPODOC vuoto || IN || PG || AN
|
||||||
{
|
{
|
||||||
// Devo poter rivedere tutti i registri se ho cancellato il campo TIPODOC
|
|
||||||
field_reg.check_type(CHECK_NORMAL);
|
|
||||||
f.mask().set(F_COD_REG,"");
|
f.mask().set(F_COD_REG,"");
|
||||||
f.mask().disable(F_COD_REG);
|
f.mask().disable(F_COD_REG);
|
||||||
|
|
||||||
// if (f.to_check(k)) {
|
|
||||||
f.mask().hide(F_TIPO_MOV_1);
|
f.mask().hide(F_TIPO_MOV_1);
|
||||||
if (salda_conto()) f.mask().show(F_TIPO_MOV_2);
|
if (salda_conto())
|
||||||
// }
|
f.mask().show(F_TIPO_MOV_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ma davvero esiste il registro ?
|
// Ma davvero esiste il registro ?
|
||||||
TString16 codreg(f.mask().get(F_COD_REG));
|
const TString16 codreg(f.mask().get(F_COD_REG));
|
||||||
if (codreg.not_empty())
|
if (codreg.not_empty())
|
||||||
{
|
{
|
||||||
TRegistro registro(codreg, anno_iva());
|
TRegistro registro(codreg, anno_iva());
|
||||||
if (!registro.read(codreg, anno_iva()))
|
if (registro.name().empty())
|
||||||
return f.warning_box("Non esiste il registro %s per l'anno %d",
|
return f.error_box("Non esiste il registro %s per l'anno %d",
|
||||||
(const char *)codreg, anno_iva());
|
(const char *)codreg, anno_iva());
|
||||||
}
|
}
|
||||||
|
|
||||||
app()->MostraCampi(f);
|
app().mostra_campi(f);
|
||||||
// if (f.focusdirty())
|
app().fill_sheet(f.mask());
|
||||||
app()->fill_sheet(f.mask());
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG0500_application::tipomov_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::tipomov_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
{
|
{
|
||||||
app()->MostraCampi(f);
|
app().mostra_campi(f);
|
||||||
if (f.focusdirty())
|
if (f.focusdirty())
|
||||||
app()->fill_sheet(f.mask());
|
app().fill_sheet(f.mask());
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Il codice causale per incasso immediato, se specificato, deve
|
// Il codice causale per incasso immediato, se specificato, deve
|
||||||
// essere puramente contabile (= codreg vuoto e tpm = Nessuno
|
// essere puramente contabile (= codreg vuoto e tpm = Nessuno
|
||||||
bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::codcausim_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (f.to_check(k))
|
if (f.to_check(k))
|
||||||
{
|
{
|
||||||
TString16 causim(f.get());
|
TString16 causim(f.get());
|
||||||
TLocalisamfile& caus = app()->_rel->lfile(LF_CAUSALI);
|
TLocalisamfile& caus = app()._rel->lfile(LF_CAUSALI);
|
||||||
caus.zero();
|
caus.zero();
|
||||||
caus.put(CAU_CODCAUS, causim);
|
caus.put(CAU_CODCAUS, causim);
|
||||||
if (caus.read() == NOERR)
|
if (caus.read() == NOERR)
|
||||||
@ -433,7 +430,7 @@ bool CG0500_application::codcausim_hndl (TMask_field& f, KEY k)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CG0500_application::MostraCampi(TMask_field& f)
|
bool TCaus_app::mostra_campi(TMask_field& f)
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
const int tpm = m.get_int(F_TIPO_MOV);
|
const int tpm = m.get_int(F_TIPO_MOV);
|
||||||
@ -487,12 +484,12 @@ bool CG0500_application::MostraCampi(TMask_field& f)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::cod_reg_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_TAB)
|
if (k == K_TAB)
|
||||||
{
|
{
|
||||||
app()->MostraCampi(f);
|
app().mostra_campi(f);
|
||||||
if (f.focusdirty()) app()->fill_sheet(f.mask());
|
if (f.focusdirty()) app().fill_sheet(f.mask());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +526,7 @@ bool CG0500_application::cod_reg_hndl (TMask_field& f, KEY k)
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
// Handler della maschera dello spreadsheet
|
// Handler della maschera dello spreadsheet
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::conto_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
// Se specifico il conto deve essere non vuoto il gruppo
|
// Se specifico il conto deve essere non vuoto il gruppo
|
||||||
if (f.to_check(k))
|
if (f.to_check(k))
|
||||||
@ -549,7 +546,7 @@ bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
|||||||
int ultima = 8;
|
int ultima = 8;
|
||||||
char cf = f.mask().get(SS_TIPOCF)[0];
|
char cf = f.mask().get(SS_TIPOCF)[0];
|
||||||
TMask_field& cfld = f.mask().field(SS_TIPOCF);
|
TMask_field& cfld = f.mask().field(SS_TIPOCF);
|
||||||
const int tpr = app()->main_mask()->get_int(F_TIPO_REG);
|
const int tpr = app().main_mask()->get_int(F_TIPO_REG);
|
||||||
bool puramente_contabile = FALSE;
|
bool puramente_contabile = FALSE;
|
||||||
|
|
||||||
switch (tpr)
|
switch (tpr)
|
||||||
@ -559,7 +556,7 @@ bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
|||||||
case 0:
|
case 0:
|
||||||
scarta = 'Z'; // Accetto tutto
|
scarta = 'Z'; // Accetto tutto
|
||||||
puramente_contabile = TRUE;
|
puramente_contabile = TRUE;
|
||||||
switch (app()->_tipo_des)
|
switch (app()._tipo_des)
|
||||||
{
|
{
|
||||||
case incasso_pagamento: ultima = 11; break;
|
case incasso_pagamento: ultima = 11; break;
|
||||||
case incasso_pagamento_gesval: ultima = 12; break;
|
case incasso_pagamento_gesval: ultima = 12; break;
|
||||||
@ -569,23 +566,23 @@ bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
|||||||
|
|
||||||
if (!puramente_contabile)
|
if (!puramente_contabile)
|
||||||
{
|
{
|
||||||
if (app()->_riga > ultima) // se sono nelle righe libere accetto TUTTO..
|
if (app()._riga > ultima) // se sono nelle righe libere accetto TUTTO..
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
if (app()->_riga == 0 || app()->_riga == 6)
|
if (app()._riga == 0 || app()._riga == 6)
|
||||||
{
|
{
|
||||||
if (cf == scarta)
|
if (cf == scarta)
|
||||||
return cfld.warning_box(
|
return cfld.warning_box(
|
||||||
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
||||||
cf == 'C' ? "cliente" : "fornitore",
|
cf == 'C' ? "cliente" : "fornitore",
|
||||||
tpr == 1 ? "vendite" : "acquisti", app()->_riga+1);
|
tpr == 1 ? "vendite" : "acquisti", app()._riga+1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (cf == 'C' || cf == 'F')
|
if (cf == 'C' || cf == 'F')
|
||||||
return cfld.warning_box(
|
return cfld.warning_box(
|
||||||
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
"Impossibile inserire un %s con registro di tipo %s nella riga %d",
|
||||||
cf == 'C' ? "cliente" : "fornitore",
|
cf == 'C' ? "cliente" : "fornitore",
|
||||||
tpr == 1 ? "vendite" : "acquisti", app()->_riga+1);
|
tpr == 1 ? "vendite" : "acquisti", app()._riga+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -594,7 +591,7 @@ bool CG0500_application::conto_hndl (TMask_field& f, KEY k)
|
|||||||
|
|
||||||
// 1. Se specifico il sottoconto devono essere non vuoti gruppo e conto
|
// 1. Se specifico il sottoconto devono essere non vuoti gruppo e conto
|
||||||
// 2. g-c-s devono esistere
|
// 2. g-c-s devono esistere
|
||||||
bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::sottoconto_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (f.to_check(k))
|
if (f.to_check(k))
|
||||||
{
|
{
|
||||||
@ -609,7 +606,7 @@ bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
|||||||
|
|
||||||
/* A che cavolo serve CHECKTYPE NORMAL ????????????????????????????????????????
|
/* A che cavolo serve CHECKTYPE NORMAL ????????????????????????????????????????
|
||||||
TConto tc(g,c,s);
|
TConto tc(g,c,s);
|
||||||
if (!tc.read(app()->conti().curr()))
|
if (!tc.read(app().conti().curr()))
|
||||||
return f.warning_box("Conto inesistente");
|
return f.warning_box("Conto inesistente");
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -619,11 +616,11 @@ bool CG0500_application::sottoconto_hndl (TMask_field& f, KEY k)
|
|||||||
|
|
||||||
// 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
|
// Abilita 109 e 110 (rigaiva e codiva) SOLO SE registro 1 o 2
|
||||||
bool CG0500_application::tipocf_hndl (TMask_field& f, KEY k)
|
bool TCaus_app::tipocf_hndl (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
{
|
{
|
||||||
const int tpr = app()->main_mask()->get_int(F_TIPO_REG);
|
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);
|
f.mask().enable(109); f.mask().enable(110);
|
||||||
}
|
}
|
||||||
@ -641,7 +638,7 @@ void TRighe_rcaus::CausaleVendite()
|
|||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
TConto tc();
|
TConto tc();
|
||||||
app()->_tipo_des = vendita;
|
app()._tipo_des = vendita;
|
||||||
// set_descr(i++, "C Clienti", 'C');
|
// set_descr(i++, "C Clienti", 'C');
|
||||||
set_descr(i++, "C Clienti"); // Lascio scelta libera
|
set_descr(i++, "C Clienti"); // Lascio scelta libera
|
||||||
set_descr(i++, "C Di ricavo");
|
set_descr(i++, "C Di ricavo");
|
||||||
@ -659,7 +656,7 @@ void TRighe_rcaus::CausaleVendite()
|
|||||||
void TRighe_rcaus::CausaleAcquisti()
|
void TRighe_rcaus::CausaleAcquisti()
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
app()->_tipo_des = acquisto;
|
app()._tipo_des = acquisto;
|
||||||
// set_descr( i++, "C Fornitori", 'F');
|
// set_descr( i++, "C Fornitori", 'F');
|
||||||
set_descr( i++, "C Fornitori");
|
set_descr( i++, "C Fornitori");
|
||||||
set_descr(i++, "C Di costo");
|
set_descr(i++, "C Di costo");
|
||||||
@ -676,7 +673,7 @@ void TRighe_rcaus::CausaleAcquisti()
|
|||||||
void TRighe_rcaus::CausaleRitenutaOccas()
|
void TRighe_rcaus::CausaleRitenutaOccas()
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
app()->_tipo_des = ritenuta_occas;
|
app()._tipo_des = ritenuta_occas;
|
||||||
set_descr (i++, "Costo");
|
set_descr (i++, "Costo");
|
||||||
set_descr (i++, "Cassa/banca");
|
set_descr (i++, "Cassa/banca");
|
||||||
set_descr (i++, "Erario");
|
set_descr (i++, "Erario");
|
||||||
@ -692,7 +689,7 @@ void TRighe_rcaus::CaricaRigheLibere()
|
|||||||
void TRighe_rcaus::CausaleIncassoPagamento()
|
void TRighe_rcaus::CausaleIncassoPagamento()
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
app()->_tipo_des = incasso_pagamento;
|
app()._tipo_des = incasso_pagamento;
|
||||||
set_descr ( i++, "C Clienti/Fornitori");
|
set_descr ( i++, "C Clienti/Fornitori");
|
||||||
set_descr ( i++, "C Cassa o banca");
|
set_descr ( i++, "C Cassa o banca");
|
||||||
set_descr ( i++, "C Tratta");
|
set_descr ( i++, "C Tratta");
|
||||||
@ -707,12 +704,12 @@ void TRighe_rcaus::CausaleIncassoPagamento()
|
|||||||
if (gestione_valuta())
|
if (gestione_valuta())
|
||||||
{
|
{
|
||||||
set_descr (i++, "C Differenza cambio");
|
set_descr (i++, "C Differenza cambio");
|
||||||
app()->_tipo_des = incasso_pagamento_gesval;
|
app()._tipo_des = incasso_pagamento_gesval;
|
||||||
}
|
}
|
||||||
CaricaRigheLibere();
|
CaricaRigheLibere();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int m770)
|
void TCaus_app::compilaarray(const TString& tpd, int tpm, int tpr, int m770)
|
||||||
{
|
{
|
||||||
_forcedCopy = FALSE;
|
_forcedCopy = FALSE;
|
||||||
if (tpd.empty() || tpd == "IN" || tpd == "AN" || tpd == "PG")
|
if (tpd.empty() || tpd == "IN" || tpd == "AN" || tpd == "PG")
|
||||||
@ -730,20 +727,20 @@ void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int
|
|||||||
_righe_rcaus.CausaleRitenutaOccas();
|
_righe_rcaus.CausaleRitenutaOccas();
|
||||||
else {
|
else {
|
||||||
_forcedCopy = TRUE;
|
_forcedCopy = TRUE;
|
||||||
_righe_rcaus.ClearDescr();
|
_righe_rcaus.clear_descr();
|
||||||
_righe_rcaus.CaricaRigheLibere();
|
_righe_rcaus.CaricaRigheLibere();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_forcedCopy = TRUE;
|
_forcedCopy = TRUE;
|
||||||
_righe_rcaus.ClearDescr();
|
_righe_rcaus.clear_descr();
|
||||||
_righe_rcaus.CaricaRigheLibere();
|
_righe_rcaus.CaricaRigheLibere();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // NO saldaconto
|
else { // NO saldaconto
|
||||||
_forcedCopy = TRUE;
|
_forcedCopy = TRUE;
|
||||||
_righe_rcaus.ClearDescr();
|
_righe_rcaus.clear_descr();
|
||||||
_righe_rcaus.CaricaRigheLibere();
|
_righe_rcaus.CaricaRigheLibere();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -757,20 +754,20 @@ void CG0500_application::compilaarray(const TString& tpd, int tpm, int tpr, int
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_forcedCopy = TRUE;
|
_forcedCopy = TRUE;
|
||||||
_righe_rcaus.ClearDescr();
|
_righe_rcaus.clear_descr();
|
||||||
_righe_rcaus.CaricaRigheLibere();
|
_righe_rcaus.CaricaRigheLibere();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG0500_application::fill_sheet(TMask& m)
|
bool TCaus_app::fill_sheet(TMask& m)
|
||||||
{
|
{
|
||||||
descr2array(m);
|
descr2array(m, TRUE);
|
||||||
array2sheet();
|
array2sheet();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CG0500_application::read(TMask& m)
|
int TCaus_app::read(TMask& m)
|
||||||
{
|
{
|
||||||
m.autoload(_rel);
|
m.autoload(_rel);
|
||||||
descr2array(m, FALSE);
|
descr2array(m, FALSE);
|
||||||
@ -779,9 +776,9 @@ int CG0500_application::read(TMask& m)
|
|||||||
return NOERR;
|
return NOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::add_riga(int numrig,
|
void TCaus_app::add_riga(int numrig,
|
||||||
char cf, char sz, TString& d, TString& da, bool riva,
|
char cf, char sz, TString& d, TString& da, bool riva,
|
||||||
TString& civa, TConto& tc)
|
TString& civa, TConto& tc)
|
||||||
{
|
{
|
||||||
TSheet_field& cs = ss();
|
TSheet_field& cs = ss();
|
||||||
TToken_string & riga = cs.row(numrig);
|
TToken_string & riga = cs.row(numrig);
|
||||||
@ -796,7 +793,7 @@ void CG0500_application::add_riga(int numrig,
|
|||||||
riga.add(civa, 9);
|
riga.add(civa, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::read_rcaus(TMask& m)
|
void TCaus_app::read_rcaus(TMask& m)
|
||||||
{
|
{
|
||||||
int numrig, g, c;
|
int numrig, g, c;
|
||||||
long s;
|
long s;
|
||||||
@ -838,10 +835,9 @@ void CG0500_application::read_rcaus(TMask& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ricopio l'array Righe_rcaus nello sheet
|
// ricopio l'array Righe_rcaus nello sheet
|
||||||
void CG0500_application::array2sheet()
|
void TCaus_app::array2sheet()
|
||||||
{
|
{
|
||||||
char _dfi [30];
|
TString80 dfi;
|
||||||
TFixed_string dfi(_dfi,30);
|
|
||||||
_items = _righe_rcaus.items();
|
_items = _righe_rcaus.items();
|
||||||
bool update = FALSE;
|
bool update = FALSE;
|
||||||
|
|
||||||
@ -852,64 +848,67 @@ void CG0500_application::array2sheet()
|
|||||||
|
|
||||||
dfi = r->get(0);
|
dfi = r->get(0);
|
||||||
// Ricopio la descrizione solo se non vuota
|
// Ricopio la descrizione solo se non vuota
|
||||||
if (_forcedCopy) {
|
if (_forcedCopy)
|
||||||
|
{
|
||||||
update = TRUE;
|
update = TRUE;
|
||||||
riga.add(dfi,0);
|
riga.add(dfi,0);
|
||||||
} else
|
}
|
||||||
if (!r->empty_items())
|
else
|
||||||
|
if (dfi.not_empty())
|
||||||
{
|
{
|
||||||
if (dfi.not_empty())
|
update = TRUE;
|
||||||
{
|
riga.add(dfi,0);
|
||||||
update = TRUE;
|
|
||||||
riga.add(dfi,0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (update) ss().force_update();
|
if (update) ss().force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG0500_application::descr2array(TMask& m, bool fromHandler)
|
bool TCaus_app::descr2array(TMask& m, bool fromHandler)
|
||||||
{
|
{
|
||||||
TLocalisamfile& caus = _rel->lfile();
|
TLocalisamfile& caus = _rel->lfile();
|
||||||
TString16 tpd, codreg;
|
TString16 tpd, codreg;
|
||||||
int tpm, m770, tpr;
|
int tpm, m770, tpr;
|
||||||
|
|
||||||
// if (m.mode() == MODE_MOD && !fromHandler)
|
// if (m.mode() == MODE_MOD && !fromHandler)
|
||||||
if (fromHandler) {
|
if (fromHandler)
|
||||||
|
{
|
||||||
codreg = m.field(F_COD_REG).get();
|
codreg = m.field(F_COD_REG).get();
|
||||||
tpd = m.field(F_TIPO_DOC).get();
|
tpd = m.field(F_TIPO_DOC).get();
|
||||||
tpm = m.get_int(F_TIPO_MOV);
|
tpm = m.get_int(F_TIPO_MOV);
|
||||||
m770 = m.get_int(F_M_770);
|
m770 = m.get_int(F_M_770);
|
||||||
} else if (m.mode() == MODE_MOD) {
|
}
|
||||||
|
else if (m.mode() == MODE_MOD)
|
||||||
|
{
|
||||||
codreg = caus.get("REG");
|
codreg = caus.get("REG");
|
||||||
tpd = caus.get("TIPODOC");
|
tpd = caus.get("TIPODOC");
|
||||||
tpm = caus.get_int("TIPOMOV");
|
tpm = caus.get_int("TIPOMOV");
|
||||||
m770 = caus.get_int("M770");
|
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();
|
codreg = m.field(F_COD_REG).get();
|
||||||
tpd = m.field(F_TIPO_DOC).get();
|
tpd = m.field(F_TIPO_DOC).get();
|
||||||
tpm = m.get_int(F_TIPO_MOV);
|
tpm = m.get_int(F_TIPO_MOV);
|
||||||
m770 = m.get_int(F_M_770);
|
m770 = m.get_int(F_M_770);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromHandler)
|
{
|
||||||
tpr = m.get_int(F_TIPO_REG);
|
TString16 chiave; chiave << anno_iva() << codreg;
|
||||||
else {
|
TTable reg("REG");
|
||||||
TString16 chiave; chiave << anno_iva() << codreg;
|
reg.put("CODTAB", chiave);
|
||||||
TTable reg("REG");
|
if (reg.read() == NOERR)
|
||||||
reg.put("CODTAB", chiave);
|
|
||||||
reg.read();
|
|
||||||
tpr = reg.get_int("I0");
|
tpr = reg.get_int("I0");
|
||||||
}
|
else
|
||||||
|
tpr = 0;
|
||||||
// carico le descrizioni fisse nell'array Righe_rcaus
|
|
||||||
compilaarray(tpd,tpm,tpr,m770);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::togli_dal_file(const TString& cau)
|
// carico le descrizioni fisse nell'array Righe_rcaus
|
||||||
|
compilaarray(tpd,tpm,tpr,m770);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCaus_app::togli_dal_file(const TString& cau)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
TLocalisamfile& rcaus = _rel->lfile(LF_RCAUSALI);
|
||||||
@ -930,17 +929,17 @@ void CG0500_application::togli_dal_file(const TString& cau)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CG0500_application::write(const TMask& m)
|
int TCaus_app::write(const TMask& m)
|
||||||
{
|
{
|
||||||
return re_write(m, FALSE);
|
return re_write(m, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CG0500_application::rewrite(const TMask& m)
|
int TCaus_app::rewrite(const TMask& m)
|
||||||
{
|
{
|
||||||
return re_write(m, TRUE);
|
return re_write(m, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CG0500_application::re_write(const TMask& m,bool rewrite)
|
int TCaus_app::re_write(const TMask& m,bool rewrite)
|
||||||
{
|
{
|
||||||
const TString16 cau(m.get(F_COD_CAUS));
|
const TString16 cau(m.get(F_COD_CAUS));
|
||||||
TString80 desc;
|
TString80 desc;
|
||||||
@ -1002,7 +1001,7 @@ int CG0500_application::re_write(const TMask& m,bool rewrite)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CG0500_application::remove()
|
bool TCaus_app::remove()
|
||||||
{
|
{
|
||||||
_rel->restore_status(); // senno' non riesco a leggere il cod. caus.
|
_rel->restore_status(); // senno' non riesco a leggere il cod. caus.
|
||||||
_rel->update(); // chiamo position_rels()
|
_rel->update(); // chiamo position_rels()
|
||||||
@ -1023,25 +1022,25 @@ bool CG0500_application::remove()
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::init_query_mode(TMask& m)
|
void TCaus_app::init_query_mode(TMask& m)
|
||||||
{
|
{
|
||||||
_righe_rcaus.destroy();
|
_righe_rcaus.destroy();
|
||||||
ss().reset();
|
ss().reset();
|
||||||
init_mask(m);
|
init_mask(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::init_insert_mode(TMask& m)
|
void TCaus_app::init_insert_mode(TMask& m)
|
||||||
{
|
{
|
||||||
ss().reset();
|
ss().reset();
|
||||||
init_mask(m);
|
init_mask(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::init_modify_mode(TMask& m)
|
void TCaus_app::init_modify_mode(TMask& m)
|
||||||
{
|
{
|
||||||
init_mask(m);
|
init_mask(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG0500_application::init_mask(TMask& m)
|
void TCaus_app::init_mask(TMask& m)
|
||||||
{
|
{
|
||||||
// 27/06/94 Setto il campo nascosto F_ANNOES all'anno di liq. Iva
|
// 27/06/94 Setto il campo nascosto F_ANNOES all'anno di liq. Iva
|
||||||
// preso dai par.ditta
|
// preso dai par.ditta
|
||||||
@ -1050,7 +1049,7 @@ void CG0500_application::init_mask(TMask& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CG0500_application::user_create()
|
bool TCaus_app::user_create()
|
||||||
{
|
{
|
||||||
_rel = new TRelation (LF_CAUSALI);
|
_rel = new TRelation (LF_CAUSALI);
|
||||||
_rel->add(LF_RCAUSALI, "CODCAUS=CODCAUS");
|
_rel->add(LF_RCAUSALI, "CODCAUS=CODCAUS");
|
||||||
@ -1091,17 +1090,17 @@ bool CG0500_application::user_create()
|
|||||||
cs.set_notify(leggi_riga);
|
cs.set_notify(leggi_riga);
|
||||||
|
|
||||||
cs.sheet_mask().set_handler(102, tipocf_hndl); // 102 e' il TIPOCF
|
cs.sheet_mask().set_handler(102, tipocf_hndl); // 102 e' il TIPOCF
|
||||||
|
cs.sheet_mask().set_handler(104, conto_hndl);
|
||||||
cs.sheet_mask().set_handler(105, sottoconto_hndl);
|
cs.sheet_mask().set_handler(105, sottoconto_hndl);
|
||||||
cs.sheet_mask().set_handler(205, sottoconto_hndl);
|
cs.sheet_mask().set_handler(205, sottoconto_hndl);
|
||||||
cs.sheet_mask().set_handler(305, sottoconto_hndl);
|
cs.sheet_mask().set_handler(305, sottoconto_hndl);
|
||||||
cs.sheet_mask().set_handler(104, conto_hndl);
|
|
||||||
|
|
||||||
_forcedCopy = FALSE;
|
_forcedCopy = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG0500_application::user_destroy()
|
bool TCaus_app::user_destroy()
|
||||||
{
|
{
|
||||||
delete _msk;
|
delete _msk;
|
||||||
delete _rel;
|
delete _rel;
|
||||||
@ -1111,7 +1110,7 @@ bool CG0500_application::user_destroy()
|
|||||||
|
|
||||||
int cg0500(int argc, char* argv[])
|
int cg0500(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
CG0500_application a;
|
TCaus_app a;
|
||||||
a.run(argc, argv, "Tabella causali");
|
a.run(argc, argv, "Tabella causali");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ BEGIN
|
|||||||
OUTPUT F_COD_REG CODTAB[5,7]
|
OUTPUT F_COD_REG CODTAB[5,7]
|
||||||
OUTPUT F_TIPO_REG I0
|
OUTPUT F_TIPO_REG I0
|
||||||
OUTPUT F_CORRISP B0
|
OUTPUT F_CORRISP B0
|
||||||
HELP "Inserire il codice registro"
|
HELP "Codice registro"
|
||||||
WARNING "Non trovo il registro"
|
WARNING "Registro assente"
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
FLAGS "DU"
|
FLAGS "DU"
|
||||||
END
|
END
|
||||||
@ -120,13 +120,27 @@ BEGIN
|
|||||||
FLAGS "H"
|
FLAGS "H"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_ANNOES 4
|
LISTBOX F_M_770 1 40
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 6 ""
|
PROMPT 2 6 "Collegamento Mod.770 "
|
||||||
|
FIELD LF_CAUSALI->M770
|
||||||
|
HELP "Inserire il tipo di collegamento Mod.770"
|
||||||
|
ITEM " |Nessuno"
|
||||||
|
ITEM "1|Ricevuta e/o pagamento fattura percip."
|
||||||
|
ITEM "2|Versamento ritenute percip."
|
||||||
|
ITEM "3|Versamento ritenute dipendente"
|
||||||
|
ITEM "4|Versamento contributi dipendente"
|
||||||
|
ITEM "5|Compensi non soggetti"
|
||||||
|
ITEM "6|Ritenute per operazioni occasionali"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_ANNOES 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 5 ""
|
||||||
FLAGS "H"
|
FLAGS "H"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_TIPO_REG 4
|
NUMBER F_TIPO_REG 1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 23 5 ""
|
PROMPT 23 5 ""
|
||||||
FLAGS "H"
|
FLAGS "H"
|
||||||
@ -272,20 +286,6 @@ BEGIN
|
|||||||
ITEM "Z|Rettifica vendita"
|
ITEM "Z|Rettifica vendita"
|
||||||
END
|
END
|
||||||
|
|
||||||
LISTBOX F_M_770 1 40
|
|
||||||
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
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -283,6 +283,8 @@ void TPrimanota_application::init_mask(TMask& m)
|
|||||||
read_caus(NULL, 0); // Setta campi obbligatori
|
read_caus(NULL, 0); // Setta campi obbligatori
|
||||||
fill_sheet(m);
|
fill_sheet(m);
|
||||||
|
|
||||||
|
const bool intra = _causale.intra();
|
||||||
|
|
||||||
if (_iva != nessuna_iva)
|
if (_iva != nessuna_iva)
|
||||||
{
|
{
|
||||||
char clig, forg;
|
char clig, forg;
|
||||||
@ -299,7 +301,6 @@ void TPrimanota_application::init_mask(TMask& m)
|
|||||||
m.send_key(K_SHIFT+K_CTRL+clig, -1); // group 1 (clienti)
|
m.send_key(K_SHIFT+K_CTRL+clig, -1); // group 1 (clienti)
|
||||||
m.send_key(K_SHIFT+K_CTRL+forg, -2); // group 2 (fornitori)
|
m.send_key(K_SHIFT+K_CTRL+forg, -2); // group 2 (fornitori)
|
||||||
|
|
||||||
const bool intra = _causale.intra();
|
|
||||||
m.show(F_CORRLIRE, intra);
|
m.show(F_CORRLIRE, intra);
|
||||||
|
|
||||||
const bool corrval = intra && _causale.corrval();
|
const bool corrval = intra && _causale.corrval();
|
||||||
@ -309,12 +310,10 @@ void TPrimanota_application::init_mask(TMask& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_VISVAL (GROUP 3)
|
// Show/Hide campi valuta: F_VALUTA, F_CAMBIO, F_VISVAL (GROUP 3)
|
||||||
const bool valuta = _causale.valuta() && gestione_valuta();
|
const bool valuta = _causale.valuta() && (intra || gestione_valuta());
|
||||||
m.send_key(K_SHIFT+K_CTRL+(valuta ? 's' : 'h'), -3);
|
m.send_key(K_SHIFT+K_CTRL+(valuta ? 's' : 'h'), -3);
|
||||||
if (valuta)
|
if (valuta)
|
||||||
m.set(F_VISVAL, "X");
|
m.set(F_VISVAL, "X");
|
||||||
|
|
||||||
// m.disable(DLG_NEWREC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrimanota_application::init_query_mode(TMask& m)
|
void TPrimanota_application::init_query_mode(TMask& m)
|
||||||
|
@ -157,16 +157,52 @@ int TMovimentoPN::registra(bool re, bool force)
|
|||||||
cancella(rm, i+1, _oldcg);
|
cancella(rm, i+1, _oldcg);
|
||||||
_oldcg = cg_items();
|
_oldcg = cg_items();
|
||||||
|
|
||||||
|
|
||||||
|
const int annoiva = m.get_int("ANNOIVA");
|
||||||
|
const TString16 reg(m.get("REG"));
|
||||||
|
TRegistro registro(reg, annoiva);
|
||||||
|
const bool att_mista = reg.empty() ? FALSE : registro.attivita_mista();
|
||||||
|
|
||||||
for (i = 0 ; i < iva_items(); i++)
|
for (i = 0 ; i < iva_items(); i++)
|
||||||
{
|
{
|
||||||
if (!re) iva(i).put("NUMREG", numreg);
|
TRectype& r = iva(i);
|
||||||
const int err = write_rec(re, iva(i), ri);
|
|
||||||
|
if (!re) r.put("NUMREG", numreg); // Force correct number
|
||||||
|
|
||||||
|
int tipoatt = 1;
|
||||||
|
if (att_mista)
|
||||||
|
{
|
||||||
|
const char tipo = r.get_char("TIPO");
|
||||||
|
if (tipo == ' ')
|
||||||
|
{
|
||||||
|
TBill c(r.get_int("GRUPPO"), r.get_int("CONTO"), r.get_long("SOTTOCONTO"));
|
||||||
|
tipoatt = c.tipo_att();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
r.put("TIPOATT", tipoatt);
|
||||||
|
|
||||||
|
const int err = write_rec(re, r, ri);
|
||||||
if (!force && err != NOERR) return err;
|
if (!force && err != NOERR) return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < _oldiva)
|
if (i < _oldiva)
|
||||||
cancella(ri, i+1, _oldiva);
|
cancella(ri, i+1, _oldiva);
|
||||||
_oldiva = iva_items();
|
_oldiva = iva_items();
|
||||||
|
|
||||||
|
// Aggiorna data registrazione sul libro giornale
|
||||||
|
const TDate datareg(m.get("DATAREG"));
|
||||||
|
TLibro_giornale gio(date2esc(datareg));
|
||||||
|
gio.update(0L, datareg);
|
||||||
|
|
||||||
|
// Aggiorna data registrazione e protocollo IVA sul registro
|
||||||
|
if (reg.not_empty())
|
||||||
|
{
|
||||||
|
const long protiva = m.get_long("PROTIVA");
|
||||||
|
const long uprotiva = m.get_long("UPROTIVA");
|
||||||
|
const TDate datareg = m.get_date("DATAREG");
|
||||||
|
registro.update(max(protiva, uprotiva), datareg);
|
||||||
|
}
|
||||||
|
|
||||||
// Resetta il flag di calcolato sulla liquidazione IVA del mese di registrazione
|
// Resetta il flag di calcolato sulla liquidazione IVA del mese di registrazione
|
||||||
// Chiave di LIM: Anno (1-4), Mese (5-6)
|
// Chiave di LIM: Anno (1-4), Mese (5-6)
|
||||||
|
|
||||||
@ -184,17 +220,14 @@ int TMovimentoPN::registra(bool re, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString16 cod(m.get("REG"));
|
const int att = att_mista ? 2 : 1;
|
||||||
const int anno = m.get_int("ANNOIVA");
|
|
||||||
TRegistro reg(cod, anno);
|
|
||||||
const int att = reg.attivita_mista() ? 2 : 1;
|
|
||||||
|
|
||||||
// Chiave di PLM: Anno (1-4), Cod. Att. (5-9), Tipo att. (10-10), Mese (11-12)
|
// Chiave di PLM: Anno (1-4), Cod. Att. (5-9), Tipo att. (10-10), Mese (11-12)
|
||||||
TTable plm("PLM");
|
TTable plm("PLM");
|
||||||
for (int a = 1; a <= att; a++)
|
for (int a = 1; a <= att; a++)
|
||||||
{
|
{
|
||||||
chiave.cut(0);
|
chiave.cut(0);
|
||||||
chiave << d.year() << reg.attivita() << a << d.month();
|
chiave << d.year() << registro.attivita() << a << d.month();
|
||||||
plm.put("CODTAB", chiave);
|
plm.put("CODTAB", chiave);
|
||||||
if (plm.read() == NOERR)
|
if (plm.read() == NOERR)
|
||||||
{
|
{
|
||||||
@ -214,46 +247,10 @@ int TMovimentoPN::registra(bool re, bool force)
|
|||||||
int TMovimentoPN::write(bool force, TDate&)
|
int TMovimentoPN::write(bool force, TDate&)
|
||||||
{
|
{
|
||||||
const TRectype& r = lfile().curr();
|
const TRectype& r = lfile().curr();
|
||||||
const int annoiva = r.get_int("ANNOIVA");
|
|
||||||
const TString16 reg(r.get("REG"));
|
|
||||||
TRegistro registro(reg, annoiva);
|
|
||||||
|
|
||||||
if (registro.iva() != nessuna_iva)
|
|
||||||
{
|
|
||||||
const bool mista = registro.attivita_mista();
|
|
||||||
for (int i = 0; i < iva_items(); i++)
|
|
||||||
{
|
|
||||||
int tipoatt = 1;
|
|
||||||
if (mista)
|
|
||||||
{
|
|
||||||
const char tipo = r.get_char("TIPO");
|
|
||||||
if (tipo == ' ')
|
|
||||||
{
|
|
||||||
TBill c(r.get_int("GRUPPO"), r.get_int("CONTO"), r.get_long("SOTTOCONTO"));
|
|
||||||
tipoatt = c.tipo_att();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
iva(i).put("TIPOATT", tipoatt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_oldcg = _oldiva = 0;
|
_oldcg = _oldiva = 0;
|
||||||
int err = registra(FALSE, force);
|
int err = registra(FALSE, force);
|
||||||
|
|
||||||
if (err == NOERR)
|
|
||||||
{
|
|
||||||
const TDate datareg(r.get("DATAREG"));
|
|
||||||
TLibro_giornale gio(date2esc(datareg));
|
|
||||||
gio.update(0L, datareg); // Aggiorna data registrazione sul libro giornale
|
|
||||||
|
|
||||||
if (reg.not_empty())
|
|
||||||
{ // Aggiorna data registrazione e protocollo IVA sul registro
|
|
||||||
const long protiva = r.get_long("PROTIVA");
|
|
||||||
const long uprotiva = r.get_long("UPROTIVA");
|
|
||||||
const TDate datareg = r.get_date("DATAREG");
|
|
||||||
registro.update(max(protiva, uprotiva), datareg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
|||||||
if (!c.ok())
|
if (!c.ok())
|
||||||
return f.error_box("Il conto della riga %d non e' completo", i+1);
|
return f.error_box("Il conto della riga %d non e' completo", i+1);
|
||||||
const TBill co(cg.row(i), 10, 0x0);
|
const TBill co(cg.row(i), 10, 0x0);
|
||||||
if (!c.empty() && !co.ok())
|
if (!co.empty() && !co.ok())
|
||||||
return f.error_box("La contropartita della riga %d non e' completa", i+1);
|
return f.error_box("La contropartita della riga %d non e' completa", i+1);
|
||||||
empty = FALSE;
|
empty = FALSE;
|
||||||
}
|
}
|
||||||
@ -501,9 +501,15 @@ bool TPrimanota_application::cg_notify(int r, KEY k)
|
|||||||
if (r == 0 && app().iva() == nessuna_iva && cg.row(1).empty_items())
|
if (r == 0 && app().iva() == nessuna_iva && cg.row(1).empty_items())
|
||||||
{
|
{
|
||||||
TImporto i; i = row;
|
TImporto i; i = row;
|
||||||
if (i.valore() != 0.0)
|
if (!i.is_zero())
|
||||||
{
|
{
|
||||||
TBill contro(row, 9, 0x3);
|
TBill contro(row, 9, 0x3);
|
||||||
|
if (!contro.ok() && *app().causale().codice() > ' ')
|
||||||
|
{
|
||||||
|
app().causale().bill(2, contro);
|
||||||
|
contro.add_to(row, 9, 0x3);
|
||||||
|
cg.force_update(r);
|
||||||
|
}
|
||||||
if (contro.ok())
|
if (contro.ok())
|
||||||
{
|
{
|
||||||
i.swap_section();
|
i.swap_section();
|
||||||
@ -614,16 +620,22 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
|
|
||||||
TCodiceIVA iva(f.get());
|
if (m.get_int(107) == 0)
|
||||||
TBill b; app().IVA2bill(iva, b);
|
{
|
||||||
m.set(105, b.tipo_cr());
|
TCodiceIVA iva(f.get());
|
||||||
const char tipo[2] = { b.tipo(), '\0' };
|
TBill b; app().IVA2bill(iva, b);
|
||||||
m.set(106, tipo);
|
|
||||||
m.set(107, b.gruppo());
|
char cr[2] = { b.tipo_cr() + '0', '\0' };
|
||||||
m.set(108, b.conto());
|
m.set(105, *cr > '0' ? cr : "");
|
||||||
const short id = b.tipo() == 'C' ? 209 : (b.tipo() == 'F' ? 309 : 109);
|
|
||||||
m.set(id, b.sottoconto());
|
const char tipo[2] = { b.tipo(), '\0' };
|
||||||
m.set(id+1, b.descrizione());
|
m.set(106, tipo);
|
||||||
|
m.set(107, b.gruppo());
|
||||||
|
m.set(108, b.conto());
|
||||||
|
const short id = b.tipo() == 'C' ? 209 : (b.tipo() == 'F' ? 309 : 109);
|
||||||
|
m.set(id, b.sottoconto());
|
||||||
|
m.set(id+1, b.descrizione());
|
||||||
|
}
|
||||||
|
|
||||||
TMask_field& im = m.field(101);
|
TMask_field& im = m.field(101);
|
||||||
im.set_dirty();
|
im.set_dirty();
|
||||||
@ -1059,10 +1071,13 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
|||||||
if (f.dirty() || f.mask().query_mode())
|
if (f.dirty() || f.mask().query_mode())
|
||||||
{
|
{
|
||||||
const TLibro_giornale& gio = app().giornale();
|
const TLibro_giornale& gio = app().giornale();
|
||||||
if (dr <= gio.last_print())
|
if (dr < gio.last_print())
|
||||||
return f.error_box("La data dell'operazione e' antecedente al %s,\n"
|
{
|
||||||
"ultima stampa del libro giornale dell'esercizio %d",
|
f.error_box("La data dell'operazione e' antecedente al %s,\n"
|
||||||
gio.last_reg().string(), ae);
|
"ultima stampa del libro giornale dell'esercizio %d",
|
||||||
|
gio.last_reg().string(), ae);
|
||||||
|
if (m.insert_mode()) return FALSE;
|
||||||
|
}
|
||||||
if (dr < gio.last_reg())
|
if (dr < gio.last_reg())
|
||||||
f.warning_box("La data dell'operazione e' antecedente al %s,\n"
|
f.warning_box("La data dell'operazione e' antecedente al %s,\n"
|
||||||
"ultima registrazione sul libro giornale dell'esercizio %d",
|
"ultima registrazione sul libro giornale dell'esercizio %d",
|
||||||
@ -1078,9 +1093,6 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
|||||||
if (mov.read() == NOERR)
|
if (mov.read() == NOERR)
|
||||||
m.set(F_CODCAUS, mov.get(MOV_CODCAUS));
|
m.set(F_CODCAUS, mov.get(MOV_CODCAUS));
|
||||||
}
|
}
|
||||||
// Forza aggiornamento registro causale essendo cambiato l'anno
|
|
||||||
const bool ok = app().causale().read(m.get(F_CODCAUS), dr.year());
|
|
||||||
if (!ok) return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRegistro& reg = app().causale().reg();
|
TRegistro& reg = app().causale().reg();
|
||||||
@ -1091,12 +1103,17 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
const bool ok = reg.reread();
|
const bool ok = reg.reread();
|
||||||
if (!ok) return FALSE;
|
if (!ok) return FALSE;
|
||||||
|
if (app().iva() != nessuna_iva)
|
||||||
|
m.field(F_CODREG).on_hit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dr < reg.last_print())
|
if (dr < reg.last_print())
|
||||||
return f.error_box("La data dell'operazione e' antecedente al %s,\n"
|
{
|
||||||
"ultima stampa del registro '%s' dell'anno %d",
|
f.error_box("La data dell'operazione e' antecedente al %s,\n"
|
||||||
reg.last_print().string(), (const char*)codreg, dr.year());
|
"ultima stampa del registro '%s' dell'anno %d",
|
||||||
|
reg.last_print().string(), (const char*)codreg, dr.year());
|
||||||
|
if (m.insert_mode()) return FALSE;
|
||||||
|
}
|
||||||
if (dr < reg.last_reg())
|
if (dr < reg.last_reg())
|
||||||
f.warning_box("La data dell'operazione e' antecedente al %s,\n"
|
f.warning_box("La data dell'operazione e' antecedente al %s,\n"
|
||||||
"ultima registrazione sul registro '%s' dell'anno %d",
|
"ultima registrazione sul registro '%s' dell'anno %d",
|
||||||
@ -1117,14 +1134,12 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
|
|||||||
const int ae = date2esc(dc); // Esercizio corrispondente
|
const int ae = date2esc(dc); // Esercizio corrispondente
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
|
|
||||||
const char* data = "";
|
const char* data = "del 74/ter";
|
||||||
if (f.dlg() == F_DATACOMP)
|
if (f.dlg() == F_DATACOMP)
|
||||||
{
|
{
|
||||||
m.set(F_ANNOES, ae);
|
m.set(F_ANNOES, ae);
|
||||||
data = "di competenza";
|
data = "di competenza";
|
||||||
}
|
}
|
||||||
else
|
|
||||||
data = "del 74/ter";
|
|
||||||
|
|
||||||
if (ae)
|
if (ae)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user