Corretta la famosa palla del codice iva a cui ventilare (MI0539)

git-svn-id: svn://10.65.10.50/trunk@1003 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1995-02-15 10:43:04 +00:00
parent 348530163b
commit 88c4f0ce3c
8 changed files with 135 additions and 122 deletions

View File

@ -81,7 +81,7 @@ bool TLiquidazione_app::user_create()
_month = subj.get_int(1); _month = subj.get_int(1);
ditta = subj.get_long(2); ditta = subj.get_long(2);
char rcl = *(subj.get(3)); char rcl = *(subj.get(3));
recalc_only = rcl == 'C'; _recalc_only = rcl == 'C';
_is_visliq = rcl == 'V'; _is_visliq = rcl == 'V';
_isregis = (rcl == 'l' || rcl == 'L'); // stampa per registri _isregis = (rcl == 'l' || rcl == 'L'); // stampa per registri
_isfinal = rcl == 'l'; // se l minuscolo, definitivo _isfinal = rcl == 'l'; // se l minuscolo, definitivo
@ -162,7 +162,7 @@ bool TLiquidazione_app::user_create()
_plm_codatt = new TRecfield(*_plm_r,"CODTAB",4,9); _plm_codatt = new TRecfield(*_plm_r,"CODTAB",4,9);
_plm_mese = new TRecfield(*_plm_r,"CODTAB",10,11); _plm_mese = new TRecfield(*_plm_r,"CODTAB",10,11);
_pla_ditta = new TRecfield(*_pla_r,"CODTAB",0,4); _pla_ditta = new TRecfield(*_pla_r,"CODTAB",0,4);
_pla_anno = new TRecfield(*_pla_r,"CODTAB",5,8); _pla_anno = new TRecfield(*_pla_r,"CODTAB",5,8);
_pla_codatt = new TRecfield(*_pla_r,"CODTAB",9,14); _pla_codatt = new TRecfield(*_pla_r,"CODTAB",9,14);

View File

@ -91,6 +91,7 @@ public: // non e' bello, ma non e' bello neanche dover fare un
real _aliquota; // aliquota iva real _aliquota; // aliquota iva
real _totale; // totale acquisti real _totale; // totale acquisti
TString _codiva; // codice iva TString _codiva; // codice iva
TString _other; // codice iva a cui ventilare
_VentItem() : _imposta(0.0), _totale(0.0) {} _VentItem() : _imposta(0.0), _totale(0.0) {}
virtual ~_VentItem() {} virtual ~_VentItem() {}
}; };
@ -389,7 +390,7 @@ public:
// minchia di puro suino // minchia di puro suino
void add_vendite (int month, const char* codreg, int tipodet, real& r); void add_vendite (int month, const char* codreg, int tipodet, real& r);
void add_ventilation (real iva, real sum, const char* codiva); void add_ventilation (real iva, real sum, const char* codiva, const char* other);
void add_corrisp (int month, const char* codreg, real& r, real& p, void add_corrisp (int month, const char* codreg, real& r, real& p,
int tipodet, const char * codiva); int tipodet, const char * codiva);

View File

@ -78,7 +78,8 @@ bool TLiquidazione_app::is_date_ok(TDate& d, int month)
} }
void TLiquidazione_app::add_ventilation(real iva, real howmuch, const char* codiva) void TLiquidazione_app::add_ventilation(real iva, real howmuch,
const char* codiva, const char* other)
{ {
_VentItem* vi = NULL; _VentItem* vi = NULL;
for (int i = 0; i < _vent_arr.items(); i++) for (int i = 0; i < _vent_arr.items(); i++)
@ -92,6 +93,7 @@ void TLiquidazione_app::add_ventilation(real iva, real howmuch, const char* cod
_vent_arr.add(vi = new _VentItem); _vent_arr.add(vi = new _VentItem);
vi->_aliquota = iva; vi->_aliquota = iva;
vi->_codiva = codiva; vi->_codiva = codiva;
vi->_other = other;
} }
vi->_totale += howmuch; vi->_totale += howmuch;
} }

View File

@ -171,7 +171,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
look_iva(other); look_iva(other);
perc = _iva->get_real("R0"); perc = _iva->get_real("R0");
} }
add_ventilation(perc / CENTO, lurd, *_pim_codiva); add_ventilation(perc / CENTO, lurd, *_pim_codiva, other);
} }
} }
} }
@ -229,6 +229,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
imposta += _pim->get_real("R1"); imposta += _pim->get_real("R1");
_pim->put("R0", imponibile); _pim->put("R0", imponibile);
_pim->put("R1", imposta); _pim->put("R1", imposta);
_pim->put("S4", vv->_other);
// segnale per comodita' // segnale per comodita'
_pim->put("B1","X"); _pim->put("B1","X");
_pim->rewrite(); _pim->rewrite();

View File

@ -334,7 +334,15 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
TString tipoiva = _iva->get("S1"); TString tipoiva = _iva->get("S1");
int tipodet = atoi(*_pim_tipodet); int tipodet = atoi(*_pim_tipodet);
TString codiva((const char*)(*_pim_codiva)); TString codiva((const char*)(*_pim_codiva));
TString other = _pim->get("S4");
// ACHTUNG! Corrispettivi da ventileer possono ventilare
// ad un altro codiva; in tal caso si scrive quello
if (corrisp && !other.empty())
{
look_iva(other);
codiva = other;
}
// se e' corrispettivo da ventilare non // se e' corrispettivo da ventilare non
// scrivo un cannolo ripieno visto che e' stato ventilato // scrivo un cannolo ripieno visto che e' stato ventilato
if (tipomov == vendita && tipoiva == "VE") continue; if (tipomov == vendita && tipoiva == "VE") continue;
@ -361,9 +369,9 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
d = (_DescrItem*)&_descr_arr[i]; d = (_DescrItem*)&_descr_arr[i];
if (d->_flags == PIM_ROW && if (d->_flags == PIM_ROW &&
d->_s0 == ref && d->_s0 == ref &&
d->_s1 == (const char*)*_pim_codiva) d->_s1 == codiva)
break; break;
if (d->_s1 > (const char*)*_pim_codiva) if (d->_s1 > codiva)
{ {
isnew = TRUE; isnew = TRUE;
_DescrItem* dd = new _DescrItem(PIM_ROW); _DescrItem* dd = new _DescrItem(PIM_ROW);
@ -440,7 +448,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
if (isnew) if (isnew)
{ {
d->_s0 = ref; d->_s0 = ref;
d->_s1 = *_pim_codiva; d->_s1 = codiva;
// flag per stampare l'intestazione colonne // flag per stampare l'intestazione colonne
} }
} }

View File

@ -73,7 +73,7 @@ bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t)
} }
found = !imp.is_zero() || !iva.is_zero(); found = !imp.is_zero() || !iva.is_zero();
break; break;
case acq_beni_riv: case base_ventilazione:
found = (tipomov == 2 && tipodet != 9 && tipocr == 1); found = (tipomov == 2 && tipodet != 9 && tipocr == 1);
found &= (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES"); found &= (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES");
found &= (ricl ? TRUE : tipodet == 3); found &= (ricl ? TRUE : tipodet == 3);
@ -84,8 +84,9 @@ bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t)
} }
found &= !imp.is_zero() || !iva.is_zero(); found &= !imp.is_zero() || !iva.is_zero();
break; break;
case base_ventilazione: case acq_beni_riv:
found = (tipomov == 2 && tipodet != 9 && (tipocr == 1 || tipocr == 5)); found = (tipomov == 2 && tipodet != 9 &&
(tipocr == 1 || (tipocr == 5 && tipodet == 3)));
found &= tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES"; found &= tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES";
found &= (ricl ? TRUE : tipodet == 3); found &= (ricl ? TRUE : tipodet == 3);
if (found) if (found)