Patch level : 12.0
Files correlati : fp0400.cpp Commento: Aggiunta la logica per la gestione dei fornitori di tipo 4 (ovvero quelli che hanno più di un codice fornitore associato). Campo ora cicla su tutti i codici cliente/fornitore associati ad una data partita iva e restituisce quello più grande (quindi l'ultimo inserito ed il più aggiornato)
This commit is contained in:
parent
a1ee04aca6
commit
3847bfc482
@ -100,6 +100,7 @@ protected:
|
||||
static int find_fornitore(TLocalisamfile& clifo);
|
||||
static void add_row_err_forn(int forn_code, TSheet_field& sf_err, TString& denom);
|
||||
void aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TSheet_field& sf_err);
|
||||
int gestisci_forn_tipo_4(TString paiv);
|
||||
// Aggiunge i protocolli che sono già presenti per le fatture nel db alla tabellina per il filtro
|
||||
void aggiungi_prot() const;
|
||||
void init() const;
|
||||
@ -291,13 +292,13 @@ real TPassive_mask::calcola_importo(vector<iva> riva)
|
||||
void TPassive_mask::aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TSheet_field& sf_err)
|
||||
{
|
||||
TString denom = fp_db().sq_get("RAG_SOC");
|
||||
const TString& paa_codfisc = fp_db().sq_get("COD_FISC");
|
||||
const TString& paa_piva = fp_db().sq_get("P_IVA");
|
||||
const TString& paa_codpaese = fp_db().sq_get("COD_PAESE");
|
||||
const TDate& dataregcont = fp_db().sq_get_date("DATAREGCONT");
|
||||
const TString& filter_elab = get_fattsel();
|
||||
const bool is_contab = dataregcont != TDate("20010101");
|
||||
const TString& id_sdi = fp_db().sq_get("ID_SDI");
|
||||
TString paa_codfisc = fp_db().sq_get("COD_FISC");
|
||||
TString paa_piva = fp_db().sq_get("P_IVA");
|
||||
TString paa_codpaese = fp_db().sq_get("COD_PAESE");
|
||||
TDate dataregcont = fp_db().sq_get_date("DATAREGCONT");
|
||||
TString filter_elab = get_fattsel();
|
||||
bool is_contab = dataregcont != TDate("20010101");
|
||||
TString id_sdi = fp_db().sq_get("ID_SDI");
|
||||
|
||||
TToken_string keys("", ';');
|
||||
keys.add(fp_db().sq_get("KEYPROG")); keys.add(fp_db().sq_get("KEYHEAD")); keys.add(fp_db().sq_get("KEYFATT"));
|
||||
@ -312,11 +313,8 @@ void TPassive_mask::aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TShee
|
||||
return;
|
||||
|
||||
const bool data_range = dataregcont >= TDate(get(F_DATAINIREG)) && dataregcont <= TDate(get(F_DATAENDREG));
|
||||
|
||||
//INDAGARE QUI IL PROBLEMA DELLA SILE
|
||||
|
||||
if (filter_elab.blank() && forn_code != 0 // Filtro sui non associati
|
||||
|| filter_elab == FILTER_ASS && forn_code == 0 && !is_contab // Filtro sui associati e non contab.
|
||||
|| filter_elab == FILTER_ASS && (forn_code == 0 || forn_code == -16) && !is_contab // Filtro sui associati e non contab.
|
||||
|| filter_elab == FILTER_CONT && forn_code == 0 && is_contab && data_range // Filtro solo contabilizzati e data
|
||||
|| filter_elab == FILTER_ALL) // Tutte
|
||||
{
|
||||
@ -408,6 +406,15 @@ void TPassive_mask::aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TShee
|
||||
sf.set_row_cell(S_FORNITORE, clifo.get(CLI_CODCF), row);
|
||||
sf.set_row_cell(S_RAGSOC, clifo.get(CLI_RAGSOC), row);
|
||||
}
|
||||
else if (forn_code == tipo_forn_4) {
|
||||
int last_codcf = gestisci_forn_tipo_4(paa_piva);
|
||||
if (last_codcf != -1) {
|
||||
sf.set_row_cell(S_FPPRO, true, row);
|
||||
sf.set_row_cell(S_FORNITORE, last_codcf, row);
|
||||
sf.set_row_cell(S_RAGSOC, clifo.get(CLI_RAGSOC), row);
|
||||
}
|
||||
|
||||
}
|
||||
else if (_list_fatt_err.find(denom) == _list_fatt_err.end())
|
||||
{
|
||||
TForn_err& forn_err = _list_fatt_err[denom];
|
||||
@ -430,6 +437,30 @@ void TPassive_mask::aggiungi_riga(TLocalisamfile& clifo, TSheet_field& sf, TShee
|
||||
}
|
||||
}
|
||||
|
||||
int TPassive_mask::gestisci_forn_tipo_4(TString paiv) {
|
||||
|
||||
int last_codcf = -1;
|
||||
int current_codcf = -1;
|
||||
|
||||
TRectype filter(LF_CLIFO);
|
||||
|
||||
TRelation clifo(LF_CLIFO);
|
||||
TRectype& forn = clifo.curr();
|
||||
forn.put(CLI_TIPOCF, "F");
|
||||
TString filtro;
|
||||
filtro << "(PAIV==\"" << paiv << "\")";
|
||||
TCursor cur(&clifo, filtro, 5, &filter, &filter);
|
||||
const long items = cur.items();
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur) {
|
||||
int current_codcf = cur.curr().get_int(CLI_CODCF);
|
||||
if (current_codcf > last_codcf)
|
||||
last_codcf = current_codcf;
|
||||
}
|
||||
|
||||
return last_codcf;
|
||||
}
|
||||
|
||||
void TPassive_mask::aggiungi_prot() const
|
||||
{
|
||||
TSheet_field& sf_prot = sfield(F_PROT);
|
||||
@ -534,17 +565,11 @@ void TPassive_mask::auto_assoc()
|
||||
|
||||
int TPassive_mask::find_fornitore(TLocalisamfile& clifo)
|
||||
{
|
||||
const TString paa_codfisc = fp_db().sq_get("COD_FISC");
|
||||
const TString paa_piva = fp_db().sq_get("P_IVA");
|
||||
const TString paa_codpaese = fp_db().sq_get("COD_PAESE");
|
||||
const TString fppro_tipocf = fp_db().sq_get("TIPO_CF");
|
||||
const TString fppro_codcf = fp_db().sq_get("COD_CLIFOR");
|
||||
|
||||
if (fppro_codcf == 2774)
|
||||
{
|
||||
int g = 0;
|
||||
}
|
||||
|
||||
TString paa_codfisc = fp_db().sq_get("COD_FISC");
|
||||
TString paa_piva = fp_db().sq_get("P_IVA");
|
||||
TString paa_codpaese = fp_db().sq_get("COD_PAESE");
|
||||
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;
|
||||
@ -607,18 +632,13 @@ int TPassive_mask::find_fornitore(TLocalisamfile& clifo)
|
||||
found_clifo = no_cf;
|
||||
}
|
||||
|
||||
if (fppro_codcf == 1501) {
|
||||
int i = 0;
|
||||
}
|
||||
else if (fppro_codcf == 2774)
|
||||
{
|
||||
int g = 0;
|
||||
}
|
||||
|
||||
|
||||
// Controllo che non abbia 4 come tipo fornitore
|
||||
found_clifo = found_clifo == found_piva && clifo.get(CLI_ALLEG) == "4" ? tipo_forn_4 : found_clifo;
|
||||
|
||||
|
||||
if (found_clifo == found_piva && clifo.get(CLI_ALLEG) == "4")
|
||||
found_clifo = tipo_forn_4;
|
||||
else
|
||||
found_clifo == found_clifo;
|
||||
|
||||
return found_clifo;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user