Corretta gestione partie e residui
git-svn-id: svn://10.65.10.50/trunk@2582 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
968abc211d
commit
d8eeddba98
@ -733,6 +733,8 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
{
|
{
|
||||||
m.autosave(_rel);
|
m.autosave(_rel);
|
||||||
|
|
||||||
|
TRectype& rec = _rel->curr(); // Record della testata
|
||||||
|
|
||||||
const long numreg = m.get_long(F_NUMREG);
|
const long numreg = m.get_long(F_NUMREG);
|
||||||
const TDate datareg(m.get(F_DATAREG));
|
const TDate datareg(m.get(F_DATAREG));
|
||||||
const int annoes = m.get_int(F_ANNOES);
|
const int annoes = m.get_int(F_ANNOES);
|
||||||
@ -743,6 +745,17 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
_saldi.set_num_ulmov(numreg);
|
_saldi.set_num_ulmov(numreg);
|
||||||
_saldi.set_data_ulmov((TDate)m.get(F_DATAREG));
|
_saldi.set_data_ulmov((TDate)m.get(F_DATAREG));
|
||||||
|
|
||||||
|
const int tm = causale().tipomov();
|
||||||
|
char s[2];
|
||||||
|
if (tm > 0)
|
||||||
|
{
|
||||||
|
s[0] = tm+'0';
|
||||||
|
s[1] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s[0] = '\0';
|
||||||
|
rec.put(MOV_TIPOMOV, s); // Tolto dalla maschera (su file e' alfanumerico)!
|
||||||
|
|
||||||
_rel->destroy_rows(numreg); // Destroy all records
|
_rel->destroy_rows(numreg); // Destroy all records
|
||||||
cgs_pack(); // Destroy all null rows
|
cgs_pack(); // Destroy all null rows
|
||||||
|
|
||||||
@ -788,8 +801,6 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
|||||||
|
|
||||||
if (_iva == nessuna_iva) return;
|
if (_iva == nessuna_iva) return;
|
||||||
|
|
||||||
TRectype& rec = _rel->curr(); // Record della testata
|
|
||||||
|
|
||||||
if (causale().corrispettivi())
|
if (causale().corrispettivi())
|
||||||
{
|
{
|
||||||
rec.put("TIPO", "");
|
rec.put("TIPO", "");
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#define F_ANNORIF 124
|
#define F_ANNORIF 124
|
||||||
#define F_NUMRIF 125
|
#define F_NUMRIF 125
|
||||||
#define F_PROVVISORIO 129
|
#define F_PROVVISORIO 129
|
||||||
#define F_TIPOMOV 130
|
|
||||||
#define F_OCCASEDIT 131
|
#define F_OCCASEDIT 131
|
||||||
#define F_SOLAIVA 132
|
#define F_SOLAIVA 132
|
||||||
#define F_CORRLIRE 133
|
#define F_CORRLIRE 133
|
||||||
|
@ -82,7 +82,7 @@ END
|
|||||||
STRING F_CODREG 3
|
STRING F_CODREG 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 57 4 "Registro IVA "
|
PROMPT 57 4 "Registro IVA "
|
||||||
FLAGS "DGUZ"
|
FLAGS "DUZ"
|
||||||
FIELD REG
|
FIELD REG
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -101,7 +101,6 @@ BEGIN
|
|||||||
OUTPUT F_DESCRCAUS DESCR
|
OUTPUT F_DESCRCAUS DESCR
|
||||||
OUTPUT F_CODREG REG
|
OUTPUT F_CODREG REG
|
||||||
OUTPUT F_TIPODOC TIPODOC
|
OUTPUT F_TIPODOC TIPODOC
|
||||||
OUTPUT F_TIPOMOV TIPOMOV
|
|
||||||
MESSAGE COPY,H_CODCAUS
|
MESSAGE COPY,H_CODCAUS
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
ADD RUN cg0 -4
|
ADD RUN cg0 -4
|
||||||
@ -137,13 +136,6 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_TIPOMOV 1
|
|
||||||
BEGIN
|
|
||||||
PROMPT 32 6 "Tipo movimento "
|
|
||||||
FIELD TIPOMOV
|
|
||||||
FLAGS "H"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_NUMDOC 7
|
STRING F_NUMDOC 7
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 57 6 "Documento n. "
|
PROMPT 57 6 "Documento n. "
|
||||||
|
@ -514,14 +514,15 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
|
|||||||
const TMask& m = a.curr_mask();
|
const TMask& m = a.curr_mask();
|
||||||
|
|
||||||
TString msg(255);
|
TString msg(255);
|
||||||
msg << "Il totale documento " << (val ? "in valuta" : "inserito")
|
msg << "Il totale documento ";
|
||||||
<< " e' " << imptot.valore().string(pic) << ' ' << imptot.sezione() << ",\n";
|
if (val)
|
||||||
|
msg << "in valuta " << m.get(SK_VALUTA);
|
||||||
|
else
|
||||||
|
msg << "inserito";
|
||||||
|
msg << " e' " << imptot.valore().string(pic) << ' ' << imptot.sezione() << ",\n";
|
||||||
msg << "i pagamenti e le spese ammontano a "
|
msg << "i pagamenti e le spese ammontano a "
|
||||||
<< impsal.valore().string(pic) << ' ' << impsal.sezione() << ",\n";
|
<< impsal.valore().string(pic) << ' ' << impsal.sezione() << ",\n";
|
||||||
msg << "per cui il residuo e' " << residuo.valore().string(pic);
|
msg << "per cui il residuo e' " << residuo.valore().string(pic) << '.';
|
||||||
if (val)
|
|
||||||
msg << ' ' << m.get(SK_VALUTA);
|
|
||||||
msg << '.';
|
|
||||||
|
|
||||||
if (m.edit_mode() && impsal.is_zero())
|
if (m.edit_mode() && impsal.is_zero())
|
||||||
{
|
{
|
||||||
|
@ -477,25 +477,14 @@ bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
|
|||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
TPrimanota_application& a = app();
|
TPrimanota_application& a = app();
|
||||||
|
|
||||||
bool update = FALSE; // Devo ricopiarmi a pagina 3?
|
bool update = a.is_fattura(); // Devo ricopiarmi a pagina 3?
|
||||||
if (f.focusdirty())
|
if (f.focusdirty())
|
||||||
{
|
{
|
||||||
// Forza il ricalcolo del totale in lire se necessario
|
// Forza il ricalcolo del totale in lire se necessario
|
||||||
a.gioca_cambi(m.insert_mode() ? 0x1 : 0x0);
|
a.gioca_cambi(m.insert_mode() ? 0x1 : 0x0);
|
||||||
|
|
||||||
if (a.is_fattura())
|
|
||||||
{
|
|
||||||
TPagamento& pag = a.pagamento();
|
|
||||||
// pag.set_cambio(m, m.get_bool(FS_RECALC)); // Aggiorna cambio sul pagamento
|
|
||||||
update = TRUE;
|
|
||||||
|
|
||||||
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
|
||||||
pag.set_sheet(ps);
|
|
||||||
a.pag_rows() = ps.rows_array();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
update = a.is_fattura() && !m.is_running();
|
update &= !m.is_running();
|
||||||
|
|
||||||
if (update)
|
if (update)
|
||||||
m.set(FS_CAMBIO, f.get()); // Copia a pagina 3
|
m.set(FS_CAMBIO, f.get()); // Copia a pagina 3
|
||||||
|
@ -33,7 +33,7 @@ class TGame_mask : public TMask
|
|||||||
|
|
||||||
tipo_movimento _tipomov; // Dati per la creazione di un nuovo movimento
|
tipo_movimento _tipomov; // Dati per la creazione di un nuovo movimento
|
||||||
char _sezione;
|
char _sezione;
|
||||||
TDate _datadoc;
|
TDate _datad;
|
||||||
TString _codpag, _descr, _numdoc;
|
TString _codpag, _descr, _numdoc;
|
||||||
|
|
||||||
TDecoder _causali; // Decodificatore delle causali
|
TDecoder _causali; // Decodificatore delle causali
|
||||||
@ -54,7 +54,7 @@ protected:
|
|||||||
|
|
||||||
void fill_partite();
|
void fill_partite();
|
||||||
|
|
||||||
real aggiorna_residuo();
|
void aggiorna_residuo();
|
||||||
|
|
||||||
int update_partita(const TPartita& game, int prow);
|
int update_partita(const TPartita& game, int prow);
|
||||||
void update_saldo_clifo();
|
void update_saldo_clifo();
|
||||||
@ -563,34 +563,35 @@ bool TGame_mask::cambio_handler(TMask_field& f, KEY k)
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Aggiorna il campo con il residuo da spendere sui pagamenti
|
// Aggiorna il campo con il residuo da spendere sui pagamenti
|
||||||
real TGame_mask::aggiorna_residuo()
|
void TGame_mask::aggiorna_residuo()
|
||||||
{
|
{
|
||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
return ZERO;
|
return ZERO;
|
||||||
#else
|
#else
|
||||||
_importo = app().get_cgs_imp(_numrig-1); // Importo sulla riga contabile
|
_importo = app().get_cgs_imp(_numrig-1); // Importo sulla riga contabile
|
||||||
_residuo = _importo;
|
_residuo = _importo;
|
||||||
_residuo -= app().partite().importo_speso(_numreg, _numrig); // Residuo della riga
|
|
||||||
|
TPartite_array& giochi = app().partite();
|
||||||
|
const TImporto speso = giochi.importo_speso(_numreg, _numrig);
|
||||||
|
_residuo -= speso; // Residuo della riga
|
||||||
|
|
||||||
const char sez = calcola_sezione(); // Sezione di riferimento
|
const char sez = calcola_sezione(); // Sezione di riferimento
|
||||||
_residuo.normalize(sez);
|
_residuo.normalize(sez);
|
||||||
|
set(P_RESIDUO, _residuo.valore());
|
||||||
|
|
||||||
const real& res = _residuo.valore();
|
const TValuta cambio(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||||
set(P_RESIDUO, res);
|
if (cambio.in_valuta())
|
||||||
|
|
||||||
if (field(P_CAMBIO).enabled())
|
|
||||||
{
|
{
|
||||||
const TValuta cambio(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
// Importo della riga contabile senza differenza cambi
|
||||||
if (cambio.in_valuta())
|
_resval = _importo;
|
||||||
{
|
const TImporto diffcam = giochi.importo_speso(_numreg, _numrig, FALSE, 0x4);
|
||||||
_resval = _importo; cambio.lit2val(_resval);
|
_resval -= diffcam;
|
||||||
_resval -= app().partite().importo_speso(_numreg, _numrig, TRUE); // Residuo della riga
|
cambio.lit2val(_resval);
|
||||||
_resval.normalize(sez);
|
const TImporto spesoval = giochi.importo_speso(_numreg, _numrig, TRUE);
|
||||||
set(P_RESIDUOVAL, _resval.valore());
|
_resval -= spesoval; // Residuo della riga
|
||||||
}
|
_resval.normalize(sez);
|
||||||
|
set(P_RESIDUOVAL, _resval.valore());
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,7 +679,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
|||||||
gm.set(P_ANNO, anno); // Aggiorna campi di ricerca
|
gm.set(P_ANNO, anno); // Aggiorna campi di ricerca
|
||||||
gm.set(P_NUMERO, num);
|
gm.set(P_NUMERO, num);
|
||||||
|
|
||||||
TString prima_valuta; // Codice prima valuta
|
TString prima_valuta; // Codice prima valuta
|
||||||
|
|
||||||
if (anno > 0)
|
if (anno > 0)
|
||||||
{
|
{
|
||||||
@ -1085,7 +1086,9 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
const int anno = gm.get_int(P_ANNO);
|
const int anno = gm.get_int(P_ANNO);
|
||||||
const TString16 numero = gm.get(P_NUMERO);
|
const TString16 numero = gm.get(P_NUMERO);
|
||||||
|
|
||||||
TPartita& game = app().partite().partita(bill, anno, numero);
|
TPartite_array& giochi = app().partite();
|
||||||
|
TPartita* was = giochi.exist(bill, anno, numero); // Controlla esistenza nell'array
|
||||||
|
TPartita& game = was ? *was : giochi.partita(bill, anno, numero);
|
||||||
|
|
||||||
long nreg = m.get_long(108); // Numero registrazione
|
long nreg = m.get_long(108); // Numero registrazione
|
||||||
const int nrata = m.get_int(102); // Rata selezionata (puo' essere 0)
|
const int nrata = m.get_int(102); // Rata selezionata (puo' essere 0)
|
||||||
@ -1094,7 +1097,10 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
if (nrata != 0 && nrigp == 0)
|
if (nrata != 0 && nrigp == 0)
|
||||||
{
|
{
|
||||||
if (m.get_bool(114))
|
if (m.get_bool(114))
|
||||||
|
{
|
||||||
|
if (was == NULL) giochi.destroy(game);
|
||||||
return f.error_box("La rata %d e' bloccata.", nrata);
|
return f.error_box("La rata %d e' bloccata.", nrata);
|
||||||
|
}
|
||||||
|
|
||||||
const TValuta parval(game.riga(nriga));
|
const TValuta parval(game.riga(nriga));
|
||||||
const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||||
@ -1102,6 +1108,8 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
TString c = parval.codice();
|
TString c = parval.codice();
|
||||||
if (c.empty()) c = "lire";
|
if (c.empty()) c = "lire";
|
||||||
|
|
||||||
|
if (was == NULL) giochi.destroy(game);
|
||||||
return f.error_box("La fattura deve essere pagata in %s.", (const char*)c);
|
return f.error_box("La fattura deve essere pagata in %s.", (const char*)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1125,6 +1133,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
cambiato = gm.edit_pagamento(game, nriga, nrata, nrigp);
|
cambiato = gm.edit_pagamento(game, nriga, nrata, nrigp);
|
||||||
if (cambiato)
|
if (cambiato)
|
||||||
{
|
{
|
||||||
|
// Se ho cancellato il pagamento chiudo la maschera
|
||||||
if (m.is_running() && !game.esiste(nriga, nrata, nrigp))
|
if (m.is_running() && !game.esiste(nriga, nrata, nrigp))
|
||||||
m.stop_run(K_FORCE_CLOSE);
|
m.stop_run(K_FORCE_CLOSE);
|
||||||
}
|
}
|
||||||
@ -1134,6 +1143,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
#ifdef __EXTRA__
|
#ifdef __EXTRA__
|
||||||
gm.prima_nota(nreg);
|
gm.prima_nota(nreg);
|
||||||
#else
|
#else
|
||||||
|
if (was == NULL) giochi.destroy(game);
|
||||||
return f.error_box("Modificare il movimento %ld", nreg);
|
return f.error_box("Modificare il movimento %ld", nreg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1148,6 +1158,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
#else
|
#else
|
||||||
if (nreg != gm._numreg || nrata == 0)
|
if (nreg != gm._numreg || nrata == 0)
|
||||||
{
|
{
|
||||||
|
if (was == NULL) giochi.destroy(game);
|
||||||
if (nreg == 0)
|
if (nreg == 0)
|
||||||
f.error_box("Utilizzare la gestione extra-contabile");
|
f.error_box("Utilizzare la gestione extra-contabile");
|
||||||
else
|
else
|
||||||
@ -1182,7 +1193,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
// Se la partita e' presente anche su file non posso cancellarla:
|
// Se la partita e' presente anche su file non posso cancellarla:
|
||||||
// altrimenti non verra' rimossa alla registrazione!
|
// altrimenti non verra' rimossa alla registrazione!
|
||||||
if (!game.is_on_file())
|
if (!game.is_on_file())
|
||||||
app().partite().destroy(game);
|
giochi.destroy(game);
|
||||||
if (on_sheet)
|
if (on_sheet)
|
||||||
gm.fill_partite();
|
gm.fill_partite();
|
||||||
}
|
}
|
||||||
@ -1453,8 +1464,14 @@ void TGame_mask::fill_partite()
|
|||||||
if (gioco->ok())
|
if (gioco->ok())
|
||||||
{
|
{
|
||||||
const TBill& k = gioco->conto();
|
const TBill& k = gioco->conto();
|
||||||
const bool u = (k.tipo() > ' ' && k.sottoconto() == conto().sottoconto()) ||
|
bool u = (k.tipo() > ' ' && k.sottoconto() == conto().sottoconto()) || k == conto();
|
||||||
k == conto();
|
|
||||||
|
#ifdef DBG
|
||||||
|
if (u && !all && gioco->chiusa() && gioco->mov2rig(_numreg, _numrig) <= 0)
|
||||||
|
u = error_box("Tentativo di visualizzare partita %d %s!",
|
||||||
|
gioco->anno(), (const char*)gioco->numero());
|
||||||
|
#endif
|
||||||
|
|
||||||
if (u)
|
if (u)
|
||||||
update_partita(*gioco, -1);
|
update_partita(*gioco, -1);
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ NUMBER FS_NRATE 3
|
|||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 36 6 "Numero di rate "
|
PROMPT 36 6 "Numero di rate "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
|
FLAGS "U"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING FS_VALUTA 3
|
STRING FS_VALUTA 3
|
||||||
|
@ -185,7 +185,7 @@ void TPagamento::set_tipo_prima_rata(int v, int sscad)
|
|||||||
|
|
||||||
void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
|
void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
|
||||||
{
|
{
|
||||||
if (n == 0) return;
|
if (n <= 0) return;
|
||||||
_dirty = FALSE;
|
_dirty = FALSE;
|
||||||
|
|
||||||
const int nr = n_rate();
|
const int nr = n_rate();
|
||||||
@ -427,49 +427,9 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
adjust_fixed_scad();
|
adjust_fixed_scad();
|
||||||
|
|
||||||
_dirty = TRUE;
|
_dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPagamento::set_cambio(const TMask& m, bool recalc_lit)
|
|
||||||
{
|
|
||||||
const int first = _tpr < 4 ? 0 : 1;
|
|
||||||
const bool era_valuta = in_valuta();
|
|
||||||
|
|
||||||
_cambio = m.get_real(SK_CAMBIO);
|
|
||||||
if (_cambio.sign() <= 0)
|
|
||||||
_cambio = 1.0;
|
|
||||||
|
|
||||||
const bool in_val = m.get(SK_VALUTA).not_empty();
|
|
||||||
|
|
||||||
real imp; // Importo di parcheggio
|
|
||||||
|
|
||||||
if (era_valuta)
|
|
||||||
{
|
|
||||||
if (in_val) // Da valuta a valuta
|
|
||||||
{
|
|
||||||
if (recalc_lit)
|
|
||||||
adjust_perc_imp(TRUE, _rdiff, FALSE);
|
|
||||||
}
|
|
||||||
else // Da valuta a lire
|
|
||||||
{
|
|
||||||
_firstr = _secndr = ZERO;
|
|
||||||
for (int i = _rate.items()-1; i >= 0; i--)
|
|
||||||
set_imprata(i, ZERO, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (in_val) // Da lire a valuta
|
|
||||||
{
|
|
||||||
real imponibile = m.get(SK_TOTDOCVAL);
|
|
||||||
real imposta = _imposlit / _cambio; imposta.round(_roundval);
|
|
||||||
real spese = _speselit / _cambio; spese.round(_roundval);
|
|
||||||
init_total(imponibile, imposta, spese, TRUE);
|
|
||||||
adjust_perc_imp(TRUE, _rdiff, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void TPagamento::adjust_importo_lire(int start)
|
void TPagamento::adjust_importo_lire(int start)
|
||||||
|
@ -162,7 +162,6 @@ public:
|
|||||||
void set_inizio_scadenza(char v) { _inscad = v; }
|
void set_inizio_scadenza(char v) { _inscad = v; }
|
||||||
void set_code(const char* c) { _code = c; }
|
void set_code(const char* c) { _code = c; }
|
||||||
void set_roundval(int n) { _roundval = n; }
|
void set_roundval(int n) { _roundval = n; }
|
||||||
void set_cambio(const TMask& m, bool recalc_lit);
|
|
||||||
|
|
||||||
bool in_valuta() const { return _in_valuta; }
|
bool in_valuta() const { return _in_valuta; }
|
||||||
const real& cambio() const { return _cambio; }
|
const real& cambio() const { return _cambio; }
|
||||||
|
@ -1125,7 +1125,7 @@ bool TPartita::esiste(int nriga, int nrata, int nrigp) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ritorna l'importo in lire speso su di una riga contabile
|
// Ritorna l'importo in lire speso su di una riga contabile
|
||||||
TImporto TPartita::importo_speso(long nreg, int numrig, bool valuta) const
|
TImporto TPartita::importo_speso(long nreg, int numrig, bool valuta, int mode) const
|
||||||
{
|
{
|
||||||
TImporto imp;
|
TImporto imp;
|
||||||
|
|
||||||
@ -1133,7 +1133,7 @@ TImporto TPartita::importo_speso(long nreg, int numrig, bool valuta) const
|
|||||||
{
|
{
|
||||||
const TRiga_partite& row = riga(r);
|
const TRiga_partite& row = riga(r);
|
||||||
if (nreg == row.get_long(PART_NREG) && numrig == row.get_int(PART_NUMRIG))
|
if (nreg == row.get_long(PART_NREG) && numrig == row.get_int(PART_NUMRIG))
|
||||||
imp += row.importo(valuta);
|
imp += row.importo(valuta, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
return imp;
|
return imp;
|
||||||
@ -1673,18 +1673,17 @@ int TPartite_array::add_numreg(long nreg)
|
|||||||
{
|
{
|
||||||
if (nreg != _numreg)
|
if (nreg != _numreg)
|
||||||
{
|
{
|
||||||
TLocalisamfile rel(LF_PARTITE);
|
TRelation rel(LF_PARTITE);
|
||||||
rel.setkey(2); // Chiave per NREG
|
|
||||||
|
|
||||||
TRectype& part = rel.curr();
|
TRectype& part = rel.curr();
|
||||||
part.zero();
|
part.zero();
|
||||||
part.put(PART_NREG, nreg);
|
part.put(PART_NREG, nreg);
|
||||||
for (int err = rel.read(_isgreat);
|
|
||||||
err == NOERR && part.get_long(PART_NREG) == nreg;
|
// Uso un cursore per evitare conflitti di lettura con l'oggetta partita
|
||||||
err = rel.next())
|
TCursor cur(&rel, "", 2, &part, &part);
|
||||||
{
|
for (cur = 0; cur.ok(); ++cur)
|
||||||
partita(part); // Aggiungi partita se non esiste gia'
|
partita(part); // Aggiungi partita se non esiste gia'
|
||||||
}
|
|
||||||
_numreg = nreg;
|
_numreg = nreg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1702,12 +1701,12 @@ bool TPartite_array::utilizzata(long numreg, int numrig)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
TImporto TPartite_array::importo_speso(long nreg, int numrig, bool valuta)
|
TImporto TPartite_array::importo_speso(long nreg, int numrig, bool valuta, int mode)
|
||||||
{
|
{
|
||||||
TImporto imp;
|
TImporto imp;
|
||||||
add_numreg(nreg);
|
add_numreg(nreg);
|
||||||
for (TPartita* game = first(); game; game = next())
|
for (TPartita* game = first(); game; game = next())
|
||||||
imp += game->importo_speso(nreg, numrig, valuta);
|
imp += game->importo_speso(nreg, numrig, valuta, mode);
|
||||||
imp.normalize();
|
imp.normalize();
|
||||||
return imp;
|
return imp;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ public:
|
|||||||
const TString& numero() const { return _num; }
|
const TString& numero() const { return _num; }
|
||||||
const TString& descrizione() const;
|
const TString& descrizione() const;
|
||||||
|
|
||||||
TImporto importo_speso(long numreg, int numrig, bool valuta) const;
|
TImporto importo_speso(long numreg, int numrig, bool valuta, int mode = 0xF) const;
|
||||||
void update_reg(long nreg, const TRectype& mov, const TRecord_array& cg);
|
void update_reg(long nreg, const TRectype& mov, const TRecord_array& cg);
|
||||||
void calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp) const;
|
void calcola_saldo(TImporto& saldo, TImporto& doc, TImporto& pag, TImporto& imp) const;
|
||||||
TImporto calcola_saldo(bool valuta) const;
|
TImporto calcola_saldo(bool valuta) const;
|
||||||
@ -336,7 +336,7 @@ public:
|
|||||||
bool rewrite() { return write(TRUE); }
|
bool rewrite() { return write(TRUE); }
|
||||||
|
|
||||||
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
||||||
TImporto importo_speso(long numreg, int numrig, bool valuta = FALSE);
|
TImporto importo_speso(long numreg, int numrig, bool valuta = FALSE, int mode = 0xF);
|
||||||
void update_reg(const TRectype& mov, const TRecord_array& cg, long old_reg = 0);
|
void update_reg(const TRectype& mov, const TRecord_array& cg, long old_reg = 0);
|
||||||
|
|
||||||
// Controlla se esistono righe di pagamento relative alla riga numrig
|
// Controlla se esistono righe di pagamento relative alla riga numrig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user