1994-11-10 14:25:26 +00:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// Scadenzario
|
|
|
|
// fv 24/8/94
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
1997-06-20 08:52:24 +00:00
|
|
|
#include <msksheet.h>
|
|
|
|
#include "cgpagame.h"
|
|
|
|
#include "cgsaldac.h"
|
1995-03-22 09:04:45 +00:00
|
|
|
|
1994-11-10 14:25:26 +00:00
|
|
|
#include "cg2102.h"
|
|
|
|
#include "cg2100.h"
|
1995-02-28 09:17:57 +00:00
|
|
|
#include "cg21sld.h"
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-03-23 17:17:13 +00:00
|
|
|
#include <clifo.h>
|
1995-12-20 10:16:55 +00:00
|
|
|
#include <defmask.h>
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-12-07 11:09:17 +00:00
|
|
|
TPagamento& TPrimanota_application::pagamento() const
|
|
|
|
{
|
|
|
|
CHECK(_pag, "Pagamento nullo");
|
|
|
|
return *_pag;
|
|
|
|
}
|
1996-01-30 11:46:19 +00:00
|
|
|
|
1995-10-25 09:34:53 +00:00
|
|
|
bool TPrimanota_application::pag_notify(TSheet_field& ps, int r, KEY k)
|
1995-09-25 11:38:25 +00:00
|
|
|
{
|
1997-03-28 12:03:29 +00:00
|
|
|
TMask* msk = &(ps.mask());
|
|
|
|
|
|
|
|
// if (!msk->is_running()) return TRUE; // Necessario per evitare il CHECK sul pagamento nullo
|
1997-04-01 15:45:26 +00:00
|
|
|
if (!app().is_fattura() || app()._pag == NULL) return TRUE; // Necessario per evitare il CHECK sul pagamento nullo
|
1997-02-11 16:02:03 +00:00
|
|
|
|
|
|
|
TPagamento& pag = app().pagamento();
|
1995-03-22 09:04:45 +00:00
|
|
|
TString_array& rws = app().pag_rows();
|
1995-09-25 11:38:25 +00:00
|
|
|
|
1996-01-31 11:52:54 +00:00
|
|
|
const int rdiff = msk->get_int(FS_RDIFFER);
|
1995-09-25 11:38:25 +00:00
|
|
|
const bool in_valuta = pag.in_valuta();
|
2004-04-28 20:29:34 +00:00
|
|
|
// const int impos = in_valuta ? 2 : 1;
|
1994-11-10 14:25:26 +00:00
|
|
|
|
|
|
|
// ts contiene la vecchia riga, ns la nuova
|
1995-10-10 09:04:46 +00:00
|
|
|
TToken_string ts(128), ns(128);
|
1995-09-22 12:29:00 +00:00
|
|
|
TString16 banca;
|
1994-11-10 14:25:26 +00:00
|
|
|
|
2004-04-28 20:29:34 +00:00
|
|
|
bool doit = TRUE, m_impl = FALSE, m_impv = FALSE, m_perc = FALSE;
|
|
|
|
bool m_scad = FALSE, m_tipo = FALSE, m_ulc = FALSE, mod = FALSE;
|
1994-11-10 14:25:26 +00:00
|
|
|
word ahiahi = P_OK;
|
|
|
|
|
1996-02-02 11:09:18 +00:00
|
|
|
TString news(10), newl(15), newv(15), newp(15), newt(1), newu(1);
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-02-28 09:17:57 +00:00
|
|
|
bool recalc = msk->get_bool(FS_RECALC);
|
|
|
|
bool mcomm = msk->get_bool(FS_MCOMM);
|
1994-11-10 14:25:26 +00:00
|
|
|
|
|
|
|
switch (k)
|
1996-01-11 15:44:06 +00:00
|
|
|
{
|
|
|
|
case K_SPACE:
|
|
|
|
{
|
1996-01-31 11:52:54 +00:00
|
|
|
const bool can = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(13) != 'X';
|
1996-01-11 15:44:06 +00:00
|
|
|
ps.sheet_mask().enable(DLG_DELREC, can);
|
|
|
|
}
|
|
|
|
break;
|
1994-11-10 14:25:26 +00:00
|
|
|
case K_ENTER:
|
1995-03-22 09:04:45 +00:00
|
|
|
ns = ps.row(r);
|
|
|
|
ts = rws.row(r);
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-09-25 11:38:25 +00:00
|
|
|
news = ns.get(0); // Data scadenza
|
1996-02-02 11:09:18 +00:00
|
|
|
newl = ns.get(1); // Imponibile (lire)
|
|
|
|
newv = ns.get(2); // Imponibile (valuta)
|
1995-09-25 11:38:25 +00:00
|
|
|
newp = ns.get(3); // Percentuale
|
|
|
|
newt = ns.get(4); // Tipo pagamento
|
1995-11-03 08:17:08 +00:00
|
|
|
newu = ns.get(5); // Ulteriore classificazione
|
1994-11-10 14:25:26 +00:00
|
|
|
|
|
|
|
// qui viene il bello, si fa per dire
|
1995-10-10 09:04:46 +00:00
|
|
|
if (news != ts.get(0)) // modificata data scadenza
|
1995-09-25 11:38:25 +00:00
|
|
|
mod = m_scad = TRUE;
|
1996-01-15 18:56:45 +00:00
|
|
|
if (real(newp) != real(ts.get(3))) // modificata percentuale
|
1995-09-25 11:38:25 +00:00
|
|
|
mod = m_perc = TRUE;
|
1996-02-02 11:09:18 +00:00
|
|
|
if (real(newl) != real(ts.get(1))) // modificato importo lire
|
1994-11-10 14:25:26 +00:00
|
|
|
{
|
1996-02-02 11:09:18 +00:00
|
|
|
// se si modifica la percentuale nessun importo viene cagato
|
|
|
|
if ((recalc && !m_perc) || (!recalc))
|
|
|
|
mod = m_impl = TRUE;
|
|
|
|
}
|
|
|
|
if (in_valuta && real(newv) != real(ts.get(2)))
|
|
|
|
{
|
|
|
|
// se si modifica la percentuale nessun importo viene cagato
|
1995-02-28 09:17:57 +00:00
|
|
|
if ((recalc && !m_perc) || (!recalc))
|
1996-02-02 11:09:18 +00:00
|
|
|
mod = m_impv = TRUE;
|
1994-11-10 14:25:26 +00:00
|
|
|
}
|
1995-10-10 09:04:46 +00:00
|
|
|
if (newt != ts.get(4)) // modificato tipo pagamento
|
1995-11-10 13:35:00 +00:00
|
|
|
mod = m_tipo = m_ulc = TRUE;
|
1995-11-03 08:17:08 +00:00
|
|
|
|
|
|
|
if (newu != ts.get(5)) // modificata ulteriore classificazione
|
1996-01-10 11:48:09 +00:00
|
|
|
mod = m_ulc = TRUE;
|
1997-03-28 12:03:29 +00:00
|
|
|
else if (m_tipo)
|
|
|
|
{
|
1996-01-11 09:29:49 +00:00
|
|
|
// forza reset di ulc se si e' modificato il tipo rata
|
1996-01-10 11:48:09 +00:00
|
|
|
m_ulc = TRUE;
|
1996-01-15 18:56:45 +00:00
|
|
|
newu = "";
|
|
|
|
}
|
1996-01-10 11:48:09 +00:00
|
|
|
|
1994-11-10 14:25:26 +00:00
|
|
|
break;
|
1995-12-22 15:33:27 +00:00
|
|
|
case K_DEL:
|
1996-01-31 11:52:54 +00:00
|
|
|
doit = !recalc && pag.n_rate() > 1 && ps.row(r).get_char(13) != 'X';
|
1995-12-22 15:33:27 +00:00
|
|
|
if (doit)
|
|
|
|
{
|
|
|
|
pag.remove_rata(r);
|
1996-01-11 15:44:06 +00:00
|
|
|
msk->set(FS_NRATE, pag.n_rate());
|
1995-12-22 15:33:27 +00:00
|
|
|
}
|
|
|
|
break;
|
1995-11-16 09:56:22 +00:00
|
|
|
case K_INS:
|
1996-01-11 15:44:06 +00:00
|
|
|
// permette aggiunta e cancellazione solo se non c'e' ricalcolo automatico
|
1995-11-16 09:56:22 +00:00
|
|
|
doit = !recalc;
|
1996-01-11 15:44:06 +00:00
|
|
|
break;
|
|
|
|
case K_CTRL+K_INS: // Post inserimento
|
1995-12-22 15:33:27 +00:00
|
|
|
{
|
|
|
|
const int prev = r - 1;
|
1996-01-03 09:50:01 +00:00
|
|
|
const int gio_scad = pag.scad_rata(prev);
|
|
|
|
TDate data_scad(pag.data_rata(prev));
|
1995-12-22 15:33:27 +00:00
|
|
|
|
1996-01-03 09:50:01 +00:00
|
|
|
pag.add_rata(ZERO, gio_scad, pag.tipo_rata(prev), pag.ulc_rata(prev));
|
|
|
|
pag.next_scad(data_scad, gio_scad, pag.mese_commerciale(), r);
|
|
|
|
pag.set_datarata(r, data_scad);
|
1996-02-14 11:08:20 +00:00
|
|
|
// pag.adjust_fixed_scad();
|
1995-12-22 15:33:27 +00:00
|
|
|
pag.set_sheet(ps);
|
|
|
|
rws = ps.rows_array();
|
|
|
|
}
|
1994-11-10 14:25:26 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// settato da recalc_rate se occorre ridefinire lo sheet
|
|
|
|
// aggiungendo o togliendo righe
|
|
|
|
bool need_recalc = FALSE;
|
|
|
|
|
|
|
|
if (k == K_ENTER)
|
|
|
|
{
|
|
|
|
if (mod && recalc)
|
|
|
|
{
|
|
|
|
// ricalcola sheet come sai fare tu
|
1995-03-22 09:04:45 +00:00
|
|
|
ahiahi = pag.recalc_rate(r, m_perc,
|
1996-02-02 11:09:18 +00:00
|
|
|
((m_perc || m_impv) ?
|
|
|
|
(m_perc ? (const char*)newp : (const char*)newv) : NULL),
|
|
|
|
(m_impl ? (const char*)newl : NULL),
|
1995-03-22 09:04:45 +00:00
|
|
|
(m_scad ? (const char*)news : NULL),
|
1995-11-03 08:17:08 +00:00
|
|
|
(m_tipo ? (const char*)newt : NULL),
|
|
|
|
(m_ulc ? (const char*)newu : NULL),
|
1996-02-02 11:09:18 +00:00
|
|
|
rdiff, mcomm, need_recalc);
|
|
|
|
|
1994-11-10 14:25:26 +00:00
|
|
|
// see if rdiff changed
|
1995-06-21 15:33:31 +00:00
|
|
|
msk->set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
|
1995-09-22 12:29:00 +00:00
|
|
|
msk->set(FS_NRATE, pag.n_rate());
|
1996-01-15 18:56:45 +00:00
|
|
|
}
|
1994-11-10 14:25:26 +00:00
|
|
|
if (!recalc)
|
|
|
|
{
|
|
|
|
ahiahi = P_OK;
|
|
|
|
// put data as they are
|
1995-03-22 09:04:45 +00:00
|
|
|
TToken_string& trw = pag.rata(r);
|
1997-03-28 12:03:29 +00:00
|
|
|
TToken_string& trs = ps.row(r);
|
|
|
|
if (m_tipo)
|
|
|
|
trw.add(newt,2);
|
1996-01-29 13:32:37 +00:00
|
|
|
if (m_ulc)
|
|
|
|
trw.add(newu, 5);
|
1996-01-15 11:22:37 +00:00
|
|
|
if (m_scad)
|
|
|
|
{
|
|
|
|
trw.add(news,3);
|
|
|
|
if (r > 0)
|
|
|
|
{
|
|
|
|
TDate d(news);
|
|
|
|
int scd = (int)(d - pag.data_rata(r-1));
|
|
|
|
if (pag.mese_commerciale() && (scd % 30) != 0)
|
1999-10-22 10:00:18 +00:00
|
|
|
scd = 30 * ((scd/30)+1);
|
1996-01-15 11:22:37 +00:00
|
|
|
trw.add(scd, 0);
|
1997-03-28 12:03:29 +00:00
|
|
|
}
|
|
|
|
trs.add(news, 0);
|
1996-01-15 11:22:37 +00:00
|
|
|
}
|
1996-02-02 11:09:18 +00:00
|
|
|
if (m_impl)
|
1995-10-25 09:34:53 +00:00
|
|
|
{
|
1996-02-02 11:09:18 +00:00
|
|
|
trw.add(newl,7);
|
1996-02-14 10:41:16 +00:00
|
|
|
if (!in_valuta)
|
|
|
|
{
|
|
|
|
// si ricalcola la percentuale a modifica importo in lire solo
|
|
|
|
// se non c'e' l'importo in valuta
|
|
|
|
const real p = pag.recalc_percrata(r, FALSE);
|
1997-03-28 12:03:29 +00:00
|
|
|
trs.add(p.string(), 3);
|
1996-02-14 10:41:16 +00:00
|
|
|
}
|
1996-02-02 11:09:18 +00:00
|
|
|
}
|
|
|
|
if (m_impv)
|
|
|
|
{
|
|
|
|
trw.add(newv,4);
|
|
|
|
const real p = pag.recalc_percrata(r, TRUE);
|
1997-03-28 12:03:29 +00:00
|
|
|
trs.add(p.string(), 3);
|
1996-01-29 13:32:37 +00:00
|
|
|
}
|
1996-01-11 09:29:49 +00:00
|
|
|
if (mod)
|
1997-03-28 12:03:29 +00:00
|
|
|
{
|
|
|
|
rws.row(r) = trs;
|
|
|
|
ps.force_update(r);
|
|
|
|
}
|
1996-01-15 18:56:45 +00:00
|
|
|
}
|
|
|
|
|
1995-03-22 09:04:45 +00:00
|
|
|
if (ahiahi) // any error? Rimetti le righe com'erano prima
|
1995-10-25 09:34:53 +00:00
|
|
|
{
|
|
|
|
if (recalc)
|
1995-11-16 09:56:22 +00:00
|
|
|
{
|
|
|
|
TString err(80); pag.strerr(ahiahi,err);
|
|
|
|
warning_box(err);
|
1995-10-25 09:34:53 +00:00
|
|
|
ps.row(r) = rws.row(r);
|
|
|
|
ps.force_update(r);
|
|
|
|
}
|
1994-11-10 14:25:26 +00:00
|
|
|
}
|
1995-03-22 09:04:45 +00:00
|
|
|
else if (recalc && mod && need_recalc)
|
|
|
|
{
|
|
|
|
// ridefinisci lo sheet sulla base delle nuove rate
|
|
|
|
pag.set_sheet(ps);
|
|
|
|
rws = ps.rows_array();
|
|
|
|
}
|
1994-11-10 14:25:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return doit;
|
|
|
|
}
|
|
|
|
|
1995-10-25 09:34:53 +00:00
|
|
|
bool TPrimanota_application::pag_sheet_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
|
|
|
bool ok = TRUE;
|
|
|
|
if (key == K_TAB || key == K_ENTER)
|
|
|
|
{
|
1996-01-03 12:10:02 +00:00
|
|
|
TMask& m = f.mask();
|
|
|
|
|
1995-12-07 11:09:17 +00:00
|
|
|
TPagamento& pag = app().pagamento();
|
1996-01-09 18:51:47 +00:00
|
|
|
const TDate dt(m.get(F_DATADOC));
|
|
|
|
|
|
|
|
pag.set_datadoc(dt);
|
1996-01-03 12:10:02 +00:00
|
|
|
word err = pag.validate();
|
|
|
|
if (m.edit_mode())
|
1996-02-02 11:09:18 +00:00
|
|
|
err &= ~(P_RSUM | P_TOTNCLIT | P_TOTNCVAL ); // Ignora totale importi e rate
|
1995-12-07 11:09:17 +00:00
|
|
|
if (err != P_OK)
|
1995-10-25 09:34:53 +00:00
|
|
|
{
|
1995-12-07 11:09:17 +00:00
|
|
|
TString s(256);
|
|
|
|
pag.strerr(err, s);
|
1996-02-06 12:09:20 +00:00
|
|
|
return f.error_box(s);
|
1995-10-25 09:34:53 +00:00
|
|
|
}
|
1995-12-23 09:41:46 +00:00
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
const TString& codval = m.get(SK_VALUTA);
|
|
|
|
const bool in_valuta = pag.in_valuta();
|
1996-01-15 18:56:45 +00:00
|
|
|
real imp;
|
|
|
|
|
2003-10-23 14:50:38 +00:00
|
|
|
if (key == K_ENTER)
|
1995-12-23 09:41:46 +00:00
|
|
|
{
|
2004-04-28 20:29:34 +00:00
|
|
|
real tot = m.get_real(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
|
1995-12-23 09:41:46 +00:00
|
|
|
for (int r = pag.n_rate()-1; r >= 0; r--)
|
1996-02-06 09:55:56 +00:00
|
|
|
imp += in_valuta ? pag.tval_rata(r) : pag.tlit_rata(r);
|
|
|
|
|
|
|
|
imp.round(pag.round(in_valuta));
|
|
|
|
tot.round(pag.round(in_valuta));
|
|
|
|
|
1995-12-23 09:41:46 +00:00
|
|
|
if (imp != tot)
|
|
|
|
{
|
2003-04-14 07:42:12 +00:00
|
|
|
TCurrency curr(imp, in_valuta ? (const char*)codval : "");
|
1999-04-06 15:34:39 +00:00
|
|
|
const TString is = curr.string(TRUE);
|
|
|
|
curr.set_num(tot);
|
|
|
|
const TString ts = curr.string(TRUE);
|
2003-04-14 07:42:12 +00:00
|
|
|
ok = yesno_box(FR("Il totale delle rate e' %s mentre\n"
|
1996-02-05 08:27:17 +00:00
|
|
|
"il totale del documento e' %s.\n"
|
2003-04-14 07:42:12 +00:00
|
|
|
"Si desidera registrare ugualmente?"),
|
1996-02-05 08:27:17 +00:00
|
|
|
(const char*)is, (const char*)ts);
|
1995-12-23 09:41:46 +00:00
|
|
|
}
|
1996-01-15 18:56:45 +00:00
|
|
|
}
|
1996-01-03 12:10:02 +00:00
|
|
|
|
1996-01-15 18:56:45 +00:00
|
|
|
if (key == K_ENTER && in_valuta)
|
|
|
|
{
|
2004-04-28 20:29:34 +00:00
|
|
|
const real totlit = m.get_real(F_TOTALE);
|
1996-01-15 18:56:45 +00:00
|
|
|
imp = ZERO;
|
|
|
|
for (int r = pag.n_rate()-1; r >= 0; r--)
|
1996-02-06 09:55:56 +00:00
|
|
|
imp += pag.tlit_rata(r);
|
|
|
|
|
|
|
|
imp.round(pag.round(FALSE));
|
|
|
|
|
1996-01-15 18:56:45 +00:00
|
|
|
if (imp != totlit)
|
1999-04-06 15:34:39 +00:00
|
|
|
{
|
2003-04-14 07:42:12 +00:00
|
|
|
TCurrency curr(imp);
|
1999-04-06 15:34:39 +00:00
|
|
|
const TString is = curr.string(TRUE);
|
|
|
|
curr.set_num(totlit);
|
|
|
|
const TString ts = curr.string(TRUE);
|
1999-07-16 14:59:11 +00:00
|
|
|
const TRectype & rec = cache().get("%VAL", TCurrency::get_firm_val());
|
2003-04-14 07:42:12 +00:00
|
|
|
const char * name = (const char *) rec.get("S0");
|
1999-07-16 14:59:11 +00:00
|
|
|
|
2003-04-14 07:42:12 +00:00
|
|
|
ok = yesno_box(FR("Il totale in %s delle rate e' %s mentre\n"
|
1996-02-13 16:35:59 +00:00
|
|
|
"il totale del documento e' %s.\n"
|
2003-04-14 07:42:12 +00:00
|
|
|
"Si desidera registrare ugualmente?"),
|
1999-07-16 14:59:11 +00:00
|
|
|
name, (const char*)is, (const char*)ts);
|
1996-01-03 12:10:02 +00:00
|
|
|
}
|
1995-12-23 09:41:46 +00:00
|
|
|
}
|
1995-10-25 09:34:53 +00:00
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
1995-12-20 16:16:14 +00:00
|
|
|
bool TPrimanota_application::tipopag_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
|
|
|
if ((key == K_TAB || key == K_ENTER) && f.dirty())
|
|
|
|
{
|
|
|
|
TMask& m = f.mask();
|
1996-01-12 11:28:43 +00:00
|
|
|
int t = m.get_int(105);
|
|
|
|
if (t <= 0)
|
|
|
|
{
|
|
|
|
t = 1;
|
|
|
|
f.set("1");
|
|
|
|
}
|
1995-12-20 16:16:14 +00:00
|
|
|
const char u = m.get(106)[0];
|
1996-01-12 11:28:43 +00:00
|
|
|
const TPagamento& pag = app().pagamento();
|
|
|
|
bool ok;
|
|
|
|
const char* s = pag.desc_tipo(t, u, &ok);
|
|
|
|
if (!ok) m.reset(106);
|
1995-12-20 16:16:14 +00:00
|
|
|
m.set(107, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
1995-10-25 09:34:53 +00:00
|
|
|
|
1995-02-28 09:17:57 +00:00
|
|
|
bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
|
1996-01-25 17:20:49 +00:00
|
|
|
{
|
2003-10-17 08:28:05 +00:00
|
|
|
bool ok = true;
|
1995-03-22 09:04:45 +00:00
|
|
|
|
1996-02-05 08:27:17 +00:00
|
|
|
TMask& m = f.mask();
|
|
|
|
TPrimanota_application& a = app();
|
|
|
|
const bool set_scad = a.is_fattura() && m.page_enabled(2); // E' attiva pagina 3
|
1996-01-09 10:32:00 +00:00
|
|
|
if (key == K_ENTER)
|
|
|
|
{
|
2003-10-17 08:28:05 +00:00
|
|
|
if (set_scad && f.empty())
|
1995-12-19 15:53:50 +00:00
|
|
|
{
|
2003-10-17 08:28:05 +00:00
|
|
|
ok = f.error_box(TR("Il codice di pagamento e' obbligatorio!"));
|
2002-02-26 16:20:19 +00:00
|
|
|
|
2003-10-17 08:28:05 +00:00
|
|
|
// Nella maschera iva cerco di reperirlo dal cliente
|
|
|
|
if (m.id2pos(F_CLIENTE) > 0)
|
1996-01-04 14:51:26 +00:00
|
|
|
{
|
2003-10-17 08:28:05 +00:00
|
|
|
const char typ = a.clifo();
|
|
|
|
const long cod = m.get_long(typ == 'C' ? F_CLIENTE : F_FORNITORE);
|
|
|
|
TLocalisamfile clifo(LF_CLIFO);
|
|
|
|
clifo.put(CLI_TIPOCF, typ);
|
|
|
|
clifo.put(CLI_CODCF, cod);
|
|
|
|
if (clifo.read() == NOERR)
|
1996-01-09 10:32:00 +00:00
|
|
|
{
|
2003-10-17 08:28:05 +00:00
|
|
|
const TString& cp = clifo.get(CLI_CODPAG);
|
|
|
|
if (cp.not_empty())
|
|
|
|
{
|
|
|
|
f.set(cp);
|
|
|
|
key = K_TAB;
|
|
|
|
}
|
|
|
|
}
|
1996-01-09 10:32:00 +00:00
|
|
|
}
|
1996-01-04 14:51:26 +00:00
|
|
|
}
|
1995-12-19 15:53:50 +00:00
|
|
|
}
|
|
|
|
|
1996-01-25 17:20:49 +00:00
|
|
|
if (key == K_TAB && f.focusdirty() && m.insert_mode() && set_scad)
|
1996-02-05 08:27:17 +00:00
|
|
|
a.set_scadenze(m);
|
1996-01-09 10:32:00 +00:00
|
|
|
|
1996-01-25 17:20:49 +00:00
|
|
|
return ok;
|
1995-02-28 09:17:57 +00:00
|
|
|
}
|
1995-08-24 07:27:50 +00:00
|
|
|
|
1995-12-18 10:56:53 +00:00
|
|
|
bool TPrimanota_application::annorif_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
|
|
|
bool ok = TRUE;
|
1996-05-07 14:10:16 +00:00
|
|
|
if (f.to_check(key))
|
1996-02-05 11:29:29 +00:00
|
|
|
{
|
|
|
|
const TMask& m = f.mask();
|
2003-10-01 14:22:06 +00:00
|
|
|
if (f.empty() && !m.get(F_NUMRIF).blank())
|
1996-02-05 11:29:29 +00:00
|
|
|
{
|
|
|
|
const TString& anno = m.get(F_DATADOC).right(4);
|
|
|
|
f.set(anno);
|
2003-04-14 07:42:12 +00:00
|
|
|
ok = error_box(TR("L'anno di riferimento partita e' obbligatorio!"));
|
1996-02-05 11:29:29 +00:00
|
|
|
}
|
1995-12-18 10:56:53 +00:00
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
1995-11-14 15:58:25 +00:00
|
|
|
bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
|
|
|
bool ok = TRUE;
|
1996-01-03 12:10:02 +00:00
|
|
|
|
|
|
|
if (f.to_check(key, TRUE))
|
1995-12-04 11:04:35 +00:00
|
|
|
{
|
1996-02-05 08:27:17 +00:00
|
|
|
TPrimanota_application& a = app();
|
1995-12-04 11:04:35 +00:00
|
|
|
TMask& m = f.mask();
|
2003-10-01 14:22:06 +00:00
|
|
|
const bool moviva = a.iva() != nessuna_iva; // Maschera IVA?
|
1996-02-05 11:29:29 +00:00
|
|
|
|
1996-02-16 09:51:28 +00:00
|
|
|
bool required = m.insert_mode() && a.is_fattura();
|
|
|
|
required &= key == K_ENTER || f.focusdirty();
|
2003-10-01 14:22:06 +00:00
|
|
|
if (moviva)
|
|
|
|
required &= !(m.get_bool(F_SOLAIVA) || m.field(F_OCCASEDIT).active());
|
1996-02-05 08:27:17 +00:00
|
|
|
|
1996-02-05 11:29:29 +00:00
|
|
|
if (required && f.get().blank())
|
1995-12-04 11:04:35 +00:00
|
|
|
{
|
2003-10-01 14:22:06 +00:00
|
|
|
if (moviva && m.field(F_CODPAG).empty())
|
1995-12-04 11:04:35 +00:00
|
|
|
{
|
1996-02-05 08:27:17 +00:00
|
|
|
TMask_field& clifo = m.field(a.iva() == iva_vendite ? F_CLIENTE : F_FORNITORE);
|
|
|
|
clifo.set_dirty();
|
1995-12-04 11:04:35 +00:00
|
|
|
clifo.on_hit();
|
|
|
|
}
|
1996-02-05 08:27:17 +00:00
|
|
|
|
2004-04-28 20:29:34 +00:00
|
|
|
// TMask_field& anno = m.field(F_ANNORIF);
|
1996-02-16 09:51:28 +00:00
|
|
|
if (m.get(F_ANNORIF).empty())
|
|
|
|
m.set(F_ANNORIF, m.get(F_DATADOC).right(4));
|
|
|
|
|
|
|
|
f.set(m.get(a._npart_is_prot ? F_PROTIVA : F_NUMDOC));
|
|
|
|
key = K_TAB; // Forza la successiva activate_numrif
|
1996-02-05 08:27:17 +00:00
|
|
|
|
2003-04-14 07:42:12 +00:00
|
|
|
ok = f.error_box(TR("Il numero di riferimento partita e' obbligatorio!"));
|
1995-12-04 11:04:35 +00:00
|
|
|
}
|
1996-02-05 08:27:17 +00:00
|
|
|
|
|
|
|
if (key == K_TAB && a.is_fattura())
|
1996-12-10 08:23:20 +00:00
|
|
|
a.activate_numrif(m, TRUE);
|
1996-01-03 12:10:02 +00:00
|
|
|
|
1996-02-05 08:27:17 +00:00
|
|
|
if (ok && key == K_ENTER && m.edit_mode())
|
1995-12-29 11:55:59 +00:00
|
|
|
{
|
1996-02-05 08:27:17 +00:00
|
|
|
const TPartita* old = a.partite().first();
|
|
|
|
if (old && old->ok() && f.get().blank()) // Se esisteva una partita ma ora non piu'
|
1995-12-29 11:55:59 +00:00
|
|
|
{
|
2003-04-14 07:42:12 +00:00
|
|
|
const KEY k = yesnocancel_box(FR("Attenzione la fattura della partita %d %s verra' eliminata.\n"
|
|
|
|
"Premere SI per cancellarla, NO per ripristinarla, ANNULLA per modificarla"),
|
1995-12-29 11:55:59 +00:00
|
|
|
old->anno(), (const char*)old->numero());
|
|
|
|
switch (k)
|
|
|
|
{
|
|
|
|
case K_NO:
|
|
|
|
f.set(old->numero());
|
|
|
|
if (m.get(F_ANNORIF).empty())
|
|
|
|
m.set(F_ANNORIF, old->anno());
|
|
|
|
break;
|
|
|
|
case K_ESC:
|
|
|
|
ok = FALSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1995-11-14 15:58:25 +00:00
|
|
|
}
|
1995-12-29 11:55:59 +00:00
|
|
|
}
|
1995-11-14 15:58:25 +00:00
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
1995-12-20 16:16:14 +00:00
|
|
|
bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1996-01-04 14:51:26 +00:00
|
|
|
if (key == K_TAB && f.to_check(key, TRUE))
|
1995-12-20 16:16:14 +00:00
|
|
|
{
|
|
|
|
TMask& m = f.mask();
|
2001-05-01 08:17:07 +00:00
|
|
|
const TString& val = f.get();
|
|
|
|
const bool full = val.not_empty() && val != TCurrency::get_firm_val();
|
1996-01-19 13:09:12 +00:00
|
|
|
|
1996-01-23 15:37:14 +00:00
|
|
|
if (full)
|
|
|
|
{
|
1999-04-26 15:58:05 +00:00
|
|
|
TEdit_field& dc = m.efield(SK_DATACAMBIO);
|
1996-01-23 15:37:14 +00:00
|
|
|
if (dc.get().empty()) // Inizializza data cambio se assente
|
1996-01-31 11:52:54 +00:00
|
|
|
dc.set(m.get(F_DATADOC));
|
1999-07-16 14:59:11 +00:00
|
|
|
|
1996-01-31 11:52:54 +00:00
|
|
|
if (f.focusdirty())
|
1996-01-23 15:37:14 +00:00
|
|
|
{
|
|
|
|
dc.set_dirty();
|
|
|
|
dc.check(RUNNING_CHECK); // Forza ricerca cambio
|
|
|
|
dc.on_hit(); // Forza messaggi (eventuale copia a pag. 3)
|
1999-04-26 15:58:05 +00:00
|
|
|
if (m.get(SK_CAMBIO).empty())
|
|
|
|
{
|
|
|
|
TCursor& cur = *dc.browse()->cursor();
|
|
|
|
if (cur.items() == 0) // Uso cambio standard
|
|
|
|
{
|
2001-05-01 08:17:07 +00:00
|
|
|
const TRectype& recval = cache().get("%VAL", val);
|
|
|
|
dc.set(recval.get("D0"));
|
|
|
|
m.enable(SK_CAMBIO); // Abilito per far funzionare la prossima riga
|
|
|
|
m.set(SK_CAMBIO, recval.get("S4"), TRUE);
|
1999-04-26 15:58:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-18 15:35:05 +00:00
|
|
|
if (m.id2pos(F_VALUTAINTRA) >= 0)
|
|
|
|
{
|
|
|
|
TEdit_field& vi = m.efield(F_VALUTAINTRA);
|
|
|
|
if (vi.active() && vi.empty())
|
|
|
|
{
|
|
|
|
m.set(F_VALUTAINTRA, val);
|
|
|
|
m.set(F_CAMBIOINTRA, m.get(SK_CAMBIO), TRUE);
|
|
|
|
}
|
1999-04-26 15:58:05 +00:00
|
|
|
}
|
1996-01-23 15:37:14 +00:00
|
|
|
}
|
1996-01-19 13:09:12 +00:00
|
|
|
}
|
1996-01-23 15:37:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m.set(SK_CAMBIO, "", TRUE);
|
|
|
|
m.set(SK_TOTDOCVAL, "", TRUE);
|
1999-07-16 14:59:11 +00:00
|
|
|
if (m.id2pos(SK_CONTROEURO) >= 0)
|
|
|
|
m.set(SK_CONTROEURO, "", TRUE);
|
1996-01-23 15:37:14 +00:00
|
|
|
}
|
|
|
|
m.enable(SK_CAMBIO, full);
|
|
|
|
m.enable(SK_TOTDOCVAL, full);
|
1996-01-04 14:51:26 +00:00
|
|
|
|
|
|
|
if (app().is_fattura())
|
1996-01-19 13:09:12 +00:00
|
|
|
m.set(FS_VALUTA, val); // Copia a pagina 3
|
1996-01-04 14:51:26 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TPrimanota_application::datacambio_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1996-01-12 17:43:52 +00:00
|
|
|
if (key == K_TAB && f.to_check(key, TRUE))
|
|
|
|
{
|
|
|
|
if (app().is_fattura())
|
|
|
|
f.mask().set(FS_DATACAMBIO, f.get()); // Copia a pagina 3
|
1999-04-06 15:34:39 +00:00
|
|
|
::handler_data_cambio(f, key);
|
1995-12-20 16:16:14 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1995-09-25 11:38:25 +00:00
|
|
|
bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1996-01-31 11:52:54 +00:00
|
|
|
if (key == K_TAB && f.to_check(key, TRUE))
|
1996-01-12 17:43:52 +00:00
|
|
|
{
|
1996-01-05 15:17:50 +00:00
|
|
|
TMask& m = f.mask();
|
1996-01-29 08:11:28 +00:00
|
|
|
TPrimanota_application& a = app();
|
1996-01-12 17:43:52 +00:00
|
|
|
|
1996-02-08 15:46:39 +00:00
|
|
|
bool update = a.is_fattura(); // Devo ricopiarmi a pagina 3?
|
1996-01-12 17:43:52 +00:00
|
|
|
if (f.focusdirty())
|
1996-01-29 08:11:28 +00:00
|
|
|
{
|
|
|
|
// Forza il ricalcolo del totale in lire se necessario
|
|
|
|
a.gioca_cambi(m.insert_mode() ? 0x1 : 0x0);
|
1996-01-12 17:43:52 +00:00
|
|
|
}
|
|
|
|
else
|
1996-02-08 15:46:39 +00:00
|
|
|
update &= !m.is_running();
|
1996-01-12 17:43:52 +00:00
|
|
|
|
|
|
|
if (update)
|
|
|
|
m.set(FS_CAMBIO, f.get()); // Copia a pagina 3
|
1995-09-25 11:38:25 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1995-08-24 07:27:50 +00:00
|
|
|
bool TPrimanota_application::reset_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1995-11-23 14:20:03 +00:00
|
|
|
if (key == K_SPACE)
|
|
|
|
{
|
|
|
|
TMask& m = f.mask();
|
1996-01-30 11:46:19 +00:00
|
|
|
app().reset_pagamento();
|
1995-08-24 07:27:50 +00:00
|
|
|
app().set_scadenze(m);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1995-10-25 09:34:53 +00:00
|
|
|
bool TPrimanota_application::recalc_handler(TMask_field& f, KEY key)
|
1996-05-15 10:22:59 +00:00
|
|
|
{
|
|
|
|
TPrimanota_application& a = app();
|
|
|
|
if (key == K_SPACE && a.is_fattura())
|
1995-10-25 09:34:53 +00:00
|
|
|
{
|
1996-01-30 11:46:19 +00:00
|
|
|
TMask& m = f.mask();
|
1995-10-25 09:34:53 +00:00
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
1996-05-15 10:22:59 +00:00
|
|
|
TPagamento& pag = a.pagamento();
|
1996-01-30 11:46:19 +00:00
|
|
|
|
|
|
|
const bool recalc_aut = f.get().not_empty();
|
|
|
|
|
|
|
|
if (!recalc_aut && pag.tipo_prima_rata() > 3)
|
|
|
|
{
|
|
|
|
// SE CAMBIANO I SIGNIFICATI DEL TIPO PRIMA RATA BISOGNA RIFARE TUTTO
|
|
|
|
pag.set_tipo_prima_rata(pag.tipo_prima_rata() - 3);
|
|
|
|
m.set(FS_TIPOPR, pag.desc_tpr());
|
|
|
|
pag.set_tpr4(TRUE);
|
|
|
|
}
|
|
|
|
else if (recalc_aut && pag.was_tpr4())
|
|
|
|
{
|
|
|
|
// SE CAMBIANO I SIGNIFICATI DEL TIPO PRIMA RATA BISOGNA RIFARE TUTTO
|
|
|
|
pag.set_tpr4(FALSE);
|
1996-02-02 11:09:18 +00:00
|
|
|
bool yak = pag.tlit_rata(0) != pag.importo_da_non_dividere(FALSE);
|
|
|
|
if (pag.in_valuta()) yak |= (pag.tval_rata(0) != pag.importo_da_non_dividere(TRUE));
|
1996-01-30 11:46:19 +00:00
|
|
|
if (yak)
|
|
|
|
{
|
2003-04-14 07:42:12 +00:00
|
|
|
if (yesno_box(TR("L'importo della prima rata e' stato modificato. "
|
1996-01-30 11:46:19 +00:00
|
|
|
"Con il ricalcolo automatico esso non sara' piu'"
|
|
|
|
" modificabile. Si desidera "
|
2003-04-14 07:42:12 +00:00
|
|
|
"riportare le rate alle condizioni iniziali?")))
|
1996-01-30 11:46:19 +00:00
|
|
|
{
|
|
|
|
pag.set_tipo_prima_rata(pag.tipo_prima_rata() + 3);
|
|
|
|
m.set(FS_TIPOPR, pag.desc_tpr());
|
1996-05-15 10:22:59 +00:00
|
|
|
a.reset_pagamento();
|
|
|
|
a.set_scadenze(m);
|
1996-01-30 11:46:19 +00:00
|
|
|
}
|
2003-04-14 07:42:12 +00:00
|
|
|
else warning_box(FR("Il tipo prima rata e' stato modificato in \"%s\" per "
|
1996-02-14 10:41:16 +00:00
|
|
|
"poter mantenere la rateazione scelta e la possibilita' di "
|
2003-04-14 07:42:12 +00:00
|
|
|
"ricalcolo automatico"),
|
1996-01-30 11:46:19 +00:00
|
|
|
pag.desc_tpr());
|
1996-02-08 09:12:02 +00:00
|
|
|
}
|
1996-01-30 11:46:19 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pag.set_tipo_prima_rata(pag.tipo_prima_rata() + 3);
|
|
|
|
m.set(FS_TIPOPR, pag.desc_tpr());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1996-01-22 10:10:43 +00:00
|
|
|
const bool on = pag.tipo_prima_rata() < 4 || !recalc_aut;
|
|
|
|
ps.enable_cell(0, 1, on);
|
|
|
|
ps.enable_cell(0, 2, on);
|
|
|
|
ps.enable_cell(0, 3, on);
|
1996-07-31 15:06:29 +00:00
|
|
|
|
|
|
|
ps.enable_column(3, recalc_aut);
|
|
|
|
ps.sheet_mask().enable(DLG_DELREC, !recalc_aut);
|
1995-10-25 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1995-09-11 10:53:00 +00:00
|
|
|
bool TPrimanota_application::nrate_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1995-11-03 08:17:08 +00:00
|
|
|
if (key == K_TAB && f.focusdirty())
|
1995-09-11 10:53:00 +00:00
|
|
|
{
|
1995-12-07 11:09:17 +00:00
|
|
|
TPagamento& pag = app().pagamento();
|
|
|
|
pag.set_numero_rate(atoi(f.get()));
|
|
|
|
if (pag.dirty())
|
1995-09-11 10:53:00 +00:00
|
|
|
{
|
1995-11-03 08:17:08 +00:00
|
|
|
TMask& m = f.mask();
|
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
1999-04-26 15:58:05 +00:00
|
|
|
pag.set_sheet(ps);
|
|
|
|
app().set_banche(m);
|
1995-11-03 08:17:08 +00:00
|
|
|
app().pag_rows() = ps.rows_array();
|
1996-01-16 11:01:04 +00:00
|
|
|
}
|
2003-10-01 14:22:06 +00:00
|
|
|
TString8 r; r.format("%d", pag.n_rate());
|
|
|
|
f.set(r);
|
1995-09-11 10:53:00 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1995-09-22 12:29:00 +00:00
|
|
|
bool TPrimanota_application::codcab_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
|
|
|
if (key == K_TAB && f.focusdirty())
|
|
|
|
{
|
|
|
|
const TMask& m = f.mask();
|
|
|
|
const short id = f.dlg() == FS_NSCAB ? FS_NSABI : FS_VSABI;
|
1995-11-03 08:17:08 +00:00
|
|
|
const int pos = id == FS_NSABI ? 7 : 9; // Posizione codici ABI sullo sheet
|
1995-09-22 12:29:00 +00:00
|
|
|
const TString16 abi = m.get(id);
|
|
|
|
const TString16 cab = m.get(id+1);
|
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
1995-11-03 08:17:08 +00:00
|
|
|
for (int i = ps.items()-1; i >= 0; i--) // Setta la banca in tutte le righe
|
1995-09-22 12:29:00 +00:00
|
|
|
{
|
|
|
|
TToken_string& row = ps.row(i);
|
|
|
|
row.add(abi, pos);
|
|
|
|
row.add(cab, pos+1);
|
|
|
|
}
|
|
|
|
ps.force_update();
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
1995-08-24 07:27:50 +00:00
|
|
|
|
1995-12-29 10:45:09 +00:00
|
|
|
bool TPrimanota_application::ratalit_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1997-02-11 16:02:03 +00:00
|
|
|
TMask& m = app().curr_mask();
|
|
|
|
if (key == K_F8 || (key == K_TAB && f.get().empty() && m.is_running()))
|
1995-12-29 10:45:09 +00:00
|
|
|
{
|
1996-02-07 11:51:14 +00:00
|
|
|
const TPagamento& pag = app().pagamento();
|
1995-12-29 10:45:09 +00:00
|
|
|
if (pag.in_valuta())
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
const TValuta v(m, FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO, SK_CONTROEURO);
|
1995-12-29 10:45:09 +00:00
|
|
|
const real other(f.mask().get(103));
|
1996-02-07 11:51:14 +00:00
|
|
|
const char* s = v.val2lit(other).string();
|
1996-01-16 08:16:13 +00:00
|
|
|
f.set(s);
|
|
|
|
}
|
1995-12-29 10:45:09 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TPrimanota_application::rataval_handler(TMask_field& f, KEY key)
|
|
|
|
{
|
1996-01-03 09:50:01 +00:00
|
|
|
if (key == K_F8 || (key == K_TAB && f.get().empty()))
|
1995-12-29 10:45:09 +00:00
|
|
|
{
|
|
|
|
TPagamento& pag = app().pagamento();
|
|
|
|
if (pag.in_valuta())
|
1996-01-15 18:56:45 +00:00
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
const TValuta v(app().curr_mask(), FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO, SK_CONTROEURO);
|
1995-12-29 10:45:09 +00:00
|
|
|
const real other(f.mask().get(102));
|
1999-04-06 15:34:39 +00:00
|
|
|
TString80 s(v.lit2val(other).string());
|
1995-12-29 10:45:09 +00:00
|
|
|
f.set(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1996-01-30 11:46:19 +00:00
|
|
|
void TPrimanota_application::reset_pagamento()
|
1995-11-14 10:27:10 +00:00
|
|
|
{
|
1995-12-07 11:09:17 +00:00
|
|
|
TPagamento& pag = pagamento();
|
|
|
|
pag.read();
|
|
|
|
pag.set_rate_auto();
|
1995-08-24 07:27:50 +00:00
|
|
|
}
|
|
|
|
|
1995-10-31 11:37:09 +00:00
|
|
|
void TPrimanota_application::recalc_scadenze(const TDate& d)
|
|
|
|
{
|
1995-12-07 11:09:17 +00:00
|
|
|
TPagamento& pag = pagamento();
|
|
|
|
pag.set_inizio(d);
|
1995-11-23 14:20:03 +00:00
|
|
|
// ridefinisci lo sheet sulla base delle nuove rate
|
|
|
|
TSheet_field& ps = pags();
|
|
|
|
TString_array& rws = pag_rows();
|
1995-10-31 11:37:09 +00:00
|
|
|
|
1995-12-07 11:09:17 +00:00
|
|
|
pag.set_sheet(ps);
|
1995-11-23 14:20:03 +00:00
|
|
|
rws = ps.rows_array();
|
1995-10-31 11:37:09 +00:00
|
|
|
}
|
1995-02-28 09:17:57 +00:00
|
|
|
|
|
|
|
void TPrimanota_application::set_pagamento(const char* c, const char* d)
|
|
|
|
{
|
1995-12-04 11:04:35 +00:00
|
|
|
if (_pag != NULL)
|
|
|
|
{
|
|
|
|
delete _pag;
|
|
|
|
_pag = NULL;
|
|
|
|
}
|
|
|
|
if (c != NULL || d != NULL)
|
1996-02-23 11:37:28 +00:00
|
|
|
{
|
|
|
|
if (!TDate::isdate(d))
|
|
|
|
d = "";
|
1995-12-04 11:04:35 +00:00
|
|
|
_pag = new TPagamento(c, d);
|
1996-02-23 11:37:28 +00:00
|
|
|
}
|
1995-02-28 09:17:57 +00:00
|
|
|
}
|
|
|
|
|
1996-02-13 16:35:59 +00:00
|
|
|
void TPrimanota_application::set_totale_pagamento(bool update)
|
1996-01-09 10:32:00 +00:00
|
|
|
{
|
|
|
|
const TMask& m = curr_mask();
|
1995-12-23 09:41:46 +00:00
|
|
|
TPagamento& pag = pagamento();
|
1996-01-05 15:17:50 +00:00
|
|
|
|
2003-10-01 14:22:06 +00:00
|
|
|
const real imposta = m.id2pos(F_IMPOSTE) >= 0 ? m.get_real(F_IMPOSTE) : ZERO;
|
1996-02-07 11:51:14 +00:00
|
|
|
const real imponibile = m.get_real(F_TOTALE) - imposta;
|
|
|
|
const real spese = ZERO;
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
1996-02-07 11:51:14 +00:00
|
|
|
if (cambio.in_valuta())
|
|
|
|
{
|
1996-02-08 09:12:02 +00:00
|
|
|
const real imposval = cambio.lit2val(imposta);
|
1996-02-07 11:51:14 +00:00
|
|
|
const real imponval = m.get_real(SK_TOTDOCVAL) - imposval;
|
|
|
|
pag.set_total_valuta(imponval, imposval, spese, cambio.cambio(),
|
1999-04-06 15:34:39 +00:00
|
|
|
imponibile, imposta, spese, cambio.codice());
|
1995-09-25 11:38:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1996-02-02 11:09:18 +00:00
|
|
|
pag.set_total(imponibile, imposta, spese);
|
1995-09-25 11:38:25 +00:00
|
|
|
}
|
1996-02-07 11:51:14 +00:00
|
|
|
|
1996-02-13 16:35:59 +00:00
|
|
|
if (update)
|
1996-02-07 11:51:14 +00:00
|
|
|
{
|
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
|
|
|
pagamento().set_sheet(ps); // Aggiorna lo sheet
|
|
|
|
pag_rows() = ps.rows_array(); // copia sheet
|
|
|
|
}
|
1996-01-09 10:32:00 +00:00
|
|
|
}
|
1995-02-28 09:17:57 +00:00
|
|
|
|
1999-04-26 15:58:05 +00:00
|
|
|
void TPrimanota_application::set_banche(TMask& m)
|
|
|
|
{
|
|
|
|
// Aggiunge banche: CM000033
|
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
|
|
|
bool update = FALSE;
|
|
|
|
for (int i = ps.items()-1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
TToken_string& row = ps.row(i);
|
|
|
|
if (row.get_char(7) <= ' ')
|
|
|
|
{
|
|
|
|
row.add(m.get(FS_NSABI), 7);
|
|
|
|
row.add(m.get(FS_NSCAB), 8);
|
|
|
|
update = TRUE;
|
|
|
|
}
|
|
|
|
if (row.get_char(9) <= ' ')
|
|
|
|
{
|
|
|
|
row.add(m.get(FS_VSABI), 9);
|
|
|
|
row.add(m.get(FS_VSCAB), 10);
|
|
|
|
update = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (update)
|
|
|
|
ps.force_update();
|
|
|
|
}
|
|
|
|
|
1996-01-09 10:32:00 +00:00
|
|
|
void TPrimanota_application::set_scadenze(TMask& m)
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
const TString16 cp(m.get(F_CODPAG));
|
|
|
|
const TString16 dt(m.get(F_DATADOC));
|
1996-01-09 10:32:00 +00:00
|
|
|
set_pagamento(cp, dt);
|
1996-02-13 16:35:59 +00:00
|
|
|
set_totale_pagamento(FALSE);
|
1996-01-09 10:32:00 +00:00
|
|
|
|
|
|
|
TPagamento& pag = pagamento();
|
1995-10-25 09:34:53 +00:00
|
|
|
if (m.field(FS_RECALC).enabled())
|
|
|
|
{
|
|
|
|
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
|
|
|
|
m.set(FS_NAMEPAG, pag.name());
|
|
|
|
m.set(FS_TIPOPR, pag.desc_tpr());
|
|
|
|
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "");
|
1995-11-23 14:20:03 +00:00
|
|
|
m.set(FS_RECALC, m.insert_mode() ? "X" : "", TRUE);
|
1995-10-25 09:34:53 +00:00
|
|
|
m.set(FS_NRATE, pag.n_rate());
|
|
|
|
}
|
1995-03-22 09:04:45 +00:00
|
|
|
|
1995-11-23 14:20:03 +00:00
|
|
|
pag.set_rate_auto();
|
1995-09-25 11:38:25 +00:00
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
|
|
|
pag.set_sheet(ps); // prepara lo sheet
|
1999-04-26 15:58:05 +00:00
|
|
|
set_banche(m);
|
1995-09-25 11:38:25 +00:00
|
|
|
_pag_rows = ps.rows_array(); // copia sheet
|
1995-02-28 09:17:57 +00:00
|
|
|
}
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-06-21 15:33:31 +00:00
|
|
|
bool TPrimanota_application::read_scadenze(TMask& m)
|
1995-02-28 09:17:57 +00:00
|
|
|
{
|
1995-09-19 15:43:43 +00:00
|
|
|
const int anno = m.get_int(F_ANNORIF);
|
|
|
|
const TString16 numpart(m.get(F_NUMRIF));
|
1995-12-23 09:41:46 +00:00
|
|
|
|
1996-01-23 15:37:14 +00:00
|
|
|
if (anno <= 0 || numpart.blank()) // Partita vuota
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
TBill clifo; cerca_conto_cf(clifo);
|
1995-09-19 15:43:43 +00:00
|
|
|
const TPartita& part = partite().partita(clifo, anno, numpart);
|
1996-01-23 15:37:14 +00:00
|
|
|
|
|
|
|
const TRectype& testa = _rel->curr();
|
|
|
|
const long nreg = testa.get_long(MOV_NUMREG);
|
|
|
|
const TDate datadoc = testa.get_date(MOV_DATADOC);
|
1994-11-18 11:40:45 +00:00
|
|
|
|
1996-01-11 15:44:06 +00:00
|
|
|
const int npart = part.prima_fattura(nreg);
|
1996-01-23 15:37:14 +00:00
|
|
|
if (npart <= 0) // Non esiste una riga per questo movimento
|
|
|
|
{
|
|
|
|
partite().destroy();
|
1996-01-29 08:11:28 +00:00
|
|
|
return FALSE; // Non dovrebbe succedere mai, in quanto gia' beccato sopra!
|
1996-01-23 15:37:14 +00:00
|
|
|
}
|
1996-01-29 08:11:28 +00:00
|
|
|
|
|
|
|
// Determino il codice pagamento dalla riga di fattura
|
|
|
|
TString codpag;
|
1996-01-23 15:37:14 +00:00
|
|
|
const TRiga_partite& partita = part.riga(npart);
|
1995-12-23 09:41:46 +00:00
|
|
|
if (partita.rate() > 0)
|
|
|
|
{
|
1995-09-19 15:43:43 +00:00
|
|
|
const TRiga_scadenze& primarata = partita.rata(1);
|
1995-12-23 09:41:46 +00:00
|
|
|
codpag = primarata.get(SCAD_CODPAG);
|
|
|
|
}
|
|
|
|
set_pagamento(codpag, datadoc.string());
|
1996-01-04 14:51:26 +00:00
|
|
|
TPagamento& pag = pagamento();
|
1996-01-11 15:44:06 +00:00
|
|
|
|
|
|
|
const bool in_valuta = m.get(SK_VALUTA).not_empty();
|
1996-01-09 10:32:00 +00:00
|
|
|
|
2004-04-28 20:29:34 +00:00
|
|
|
const real totale = m.get_real(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
|
2000-05-05 15:25:49 +00:00
|
|
|
if (totale != partita.importo(in_valuta).valore())
|
1995-12-23 09:41:46 +00:00
|
|
|
{
|
2000-05-05 15:25:49 +00:00
|
|
|
const TCurrency totdoc_c(totale, m.get(SK_VALUTA));
|
|
|
|
const TCurrency totdoc_s(partita.importo(in_valuta).valore(), m.get(SK_VALUTA));
|
|
|
|
const TString i1 = totdoc_c.string(TRUE);
|
|
|
|
const TString i2 = totdoc_s.string(TRUE);
|
2003-04-14 07:42:12 +00:00
|
|
|
warning_box(FR("Il totale documento (%s) non corrisponde a quello del saldaconto (%s)."),
|
2000-05-05 15:25:49 +00:00
|
|
|
(const char*)i1, (const char*)i2);
|
|
|
|
}
|
2003-10-01 14:22:06 +00:00
|
|
|
if (iva() != nessuna_iva)
|
2000-05-05 15:25:49 +00:00
|
|
|
{
|
2003-10-01 14:22:06 +00:00
|
|
|
if (m.get_real(F_IMPOSTE) != partita.get_real(PART_IMPOSTA))
|
|
|
|
{
|
|
|
|
const TCurrency imposte_c(m.get_real(F_IMPOSTE));
|
|
|
|
const TCurrency imposte_s(partita.get_real(PART_IMPOSTA));
|
|
|
|
const TString i1 = imposte_c.string(TRUE);
|
|
|
|
const TString i2 = imposte_s.string(TRUE);
|
|
|
|
warning_box(FR("Il totale delle imposte (%s) non corrisponde a quello del saldaconto (%s)."),
|
|
|
|
(const char*)i1, (const char*)i2);
|
|
|
|
}
|
1995-12-23 09:41:46 +00:00
|
|
|
}
|
1996-01-09 10:32:00 +00:00
|
|
|
|
1996-02-13 16:35:59 +00:00
|
|
|
set_totale_pagamento(FALSE);
|
1995-12-23 09:41:46 +00:00
|
|
|
|
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
1996-01-11 15:44:06 +00:00
|
|
|
|
|
|
|
const int protette = partita.ultima_rata_con_abbuoni_diffcam();
|
1995-12-23 09:41:46 +00:00
|
|
|
|
1996-01-05 15:17:50 +00:00
|
|
|
pag.zap_rate(); // Azzera pagamento
|
|
|
|
for (int i = 1; i <= partita.rate(); i++) // E' necessario andare in avanti!!!
|
1995-12-23 09:41:46 +00:00
|
|
|
{
|
|
|
|
const TRiga_scadenze& scadenza = partita.rata(i);
|
2004-04-28 20:29:34 +00:00
|
|
|
real importo = scadenza.get_real(SCAD_IMPORTO);
|
|
|
|
const TDate scad = scadenza.get_date(SCAD_DATASCAD);
|
1995-12-23 09:41:46 +00:00
|
|
|
const int tipop = scadenza.get_int(SCAD_TIPOPAG);
|
1996-01-31 11:52:54 +00:00
|
|
|
const bool prot = i <= protette; // Non cancellabile
|
1995-12-23 09:41:46 +00:00
|
|
|
const TString16 ulc = scadenza.get(SCAD_ULTCLASS);
|
1996-01-03 12:10:02 +00:00
|
|
|
if (in_valuta)
|
1995-12-23 09:41:46 +00:00
|
|
|
{
|
|
|
|
const real impval(scadenza.get(SCAD_IMPORTOVAL));
|
1996-01-31 11:52:54 +00:00
|
|
|
pag.set_rata(i-1, impval, importo, scad, tipop, ulc, prot);
|
1995-12-23 09:41:46 +00:00
|
|
|
}
|
|
|
|
else
|
1996-02-02 11:09:18 +00:00
|
|
|
pag.set_rata(i-1, ZERO, importo, scad, tipop, ulc, prot);
|
1995-12-23 09:41:46 +00:00
|
|
|
|
|
|
|
TToken_string& str = ps.row(i-1);
|
|
|
|
str.add(scadenza.get(SCAD_CODABIPR), 7);
|
|
|
|
str.add(scadenza.get(SCAD_CODCABPR), 8);
|
|
|
|
str.add(scadenza.get(SCAD_CODABI), 9);
|
|
|
|
str.add(scadenza.get(SCAD_CODCAB), 10);
|
|
|
|
if (i == 1)
|
|
|
|
{
|
|
|
|
m.set(FS_NSABI, str.get(7));
|
|
|
|
m.set(FS_NSCAB, str.get(8));
|
|
|
|
m.set(FS_VSABI, str.get(9));
|
|
|
|
m.set(FS_VSCAB, str.get(10));
|
|
|
|
m.set(FS_AGENTE, scadenza.get(SCAD_CODAG));
|
1996-01-31 11:52:54 +00:00
|
|
|
}
|
|
|
|
str.add(scadenza.get(SCAD_DESCR), 11);
|
|
|
|
str.add(scadenza.get(SCAD_BLOCCATA), 12);
|
|
|
|
str.add(prot ? "X" : " ", 13);
|
1995-12-23 09:41:46 +00:00
|
|
|
}
|
|
|
|
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
|
|
|
|
m.set(FS_NAMEPAG, pag.name());
|
|
|
|
m.set(FS_TIPOPR, pag.desc_tpr());
|
|
|
|
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "", TRUE);
|
|
|
|
m.set(FS_RECALC, m.insert_mode() ? "X" : "", TRUE);
|
|
|
|
m.set(FS_NRATE, pag.n_rate());
|
1995-02-28 09:17:57 +00:00
|
|
|
|
1995-03-22 09:04:45 +00:00
|
|
|
pag.set_sheet(ps);
|
|
|
|
_pag_rows = ps.rows_array();
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-02-28 09:17:57 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1996-01-19 13:09:12 +00:00
|
|
|
int TPrimanota_application::cerca_conto_cf(TBill& bill) const
|
1996-01-11 15:44:06 +00:00
|
|
|
{
|
|
|
|
TString_array& a = cgs().rows_array();
|
2003-10-01 14:22:06 +00:00
|
|
|
if (iva() != nessuna_iva)
|
|
|
|
{
|
|
|
|
const char tipocf = clifo();
|
|
|
|
const long codcf = curr_mask().get_long(tipocf == 'C' ? F_CLIENTE : F_FORNITORE);
|
|
|
|
for (int r = 0; r < a.items(); r++)
|
|
|
|
{
|
|
|
|
TToken_string& row = a.row(r);
|
|
|
|
bill.get(row, 2, 0x1);
|
|
|
|
if (bill.tipo() == tipocf && bill.codclifo() == codcf)
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
bill.set(0, 0, codcf, tipocf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int r = 0; r < a.items(); r++)
|
|
|
|
{
|
|
|
|
TToken_string& row = a.row(r);
|
|
|
|
bill.get(row, 2, 0x1);
|
|
|
|
if (bill.tipo() > ' ')
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
if (a.items() > 0)
|
|
|
|
{
|
|
|
|
TToken_string& row = a.row(0);
|
|
|
|
bill.get(row, 2, 0x1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bill.set(0, 0, 0, ' ');
|
1996-01-11 15:44:06 +00:00
|
|
|
}
|
1996-01-19 13:09:12 +00:00
|
|
|
return -1;
|
1996-01-11 15:44:06 +00:00
|
|
|
}
|
|
|
|
|
1995-02-28 09:17:57 +00:00
|
|
|
void TPrimanota_application::write_scadenze(const TMask& m)
|
1995-09-19 15:43:43 +00:00
|
|
|
{
|
|
|
|
const long nreg = m.get_long(F_NUMREG);
|
1995-11-10 13:35:00 +00:00
|
|
|
const int anno = m.get_int(F_ANNORIF);
|
|
|
|
const TString numpart(m.get(F_NUMRIF));
|
1994-11-10 14:25:26 +00:00
|
|
|
|
1995-11-14 15:58:25 +00:00
|
|
|
TPartita* oldgame = partite().first();
|
1995-09-19 15:43:43 +00:00
|
|
|
TPartita* newgame = NULL;
|
1996-02-13 16:35:59 +00:00
|
|
|
|
|
|
|
int nuova_riga = 0;
|
1995-11-14 15:58:25 +00:00
|
|
|
|
1996-02-19 14:04:36 +00:00
|
|
|
if (anno > 0 && !numpart.blank() && m.page_enabled(2))
|
1995-09-19 15:43:43 +00:00
|
|
|
{
|
|
|
|
const int tmov = causale().tipomov();
|
2002-12-20 16:15:03 +00:00
|
|
|
const TString& desc = m.get(F_DESCR);
|
|
|
|
const TString& codpag = m.get(F_CODPAG);
|
|
|
|
const TString8 codcaus = causale().codice();
|
1999-07-16 14:59:11 +00:00
|
|
|
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
2002-12-20 16:15:03 +00:00
|
|
|
const TString& agente = m.get(FS_AGENTE);
|
1995-09-19 15:43:43 +00:00
|
|
|
const char sezione = get_cgs_imp(0).sezione(); // Dare/Avere
|
1995-10-25 09:34:53 +00:00
|
|
|
|
1996-01-19 13:09:12 +00:00
|
|
|
TBill clifo;
|
|
|
|
const int riga_clifo = cerca_conto_cf(clifo);
|
|
|
|
CHECK(riga_clifo >= 0, "Impossibile generare la fattura senza gruppo/conto cliente");
|
1995-09-19 15:43:43 +00:00
|
|
|
newgame = new TPartita(clifo, anno, numpart);
|
|
|
|
|
1996-01-03 12:10:02 +00:00
|
|
|
const int row = newgame->prima_fattura(nreg); // Riga fattura di questo movimento
|
1995-09-19 15:43:43 +00:00
|
|
|
TRiga_partite& partita = row <= 0 ? newgame->new_row() : newgame->riga(row);
|
1996-02-13 16:35:59 +00:00
|
|
|
nuova_riga = partita.get_int(PART_NRIGA);
|
|
|
|
|
1995-12-07 11:09:17 +00:00
|
|
|
TPagamento& pag = pagamento();
|
1995-09-19 15:43:43 +00:00
|
|
|
|
|
|
|
// put data on partita
|
1996-01-03 12:10:02 +00:00
|
|
|
partita.put(PART_TIPOMOV, tmov);
|
|
|
|
partita.put(PART_NREG, nreg);
|
1996-01-25 17:20:49 +00:00
|
|
|
partita.put(PART_NUMRIG, riga_clifo+1);
|
1996-01-05 15:17:50 +00:00
|
|
|
partita.put(PART_DATAREG, m.get(F_DATAREG));
|
|
|
|
partita.put(PART_DATADOC, m.get(F_DATADOC));
|
|
|
|
partita.put(PART_NUMDOC, m.get(F_NUMDOC));
|
1996-01-03 12:10:02 +00:00
|
|
|
partita.put(PART_DESCR, desc);
|
|
|
|
partita.put(PART_CODCAUS, codcaus);
|
1996-01-05 15:17:50 +00:00
|
|
|
partita.put(PART_REG, causale().reg().name());
|
1996-01-03 12:10:02 +00:00
|
|
|
partita.put(PART_SEZ, sezione);
|
2003-10-01 14:22:06 +00:00
|
|
|
if (iva() != nessuna_iva)
|
|
|
|
partita.put(PART_PROTIVA, m.get_long(F_PROTIVA));
|
1996-01-19 13:09:12 +00:00
|
|
|
|
|
|
|
const TImporto totdoc = get_cgs_imp(riga_clifo);
|
|
|
|
partita.put(PART_IMPTOTDOC, totdoc.valore());
|
1997-04-11 15:03:19 +00:00
|
|
|
|
1996-01-03 12:10:02 +00:00
|
|
|
cambio.put(partita);
|
|
|
|
const bool in_valuta = cambio.in_valuta();
|
1997-04-11 15:03:19 +00:00
|
|
|
|
|
|
|
if (in_valuta)
|
|
|
|
partita.put(PART_IMPTOTVAL, m.get(SK_TOTDOCVAL));
|
|
|
|
|
2004-04-28 20:29:34 +00:00
|
|
|
real imponibile, imponibile_val;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = pag.n_rate()-1; i >= 0; i--)
|
1996-01-03 12:10:02 +00:00
|
|
|
{
|
|
|
|
if (in_valuta)
|
1996-02-02 11:09:18 +00:00
|
|
|
imponibile_val += pag.tval_rata(i);
|
|
|
|
imponibile += pag.tlit_rata(i);
|
1995-09-25 17:30:36 +00:00
|
|
|
}
|
1996-01-03 12:10:02 +00:00
|
|
|
|
|
|
|
partita.put(PART_IMPORTO, imponibile);
|
|
|
|
partita.put(PART_IMPORTOVAL, imponibile_val);
|
1995-12-23 09:41:46 +00:00
|
|
|
partita.put(PART_SPESE, pag.spese());
|
2003-10-01 14:22:06 +00:00
|
|
|
if (iva() != nessuna_iva)
|
|
|
|
partita.put(PART_IMPOSTA, m.get(F_IMPOSTE));
|
1995-09-19 15:43:43 +00:00
|
|
|
|
1995-09-22 12:29:00 +00:00
|
|
|
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
|
1996-01-03 12:10:02 +00:00
|
|
|
|
1996-01-31 11:52:54 +00:00
|
|
|
partita.elimina_rata(-1); // Elimina tutte le rate eventuali
|
|
|
|
for (i = 0; i < ps.items(); i++)
|
1995-09-22 12:29:00 +00:00
|
|
|
{
|
|
|
|
TToken_string& row = ps.row(i);
|
|
|
|
|
1995-09-19 15:43:43 +00:00
|
|
|
TRiga_scadenze& scadenza = partita.new_row();
|
1996-02-05 09:21:39 +00:00
|
|
|
|
1996-02-05 08:27:17 +00:00
|
|
|
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(); // 3 = Percentuale
|
|
|
|
scadenza.put(SCAD_TIPOPAG, row.get()); // 4 = Tipo pagamento
|
|
|
|
scadenza.put(SCAD_ULTCLASS, row.get()); // 5 = Ulteriore classificazione
|
|
|
|
row.get(); // 6 = Descrizione pagamento
|
|
|
|
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
|
1995-09-19 15:43:43 +00:00
|
|
|
}
|
1995-03-22 09:04:45 +00:00
|
|
|
}
|
1995-09-19 15:43:43 +00:00
|
|
|
|
|
|
|
if (oldgame != NULL)
|
|
|
|
{
|
1995-11-14 15:58:25 +00:00
|
|
|
const int rigafatt = oldgame->prima_fattura(nreg);
|
|
|
|
if (rigafatt > 0)
|
1995-09-19 15:43:43 +00:00
|
|
|
{
|
1995-09-25 17:30:36 +00:00
|
|
|
if (newgame == NULL || *oldgame != *newgame)
|
1995-09-19 15:43:43 +00:00
|
|
|
{
|
|
|
|
bool sposta = newgame != NULL;
|
|
|
|
if (sposta)
|
1995-10-04 15:07:56 +00:00
|
|
|
{
|
|
|
|
sposta = (oldgame->conto().sottoconto() == newgame->conto().sottoconto());
|
1995-09-19 15:43:43 +00:00
|
|
|
if (sposta)
|
2003-04-14 07:42:12 +00:00
|
|
|
sposta = yesno_box(FR("Si desidera spostare la fattura e gli eventuali\n"
|
|
|
|
"pagamenti relativi nella partita %d %s?"), anno, (const char*)numpart);
|
1995-09-19 15:43:43 +00:00
|
|
|
}
|
|
|
|
if (sposta)
|
1996-02-13 16:35:59 +00:00
|
|
|
{
|
|
|
|
oldgame->sposta_riga(rigafatt, *newgame, nuova_riga);
|
|
|
|
}
|
1995-09-19 15:43:43 +00:00
|
|
|
else
|
1995-09-25 17:30:36 +00:00
|
|
|
{
|
1995-11-14 15:58:25 +00:00
|
|
|
oldgame->scollega_pagamenti(rigafatt);
|
|
|
|
oldgame->rimuovi_riga(rigafatt);
|
1995-09-25 17:30:36 +00:00
|
|
|
}
|
1995-09-19 15:43:43 +00:00
|
|
|
oldgame->rewrite();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1996-02-13 16:35:59 +00:00
|
|
|
oldgame->sposta_riga(rigafatt, *newgame, nuova_riga);
|
1995-09-19 15:43:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1995-09-01 10:13:36 +00:00
|
|
|
|
1995-11-18 11:09:06 +00:00
|
|
|
if (newgame != NULL) // Se non ho cancellato il numero partita ...
|
1996-02-21 09:00:03 +00:00
|
|
|
{
|
1995-11-14 15:58:25 +00:00
|
|
|
newgame->write(); // Salva nuova partita
|
1996-02-16 09:51:28 +00:00
|
|
|
delete newgame;
|
|
|
|
}
|
1995-03-22 09:04:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// Gestione pagamenti
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
|
|
|
|
{
|
|
|
|
bool ok = TRUE;
|
|
|
|
TMask& m = f.mask();
|
1996-01-31 11:52:54 +00:00
|
|
|
TPrimanota_application& a = app();
|
1996-02-19 14:04:36 +00:00
|
|
|
TMask& cm = a.curr_mask();
|
1995-09-29 16:21:08 +00:00
|
|
|
|
1996-02-16 09:51:28 +00:00
|
|
|
const char tipo = m.get(CG_ROWTYPE)[0];
|
1996-02-19 14:04:36 +00:00
|
|
|
const bool is_nota = tipo == 'T' && a.causale().tipomov() == 2 && cm.field(F_NUMRIF).active();
|
1996-02-27 11:32:35 +00:00
|
|
|
const bool tras = a._as400 && a.causale().tipomov() > 1 && m.get(CG_TIPO).not_empty();
|
|
|
|
|
|
|
|
if (tipo == 'K' || is_nota || tras)
|
1995-09-29 16:21:08 +00:00
|
|
|
{
|
|
|
|
TSheet_field& s = *m.get_sheet();
|
|
|
|
const int riga = s.selected();
|
|
|
|
|
|
|
|
if (k == K_SPACE)
|
|
|
|
{
|
1996-01-31 11:52:54 +00:00
|
|
|
const bool ok = a.edit_partite(m, riga);
|
1995-10-25 09:34:53 +00:00
|
|
|
if (ok && riga < s.items())
|
1995-09-29 16:21:08 +00:00
|
|
|
k = K_ENTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == K_ENTER)
|
1995-10-25 09:34:53 +00:00
|
|
|
{
|
1998-05-11 15:57:22 +00:00
|
|
|
const long curreg = cm.insert_mode() ? NUMREG_PROVVISORIO : cm.get_long(F_NUMREG);
|
1996-01-31 11:52:54 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
if (importo != speso)
|
|
|
|
{
|
1999-04-06 15:34:39 +00:00
|
|
|
TString msg(128);
|
2003-04-14 07:42:12 +00:00
|
|
|
const TCurrency curr(speso.valore());
|
|
|
|
msg.format(FR("L'importo sul saldaconto della riga %d e' %s"), (riga+1), (const char*)curr.string(TRUE));
|
1996-04-16 15:41:45 +00:00
|
|
|
if (!speso.is_zero())
|
2003-04-14 07:42:12 +00:00
|
|
|
msg << (speso.sezione() == 'A' ? TR(" Avere") : TR(" Dare"));
|
1996-04-16 15:41:45 +00:00
|
|
|
return f.error_box(msg);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
1997-03-26 08:26:08 +00:00
|
|
|
f.set_focus();
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// deleting significato
|
1995-10-11 11:39:50 +00:00
|
|
|
// -1 sto cancellando tutto
|
|
|
|
// 0 non sto cancellando nulla
|
1995-09-29 16:21:08 +00:00
|
|
|
// 1 sto cancellando la prima riga contabile
|
|
|
|
// n sto cancellando la ennesima riga contabile
|
1996-01-09 10:32:00 +00:00
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pag,
|
|
|
|
const TValuta& valuta, int deleting)
|
|
|
|
{
|
|
|
|
const int nriga = new_pag.get_int(PAGSCA_NRIGA); // Riga fattura
|
|
|
|
const int nrata = new_pag.get_int(PAGSCA_NRATA); // Numero rata
|
|
|
|
const int nrigp = new_pag.get_int(PAGSCA_NRIGP); // Riga pagamento
|
|
|
|
const TRectype& old_pag = p.pagamento(nriga, nrata, nrigp);
|
|
|
|
const TRiga_partite& somma = p.riga(nrigp);
|
|
|
|
const int riga_contabile = somma.get_int(PART_NUMRIG); // Riga movimento
|
1996-01-25 17:20:49 +00:00
|
|
|
TSheet_field& sheet = cgs();
|
2002-02-26 16:20:19 +00:00
|
|
|
TBill new_conto; new_conto.get(new_pag, TRUE);
|
1996-02-27 11:32:35 +00:00
|
|
|
|
2002-02-26 16:20:19 +00:00
|
|
|
if (_as400 || !new_conto.ok())
|
1996-02-27 11:32:35 +00:00
|
|
|
deleting = -1; // Ignora contropartite
|
1995-09-29 16:21:08 +00:00
|
|
|
|
1995-10-11 11:39:50 +00:00
|
|
|
if (deleting >= 0)
|
1995-09-29 16:21:08 +00:00
|
|
|
{
|
|
|
|
const char sez = somma.sezione(); // Sezione importo e ritenute
|
|
|
|
const char controsez = sez == 'A' ? 'D' : 'A'; // Sezione contropartita
|
|
|
|
|
|
|
|
// Aggiornamento contopartita
|
|
|
|
const TImporto old_importo(controsez, old_pag.get_real(PAGSCA_IMPORTO));
|
|
|
|
TBill old_conto; old_conto.get(old_pag, TRUE);
|
|
|
|
|
|
|
|
const TImporto new_importo(controsez, new_pag.get_real(PAGSCA_IMPORTO));
|
1996-01-25 17:20:49 +00:00
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
if (old_importo != new_importo || old_conto != new_conto)
|
|
|
|
{
|
2002-02-26 16:20:19 +00:00
|
|
|
int old_riga = bill2pos(old_conto, 'I');
|
1995-09-29 16:21:08 +00:00
|
|
|
if (old_riga >= 0)
|
|
|
|
{
|
|
|
|
const bool empty = sub_cgs_imp(old_riga, old_importo);
|
|
|
|
if (empty && (new_importo.is_zero() || new_conto != old_conto))
|
1996-01-25 17:20:49 +00:00
|
|
|
sheet.destroy(old_riga);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
2002-02-26 16:20:19 +00:00
|
|
|
else
|
|
|
|
if (!old_importo.is_zero())
|
|
|
|
{
|
|
|
|
TImporto imp = old_importo; imp.swap_section();
|
|
|
|
set_cgs_row(old_riga, imp, old_conto, "", 'I');
|
|
|
|
}
|
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
|
2002-05-08 16:25:49 +00:00
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
// Importo della contropartita
|
|
|
|
if (!new_importo.is_zero() && new_conto.ok())
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
int new_riga = bill2pos(new_conto, 'I');
|
1995-09-29 16:21:08 +00:00
|
|
|
if (new_riga < 0)
|
1995-12-20 16:16:14 +00:00
|
|
|
{
|
|
|
|
const int tp = somma.get_int(PART_TIPOPAG);
|
|
|
|
const int da = p.tipopag2causale(tp);
|
|
|
|
const TString descagg(causale().desc_agg(da));
|
1999-07-16 14:59:11 +00:00
|
|
|
new_riga = set_cgs_row(new_riga, new_importo, new_conto, descagg, 'I');
|
|
|
|
|
|
|
|
TToken_string& cli_row = sheet.row(riga_contabile-1);
|
|
|
|
TBill contro; contro.get(cli_row, 9, 0x3);
|
|
|
|
if (!contro.ok()) // Completa controparita della riga cliente se necessario
|
|
|
|
new_conto.add_to(cli_row, 9, 0x3);
|
|
|
|
TString80 descr = cli_row.get(CG_DESCR-FIRST_FIELD);
|
|
|
|
if (descr.blank()) // Compila descrizione della riga cliente se necessario
|
|
|
|
{
|
|
|
|
descr = somma.get(PART_DESCR);
|
|
|
|
cli_row.add(descr, CG_DESCR-FIRST_FIELD);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Compila contropartita della nuova riga
|
|
|
|
TBill clifo; clifo.get(cli_row, 2, 0x3);
|
|
|
|
TToken_string& new_row = sheet.row(new_riga);
|
|
|
|
clifo.add_to(new_row, 9, 0x3);
|
1995-12-20 16:16:14 +00:00
|
|
|
}
|
1995-09-29 16:21:08 +00:00
|
|
|
else
|
|
|
|
add_cgs_imp(new_riga, new_importo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Aggiornamento ritenute
|
|
|
|
const real old_ritenute(old_pag.get(PAGSCA_RITENUTE));
|
|
|
|
const real new_ritenute(new_pag.get(PAGSCA_RITENUTE));
|
|
|
|
if (old_ritenute != new_ritenute)
|
|
|
|
{
|
|
|
|
const TImporto grow_ritenute(controsez, new_ritenute-old_ritenute);
|
2004-04-28 20:29:34 +00:00
|
|
|
const int riga = type2pos('F');
|
1995-09-29 16:21:08 +00:00
|
|
|
if (riga < 0)
|
|
|
|
{
|
1996-01-09 10:32:00 +00:00
|
|
|
TBill conto_rit; causale().bill(RIGA_RITENUTE, conto_rit);
|
|
|
|
const TString desc(causale().desc_agg(RIGA_RITENUTE));
|
1995-10-06 13:24:49 +00:00
|
|
|
set_cgs_row(riga, grow_ritenute, conto_rit, desc, 'F');
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const bool empty = add_cgs_imp(riga, grow_ritenute);
|
1996-01-25 17:20:49 +00:00
|
|
|
if (empty) sheet.destroy(riga);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
}
|
1996-02-27 11:32:35 +00:00
|
|
|
} // if (deleting >= 0)
|
1998-03-16 13:46:03 +00:00
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
char old_ap, new_ap;
|
|
|
|
TImporto old_abbuono, new_abbuono, old_diffcam, new_diffcam;
|
|
|
|
const bool empty = p.modifica_pagamento(new_pag, valuta,
|
|
|
|
old_ap, old_abbuono, old_diffcam,
|
1995-10-25 09:34:53 +00:00
|
|
|
new_ap, new_abbuono, new_diffcam, TRUE);
|
1995-09-29 16:21:08 +00:00
|
|
|
|
1995-10-11 11:39:50 +00:00
|
|
|
if (deleting >= 0)
|
1995-09-29 16:21:08 +00:00
|
|
|
{
|
|
|
|
// Se c'e' differenza negli abbuoni
|
|
|
|
if (old_abbuono != new_abbuono || old_ap != new_ap)
|
|
|
|
{
|
|
|
|
if (old_ap != ' ') // Se c'era un abbuono ...
|
|
|
|
{
|
|
|
|
const int riga_abb = type2pos(old_ap);
|
|
|
|
CHECK(riga_abb >= 0, "Chiss'e' fregato gli abbuoni?");
|
1995-10-25 09:34:53 +00:00
|
|
|
const bool empty = add_cgs_imp(riga_abb, old_abbuono);
|
1995-09-29 16:21:08 +00:00
|
|
|
if (empty && new_ap != old_ap)
|
1996-01-25 17:20:49 +00:00
|
|
|
sheet.destroy(riga_abb);
|
1995-09-29 16:21:08 +00:00
|
|
|
|
|
|
|
if (deleting != riga_contabile)
|
|
|
|
{
|
|
|
|
// Sottrae l'abbuono con la sezione invertita dalla riga contabile
|
1995-10-25 09:34:53 +00:00
|
|
|
sub_cgs_imp(riga_contabile-1, old_abbuono);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (new_ap != ' ') // Se ci sono abbuoni
|
|
|
|
{
|
2004-04-28 20:29:34 +00:00
|
|
|
const int riga_abb = type2pos(new_ap);
|
1995-10-25 09:34:53 +00:00
|
|
|
|
|
|
|
new_abbuono.swap_section();
|
|
|
|
new_abbuono.normalize();
|
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
if (riga_abb < 0)
|
|
|
|
{
|
1996-01-09 10:32:00 +00:00
|
|
|
const int rc = new_ap == 'A' ? RIGA_ABBUONI_ATTIVI : RIGA_ABBUONI_PASSIVI;
|
1995-09-29 16:21:08 +00:00
|
|
|
TBill conto_abb; causale().bill(rc, conto_abb);
|
1995-10-06 13:24:49 +00:00
|
|
|
const TString desc(causale().desc_agg(rc));
|
|
|
|
app().set_cgs_row(riga_abb, new_abbuono, conto_abb, desc, new_ap);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
add_cgs_imp(riga_abb, new_abbuono);
|
|
|
|
|
|
|
|
if (deleting != riga_contabile)
|
|
|
|
{
|
|
|
|
// Aggiunge l'abbuono con la sezione invertita
|
1995-10-06 13:24:49 +00:00
|
|
|
sub_cgs_imp(riga_contabile-1, new_abbuono);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Se c'e' variazione nella differenza cambi
|
|
|
|
if (old_diffcam != new_diffcam)
|
|
|
|
{
|
|
|
|
const int riga_diffcam = type2pos('C');
|
1995-10-25 09:34:53 +00:00
|
|
|
TImporto grow_diffcam(old_diffcam);
|
|
|
|
grow_diffcam -= new_diffcam;
|
1995-09-29 16:21:08 +00:00
|
|
|
grow_diffcam.normalize();
|
|
|
|
|
|
|
|
if (riga_diffcam < 0)
|
|
|
|
{
|
1996-01-09 10:32:00 +00:00
|
|
|
TBill conto_diffcam; causale().bill(RIGA_DIFFCAM, conto_diffcam);
|
|
|
|
const TString desc(causale().desc_agg(RIGA_DIFFCAM));
|
1995-10-06 13:24:49 +00:00
|
|
|
set_cgs_row(riga_diffcam, grow_diffcam, conto_diffcam, desc, 'C');
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const bool empty = add_cgs_imp(riga_diffcam, grow_diffcam);
|
1996-01-25 17:20:49 +00:00
|
|
|
if (empty)
|
|
|
|
sheet.destroy(riga_diffcam);
|
1995-09-29 16:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (deleting != riga_contabile)
|
|
|
|
{
|
|
|
|
// Aggiunge la differenza con la sezione invertita
|
|
|
|
sub_cgs_imp(riga_contabile-1, grow_diffcam);
|
|
|
|
}
|
|
|
|
}
|
1995-10-11 11:39:50 +00:00
|
|
|
} // if (deleting >= 0)
|
1995-09-29 16:21:08 +00:00
|
|
|
|
|
|
|
return empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Scorre tutte le righe della partita ed azzera i pagamenti relativi a alla riga contabile
|
|
|
|
// cancellata e decrementa i numeri riga superiori a numrig
|
|
|
|
bool TPrimanota_application::notify_cgline_deletion(TPartita& partita, long nreg, int numrig)
|
|
|
|
{
|
|
|
|
bool found = FALSE;
|
2004-04-28 20:29:34 +00:00
|
|
|
int p;
|
1996-02-07 11:51:14 +00:00
|
|
|
|
|
|
|
// Al primo "giro" elimino i pagamenti dalla rate
|
2004-04-28 20:29:34 +00:00
|
|
|
for (p = partita.last(); p > 0; p = partita.pred(p))
|
1995-09-29 16:21:08 +00:00
|
|
|
{
|
|
|
|
TRiga_partite& part = partita.riga(p);
|
1995-11-23 14:20:03 +00:00
|
|
|
if (part.is_fattura())
|
1995-09-29 16:21:08 +00:00
|
|
|
{
|
|
|
|
for (int r = part.rate(); r > 0; r--)
|
|
|
|
{
|
|
|
|
const TRiga_scadenze& scad = part.rata(r);
|
|
|
|
for (int s = scad.last(); s > 0; s = scad.pred(s))
|
|
|
|
{
|
|
|
|
const TRiga_partite& sum = partita.riga(s);
|
|
|
|
if (sum.get_long(PART_NREG) == nreg &&
|
|
|
|
(numrig <= 0 || sum.get_int(PART_NUMRIG) == numrig))
|
|
|
|
{
|
|
|
|
TRectype nul_pag(scad.row(s));
|
|
|
|
nul_pag.zero(PAGSCA_IMPORTO);
|
|
|
|
nul_pag.zero(PAGSCA_IMPORTOVAL);
|
|
|
|
nul_pag.zero(PAGSCA_RITENUTE);
|
|
|
|
nul_pag.put(PAGSCA_ACCSAL, 'A');
|
|
|
|
const TValuta val; // Non cambiare valuta
|
|
|
|
notify_edit_pagamento(partita, nul_pag, val, numrig);
|
|
|
|
found = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1996-02-07 11:51:14 +00:00
|
|
|
|
|
|
|
// Alla fine del "giro" elimino i pagamenti non assegnati
|
1995-11-23 14:20:03 +00:00
|
|
|
TRecord_array& unas = partita.unassigned();
|
|
|
|
for (int u = unas.last_row(); u > 0; u = unas.pred_row(u))
|
|
|
|
{
|
|
|
|
const TRiga_partite& sum = partita.riga(u);
|
|
|
|
if (sum.get_long(PART_NREG) == nreg &&
|
|
|
|
(numrig <= 0 || sum.get_int(PART_NUMRIG) == numrig))
|
|
|
|
{
|
|
|
|
TRectype nul_pag(unas.row(u, FALSE));
|
|
|
|
nul_pag.zero(PAGSCA_IMPORTO);
|
|
|
|
nul_pag.zero(PAGSCA_IMPORTOVAL);
|
|
|
|
nul_pag.zero(PAGSCA_RITENUTE);
|
|
|
|
nul_pag.put(PAGSCA_ACCSAL, 'A'); // Inutile, ma l'ho copiato da sopra
|
|
|
|
const TValuta val; // Non cambiare valuta
|
|
|
|
notify_edit_pagamento(partita, nul_pag, val, numrig);
|
|
|
|
found = TRUE;
|
|
|
|
}
|
|
|
|
}
|
1995-09-29 16:21:08 +00:00
|
|
|
|
1996-02-07 11:51:14 +00:00
|
|
|
// Al secondo "giro" decremento NRIGP dalle righe di pagamento
|
|
|
|
if (numrig > 0)
|
|
|
|
{
|
|
|
|
for (p = partita.last(); p > 0; p = partita.pred(p))
|
|
|
|
{
|
|
|
|
TRiga_partite& part = partita.riga(p);
|
|
|
|
if (!part.is_fattura())
|
|
|
|
{
|
|
|
|
if (part.get_long(PART_NREG) == nreg)
|
|
|
|
{
|
|
|
|
const int nr = part.get_int(PART_NUMRIG);
|
|
|
|
if (nr > numrig)
|
|
|
|
part.put(PART_NUMRIG, nr-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TPrimanota_application::notify_cgline_deletion(int numrig)
|
1996-02-27 11:32:35 +00:00
|
|
|
{
|
1995-09-29 16:21:08 +00:00
|
|
|
bool found = FALSE;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
const TMask& m = curr_mask();
|
|
|
|
const long nreg = m.insert_mode() ? NUMREG_PROVVISORIO : m.get_long(F_NUMREG);
|
1998-05-11 15:57:22 +00:00
|
|
|
|
|
|
|
// if (curr_mask().edit_mode())
|
|
|
|
// partite().add_numreg(nreg); // Gia' fatto dalla read
|
|
|
|
|
1995-10-11 11:39:50 +00:00
|
|
|
for (TPartita* game = partite().first(); game; game = partite().next())
|
1995-09-29 16:21:08 +00:00
|
|
|
found |= notify_cgline_deletion(*game, nreg, numrig);
|
1996-02-27 11:32:35 +00:00
|
|
|
|
1995-09-29 16:21:08 +00:00
|
|
|
return found;
|
2004-04-28 20:29:34 +00:00
|
|
|
}
|