Patch level : 12.0 824

Files correlati     : ef0.exe
Commento            : Corretta ricerca IBAN da cfven (non esiste) a cfban/tab(BAN)
This commit is contained in:
Simone Palacino 2019-06-13 17:40:53 +02:00
parent 76ab6fec41
commit 02b8cce7e3
3 changed files with 52 additions and 3 deletions

View File

@ -8,6 +8,9 @@
#include <comuni.h>
#include <doc.h>
#include "../cg/cfban.h"
#include "tabutil.h"
#include "utility.h"
///////////////////////////////////////////////////////////////
// Classe per la gestione di effetti con metodi standard di: //
@ -363,9 +366,7 @@ bool TVariazione_effetti::clifo_handler(TMask_field& f, KEY k)
if (k == K_TAB && f.to_check(k))
{
TMask& m = f.mask();
TString8 str;
str << m.get(F_TIPOCF) << '|' << m.get(F_CODCF);
const TString& iban = cache().get(LF_CFVEN, str, "IBAN");
TString iban; iban << get_iban(m.get(F_CODCF));
if (iban.not_empty())
{
m.set(F_IBAN, iban);

View File

@ -6,6 +6,9 @@
#include <progind.h>
#include <utility.h>
#include <config.h>
#include "../cg/cfban.h"
#include "../cg/cgsaldac.h"
#include "tabutil.h"
///////////////////////////////////////////////////////////
// TPerformance_profiler
@ -719,3 +722,44 @@ TString& to_tstring(int n)
{
return to_tstring(static_cast<long>(n));
}
bool get_bnp_iban(const TString& abi, const TString& cab, int nprog, TString& iban)
{
TTable bnp("BNP");
TString16 key;
key << abi << cab;
if (nprog > 0)
{
TString4 sprog;
sprog.format("%02d", nprog);
key << sprog;
}
bnp.put("CODTAB", key);
int err = bnp.read(_isgteq);
if (err == NOERR && !bnp.get("CODTAB").starts_with(abi))
err = _iskeynotfound;
if (err == NOERR)
iban = bnp.get("S3");
return err == NOERR;
}
TString get_iban(const TString& codcf)
{
TString iban;
TToken_string key;
key.add("C");
key.add(codcf);
key.add("V");
key.add(1);
const TRectype& cfban = cache().get(LF_CFBAN, key);
if (!cfban.empty())
{
const TString& abi_cf = cfban.get(CFBAN_ABI);
const TString& cab_cf = cfban.get(CFBAN_CAB);
const bool found_cf = abi_cf.full() && cab_cf.full();
iban = cfban.get(CFBAN_IBAN);
if (found_cf && iban.blank())
get_bnp_iban(abi_cf, cab_cf, -1, iban);
}
return iban;
}

View File

@ -80,4 +80,8 @@ TString& to_tstring(long n);
TString& to_tstring(int n);
inline bool is_multi_table(const int file) { return file == LF_TAB || file == LF_TABGEN || file == LF_TABCOM || file == LF_TABMOD; }
TString get_iban(const TString& codcf);
#endif /* __UTILITY_H */