Patch level : 12.0 698
Files correlati : fp Commento : - Spostate funzioni comuni - Inizio sistemazione calcolo ritenuta e cassa previdenziale
This commit is contained in:
commit
f5c1e1dc81
8
cd/test/fp0694.txt
Normal file
8
cd/test/fp0694.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fp0.exe
|
||||||
|
|
||||||
|
- Sistemato caricamento con più di 10 tipi doc_to_paf
|
||||||
|
- Sistemati calcoli con 3 o più cifre decimali nel prezzo o quantità
|
||||||
|
- Workaround per bolli
|
||||||
|
- Sistemata ritenuta con calcoli nuovi
|
||||||
|
- Sistemato codice IVA per assoggettamento fiscale
|
||||||
|
- Messi log specifici se non riesce a generare PDF
|
19
cd/test/fp0694a.ini
Normal file
19
cd/test/fp0694a.ini
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[Main]
|
||||||
|
Demo=0
|
||||||
|
|
||||||
|
[fp1]
|
||||||
|
File(0) = fp0.exe|X
|
||||||
|
Patch = 0694
|
||||||
|
Versione = 21511200
|
||||||
|
|
||||||
|
[fp]
|
||||||
|
Data = 05-02-2019
|
||||||
|
Descrizione = Fattura Elettronica
|
||||||
|
Dischi = 1
|
||||||
|
Moduli = cg,ve
|
||||||
|
OEM =
|
||||||
|
Patch = 694
|
||||||
|
PostProcess =
|
||||||
|
PreProcess =
|
||||||
|
Versione = 21511200
|
||||||
|
|
BIN
cd/test/fp0694a1.zip
Normal file
BIN
cd/test/fp0694a1.zip
Normal file
Binary file not shown.
6
cd/test/ve0694.txt
Normal file
6
cd/test/ve0694.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
ve0.exe
|
||||||
|
vetbspp.msk
|
||||||
|
cgtbvet.msk
|
||||||
|
pr0.exe
|
||||||
|
|
||||||
|
- Aggiunta campi in spesa per tipo cassa
|
151
cd/test/ve0694a.ini
Normal file
151
cd/test/ve0694a.ini
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
[Main]
|
||||||
|
Demo=0
|
||||||
|
|
||||||
|
[ve9]
|
||||||
|
Edit_163 = ve0 -4
|
||||||
|
Edit_33 = ve0 -0
|
||||||
|
Edit_4 = ve0 -4
|
||||||
|
Edit_47 = ve2 -3
|
||||||
|
Edit_5 = ve0 -4
|
||||||
|
File(137) = ve0.exe|X
|
||||||
|
File(247) = vetbspp.msk|X
|
||||||
|
Patch = 694
|
||||||
|
Versione = 21511200
|
||||||
|
|
||||||
|
[ve99]
|
||||||
|
Kill(0) = batbcld.msk|x
|
||||||
|
Kill(1) = bastspp.rep|x
|
||||||
|
Kill(2) = batbcaa.msk|x
|
||||||
|
Kill(3) = bastgmc.rep|x
|
||||||
|
Kill(4) = baststd.rep|x
|
||||||
|
Kill(5) = bastspp.msk|x
|
||||||
|
Kill(6) = bastctr.rep|x
|
||||||
|
Kill(7) = basttip.msk|x
|
||||||
|
Kill(8) = batbpro.msk|x
|
||||||
|
Kill(9) = efstbnp.msk|x
|
||||||
|
Kill(10) = bastimb.rep|x
|
||||||
|
Kill(11) = batbgca.msk|x
|
||||||
|
Kill(12) = ve7200a.frm|x
|
||||||
|
Kill(13) = basttag.rep|x
|
||||||
|
Kill(14) = basttip.rep|x
|
||||||
|
Kill(15) = bastfrd.msk|x
|
||||||
|
Kill(16) = bastabe.rep|x
|
||||||
|
Kill(17) = batbctr.msk|x
|
||||||
|
Kill(18) = batbgsa.msk|x
|
||||||
|
Kill(19) = bastfrd.rep|x
|
||||||
|
Kill(20) = bastprs.rep|x
|
||||||
|
Kill(21) = batbgmc.msk|x
|
||||||
|
Kill(22) = batbfrd.msk|x
|
||||||
|
Kill(23) = bastcra.msk|x
|
||||||
|
Kill(24) = basteld.rep|x
|
||||||
|
Kill(25) = bastfrm.msk|x
|
||||||
|
Kill(26) = batbabe.msk|x
|
||||||
|
Kill(27) = batbfca.msk|x
|
||||||
|
Kill(28) = ve7300a.msk|x
|
||||||
|
Kill(29) = bastrfc.rep|x
|
||||||
|
Kill(30) = basttri.msk|x
|
||||||
|
Kill(31) = batbspt.msk|x
|
||||||
|
Kill(32) = bastcaa.msk|x
|
||||||
|
Kill(33) = batbfrm.msk|x
|
||||||
|
Kill(34) = ve7100a.msk|x
|
||||||
|
Kill(35) = ve7700a.msk|x
|
||||||
|
Kill(36) = bastasf.msk|x
|
||||||
|
Kill(37) = bastabe.msk|x
|
||||||
|
Kill(38) = ve7200a.msk|x
|
||||||
|
Kill(39) = bastgcg.msk|x
|
||||||
|
Kill(40) = baststd.msk|x
|
||||||
|
Kill(41) = batbnum.msk|x
|
||||||
|
Kill(42) = bastfrr.rep|x
|
||||||
|
Kill(43) = batbfrr.msk|x
|
||||||
|
Kill(44) = batbrfa.msk|x
|
||||||
|
Kill(45) = batbstd.msk|x
|
||||||
|
Kill(46) = basteld.msk|x
|
||||||
|
Kill(47) = batbubi.msk|x
|
||||||
|
Kill(48) = bastfrr.msk|x
|
||||||
|
Kill(49) = bastasf.rep|x
|
||||||
|
Kill(50) = bastgca.rep|x
|
||||||
|
Kill(51) = basttri.rep|x
|
||||||
|
Kill(52) = batbtri.msk|x
|
||||||
|
Kill(53) = ve7.exe|x
|
||||||
|
Kill(54) = batbtip.msk|x
|
||||||
|
Kill(55) = batbasf.msk|x
|
||||||
|
Kill(56) = bastgmc.msk|x
|
||||||
|
Kill(57) = bastrfa.msk|x
|
||||||
|
Kill(58) = basttag.msk|x
|
||||||
|
Kill(59) = ve7600a.msk|x
|
||||||
|
Kill(60) = bastubi.rep|x
|
||||||
|
Kill(61) = bastubi.msk|x
|
||||||
|
Kill(62) = bastcau.msk|x
|
||||||
|
Kill(63) = batbprs.msk|x
|
||||||
|
Kill(64) = batbgcg.msk|x
|
||||||
|
Kill(65) = batbmre.msk|x
|
||||||
|
Kill(66) = bastctr.msk|x
|
||||||
|
Kill(67) = batbcau.msk|x
|
||||||
|
Kill(68) = batbfsa.msk|x
|
||||||
|
Kill(69) = batbrfc.msk|x
|
||||||
|
Kill(70) = bastnum.rep|x
|
||||||
|
Kill(71) = bastums.rep|x
|
||||||
|
Kill(72) = batbtag.msk|x
|
||||||
|
Kill(73) = batbprv.msk|x
|
||||||
|
Kill(74) = bastgca.msk|x
|
||||||
|
Kill(75) = bastrfa.rep|x
|
||||||
|
Kill(76) = batbspp.msk|x
|
||||||
|
Kill(77) = bastfca.msk|x
|
||||||
|
Kill(78) = ve7400a.msk|x
|
||||||
|
Kill(79) = ve7701a.ini|x
|
||||||
|
Kill(80) = batbfid.msk|x
|
||||||
|
Kill(81) = ve7300a.frm|x
|
||||||
|
Kill(82) = bastcaa.rep|x
|
||||||
|
Kill(83) = bastnum.msk|x
|
||||||
|
Kill(84) = ve7400a.ini|x
|
||||||
|
Kill(85) = bastprs.msk|x
|
||||||
|
Kill(86) = bastcau.rep|x
|
||||||
|
Kill(87) = bastfca.rep|x
|
||||||
|
Kill(88) = eftbbnp.msk|x
|
||||||
|
Kill(89) = bastums.msk|x
|
||||||
|
Kill(90) = efstbnp.rep|x
|
||||||
|
Kill(91) = bastgcg.rep|x
|
||||||
|
Kill(92) = bastbnp.msk|x
|
||||||
|
Kill(93) = ve7400conf.ini|x
|
||||||
|
Kill(94) = bastfrm.rep|x
|
||||||
|
Kill(95) = batbeld.msk|x
|
||||||
|
Kill(96) = bastcra.rep|x
|
||||||
|
Kill(97) = batbbnp.msk|x
|
||||||
|
Kill(98) = batbacr.msk|x
|
||||||
|
Kill(99) = batbimb.msk|x
|
||||||
|
Kill(100) = bastimb.msk|x
|
||||||
|
Kill(101) = batbums.msk|x
|
||||||
|
Kill(102) = bastbnp.rep|x
|
||||||
|
Kill(103) = bastrfc.msk|x
|
||||||
|
Kill(104) = batbcra.msk|x
|
||||||
|
Kill(105) = ve7500a.msk|x
|
||||||
|
|
||||||
|
[cg9]
|
||||||
|
Edit_19 = cg0 -0
|
||||||
|
Edit_20 = cg0 -1
|
||||||
|
Edit_26 = cg0 -4
|
||||||
|
Edit_5 = cg0 -5
|
||||||
|
File(112) = cgtbvet.msk|X
|
||||||
|
Patch = 684
|
||||||
|
Versione = 21511200
|
||||||
|
|
||||||
|
[pr9]
|
||||||
|
Edit_4 = pr0 -0
|
||||||
|
Edit_5 = pr0 -0
|
||||||
|
File(16) = pr0.exe|X
|
||||||
|
Patch = 0862
|
||||||
|
Versione = 21511200
|
||||||
|
|
||||||
|
[ve]
|
||||||
|
Data = 05-02-2019
|
||||||
|
Descrizione = Vendite
|
||||||
|
Dischi = 1
|
||||||
|
Moduli = ba,cg9,pr9,mg9,sv9,in9,ef9
|
||||||
|
OEM =
|
||||||
|
Patch = 694
|
||||||
|
PostProcess = bainst -0 VE
|
||||||
|
PreProcess =
|
||||||
|
Prezzo(1) =
|
||||||
|
Prezzo(2) =
|
||||||
|
Versione = 21511200
|
||||||
|
|
BIN
cd/test/ve0694a1.zip
Normal file
BIN
cd/test/ve0694a1.zip
Normal file
Binary file not shown.
@ -35,6 +35,11 @@ bool get_coddest(const char tipocf, const long codcf, TString& coddest, TString&
|
|||||||
inline const TString& no_special(char a);
|
inline const TString& no_special(char a);
|
||||||
const TString& tipo_doc_sdi(const TDocumento& doc);
|
const TString& tipo_doc_sdi(const TDocumento& doc);
|
||||||
|
|
||||||
|
// Controlli comuni
|
||||||
|
bool is_fattura(const TRectype& doc);
|
||||||
|
// Si potrebbe standardizzare in TISAM_recordset
|
||||||
|
TString& add_filter(const TString& field, const TString& from, const TString& to);
|
||||||
|
|
||||||
// Contenitore di campi di un record di database MSSQLServer
|
// Contenitore di campi di un record di database MSSQLServer
|
||||||
class TPaf_record : public TObject
|
class TPaf_record : public TObject
|
||||||
{
|
{
|
||||||
@ -114,6 +119,7 @@ private:
|
|||||||
bool _is_pa;
|
bool _is_pa;
|
||||||
bool _has_bolla;
|
bool _has_bolla;
|
||||||
TString _codivadefault;
|
TString _codivadefault;
|
||||||
|
long _index_cassa_previdenziale;
|
||||||
|
|
||||||
// Classe interna per gestire righe aggiuntive in riepilogo
|
// Classe interna per gestire righe aggiuntive in riepilogo
|
||||||
class TRiepilogo_agg
|
class TRiepilogo_agg
|
||||||
@ -162,6 +168,7 @@ protected:
|
|||||||
void set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc) const;
|
void set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc) const;
|
||||||
void add_ritenuta(const TDocumentoEsteso& doc, const TSpesa_prest& sp, TPaf_record& paf0700f) const;
|
void add_ritenuta(const TDocumentoEsteso& doc, const TSpesa_prest& sp, TPaf_record& paf0700f) const;
|
||||||
bool add_riepilogo_iva(TPaf_record& paf2200f, const TCodiceIVA& cod_iva, const char* eiva, const real& imponibile = ZERO, const real& imposta = ZERO);
|
bool add_riepilogo_iva(TPaf_record& paf2200f, const TCodiceIVA& cod_iva, const char* eiva, const real& imponibile = ZERO, const real& imposta = ZERO);
|
||||||
|
bool add_cassa_previdenziale(TRiga_documento& rdoc);
|
||||||
|
|
||||||
const TFirm& get_firm();
|
const TFirm& get_firm();
|
||||||
|
|
||||||
|
@ -226,6 +226,38 @@ const TString& tipo_doc_sdi(const TDocumento& doc)
|
|||||||
{
|
{
|
||||||
return doc.get(DOC_TIPODOCSDI).full() ? doc.get(DOC_TIPODOCSDI) : doc.tipo().tipo_doc_sdi();
|
return doc.get(DOC_TIPODOCSDI).full() ? doc.get(DOC_TIPODOCSDI) : doc.tipo().tipo_doc_sdi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_fattura(const TRectype& doc)
|
||||||
|
{
|
||||||
|
const TTipo_documento& td = cached_tipodoc(doc.get(DOC_TIPODOC));
|
||||||
|
if (!td.is_fattura()) // Tengo per buone solo le fatture e le note di credito
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const TCodice_numerazione& cn = cached_numerazione(doc.get(DOC_CODNUM));
|
||||||
|
return cn.tipo() == 2 && !cn.get_bool("B10"); // Controlla se fattura provvisioria esclusa da P.A.
|
||||||
|
}
|
||||||
|
|
||||||
|
TString& add_filter(const TString& field, const TString& from, const TString& to)
|
||||||
|
{
|
||||||
|
TString& query = get_tmp_string();
|
||||||
|
const TString qf = field.find('.') < 0 ? field : field.sub(field.find('.') + 1);
|
||||||
|
|
||||||
|
if (from.full() && to.full())
|
||||||
|
{
|
||||||
|
query << "&&(BETWEEN(" << field << ", #DA" << qf << ", #A" << qf << "))";
|
||||||
|
}
|
||||||
|
else if (from.full())
|
||||||
|
{
|
||||||
|
query << "&&(" << field << ">=#DA" << qf << ")";
|
||||||
|
}
|
||||||
|
else if (to.full())
|
||||||
|
{
|
||||||
|
query << "&&(" << field << "<=#A" << qf << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* TPaf_record
|
* TPaf_record
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -729,6 +761,9 @@ bool TDoc_fp::initialize(const TDocumentoEsteso& doc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Azzero indici
|
||||||
|
_index_cassa_previdenziale = 1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,12 +940,8 @@ void TDoc_fp::set_qta_prezzo(TPaf_record& paf1800f, TRiga_documento* rdoc) const
|
|||||||
paf1800f.set("PI_PRZTOTALE", converti_prezzo(prezzo_tot));
|
paf1800f.set("PI_PRZTOTALE", converti_prezzo(prezzo_tot));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDoc_fp::add_ritenuta(const TDocumentoEsteso& doc, const TSpesa_prest& sp, TPaf_record& paf0700f) const
|
const real calc_ritenuta(const TDocumento& doc)
|
||||||
{
|
{
|
||||||
// <DatiRitenuta>
|
|
||||||
paf0700f.set("P7_TIPORITENUTA", _rec_clifo.get_char(CLI_TIPOPERS) == 'F' ? "RT01" : "RT02");
|
|
||||||
TString doc_imponibile = doc.imponibile().string();
|
|
||||||
|
|
||||||
real imponibile_prestazioni = ZERO;
|
real imponibile_prestazioni = ZERO;
|
||||||
{
|
{
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc, r, rdoc)
|
FOR_EACH_PHYSICAL_RDOC(doc, r, rdoc)
|
||||||
@ -924,11 +955,22 @@ void TDoc_fp::add_ritenuta(const TDocumentoEsteso& doc, const TSpesa_prest& sp,
|
|||||||
// Riciclo per sommare la % delle spese da sommare
|
// Riciclo per sommare la % delle spese da sommare
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc, r, rdoc)
|
FOR_EACH_PHYSICAL_RDOC(doc, r, rdoc)
|
||||||
{
|
{
|
||||||
if (rdoc->is_spese() && rdoc->spesa().get_bool("B1"))
|
if (rdoc->is_spese() && rdoc->spesa().spe_cal_rit())
|
||||||
imponibile += imponibile * rdoc->spesa().perc() / CENTO;
|
imponibile += imponibile * rdoc->spesa().perc() / CENTO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return imponibile;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDoc_fp::add_ritenuta(const TDocumentoEsteso& doc, const TSpesa_prest& sp, TPaf_record& paf0700f) const
|
||||||
|
{
|
||||||
|
// <DatiRitenuta>
|
||||||
|
paf0700f.set("P7_TIPORITENUTA", _rec_clifo.get_char(CLI_TIPOPERS) == 'F' ? "RT01" : "RT02");
|
||||||
|
TString doc_imponibile = doc.imponibile().string();
|
||||||
|
|
||||||
|
const real imponibile = calc_ritenuta(doc);
|
||||||
|
|
||||||
paf0700f.set("P7_IMPORTORIT", converti_prezzo(imponibile * sp.perc() / CENTO));
|
paf0700f.set("P7_IMPORTORIT", converti_prezzo(imponibile * sp.perc() / CENTO));
|
||||||
paf0700f.set("P7_ALIQUOTARIT", sp.perc());
|
paf0700f.set("P7_ALIQUOTARIT", sp.perc());
|
||||||
static TString caus_la; caus_la.cut(0);
|
static TString caus_la; caus_la.cut(0);
|
||||||
@ -936,8 +978,7 @@ void TDoc_fp::add_ritenuta(const TDocumentoEsteso& doc, const TSpesa_prest& sp,
|
|||||||
|
|
||||||
if (caus_la.empty())
|
if (caus_la.empty())
|
||||||
{
|
{
|
||||||
static TString caus770; caus770.cut(0); caus770.format("%02d", sp.caus_770());
|
caus_la << sp.rec_caus_770().get("S2");
|
||||||
caus_la << cache().get("%CA7", caus770, "S2");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
paf0700f.set("P7_CAUSPAGAM", caus_la);
|
paf0700f.set("P7_CAUSPAGAM", caus_la);
|
||||||
@ -965,8 +1006,8 @@ bool TDoc_fp::add_riepilogo_iva(TPaf_record& paf2200f, const TCodiceIVA& cod_iva
|
|||||||
// Imponibile
|
// Imponibile
|
||||||
paf2200f.set("PL_IMPONIBILE", converti_prezzo(imponibile + riepilogo_agg.imponibile));
|
paf2200f.set("PL_IMPONIBILE", converti_prezzo(imponibile + riepilogo_agg.imponibile));
|
||||||
|
|
||||||
// Imposta, per gli omaggi con addebito ho già l'imposta
|
// Imposta
|
||||||
paf2200f.set("PL_IMPOSTA", converti_prezzo(imposta));
|
paf2200f.set("PL_IMPOSTA", converti_prezzo(imposta + riepilogo_agg.imposta));
|
||||||
|
|
||||||
// Esigibilità IVA
|
// Esigibilità IVA
|
||||||
paf2200f.set("PL_ESIGIVA", eiva);
|
paf2200f.set("PL_ESIGIVA", eiva);
|
||||||
@ -984,6 +1025,47 @@ bool TDoc_fp::add_riepilogo_iva(TPaf_record& paf2200f, const TCodiceIVA& cod_iva
|
|||||||
return insert(paf2200f);
|
return insert(paf2200f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TDoc_fp::add_cassa_previdenziale(TRiga_documento& rdoc)
|
||||||
|
{
|
||||||
|
static TPaf_record paf0800f("PAF0800F");
|
||||||
|
paf0800f.reset();
|
||||||
|
if (_index_cassa_previdenziale == 1)
|
||||||
|
{
|
||||||
|
paf0800f.set("P8_KEYHEADERFATT", _hfatt);
|
||||||
|
paf0800f.set("P8_KEYBODYFATT", _bfatt);
|
||||||
|
remove(paf0800f);
|
||||||
|
}
|
||||||
|
// Chiavi
|
||||||
|
paf0800f.set("P8_KEYHEADERFATT", _hfatt);
|
||||||
|
paf0800f.set("P8_KEYBODYFATT", _bfatt);
|
||||||
|
paf0800f.set("P8_RIFNUMLINEA", _index_cassa_previdenziale++);
|
||||||
|
|
||||||
|
// Resto
|
||||||
|
const TSpesa_prest& sp = rdoc.spesa();
|
||||||
|
const real imponibile_ritenuta = calc_ritenuta(rdoc.doc());
|
||||||
|
const real importo_cassa = imponibile_ritenuta * sp.perc() / CENTO;
|
||||||
|
|
||||||
|
paf0800f.set("P8_TIPOCASSA", sp.cassa_previdenziale());
|
||||||
|
// Aliquota della cassa
|
||||||
|
paf0800f.set("P8_ALIQCASSA", sp.perc());
|
||||||
|
// Importo contributo cassa
|
||||||
|
paf0800f.set("P8_IMCONTRCASSA", converti_prezzo(importo_cassa));
|
||||||
|
// Imponibile cassa
|
||||||
|
paf0800f.set("P8_IMPONCASSA", converti_prezzo(imponibile_ritenuta));
|
||||||
|
// Aliquota applicata alla riga spesa
|
||||||
|
paf0800f.set("P8_ALIQIVA", rdoc.iva().percentuale());
|
||||||
|
if(sp.sogg_a_rit())
|
||||||
|
paf0800f.set("P8_RITENUTA", "SI");
|
||||||
|
paf0800f.set("P8_NATURA", rdoc.iva().natura());
|
||||||
|
|
||||||
|
// Inserisco il tutto nei dati riepilogo
|
||||||
|
TRiepilogo_agg& pop = _riepilogo_agg[rdoc.iva().codice()];
|
||||||
|
pop.imponibile += importo_cassa;
|
||||||
|
pop.imposta += importo_cassa * rdoc.iva().percentuale() / CENTO;
|
||||||
|
|
||||||
|
return insert(paf0800f);
|
||||||
|
}
|
||||||
|
|
||||||
const TFirm& TDoc_fp::get_firm()
|
const TFirm& TDoc_fp::get_firm()
|
||||||
{
|
{
|
||||||
return prefix().firm();
|
return prefix().firm();
|
||||||
@ -1307,14 +1389,16 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
paf3000f.set("PT_KEYHEADERFATT", _hfatt);
|
paf3000f.set("PT_KEYHEADERFATT", _hfatt);
|
||||||
paf3000f.set("PT_KEYBODYFATT", _bfatt);
|
paf3000f.set("PT_KEYBODYFATT", _bfatt);
|
||||||
remove(paf3000f);
|
remove(paf3000f);
|
||||||
long riga = 0;
|
long riga = 1;
|
||||||
|
|
||||||
|
|
||||||
FOR_EACH_PHYSICAL_RDOC(doc, r, rdoc)
|
FOR_EACH_PHYSICAL_RDOC(doc, r, rdoc)
|
||||||
{
|
{
|
||||||
|
bool skip_riga = false;
|
||||||
paf1800f.reset();
|
paf1800f.reset();
|
||||||
paf1800f.set("PI_KEYHEADERFATT", _hfatt);
|
paf1800f.set("PI_KEYHEADERFATT", _hfatt);
|
||||||
paf1800f.set("PI_KEYBODYFATT", _bfatt);
|
paf1800f.set("PI_KEYBODYFATT", _bfatt);
|
||||||
paf1800f.set("PI_NUMEROLINEA", ++riga);
|
paf1800f.set("PI_NUMEROLINEA", riga);
|
||||||
const TString& descrizione_riga = descrizione(*rdoc);
|
const TString& descrizione_riga = descrizione(*rdoc);
|
||||||
if (descrizione_riga.empty())
|
if (descrizione_riga.empty())
|
||||||
continue;
|
continue;
|
||||||
@ -1420,47 +1504,58 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
}
|
}
|
||||||
else if (rdoc->is_spese())
|
else if (rdoc->is_spese())
|
||||||
{
|
{
|
||||||
const TSpesa_prest& sp = rdoc->spesa();
|
const TSpesa_prest& sp = rdoc->spesa();
|
||||||
|
|
||||||
|
// Controllo se ha la cassa professionale lo metto in testata
|
||||||
|
if (sp.cassa_previdenziale().full())
|
||||||
|
{
|
||||||
|
ok &= add_cassa_previdenziale(*rdoc);
|
||||||
|
skip_riga = true;
|
||||||
|
}
|
||||||
|
// Altrimenti lo metto in riga
|
||||||
|
else
|
||||||
|
{
|
||||||
const real imp = rdoc->importo(true, false);
|
const real imp = rdoc->importo(true, false);
|
||||||
real qta = UNO;
|
real qta = UNO;
|
||||||
bool qta_inverse = false;
|
bool qta_inverse = false;
|
||||||
if (sp.is_tipo())
|
if (sp.is_tipo())
|
||||||
{
|
{
|
||||||
paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA));
|
paf1800f.set("PI_UNITAMISURA", rdoc->get(RDOC_UMQTA));
|
||||||
qta = rdoc->get_real(RDOC_QTA);
|
qta = rdoc->get_real(RDOC_QTA);
|
||||||
if (qta.is_zero())
|
if (qta.is_zero())
|
||||||
{
|
{
|
||||||
TString msg;
|
TString msg;
|
||||||
msg.format("La riga spese a quantità %d ha quantità nulla (campo %s)", riga, static_cast<const char*>(rdoc->field_qta()));
|
msg.format("La riga spese a quantità %d ha quantità nulla (campo %s)", riga, static_cast<const char*>(rdoc->field_qta()));
|
||||||
log(1, msg);
|
log(1, msg);
|
||||||
qta = UNO;
|
qta = UNO;
|
||||||
}
|
}
|
||||||
if(qta < ZERO)
|
if (qta < ZERO)
|
||||||
{
|
{
|
||||||
qta = -qta;
|
qta = -qta;
|
||||||
qta_inverse = true;
|
qta_inverse = true;
|
||||||
}
|
}
|
||||||
paf1800f.set("PI_QUANTITA", qta);
|
paf1800f.set("PI_QUANTITA", qta);
|
||||||
}
|
}
|
||||||
real prz = imp;
|
real prz = imp;
|
||||||
if (qta != UNO)
|
if (qta != UNO)
|
||||||
{
|
{
|
||||||
prz = rdoc->prezzo(true, false, 8);
|
prz = rdoc->prezzo(true, false, 8);
|
||||||
if (prz.is_zero() && !imp.is_zero())
|
if (prz.is_zero() && !imp.is_zero())
|
||||||
{
|
{
|
||||||
const TPrice price(imp / qta);
|
const TPrice price(imp / qta);
|
||||||
prz = price.get_value();
|
prz = price.get_value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
paf1800f.set("PI_PREZZOUNIT", converti_prezzo(qta_inverse ? -abs(prz) : abs(prz)));
|
paf1800f.set("PI_PREZZOUNIT", converti_prezzo(qta_inverse ? -abs(prz) : abs(prz)));
|
||||||
paf1800f.set("PI_PRZTOTALE", converti_prezzo(imp));
|
paf1800f.set("PI_PRZTOTALE", converti_prezzo(imp));
|
||||||
set_IVA(*rdoc, paf1800f);
|
set_IVA(*rdoc, paf1800f);
|
||||||
|
|
||||||
// Controllo se è una ritenuta fiscale
|
// Controllo se è una ritenuta fiscale
|
||||||
if (sp.tipo_ritenuta() == 'F')
|
if (sp.tipo_ritenuta() == 'F')
|
||||||
{
|
{
|
||||||
add_ritenuta(doc, rdoc->spesa(), paf0700f);
|
add_ritenuta(doc, rdoc->spesa(), paf0700f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (rdoc->is_prestazione())
|
else if (rdoc->is_prestazione())
|
||||||
{
|
{
|
||||||
@ -1564,9 +1659,12 @@ bool TDoc_fp::doc_to_paf(TDocumentoEsteso& doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// </ScontoMaggiorazione>
|
// </ScontoMaggiorazione>
|
||||||
|
if (!skip_riga)
|
||||||
paf1800f.set("PI_GESTIONE", "D");
|
{
|
||||||
ok &= insert(paf1800f) && insert(paf3000f);
|
paf1800f.set("PI_GESTIONE", "D");
|
||||||
|
ok &= insert(paf1800f) && insert(paf3000f);
|
||||||
|
riga++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Controllo plafond
|
// Controllo plafond
|
||||||
// Riga esenzione?
|
// Riga esenzione?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user