Patch level : 10.0
Files correlati : ef0.exe Ricompilazione Demo : [ ] Commento : 0001566: Disposizioni incassi/pagamenti: ef0 -9 Nella generazione delle distinte di incasso/pagamento direttamente da saldaconto occorre controllare l'esistenza sull'anagrafica Cli/For dei codici ABI e CAB! O meglio l'obbligatorietà dovrebbe essere solo per i clienti nel caso di riba e fornitori nel caso di bonifici! git-svn-id: svn://10.65.10.50/trunk@20184 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ffa34ea1d2
commit
43ce17527b
133
ef/ef0a00.cpp
133
ef/ef0a00.cpp
@ -120,9 +120,9 @@ bool TPE_mask::calc_residual(const TRiga_scadenze& scad,
|
|||||||
|
|
||||||
const long codcf = scad.get_long(SCAD_SOTTOCONTO);
|
const long codcf = scad.get_long(SCAD_SOTTOCONTO);
|
||||||
TString80 expr;
|
TString80 expr;
|
||||||
expr << '(' << LF_EFFETTI << "->EFFCONT!=\"X\")&&";
|
expr << '(' << LF_EFFETTI << "->" << EFF_EFFCONT << "!=\"X\")&&";
|
||||||
expr << '(' << LF_EFFETTI << "->TIPOCF==\"" << tipocf << "\")&&";
|
expr << '(' << LF_EFFETTI << "->" << EFF_TIPOCF << "==\"" << tipocf << "\")&&";
|
||||||
expr << '(' << LF_EFFETTI << "->CODCF==\"" << codcf << "\")";
|
expr << '(' << LF_EFFETTI << "->" << EFF_CODCF << "==\"" << codcf << "\")";
|
||||||
cur.setfilter(expr, TRUE);
|
cur.setfilter(expr, TRUE);
|
||||||
const long items = cur.items();
|
const long items = cur.items();
|
||||||
if (items > 0L)
|
if (items > 0L)
|
||||||
@ -162,35 +162,32 @@ bool TPE_mask::calc_residual(const TRiga_scadenze& scad,
|
|||||||
|
|
||||||
void TPE_mask::update_total()
|
void TPE_mask::update_total()
|
||||||
{
|
{
|
||||||
real tot;
|
|
||||||
TSheet_field& s = sfield(F_SHEET);
|
TSheet_field& s = sfield(F_SHEET);
|
||||||
const int postot = s.cid2index(F_IMPORTO);
|
const int postot = s.cid2index(F_IMPORTO);
|
||||||
|
real tot;
|
||||||
FOR_EACH_SHEET_ROW_BACK(s, r, row)
|
FOR_EACH_SHEET_ROW_BACK(s, r, row)
|
||||||
tot += real(row->get(postot));
|
tot += real(row->get(postot));
|
||||||
set(F_TOTAL, tot);
|
set(F_TOTAL, tot);
|
||||||
if (tot==ZERO)
|
enable(DLG_SAVEREC, !tot.is_zero());
|
||||||
disable(DLG_SAVEREC);
|
|
||||||
else
|
|
||||||
enable(DLG_SAVEREC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPE_mask::fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& partially_unassigned, bool force, bool is_old)
|
bool TPE_mask::fill_row(const TRiga_scadenze& rs, TToken_string& row, bool& partially_unassigned, bool force, bool is_old)
|
||||||
{
|
{
|
||||||
const int tipopageff = get_int(F_TIPOPAGEFF);
|
const int tipopageff = get_int(F_TIPOPAGEFF);
|
||||||
int tipopag;
|
int tipopag = 0;
|
||||||
real impres, imppag;
|
real impres, imppag;
|
||||||
char accsal; int rigadist, rigaeff;
|
char accsal; int rigadist, rigaeff;
|
||||||
row.cut(0);
|
row.cut(0);
|
||||||
bool ok = calc_residual(rs, impres, imppag, accsal, rigadist, rigaeff, partially_unassigned, tipopag, is_old) || force;
|
bool ok = calc_residual(rs, impres, imppag, accsal, rigadist, rigaeff, partially_unassigned, tipopag, is_old) || force;
|
||||||
if (ok)
|
if (ok)
|
||||||
ok = tipopag == tipopageff || tipopageff == 0;
|
ok = tipopageff == 0 || tipopag == tipopageff; // Eventuale filtro sul tipo pagamento
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
row.add(imppag.string());
|
row.add(imppag.string());
|
||||||
row.add(accsal);
|
row.add(accsal);
|
||||||
row.add(impres.string());
|
row.add(impres.string());
|
||||||
row.add(rs.get_long(SCAD_SOTTOCONTO));
|
row.add(rs.get_long(SCAD_SOTTOCONTO));
|
||||||
TString16 cod; cod << rs.get_char(SCAD_TIPOCF) << '|' << rs.get_long(SCAD_SOTTOCONTO);
|
TString8 cod; cod << rs.get_char(SCAD_TIPOCF) << '|' << rs.get_long(SCAD_SOTTOCONTO);
|
||||||
row.add(cache().get(LF_CLIFO, cod, CLI_RAGSOC));
|
row.add(cache().get(LF_CLIFO, cod, CLI_RAGSOC));
|
||||||
row.add(rs.get(SCAD_ANNO));
|
row.add(rs.get(SCAD_ANNO));
|
||||||
row.add(rs.get(SCAD_NUMPART));
|
row.add(rs.get(SCAD_NUMPART));
|
||||||
@ -505,54 +502,64 @@ TRectype& TPE_mask::new_row_effetto(TDistinta& dist, char tipocf, long codcf,
|
|||||||
bool TPE_mask::check_bank(TEffetto& effetto, TLog_report& log) const
|
bool TPE_mask::check_bank(TEffetto& effetto, TLog_report& log) const
|
||||||
{
|
{
|
||||||
const int tipopag = effetto.get_int(EFF_TIPOPAG);
|
const int tipopag = effetto.get_int(EFF_TIPOPAG);
|
||||||
if (tipopag != 3 && tipopag != 9) // Controllo solo ri.ba. e bonifici
|
const int tipocf = effetto.get_char(EFF_TIPOCF);
|
||||||
return true;
|
|
||||||
|
|
||||||
TString8 abi = effetto.get(EFF_CODABI);
|
// Controllo solo ri.ba. clienti e bonifici fornitori
|
||||||
TString8 cab = effetto.get(EFF_CODCAB);
|
if ((tipocf=='F') ? (tipopag==9) : (tipopag==3))
|
||||||
TString80 iban = effetto.get(EFF_IBAN);
|
|
||||||
|
|
||||||
TToken_string key;
|
|
||||||
key = effetto.get(EFF_TIPOCF);
|
|
||||||
key.add(effetto.get(EFF_CODCF));
|
|
||||||
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
|
||||||
|
|
||||||
if (atol(abi) == 0 || atol(cab) == 0L)
|
|
||||||
{
|
{
|
||||||
abi = clifo.get(CLI_CODABI);
|
TString8 abi = effetto.get(EFF_CODABI);
|
||||||
cab = clifo.get(CLI_CODCAB);
|
TString8 cab = effetto.get(EFF_CODCAB);
|
||||||
}
|
TString80 iban = effetto.get(EFF_IBAN);
|
||||||
if (iban.blank())
|
|
||||||
iban = clifo.get(CLI_IBAN);
|
|
||||||
if (iban.starts_with("IT") && atol(abi)> 0 && atol(cab)>0)
|
|
||||||
{
|
|
||||||
TString16 abicab; abicab << abi << cab;
|
|
||||||
if (iban.mid(5, 10) != abicab)
|
|
||||||
iban.cut(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
effetto.put(EFF_CODABI, abi);
|
TToken_string key(8);
|
||||||
effetto.put(EFF_CODCAB, cab);
|
key = effetto.get(EFF_TIPOCF);
|
||||||
effetto.put(EFF_IBAN, iban);
|
key.add(effetto.get(EFF_CODCF));
|
||||||
|
const TRectype& clifo = cache().get(LF_CLIFO, key);
|
||||||
|
|
||||||
if (tipopag == 3 && (atol(abi)==0 || atol(cab)==0))
|
if (real::is_null(abi) || real::is_null(cab))
|
||||||
{
|
{
|
||||||
TString msg;
|
abi = clifo.get(CLI_CODABI);
|
||||||
msg.format(FR("Impossibile determinare ABI/CAB del %s sull'effetto %ld"),
|
cab = clifo.get(CLI_CODCAB);
|
||||||
(const char*)key, effetto.get_long(EFF_NPROGTR));
|
}
|
||||||
log.log(2, msg);
|
if (iban.blank())
|
||||||
return false;
|
iban = clifo.get(CLI_IBAN);
|
||||||
|
if (iban.starts_with("IT"))
|
||||||
|
{
|
||||||
|
if (real::is_null(abi) || real::is_null(cab))
|
||||||
|
{
|
||||||
|
abi = iban.mid( 5, 5);
|
||||||
|
cab = iban.mid(10, 5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TString16 abicab; abicab << abi << cab;
|
||||||
|
if (iban.mid(5, 10) != abicab)
|
||||||
|
iban.cut(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
effetto.put(EFF_CODABI, abi);
|
||||||
|
effetto.put(EFF_CODCAB, cab);
|
||||||
|
effetto.put(EFF_IBAN, iban);
|
||||||
|
|
||||||
|
if (tipopag == 3 && (real::is_null(abi) || real::is_null(cab)))
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg.format(FR("Impossibile determinare ABI/CAB del %s sull'effetto %ld"),
|
||||||
|
(const char*)key, effetto.get_long(EFF_NPROGTR));
|
||||||
|
log.log(2, msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tipopag == 9 && iban.blank())
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg.format(FR("Impossibile determinare IBAN del %s sull'effetto %ld"),
|
||||||
|
(const char*)key, effetto.get_long(EFF_NPROGTR));
|
||||||
|
log.log(2, msg);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tipopag == 9 && iban.blank())
|
|
||||||
{
|
|
||||||
TString msg;
|
|
||||||
msg.format(FR("Impossibile determinare IBAN del %s sull'effetto %ld"),
|
|
||||||
(const char*)key, effetto.get_long(EFF_NPROGTR));
|
|
||||||
log.log(2, msg);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,14 +594,14 @@ void TPE_mask::save_rate()
|
|||||||
const bool eurocambio = get_bool(F_EURO);
|
const bool eurocambio = get_bool(F_EURO);
|
||||||
const int tipopag = get_int(F_TIPOPAG);
|
const int tipopag = get_int(F_TIPOPAG);
|
||||||
|
|
||||||
bool zeroes = FALSE; // Esistono righe effetto da cancellare
|
bool zeroes = false; // Esistono righe effetto da cancellare
|
||||||
|
|
||||||
TSheet_field& sheet = sfield(F_SHEET);
|
TSheet_field& sheet = sfield(F_SHEET);
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, row)
|
FOR_EACH_SHEET_ROW(sheet, r, row)
|
||||||
{
|
{
|
||||||
real imp = row->get(sheet.cid2index(F_IMPORTO));
|
real imp = row->get(sheet.cid2index(F_IMPORTO));
|
||||||
real impval;
|
real impval;
|
||||||
if (codval.not_empty() && !imp.is_zero())
|
if (codval.full() && !imp.is_zero())
|
||||||
{
|
{
|
||||||
impval = imp;
|
impval = imp;
|
||||||
TCurrency c(impval, codval, cambio, eurocambio ? _exchange_contro : _exchange_base);
|
TCurrency c(impval, codval, cambio, eurocambio ? _exchange_contro : _exchange_base);
|
||||||
@ -648,6 +655,7 @@ void TPE_mask::save_rate()
|
|||||||
|
|
||||||
TEffetto& eff = distinta[rigadist-1];
|
TEffetto& eff = distinta[rigadist-1];
|
||||||
eff.put(EFF_DATASCAD, scad.get(SCAD_DATASCAD));
|
eff.put(EFF_DATASCAD, scad.get(SCAD_DATASCAD));
|
||||||
|
eff.put(EFF_TIPOPAG, tipopag);
|
||||||
eff.put(EFF_CODABI, abi);
|
eff.put(EFF_CODABI, abi);
|
||||||
eff.put(EFF_CODCAB, cab);
|
eff.put(EFF_CODCAB, cab);
|
||||||
eff.put(EFF_IBAN, iban);
|
eff.put(EFF_IBAN, iban);
|
||||||
@ -657,16 +665,15 @@ void TPE_mask::save_rate()
|
|||||||
check_bank(eff, log); // Cerca di sistemare ABI/CAB/IBAN
|
check_bank(eff, log); // Cerca di sistemare ABI/CAB/IBAN
|
||||||
|
|
||||||
TRectype& reff = eff.row_r(rigaeff);
|
TRectype& reff = eff.row_r(rigaeff);
|
||||||
real oldimp = reff.get(REFF_IMPORTO);
|
const real oldimp = reff.get(REFF_IMPORTO);
|
||||||
real oldimpval = reff.get(REFF_IMPORTOVAL);
|
const real oldimpval = reff.get(REFF_IMPORTOVAL);
|
||||||
reff.put(REFF_IMPORTO, imp);
|
reff.put(REFF_IMPORTO, imp);
|
||||||
reff.put(REFF_IMPORTOVAL, impval);
|
reff.put(REFF_IMPORTOVAL, impval);
|
||||||
reff.put(REFF_ACCSAL, accsal);
|
reff.put(REFF_ACCSAL, accsal);
|
||||||
|
if (accsal != 'S' && imp.is_zero())
|
||||||
if (imp.is_zero() && accsal != 'S')
|
|
||||||
{
|
{
|
||||||
reff.put(REFF_ACCSAL, 'Z'); // Segna la riga come NULLA
|
reff.put(REFF_ACCSAL, 'Z'); // Segna la riga come NULLA
|
||||||
zeroes = TRUE;
|
zeroes = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -723,7 +730,7 @@ void TPE_mask::save_rate()
|
|||||||
dati_dist.add(get(F_DATADIST));
|
dati_dist.add(get(F_DATADIST));
|
||||||
dati_dist.add(get(F_ABI));
|
dati_dist.add(get(F_ABI));
|
||||||
dati_dist.add(get(F_CAB));
|
dati_dist.add(get(F_CAB));
|
||||||
distinta.write(FALSE, &dati_dist);
|
distinta.write(false, &dati_dist);
|
||||||
|
|
||||||
if (log.recordset()->items() > 0)
|
if (log.recordset()->items() > 0)
|
||||||
log.preview();
|
log.preview();
|
||||||
@ -784,7 +791,7 @@ bool TPE_mask::on_sheet_event(TOperable_field& o, TField_event e, long jolly)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case se_notify_modify:
|
case se_notify_modify:
|
||||||
_spork = TRUE;
|
_spork = true;
|
||||||
update_total();
|
update_total();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user