Patch level : 12.0 384

Files correlati     : tf
Commento            : Spostato numero di invio in %LIA.I14

git-svn-id: svn://10.65.10.50/branches/R_10_00@23777 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
mtollari 2017-05-04 16:04:14 +00:00
parent 28f385b562
commit a82d6780fc

View File

@ -32,6 +32,7 @@ const TRectype getLim(int anno, int mese)
return cache().get("LIM", key);
}
// Ritorna il record richiesto di ivaliq
const TRectype getLiq(int anno, int mese)
{
TString key; key << anno << "|";
@ -41,6 +42,13 @@ const TRectype getLiq(int anno, int mese)
return cache().get(LF_IVALIQ, key);
}
// Ritorna il record richiesto di tabcom.LIA
const TRectype getLia(int anno)
{
TString key; key << format("%05d", prefix().firm().codice()) << anno; // %05d Crea un numero di 5 cifre partendo dal codice e mettendoci 0 davanti
return cache().get("%LIA", key);
}
TString formatCurrency(TString value)
{
real app(value);
@ -170,10 +178,10 @@ bool TIvaSend_app::generate(TIvaSend_msk& msk)
ofstream file;
TFilename path(msk.get(F_PATH));
TRectype rowLim = getLim(msk.get_int(F_ANNO), msk.isMese() ? msk.get_int(F_DAMESE) : (((msk.get_int(F_DATRIMESTRE) - 1) * 3) + 1));
TRectype rowLia = getLia(msk.get_int(F_ANNO));
// Decido di utilizzare I10 come numero progressivo di trasmissione
int prog = rowLim.get_int("I14"); prog++;
int prog = rowLia.get_int("I14"); prog++;
TString nomeFile; nomeFile << "IT" << getAnagDitta().get("PAIV") << TIPO_FILE << prog << ".csv";
@ -189,7 +197,7 @@ bool TIvaSend_app::generate(TIvaSend_msk& msk)
int end = msk.isMese() ? msk.get_int(F_AMESE) : (((msk.get_int(F_ATRIMESTRE) - 1) * 3) + 1);
for(; start <= end; start++)
{
rowLim = getLim(msk.get_int(F_ANNO), start); // rowLim viene già usata sopra
TRectype rowLim = getLim(msk.get_int(F_ANNO), start); // rowLim viene già usata sopra
TRectype rowLiq = getLiq(msk.get_int(F_ANNO), start);
TToken_string riga(testata);
@ -227,9 +235,9 @@ bool TIvaSend_app::generate(TIvaSend_msk& msk)
riga.add(formatCurrency(rowLiq.get("ACCDOV"))); // Acconto dovuto
riga.add(formatCurrency(rowLiq.get("IVAVER"))); // IVA da versare
riga.add(formatCurrency(rowLiq.get("IVAVERC"))); // IVA a credito VP14 col 2
riga.add(prog); // Numero interno trasmissione
riga.add(""); // Flag trasmesso
riga.add(""); // Flag accettato
riga.add(prog); // Numero interno trasmissione
riga.add(""); // Flag trasmesso
riga.add(""); // Flag accettato
// Appendo al file
file << riga << "\n";
@ -237,8 +245,8 @@ bool TIvaSend_app::generate(TIvaSend_msk& msk)
file.close();
// Aggiorno l'univoco
rowLim.put("I14", prog);
if(rowLim.rewrite(TLocalisamfile(LF_TAB)) != NOERR)
rowLia.put("I14", prog);
if(rowLia.rewrite(TLocalisamfile(LF_TABCOM)) != NOERR)
{
error_box("Errore aggiornamento progressivo");
return false;