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);
} }
} }
} }
@ -228,7 +228,8 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
imponibile += _pim->get_real("R0"); imponibile += _pim->get_real("R0");
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

@ -1,23 +1,23 @@
BUTTON DLG_SAVEREC 8 2 BUTTON DLG_SAVEREC 8 2
BEGIN BEGIN
PROMPT -14 -1 "~Registra" PROMPT -14 -1 "~Registra"
MESSAGE EXIT,K_SAVE MESSAGE EXIT,K_SAVE
END END
BUTTON DLG_RECALC 8 2 BUTTON DLG_RECALC 8 2
BEGIN BEGIN
PROMPT -24 -1 "Ri~calcola" PROMPT -24 -1 "Ri~calcola"
MESSAGE EXIT,K_INS MESSAGE EXIT,K_INS
END END
BUTTON DLG_CANCEL 8 2 BUTTON DLG_CANCEL 8 2
BEGIN BEGIN
PROMPT -34 -1 "" PROMPT -34 -1 ""
END END
BUTTON DLG_QUIT 8 2 BUTTON DLG_QUIT 8 2
BEGIN BEGIN
PROMPT -44 -1 "" PROMPT -44 -1 ""
MESSAGE EXIT,K_QUIT MESSAGE EXIT,K_QUIT
END END

View File

@ -73,8 +73,8 @@ 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);
if (found) if (found)
@ -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)

View File

@ -1,86 +1,86 @@
// classpim.h // classpim.h
// funzioni ed enum per classificare i pim // funzioni ed enum per classificare i pim
#ifndef __CLASSPIM_H #ifndef __CLASSPIM_H
#define __CLASSPIM_H #define __CLASSPIM_H
#ifndef __ISAM_H #ifndef __ISAM_H
#include <isam.h> #include <isam.h>
#endif #endif
#ifndef __REAL_H #ifndef __REAL_H
#include <real.h> #include <real.h>
#endif #endif
// per ora ci si fotte di agenzie viaggio e di // per ora ci si fotte di agenzie viaggio e di
// regimi agricoli // regimi agricoli
enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali
acq_simp = 2, vend_simp = 3, // acq. e vend. sosp. imposta acq_simp = 2, vend_simp = 3, // acq. e vend. sosp. imposta
bolle_doganali = 4, // bolle doganali (acquisti) bolle_doganali = 4, // bolle doganali (acquisti)
acq_beni_riv = 5, // acq. beni per rivendita acq_beni_riv = 5, // acq. beni per rivendita
base_ventilazione = 6, // base calcolo per ventil. base_ventilazione = 6, // base calcolo per ventil.
corr_norm = 7, corr_simp = 8, // corrispettivi n. e s. imp. corr_norm = 7, corr_simp = 8, // corrispettivi n. e s. imp.
acq_beni_ammort = 9, // acq. beni ammortizz. detr. acq_beni_ammort = 9, // acq. beni ammortizz. detr.
acq_beni_ammort_nd = 10, // beni ammort. non detraibili acq_beni_ammort_nd = 10, // beni ammort. non detraibili
acq_beni_leasing = 11, // beni strum. acq in leasing acq_beni_leasing = 11, // beni strum. acq in leasing
acq_amm_ultdetr = 12, // beni amm. ult. detr 6% acq_amm_ultdetr = 12, // beni amm. ult. detr 6%
acq_ind_op_es = 13, // acq. indetr. su op.es. acq_ind_op_es = 13, // acq. indetr. su op.es.
acq_ind_pass_int = 14, // passaggi interni acq_ind_pass_int = 14, // passaggi interni
acq_ind_art_19 = 15, // indetr. art. 19 acq_ind_art_19 = 15, // indetr. art. 19
cess_amm = 16, // cessioni amministrative cess_amm = 16, // cessioni amministrative
vend_rimborso = 17, // vendite valide per rimborso vend_rimborso = 17, // vendite valide per rimborso
acq_rimborso = 18 // acq. validi per rimborso acq_rimborso = 18 // acq. validi per rimborso
// ACHTUNG: se si aggiunge, cambiare sotto!!! // ACHTUNG: se si aggiunge, cambiare sotto!!!
}; };
// questo serve nel cpp ma lo metto qua se no // questo serve nel cpp ma lo metto qua se no
// non lo cambiero' mai quando serve // non lo cambiero' mai quando serve
const int MAX_TIPOREC = 18; const int MAX_TIPOREC = 18;
// --------------------------------------------------------------- // ---------------------------------------------------------------
// "classifica" un record progressivo IVA passato per reference // "classifica" un record progressivo IVA passato per reference
// mette l'imponibile in imp, l'imposta in iva, e in t mette // mette l'imponibile in imp, l'imposta in iva, e in t mette
// un valore dell'enum di cui sopra, che dice di che tipo e' // un valore dell'enum di cui sopra, che dice di che tipo e'
// l'importo ritornato // l'importo ritornato
// --------------------------------------------------------------- // ---------------------------------------------------------------
// RITORNA TRUE SE VA CHIAMATA ANCORA CON LO STESSO PIM come // RITORNA TRUE SE VA CHIAMATA ANCORA CON LO STESSO PIM come
// parametro (ovvero: ci sono altri valori da passare che fanno // parametro (ovvero: ci sono altri valori da passare che fanno
// parte dello stesso pim) // parte dello stesso pim)
// --------------------------------------------------------------- // ---------------------------------------------------------------
// mese, anno, attivita' vanno gestiti esternamente. Quando un pim // mese, anno, attivita' vanno gestiti esternamente. Quando un pim
// contiene dati che valgono per piu' di un caso, ritorna TRUE // contiene dati che valgono per piu' di un caso, ritorna TRUE
// finche' i casi possibili non sono esauriti // finche' i casi possibili non sono esauriti
// --------------------------------------------------------------- // ---------------------------------------------------------------
// ------------------------------- ESEMPIO che fa sempre bene // ------------------------------- ESEMPIO che fa sempre bene
// TTable pim("PIM"); // TTable pim("PIM");
// while (pim.first(); !pim.eof(); pim.next()) // while (pim.first(); !pim.eof(); pim.next())
// { // {
// real imponibile, imposta; // real imponibile, imposta;
// tiporec tipo; // tiporec tipo;
// //
// // Escludi i pim che non vuoi (per attivita', anno, mese) // // Escludi i pim che non vuoi (per attivita', anno, mese)
// if (questo_non_lo_volevo) continue; // if (questo_non_lo_volevo) continue;
// //
// //
// while (classify_pim(pim.curr(), imponibile, imposta, tipo)) // while (classify_pim(pim.curr(), imponibile, imposta, tipo))
// { // {
// switch(tipo) // switch(tipo)
// { // {
// case acq_norm: // case acq_norm:
// acq_imponibile += imponibile; // acq_imponibile += imponibile;
// acq_imposta += imposta; // acq_imposta += imposta;
// break; // break;
// // eccetera // // eccetera
// } // }
// } // }
// } // }
// //
// CONTENTA? ciao, f. :) // CONTENTA? ciao, f. :)
// ----------------------------------------------------------- // -----------------------------------------------------------
bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t); bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t);
#endif #endif