Corretta marea di errori Gabri

git-svn-id: svn://10.65.10.50/trunk@2391 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-01-04 14:51:26 +00:00
parent f4c1bcfbd3
commit 49b4babbca
8 changed files with 164 additions and 143 deletions

View File

@ -249,6 +249,7 @@ void TCaus_app::causale_inc_pag()
set_descr ( i++, "C Cessione");
set_descr ( i++, "C Paghero'");
set_descr ( i++, "C Lettera di credito");
// set_descr ( i++, "C Tratta accettata");
set_descr ( i++, "C Abbuoni pass./sc.");
set_descr ( i++, "C Abbuoni att./sc.");
set_descr ( i++, "C Spese e rimborsi");

View File

@ -143,6 +143,7 @@ TMask* TPrimanota_application::load_mask(int n)
m->set_handler(F_TOTALE, totdoc_handler);
m->set_handler(F_SHEETCG, cg_handler);
m->set_handler(SK_VALUTA, valuta_handler);
m->set_handler(SK_DATACAMBIO, datacambio_handler);
m->set_handler(SK_CAMBIO, cambio_handler);
m->set_handler(SK_TOTDOCVAL, totdocval_handler);
@ -493,6 +494,8 @@ void TPrimanota_application::init_mask(TMask& m)
m.enable(DLG_DELREC, scad_free); // Disabilita tasto cancella
m.enable(-1, scad_free); // Disabilita cliente
m.enable(-2, scad_free);
m.enable(F_ANNORIF, scad_free); // Disabilita anno e numero partita
m.enable(F_NUMRIF, scad_free);
m.enable(F_CODPAG, scad_free); // Disabilita codice pagamento
m.enable(FS_RESET, scad_free); // Disabilita tasto di reset

View File

@ -96,7 +96,7 @@ BEGIN
ITEM "Rata"
ITEM "Data doc.@10"
ITEM "Data scad."
ITEM "Descrizione@16"
ITEM "Descrizione@20"
ITEM "Importo Lire@14"
ITEM "Importo Valuta@14"
ITEM "Num. reg."

View File

@ -1898,31 +1898,31 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
void TPrimanota_application::gioca_cambi(int force)
{
TMask& m = curr_mask();
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
if (cambio.in_lire())
const TValuta valuta(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
if (valuta.in_lire())
return;
const real totale = m.get(F_TOTALE);
const real totval = m.get(SK_TOTDOCVAL);
if ( (force == 0x1 || totale.is_zero()) && !(totval.is_zero() || cambio.cambio() == 1.0) )
const real cambio = m.get(SK_CAMBIO);
if ( (force == 0x1 || totale.is_zero()) && !(totval.is_zero() || cambio.is_zero()) )
{
const real new_totale = cambio.val2lit(totval);
const real new_totale = valuta.val2lit(totval);
if (new_totale != totale)
m.set(F_TOTALE, new_totale, TRUE);
}
if ( (force == 0x2 || totval.is_zero()) && !(totale.is_zero() || cambio.cambio() == 1.0) )
if ( (force == 0x2 || totval.is_zero()) && !(totale.is_zero() || cambio.is_zero()) )
{
const real new_totval = cambio.lit2val(totale);
const real new_totval = valuta.lit2val(totale);
if (new_totval != totval)
m.set(SK_TOTDOCVAL, new_totval, TRUE);
}
if ( (force == 0x4 || cambio.cambio() == 1.0) && !(totale.is_zero() || totval.is_zero()))
if ( (force == 0x4 || cambio.is_zero()) && !(totale.is_zero() || totval.is_zero()) )
{
real new_cambio = totale / totval; new_cambio.round(5);
if (new_cambio != cambio.cambio())
if (new_cambio != cambio)
m.set(SK_CAMBIO, new_cambio, TRUE);
}
}
@ -1958,11 +1958,11 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
if (totale.is_zero())
ok = yesno_box("Totale documento nullo: continuare ugualmente?");
const real cambio(m.get(SK_CAMBIO));
if (!cambio.is_zero())
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
if (cambio.in_valuta())
{
const real totval(m.get(SK_TOTDOCVAL));
real totlit = totval * cambio; totlit.round(0);
const real totlit = cambio.val2lit(totval);
if (totale != totlit)
ok = yesno_box("Il totale documento dovrebbe essere %s: continuare ugualmente?",
totlit.string("."));
@ -1979,11 +1979,13 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
app().gioca_cambi();
const TMask& m = f.mask();
if (app().is_fattura() && m.insert_mode()) // Se e' una vera fattura
if (app().is_fattura() && m.insert_mode()) // Se e' una fattura
{
TPagamento& pag = app().pagamento();
const real totval(f.get());
pag.set_total(totval, ZERO, ZERO);
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
const real impostaval = cambio.lit2val(m.get_real(F_IMPOSTE));
pag.set_total(totval, impostaval, ZERO);
pag.set_rate_auto();
pag.set_sheet(app().pags());
}
@ -1992,32 +1994,37 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
return TRUE;
}
// Aggiunge o aggiorna la riga delle ritenute fiscali o sociali
// Certified 99%
void TPrimanota_application::add_cgs_rit(bool fiscali)
{
TMask& m = curr_mask();
const real imp(m.get(fiscali ? F_RITFIS : F_RITSOC));
const real imp(m.get(fiscali ? F_RITFIS : F_RITSOC)); // Determina importo
const char tipo = fiscali ? 'F' : 'S';
const int pos = type2pos(tipo);
if (pos < 0)
const int pos = type2pos(tipo); // Cerca la riga contabile
if (pos < 0) // Se non c'e' ...
{
if (!imp.is_zero()) // ... e l'importo e' valido
{ // crea una nuova riga di ritenute
const int riga = fiscali ? 8 : 9;
TBill conto; causale().bill(riga, conto);
const TString80 desc(causale().desc_agg(riga));
set_cgs_row(-1, real2imp(imp, tipo), conto, desc, tipo);
}
}
else
{
if (imp.is_zero())
reset_cgs_row(pos);
else
set_cgs_imp(pos, real2imp(imp, tipo));
if (imp.is_zero()) // se l'importo e' nullo ...
reset_cgs_row(pos); // ... azzera la riga contabile
else // altrimenti ...
set_cgs_imp(pos, real2imp(imp, tipo)); // ... aggiorna importo
}
if (m.insert_mode())
m.field(F_CODIVA).on_hit();
m.field(F_CODIVA).on_hit(); // Ricalcola sheet iva e contabile
else
app().calcola_saldo();
app().calcola_saldo(); // Ricalcola solo lo sbilancio
}
// Handler of the F_PROTIVA
@ -2038,11 +2045,12 @@ bool TPrimanota_application::protiva_handler(TMask_field& f, KEY key)
}
else
if (key == K_TAB && app().is_saldaconto() &&
if (key == K_TAB &&
app().is_saldaconto() && app().npart_is_prot() &&
m.insert_mode() && m.get(F_NUMRIF).empty())
{
const TString& piva = f.get();
if (piva.not_empty() && app().npart_is_prot())
if (piva.not_empty())
m.set(F_NUMRIF, piva);
}
}

View File

@ -108,6 +108,7 @@ class TPrimanota_application : public TRelation_application
static bool codpag_handler(TMask_field& f, KEY key);
static bool valuta_handler(TMask_field& f, KEY key);
static bool datacambio_handler(TMask_field& f, KEY key);
static bool cambio_handler(TMask_field& f, KEY key);
static bool reset_handler(TMask_field& f, KEY key);
static bool nrate_handler(TMask_field& f, KEY key);

View File

@ -249,13 +249,6 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
if (m.insert_mode() && app().is_fattura())
{
if (key == K_TAB && f.focusdirty())
{
const TString16 dt(m.get(F_DATADOC));
app().set_pagamento(f.get(), dt);
app().set_scadenze(m);
}
if (key == K_ENTER && f.get().empty())
{
const char typ = app().clifo();
@ -265,12 +258,21 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
clifo.put(CLI_TIPOCF, typ);
clifo.put(CLI_CODCF, cod);
if (clifo.read() == NOERR)
{
f.set(clifo.get(CLI_CODPAG));
key = K_TAB; // cosi' scatta l'handler del K_TAB
}
return error_box("Il codice di pagamento e' obbligatorio!\n"
"Se possibile esso verra' proposto, ma potra'\n"
"essere modificato prima di registrare il movimento.");
}
if (key == K_TAB && f.focusdirty())
{
const TString16 dt(m.get(F_DATADOC));
app().set_pagamento(f.get(), dt);
app().set_scadenze(m);
}
}
return TRUE;
@ -345,20 +347,25 @@ bool TPrimanota_application::numrif_handler(TMask_field& f, KEY key)
bool TPrimanota_application::valuta_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
if (key == K_TAB && f.to_check(key, TRUE))
{
TMask& m = f.mask();
TEdit_field& dc = m.efield(SK_DATACAMBIO);
if (dc.get().empty()) // Inizializza data cambio se assente
m.set(SK_DATACAMBIO, m.get(F_DATADOC), TRUE);
/*
const TDate datacam(dc.get());
const TRectype& rec = dc.browse()->cursor()->curr();
const TString& cur = rec.get("CODTAB");
TString16 key; key << f.get() << datacam.string(ANSI);
if (cur != key) // Se non esiste cambio per la nuova valuta
m.set(SK_CAMBIO, "", TRUE);
*/
if (app().is_fattura())
m.set(FS_VALUTA, f.get()); // Copia a pagina 3
}
return TRUE;
}
bool TPrimanota_application::datacambio_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty() && app().is_fattura())
{
TMask& m = f.mask();
m.set(FS_DATACAMBIO, f.get()); // Copia a pagina 3
}
return TRUE;
}
@ -373,20 +380,18 @@ bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
{
TPagamento& pag = app().pagamento();
const real ex(f.get());
pag.set_cambio(ex);
pag.set_cambio(ex); // Aggiorna cambio sul pagamento
TMask& m = f.mask();
if (m.insert_mode())
m.set(FS_CAMBIO, ex); // Copia a pagina 3
if (m.insert_mode()) // Ricalcola tutte le rate
{
pag.set_rate_auto();
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag.set_sheet(ps);
app().pag_rows() = ps.rows_array();
}
// Copio la valuta a pagina 3
const TValuta val(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO);
val.set(m, FS_VALUTA, FS_DATACAMBIO, FS_CAMBIO);
}
}
return TRUE;
@ -594,9 +599,12 @@ bool TPrimanota_application::read_scadenze(TMask& m)
codpag = primarata.get(SCAD_CODPAG);
}
set_pagamento(codpag, datadoc.string());
TPagamento& pag = pagamento();
const TValuta cambio(partita);
const bool in_valuta = cambio.in_valuta();
if (in_valuta)
pag.set_cambio(cambio.cambio());
const real totale = m.get(in_valuta ? SK_TOTDOCVAL : F_TOTALE);
if (totale != partita.importo(in_valuta).valore() ||
@ -615,13 +623,12 @@ bool TPrimanota_application::read_scadenze(TMask& m)
}
imponibile -= imposta;
TPagamento& pag = pagamento();
pag.set_total(imponibile, imposta, spese);
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
pag.zap_rate();
for (int i = 1; i <= partita.rate(); i++)
for (int i = partita.rate(); i > 0; i--)
{
const TRiga_scadenze& scadenza = partita.rata(i);
real importo = scadenza.get(SCAD_IMPORTO);

View File

@ -43,7 +43,7 @@ TPay_mask::TPay_mask() : TMask("cg2100s")
}
void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
const TImporto& importo)
const TImporto& residuo)
{
TRelation rel(LF_PAGSCA); // Working relation
rel.curr() = oldpag;
@ -104,14 +104,13 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
const long numreg = sum.get_long(PART_NREG);
const int numrig = sum.get_int(PART_NUMRIG);
if (in_valuta)
_pagabile = val.lit2val(residuo.valore());
else
_pagabile = residuo.valore();
TReal_field& resp = (TReal_field&)field(S_RESIDUOPAG);
resp.set_decimals(in_valuta ? 3 : 0);
TImporto r(importo);
r -= app().partite().importo_speso(numreg, numrig);
if (in_valuta)
_pagabile = val.lit2val(r.valore());
else
_pagabile = r.valore();
resp.set(_pagabile.string());
_pagabile += oldimp;
@ -287,7 +286,8 @@ class TGame_mask : public TMask
const TBill _conto; // Conto fisso del cliente/fornitore
long _numreg; // Numero movimento contabile
int _numrig; // Riga contabile corrente (prima = 1!)
TImporto _importo; // Importo riga contabile
TImporto _importo; // Importo su riga contabile
TImporto _residuo; // Residuo della riga contabile
int _riga_partite; // Riga corrente delle partite
bool _changed; // Flag di modifica partite
bool _valfirst; // La colonna della valuta precede le lire
@ -313,7 +313,7 @@ protected:
void add_descrizione(TToken_string& s, const TRiga_partite& riga, int pos = -1);
TImporto get_importo(TToken_string& s, int pos) const;
void fill_partite(int anno = 0, const char* numero = "");
void fill_partite();
real aggiorna_residuo();
int update_partita(const TPartita& game, int prow);
@ -484,10 +484,10 @@ real TGame_mask::aggiorna_residuo()
return ZERO;
#else
_importo = app().get_cgs_imp(_numrig-1); // Importo sulla riga contabile
TImporto residuo(_importo);
residuo -= app().partite().importo_speso(_numreg, _numrig); // Sottraggo importi spesi
set(P_RESIDUO, residuo.valore());
return residuo.valore();
_residuo = _importo;
_residuo -= app().partite().importo_speso(_numreg, _numrig); // Residuo della riga
set(P_RESIDUO, _residuo.valore().string());
return _residuo.valore();
#endif
}
@ -520,9 +520,6 @@ bool TGame_mask::cerca_valuta(TValuta& val) const
void TGame_mask::aggiorna_valuta(const TValuta& val)
{
int annorif = 0;
TString16 numrif;
TPartite_array& pa = app().partite();
for (TPartita* game = pa.first(); game; game = pa.next())
{
@ -538,11 +535,6 @@ void TGame_mask::aggiorna_valuta(const TValuta& val)
if (sum.get_long(PART_NREG) == _numreg &&
sum.get_int(PART_NUMRIG) == _numrig)
{
if (annorif == 0)
{
annorif = sum.get_int(PART_ANNO);
numrif = sum.get(PART_NUMPART);
}
TRectype pag(scad.row(p));
real imp(pag.get(PAGSCA_IMPORTOVAL));
val.val2lit(imp);
@ -557,24 +549,7 @@ void TGame_mask::aggiorna_valuta(const TValuta& val)
}
}
}
#ifndef __EXTRA__
if (annorif != 0)
{
const bool proponi = app().causale().tipomov() == 2;
if (proponi)
{
const TMask& cm = app().curr_mask();
const int anno = cm.get_int(F_ANNORIF);
if (anno != 0)
{
annorif = anno;
numrif = cm.get(F_NUMRIF);
}
}
}
#endif
fill_partite(annorif, numrif);
fill_partite();
}
void TGame_mask::aggiorna_sorelle(const TRiga_partite& part) const
@ -612,6 +587,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
gm.set(P_ANNO, anno); // Aggiorna campi di ricerca
gm.set(P_NUMERO, num);
TValuta cambio;
bool in_valuta = FALSE;
if (anno > 0)
@ -633,7 +609,9 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (!riga.is_fattura())
continue;
in_valuta = riga.in_valuta();
cambio.get(riga);
in_valuta = cambio.in_valuta();
riga_fattura.cut(0);
riga_fattura.add(ri);
riga_fattura.add("");
@ -790,7 +768,11 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
if (lastrow > 0)
{
TToken_string& sp = scadenze.row(scadenze.add(""));
sp.add("Saldo ", 4); sp << anno << ' ' << num;
sp.add("Saldo ", 4);
if (cambio.in_valuta())
sp << cambio.codice() << ' ';
sp << anno << ' ' << num;
gm.add_importo(sp, tot_lit);
gm.add_importo(sp, tot_val, TRUE);
}
@ -973,10 +955,6 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
return FALSE; // Ho cliccato su di un saldo (per sbaglio!)
TGame_mask& gm = (TGame_mask&)(m.get_sheet()->mask());
TMask_field& cambio = gm.field(P_CAMBIO);
if (cambio.active() && cambio.get().empty())
return f.error_box("E' necessario specificare un cambio");
const TBill& bill = gm.conto();
const int anno = gm.get_int(P_ANNO);
const TString16 numero = gm.get(P_NUMERO);
@ -989,6 +967,15 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
if (nrata != 0 && nrigp == 0)
{
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);
}
#ifdef __EXTRA__
gm._tipomov = (tipo_movimento) 3;
gm._descr = "";
@ -1009,8 +996,8 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
cambiato = gm.edit_pagamento(game, nriga, nrata, nrigp);
if (cambiato)
{
if (!game.esiste(nriga, nrata, nrigp))
m.stop_run(K_ESC);
if (m.is_running() && !game.esiste(nriga, nrata, nrigp))
m.stop_run(K_FORCE_CLOSE);
}
}
else
@ -1075,8 +1062,8 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
new_game->disable(-1);
gm._tipomov = (tipo_movimento)app().causale().tipomov();
new_game->set(P_NUOVO, gm._tipomov);
new_game->set(P_SEZIONE, gm._importo.sezione());
new_game->set(P_RESIDUO, gm.get(P_RESIDUO));
new_game->set(P_SEZIONE, gm._residuo.sezione());
new_game->set(P_RESIDUO, gm._residuo.valore());
new_game->set(P_DATADOC, cm.get(F_DATADOC));
new_game->set(P_NUMDOC, cm.get(F_NUMDOC));
new_game->set(P_DESCR, cm.get(F_DESCR));
@ -1096,7 +1083,6 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
gm._tipomov = (tipo_movimento)new_game->get_int(P_NUOVO);
gm._codpag = new_game->get(P_CODPAG);
gm._sezione = new_game->get(P_SEZIONE)[0];
gm._importo.set(gm._sezione, real(new_game->get(P_RESIDUO)));
gm._numdoc = new_game->get(P_NUMDOC);
gm._datadoc = new_game->get(P_DATADOC);
gm._descr = new_game->get(P_DESCR);
@ -1125,7 +1111,9 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
#endif
if (game.ok())
{
gm.fill_partite(anno, numero); // Aggiorna sheet partite
gm.set(P_ANNO, anno);
gm.set(P_NUMERO, numero);
gm.fill_partite(); // Aggiorna sheet partite
gm._changed = TRUE;
}
else
@ -1295,9 +1283,11 @@ bool TGame_mask::same_number(const char* key, const char* num) const
return k == n;
}
void TGame_mask::fill_partite(int annorif, const char* numrif)
void TGame_mask::fill_partite()
{
const bool all = get(P_SHOWALL).not_empty();
const int annorif = get_int(P_ANNO); // Anno corrente
const TString numrif = get(P_NUMERO); // Partita corrente
const bool all = get(P_SHOWALL).not_empty(); // Visualizza anche partite chiuse
TString_array& a = partite().rows_array();
a.destroy();
@ -1377,13 +1367,13 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
TRiga_partite& riga = p.riga(nriga);
TRiga_scadenze& scaden = riga.new_row(); // Crea una rata falsa
scaden.put(SCAD_DATASCAD, somma.get(PART_DATADOC));
m.set_pag(oldpag, scaden, _importo);
m.set_pag(oldpag, scaden, _residuo);
riga.destroy_rows(); // Distrugge la rata falsa
}
else
{
const TRiga_scadenze& scaden = p.rata(nriga, nrata);
m.set_pag(oldpag, scaden, _importo);
m.set_pag(oldpag, scaden, _residuo);
}
m.set(S_DESCAGG, somma.get(PART_DESCR));

View File

@ -1074,22 +1074,24 @@ TRectype& TPartita::pagamento(int nriga, int nrata, int nrigp)
return r.row(nrigp);
}
// Controlla l'esistenza di una riga, rata, pagamento.
// Gli ultimi parametri possono essere nulli per poter testare una singola riga o rata
bool TPartita::esiste(int nriga, int nrata, int nrigp) const
{
if (nriga == UNASSIGNED)
if (nriga == UNASSIGNED) // Cerca solo pagamento non assegnato
return _unassigned.exist(nrigp);
if (nrata <= 0)
return _part.exist(nriga);
const bool esiste_riga = _part.exist(nriga);
if (!esiste_riga || nrata <= 0) // Riga non esistente o rata nulla
return esiste_riga;
if (nrigp <= 0)
{
const TRiga_partite& r = riga(nriga);
return r.exist(nrata);
}
const bool esiste_rata = r.exist(nrata);
if (!esiste_rata || nrigp <= 0) // Rata inesistente o pagamento nullo
return esiste_rata;
const TRiga_scadenze& r = rata(nriga, nrata);
return r.exist(nrigp);
const TRiga_scadenze& scad = r.rata(nrata);
return scad.exist(nrigp); // Cerca pagamento vero e proprio
}
// Ritorna l'importo in lire speso su di una riga contabile
@ -1437,11 +1439,12 @@ void TPartita::sposta_riga(int r, TPartita& part)
{
const TRiga_partite& vecchia = riga(j);
TRiga_partite& nuova = part.new_row(part.esiste(j) ? 0 :j);
for (int f = 0; f < vecchia.items(); f++)
for (int n = vecchia.items()-1; n >= 0; n--) // Copia tutti i campi non chiave
{
const char* fnam = vecchia.fieldname(f);
if (knames.get_pos(fnam) < 0)
nuova.put(fnam, vecchia.get(fnam));
const char* f = vecchia.fieldname(n);
if (knames.get_pos(f) < 0)
nuova.put(f, vecchia.get(f));
}
nuova.zero(PART_IMPORTO);
nuova.zero(PART_IMPORTOVAL);
@ -1450,11 +1453,18 @@ void TPartita::sposta_riga(int r, TPartita& part)
address[j] = nuova.get_int(PART_NRIGA);
}
const int nrigp = address[j];
TRectype npg(LF_PAGSCA);
if (part.esiste(r, i, nrigp))
int new_row = prima; // Nuova riga fattura
int new_sca = i; // Nuovo numero rata (uguale a prima)
const int nrigp = address[j]; // Nuova riga somma (e pagamento)
if (!part.esiste(new_row, new_sca)) // Se la nuova partita non ha la rata
new_row = new_sca = UNASSIGNED; // allora sposta sui non asseganti
TRectype npg(LF_PAGSCA); // Nuovo record di pagamento
if (part.esiste(new_row, new_sca, nrigp)) // Se il pagamento esiste di gia'
{
npg = part.pagamento(r, i, nrigp);
npg = part.pagamento(new_row, new_sca, nrigp);
CHECK(npg.get_char(PAGSCA_ACCSAL) != 'S', "Can't add to soldered payment");
somma(pag, npg, PART_IMPORTO);
somma(pag, npg, PART_IMPORTOVAL);
@ -1462,17 +1472,18 @@ void TPartita::sposta_riga(int r, TPartita& part)
}
else
{
if (nrw.exist(i))
npg = nrw.rata(i).new_row(nrigp);
else
if (new_sca == UNASSIGNED)
npg = part.unassigned().row(nrigp, TRUE);
for (int f = 0; f < pag.items(); f++)
else
npg = nrw.rata(new_sca).new_row(nrigp);
for (int n = pag.items()-1; n >= 0; n--) // Copia tutti i campi non chiave
{
const char* fnam = pag.fieldname(f);
if (knames.get_pos(fnam) < 0)
npg.put(fnam, pag.get(fnam));
const char* f = pag.fieldname(n);
if (knames.get_pos(f) < 0)
npg.put(f, pag.get(f));
}
}
const TValuta val;
part.modifica_pagamento(npg, val, FALSE);
scd.elimina_pagamento(j);