Ultime gabriellate
git-svn-id: svn://10.65.10.50/trunk@2187 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
063622cd6c
commit
7cd89ab971
@ -212,8 +212,6 @@ bool BA3700_application::tipo_prima_rata(TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
// aggiunge o toglie se necessario rata 0, lasciando
|
// aggiunge o toglie se necessario rata 0, lasciando
|
||||||
// le altre e shiftando le scadenze
|
// le altre e shiftando le scadenze
|
||||||
// pag->set_tipo_prima_rata()
|
|
||||||
// if (k != K_TAB) return TRUE;
|
|
||||||
if (f.mask().query_mode())
|
if (f.mask().query_mode())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
sht* s = (sht*)get_app_data();
|
sht* s = (sht*)get_app_data();
|
||||||
@ -232,6 +230,7 @@ bool BA3700_application::tipo_prima_rata(TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
pag->set_sheet(*shf);
|
pag->set_sheet(*shf);
|
||||||
(*rws) = shf->rows_array();
|
(*rws) = shf->rows_array();
|
||||||
|
msk->field(F_NUM_RATE).set(format("%d",pag->n_rate()));
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -247,11 +246,12 @@ bool BA3700_application::numero_rate(TMask_field& f, KEY k)
|
|||||||
TMask* msk = s->_msk;
|
TMask* msk = s->_msk;
|
||||||
TArray* rws = s->_rws;
|
TArray* rws = s->_rws;
|
||||||
int nr = msk->get_int(F_NUM_RATE);
|
int nr = msk->get_int(F_NUM_RATE);
|
||||||
if (!pag || nr == pag->n_rate() || msk->get(F_NUM_RATE).empty()) return TRUE;
|
if (!pag || nr == pag->n_rate() || msk->get(F_NUM_RATE).empty())
|
||||||
|
return TRUE;
|
||||||
int ir = msk->get_int(F_INT_RATE);
|
int ir = msk->get_int(F_INT_RATE);
|
||||||
if (ir == 0) ir = -1;
|
if (ir == 0) ir = -1;
|
||||||
|
|
||||||
pag->set_numero_rate(msk->get_int(F_NUM_RATE),ir);
|
pag->set_numero_rate(nr,ir);
|
||||||
if (pag->dirty())
|
if (pag->dirty())
|
||||||
{
|
{
|
||||||
pag->set_sheet(*shf);
|
pag->set_sheet(*shf);
|
||||||
|
@ -261,7 +261,6 @@ BEGIN
|
|||||||
INPUT 103
|
INPUT 103
|
||||||
OUTPUT 103
|
OUTPUT 103
|
||||||
OUTPUT 105
|
OUTPUT 105
|
||||||
ITEM " |Altro pagamento"
|
|
||||||
ITEM "1|Rimessa diretta o contanti"
|
ITEM "1|Rimessa diretta o contanti"
|
||||||
ITEM "2|Tratta"
|
ITEM "2|Tratta"
|
||||||
ITEM "3|Ricevuta Bancaria"
|
ITEM "3|Ricevuta Bancaria"
|
||||||
|
@ -112,7 +112,7 @@ void TPagamento::set_rate_differenziate(int v)
|
|||||||
void TPagamento::set_tipo_prima_rata(int v, int sscad)
|
void TPagamento::set_tipo_prima_rata(int v, int sscad)
|
||||||
{
|
{
|
||||||
_dirty = FALSE;
|
_dirty = FALSE;
|
||||||
if (_tpr == v) return;
|
if (_tpr == v) return;
|
||||||
|
|
||||||
if (v < 4 && _tpr > 3)
|
if (v < 4 && _tpr > 3)
|
||||||
{
|
{
|
||||||
@ -143,6 +143,12 @@ void TPagamento::set_tipo_prima_rata(int v, int sscad)
|
|||||||
tt.add(scad_rata(i+1),0);
|
tt.add(scad_rata(i+1),0);
|
||||||
tt.add(tipo_rata(i+1),2);
|
tt.add(tipo_rata(i+1),2);
|
||||||
tt.add(ulc_rata(i+1), 5);
|
tt.add(ulc_rata(i+1), 5);
|
||||||
|
}
|
||||||
|
if (n_rate() == 2 && scad_rata(1) == 0)
|
||||||
|
{
|
||||||
|
// l'unica rata aveva scadenza 0; ci mettiamo n.giorni default
|
||||||
|
TToken_string& tt = rata(1);
|
||||||
|
tt.add(_int_rate, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_tpr = v;
|
_tpr = v;
|
||||||
@ -680,9 +686,20 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
|
|
||||||
if (ulc != NULL)
|
if (ulc != NULL)
|
||||||
{
|
{
|
||||||
rata(row).add(ulc, 5);
|
for (int k = 0; k < srate.items(); k++)
|
||||||
srate.row(row).add(ulc, 5);
|
{
|
||||||
need_recalc = TRUE;
|
// deve farlo per tutte dalla 1 in poi se rdiff == 2,
|
||||||
|
// soltanto per row diversamente
|
||||||
|
if ((rdiff == 2 && row > 0 && k > 0) || k == row)
|
||||||
|
{
|
||||||
|
TToken_string& tt = rata(k);
|
||||||
|
TToken_string& ss = (TToken_string&)srate[k];
|
||||||
|
tt.add(ulc,5);
|
||||||
|
ss.add(ulc,5);
|
||||||
|
need_recalc = TRUE;
|
||||||
|
// no error is possible
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scad != NULL)
|
if (scad != NULL)
|
||||||
@ -751,8 +768,13 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
// aggiungere il resto sulla 1a rata
|
// aggiungere il resto sulla 1a rata
|
||||||
// controlla se rdiff e' compatibile con
|
// controlla se rdiff e' compatibile con
|
||||||
// i dati e se e' il caso riaggiusta
|
// i dati e se e' il caso riaggiusta
|
||||||
if (rdiff == 3 && (remainder % newv) != 0.0)
|
// -------------------------------- vedi se rimettere -----------------------------------
|
||||||
rdiff = 2;
|
// if (rdiff == 3 && (remainder % newv) != 0.0)
|
||||||
|
// {
|
||||||
|
// warning_box("Il resto non e' divisibile - uso 'Uguali finche' possibile'");
|
||||||
|
// rdiff = 4;
|
||||||
|
// }
|
||||||
|
// ---------------------------------------------------------------------------------------
|
||||||
// *** 10/8/95: se uguali e non e' multiplo intero lo teniamo cosi' e poi
|
// *** 10/8/95: se uguali e non e' multiplo intero lo teniamo cosi' e poi
|
||||||
// *** aggiungiamo alla prima rata utile
|
// *** aggiungiamo alla prima rata utile
|
||||||
// if (rdiff == 2 && !((rmax % newv.integer()) == ZERO))
|
// if (rdiff == 2 && !((rmax % newv.integer()) == ZERO))
|
||||||
@ -816,7 +838,7 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
for (int j = srate.items()-1; j >= frs; j--) _rate.destroy(j);
|
for (int j = srate.items()-1; j >= frs; j--) _rate.destroy(j);
|
||||||
|
|
||||||
const int n = srate.items(); // questo rimane per forza costante
|
const int n = srate.items(); // questo rimane per forza costante
|
||||||
if (rdiff == 2 && n > 1)
|
if (rdiff == 2 && n > 1+first)
|
||||||
{
|
{
|
||||||
// HERE
|
// HERE
|
||||||
real tot = is_perc_modified ? real(100.0) : (_tpr < 4 ? _firstr : _secndr);
|
real tot = is_perc_modified ? real(100.0) : (_tpr < 4 ? _firstr : _secndr);
|
||||||
@ -832,9 +854,9 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
// inferiore al minimo
|
// inferiore al minimo
|
||||||
if (nimp.sign() < 0) { _rate = srate; return P_NEG; }
|
if (nimp.sign() < 0) { _rate = srate; return P_NEG; }
|
||||||
real remainder = tot - nimp;
|
real remainder = tot - nimp;
|
||||||
real div = remainder / real(n - 1);
|
real div = remainder / real(n - 1 - first);
|
||||||
div.round(is_perc_modified ? 2 : _round);
|
div.round(is_perc_modified ? 2 : _round);
|
||||||
nimp = tot - (div * real(n-1));
|
nimp = tot - (div * real(n-1-first));
|
||||||
|
|
||||||
for (int k = first; k < n; k++)
|
for (int k = first; k < n; k++)
|
||||||
{
|
{
|
||||||
@ -868,8 +890,8 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
real div = rest / nimp;
|
real div = rest / nimp;
|
||||||
if (div < real(1.0)) { _rate = srate; return P_TROP; }
|
if (div < real(1.0)) { _rate = srate; return P_TROP; }
|
||||||
|
|
||||||
int nr = (int)div.integer() + (_tpr > 4 ? 2 : 1);
|
int nr = (int)div.integer() + (_tpr > 3 ? 2 : 1);
|
||||||
real reminder = rest - (nimp * real(nr -1));
|
real reminder = rest - (nimp * real(nr - 1 - first));
|
||||||
rfirst += reminder;
|
rfirst += reminder;
|
||||||
for (int k = first; k < nr; k++)
|
for (int k = first; k < nr; k++)
|
||||||
{
|
{
|
||||||
@ -933,11 +955,16 @@ word TPagamento::recalc_rate(int row, bool is_perc_modified,
|
|||||||
if ((mx - sum) < newv)
|
if ((mx - sum) < newv)
|
||||||
{
|
{
|
||||||
// add remainder on first rate
|
// add remainder on first rate
|
||||||
newv += (mx - sum);
|
newv += (mx - sum);
|
||||||
|
if (rdiff == 3)
|
||||||
|
{
|
||||||
|
newv = is_perc_modified ? perc_rata(first) : tpay_rata(first);
|
||||||
|
newv += (mx - sum);
|
||||||
|
}
|
||||||
if (!is_perc_modified)
|
if (!is_perc_modified)
|
||||||
set_imprata(frs, newv);
|
set_imprata(first, newv);
|
||||||
else {
|
else {
|
||||||
TToken_string& t = rata(frs);
|
TToken_string& t = rata(first);
|
||||||
t.add(newv.string(), 1);
|
t.add(newv.string(), 1);
|
||||||
}
|
}
|
||||||
remove_rata(j);
|
remove_rata(j);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user