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:
parent
348530163b
commit
88c4f0ce3c
@ -81,7 +81,7 @@ bool TLiquidazione_app::user_create()
|
||||
_month = subj.get_int(1);
|
||||
ditta = subj.get_long(2);
|
||||
char rcl = *(subj.get(3));
|
||||
recalc_only = rcl == 'C';
|
||||
_recalc_only = rcl == 'C';
|
||||
_is_visliq = rcl == 'V';
|
||||
_isregis = (rcl == 'l' || rcl == 'L'); // stampa per registri
|
||||
_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_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_codatt = new TRecfield(*_pla_r,"CODTAB",9,14);
|
||||
|
||||
|
@ -91,6 +91,7 @@ public: // non e' bello, ma non e' bello neanche dover fare un
|
||||
real _aliquota; // aliquota iva
|
||||
real _totale; // totale acquisti
|
||||
TString _codiva; // codice iva
|
||||
TString _other; // codice iva a cui ventilare
|
||||
_VentItem() : _imposta(0.0), _totale(0.0) {}
|
||||
virtual ~_VentItem() {}
|
||||
};
|
||||
@ -389,7 +390,7 @@ public:
|
||||
|
||||
// minchia di puro suino
|
||||
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,
|
||||
int tipodet, const char * codiva);
|
||||
|
||||
|
@ -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;
|
||||
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);
|
||||
vi->_aliquota = iva;
|
||||
vi->_codiva = codiva;
|
||||
vi->_other = other;
|
||||
}
|
||||
vi->_totale += howmuch;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
|
||||
look_iva(other);
|
||||
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");
|
||||
imposta += _pim->get_real("R1");
|
||||
_pim->put("R0", imponibile);
|
||||
_pim->put("R1", imposta);
|
||||
_pim->put("R1", imposta);
|
||||
_pim->put("S4", vv->_other);
|
||||
// segnale per comodita'
|
||||
_pim->put("B1","X");
|
||||
_pim->rewrite();
|
||||
|
@ -334,7 +334,15 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
||||
TString tipoiva = _iva->get("S1");
|
||||
int tipodet = atoi(*_pim_tipodet);
|
||||
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
|
||||
// scrivo un cannolo ripieno visto che e' stato ventilato
|
||||
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];
|
||||
if (d->_flags == PIM_ROW &&
|
||||
d->_s0 == ref &&
|
||||
d->_s1 == (const char*)*_pim_codiva)
|
||||
d->_s1 == codiva)
|
||||
break;
|
||||
if (d->_s1 > (const char*)*_pim_codiva)
|
||||
if (d->_s1 > codiva)
|
||||
{
|
||||
isnew = TRUE;
|
||||
_DescrItem* dd = new _DescrItem(PIM_ROW);
|
||||
@ -440,7 +448,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
|
||||
if (isnew)
|
||||
{
|
||||
d->_s0 = ref;
|
||||
d->_s1 = *_pim_codiva;
|
||||
d->_s1 = codiva;
|
||||
// flag per stampare l'intestazione colonne
|
||||
}
|
||||
}
|
||||
|
46
cg/cg5500t.h
46
cg/cg5500t.h
@ -1,23 +1,23 @@
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BEGIN
|
||||
PROMPT -14 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
|
||||
BUTTON DLG_RECALC 8 2
|
||||
BEGIN
|
||||
PROMPT -24 -1 "Ri~calcola"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -34 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -44 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
BUTTON DLG_SAVEREC 8 2
|
||||
BEGIN
|
||||
PROMPT -14 -1 "~Registra"
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
|
||||
BUTTON DLG_RECALC 8 2
|
||||
BEGIN
|
||||
PROMPT -24 -1 "Ri~calcola"
|
||||
MESSAGE EXIT,K_INS
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 8 2
|
||||
BEGIN
|
||||
PROMPT -34 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 8 2
|
||||
BEGIN
|
||||
PROMPT -44 -1 ""
|
||||
MESSAGE EXIT,K_QUIT
|
||||
END
|
||||
|
||||
|
@ -73,8 +73,8 @@ bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t)
|
||||
}
|
||||
found = !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case acq_beni_riv:
|
||||
found = (tipomov == 2 && tipodet != 9 && tipocr == 1);
|
||||
case base_ventilazione:
|
||||
found = (tipomov == 2 && tipodet != 9 && tipocr == 1);
|
||||
found &= (tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES");
|
||||
found &= (ricl ? TRUE : tipodet == 3);
|
||||
if (found)
|
||||
@ -84,8 +84,9 @@ bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t)
|
||||
}
|
||||
found &= !imp.is_zero() || !iva.is_zero();
|
||||
break;
|
||||
case base_ventilazione:
|
||||
found = (tipomov == 2 && tipodet != 9 && (tipocr == 1 || tipocr == 5));
|
||||
case acq_beni_riv:
|
||||
found = (tipomov == 2 && tipodet != 9 &&
|
||||
(tipocr == 1 || (tipocr == 5 && tipodet == 3)));
|
||||
found &= tipoiva != "NS" && tipoiva != "NI" && tipoiva != "ES";
|
||||
found &= (ricl ? TRUE : tipodet == 3);
|
||||
if (found)
|
||||
|
170
cg/classpim.h
170
cg/classpim.h
@ -1,86 +1,86 @@
|
||||
// classpim.h
|
||||
// funzioni ed enum per classificare i pim
|
||||
|
||||
#ifndef __CLASSPIM_H
|
||||
#define __CLASSPIM_H
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
|
||||
// per ora ci si fotte di agenzie viaggio e di
|
||||
// regimi agricoli
|
||||
|
||||
enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali
|
||||
acq_simp = 2, vend_simp = 3, // acq. e vend. sosp. imposta
|
||||
bolle_doganali = 4, // bolle doganali (acquisti)
|
||||
acq_beni_riv = 5, // acq. beni per rivendita
|
||||
base_ventilazione = 6, // base calcolo per ventil.
|
||||
corr_norm = 7, corr_simp = 8, // corrispettivi n. e s. imp.
|
||||
acq_beni_ammort = 9, // acq. beni ammortizz. detr.
|
||||
acq_beni_ammort_nd = 10, // beni ammort. non detraibili
|
||||
acq_beni_leasing = 11, // beni strum. acq in leasing
|
||||
acq_amm_ultdetr = 12, // beni amm. ult. detr 6%
|
||||
acq_ind_op_es = 13, // acq. indetr. su op.es.
|
||||
acq_ind_pass_int = 14, // passaggi interni
|
||||
acq_ind_art_19 = 15, // indetr. art. 19
|
||||
cess_amm = 16, // cessioni amministrative
|
||||
vend_rimborso = 17, // vendite valide per rimborso
|
||||
acq_rimborso = 18 // acq. validi per rimborso
|
||||
// ACHTUNG: se si aggiunge, cambiare sotto!!!
|
||||
};
|
||||
|
||||
// questo serve nel cpp ma lo metto qua se no
|
||||
// non lo cambiero' mai quando serve
|
||||
const int MAX_TIPOREC = 18;
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// "classifica" un record progressivo IVA passato per reference
|
||||
// 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'
|
||||
// l'importo ritornato
|
||||
// ---------------------------------------------------------------
|
||||
// RITORNA TRUE SE VA CHIAMATA ANCORA CON LO STESSO PIM come
|
||||
// parametro (ovvero: ci sono altri valori da passare che fanno
|
||||
// parte dello stesso pim)
|
||||
// ---------------------------------------------------------------
|
||||
// mese, anno, attivita' vanno gestiti esternamente. Quando un pim
|
||||
// contiene dati che valgono per piu' di un caso, ritorna TRUE
|
||||
// finche' i casi possibili non sono esauriti
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
// ------------------------------- ESEMPIO che fa sempre bene
|
||||
// TTable pim("PIM");
|
||||
// while (pim.first(); !pim.eof(); pim.next())
|
||||
// {
|
||||
// real imponibile, imposta;
|
||||
// tiporec tipo;
|
||||
//
|
||||
// // Escludi i pim che non vuoi (per attivita', anno, mese)
|
||||
// if (questo_non_lo_volevo) continue;
|
||||
//
|
||||
//
|
||||
// while (classify_pim(pim.curr(), imponibile, imposta, tipo))
|
||||
// {
|
||||
// switch(tipo)
|
||||
// {
|
||||
// case acq_norm:
|
||||
// acq_imponibile += imponibile;
|
||||
// acq_imposta += imposta;
|
||||
// break;
|
||||
// // eccetera
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// CONTENTA? ciao, f. :)
|
||||
// -----------------------------------------------------------
|
||||
|
||||
bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t);
|
||||
|
||||
// classpim.h
|
||||
// funzioni ed enum per classificare i pim
|
||||
|
||||
#ifndef __CLASSPIM_H
|
||||
#define __CLASSPIM_H
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
|
||||
|
||||
// per ora ci si fotte di agenzie viaggio e di
|
||||
// regimi agricoli
|
||||
|
||||
enum tiporec { acq_norm = 0, vend_norm = 1, // acquisti e vendite normali
|
||||
acq_simp = 2, vend_simp = 3, // acq. e vend. sosp. imposta
|
||||
bolle_doganali = 4, // bolle doganali (acquisti)
|
||||
acq_beni_riv = 5, // acq. beni per rivendita
|
||||
base_ventilazione = 6, // base calcolo per ventil.
|
||||
corr_norm = 7, corr_simp = 8, // corrispettivi n. e s. imp.
|
||||
acq_beni_ammort = 9, // acq. beni ammortizz. detr.
|
||||
acq_beni_ammort_nd = 10, // beni ammort. non detraibili
|
||||
acq_beni_leasing = 11, // beni strum. acq in leasing
|
||||
acq_amm_ultdetr = 12, // beni amm. ult. detr 6%
|
||||
acq_ind_op_es = 13, // acq. indetr. su op.es.
|
||||
acq_ind_pass_int = 14, // passaggi interni
|
||||
acq_ind_art_19 = 15, // indetr. art. 19
|
||||
cess_amm = 16, // cessioni amministrative
|
||||
vend_rimborso = 17, // vendite valide per rimborso
|
||||
acq_rimborso = 18 // acq. validi per rimborso
|
||||
// ACHTUNG: se si aggiunge, cambiare sotto!!!
|
||||
};
|
||||
|
||||
// questo serve nel cpp ma lo metto qua se no
|
||||
// non lo cambiero' mai quando serve
|
||||
const int MAX_TIPOREC = 18;
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// "classifica" un record progressivo IVA passato per reference
|
||||
// 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'
|
||||
// l'importo ritornato
|
||||
// ---------------------------------------------------------------
|
||||
// RITORNA TRUE SE VA CHIAMATA ANCORA CON LO STESSO PIM come
|
||||
// parametro (ovvero: ci sono altri valori da passare che fanno
|
||||
// parte dello stesso pim)
|
||||
// ---------------------------------------------------------------
|
||||
// mese, anno, attivita' vanno gestiti esternamente. Quando un pim
|
||||
// contiene dati che valgono per piu' di un caso, ritorna TRUE
|
||||
// finche' i casi possibili non sono esauriti
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
// ------------------------------- ESEMPIO che fa sempre bene
|
||||
// TTable pim("PIM");
|
||||
// while (pim.first(); !pim.eof(); pim.next())
|
||||
// {
|
||||
// real imponibile, imposta;
|
||||
// tiporec tipo;
|
||||
//
|
||||
// // Escludi i pim che non vuoi (per attivita', anno, mese)
|
||||
// if (questo_non_lo_volevo) continue;
|
||||
//
|
||||
//
|
||||
// while (classify_pim(pim.curr(), imponibile, imposta, tipo))
|
||||
// {
|
||||
// switch(tipo)
|
||||
// {
|
||||
// case acq_norm:
|
||||
// acq_imponibile += imponibile;
|
||||
// acq_imposta += imposta;
|
||||
// break;
|
||||
// // eccetera
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// CONTENTA? ciao, f. :)
|
||||
// -----------------------------------------------------------
|
||||
|
||||
bool classify_pim(TRectype& pimr, real& imp, real& iva, tiporec& t);
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user