Corretta gestione modifica rata in prima nota
git-svn-id: svn://10.65.10.50/trunk@1942 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a57f4d2b69
commit
919e99206f
@ -552,6 +552,11 @@ void TPrimanota_application::init_modify_mode(TMask& m)
|
||||
{
|
||||
const long numreg = m.get_long(F_NUMREG);
|
||||
partite().add_numreg(numreg);
|
||||
if (iva() != nessuna_iva)
|
||||
{
|
||||
const TPartita* game = partite().first();
|
||||
m.enable(DLG_DELREC, game == NULL || !game->esistono_abbuoni_diffcam());
|
||||
}
|
||||
}
|
||||
|
||||
calcola_saldo(); // Verifica eventuali sbilanci contabili
|
||||
|
@ -1864,14 +1864,14 @@ bool TPrimanota_application::totdocval_handler(TMask_field& f, KEY key)
|
||||
if (totale.is_zero())
|
||||
{
|
||||
totval *= cambio;
|
||||
m.set(F_TOTALE, totval.string());
|
||||
m.set(F_TOTALE, totval.string(), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cambio.is_zero())
|
||||
{
|
||||
totale /= totval;
|
||||
m.set(S_CAMBIO, totale.string());
|
||||
m.set(S_CAMBIO, totale.string(), TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +162,10 @@ bool TPrimanota_application::cambio_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
const real ex(f.get());
|
||||
pag->set_cambio(ex);
|
||||
|
||||
TSheet_field& ps = app().pags();
|
||||
pag->set_sheet(ps);
|
||||
ps.force_update();
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -292,11 +296,14 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
||||
const real spese(0.0);
|
||||
|
||||
TPagamento& pag = *pagamento();
|
||||
|
||||
bool in_valuta = FALSE;
|
||||
if (cambio.sign() > 0)
|
||||
{
|
||||
pag.set_cambio(cambio);
|
||||
imponibile = real(m.get(S_TOTDOCVAL));
|
||||
imposta = ZERO;
|
||||
imposta = ZERO;
|
||||
in_valuta = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -335,22 +342,26 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
||||
// se invece la maschera contiene importi diversi da quelli
|
||||
// registrati si passa la palla al culano/a
|
||||
// TBC controllo se imponibile deve contenere le spese
|
||||
else if ((imponibile + imposta) != partita.get_real(PART_IMPORTO) ||
|
||||
imposta != partita.get_real(PART_IMPOSTA) ||
|
||||
spese != partita.get_real(PART_SPESE))
|
||||
else
|
||||
{
|
||||
fromscratch = !yesno_box("Gli importi totali delle scadenze sono stati modificati rispetto"
|
||||
" all'ultima registrazione. Si desidera mantenere"
|
||||
" comunque la rateazione precedente");
|
||||
// nel qual caso, of course, si disabilitano gli automatismi
|
||||
if(!fromscratch) m.field(FS_RECALC).set("");
|
||||
}
|
||||
if ((imponibile + imposta) != partita.get_real(in_valuta ? PART_IMPORTOVAL : PART_IMPORTO) ||
|
||||
imposta != partita.get_real(PART_IMPOSTA) ||
|
||||
spese != partita.get_real(PART_SPESE))
|
||||
{
|
||||
fromscratch = !yesno_box("Gli importi totali delle scadenze sono stati modificati rispetto"
|
||||
" all'ultima registrazione. Si desidera mantenere"
|
||||
" comunque la rateazione precedente");
|
||||
// nel qual caso, of course, si disabilitano gli automatismi
|
||||
if(!fromscratch) m.field(FS_RECALC).set("");
|
||||
}
|
||||
}
|
||||
|
||||
if (fromscratch)
|
||||
{
|
||||
pag.set_rate_auto();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
pag.zap_rate();
|
||||
for (int i = 1; i <= partita.rate(); i++)
|
||||
{
|
||||
@ -382,6 +393,12 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
||||
m.set(FS_AGENTE, scadenza.get(SCAD_CODAG));
|
||||
}
|
||||
}
|
||||
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" : "");
|
||||
m.set(FS_RECALC, "X", TRUE);
|
||||
m.set(FS_NRATE, pag.n_rate());
|
||||
} //else
|
||||
}
|
||||
else
|
||||
@ -400,14 +417,10 @@ bool TPrimanota_application::read_scadenze(TMask& m)
|
||||
m.disable(-2); // Disabilita fornitore
|
||||
m.disable(-3); // Disabilita cambio
|
||||
m.disable(F_CODPAG); // Disabilita codice pagamento
|
||||
// m.disable(F_ANNORIF); // Disabilita anno partita
|
||||
// m.disable(F_NUMRIF); // Disabilita numero partita
|
||||
m.disable(FS_RESET); // Disabilita tasto di reset
|
||||
m.set(FS_RECALC, "", TRUE); // Disabilita ricalcolo automatico
|
||||
m.disable(FS_RECALC);
|
||||
}
|
||||
else
|
||||
m.set(FS_RECALC, "X");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
if (!diff.is_zero())
|
||||
{
|
||||
TToken_string& rdiff = scadenze.row(scadenze.add(""));
|
||||
rdiff.add("Differenza cambio rata ", 4); rdiff << ra;
|
||||
rdiff.add("Differ. cambio rata ", 4); rdiff << ra;
|
||||
add_importo(rdiff, diff.normalize());
|
||||
}
|
||||
}
|
||||
@ -550,7 +550,7 @@ 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 partita ", 4); sp << anno << ' ' << num;
|
||||
sp.add("Saldo ", 4); sp << anno << ' ' << num;
|
||||
add_importo(sp, tot_lit.normalize());
|
||||
add_importo(sp, tot_val.normalize(), 2);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ NUMBER 102 15
|
||||
BEGIN
|
||||
PROMPT 1 3 "Importo "
|
||||
PICTURE "."
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
BOOLEAN 111
|
||||
@ -22,14 +21,12 @@ NUMBER 103 15 2
|
||||
BEGIN
|
||||
PROMPT 1 4 "Importo valuta "
|
||||
PICTURE ".2"
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
NUMBER 104 8 3
|
||||
NUMBER 104 6 2
|
||||
BEGIN
|
||||
PROMPT 1 2 "Percentuale "
|
||||
PICTURE ".3"
|
||||
FLAGS "R"
|
||||
PICTURE ".2"
|
||||
END
|
||||
|
||||
NUMBER 105 2 0
|
||||
|
@ -36,7 +36,7 @@ BEGIN
|
||||
ITEM "4|Uguali finche' possibile" MESSAGE DISABLE,FS_NRATE
|
||||
END
|
||||
|
||||
NUMBER FS_NRATE 3 0
|
||||
NUMBER FS_NRATE 3
|
||||
BEGIN
|
||||
PROMPT 36 6 "Numero di rate "
|
||||
END
|
||||
@ -142,7 +142,7 @@ BEGIN
|
||||
USE AGE
|
||||
INPUT CODTAB FS_AGENTE
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione @50" S0
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT FS_AGENTE CODTAB
|
||||
OUTPUT FS_DESCAGENTE S0
|
||||
CHECKTYPE NORMAL
|
||||
@ -153,7 +153,7 @@ BEGIN
|
||||
PROMPT 27 10 ""
|
||||
USE AGE KEY 2
|
||||
INPUT S0 FS_DESCAGENTE
|
||||
DISPLAY "Descrizione @50" S0
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT FS_AGENTE
|
||||
CHECKTYPE NORMAL
|
||||
@ -165,7 +165,7 @@ BEGIN
|
||||
ITEM "Scadenza@10"
|
||||
ITEM "Importo@15"
|
||||
ITEM "In Valuta@15"
|
||||
ITEM "Percentuale@12"
|
||||
ITEM "%@6"
|
||||
ITEM "Tipo"
|
||||
ITEM "Pagamento@32"
|
||||
ITEM "Ns.ABI"
|
||||
|
2775
cg/pagament.cpp
2775
cg/pagament.cpp
File diff suppressed because it is too large
Load Diff
@ -875,7 +875,20 @@ bool TPartita::utilizzata(int nrigp) const
|
||||
}
|
||||
}
|
||||
return _unassigned.exist(nrigp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TPartita::esistono_abbuoni_diffcam() const
|
||||
{
|
||||
for (int r = last(); r > 0; r = pred(r))
|
||||
{
|
||||
const TRiga_partite& row = riga(r);
|
||||
if (!row.get_real(PART_ABBUONI).is_zero() || !row.get_real(PART_DIFFCAM).is_zero())
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool TPartita::modifica_pagamento(const TRectype& new_pag, const TValuta& valuta,
|
||||
char& old_ap, TImporto& old_abb, TImporto& old_diffcam,
|
||||
@ -1094,7 +1107,14 @@ void TPartita::scollega_pagamenti(int r, int s)
|
||||
pag.put(PAGSCA_ACCSAL, 'A');
|
||||
pag.put(PAGSCA_NRIGA, (int)TPartita::UNASSIGNED);
|
||||
pag.put(PAGSCA_NRATA, (int)TPartita::UNASSIGNED);
|
||||
_unassigned.add_row(pag);
|
||||
if (_unassigned.exist(j))
|
||||
{
|
||||
TRectype& unas = _unassigned.row(j, FALSE);
|
||||
somma(pag, unas, PAGSCA_IMPORTO);
|
||||
somma(pag, unas, PAGSCA_IMPORTOVAL);
|
||||
}
|
||||
else
|
||||
_unassigned.add_row(pag);
|
||||
sc.rows_array().destroy_row(j);
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,7 @@ public:
|
||||
TRectype& pagamento(int nriga, int nrata, int nrigp);
|
||||
bool rata_chiusa(int nriga, int nrata) const;
|
||||
bool esiste(int nriga, int nrata = 0, int nrigp = 0) const;
|
||||
bool esistono_abbuoni_diffcam() const;
|
||||
|
||||
// assegna riga e figli ad altra partita
|
||||
void sposta_riga(int r, TPartita& part);
|
||||
|
Loading…
x
Reference in New Issue
Block a user