Patch level : 12.0 856
Files correlati : fp0.exe Commento : Aggiunto controllo per fornitore tipo 4: non associo
This commit is contained in:
parent
57d4f72909
commit
d0290e9d19
@ -19,6 +19,7 @@
|
||||
|
||||
enum
|
||||
{
|
||||
tipo_forn_4 = -16, // Trovato fornitore ma ha tipo 4. Da inserire a manina.
|
||||
no_cf = -14, // Non trovato con cod. fisc. (se non ho nemmeno la p.iva)
|
||||
no_match_cf = -15, // Trovato forn. ma il cod. fisc non corrisponde
|
||||
no_forn = -5, // Non trovato forn. con p.iva
|
||||
@ -400,6 +401,9 @@ void TPassive_mask::add_row_err_forn(const int forn_code, TSheet_field& sf_err,
|
||||
case no_cf:
|
||||
row_err.add("Fornitore senza P. IVA, non trovato il codice fiscale");
|
||||
break;
|
||||
case tipo_forn_4:
|
||||
row_err.add("Fornitore con codice 4. Inserire manualmente il fornitore giusto.");
|
||||
break;
|
||||
default:
|
||||
row_err.add("Errore durante identificazione fornitore.");
|
||||
break;
|
||||
@ -459,18 +463,15 @@ void TPassive_mask::auto_assoc()
|
||||
|
||||
int TPassive_mask::find_fornitore(TLocalisamfile& clifo)
|
||||
{
|
||||
TString paa_codfisc = fp_db().sq_get("COD_FISC");
|
||||
const TString paa_piva = fp_db().sq_get("P_IVA");
|
||||
TString paa_codpaese = fp_db().sq_get("COD_PAESE");
|
||||
const TString fppro_tipocf = fp_db().sq_get("TIPO_CF");
|
||||
TString fppro_codcf = fp_db().sq_get("COD_CLIFOR");
|
||||
TString paa_codfisc = fp_db().sq_get("COD_FISC");
|
||||
const TString paa_piva = fp_db().sq_get("P_IVA");
|
||||
TString paa_codpaese = fp_db().sq_get("COD_PAESE");
|
||||
const TString fppro_tipocf = fp_db().sq_get("TIPO_CF");
|
||||
TString fppro_codcf = fp_db().sq_get("COD_CLIFOR");
|
||||
|
||||
// Cerco se il fornitore è presente in Campo
|
||||
int found_clifo = -1;
|
||||
|
||||
if (fppro_codcf == "17")
|
||||
bool simo = true;
|
||||
|
||||
TString piva;
|
||||
// Leggo dall FPPRO se è già stato salvato il fornitore
|
||||
// Se è già salvato nell FPPRO ricerco in Campo col codice fornitore (chiave 1)
|
||||
@ -479,56 +480,57 @@ int TPassive_mask::find_fornitore(TLocalisamfile& clifo)
|
||||
clifo.setkey(1);
|
||||
clifo.put(CLI_CODCF, fppro_codcf);
|
||||
// Se trovo dall FPPRO setto a 0
|
||||
clifo.read() == NOERR ? found_clifo = 0 : found_clifo = -3;
|
||||
clifo.read() == NOERR ? found_clifo = saved_db : found_clifo = err_match_db;
|
||||
}
|
||||
else if (paa_codpaese.full() && (piva = paa_piva).full()) // Se non c'è nell FPPRO ricerco con chiave 5
|
||||
{
|
||||
if (piva == "01903590154")
|
||||
bool simo = true;
|
||||
clifo.setkey(5);
|
||||
clifo.put(CLI_STATOPAIV, paa_codpaese);
|
||||
clifo.put(CLI_PAIV, paa_piva);
|
||||
clifo.read() == NOERR ? found_clifo = 2 : found_clifo = -1; // Se trovo con partita iva setto a 2
|
||||
clifo.read() == NOERR ? found_clifo = found_piva : found_clifo = -1; // Se trovo con partita iva setto a 2
|
||||
|
||||
if (found_clifo != 2 && paa_codpaese == "IT") // Se non l'ho trovato potrebbe essere italiano e ha codice paese blank
|
||||
if (found_clifo != found_piva && paa_codpaese == "IT") // Se non l'ho trovato potrebbe essere italiano e ha codice paese blank
|
||||
{
|
||||
clifo.put(CLI_PAIV, paa_piva);
|
||||
clifo.put(CLI_STATOPAIV, "");
|
||||
clifo.read() == NOERR ? found_clifo = 2 : found_clifo = -5; // Se trovo con partita iva setto a 2
|
||||
clifo.read() == NOERR ? found_clifo = found_piva : found_clifo = no_forn; // Se trovo con partita iva setto a 2
|
||||
}
|
||||
// Se trovo con p.iva controllo il cod. fisc. e, se c'è da db e se c'è in clienti-fornitori, altrimenti vado avanti
|
||||
if (found_clifo == 2 && paa_codfisc.full() && clifo.get(CLI_COFI).full())
|
||||
if (found_clifo == found_piva && paa_codfisc.full() && clifo.get(CLI_COFI).full())
|
||||
{
|
||||
if (clifo.get(CLI_COFI) == paa_codfisc) // Controllo che il cod fisc (se c'è) corrisponda
|
||||
found_clifo = 2;
|
||||
found_clifo = found_piva;
|
||||
else
|
||||
found_clifo = -15;
|
||||
found_clifo = no_match_cf;
|
||||
}
|
||||
}
|
||||
// Altrimenti lo cerco con chiave 4, se ho il codice fiscale o ho il cod fisc e l'ho trovato con p iva
|
||||
else if (paa_codfisc.full())
|
||||
{
|
||||
clifo.setkey(4);
|
||||
clifo.setkey(found_cf);
|
||||
clifo.put(CLI_COFI, paa_codfisc);
|
||||
clifo.read() == NOERR ? found_clifo = 4 : found_clifo = -14; // Se il cod fisc corrisponde setto a 2
|
||||
clifo.read() == NOERR ? found_clifo = found_cf : found_clifo = no_cf; // Se il cod fisc corrisponde setto a 2
|
||||
}
|
||||
|
||||
// Se lo trovo controllo che non abbia il flag di sospeso se no ricerco ancora
|
||||
bool noerr = true;
|
||||
if (found_clifo == 2)
|
||||
if (found_clifo == found_piva)
|
||||
{
|
||||
while (clifo.get_bool(CLI_SOSPESO) && noerr && clifo.get(CLI_PAIV) == paa_piva)
|
||||
noerr = clifo.next() == NOERR;
|
||||
if (clifo.get_bool(CLI_SOSPESO) || !noerr || clifo.get(CLI_PAIV) != paa_piva)
|
||||
found_clifo = -5;
|
||||
found_clifo = no_forn;
|
||||
}
|
||||
else if (found_clifo == 4)
|
||||
else if (found_clifo == found_cf)
|
||||
{
|
||||
while (clifo.get_bool(CLI_SOSPESO) && noerr && clifo.get(CLI_COFI) == paa_codfisc)
|
||||
noerr = clifo.next() == NOERR;
|
||||
if (clifo.get_bool(CLI_SOSPESO) || !noerr || clifo.get(CLI_COFI) != paa_codfisc)
|
||||
found_clifo = -14;
|
||||
found_clifo = no_cf;
|
||||
}
|
||||
|
||||
// Controllo che non abbia 4 come tipo fornitore
|
||||
found_clifo = found_clifo == found_piva && clifo.get(CLI_ALLEG) == "4" ? tipo_forn_4 : found_clifo;
|
||||
|
||||
return found_clifo;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user