Patch level : 12.0 420
Files correlati : tf Commento : - Sistemato salvataggio record custom - Aggiunto controllo record a volte escono record con flag errato dalle queries - Aggiunto controllo tipo documento - Sistemata procedura controllo errori, adesso riceve il puntatore di strarr - Modificata esportazione tff0400 se è un estero non CEE al posto del codice_fiscale riempio la partita_IVA con quello che è li presente git-svn-id: svn://10.65.10.50/branches/R_10_00@23959 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c6668aa742
commit
42fac4d92f
@ -238,14 +238,10 @@ const char* decodTipo(TToken_string* strarr)
|
||||
bool saveRec(TToken_string row, bool esportato)
|
||||
{
|
||||
static TLocalisamfile trasfatt(LF_TRASFATT);
|
||||
// Devo inserire la riga in trasfatt
|
||||
TRectype rCust(LF_TRASFATT);
|
||||
if(strcmp(row.get(_spedita), "X") == 0) // Controllo che non sia già stata spedita prima
|
||||
{
|
||||
TString key = row.get(_numero); key << "|"<< row.get(_aliquota);
|
||||
rCust = cache().get(LF_TRASFATT, key);
|
||||
}
|
||||
// Controllo non si sa mai
|
||||
TString key = row.get(_numero); key << "|"<< row.get(_aliquota);
|
||||
|
||||
TRectype rCust = cache().get(LF_TRASFATT, key);
|
||||
// Se la riga non esiste metto la chiave
|
||||
if(rCust.empty())
|
||||
{
|
||||
rCust.put("NUMREG", row.get(_numero));
|
||||
@ -263,7 +259,8 @@ bool saveRec(TToken_string row, bool esportato)
|
||||
rCust.put("AUTOFATT", row.get(_autofatt));
|
||||
if(esportato)
|
||||
{
|
||||
rCust.put("TFINVIO", true);
|
||||
TString invio = esportato? "I" : row.get(_invio);
|
||||
rCust.put("TFINVIO", invio);
|
||||
rCust.put("TFDATA", TDate(TODAY));
|
||||
}
|
||||
|
||||
@ -956,7 +953,7 @@ bool TTrFa_app::tff0200(TString key)
|
||||
}
|
||||
|
||||
// DatiSede
|
||||
TString via = _ditta.via_residenza(), cap = _ditta.CAP_residenza(), nazione = _ditta.stato_residenzaISO();
|
||||
TString via = _ditta.via_residenza(), cap = _ditta.CAP_residenza(), nazione = _ditta.stato_residenza_ISO();
|
||||
// Valori necessari, se non ci sono salto
|
||||
if(via.full() && cap.full() && nazione.full())
|
||||
{
|
||||
@ -976,7 +973,7 @@ bool TTrFa_app::tff0200(TString key)
|
||||
if(r_ana.get_char("TIPORFSO") == 'S') // Stabile Organizzazione
|
||||
{
|
||||
TAnagrafica rfso(r_ana);
|
||||
TString via = rfso.via_residenza(), cap = rfso.CAP_residenza(), nazione = rfso.stato_residenzaISO();
|
||||
TString via = rfso.via_residenza(), cap = rfso.CAP_residenza(), nazione = rfso.stato_residenza_ISO();
|
||||
|
||||
tff0200f.set("P2_STABORGIND", via);
|
||||
tff0200f.set("P2_STABORGNRCIVICO", rfso.civico_residenza());
|
||||
@ -1007,7 +1004,7 @@ bool TTrFa_app::tff0300(TString key, TRectype r_ana)
|
||||
|
||||
TTrFa_record tff0300f("TFF0300F");
|
||||
tff0300f.set("P3_KEYPRGINVIO", key);
|
||||
tff0300f.set("P3_FISCIVAPAESE", rfso.stato_residenzaISO());
|
||||
tff0300f.set("P3_FISCIVAPAESE", rfso.stato_residenza_ISO());
|
||||
tff0300f.set("P3_FISCIVACODICE", paiv);
|
||||
|
||||
if(r_ana.get_char("TIPOA") == 'G')
|
||||
@ -1097,7 +1094,18 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
||||
tff0400f.set("P4_FISCIVACOD", "99999999999");
|
||||
}
|
||||
else
|
||||
tff0400f.set("P4_CODFISC", cedeprest.codice_fiscale());
|
||||
{
|
||||
// Se è un estero non CEE prendo nella partita IVA metto l'identificativo fiscale
|
||||
if(cedeprest.estero_non_CEE())
|
||||
{
|
||||
tff0400f.set("P4_FISCIVAPAESE", cedeprest.stato_partita_IVA());
|
||||
tff0400f.set("P4_FISCIVACOD", cedeprest.codice_fiscale());
|
||||
}
|
||||
else
|
||||
{
|
||||
tff0400f.set("P4_CODFISC", cedeprest.codice_fiscale());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cedeprest.ok()) // Con bolle doganali non a posto impazzisce
|
||||
@ -1162,9 +1170,9 @@ bool TTrFa_app::tff0400(TSheet_field& sheet)
|
||||
{
|
||||
tff0400f.set("P4_ANADENOM", cedeprest.ragione_sociale());
|
||||
}
|
||||
TString via = cedeprest.via_residenza(), cap = cedeprest.CAP_residenza(), nazione = cedeprest.stato_residenzaISO();
|
||||
TString via = cedeprest.via_residenza(), cap = cedeprest.CAP_residenza(), nazione = cedeprest.stato_residenza_ISO();
|
||||
// Valori necessari, se non ci sono salto
|
||||
if(via.full() && cap.full() && nazione.full())
|
||||
if(via.full() && (cap.full() || cedeprest.estero()) && nazione.full())
|
||||
{
|
||||
tff0400f.set("P4_SEDEIND", via);
|
||||
tff0400f.set("P4_SEDENRCIVICO", cedeprest.civico_residenza());
|
||||
@ -1227,6 +1235,8 @@ bool TTrFa_app::tff0700(TSheet_field& sheet)
|
||||
tff0700f.set("P7_KEYHEADERFATT", getHeader(strarr));
|
||||
tff0700f.set("P7_KEYBODYFATT", getBody(strarr));
|
||||
|
||||
TString natura = strarr->get(_natura);
|
||||
|
||||
tff0700f.set("P7_TIPODOC", decodTipo(strarr));
|
||||
tff0700f.set("P7_DATA", toDate(strarr->get(_datadoc)));
|
||||
tff0700f.set("P7_NUMERO", strarr->get(_numdoc));
|
||||
@ -1298,7 +1308,7 @@ bool TTrFa_app::tff3100(TToken_string* strarr, TRectype r_ana)
|
||||
|
||||
if(r_ana.get_char("TIPORFSO") == 'S') // Stabile Organizzazione
|
||||
{
|
||||
TString via = rfso.via_residenza(), cap = rfso.CAP_residenza(), nazione = rfso.stato_residenzaISO();
|
||||
TString via = rfso.via_residenza(), cap = rfso.CAP_residenza(), nazione = rfso.stato_residenza_ISO();
|
||||
|
||||
tff3100f.set("PH_STABORGIND", via);
|
||||
tff3100f.set("PH_STABORGNRCIVICO", rfso.civico_residenza());
|
||||
@ -1315,7 +1325,7 @@ bool TTrFa_app::tff3100(TToken_string* strarr, TRectype r_ana)
|
||||
|
||||
TString paiv = rfso.partita_IVA(), ragsoc = rfso.ragione_sociale(), nom = rfso.nome(), cog = rfso.cognome();
|
||||
|
||||
tff3100f.set("PH_FISCIVAPAESE", rfso.stato_residenzaISO());
|
||||
tff3100f.set("PH_FISCIVAPAESE", rfso.stato_residenza_ISO());
|
||||
tff3100f.set("PH_FISCIVACODICE", paiv);
|
||||
|
||||
if(r_ana.get_char("TIPOA") == 'G')
|
||||
|
@ -53,6 +53,7 @@ enum filter_fatt
|
||||
#define FLAG_ERRORE "E"
|
||||
#define FLAG_NINVIO "N"
|
||||
#define FLAG_FORZATO "F"
|
||||
#define FLAG_INVIATO "I"
|
||||
#define SPESOMETROBASE "ModuliSirio"
|
||||
|
||||
/* Così facendo basta modificare la maschera (e le dichiarazioni di conseguenza)
|
||||
@ -218,7 +219,7 @@ public:
|
||||
// Controllo tutti i records
|
||||
bool checkAll();
|
||||
// Testo validità record
|
||||
bool checkRec(TPrinter* stampa, TToken_string& rec);
|
||||
bool checkRec(TPrinter* stampa, TToken_string* rec);
|
||||
// Controllo che siano presenti records
|
||||
bool checkNotEmpty();
|
||||
// Controllo finale prima di inviare il tutto, se ci sono fatture
|
||||
@ -226,6 +227,8 @@ public:
|
||||
void theFinalCheckDown();
|
||||
// Mette il flag di invio = [flag] per la riga numero [nrow]
|
||||
void flagRow(int nrow, TString flag);
|
||||
// Salto se la riga ha un tipo invio non del filtro
|
||||
bool checkInvio(const TString& invio);
|
||||
};
|
||||
// Funzione inline di stampa
|
||||
inline void printError(TPrinter* stampa, TString movimento, TString documento, TString msgerr);
|
||||
|
@ -193,6 +193,14 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case A_TIPODOC:
|
||||
// Controllo che il tipo di documento rientri in quelli del filtro
|
||||
if(e == fe_modify && !get_bool(getTipoDoc(o.get())))
|
||||
{
|
||||
error_box("Attenzione! il tipo di documento scelto non fa parte dei filtri correnti!");
|
||||
o.set("");
|
||||
}
|
||||
break;
|
||||
case DLG_SAVEREC:
|
||||
if(e == fe_button)
|
||||
saveAll();
|
||||
@ -422,7 +430,7 @@ bool TTrFa_mask::checkAll()
|
||||
TSheet_field& sheet = sfield(F_RIGHE);
|
||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||
{
|
||||
checkRec(&stampa, *strarr);
|
||||
checkRec(&stampa, strarr);
|
||||
}
|
||||
riga.reset();
|
||||
riga.put(TR("------------------ Fine controllo! ------------------"), 30);
|
||||
@ -440,14 +448,14 @@ inline void printError(TPrinter* stampa, TString movimento, TString documento, T
|
||||
stampa->print(riga);
|
||||
}
|
||||
|
||||
bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string& rec)
|
||||
bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string* rec)
|
||||
{
|
||||
bool ok = true;
|
||||
TString numMov = rec.get(_numero), numDoc = rec.get(_numdoc);
|
||||
TString numMov = rec->get(_numero), numDoc = rec->get(_numdoc);
|
||||
TString msgerr;
|
||||
TString coderr;
|
||||
// Controllo date ***********************************************************************************
|
||||
TDate reg = rec.get(_datareg), doc = rec.get(_datadoc);
|
||||
TDate reg = rec->get(_datareg), doc = rec->get(_datadoc);
|
||||
if(reg < doc)
|
||||
{
|
||||
ok = false;
|
||||
@ -457,10 +465,10 @@ bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string& rec)
|
||||
}
|
||||
|
||||
// Controllo aliquota, imponibile e imposta *********************************************************
|
||||
TCodiceIVA codiva(rec.get(_aliquota));
|
||||
TString nat = rec.get(_natura), realNat(natura(rec.get(_aliquota)));
|
||||
TCodiceIVA codiva(rec->get(_aliquota));
|
||||
TString nat = rec->get(_natura), realNat(natura(rec->get(_aliquota)));
|
||||
nat.ltrim(); // Se vuoto arriva con uno spazio
|
||||
real imponibile = rec.get(_imponibile), imposta = rec.get(_importoIVA);
|
||||
real imponibile = rec->get(_imponibile), imposta = rec->get(_importoIVA);
|
||||
if(nat != realNat)
|
||||
{
|
||||
msgerr.cut(0) << "Natura del movimento errata, valore dichiarato: " << nat << " valore corretto: " << realNat;
|
||||
@ -478,7 +486,7 @@ bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string& rec)
|
||||
}
|
||||
|
||||
// Flaggo il record con i messaggi di errore
|
||||
rec.add(coderr, _coderr); // Sempre potrebbero esserci errori non bloccanti
|
||||
rec->add(coderr, _coderr); // Sempre potrebbero esserci errori non bloccanti
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -599,6 +607,8 @@ void TTrFa_mask::load_sheet()
|
||||
TRectype movimento = *(TRectype*)rec;
|
||||
// Controllo che sia un tipo documento da leggere
|
||||
if(!get_bool(getTipoDoc(movimento.get("TIPODOC")))) continue;
|
||||
// A volte mi pesca movimenti con invio sbagliato
|
||||
if(!checkInvio(movimento.get("TFINVIO"))) continue;
|
||||
|
||||
// Creo una nuova riga nello sheet
|
||||
TToken_string& row = sheet.row(-1);
|
||||
@ -608,7 +618,7 @@ void TTrFa_mask::load_sheet()
|
||||
*/
|
||||
TRectype isCust = getTrasFatt(movimento.get("NUMREG"), iva);
|
||||
|
||||
row.add(isCust.get("TFINVIO") == "I", _spedita); // Spedita
|
||||
row.add(movimento.get("TFINVIO") == "I" ? "X" : "", _spedita); // Spedita
|
||||
row.add("X"); // Da spedire, sempre!
|
||||
row.add(isCust.full() ? "X" : "", _forzata); // Modificato
|
||||
row.add(movimento.get_long("NUMREG"), _numero); // Numero registrazione
|
||||
@ -680,9 +690,30 @@ TString TTrFa_mask::revCharge(TString numreg) const
|
||||
// Controllo se la causale ha il reverse charge, se il cliente non l'ha impostata giusta sono ARAZZI suoi
|
||||
TString key = numreg;
|
||||
TCausale caus(cache().get(LF_MOV, key, "CODCAUS"));
|
||||
if(caus.reverse_charge())
|
||||
bool tolla = true;
|
||||
return caus.reverse_charge() ? "X" : "";
|
||||
}
|
||||
|
||||
bool TTrFa_mask::checkInvio(const TString& invio)
|
||||
{
|
||||
bool ok;
|
||||
switch(get_int(F_FATTSEL))
|
||||
{
|
||||
case 0:
|
||||
ok = invio == "" || invio == FLAG_INVIO || invio == FLAG_FORZATO;
|
||||
break;
|
||||
case 1:
|
||||
ok = invio == FLAG_INVIATO;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
ok = invio == FLAG_NINVIO;
|
||||
break;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
TString TTrFa_mask::getRFSO(TString codrfso) const
|
||||
{
|
||||
TString key; key << codrfso[0] << "|" << codrfso.mid(1);
|
||||
|
@ -110,6 +110,7 @@ TRectype TTrFa_cursors::_next(return_code& code, TString& tipocf, TString& codcf
|
||||
retRec.put("NUMDOC", c_rmoviva->get("23.NUMDOC").as_string());
|
||||
retRec.put("DATAREG", c_rmoviva->get("23.DATAREG").as_date());
|
||||
retRec.put("DATADOC", c_rmoviva->get("23.DATADOC").as_date());
|
||||
retRec.put("TFINVIO", c_rmoviva->get("23.TFINVIO").as_string());
|
||||
retRec.put("IMPONIBILE", c_rmoviva->get("25.IMPONIBILE").as_real());
|
||||
retRec.put("IMPOSTA", c_rmoviva->get("25.IMPOSTA").as_real());
|
||||
retRec.put("CODIVA", c_rmoviva->get("25.CODIVA").as_string());
|
||||
|
Loading…
x
Reference in New Issue
Block a user