Corretti errori Gabriella
git-svn-id: svn://10.65.10.50/trunk@2543 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5e3950f072
commit
f3802c0cf8
@ -111,6 +111,7 @@ BEGIN
|
||||
ITEM "Num. doc."
|
||||
ITEM "Prot. IVA"
|
||||
ITEM "Pagamento"
|
||||
ITEM "Bloccata"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
@ -224,6 +225,11 @@ BEGIN
|
||||
PROMPT 1 4 "Numero doc. "
|
||||
END
|
||||
|
||||
BOOLEAN 113
|
||||
BEGIN
|
||||
PROMPT 1 5 "Pagamenti bloccati"
|
||||
END
|
||||
|
||||
NUMBER 111 5
|
||||
BEGIN
|
||||
PROMPT 41 5 "Protocollo IVA "
|
||||
|
290
cg/cg2102.cpp
290
cg/cg2102.cpp
@ -223,7 +223,7 @@ void TPrimanota_application::set_cgs_imp(int n, const TImporto& imp)
|
||||
m.set(101, imp.sezione() == 'D' ? imp.valore().string() : "");
|
||||
m.set(102, imp.sezione() == 'A' ? imp.valore().string() : "");
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
// Legge l'importo della riga n e lo ritorna col segno dovuto
|
||||
@ -269,7 +269,6 @@ bool TPrimanota_application::sub_cgs_imp(int n, const TImporto& imp)
|
||||
return tot.is_zero();
|
||||
}
|
||||
|
||||
|
||||
TImporto TPrimanota_application::real2imp(const real& r, char row_type)
|
||||
{
|
||||
bool dare;
|
||||
@ -513,19 +512,26 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
|
||||
if (!residuo.is_zero())
|
||||
{
|
||||
const char* const pic = val ? ".3" : ".";
|
||||
TPrimanota_application& a = app();
|
||||
const TMask& m = a.curr_mask();
|
||||
|
||||
TString msg(255);
|
||||
msg << "Il totale documento " << (val ? "in valuta" : "inserito")
|
||||
<< " e' " << imptot.valore().string(pic) << ' ' << imptot.sezione() << ",\n";
|
||||
msg << "i pagamenti e le spese ammontano a "
|
||||
<< impsal.valore().string(pic) << ' ' << impsal.sezione() << ",\n";
|
||||
msg << "per cui il residuo e' " << residuo.valore().string(pic) << '.';
|
||||
if (app().curr_mask().edit_mode() && impsal.is_zero())
|
||||
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())
|
||||
{
|
||||
msg << "\nSi desidera registrare ugualmente?";
|
||||
ok = app().cgs().yesno_box(msg);
|
||||
ok = a.cgs().yesno_box(msg);
|
||||
}
|
||||
else
|
||||
ok = app().cgs().error_box(msg);
|
||||
ok = a.cgs().error_box(msg);
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -536,8 +542,9 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
|
||||
bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
const real saldo = app().calcola_saldo();
|
||||
{
|
||||
TPrimanota_application& a = app();
|
||||
const real saldo = a.calcola_saldo();
|
||||
|
||||
if (saldo != ZERO)
|
||||
{
|
||||
@ -545,8 +552,8 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
return f.error_box("Il movimento e' sbilanciato di %s lire.", ss);
|
||||
}
|
||||
|
||||
const bool paga = app().is_pagamento();
|
||||
const bool nota = app().is_nota_credito();
|
||||
const bool paga = a.is_pagamento();
|
||||
const bool nota = a.is_nota_credito();
|
||||
|
||||
TMask& m = f.mask();
|
||||
const long numreg = m.get_long(F_NUMREG);
|
||||
@ -554,7 +561,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
const bool in_valuta = m.get(SK_VALUTA).not_empty();
|
||||
TImporto saldaconto, saldaconto_val;
|
||||
|
||||
TSheet_field& cg = app().cgs();
|
||||
TSheet_field& cg = a.cgs();
|
||||
bool empty = TRUE;
|
||||
for (int i = 0; i < cg.items(); i++)
|
||||
{
|
||||
@ -600,7 +607,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
saldaconto += importo;
|
||||
if (in_valuta)
|
||||
saldaconto_val += app().partite().importo_speso(numreg, i+1, TRUE);
|
||||
saldaconto_val += a.partite().importo_speso(numreg, i+1, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -608,25 +615,26 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (paga)
|
||||
{
|
||||
const char s(app().causale().sezione(2));
|
||||
const real t(f.mask().get(F_TOTALE));
|
||||
const char s(a.causale().sezione(2));
|
||||
const real t(m.get(F_TOTALE));
|
||||
const TImporto totdoc(s, t);
|
||||
const bool ok = imptot_error(totdoc, saldaconto, FALSE);
|
||||
if (!ok) return FALSE;
|
||||
bool ok = imptot_error(totdoc, saldaconto, FALSE);
|
||||
|
||||
if (in_valuta)
|
||||
if (ok && in_valuta && !saldaconto.is_zero())
|
||||
{
|
||||
const real t(f.mask().get(SK_TOTDOCVAL));
|
||||
const real t(m.get(SK_TOTDOCVAL));
|
||||
const TImporto totdoc_val(s, t);
|
||||
const bool ok = imptot_error(totdoc_val, saldaconto_val, TRUE);
|
||||
if (!ok) return FALSE;
|
||||
ok = imptot_error(totdoc_val, saldaconto_val, TRUE);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (app().is_fattura())
|
||||
if (a.is_fattura())
|
||||
{
|
||||
TBill contocf;
|
||||
if (app().cerca_conto_cf(contocf) < 0)
|
||||
if (a.cerca_conto_cf(contocf) < 0)
|
||||
{
|
||||
TString msg(80); msg = "Non esiste una riga contabile riferita al ";
|
||||
msg << (contocf.tipo() == 'C' ? "cliente" : "fornitore") << ' ';
|
||||
@ -788,9 +796,14 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
static TImporto old_spesa;
|
||||
|
||||
CHECKD(r >= 0, "Chi e' quel ca$$one che notifica la riga ", r);
|
||||
|
||||
TPrimanota_application& a = app();
|
||||
|
||||
if (k == K_CTRL + K_DEL)
|
||||
{
|
||||
a.calcola_saldo(); // Ricalcola saldo dopo cancellazione
|
||||
return TRUE; // Ritorna subito, altrimenti crea riga vuota
|
||||
}
|
||||
|
||||
TToken_string& row = cg.row(r);
|
||||
const char tipo = row_type(row); // Tipo della riga in esame
|
||||
@ -813,7 +826,9 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
else
|
||||
{
|
||||
if (tipo == 'K')
|
||||
app().notify_cgline_deletion(r+1);
|
||||
{
|
||||
a.notify_cgline_deletion(r+1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case K_ENTER:
|
||||
@ -824,20 +839,21 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
{
|
||||
const int s = type2pos('L');
|
||||
if (s < 0)
|
||||
app().crea_somma_spese(growth);
|
||||
a.crea_somma_spese(growth);
|
||||
else
|
||||
app().sub_cgs_imp(s, growth);
|
||||
a.sub_cgs_imp(s, growth);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (app().iva() == nessuna_iva && !app().is_saldaconto())
|
||||
app().generazione_righe_cg(r);
|
||||
}
|
||||
app().calcola_saldo();
|
||||
if (a.iva() == nessuna_iva && !a.is_saldaconto())
|
||||
a.generazione_righe_cg(r);
|
||||
}
|
||||
if (k == K_ENTER)
|
||||
a.calcola_saldo();
|
||||
break;
|
||||
case K_CTRL+K_INS: // Post inserimento
|
||||
if (app().is_pagamento())
|
||||
if (a.is_pagamento())
|
||||
{
|
||||
const char tipo = cg.mask().get(SK_TIPORIGA)[0];
|
||||
if (tipo == 'K' || tipo == 'G')
|
||||
@ -848,7 +864,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
const char sez = app().causale().sezione(k);
|
||||
const real imp(cg.mask().get(K_RESIDUO));
|
||||
TImporto importo(sez, imp);
|
||||
app().set_cgs_row(r, importo, conto, desc, tipo);
|
||||
a.set_cgs_row(r, importo, conto, desc, tipo);
|
||||
|
||||
if (tipo == 'K')
|
||||
{
|
||||
@ -870,9 +886,9 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
|
||||
{
|
||||
const int s = type2pos('L');
|
||||
if (s < 0)
|
||||
app().crea_somma_spese(importo);
|
||||
a.crea_somma_spese(importo);
|
||||
else
|
||||
app().sub_cgs_imp(s, importo);
|
||||
a.sub_cgs_imp(s, importo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -999,7 +1015,7 @@ bool TPrimanota_application::codiva_handler(TMask_field& f, KEY key)
|
||||
TMask& m = f.mask();
|
||||
|
||||
if (m.get_int(107) == 0)
|
||||
{
|
||||
{
|
||||
TCodiceIVA iva(f.get());
|
||||
TBill b; app().IVA2bill(iva, b);
|
||||
|
||||
@ -1128,18 +1144,19 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
static real oldimp, oldiva;
|
||||
|
||||
TToken_string& row = iva.row(r);
|
||||
const TCausale& cau = app().causale();
|
||||
TPrimanota_application& a = app();
|
||||
const TCausale& cau = a.causale();
|
||||
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
oldimp = real(row.get(0)); // Imponibile
|
||||
oldiva = real(row.get(3)); // Imposta
|
||||
|
||||
if (oldiva.is_zero() && cau.corrispettivi())
|
||||
{ // In caso di corrispettivi ...
|
||||
const TCodiceIVA i(row.get(1));
|
||||
const real percent = i.percentuale();
|
||||
oldiva = scorpora(oldimp, percent); // ... scorpora imposta dall'imponibile
|
||||
if (oldiva.is_zero() && cau.corrispettivi()) // In caso di corrispettivi ...
|
||||
{
|
||||
const TString zanicchi(row.get(1)); // Codice IVA
|
||||
const TCodiceIVA i(zanicchi);
|
||||
oldiva = i.scorpora(oldimp); // ... scorpora imposta dall'imponibile
|
||||
}
|
||||
|
||||
const char tipod = detraibile(row) ? 'D' : 'N';
|
||||
@ -1152,7 +1169,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
if (c.ok())
|
||||
{
|
||||
const TString80 d(cau.desc_agg(ri));
|
||||
oldposiva = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, d, tipod);
|
||||
oldposiva = a.set_cgs_row(-1, app().real2imp(ZERO, 'I'), c, d, tipod);
|
||||
}
|
||||
else
|
||||
if (ri == 4) // Se non esiste il conto IVA indetraibile ...
|
||||
@ -1169,7 +1186,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
if (oldpos < 0)
|
||||
{
|
||||
const TString80 d(cau.desc_agg(2));
|
||||
oldpos = app().set_cgs_row(-1, app().real2imp(ZERO, 'I'), oldconto, d, 'I');
|
||||
oldpos = a.set_cgs_row(-1, a.real2imp(ZERO, 'I'), oldconto, d, 'I');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1186,27 +1203,27 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
int delimp = -1, deliva = -1; // Eventuali righe contabili da cancellare
|
||||
if (oldpos >= 0) // Se il conto esisteva anche prima ...
|
||||
{ // sottrai il vecchio imponibile
|
||||
TImporto i(app().get_cgs_imp(oldpos));
|
||||
TImporto i(a.get_cgs_imp(oldpos));
|
||||
i.valore() -= oldimp;
|
||||
app().set_cgs_imp(oldpos, i);
|
||||
a.set_cgs_imp(oldpos, i);
|
||||
if (i.is_zero()) delimp = oldpos;
|
||||
}
|
||||
if (oldposiva >= 0) // Se conto IVA esisteva anche prima ...
|
||||
{ // sottrai la vecchia imposta
|
||||
TImporto i(app().get_cgs_imp(oldposiva));
|
||||
TImporto i(a.get_cgs_imp(oldposiva));
|
||||
i.valore() -= oldiva;
|
||||
app().set_cgs_imp(oldposiva, i);
|
||||
a.set_cgs_imp(oldposiva, i);
|
||||
if (i.is_zero()) deliva = oldposiva;
|
||||
}
|
||||
|
||||
real imponibile(row.get(0)); // Nuovo imponibile
|
||||
real imposta(row.get(3)); // Nuova imposta
|
||||
|
||||
if (imposta.is_zero() && app().causale().corrispettivi())
|
||||
{ // In caso di corrispettivi ...
|
||||
const TCodiceIVA i(row.get(1));
|
||||
const real percent = i.percentuale();
|
||||
imposta = scorpora(imponibile, percent); // ... scorpora imposta dall'imponibile
|
||||
if (imposta.is_zero() && cau.corrispettivi()) // In caso di corrispettivi ...
|
||||
{
|
||||
const TString zanicchi(row.get(1));
|
||||
const TCodiceIVA i(zanicchi);
|
||||
imposta = i.scorpora(imponibile); // ... scorpora imposta dall'imponibile
|
||||
}
|
||||
|
||||
TBill conto(row, 5, 0x3);
|
||||
@ -1216,7 +1233,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
|
||||
// Calcola riga causale col conto opportuno
|
||||
const int ri = detrarre ? RIGA_IVA_DETRAIBILE : RIGA_IVA_NON_DETRAIBILE;
|
||||
TBill contoiva; app().causale().bill(ri, contoiva);
|
||||
TBill contoiva; cau.bill(ri, contoiva);
|
||||
|
||||
if (ri == 4 && !contoiva.ok()) // Se non c'e' il conto IVA indetraibile ...
|
||||
{ // ... somma imponibile e imposta
|
||||
@ -1229,24 +1246,24 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
{
|
||||
if (delimp >= 0)
|
||||
{
|
||||
app().reset_cgs_row(delimp); // Cancella vecchia riga
|
||||
a.reset_cgs_row(delimp); // Cancella vecchia riga
|
||||
if (deliva > delimp) deliva--;
|
||||
}
|
||||
|
||||
const TImporto val(app().real2imp(imponibile, 'I'));
|
||||
const TImporto val(a.real2imp(imponibile, 'I'));
|
||||
if (conto.ok() && !val.is_zero()) // Se c'e' imponibile ...
|
||||
{ // crea una nuova riga contabile
|
||||
const TString80 d(cau.desc_agg(2));
|
||||
app().set_cgs_row(-1, val, conto, d, 'I');
|
||||
a.set_cgs_row(-1, val, conto, d, 'I');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TImporto val(app().real2imp(imponibile, 'I'));
|
||||
const bool empty = app().add_cgs_imp(newpos, val);
|
||||
TImporto val(a.real2imp(imponibile, 'I'));
|
||||
const bool empty = a.add_cgs_imp(newpos, val);
|
||||
if (empty) // Se la riga si e' azzerata ...
|
||||
{ // ... cancellala
|
||||
app().reset_cgs_row(newpos);
|
||||
a.reset_cgs_row(newpos);
|
||||
newpos = -1;
|
||||
}
|
||||
}
|
||||
@ -1259,24 +1276,24 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
int newposiva = type2pos(tipod);
|
||||
|
||||
if (deliva >= 0 && newposiva != deliva) // E' cambiato il tipo d'imposta
|
||||
app().reset_cgs_row(deliva); // Azzera il vecchio tipo se necessario
|
||||
a.reset_cgs_row(deliva); // Azzera il vecchio tipo se necessario
|
||||
|
||||
if (newposiva < 0)
|
||||
{
|
||||
if (!imposta.is_zero()) // Se c'e' imposta ...
|
||||
{ // ... crea nuova riga per l'IVA
|
||||
const TImporto val(app().real2imp(imposta, 'I'));
|
||||
const TImporto val(a.real2imp(imposta, 'I'));
|
||||
const TString80 d(cau.desc_agg(ri));
|
||||
newposiva = app().set_cgs_row(-1, val, contoiva, d, tipod);
|
||||
newposiva = a.set_cgs_row(-1, val, contoiva, d, tipod);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const TImporto val(app().real2imp(imposta, 'I'));
|
||||
const bool empty = app().add_cgs_imp(newposiva, val);
|
||||
const TImporto val(a.real2imp(imposta, 'I'));
|
||||
const bool empty = a.add_cgs_imp(newposiva, val);
|
||||
if (empty) // Se l'imposta si e' azzerata ...
|
||||
{
|
||||
app().reset_cgs_row(newposiva); // ... cancellala
|
||||
a.reset_cgs_row(newposiva); // ... cancellala
|
||||
newposiva = -1;
|
||||
}
|
||||
}
|
||||
@ -1284,20 +1301,20 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
oldiva = imposta;
|
||||
oldposiva = newposiva;
|
||||
|
||||
TMask& m = app().curr_mask();
|
||||
TMask& m = a.curr_mask();
|
||||
if (r == 0) // Se cambio la prima riga ...
|
||||
{
|
||||
app().add_cgs_tot(m); // ... ricalcola conti e imponibili
|
||||
a.add_cgs_tot(m); // ... ricalcola conti e imponibili
|
||||
}
|
||||
else
|
||||
{
|
||||
app().calcola_saldo(); // Calcola sbilancio
|
||||
app().calcola_imp(); // Calcola imponibili
|
||||
a.calcola_saldo(); // Calcola sbilancio
|
||||
a.calcola_imp(); // Calcola imponibili
|
||||
}
|
||||
|
||||
if (app().is_fattura() && m.insert_mode())
|
||||
if (a.is_fattura() && m.insert_mode())
|
||||
{
|
||||
TPagamento& pag = app().pagamento();
|
||||
TPagamento& pag = a.pagamento();
|
||||
real imposta, imponibile;
|
||||
if (pag.in_valuta())
|
||||
{
|
||||
@ -1314,7 +1331,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
|
||||
pimposta.round(pag.round()); pimponibile.round(pag.round());
|
||||
|
||||
if (pimposta != imposta || pimponibile != imponibile)
|
||||
app().set_scadenze(m); // Ricalcola rate
|
||||
a.set_scadenze(m); // Ricalcola rate
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -1373,27 +1390,24 @@ bool TPrimanota_application::cg_gruppo_handler(TMask_field& f, KEY key)
|
||||
bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
|
||||
if (key == K_ENTER)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
if (m.get(CG_ROWTYPE)[0] == 'T') // Se riga totale documento
|
||||
{
|
||||
if (!app().causale().corrispettivi())
|
||||
{
|
||||
char cf = m.get(f.dlg()-2)[0];
|
||||
if (cf < ' ') cf = ' '; // Tipo conto della riga
|
||||
|
||||
char tipo = ' '; // Tipo conto richiesto dal movimento
|
||||
if (!app().causale().corrispettivi())
|
||||
tipo = app().clifo();
|
||||
|
||||
if (cf != tipo) // Incongruenza!
|
||||
TMask& m = f.mask();
|
||||
if (m.get(CG_ROWTYPE)[0] == 'T') // Se riga totale documento
|
||||
{
|
||||
const char* d = tipo == ' ' ? "normale" : (tipo == 'C' ? "clienti" : "fornitori");
|
||||
ok = f.error_box("La riga totale richiede un conto %s.", d);
|
||||
}
|
||||
}
|
||||
const char tipo = app().clifo(); // Tipo conto richiesto dal movimento
|
||||
char cf = m.get(f.dlg()-2)[0];
|
||||
if (cf < ' ') cf = ' '; // Tipo conto della riga
|
||||
if (cf != tipo) // Incongruenza!
|
||||
{
|
||||
const char* d = tipo == ' ' ? "normale" : (tipo == 'C' ? "clienti" : "fornitori");
|
||||
ok = f.error_box("La riga totale richiede un conto %s.", d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1431,20 +1445,26 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (k == K_TAB || k == K_ENTER)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
const short cid = 100 + (f.dlg() % 100) -1;
|
||||
const int conto = m.get_int(cid);
|
||||
if (conto == 0)
|
||||
const long codice = atol(f.get());
|
||||
if (codice > 0L)
|
||||
{
|
||||
const long codice = atol(f.get());
|
||||
if (codice > 0L)
|
||||
TMask& m = f.mask();
|
||||
const short cid = 100 + (f.dlg() % 100) -1;
|
||||
const short gid = cid-1;
|
||||
const int conto = m.get_int(cid);
|
||||
const int gruppo = m.get_int(gid);
|
||||
if (gruppo == 0 && conto == 0)
|
||||
{
|
||||
TBill c(0, 0, codice, f.dlg() > 300 ? 'F' : 'C');
|
||||
c.descrizione(); // Carica gruppo e conto
|
||||
m.set(cid-1, c.gruppo());
|
||||
m.set(cid, c.conto());
|
||||
}
|
||||
}
|
||||
m.set(f.dlg()+1, c.descrizione()); // Carica gruppo e conto
|
||||
if (c.ok())
|
||||
{
|
||||
m.set(gid-1, c.tipo() == 'C' ? "C" : "F");
|
||||
m.set(gid, c.gruppo());
|
||||
m.set(cid, c.conto());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -1728,14 +1748,11 @@ bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
|
||||
TMask& m = f.mask();
|
||||
if (key == K_TAB && f.to_check(key, TRUE) && m.insert_mode() && app().is_saldaconto())
|
||||
{
|
||||
if (!app().npart_is_prot()) // Copiare numero documento nel numero partita?
|
||||
const TString16 n = f.get();
|
||||
if (n.not_empty() && !app().npart_is_prot()) // Copiare numero documento nel numero partita?
|
||||
{
|
||||
if (m.get(F_NUMRIF).empty())
|
||||
{
|
||||
const TString16 n = f.get();
|
||||
if (n.not_empty())
|
||||
m.set(F_NUMRIF, f.get(), TRUE);
|
||||
}
|
||||
if (m.field(F_NUMRIF).active() && m.get(F_NUMRIF).empty())
|
||||
m.set(F_NUMRIF, n, TRUE);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -1749,8 +1766,8 @@ bool TPrimanota_application::datadoc_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
const TDate dd(f.get()); // Fattura o nota credito
|
||||
if (dd.ok())
|
||||
{
|
||||
if (m.get(F_ANNORIF).empty() && m.insert_mode())
|
||||
{
|
||||
if (m.insert_mode() && m.field(F_ANNORIF).active() && m.get(F_ANNORIF).empty())
|
||||
m.set(F_ANNORIF, dd.year()); // copia anno documento
|
||||
|
||||
TPrimanota_application& a = app();
|
||||
@ -1806,32 +1823,41 @@ bool TPrimanota_application::occas_handler(TMask_field& f, KEY key)
|
||||
// Crea o aggiorna la riga contabile col totale documento
|
||||
// Certified 99%
|
||||
void TPrimanota_application::add_cgs_tot(TMask& m)
|
||||
{
|
||||
const char tipo = app().clifo();
|
||||
{
|
||||
const bool corri = causale().corrispettivi();
|
||||
const char tipo = corri ? ' ' : app().clifo();
|
||||
int gruppo = 0, conto = 0;
|
||||
const long codice = m.get_long(tipo == 'C' ? F_CLIENTE : F_FORNITORE);
|
||||
long codice = corri ? 0L : m.get_long(tipo == 'C' ? F_CLIENTE : F_FORNITORE);
|
||||
|
||||
const int riga_totale = type2pos('T');
|
||||
TSheet_field& ss = cgs();
|
||||
const int riga_totale = type2pos('T');
|
||||
|
||||
// Cerca di preservare il gruppo-conto-sottoconto sulla riga totale
|
||||
if (riga_totale >= 0)
|
||||
{
|
||||
TToken_string& rowt = cgs().row(riga_totale);
|
||||
TToken_string& rowt = ss.row(riga_totale);
|
||||
gruppo = rowt.get_int(3);
|
||||
conto = rowt.get_int();
|
||||
if (corri)
|
||||
codice = rowt.get_long();
|
||||
}
|
||||
|
||||
TBill nuovo(gruppo, conto, codice, tipo);
|
||||
if ((gruppo == 0 || conto == 0) && !causale().corrispettivi())
|
||||
nuovo.find(); // Compila anche gruppo e conto
|
||||
if (!corri && (gruppo == 0 || conto == 0))
|
||||
nuovo.find(); // Compila anche gruppo e conto in base al codice clifo
|
||||
|
||||
if (nuovo.gruppo() == 0 || nuovo.conto() == 0)
|
||||
{
|
||||
// Se l'utente non ha ancora specificato un conto lo prendo dalla prima riga della causale
|
||||
causale().bill(1, nuovo);
|
||||
causale().bill(1, nuovo);
|
||||
|
||||
// Nelle fatture si deve sempre aggiungere il codice clifo (in causale normalmente non c'e')
|
||||
if (!corri)
|
||||
nuovo.codclifo() = codice;
|
||||
}
|
||||
|
||||
if (riga_totale >= 0)
|
||||
{
|
||||
TSheet_field& ss = cgs();
|
||||
TToken_string& row = ss.row(riga_totale);
|
||||
const TBill vecchio(row, 2, 0x1);
|
||||
if (!vecchio.empty() && nuovo != vecchio) // Se cambio cliente/fornitore
|
||||
@ -1996,22 +2022,23 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
|
||||
if (!suspended_handler(f, key))
|
||||
return FALSE;
|
||||
|
||||
const real imp(app().ivas().row(1).get(0)); // Se il totale non e' stato spezzato
|
||||
TPrimanota_application& a = app();
|
||||
const real imp(a.ivas().row(1).get(0)); // Se il totale non e' stato spezzato
|
||||
if (imp.is_zero())
|
||||
{
|
||||
TToken_string& row = app().ivas().row(0);
|
||||
{
|
||||
TToken_string& row = a.ivas().row(0);
|
||||
|
||||
TMask& m = f.mask();
|
||||
iva_notify(app().ivas(), 0, K_SPACE);
|
||||
iva_notify(a.ivas(), 0, K_SPACE);
|
||||
|
||||
const TCodiceIVA iva(f.get());
|
||||
const bool corr = app().causale().corrispettivi();
|
||||
const bool acq3 = (app().iva() == iva_acquisti) && (row.get_int(2) == 3);
|
||||
const bool corr = a.causale().corrispettivi();
|
||||
const bool acq3 = (a.iva() == iva_acquisti) && (row.get_int(2) == 3);
|
||||
|
||||
real tot = app().totale_documento(); // Calcola totale documento
|
||||
real tot = a.totale_documento(); // Calcola totale documento
|
||||
real imposta; // Calcola imposta
|
||||
if (!corr && !acq3)
|
||||
imposta = app().scorpora(tot, iva.percentuale());
|
||||
imposta = iva.scorpora(tot);
|
||||
|
||||
row.add(tot.string(), 0); // imponibile
|
||||
row.add(imposta.string(), 3); // imposta
|
||||
@ -2020,12 +2047,12 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
row.add(iva.codice(), 1); // Aggiorna codice IVA
|
||||
TBill bill; // Aggiorna conto della prima riga IVA
|
||||
app().IVA2bill(iva, bill);
|
||||
a.IVA2bill(iva, bill);
|
||||
bill.add_to(row, 4, 0x7);
|
||||
}
|
||||
app().ivas().force_update(0);
|
||||
a.ivas().force_update(0);
|
||||
|
||||
iva_notify(app().ivas(), 0, K_ENTER);
|
||||
iva_notify(a.ivas(), 0, K_ENTER);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -2187,13 +2214,12 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
|
||||
|
||||
}
|
||||
else
|
||||
if (key == K_TAB &&
|
||||
app().is_saldaconto() && app().npart_is_prot() &&
|
||||
m.insert_mode() && m.get(F_NUMRIF).empty())
|
||||
if (key == K_TAB && m.insert_mode() && app().npart_is_prot() &&
|
||||
m.field(F_NUMRIF).active() && m.get(F_NUMRIF).empty())
|
||||
{
|
||||
const TString& piva = f.get();
|
||||
if (piva.not_empty())
|
||||
m.set(F_NUMRIF, piva);
|
||||
m.set(F_NUMRIF, piva, TRUE);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
|
100
cg/cg2104.cpp
100
cg/cg2104.cpp
@ -30,9 +30,9 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
||||
TMask* msk = &(ps.mask());
|
||||
TString_array& rws = app().pag_rows();
|
||||
|
||||
const int rdiff = atoi(msk->get(FS_RDIFFER));
|
||||
const int rdiff = msk->get_int(FS_RDIFFER);
|
||||
const bool in_valuta = pag.in_valuta();
|
||||
const int impos = in_valuta ? 2 : 1;
|
||||
const int impos = in_valuta ? 2 : 1;
|
||||
|
||||
// ts contiene la vecchia riga, ns la nuova
|
||||
TToken_string ts(128), ns(128);
|
||||
@ -51,7 +51,7 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
||||
{
|
||||
case K_SPACE:
|
||||
{
|
||||
const bool can = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(11) != 'X';
|
||||
const bool can = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(13) != 'X';
|
||||
ps.sheet_mask().enable(DLG_DELREC, can);
|
||||
}
|
||||
break;
|
||||
@ -94,7 +94,7 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
||||
|
||||
break;
|
||||
case K_DEL:
|
||||
doit = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(11) != 'X';
|
||||
doit = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(13) != 'X';
|
||||
if (doit)
|
||||
{
|
||||
pag.remove_rata(r);
|
||||
@ -122,7 +122,6 @@ bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// settato da recalc_rate se occorre ridefinire lo sheet
|
||||
// aggiungendo o togliendo righe
|
||||
@ -299,11 +298,10 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
||||
bool ok = TRUE;
|
||||
TMask& m = f.mask();
|
||||
|
||||
const bool set_scad = m.field(F_NUMRIF).active() && !m.get(F_NUMRIF).blank();
|
||||
|
||||
const bool set_scad = m.page_enabled(2); // E' attiva pagina 3
|
||||
if (key == K_ENTER)
|
||||
{
|
||||
const bool required = (m.insert_mode() && !m.get_bool(F_SOLAIVA)) || set_scad;
|
||||
const bool required = app().is_fattura() && (m.insert_mode() || set_scad);
|
||||
if (required && f.get().empty())
|
||||
{
|
||||
error_box("Il codice di pagamento e' obbligatorio!\n"
|
||||
@ -414,8 +412,8 @@ bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask_field& dc = m.field(SK_DATACAMBIO);
|
||||
if (dc.get().empty()) // Inizializza data cambio se assente
|
||||
m.set(SK_DATACAMBIO, m.get(F_DATADOC), TRUE);
|
||||
else if (f.focusdirty())
|
||||
dc.set(m.get(F_DATADOC));
|
||||
if (f.focusdirty())
|
||||
{
|
||||
dc.set_dirty();
|
||||
dc.check(RUNNING_CHECK); // Forza ricerca cambio
|
||||
@ -448,7 +446,7 @@ bool TPrimanota_application::datacambio_handler(TMask_field& f, KEY key)
|
||||
|
||||
bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
if (key == K_TAB && f.to_check(key, TRUE))
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
TPrimanota_application& a = app();
|
||||
@ -463,7 +461,7 @@ bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TPagamento& pag = a.pagamento();
|
||||
const real ex(f.get());
|
||||
pag.set_cambio(ex); // Aggiorna cambio sul pagamento
|
||||
pag.set_cambio(ex, m.get_bool(FS_RECALC)); // Aggiorna cambio sul pagamento
|
||||
update = TRUE;
|
||||
|
||||
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
||||
@ -674,14 +672,14 @@ void TPrimanota_application::set_totale_pagamento()
|
||||
|
||||
const TMask& m = curr_mask();
|
||||
TPagamento& pag = pagamento();
|
||||
pag.set_cambio(m.get_real(SK_CAMBIO));
|
||||
real implit;
|
||||
pag.set_cambio(m.get_real(SK_CAMBIO), FALSE);
|
||||
|
||||
if (pag.in_valuta())
|
||||
{
|
||||
imposta = m.get_real(F_IMPOSTE) / pag.cambio(); imposta.round(3);
|
||||
imponibile = m.get_real(SK_TOTDOCVAL) - imposta;
|
||||
implit = m.get_real(F_TOTALE);
|
||||
const real totlit = m.get_real(F_TOTALE);
|
||||
pag.set_totlit(totlit);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -690,7 +688,6 @@ void TPrimanota_application::set_totale_pagamento()
|
||||
}
|
||||
|
||||
pag.set_total(imponibile, imposta, spese);
|
||||
pag.set_implit(implit);
|
||||
}
|
||||
|
||||
void TPrimanota_application::set_scadenze(TMask& m)
|
||||
@ -772,15 +769,15 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
||||
real importo = scadenza.get(SCAD_IMPORTO);
|
||||
const TDate scad = scadenza.get(SCAD_DATASCAD);
|
||||
const int tipop = scadenza.get_int(SCAD_TIPOPAG);
|
||||
const bool paid = i <= protette; // Non cancellabile
|
||||
const bool prot = i <= protette; // Non cancellabile
|
||||
const TString16 ulc = scadenza.get(SCAD_ULTCLASS);
|
||||
if (in_valuta)
|
||||
{
|
||||
const real impval(scadenza.get(SCAD_IMPORTOVAL));
|
||||
pag.set_rata(i-1, impval, importo, scad, tipop, ulc, paid);
|
||||
pag.set_rata(i-1, impval, importo, scad, tipop, ulc, prot);
|
||||
}
|
||||
else
|
||||
pag.set_rata(i-1, importo, ZERO, scad, tipop, ulc, paid);
|
||||
pag.set_rata(i-1, importo, ZERO, scad, tipop, ulc, prot);
|
||||
|
||||
TToken_string& str = ps.row(i-1);
|
||||
str.add(scadenza.get(SCAD_CODABIPR), 7);
|
||||
@ -794,7 +791,10 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
||||
m.set(FS_VSABI, str.get(9));
|
||||
m.set(FS_VSCAB, str.get(10));
|
||||
m.set(FS_AGENTE, scadenza.get(SCAD_CODAG));
|
||||
}
|
||||
}
|
||||
str.add(scadenza.get(SCAD_DESCR), 11);
|
||||
str.add(scadenza.get(SCAD_BLOCCATA), 12);
|
||||
str.add(prot ? "X" : " ", 13);
|
||||
}
|
||||
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
|
||||
m.set(FS_NAMEPAG, pag.name());
|
||||
@ -893,31 +893,27 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
|
||||
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
||||
|
||||
partita.elimina_rata(-1);
|
||||
for (i = 0; i < pag.n_rate(); i++)
|
||||
partita.elimina_rata(-1); // Elimina tutte le rate eventuali
|
||||
for (i = 0; i < ps.items(); i++)
|
||||
{
|
||||
TToken_string& row = ps.row(i);
|
||||
|
||||
TRiga_scadenze& scadenza = partita.new_row();
|
||||
scadenza.put(SCAD_CODPAG, codpag);
|
||||
scadenza.put(SCAD_TIPOPAG, pag.tipo_rata(i));
|
||||
scadenza.put(SCAD_ULTCLASS, pag.ulc_rata(i));
|
||||
if (partita.in_valuta())
|
||||
{
|
||||
scadenza.put(SCAD_IMPORTO, pag.tlit_rata(i));
|
||||
scadenza.put(SCAD_IMPORTOVAL, pag.tpay_rata(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
scadenza.put(SCAD_IMPORTO, pag.tpay_rata(i));
|
||||
scadenza.zero(SCAD_IMPORTOVAL);
|
||||
}
|
||||
scadenza.put(SCAD_DATASCAD, pag.data_rata(i));
|
||||
scadenza.put(SCAD_CODABIPR, row.get(7));
|
||||
scadenza.put(SCAD_CODCABPR, row.get(8));
|
||||
scadenza.put(SCAD_CODABI, row.get(9));
|
||||
scadenza.put(SCAD_CODCAB, row.get(10));
|
||||
scadenza.put(SCAD_CODAG, agente);
|
||||
scadenza.put(SCAD_CODPAG, codpag); // Codice pagamento
|
||||
scadenza.put(SCAD_CODAG, agente); // Codice agente
|
||||
|
||||
scadenza.put(SCAD_DATASCAD, row.get(0)); // 0 = Data scadenza
|
||||
scadenza.put(SCAD_IMPORTO, row.get()); // 1 = Importo
|
||||
scadenza.put(SCAD_IMPORTOVAL, row.get()); // 2 = Importo in valuta
|
||||
row.get(); // 4 = Percentuale
|
||||
scadenza.put(SCAD_TIPOPAG, row.get()); // 5 = Tipo pagamento
|
||||
scadenza.put(SCAD_ULTCLASS, row.get()); // 6 = Ulteriore classificazione
|
||||
scadenza.put(SCAD_CODABIPR, row.get()); // 7 = Ns ABI
|
||||
scadenza.put(SCAD_CODCABPR, row.get()); // 8 = Ns CAB
|
||||
scadenza.put(SCAD_CODABI, row.get()); // 9 = Vs ABI
|
||||
scadenza.put(SCAD_CODCAB, row.get()); //10 = Vs CAB
|
||||
scadenza.put(SCAD_DESCR, row.get()); //11 = Note
|
||||
scadenza.put(SCAD_BLOCCATA, row.get()); //12 = Non pagabile
|
||||
}
|
||||
}
|
||||
|
||||
@ -965,32 +961,38 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
TMask& m = f.mask();
|
||||
TPrimanota_application& a = app();
|
||||
|
||||
const char tipo = m.get(116)[0];
|
||||
if (tipo == 'K' || (tipo == 'T' && app().causale().tipomov() == 2))
|
||||
const char tipo = m.get(CG_ROWTYPE)[0];
|
||||
if (tipo == 'K' || (tipo == 'T' && a.causale().tipomov() == 2))
|
||||
{
|
||||
TSheet_field& s = *m.get_sheet();
|
||||
const int riga = s.selected();
|
||||
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
const bool ok = app().edit_partite(m, riga);
|
||||
const bool ok = a.edit_partite(m, riga);
|
||||
if (ok && riga < s.items())
|
||||
k = K_ENTER;
|
||||
}
|
||||
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
const long curreg = app().curr_mask().get_long(F_NUMREG);
|
||||
const TImporto importo(app().get_cgs_imp(riga));
|
||||
const TImporto speso(app().partite().importo_speso(curreg, riga+1));
|
||||
const long curreg = a.curr_mask().get_long(F_NUMREG);
|
||||
const TImporto importo(a.get_cgs_imp(riga));
|
||||
const TImporto speso(a.partite().importo_speso(curreg, riga+1));
|
||||
|
||||
if (tipo == 'K' && !speso.is_zero())
|
||||
{
|
||||
a.disable_cgs_cells(riga, 'K');
|
||||
a.cgs().force_update(riga);
|
||||
}
|
||||
|
||||
if (importo != speso)
|
||||
{
|
||||
const char* ss = speso.valore().string(".");
|
||||
return f.error_box("L'importo deve essere %s %c", ss, speso.sezione());
|
||||
}
|
||||
if (tipo == 'K' && !speso.is_zero())
|
||||
app().disable_cgs_cells(riga, 'K');
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
|
@ -702,6 +702,13 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
gm.add_importo(row, scad.importo(FALSE), FALSE, 5);
|
||||
if (in_valuta)
|
||||
gm.add_importo(row, scad.importo(TRUE), TRUE, 6);
|
||||
|
||||
const TString& descr = scad.get(SCAD_DESCR);
|
||||
if (descr.not_empty())
|
||||
row.add(descr, 4);
|
||||
|
||||
const bool blocked = scad.get_bool(SCAD_BLOCCATA);
|
||||
row.add(blocked ? "X" : " " , 12);
|
||||
|
||||
const int lastp = scad.last();
|
||||
for (int pa = scad.first(); pa <= lastp; pa = scad.succ(pa))
|
||||
@ -1051,18 +1058,21 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
int nrigp = m.get_int(112); // Pagamento selezionato (puo' essere 0)
|
||||
|
||||
if (nrata != 0 && nrigp == 0)
|
||||
{
|
||||
{
|
||||
if (m.get_bool(113))
|
||||
return f.error_box("La rata %d e' bloccata.", nrata);
|
||||
|
||||
const TValuta parval(game.riga(nriga));
|
||||
const TValuta curval(gm, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||
if (parval != curval)
|
||||
{
|
||||
TString c = parval.codice();
|
||||
if (c.empty()) c = "lire";
|
||||
return 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);
|
||||
}
|
||||
|
||||
#ifdef __EXTRA__
|
||||
gm._tipomov = (tipo_movimento) 3;
|
||||
gm._tipomov = tm_pagamento;
|
||||
gm._descr = "";
|
||||
gm._numdoc = "";
|
||||
gm._datadoc = TDate(TODAY);
|
||||
@ -1407,10 +1417,12 @@ void TGame_mask::fill_partite()
|
||||
|
||||
app().begin_wait();
|
||||
|
||||
for (TPartita* gioco = app().partite().first();
|
||||
gioco != NULL;
|
||||
gioco = app().partite().next())
|
||||
TPartite_array& giochi = app().partite();
|
||||
for (TPartita* gioco = giochi.first(); gioco != NULL; gioco = giochi.next())
|
||||
{
|
||||
// Visualizza solo le partite con almeno una riga! Non posso scaricarle a priori in quanto
|
||||
// potrebbero essere state cancellate proprio ora e quindi devo tenerle cosi' per aggiornare
|
||||
// correttamente gli archivi.
|
||||
if (gioco->ok())
|
||||
{
|
||||
const TBill& zio = gioco->conto();
|
||||
@ -1420,31 +1432,29 @@ void TGame_mask::fill_partite()
|
||||
}
|
||||
|
||||
TLocalisamfile partita(LF_PARTITE);
|
||||
partita.zero();
|
||||
TRectype& curpar = partita.curr();
|
||||
curpar.zero();
|
||||
if (conto().tipo() > ' ') // Ignora gruppo e conto dei clifo
|
||||
{
|
||||
partita.put(PART_TIPOCF, conto().tipo());
|
||||
partita.put(PART_SOTTOCONTO, conto().codclifo());
|
||||
curpar.put(PART_TIPOCF, conto().tipo());
|
||||
curpar.put(PART_SOTTOCONTO, conto().codclifo());
|
||||
}
|
||||
else
|
||||
conto().put(partita.curr()); // Scrive completamente i conti normali
|
||||
conto().put(curpar); // Scrive completamente i conti normali
|
||||
|
||||
const TRectype filter(partita.curr()); // Record campione
|
||||
const TRectype filter(curpar); // Record campione
|
||||
|
||||
for (int err = partita.read(_isgteq);
|
||||
err == NOERR && partita.curr() == filter;
|
||||
err == NOERR && curpar == filter;
|
||||
err = partita.read(_isgreat))
|
||||
{
|
||||
const int anno = partita.get_int(PART_ANNO);
|
||||
const TString16 num(partita.get(PART_NUMPART));
|
||||
|
||||
if (!app().partite().exist(conto(), anno, num))
|
||||
if (!giochi.exist(curpar))
|
||||
{
|
||||
TPartita game(conto(), anno, num);
|
||||
TPartita game(curpar);
|
||||
if (all || !game.chiusa())
|
||||
update_partita(game, -1);
|
||||
}
|
||||
partita.put(PART_NRIGA, 9999); // Forza lettura partita successiva nella prossima read
|
||||
curpar.put(PART_NRIGA, 9999); // Forza lettura partita successiva nella prossima read
|
||||
}
|
||||
|
||||
a.sort();
|
||||
|
@ -1,4 +1,4 @@
|
||||
PAGE "Rata pagamento" -1 -1 50 13
|
||||
PAGE "Rata pagamento" -1 -1 50 15
|
||||
|
||||
DATE 101
|
||||
BEGIN
|
||||
@ -14,12 +14,6 @@ BEGIN
|
||||
WARNING "L'importo della rata non puo' essere nullo"
|
||||
END
|
||||
|
||||
BOOLEAN 112
|
||||
BEGIN
|
||||
PROMPT 35 1 "Protetta"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER 103 15 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "Importo valuta "
|
||||
@ -140,6 +134,27 @@ BEGIN
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 1 11 "Note:"
|
||||
END
|
||||
|
||||
BOOLEAN 114
|
||||
BEGIN
|
||||
PROMPT 12 11 "Non cancellabile"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BOOLEAN 113
|
||||
BEGIN
|
||||
PROMPT 38 11 "Bloccata"
|
||||
END
|
||||
|
||||
STRING 112 50 47
|
||||
BEGIN
|
||||
PROMPT 1 12 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
|
@ -222,7 +222,9 @@ BEGIN
|
||||
ITEM "Ns.CAB"
|
||||
ITEM "Vs.ABI"
|
||||
ITEM "Vs.CAB"
|
||||
ITEM "Protetta"
|
||||
ITEM "Note@50"
|
||||
ITEM "Bloccata"
|
||||
ITEM "Non cancellabile"
|
||||
END
|
||||
|
||||
BUTTON FS_RESET 7 1
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
int conto() const { return _conto; }
|
||||
long sottoconto() const { return _sottoconto; }
|
||||
long codclifo() const { return _sottoconto; }
|
||||
long& codclifo() { return _sottoconto; }
|
||||
|
||||
bool find();
|
||||
const TString& descrizione() const;
|
||||
|
@ -360,7 +360,7 @@ void TPagamento::set_numero_rate(int n, int sscad, int rdiff)
|
||||
_dirty = TRUE;
|
||||
}
|
||||
|
||||
void TPagamento::set_cambio(const real& cambio)
|
||||
void TPagamento::set_cambio(const real& cambio, bool recalc_lit)
|
||||
{
|
||||
const int first = _tpr < 4 ? 0 : 1;
|
||||
const bool era_valuta = _cambio != 1.0;
|
||||
@ -381,9 +381,12 @@ void TPagamento::set_cambio(const real& cambio)
|
||||
{
|
||||
TToken_string& row = (TToken_string&)_rate[i];
|
||||
if (in_valuta)
|
||||
{
|
||||
imp = tpay_rata(i) * _cambio; imp.round(0);
|
||||
row.add(imp.string(), 7);
|
||||
{
|
||||
if (recalc_lit)
|
||||
{
|
||||
imp = tpay_rata(i) * _cambio; imp.round(0);
|
||||
row.add(imp.string(), 7);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -420,12 +423,12 @@ void TPagamento::set_cambio(const real& cambio)
|
||||
set_total(imponibile, imposta, spese);
|
||||
}
|
||||
}
|
||||
if (in_valuta) adjust_importo_lire();
|
||||
// if (in_valuta) adjust_importo_lire();
|
||||
}
|
||||
|
||||
void TPagamento::set_implit(const real & r)
|
||||
void TPagamento::set_totlit(const real & r)
|
||||
{
|
||||
_implit = r;
|
||||
_totlit = r;
|
||||
}
|
||||
|
||||
void TPagamento::adjust_importo_lire()
|
||||
@ -435,7 +438,7 @@ void TPagamento::adjust_importo_lire()
|
||||
real totlit;
|
||||
for (int i = 0; i < n_rate(); i++)
|
||||
totlit += tlit_rata(i);
|
||||
real residuo = _implit - totlit;
|
||||
real residuo = _totlit - totlit;
|
||||
if (!residuo.is_zero())
|
||||
{
|
||||
real rs = tlit_rata(first) + residuo;
|
||||
@ -1666,7 +1669,7 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
|
||||
if (_inited)
|
||||
{
|
||||
const bool in_valuta = _cambio != 1.0;
|
||||
if (in_valuta) adjust_importo_lire();
|
||||
// if (in_valuta) adjust_importo_lire();
|
||||
|
||||
// si istanzia uno sheet di primanota
|
||||
for (int i = 0; i < n_rate(); i++)
|
||||
@ -1691,9 +1694,6 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
|
||||
ts.add(tr, 4); // 4 - Tipo rata
|
||||
ts.add(uc, 5); // 5 - Ulteriore classificazione
|
||||
ts.add(desc_tipo(tr, uc), 6); // 6 - Descrizione tipo rata
|
||||
// 7,8,9,10 - Banche
|
||||
const bool paid = ratapagata(i);
|
||||
ts.add(paid ? "X" : "", 11); // 11 - Pagaya
|
||||
}
|
||||
|
||||
for (int d = sf.items()-1; d >= i; d--)
|
||||
|
@ -35,7 +35,7 @@ class TPagamento : public TObject
|
||||
real _imposta; // imposta da affettare
|
||||
real _spese; // spese da affettare
|
||||
real _cambio; // cambio valuta
|
||||
real _implit; // imponibile in lire
|
||||
real _totlit; // imponibile in lire
|
||||
TDistrib _slicer; // affettatrice
|
||||
bool _new; // non letto da database
|
||||
TString_array _rate; // rate medesime
|
||||
@ -141,7 +141,7 @@ public:
|
||||
void set_inizio_scadenza(char v) { _inscad = v; }
|
||||
void set_code(const char* c) { _code = c; }
|
||||
void set_round(int n) { _round = n; }
|
||||
void set_cambio(const real& ex);
|
||||
void set_cambio(const real& ex, bool recalc_lit);
|
||||
bool in_valuta() const { return _cambio != 1.0; }
|
||||
const real& cambio() const { return _cambio; }
|
||||
|
||||
@ -186,7 +186,7 @@ public:
|
||||
// setta l'importo in lire di una rata
|
||||
void set_implit(int i, const real & r);
|
||||
// setta l'imponibile in lire totale
|
||||
void set_implit(const real & r);
|
||||
void set_totlit(const real & r);
|
||||
|
||||
// slicer interface
|
||||
void set_total(const real& ib, const real& im, const real& sp);
|
||||
|
@ -664,7 +664,7 @@ int TRiga_partite::read(TBaseisamfile& f, word op)
|
||||
// Registra una riga e le sue eventuali rate
|
||||
// Certified 100%
|
||||
int TRiga_partite::write(TBaseisamfile& f) const
|
||||
{
|
||||
{
|
||||
const int err = is_fattura() ? TTree_rectype::write(f) : TRectype::write(f);
|
||||
return err;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef __SALDACON_H
|
||||
#define __SALDACON_H
|
||||
|
||||
@ -306,7 +305,6 @@ public:
|
||||
TPartita(const TRectype& part);
|
||||
};
|
||||
|
||||
|
||||
class TPartite_array : private TAssoc_array
|
||||
{
|
||||
TString80 _key; // Work string
|
||||
|
Loading…
x
Reference in New Issue
Block a user