Patch level : 12.0 no-patch

Files correlati     : fp
Commento            : Aggiunto controllo vettore
This commit is contained in:
Mattia Tollari 2019-01-25 11:48:36 +01:00
parent a2fc471134
commit e78e12b5c6

View File

@ -1305,15 +1305,26 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
if(doc.get("CODVETT1").full()) if(doc.get("CODVETT1").full())
{ {
TRectype vet = cache().get("%VET", doc.get("CODVETT1")); TRectype vet = cache().get("%VET", doc.get("CODVETT1"));
TString4 statopiva = vet.get("S3").mid(49, 2); const TString4 statopiva = vet.get("S3").mid(49, 2);
TString piva = vet.get("S3").mid(20, 28); const TString piva = vet.get("S3").mid(20, 28);
const TString codfisc = vet.get("S13").mid(28, 16);
if(piva.empty() && codfisc.empty())
{
TString msg = "Il vettore ";
msg << vet.get("S0").mid(0, 50) << " non ha nè codice fiscale nè partita IVA, la fattura " << doc.anno() << " " << doc.codice_numerazione() << " " << doc.numero() << " non può essere trasmessa";
log(3, msg);
return false;
}
if(statopiva.full() && piva.full()) if(statopiva.full() && piva.full())
{ {
paf1700f.set("PG_FISCIVAPAESE", statopiva.full() ? statopiva : "IT"); paf1700f.set("PG_FISCIVAPAESE", statopiva.full() ? statopiva : "IT");
paf1700f.set("PG_FISCIVACODICE", piva); paf1700f.set("PG_FISCIVACODICE", piva);
} }
paf1700f.set("PG_CODICEFISCALE", vet.get("S13").mid(28, 16)); paf1700f.set("PG_CODICEFISCALE", codfisc);
if (vet.get_bool("B0")) if (vet.get_bool("B0"))
{ {