cg0500.cpp Corretta lettura anno iva da config
cg2100.cpp Rifatta gestione pagamento immediato cg2102.cpp COrretto handler della data di registrazione cg2104.cpp Corretta gestione numero di riferimento partita cg2105.cpp Proposto in automatico l'importo dei pagamenti cg2200.cpp Azzerata ad ogni ciclo la maschera dei provisori cg3100.cpp Eliminati tutti gli accessi diretti alla tabella esercizi cg3600.cpp Aggiunta gestione e salvataggio colonne cglib04.cpp Tolti accessi diretti alla tabella degli esercizi pagament.cpp Corretta creazione nuove rate rispettando le classificazioni git-svn-id: svn://10.65.10.50/trunk@3985 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2d4866ed71
commit
ceb86a9c6b
@ -109,12 +109,11 @@ HIDDEN TCaus_app& app() { return (TCaus_app&) main_app(); }
|
|||||||
|
|
||||||
bool TCaus_app::filtra_reg(const TRelation * r)
|
bool TCaus_app::filtra_reg(const TRelation * r)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
|
||||||
|
|
||||||
const TRectype& rec = r->lfile().curr();
|
const TRectype& rec = r->lfile().curr();
|
||||||
const int anno = atoi(rec.get("CODTAB").left(4));
|
const int anno = atoi(rec.get("CODTAB").left(4));
|
||||||
|
|
||||||
if (anno == app().anno_iva())
|
bool ok = anno == app().anno_iva();
|
||||||
|
if (ok)
|
||||||
{
|
{
|
||||||
const TipoIVA tiporeg = (TipoIVA)rec.get_int("I0");
|
const TipoIVA tiporeg = (TipoIVA)rec.get_int("I0");
|
||||||
const bool corrisp = rec.get_bool("B0");
|
const bool corrisp = rec.get_bool("B0");
|
||||||
@ -799,7 +798,11 @@ void TCaus_app::on_config_change()
|
|||||||
|
|
||||||
_saldaconto = conf.get_bool("GesSal");
|
_saldaconto = conf.get_bool("GesSal");
|
||||||
_valuta = conf.get_bool("GesVal");
|
_valuta = conf.get_bool("GesVal");
|
||||||
_anno_iva = (int)conf.get_long("AnLiIv", NULL, -1, TDate(TODAY).year());
|
|
||||||
|
const int questanno = TDate(TODAY).year();
|
||||||
|
_anno_iva = (int)conf.get_long("AnLiIv", NULL, -1, questanno);
|
||||||
|
if (_anno_iva <= 0)
|
||||||
|
_anno_iva = questanno;
|
||||||
|
|
||||||
_msk->show(F_TIPO_MOV_1, saldaconto());
|
_msk->show(F_TIPO_MOV_1, saldaconto());
|
||||||
_msk->show(F_TIPO_MOV_2, saldaconto());
|
_msk->show(F_TIPO_MOV_2, saldaconto());
|
||||||
|
165
cg/cg2100.cpp
165
cg/cg2100.cpp
@ -14,9 +14,30 @@
|
|||||||
#include <clifo.h>
|
#include <clifo.h>
|
||||||
#include <rcausali.h>
|
#include <rcausali.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Dati incasso immediato
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TDati_incasso : public TObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int _step;
|
||||||
|
TString _causale;
|
||||||
|
TBill _clifo;
|
||||||
|
TDate _datadoc;
|
||||||
|
TString _numdoc;
|
||||||
|
real _totale;
|
||||||
|
TString _descrizione;
|
||||||
|
TString _causale_fattura;
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Applicazione principale
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TPrimanota_application::TPrimanota_application()
|
TPrimanota_application::TPrimanota_application()
|
||||||
: _rel(NULL), _mode(0), _iva(nessuna_iva), _causale(NULL), _giornale(NULL),
|
: _rel(NULL), _mode(0), _iva(nessuna_iva), _causale(NULL), _giornale(NULL),
|
||||||
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY)
|
_lastreg(0), _last_dreg(TODAY), _last_dcom(TODAY), _incasso(NULL)
|
||||||
{
|
{
|
||||||
memset(_msk, 0, sizeof(_msk));
|
memset(_msk, 0, sizeof(_msk));
|
||||||
}
|
}
|
||||||
@ -164,6 +185,8 @@ bool TPrimanota_application::user_create()
|
|||||||
open_files(LF_ATTIV, LF_SALDI, LF_COMUNI, LF_OCCAS, LF_NDITTE, 0);
|
open_files(LF_ATTIV, LF_SALDI, LF_COMUNI, LF_OCCAS, LF_NDITTE, 0);
|
||||||
open_files(LF_SCADENZE, LF_PAGSCA, 0);
|
open_files(LF_SCADENZE, LF_PAGSCA, 0);
|
||||||
|
|
||||||
|
_incasso = new TDati_incasso;
|
||||||
|
|
||||||
_rel = new TMovimentoPN;
|
_rel = new TMovimentoPN;
|
||||||
_rel->add(LF_PARTITE, "NREG=NUMREG", 2); // Collega la partita aperta dalla fattura
|
_rel->add(LF_PARTITE, "NREG=NUMREG", 2); // Collega la partita aperta dalla fattura
|
||||||
|
|
||||||
@ -184,7 +207,9 @@ bool TPrimanota_application::user_create()
|
|||||||
|
|
||||||
|
|
||||||
bool TPrimanota_application::save_and_new() const
|
bool TPrimanota_application::save_and_new() const
|
||||||
{ return _savenew; }
|
{
|
||||||
|
return _savenew || _incasso->_step == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TPrimanota_application::user_destroy()
|
bool TPrimanota_application::user_destroy()
|
||||||
@ -197,6 +222,9 @@ bool TPrimanota_application::user_destroy()
|
|||||||
delete _giornale;
|
delete _giornale;
|
||||||
delete _causale;
|
delete _causale;
|
||||||
delete _rel;
|
delete _rel;
|
||||||
|
|
||||||
|
delete _incasso;
|
||||||
|
|
||||||
close_files();
|
close_files();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -254,7 +282,7 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
|
|||||||
TEdit_field& numrif = m->efield(F_NUMRIF);
|
TEdit_field& numrif = m->efield(F_NUMRIF);
|
||||||
numrif.set_justify(iva == iva_acquisti ? _num_for : _num_cli);
|
numrif.set_justify(iva == iva_acquisti ? _num_for : _num_cli);
|
||||||
numrif.set_trim(!numrif.right_justified());
|
numrif.set_trim(!numrif.right_justified());
|
||||||
activate_numrif(FALSE);
|
activate_numrif(*m, FALSE);
|
||||||
|
|
||||||
const bool av = causale().reg().agenzia_viaggi();
|
const bool av = causale().reg().agenzia_viaggi();
|
||||||
m->show(F_DATA74TER, av);
|
m->show(F_DATA74TER, av);
|
||||||
@ -368,7 +396,7 @@ bool TPrimanota_application::changing_mask(int mode)
|
|||||||
|
|
||||||
TMask* TPrimanota_application::get_mask(int mode)
|
TMask* TPrimanota_application::get_mask(int mode)
|
||||||
{
|
{
|
||||||
int annoes = 0, annoiva = 0;
|
int annoiva = 0;
|
||||||
TString16 caus;
|
TString16 caus;
|
||||||
|
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
@ -376,21 +404,19 @@ TMask* TPrimanota_application::get_mask(int mode)
|
|||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case MODE_INS:
|
case MODE_INS:
|
||||||
annoes = _msk[0]->get_int(F_ANNOES);
|
|
||||||
annoiva = _msk[0]->get_int(F_ANNOIVA);
|
annoiva = _msk[0]->get_int(F_ANNOIVA);
|
||||||
caus = _msk[0]->get(F_CODCAUS);
|
caus = _msk[0]->get(F_CODCAUS);
|
||||||
break;
|
break;
|
||||||
case MODE_MOD:
|
case MODE_MOD:
|
||||||
annoes = _rel->lfile().get_int("ANNOES");
|
annoiva = _rel->curr().get_int("ANNOIVA");
|
||||||
annoiva = _rel->lfile().get_int("ANNOIVA");
|
caus = _rel->curr().get("CODCAUS");
|
||||||
caus = _rel->lfile().get("CODCAUS");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return load_mask(0);
|
return load_mask(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (giornale().year() != annoes)
|
if (giornale().year() != annoiva)
|
||||||
giornale().read(annoes);
|
giornale().read(annoiva);
|
||||||
|
|
||||||
const TCausale& c = causale();
|
const TCausale& c = causale();
|
||||||
if (caus != c.codice() || (c.iva() != nessuna_iva && c.reg().year() != annoiva))
|
if (caus != c.codice() || (c.iva() != nessuna_iva && c.reg().year() != annoiva))
|
||||||
@ -437,15 +463,14 @@ 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 valintra = causale().valintra();
|
|
||||||
const bool corrisp = causale().corrispettivi();
|
|
||||||
|
|
||||||
if (_iva == nessuna_iva)
|
if (_iva == nessuna_iva)
|
||||||
{
|
{
|
||||||
m.show(-5, _is_saldaconto); // Abilita campi saldaconto
|
m.show(-5, _is_saldaconto); // Abilita campi saldaconto
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const bool corrisp = causale().corrispettivi();
|
||||||
|
|
||||||
bool clig, forg;
|
bool clig, forg;
|
||||||
if (_iva == iva_acquisti)
|
if (_iva == iva_acquisti)
|
||||||
{
|
{
|
||||||
@ -462,9 +487,13 @@ void TPrimanota_application::init_mask(TMask& m)
|
|||||||
if (corrisp) m.hide(F_STATOPAIV);
|
if (corrisp) m.hide(F_STATOPAIV);
|
||||||
|
|
||||||
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRLIRE, F_CORRVAL (GROUP 4)
|
// Show/Hide campi valuta: F_VALUTAINTRA, F_CAMBIOINTRA, F_CORRLIRE, F_CORRVAL (GROUP 4)
|
||||||
m.show(-4, valintra);
|
m.show(-4, causale().valintra());
|
||||||
|
|
||||||
m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard
|
m.show(F_CODIVA, m.insert_mode()); // Codice IVA standard
|
||||||
|
|
||||||
|
TSheet_field& is = ivas();
|
||||||
|
is.enable_column(2, _iva == iva_acquisti); // Tipo detrazione
|
||||||
|
is.enable_column(4, !m.insert_mode()); // Tipo costo ricavo
|
||||||
|
|
||||||
if (is_fattura())
|
if (is_fattura())
|
||||||
{
|
{
|
||||||
@ -504,24 +533,30 @@ void TPrimanota_application::init_query_mode(TMask& m)
|
|||||||
m.set(F_DATAREG, _last_dreg);
|
m.set(F_DATAREG, _last_dreg);
|
||||||
m.set(F_DATACOMP, _last_dcom);
|
m.set(F_DATACOMP, _last_dcom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_incasso->_step = 0; // Azzera flag di incasso immediato
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TPrimanota_application::fill_sheet(TMask& m) const
|
void TPrimanota_application::fill_sheet(TMask& m) const
|
||||||
{
|
{
|
||||||
const int filler = 16;
|
const int filler = 16;
|
||||||
if (_iva != nessuna_iva || !is_saldaconto())
|
|
||||||
|
const int cgpos = m.id2pos(F_SHEETCG);
|
||||||
|
const int ivpos = m.id2pos(F_SHEETIVA);
|
||||||
|
|
||||||
|
if (cgpos > 0 && (ivpos > 0 || !is_saldaconto()))
|
||||||
{
|
{
|
||||||
TSheet_field& cgs = (TSheet_field&)m.field(F_SHEETCG);
|
TSheet_field& cgs = (TSheet_field&)m.fld(cgpos);
|
||||||
for (int r = cgs.items(); r < filler; r++) cgs.row(r);
|
for (int r = cgs.items(); r < filler; r++)
|
||||||
|
cgs.row(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_iva != nessuna_iva)
|
if (ivpos > 0)
|
||||||
{
|
{
|
||||||
TSheet_field& ivas = (TSheet_field&)m.field(F_SHEETIVA);
|
TSheet_field& ivas = (TSheet_field&)m.fld(ivpos);
|
||||||
for (int r = ivas.items(); r < filler; r++) ivas.row(r);
|
for (int r = ivas.items(); r < filler; r++)
|
||||||
ivas.enable_column(2, _iva == iva_acquisti); // Tipo detrazione
|
ivas.row(r);
|
||||||
ivas.enable_column(4, !m.insert_mode()); // Tipo costo ricavo
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,9 +573,28 @@ const char* TPrimanota_application::get_next_key()
|
|||||||
TMask& m = curr_mask();
|
TMask& m = curr_mask();
|
||||||
if (m.insert_mode())
|
if (m.insert_mode())
|
||||||
{
|
{
|
||||||
_tmp.add(F_CODCAUS); _tmp.add(m.get(F_CODCAUS)); // Ricopia causale
|
_tmp.add(F_CODCAUS); // Ricopia causale
|
||||||
_tmp.add(F_DATAREG); _tmp.add(m.get(F_DATAREG)); // data operazione
|
switch (_incasso->_step)
|
||||||
_tmp.add(F_DATACOMP); _tmp.add(m.get(F_DATACOMP)); // competenza
|
{
|
||||||
|
case 1:
|
||||||
|
_tmp.add(_incasso->_causale);
|
||||||
|
_msk[0]->set(F_CODCAUS, _incasso->_causale); // Joke get_mask
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_tmp.add(_incasso->_causale_fattura);
|
||||||
|
_msk[0]->set(F_CODCAUS, _incasso->_causale_fattura); // Joke get_mask
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_tmp.add(m.get(F_CODCAUS)); // Ultima causale usata
|
||||||
|
_msk[0]->set(F_CODCAUS, m.get(F_CODCAUS));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_tmp.add(F_DATAREG); // Ricopia data operazione
|
||||||
|
_tmp.add(m.get(F_DATAREG));
|
||||||
|
|
||||||
|
_tmp.add(F_DATACOMP); // Ricopia data competenza
|
||||||
|
_tmp.add(m.get(F_DATACOMP));
|
||||||
|
|
||||||
if (iva() == iva_vendite)
|
if (iva() == iva_vendite)
|
||||||
{
|
{
|
||||||
@ -575,7 +629,7 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
|||||||
partite().destroy();
|
partite().destroy();
|
||||||
if (is_fattura())
|
if (is_fattura())
|
||||||
{
|
{
|
||||||
activate_numrif(FALSE);
|
activate_numrif(m, FALSE);
|
||||||
const TString16 dt(m.get(F_DATADOC));
|
const TString16 dt(m.get(F_DATADOC));
|
||||||
set_pagamento(NULL,dt);
|
set_pagamento(NULL,dt);
|
||||||
set_scadenze(m);
|
set_scadenze(m);
|
||||||
@ -587,6 +641,9 @@ void TPrimanota_application::init_insert_mode(TMask& m)
|
|||||||
|
|
||||||
_saldi.reset(); // Inizializza saldi
|
_saldi.reset(); // Inizializza saldi
|
||||||
|
|
||||||
|
if (_incasso->_step == 1)
|
||||||
|
genera_incasso(NULL);
|
||||||
|
|
||||||
_as400 = FALSE; // Un movimento nuovo non puo' essere trasferito da AS400
|
_as400 = FALSE; // Un movimento nuovo non puo' essere trasferito da AS400
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,7 +1114,11 @@ bool TPrimanota_application::remove()
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Gestione incasso immediato
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
HIDDEN bool incasso_handler(TMask_field& f, KEY k)
|
HIDDEN bool incasso_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
@ -1157,7 +1218,7 @@ void TPrimanota_application::genera_incasso(const char* causimm)
|
|||||||
clifo_id = F_CLIENTE; break;
|
clifo_id = F_CLIENTE; break;
|
||||||
case 'F':
|
case 'F':
|
||||||
clifo_id = F_FORNITORE; break;
|
clifo_id = F_FORNITORE; break;
|
||||||
default :
|
default :
|
||||||
clifo_id = I_SOTTOCONTO; break;
|
clifo_id = I_SOTTOCONTO; break;
|
||||||
}
|
}
|
||||||
r.put("SOTTOCONTO", m.get(clifo_id));
|
r.put("SOTTOCONTO", m.get(clifo_id));
|
||||||
@ -1226,6 +1287,54 @@ void TPrimanota_application::genera_incasso(const char* causimm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
void TPrimanota_application::genera_incasso(const char* causimm)
|
||||||
|
{
|
||||||
|
TMask& m = curr_mask();
|
||||||
|
|
||||||
|
if (causimm)
|
||||||
|
{
|
||||||
|
_incasso->_causale = causimm;
|
||||||
|
_incasso->_causale_fattura = m.get(F_CODCAUS);
|
||||||
|
_incasso->_datadoc = m.get(F_DATADOC);
|
||||||
|
_incasso->_numdoc = m.get(F_NUMDOC);
|
||||||
|
_incasso->_clifo.get(_rel->cg(0));
|
||||||
|
_incasso->_totale = m.get_real(F_TOTALE);
|
||||||
|
_incasso->_descrizione= m.get(F_DESCR);
|
||||||
|
_incasso->_step = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCausale& caus = causale();
|
||||||
|
m.set(F_DATADOC, _incasso->_datadoc);
|
||||||
|
m.set(F_NUMDOC, _incasso->_numdoc);
|
||||||
|
TBill contro; caus.bill(2, contro);
|
||||||
|
|
||||||
|
cgs().reset();
|
||||||
|
TToken_string& row1 = cgs().row(0);
|
||||||
|
TImporto imp(caus.sezione_clifo(), _incasso->_totale);
|
||||||
|
imp.add_to(row1, 0);
|
||||||
|
row1.add(_incasso->_clifo.string(0x3));
|
||||||
|
row1.add(" ");
|
||||||
|
row1.add(_incasso->_descrizione);
|
||||||
|
row1.add(contro.string(0x3));
|
||||||
|
|
||||||
|
TToken_string& row2 = cgs().row(1);
|
||||||
|
imp.swap_section();
|
||||||
|
imp.add_to(row2, 0);
|
||||||
|
row2.add(contro.string(0x3));
|
||||||
|
row2.add(" ");
|
||||||
|
row2.add(caus.desc_agg(2));
|
||||||
|
row2.add(_incasso->_clifo.string(0x3));
|
||||||
|
_incasso->_step = 2;
|
||||||
|
fill_sheet(m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Gestione collegamento 770
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool TPrimanota_application::is_percipient(long forn, char& tipper, long& codper) const
|
bool TPrimanota_application::is_percipient(long forn, char& tipper, long& codper) const
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST I_SEZIONE1 1 8
|
LIST I_SEZIONE1 1 7
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 7 "Riga 1 "
|
PROMPT 1 7 "Riga 1 "
|
||||||
HELP "Sezione del conto della prima riga"
|
HELP "Sezione del conto della prima riga"
|
||||||
@ -105,7 +105,7 @@ BEGIN
|
|||||||
MESSAGE COPY,I_IMPORTO2
|
MESSAGE COPY,I_IMPORTO2
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST F_CLIFO 1 12
|
LIST F_CLIFO 1 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 7 ""
|
PROMPT 37 7 ""
|
||||||
ITEM " |Conto" MESSAGE SHOW,I_SOTTOCONTO|HIDE,F_FORNITORE|HIDE,F_CLIENTE
|
ITEM " |Conto" MESSAGE SHOW,I_SOTTOCONTO|HIDE,F_FORNITORE|HIDE,F_CLIENTE
|
||||||
@ -190,7 +190,7 @@ BEGIN
|
|||||||
ADD RUN cg0 -0
|
ADD RUN cg0 -0
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST I_SEZIONE2 1 8
|
LIST I_SEZIONE2 1 7
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 8 "Riga 2 "
|
PROMPT 1 8 "Riga 2 "
|
||||||
HELP "Sezione del conto della prima riga"
|
HELP "Sezione del conto della prima riga"
|
||||||
@ -206,7 +206,7 @@ BEGIN
|
|||||||
FLAGS "R"
|
FLAGS "R"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST DLG_NULL 1 12
|
LIST DLG_NULL 1 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 8 ""
|
PROMPT 37 8 ""
|
||||||
ITEM " |Conto"
|
ITEM " |Conto"
|
||||||
@ -244,7 +244,7 @@ BEGIN
|
|||||||
WARNING "Sottoconto assente"
|
WARNING "Sottoconto assente"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST I_SEZIONE3 1 8
|
LIST I_SEZIONE3 1 7
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 "Riga 3 "
|
PROMPT 1 9 "Riga 3 "
|
||||||
HELP "Sezione del conto di terza riga"
|
HELP "Sezione del conto di terza riga"
|
||||||
@ -260,7 +260,7 @@ BEGIN
|
|||||||
FLAGS "R"
|
FLAGS "R"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST DLG_NULL 1 12
|
LIST DLG_NULL 1 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 9 ""
|
PROMPT 37 9 ""
|
||||||
ITEM " |Conto"
|
ITEM " |Conto"
|
||||||
@ -296,7 +296,7 @@ BEGIN
|
|||||||
WARNING "Sottoconto assente"
|
WARNING "Sottoconto assente"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST I_SEZIONE4 1 8
|
LIST I_SEZIONE4 1 7
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 10 "Riga 4 "
|
PROMPT 1 10 "Riga 4 "
|
||||||
HELP "Sezione del conto di quarta riga"
|
HELP "Sezione del conto di quarta riga"
|
||||||
@ -312,7 +312,7 @@ BEGIN
|
|||||||
FLAGS "R"
|
FLAGS "R"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST DLG_NULL 1 12
|
LIST DLG_NULL 1 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 10 ""
|
PROMPT 37 10 ""
|
||||||
ITEM " |Conto"
|
ITEM " |Conto"
|
||||||
@ -349,13 +349,15 @@ BEGIN
|
|||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
BUTTON DLG_SAVEREC 9 2
|
BUTTON DLG_SAVEREC 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -12 -1 "~Registra"
|
PROMPT -12 -1 "~Registra"
|
||||||
|
PICTURE BMP_SAVEREC
|
||||||
|
PICTURE BMP_SAVERECDN
|
||||||
MESSAGE EXIT,K_SAVE
|
MESSAGE EXIT,K_SAVE
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 9 2
|
BUTTON DLG_CANCEL 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -22 -1 ""
|
PROMPT -22 -1 ""
|
||||||
END
|
END
|
||||||
|
@ -126,13 +126,11 @@ BEGIN
|
|||||||
WARNING "L'importo in valuta deve essere specificato"
|
WARNING "L'importo in valuta deve essere specificato"
|
||||||
END
|
END
|
||||||
|
|
||||||
RADIOBUTTON S_SALDOACC 1 24
|
DATE S_DATAPAG
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 ""
|
PROMPT 2 10 "Data pag. "
|
||||||
FLAGS "Z"
|
CHECKTYPE REQUIRED
|
||||||
ITEM "A|Acconto"
|
FIELD LF_PARTITE->DATAPAG
|
||||||
ITEM "S|Saldo"
|
|
||||||
FIELD ACCSAL
|
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST S_TIPOPAG 1 33
|
LIST S_TIPOPAG 1 33
|
||||||
@ -150,11 +148,13 @@ BEGIN
|
|||||||
FIELD LF_PARTITE->TIPOPAG
|
FIELD LF_PARTITE->TIPOPAG
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE S_DATAPAG
|
RADIOBUTTON S_SALDOACC 1 24
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 11 "Data pag. "
|
PROMPT 1 10 ""
|
||||||
CHECKTYPE REQUIRED
|
FLAGS "Z"
|
||||||
FIELD LF_PARTITE->DATAPAG
|
ITEM "A|Acconto"
|
||||||
|
ITEM "S|Saldo"
|
||||||
|
FIELD ACCSAL
|
||||||
END
|
END
|
||||||
|
|
||||||
TEXT DLG_NULL
|
TEXT DLG_NULL
|
||||||
|
@ -1551,16 +1551,15 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
|
|||||||
// Certified 99%
|
// Certified 99%
|
||||||
bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
|
bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
if (key == K_TAB && f.to_check(key, TRUE))
|
||||||
if (key == K_TAB /* && m.is_running() */ && !f.empty())
|
|
||||||
{
|
{
|
||||||
TPrimanota_application& a = app();
|
TPrimanota_application& a = app();
|
||||||
const long max = a._lastreg+1;
|
|
||||||
|
|
||||||
a._skip_giornale_check = FALSE;
|
a._skip_giornale_check = FALSE;
|
||||||
a._skip_bollato_check = FALSE;
|
a._skip_bollato_check = FALSE;
|
||||||
|
|
||||||
const long num = atol(f.get());
|
const long max = a._lastreg+1;
|
||||||
|
const long num = f.empty() ? max : atol(f.get());
|
||||||
if (num < max)
|
if (num < max)
|
||||||
{
|
{
|
||||||
if (a.find(1))
|
if (a.find(1))
|
||||||
@ -1590,6 +1589,7 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key)
|
|||||||
|
|
||||||
if (ok) // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9
|
if (ok) // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9
|
||||||
{
|
{
|
||||||
|
TMask& m = f.mask();
|
||||||
m.set(F_DATAREG, mov.get("DATAREG"), TRUE);
|
m.set(F_DATAREG, mov.get("DATAREG"), TRUE);
|
||||||
m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE);
|
m.set(F_DATACOMP, mov.get("DATACOMP"), TRUE);
|
||||||
m.set(F_CODCAUS, mov.get("CODCAUS"));
|
m.set(F_CODCAUS, mov.get("CODCAUS"));
|
||||||
@ -1740,7 +1740,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
|
|||||||
reg.last_print().string(), (const char*)codreg, ar);
|
reg.last_print().string(), (const char*)codreg, ar);
|
||||||
if (error) return FALSE;
|
if (error) return FALSE;
|
||||||
}
|
}
|
||||||
if (key == K_TAB && dr < reg.last_reg())
|
if (f.dirty() && 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' del %d",
|
"ultima registrazione sul registro '%s' del %d",
|
||||||
reg.last_reg().string(), (const char*)codreg, ar);
|
reg.last_reg().string(), (const char*)codreg, ar);
|
||||||
@ -2012,7 +2012,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
m.show(F_STATOPAIV); // Stato partita IVA
|
m.show(F_STATOPAIV); // Stato partita IVA
|
||||||
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE); // Partita IVA
|
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE); // Partita IVA
|
||||||
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE); // Codice Fiscale
|
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE); // Codice Fiscale
|
||||||
a.activate_numrif(TRUE);
|
a.activate_numrif(m, TRUE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2086,7 +2086,7 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
|
|||||||
f.warning_box("Attenzione, il saldaconto verra' eliminato!");
|
f.warning_box("Attenzione, il saldaconto verra' eliminato!");
|
||||||
f.set_dirty(); // warning_box cleans the field!
|
f.set_dirty(); // warning_box cleans the field!
|
||||||
}
|
}
|
||||||
a.activate_numrif(TRUE);
|
a.activate_numrif(m, TRUE);
|
||||||
|
|
||||||
if (f.focusdirty())
|
if (f.focusdirty())
|
||||||
{
|
{
|
||||||
@ -2417,10 +2417,8 @@ bool TPrimanota_application::corrvaluta_handler(TMask_field& f, KEY key)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPrimanota_application::activate_numrif(bool init_pag)
|
bool TPrimanota_application::activate_numrif(TMask& m, bool init_pag)
|
||||||
{
|
{
|
||||||
TMask& m = curr_mask();
|
|
||||||
|
|
||||||
bool shown = is_saldaconto(); // Il numero riferimento esiste
|
bool shown = is_saldaconto(); // Il numero riferimento esiste
|
||||||
|
|
||||||
if (shown)
|
if (shown)
|
||||||
@ -2475,7 +2473,7 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
|
|||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
const bool run = m.is_running();
|
const bool run = m.is_running();
|
||||||
|
|
||||||
if (key == K_TAB && (f.focusdirty() || !run))
|
if ((key == K_TAB && f.focusdirty()) || !run)
|
||||||
{
|
{
|
||||||
TPrimanota_application& a = app();
|
TPrimanota_application& a = app();
|
||||||
|
|
||||||
@ -2506,7 +2504,7 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
|
|||||||
recalcg = FALSE;
|
recalcg = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.activate_numrif(TRUE);
|
a.activate_numrif(m, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
m.show(F_SHEETCG, anchecg);
|
m.show(F_SHEETCG, anchecg);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include "cg2103.h"
|
#include "cg2103.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class TDati_incasso;
|
||||||
|
|
||||||
class TPrimanota_application : public TRelation_application
|
class TPrimanota_application : public TRelation_application
|
||||||
{
|
{
|
||||||
TArray _file; // Tutti i fiels da usare
|
TArray _file; // Tutti i fiels da usare
|
||||||
@ -50,6 +52,8 @@ class TPrimanota_application : public TRelation_application
|
|||||||
bool _is_saldaconto; // saldaconto si/no (vede parametri e causale)
|
bool _is_saldaconto; // saldaconto si/no (vede parametri e causale)
|
||||||
bool _scad_free; // posso variare liberamente le rate della fattura
|
bool _scad_free; // posso variare liberamente le rate della fattura
|
||||||
|
|
||||||
|
TDati_incasso* _incasso; // Dati per gestire incasso immediato
|
||||||
|
|
||||||
TSaldo_agg _saldi; // Saldi da aggiornare
|
TSaldo_agg _saldi; // Saldi da aggiornare
|
||||||
TPartite_array _partite; // Partite coinvolte
|
TPartite_array _partite; // Partite coinvolte
|
||||||
|
|
||||||
@ -182,7 +186,7 @@ protected:
|
|||||||
bool is_fattura() const { return gestione_saldaconto() && causale().tipomov() == 1; }
|
bool is_fattura() const { return gestione_saldaconto() && causale().tipomov() == 1; }
|
||||||
bool is_nota_credito() const { return gestione_saldaconto() && causale().tipomov() == 2; }
|
bool is_nota_credito() const { return gestione_saldaconto() && causale().tipomov() == 2; }
|
||||||
bool is_pagamento() const { return gestione_saldaconto() && causale().tipomov() >= 3; }
|
bool is_pagamento() const { return gestione_saldaconto() && causale().tipomov() >= 3; }
|
||||||
bool activate_numrif(bool set_pag);
|
bool activate_numrif(TMask& m, bool set_pag);
|
||||||
|
|
||||||
void fill_sheet(TMask& m) const;
|
void fill_sheet(TMask& m) const;
|
||||||
void init_mask(TMask& m);
|
void init_mask(TMask& m);
|
||||||
|
@ -404,7 +404,7 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (key == K_TAB && a.is_fattura())
|
if (key == K_TAB && a.is_fattura())
|
||||||
a.activate_numrif(TRUE);
|
a.activate_numrif(m, TRUE);
|
||||||
|
|
||||||
if (ok && key == K_ENTER && m.edit_mode())
|
if (ok && key == K_ENTER && m.edit_mode())
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
#include "saldacon.h"
|
#include "saldacon.h"
|
||||||
#include "sc0100p.h"
|
#include "sc0100p.h"
|
||||||
|
#include "cglib.h"
|
||||||
#else
|
#else
|
||||||
#include "cg2100.h" // Campi maschere prima nota
|
#include "cg2100.h" // Campi maschere prima nota
|
||||||
#include "cg2102.h" // Applicazione di prima nota
|
#include "cg2102.h" // Applicazione di prima nota
|
||||||
@ -1751,6 +1752,12 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
|||||||
const TRiga_scadenze& scaden = p.rata(nriga, nrata);
|
const TRiga_scadenze& scaden = p.rata(nriga, nrata);
|
||||||
m.set_pag(oldpag, scaden, _residuo);
|
m.set_pag(oldpag, scaden, _residuo);
|
||||||
}
|
}
|
||||||
|
if (nuovo) // Inizializza automaticamente l'importo
|
||||||
|
{
|
||||||
|
TMask_field& imp = m.field(S_IMPORTO);
|
||||||
|
imp.set_dirty();
|
||||||
|
imp.on_key(K_F8);
|
||||||
|
}
|
||||||
|
|
||||||
KEY key = m.run();
|
KEY key = m.run();
|
||||||
|
|
||||||
|
@ -265,11 +265,17 @@ bool TProvvisori_app::menu(MENU_TAG)
|
|||||||
|
|
||||||
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
|
TCursor& cur = *m.efield(F_FROMDATE).browse()->cursor();
|
||||||
|
|
||||||
KEY key;
|
while (TRUE)
|
||||||
while ((key = m.run()) != K_QUIT)
|
|
||||||
{
|
{
|
||||||
TRectype from(LF_MOV);
|
TRectype from(LF_MOV), to(LF_MOV);
|
||||||
TRectype to(LF_MOV);
|
cur.setregion(from, to);
|
||||||
|
cur.set_filterfunction(NULL);
|
||||||
|
|
||||||
|
m.reset();
|
||||||
|
|
||||||
|
const KEY key = m.run();
|
||||||
|
if (key == K_QUIT)
|
||||||
|
break;
|
||||||
|
|
||||||
TString16 from_d = m.get(F_FROMDATE);
|
TString16 from_d = m.get(F_FROMDATE);
|
||||||
TString16 to_d = m.get(F_TODATE);
|
TString16 to_d = m.get(F_TODATE);
|
||||||
@ -342,10 +348,6 @@ bool TProvvisori_app::menu(MENU_TAG)
|
|||||||
delete_provv(cur, pi);
|
delete_provv(cur, pi);
|
||||||
|
|
||||||
cur.freeze(FALSE);
|
cur.freeze(FALSE);
|
||||||
from.zero(); to.zero();
|
|
||||||
cur.setregion(from, to);
|
|
||||||
cur.set_filterfunction(NULL);
|
|
||||||
m.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
153
cg/cg3100.cpp
153
cg/cg3100.cpp
@ -10,18 +10,19 @@
|
|||||||
#include "cg3.h"
|
#include "cg3.h"
|
||||||
#include "cg3100.h"
|
#include "cg3100.h"
|
||||||
|
|
||||||
#include <mov.h>
|
|
||||||
#include <rmov.h>
|
|
||||||
#include <rmoviva.h>
|
|
||||||
#include <pconti.h>
|
|
||||||
#include <comuni.h>
|
|
||||||
#include <clifo.h>
|
|
||||||
#include <saldi.h>
|
|
||||||
#include <attiv.h>
|
#include <attiv.h>
|
||||||
#include <causali.h>
|
#include <causali.h>
|
||||||
|
#include <clifo.h>
|
||||||
|
#include <comuni.h>
|
||||||
|
#include <mov.h>
|
||||||
#include <nditte.h>
|
#include <nditte.h>
|
||||||
|
#include <pconti.h>
|
||||||
|
#include <rmov.h>
|
||||||
|
#include <rmoviva.h>
|
||||||
|
#include <saldi.h>
|
||||||
|
|
||||||
#include "cglib.h"
|
#include "cglib.h"
|
||||||
#include "cglib04.h"
|
//#include "cglib04.h"
|
||||||
#include "cglib03.h"
|
#include "cglib03.h"
|
||||||
#include "cg2103.h"
|
#include "cg2103.h"
|
||||||
|
|
||||||
@ -33,7 +34,7 @@ enum liste {
|
|||||||
|
|
||||||
bool filter_func (const TRelation *);
|
bool filter_func (const TRelation *);
|
||||||
bool filter_func_fatture (const TRelation *);
|
bool filter_func_fatture (const TRelation *);
|
||||||
bool annoes (TMask_field&, KEY);
|
bool annoes_handler(TMask_field&, KEY);
|
||||||
bool data_inizio (TMask_field&, KEY);
|
bool data_inizio (TMask_field&, KEY);
|
||||||
bool data_fine (TMask_field&, KEY);
|
bool data_fine (TMask_field&, KEY);
|
||||||
|
|
||||||
@ -68,12 +69,11 @@ class TListaMov_application : public TPrintapp
|
|||||||
{
|
{
|
||||||
friend bool filter_func (const TRelation *);
|
friend bool filter_func (const TRelation *);
|
||||||
friend bool filter_func_fatture (const TRelation *);
|
friend bool filter_func_fatture (const TRelation *);
|
||||||
friend bool annoes (TMask_field&, KEY);
|
friend bool annoes_handler(TMask_field&, KEY);
|
||||||
friend bool data_inizio (TMask_field&, KEY);
|
friend bool data_inizio (TMask_field&, KEY);
|
||||||
friend bool data_fine (TMask_field&, KEY);
|
friend bool data_fine (TMask_field&, KEY);
|
||||||
|
|
||||||
TRigaiva_array _c;
|
TRigaiva_array _c;
|
||||||
TEsercizi_contabili _ec;
|
|
||||||
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
|
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
|
||||||
TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi;
|
TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi;
|
||||||
TRelation * _relmov1,* _relmov2,* _relmov3;
|
TRelation * _relmov1,* _relmov2,* _relmov3;
|
||||||
@ -139,57 +139,18 @@ public:
|
|||||||
HIDDEN inline TListaMov_application & app()
|
HIDDEN inline TListaMov_application & app()
|
||||||
{ return (TListaMov_application&)main_app();}
|
{ return (TListaMov_application&)main_app();}
|
||||||
|
|
||||||
TDate InizioEsercizio(int anno)
|
bool annoes_handler(TMask_field& f, KEY k)
|
||||||
{
|
|
||||||
TTable TabEs ("ESC");
|
|
||||||
TString16 codtab;
|
|
||||||
TDate inizio_es;
|
|
||||||
|
|
||||||
TabEs.zero();
|
|
||||||
codtab.format ("%04d", anno);
|
|
||||||
TabEs.put ("CODTAB", codtab);
|
|
||||||
TabEs.read();
|
|
||||||
if (TabEs.good())
|
|
||||||
inizio_es= TabEs.get_date ("D0");
|
|
||||||
|
|
||||||
return inizio_es;
|
|
||||||
}
|
|
||||||
|
|
||||||
TDate FineEsercizio(int anno)
|
|
||||||
{
|
|
||||||
TTable TabEs ("ESC");
|
|
||||||
TString16 codtab;
|
|
||||||
TDate fine_es;
|
|
||||||
|
|
||||||
TabEs.zero();
|
|
||||||
codtab.format ("%04d", anno);
|
|
||||||
TabEs.put ("CODTAB", codtab);
|
|
||||||
TabEs.read();
|
|
||||||
if (TabEs.good())
|
|
||||||
fine_es = TabEs.get_date ("D1");
|
|
||||||
else fine_es = botime;
|
|
||||||
|
|
||||||
return fine_es;
|
|
||||||
}
|
|
||||||
|
|
||||||
int EsercizioSucc(int code)
|
|
||||||
{
|
|
||||||
TEsercizi_contabili esc;
|
|
||||||
return esc.next(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool annoes(TMask_field& f, KEY k)
|
|
||||||
{
|
{
|
||||||
if (k == K_TAB)
|
if (k == K_TAB)
|
||||||
{
|
{
|
||||||
int anno = f.mask().get_int (F_ANNO);
|
const int anno = atoi(f.get());
|
||||||
if ( anno != 0 )
|
TEsercizi_contabili esc;
|
||||||
|
if (esc.exist(anno))
|
||||||
{
|
{
|
||||||
f.mask().field(F_DATAINI).set(InizioEsercizio(anno));
|
f.mask().set(F_DATAINI, esc[anno].inizio());
|
||||||
TDate fine = FineEsercizio(EsercizioSucc(anno));
|
const int prossimo = esc.next(anno);
|
||||||
if (fine == botime)
|
const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine();
|
||||||
fine = FineEsercizio(anno);
|
f.mask().set(F_DATAFIN, fine);
|
||||||
f.mask().field(F_DATAFIN).set(fine);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -204,17 +165,22 @@ bool data_inizio(TMask_field& f, KEY k)
|
|||||||
TDate data = f.mask().get(F_DATAINI);
|
TDate data = f.mask().get(F_DATAINI);
|
||||||
if (app()._masc == "cg3100a")
|
if (app()._masc == "cg3100a")
|
||||||
decidi = f.mask().get_int (F_DECIDI);
|
decidi = f.mask().get_int (F_DECIDI);
|
||||||
if ( anno != 0 && ( (app()._masc == "cg3100b") ||
|
|
||||||
((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
|
TEsercizi_contabili esc;
|
||||||
|
if (esc.exist(anno) && ( (app()._masc == "cg3100b") ||
|
||||||
|
((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
|
||||||
{
|
{
|
||||||
if (!data.ok()) //se la data e' vuota
|
const TDate inizio = esc[anno].inizio();
|
||||||
f.mask().field(F_DATAINI).set(InizioEsercizio(anno));
|
if (data.ok())
|
||||||
else
|
{
|
||||||
if (data < InizioEsercizio(anno))
|
if (data < inizio)
|
||||||
{
|
{
|
||||||
f.error_box("La data indicata non deve essere inferiore alla data di inizio esercizio");
|
f.error_box("La data indicata non deve essere inferiore alla data di inizio esercizio");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else //se la data e' vuota
|
||||||
|
f.mask().field(F_DATAINI).set(inizio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -238,20 +204,23 @@ bool data_fine(TMask_field& f, KEY k)
|
|||||||
f.error_box("La data iniziale non deve essere superiore alla data finale");
|
f.error_box("La data iniziale non deve essere superiore alla data finale");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if ( anno != 0 && ( (app()._masc == "cg3100b") ||
|
|
||||||
|
TEsercizi_contabili esc;
|
||||||
|
if ( esc.exist(anno) && ( (app()._masc == "cg3100b") ||
|
||||||
((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
|
((app()._masc == "cg3100a" ) && (decidi == 2)) ) )
|
||||||
{
|
{
|
||||||
TDate fine = FineEsercizio(EsercizioSucc(anno));
|
const int prossimo = esc.next(anno);
|
||||||
if (fine == botime)
|
const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine();
|
||||||
fine = FineEsercizio(anno);
|
if (datafin.ok())
|
||||||
if (!datafin.ok()) //se la data e' vuota
|
{
|
||||||
f.mask().field(F_DATAFIN).set(fine);
|
if (datafin > fine)
|
||||||
else
|
{
|
||||||
if (datafin > fine)
|
f.error_box("La data indicata non deve essere superiore alla data di fine esercizio successivo, oppure, in caso questo non esista, dell'esercizio indicato");
|
||||||
{
|
return FALSE;
|
||||||
f.error_box("La data indicata non deve essere superiore alla data di fine esercizio successivo, oppure, in caso questo non esista, dell'esercizio indicato");
|
}
|
||||||
return FALSE;
|
}
|
||||||
}
|
else //se la data e' vuota
|
||||||
|
f.mask().set(F_DATAFIN, fine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -815,7 +784,9 @@ void TListaMov_application::set_page(int file, int count)
|
|||||||
int anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
|
int anno = current_cursor()->curr(LF_MOV).get_int(MOV_ANNOIVA);
|
||||||
char prov = current_cursor()->curr(LF_MOV).get_char(MOV_PROVVIS);
|
char prov = current_cursor()->curr(LF_MOV).get_char(MOV_PROVVIS);
|
||||||
int tipo = CodiceRegistro(reg, anno);
|
int tipo = CodiceRegistro(reg, anno);
|
||||||
int ae = date2esc(data);
|
|
||||||
|
TEsercizi_contabili esc;
|
||||||
|
int ae = esc.date2esc(data);
|
||||||
if ( (tipo == 1) || (tipo == 2) )
|
if ( (tipo == 1) || (tipo == 2) )
|
||||||
{
|
{
|
||||||
set_row (_n, "@103greg @3s",FLD(LF_MOV,MOV_REG));
|
set_row (_n, "@103greg @3s",FLD(LF_MOV,MOV_REG));
|
||||||
@ -907,7 +878,8 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
|||||||
_tiporegistro = CodiceRegistro(_registro, _anno);
|
_tiporegistro = CodiceRegistro(_registro, _anno);
|
||||||
|
|
||||||
_causale_gia_stampata = FALSE;
|
_causale_gia_stampata = FALSE;
|
||||||
_ae = date2esc(_datareg);
|
TEsercizi_contabili esc;
|
||||||
|
_ae = esc.date2esc(_datareg);
|
||||||
|
|
||||||
if (_registro.not_empty()) //si tratta di fattura
|
if (_registro.not_empty()) //si tratta di fattura
|
||||||
if (current_cursor()->is_first_match(LF_RMOV))
|
if (current_cursor()->is_first_match(LF_RMOV))
|
||||||
@ -1549,7 +1521,8 @@ print_action TListaMov_application::postprocess_print(int file,int count)
|
|||||||
//cerca errori sulla testata (MOV)
|
//cerca errori sulla testata (MOV)
|
||||||
bool TListaMov_application::segnala_errori_primariga()
|
bool TListaMov_application::segnala_errori_primariga()
|
||||||
{
|
{
|
||||||
const int ae = date2esc(_datacomp);
|
TEsercizi_contabili esc;
|
||||||
|
const int ae = esc.date2esc(_datacomp);
|
||||||
|
|
||||||
if (_ae == 0)
|
if (_ae == 0)
|
||||||
_err.set(0l);
|
_err.set(0l);
|
||||||
@ -1568,13 +1541,13 @@ bool TListaMov_application::segnala_errori_primariga()
|
|||||||
|
|
||||||
if (ae)
|
if (ae)
|
||||||
{
|
{
|
||||||
int pr; // Esercizio precedente
|
const int ar = esc.date2esc(_datareg); // Esercizio in corso
|
||||||
const int ar = date2esc(_datareg); // Esercizio in corso
|
const int pr = esc.pred(ar); // Esercizio precedente
|
||||||
pr = _ec.pred(ar);
|
|
||||||
if (ae != ar && ae != pr)
|
if (ae != ar && ae != pr)
|
||||||
_err.set(4);
|
_err.set(4);
|
||||||
}
|
}
|
||||||
else _err.set(5);
|
else
|
||||||
|
_err.set(5);
|
||||||
|
|
||||||
if (_annoeser != ae)
|
if (_annoeser != ae)
|
||||||
_err.set(6);
|
_err.set(6);
|
||||||
@ -2042,13 +2015,13 @@ bool TListaMov_application::set_print(int m)
|
|||||||
_tipo_lista = movimenti_sezionale;
|
_tipo_lista = movimenti_sezionale;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CHECK(0, "Bad _tipoc");
|
NFCHECK("Bad _tipoc");
|
||||||
break;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
TMask msk(_masc);
|
TMask msk(_masc);
|
||||||
|
|
||||||
msk.set_handler(F_ANNO, annoes);
|
msk.set_handler(F_ANNO, annoes_handler);
|
||||||
msk.set_handler(F_DATAINI, data_inizio);
|
msk.set_handler(F_DATAINI, data_inizio);
|
||||||
msk.set_handler(F_DATAFIN, data_fine);
|
msk.set_handler(F_DATAFIN, data_fine);
|
||||||
|
|
||||||
|
330
cg/cg3600.cpp
330
cg/cg3600.cpp
@ -472,10 +472,10 @@ enum tipo_riga_mastrino { riga_mastrino, riga_contropartita };
|
|||||||
|
|
||||||
class TRiga_mastrino : public TObject
|
class TRiga_mastrino : public TObject
|
||||||
{
|
{
|
||||||
tipo_riga_mastrino _type;
|
tipo_riga_mastrino _type; // Tipo della riga
|
||||||
TRecnotype _mov, _rmov;
|
TRecnotype _mov, _rmov; // Numero fisico di record movivento e riga movimento
|
||||||
TDate _data;
|
real _dare, _avere; // Progressivi dare ed avere
|
||||||
real _dare, _avere;
|
TDate _data; // Data di registrazione (Ottimizzazione)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tipo_riga_mastrino tipo() const { return _type; }
|
tipo_riga_mastrino tipo() const { return _type; }
|
||||||
@ -485,7 +485,7 @@ public:
|
|||||||
const TDate& data() const { return _data; }
|
const TDate& data() const { return _data; }
|
||||||
const real& dare() const { return _dare; }
|
const real& dare() const { return _dare; }
|
||||||
const real& avere() const { return _avere; }
|
const real& avere() const { return _avere; }
|
||||||
TImporto saldo() const;
|
TImporto saldo() const; // Dare-Avere normalizzato
|
||||||
|
|
||||||
TRiga_mastrino(tipo_riga_mastrino trig,
|
TRiga_mastrino(tipo_riga_mastrino trig,
|
||||||
TRecnotype rmov, TRecnotype mov,
|
TRecnotype rmov, TRecnotype mov,
|
||||||
@ -957,6 +957,7 @@ protected: // TMask_field
|
|||||||
virtual void create(WINDOW parent);
|
virtual void create(WINDOW parent);
|
||||||
virtual void parse_head(TScanner& scanner);
|
virtual void parse_head(TScanner& scanner);
|
||||||
virtual bool parse_item(TScanner& scanner);
|
virtual bool parse_item(TScanner& scanner);
|
||||||
|
virtual word class_id() const;
|
||||||
|
|
||||||
TGrid_control& grid() const { return (TGrid_control&)*_ctl; }
|
TGrid_control& grid() const { return (TGrid_control&)*_ctl; }
|
||||||
|
|
||||||
@ -978,7 +979,10 @@ public:
|
|||||||
int visible_rows() const;
|
int visible_rows() const;
|
||||||
bool select(long rec);
|
bool select(long rec);
|
||||||
|
|
||||||
TGrid_field(TMask* m) : TOperable_field(m) { }
|
void reset_columns_order();
|
||||||
|
void save_columns_order() const;
|
||||||
|
|
||||||
|
TGrid_field(TMask* m);
|
||||||
virtual ~TGrid_field() { }
|
virtual ~TGrid_field() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -994,6 +998,9 @@ class TGrid_control : public TControl
|
|||||||
|
|
||||||
TGrid_field* _grid;
|
TGrid_field* _grid;
|
||||||
|
|
||||||
|
int _default_width[MAX_COL];
|
||||||
|
int _columns_order;
|
||||||
|
|
||||||
protected: // TControl
|
protected: // TControl
|
||||||
//@cmember Gestisce gli eventi delle celle
|
//@cmember Gestisce gli eventi delle celle
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
@ -1016,6 +1023,11 @@ protected:
|
|||||||
|
|
||||||
void update_selection(XI_EVENT* xiev);
|
void update_selection(XI_EVENT* xiev);
|
||||||
|
|
||||||
|
void set_columns_order(TToken_string* order);
|
||||||
|
|
||||||
|
XI_OBJ* find_column(short cid) const;
|
||||||
|
XI_OBJ* find_column(const char* head) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
long selected() const { return _cur_rec; }
|
long selected() const { return _cur_rec; }
|
||||||
bool select(long n);
|
bool select(long n);
|
||||||
@ -1027,6 +1039,10 @@ public:
|
|||||||
void update(long n = -1);
|
void update(long n = -1);
|
||||||
bool is_visible(long rec) const;
|
bool is_visible(long rec) const;
|
||||||
|
|
||||||
|
void load_columns_order();
|
||||||
|
void save_columns_order() const;
|
||||||
|
void reset_columns_order() { set_columns_order(NULL); }
|
||||||
|
|
||||||
TGrid_control(WINDOW parent, short cid,
|
TGrid_control(WINDOW parent, short cid,
|
||||||
short x, short y, short dx, short dy,
|
short x, short y, short dx, short dy,
|
||||||
const char* flags, const char* head,
|
const char* flags, const char* head,
|
||||||
@ -1045,7 +1061,7 @@ TGrid_control::TGrid_control(
|
|||||||
const char* flags, // @parm Flags di abilitazione
|
const char* flags, // @parm Flags di abilitazione
|
||||||
const char* head, // @parm Titolo delle colonne
|
const char* head, // @parm Titolo delle colonne
|
||||||
TGrid_field* owner)
|
TGrid_field* owner)
|
||||||
: _grid(owner), _cur_rec(-1)
|
: _grid(owner), _cur_rec(-1), _columns_order(0)
|
||||||
{
|
{
|
||||||
_read_only = FALSE;
|
_read_only = FALSE;
|
||||||
bool auto_num = FALSE;
|
bool auto_num = FALSE;
|
||||||
@ -1203,6 +1219,14 @@ TGrid_control::TGrid_control(
|
|||||||
|
|
||||||
CHECKD(_obj, "Can't create list control ", cid);
|
CHECKD(_obj, "Can't create list control ", cid);
|
||||||
update_tab_cid();
|
update_tab_cid();
|
||||||
|
|
||||||
|
int num;
|
||||||
|
XI_OBJ** column = xi_get_member_list(_obj, &num);
|
||||||
|
for (i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
RCT rct; xi_get_rect(column[i], &rct);
|
||||||
|
_default_width[i] = rct.right - rct.left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a record number in the correspondig row number
|
// Converts a record number in the correspondig row number
|
||||||
@ -1449,11 +1473,16 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
if (xiev->v.column.in_fixed ||
|
if (xiev->v.column.in_fixed ||
|
||||||
xiev->v.column.col_nbr < xi_get_fixed_columns(xiev->v.column.list))
|
xiev->v.column.col_nbr < xi_get_fixed_columns(xiev->v.column.list))
|
||||||
refused = TRUE;
|
refused = TRUE;
|
||||||
|
else
|
||||||
|
_columns_order = 1;
|
||||||
break;
|
break;
|
||||||
case XIE_COL_SIZE:
|
case XIE_COL_SIZE:
|
||||||
{
|
{
|
||||||
const short cid = col2cid(xiev->v.column.col_nbr);
|
const short cid = col2cid(xiev->v.column.col_nbr);
|
||||||
refused = !_grid->on_resize_column(cid, xiev->v.column.new_col_width);
|
if (_grid->on_resize_column(cid, xiev->v.column.new_col_width))
|
||||||
|
_columns_order = 1;
|
||||||
|
else
|
||||||
|
refused = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XIE_SELECT:
|
case XIE_SELECT:
|
||||||
@ -1564,6 +1593,147 @@ bool TGrid_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
return !refused;
|
return !refused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XI_OBJ* TGrid_control::find_column(short cid) const
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
XI_OBJ** column = xi_get_member_list(_obj, &num);
|
||||||
|
for (int i = num-1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (column[i]->cid == cid)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return i >= 0 ? column[i] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
XI_OBJ* TGrid_control::find_column(const char* head) const
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
XI_OBJ** column = xi_get_member_list(_obj, &num);
|
||||||
|
|
||||||
|
TString80 text;
|
||||||
|
for (int i = num-1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
xi_get_text(column[i], text.get_buffer(), text.size());
|
||||||
|
if (text == head)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return i >= 0 ? column[i] : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGrid_control::set_columns_order(TToken_string* order)
|
||||||
|
{
|
||||||
|
XI_OBJ* itf = get_interface();
|
||||||
|
XI_OBJ* focus = xi_get_focus(itf);
|
||||||
|
xi_set_focus(itf);
|
||||||
|
|
||||||
|
int num_cols;
|
||||||
|
XI_OBJ** column = xi_get_member_list(_obj, &num_cols);
|
||||||
|
|
||||||
|
// Costante da sottrarre nella xi_column_set_pixel_width altrimenti la somma due volte!
|
||||||
|
const int offset = 2 * (int)xi_get_pref(XI_PREF_COLUMN_OFFSET);
|
||||||
|
const int fixed = xi_get_fixed_columns(_obj);
|
||||||
|
if (fixed > 1)
|
||||||
|
xi_set_fixed_columns(_obj, 1);
|
||||||
|
|
||||||
|
if (order == NULL)
|
||||||
|
{
|
||||||
|
for (int index = 1; index < num_cols; index++)
|
||||||
|
{
|
||||||
|
const short cid = FIRST_FIELD + 1000 + index - 1;
|
||||||
|
XI_OBJ* col = find_column(cid);
|
||||||
|
if (col)
|
||||||
|
{
|
||||||
|
xi_move_column(col, index);
|
||||||
|
RCT rct; xi_get_rect(col, &rct);
|
||||||
|
if (_default_width[index] != rct.right - rct.left)
|
||||||
|
xi_column_set_pixel_width(col, _default_width[index]-offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_columns_order = 0x3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TToken_string col(8, ',');
|
||||||
|
int pos = 0;
|
||||||
|
for (col = order->get(0); !col.blank(); col = order->get(), pos++)
|
||||||
|
{
|
||||||
|
const char* head = esc(col.get(0));
|
||||||
|
const int width = col.get_int();
|
||||||
|
XI_OBJ* column = find_column(head);
|
||||||
|
if (column) // Controlla che esista ancora
|
||||||
|
{
|
||||||
|
if (pos > 0 && pos < num_cols)
|
||||||
|
xi_move_column(column, pos); // Sposta la colonna se possibile
|
||||||
|
if (width > XI_FU_MULTIPLE) // Se ha una larghezza valida
|
||||||
|
xi_column_set_pixel_width(column, width - offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fixed > 1)
|
||||||
|
xi_set_fixed_columns(_obj, fixed);
|
||||||
|
|
||||||
|
if (focus)
|
||||||
|
xi_set_focus(focus);
|
||||||
|
}
|
||||||
|
|
||||||
|
HIDDEN TFilename& field2parag(const TMask_field& f, TFilename& name)
|
||||||
|
{
|
||||||
|
const TMask& m = f.mask();
|
||||||
|
name = m.source_file();
|
||||||
|
name.ext(""); // Nome della maschera senza estensione
|
||||||
|
const int index = m.number();
|
||||||
|
CHECKD(index >= 0 && index <= 8, "Bad mask index:", index);
|
||||||
|
if (index > 0) // Aggiunge l'eventuale numero di sotto-maschera
|
||||||
|
name << '(' << index << ')';
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGrid_control::load_columns_order()
|
||||||
|
{
|
||||||
|
TFilename parag; field2parag(*_grid, parag);
|
||||||
|
TConfig config(CONFIG_USER, parag);
|
||||||
|
TToken_string order = config.get("Browse", NULL, id());
|
||||||
|
if (order.empty_items())
|
||||||
|
config.remove("Browse", id());
|
||||||
|
else
|
||||||
|
set_columns_order(&order);
|
||||||
|
_columns_order = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGrid_control::save_columns_order() const
|
||||||
|
{
|
||||||
|
if (_columns_order)
|
||||||
|
{
|
||||||
|
TFilename parag; field2parag(*_grid, parag);
|
||||||
|
TConfig config(CONFIG_USER, parag); // Apre il file di configurazione
|
||||||
|
|
||||||
|
TToken_string order(127); // Nuovo ordine delle colonne
|
||||||
|
if (_columns_order == 1) // Se vale 3 devo solo resettare
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
XI_OBJ** column = xi_get_member_list(_obj, &num);
|
||||||
|
TString80 head;
|
||||||
|
for (int i = 0; i < num; i++) // Scorre tutte le colonne
|
||||||
|
{
|
||||||
|
xi_get_text(column[i], head.get_buffer(), head.size());
|
||||||
|
const int acapo = head.find('\n');
|
||||||
|
if (acapo > 0)
|
||||||
|
{
|
||||||
|
head[acapo] = '\\';
|
||||||
|
head.insert("n", acapo+1);
|
||||||
|
}
|
||||||
|
order.add(head);
|
||||||
|
RCT rct; xi_get_rect(column[i], &rct);
|
||||||
|
order << ',' << rct.right - rct.left;
|
||||||
|
}
|
||||||
|
config.set("Browse", order, NULL, TRUE, id());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
config.remove("Browse", id());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TGrid_cell
|
// TGrid_cell
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -1647,6 +1817,15 @@ short TGrid_cell::get_size() const
|
|||||||
// TGrid_field
|
// TGrid_field
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TGrid_field::TGrid_field(TMask* m)
|
||||||
|
: TOperable_field(m)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
word TGrid_field::class_id() const
|
||||||
|
{
|
||||||
|
return CLASS_GRID_FIELD;
|
||||||
|
}
|
||||||
|
|
||||||
void TGrid_field::update(long n)
|
void TGrid_field::update(long n)
|
||||||
{ grid().update(n); }
|
{ grid().update(n); }
|
||||||
|
|
||||||
@ -1665,6 +1844,7 @@ void TGrid_field::create(WINDOW parent)
|
|||||||
_ctl_data._width, _ctl_data._height,
|
_ctl_data._width, _ctl_data._height,
|
||||||
_ctl_data._flags, _ctl_data._park,
|
_ctl_data._flags, _ctl_data._park,
|
||||||
this);
|
this);
|
||||||
|
grid().load_columns_order();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TGrid_field::parse_item(TScanner& scanner)
|
bool TGrid_field::parse_item(TScanner& scanner)
|
||||||
@ -1704,6 +1884,16 @@ long TGrid_field::selected() const
|
|||||||
bool TGrid_field::select(long rec)
|
bool TGrid_field::select(long rec)
|
||||||
{ return grid().select(rec); }
|
{ return grid().select(rec); }
|
||||||
|
|
||||||
|
void TGrid_field::reset_columns_order()
|
||||||
|
{
|
||||||
|
grid().reset_columns_order();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGrid_field::save_columns_order() const
|
||||||
|
{
|
||||||
|
grid().save_columns_order();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Da qui in poi e' tutta roba specializzata del programma
|
// Da qui in poi e' tutta roba specializzata del programma
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -1955,8 +2145,8 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
|||||||
{
|
{
|
||||||
const TRectype& mov = _mastrino.testata(rec);
|
const TRectype& mov = _mastrino.testata(rec);
|
||||||
TString80 text;
|
TString80 text;
|
||||||
text = mov.get(MOV_DATAREG);
|
text = riga.data().string();
|
||||||
text << ' ' << mov.get(MOV_DATADOC);
|
text << ' ' << mov.get(MOV_DATACOMP);
|
||||||
cell.set(text);
|
cell.set(text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1964,13 +2154,30 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
|||||||
if (riga.tipo() == riga_mastrino)
|
if (riga.tipo() == riga_mastrino)
|
||||||
{
|
{
|
||||||
const TRectype& mov = _mastrino.testata(rec);
|
const TRectype& mov = _mastrino.testata(rec);
|
||||||
const int anno = _esercizi.date2esc(mov.get_date(MOV_DATAREG));
|
const int anno = _esercizi.date2esc(riga.data());
|
||||||
const int eser = mov.get_int(MOV_ANNOES);
|
const int eser = mov.get_int(MOV_ANNOES);
|
||||||
const comp = anno == eser;
|
const comp = anno == eser;
|
||||||
cell.set_icon(comp ? ICO_CHECK_ON : ICO_CHECK_OFF);
|
cell.set_icon(comp ? ICO_CHECK_ON : ICO_CHECK_OFF);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 103:
|
case 103:
|
||||||
|
if (riga.tipo() == riga_mastrino)
|
||||||
|
{
|
||||||
|
const TRectype& mov = _mastrino.testata(rec);
|
||||||
|
cell.set(_causali.decode(mov.get(MOV_CODCAUS)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const TRectype& rmov = _mastrino.riga(rec);
|
||||||
|
TString16 text;
|
||||||
|
text.format("%03d.%03d.%06ld",
|
||||||
|
rmov.get_int(RMV_GRUPPO),
|
||||||
|
rmov.get_int(RMV_CONTO),
|
||||||
|
rmov.get_long(RMV_SOTTOCONTO));
|
||||||
|
cell.set(text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 104:
|
||||||
if (riga.tipo() == riga_mastrino)
|
if (riga.tipo() == riga_mastrino)
|
||||||
{
|
{
|
||||||
const TRectype& mov = _mastrino.testata(rec);
|
const TRectype& mov = _mastrino.testata(rec);
|
||||||
@ -1996,23 +2203,6 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
|||||||
cell.set(text);
|
cell.set(text);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 104:
|
|
||||||
if (riga.tipo() == riga_mastrino)
|
|
||||||
{
|
|
||||||
const TRectype& mov = _mastrino.testata(rec);
|
|
||||||
cell.set(_causali.decode(mov.get(MOV_CODCAUS)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const TRectype& rmov = _mastrino.riga(rec);
|
|
||||||
TString16 text;
|
|
||||||
text.format("%03d.%03d.%06ld",
|
|
||||||
rmov.get_int(RMV_GRUPPO),
|
|
||||||
rmov.get_int(RMV_CONTO),
|
|
||||||
rmov.get_long(RMV_SOTTOCONTO));
|
|
||||||
cell.set(text);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 105:
|
case 105:
|
||||||
{
|
{
|
||||||
const TRectype& rmov = _mastrino.riga(rec);
|
const TRectype& rmov = _mastrino.riga(rec);
|
||||||
@ -2054,7 +2244,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
|||||||
if (!stampa)
|
if (!stampa)
|
||||||
{
|
{
|
||||||
const TDate& data = _mastrino[next_row].data();
|
const TDate& data = _mastrino[next_row].data();
|
||||||
stampa = riga.data() < data;
|
stampa = riga.data() != data;
|
||||||
}
|
}
|
||||||
if (stampa)
|
if (stampa)
|
||||||
{
|
{
|
||||||
@ -2109,11 +2299,13 @@ void TMastrini_grid::on_grid_button()
|
|||||||
TProgind* pi = NULL;
|
TProgind* pi = NULL;
|
||||||
|
|
||||||
if (total > 50)
|
if (total > 50)
|
||||||
pi = new TProgind(total, "Calcolo contropartite", FALSE, TRUE, 48);
|
pi = new TProgind(total, "Aggiornamento contropartite ...", FALSE, TRUE, 48);
|
||||||
else
|
else
|
||||||
begin_wait();
|
begin_wait();
|
||||||
|
|
||||||
|
// Cerca l'ultima contropartita
|
||||||
const long last_con = _mastrino.last(riga_contropartita);
|
const long last_con = _mastrino.last(riga_contropartita);
|
||||||
|
// Se non esistono contropartite devo espandere le righe
|
||||||
const bool expand = last_con < 0;
|
const bool expand = last_con < 0;
|
||||||
if (expand)
|
if (expand)
|
||||||
{
|
{
|
||||||
@ -2170,6 +2362,8 @@ void TMastrini_grid::on_record_button(long rec)
|
|||||||
end_wait();
|
end_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Posso ridimensionare solo le descrizioni, le altre devono rimanere fisse per
|
||||||
|
// non perdere la formattazione su due righe
|
||||||
bool TMastrini_grid::on_resize_column(short cid, int new_size)
|
bool TMastrini_grid::on_resize_column(short cid, int new_size)
|
||||||
{
|
{
|
||||||
return cid == 103 || cid == 104;
|
return cid == 103 || cid == 104;
|
||||||
@ -2256,6 +2450,7 @@ class TGrid_mask : public TMask
|
|||||||
protected: // TMask
|
protected: // TMask
|
||||||
virtual TMask_field* parse_field(TScanner& sc);
|
virtual TMask_field* parse_field(TScanner& sc);
|
||||||
virtual bool on_key(KEY k);
|
virtual bool on_key(KEY k);
|
||||||
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
|
|
||||||
static bool link_handler(TMask_field& f, KEY k);
|
static bool link_handler(TMask_field& f, KEY k);
|
||||||
|
|
||||||
@ -2336,6 +2531,81 @@ bool TGrid_mask::on_key(KEY k)
|
|||||||
return TMask::on_key(k);
|
return TMask::on_key(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TGrid_mask::handler(WINDOW win, EVENT* ep)
|
||||||
|
{
|
||||||
|
static TGrid_field* _last_grid = NULL;
|
||||||
|
|
||||||
|
if (ep->type == E_MOUSE_DOWN && ep->v.mouse.button == 1)
|
||||||
|
{
|
||||||
|
_last_grid = NULL;
|
||||||
|
for (int f = fields()-1; f >= 0; f--)
|
||||||
|
{
|
||||||
|
TMask_field& cur_fld = fld(f);
|
||||||
|
if (cur_fld.parent() == win)
|
||||||
|
{
|
||||||
|
RCT rct; cur_fld.get_rect(rct);
|
||||||
|
if (xvt_rect_has_point(&rct, ep->v.mouse.where))
|
||||||
|
{
|
||||||
|
if (cur_fld.class_id() == CLASS_GRID_FIELD)
|
||||||
|
_last_grid = (TGrid_field*)&cur_fld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_last_grid)
|
||||||
|
{
|
||||||
|
TGrid_field& sht = (TGrid_field&)*_last_grid;
|
||||||
|
#if (XVT_PTK_VERSION_MAJOR > 4) || (XVT_PTK_VERSION_MAJOR == 4 && XVT_PTK_VERSION_MINOR >= 50)
|
||||||
|
MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR);
|
||||||
|
if (menu)
|
||||||
|
{
|
||||||
|
const PNT& p = ep->v.mouse.where;
|
||||||
|
RCT cr; xvt_vobj_get_client_rect(win, &cr);
|
||||||
|
XVT_POPUP_ALIGNMENT pa = XVT_POPUP_CENTER;
|
||||||
|
if (p.h < cr.right / 3)
|
||||||
|
pa = XVT_POPUP_LEFT_ALIGN;
|
||||||
|
else
|
||||||
|
if (p.h > 2 * cr.right / 3)
|
||||||
|
pa = XVT_POPUP_RIGHT_ALIGN;
|
||||||
|
|
||||||
|
xvt_menu_popup(menu->child, win, p, pa, NULL);
|
||||||
|
xvt_res_free_menu_tree(menu);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ASK_RESPONSE r = xvt_dm_post_ask("Annulla", "Ripristina", "Salva",
|
||||||
|
"Ordinamento delle colonne");
|
||||||
|
if (r == RESP_2)
|
||||||
|
sht.reset_columns_order();
|
||||||
|
if (r == RESP_2 || r == RESP_3)
|
||||||
|
sht.save_columns_order();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ep->type == E_COMMAND)
|
||||||
|
{
|
||||||
|
if (_last_grid)
|
||||||
|
{
|
||||||
|
switch (ep->v.cmd.tag)
|
||||||
|
{
|
||||||
|
case M_EDIT_UNDO:
|
||||||
|
_last_grid->reset_columns_order();
|
||||||
|
case M_EDIT_COPY:
|
||||||
|
_last_grid->save_columns_order();
|
||||||
|
break;
|
||||||
|
case M_EDIT_SEARCH:
|
||||||
|
_last_grid->on_key(K_F11);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TMask::handler(win, ep);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TQuery_mask
|
// TQuery_mask
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -90,7 +90,7 @@ STRING F_DESCONTO 50
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 22 5 ""
|
PROMPT 22 5 ""
|
||||||
USE LF_PCON KEY 2 SELECT (CONTO!="")&&(SOTTOCONTO="")
|
USE LF_PCON KEY 2 SELECT (CONTO!="")&&(SOTTOCONTO="")
|
||||||
INPUT DESCR F_DESGRUPPO
|
INPUT DESCR F_DESCONTO
|
||||||
COPY DISPLAY F_GRUPPO
|
COPY DISPLAY F_GRUPPO
|
||||||
DISPLAY "Conto" CONTO
|
DISPLAY "Conto" CONTO
|
||||||
DISPLAY "Tipo" TMCF
|
DISPLAY "Tipo" TMCF
|
||||||
|
@ -65,8 +65,8 @@ BEGIN
|
|||||||
FLAGS "DM2"
|
FLAGS "DM2"
|
||||||
ITEM "Data Op. \nData Com.@10F"
|
ITEM "Data Op. \nData Com.@10F"
|
||||||
ITEM "C@1F"
|
ITEM "C@1F"
|
||||||
ITEM "Operazione@20F"
|
ITEM "Causale@20F"
|
||||||
ITEM "Causale@20"
|
ITEM "Operazione@20"
|
||||||
ITEM "Dare@15R"
|
ITEM "Dare@15R"
|
||||||
ITEM "Avere@15R"
|
ITEM "Avere@15R"
|
||||||
ITEM "N.Doc. \nN.Prot.@7"
|
ITEM "N.Doc. \nN.Prot.@7"
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <extcdecl.h>
|
#include <extcdecl.h>
|
||||||
|
|
||||||
|
#include "cglib.h"
|
||||||
#include "cglib04.h"
|
#include "cglib04.h"
|
||||||
|
|
||||||
const int size = 256; //Lunghezza del record del TRASFER
|
const int size = 256; //Lunghezza del record del TRASFER
|
||||||
@ -1446,17 +1448,6 @@ int TTransfer_file::annoes_datacomp(const TString& record, TDate& datacomp)
|
|||||||
return ae;
|
return ae;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTransfer_file::datafine_esprec(const int aep, TDate& datacomp)
|
|
||||||
{
|
|
||||||
TTable esc("ESC");
|
|
||||||
for (int err = esc.first(); err == NOERR; err = esc.next())
|
|
||||||
{
|
|
||||||
const anno = esc.get_int("CODTAB");
|
|
||||||
if (anno == aep)
|
|
||||||
datacomp = esc.get("D1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TTransfer_file::decimali(TString& campo, int dec)
|
void TTransfer_file::decimali(TString& campo, int dec)
|
||||||
{
|
{
|
||||||
int l = campo.len();
|
int l = campo.len();
|
||||||
@ -5163,19 +5154,28 @@ const char* riconverti (TString& data_PC,bool anno_di_quattro)
|
|||||||
return TEMP;
|
return TEMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int date2esc(const TDate& d, int* prevesc)
|
void TTransfer_file::datafine_esprec(const int aep, TDate& datacomp)
|
||||||
{
|
{
|
||||||
if (prevesc) *prevesc = 0;
|
/* Guy: Oink!
|
||||||
TTable esc("ESC");
|
TTable esc("ESC");
|
||||||
for (int err = esc.first(); err == NOERR; err = esc.next())
|
for (int err = esc.first(); err == NOERR; err = esc.next())
|
||||||
{
|
{
|
||||||
const TDate ia(esc.get("D0")); // Data inizio esercizio
|
|
||||||
const TDate fa(esc.get("D1")); // Data fine esercizio
|
|
||||||
const anno = esc.get_int("CODTAB");
|
const anno = esc.get_int("CODTAB");
|
||||||
if (d >= ia && d <= fa)
|
if (anno == aep)
|
||||||
return anno;
|
datacomp = esc.get("D1");
|
||||||
if (prevesc) *prevesc = anno;
|
|
||||||
}
|
}
|
||||||
return 0;
|
*/
|
||||||
|
TEsercizi_contabili esc;
|
||||||
|
if (esc.exist(aep))
|
||||||
|
datacomp = esc[aep].fine();
|
||||||
|
}
|
||||||
|
|
||||||
|
int date2esc(const TDate& d, int* prevesc)
|
||||||
|
{
|
||||||
|
TEsercizi_contabili esc;
|
||||||
|
int anno = esc.date2esc(d);
|
||||||
|
if (prevesc)
|
||||||
|
*prevesc = esc.pred(anno);
|
||||||
|
return anno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,7 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
|
|||||||
if (scd == 0)
|
if (scd == 0)
|
||||||
scd = _int_rate;
|
scd = _int_rate;
|
||||||
#endif
|
#endif
|
||||||
add_rata(perc, scd, tipo_rata(0));
|
add_rata(perc, scd, tipo_rata(0), ulc_rata(0));
|
||||||
}
|
}
|
||||||
if (_inited)
|
if (_inited)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user