Corretta gestione righe IVA negative in fatture positive
git-svn-id: svn://10.65.10.50/branches/R_10_00@22805 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e9250397b0
commit
6cac0698e0
102
cg/cg3100.cpp
102
cg/cg3100.cpp
@ -54,6 +54,7 @@ class TListaMov_application : public TPrintapp
|
|||||||
int _ae, _anno, _annoes, _annoeser;
|
int _ae, _anno, _annoes, _annoeser;
|
||||||
bool _noseparator, _competence_only;
|
bool _noseparator, _competence_only;
|
||||||
real _totdocumenti, _totdoc, _totimponibile, _totimposta, _importo;
|
real _totdocumenti, _totdoc, _totimponibile, _totimposta, _importo;
|
||||||
|
real _totritenute, _ritenute, _gen_totritenute; // Aggiunte 11/02/2013
|
||||||
real _gen_totdocumenti, _gen_totimponibile, _gen_totimposta, _gen_op_esenti, _gen_op_non_imp;
|
real _gen_totdocumenti, _gen_totimponibile, _gen_totimposta, _gen_op_esenti, _gen_op_non_imp;
|
||||||
real _op_esenti, _op_non_imp; //, _impo, _impos;
|
real _op_esenti, _op_non_imp; //, _impo, _impos;
|
||||||
|
|
||||||
@ -1042,7 +1043,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
|||||||
_numr = curmov.get_long(MOV_NUMREG);
|
_numr = curmov.get_long(MOV_NUMREG);
|
||||||
_tipo_elenco = curmov.get(MOV_TIPO);
|
_tipo_elenco = curmov.get(MOV_TIPO);
|
||||||
_codcf = curmov.get_long(MOV_CODCF);
|
_codcf = curmov.get_long(MOV_CODCF);
|
||||||
int tiporeg = tipo_registro (codreg, anno);
|
const int tiporeg = tipo_registro (codreg, anno);
|
||||||
const TString8 attreg = AttivitaRegistro (codreg, anno);
|
const TString8 attreg = AttivitaRegistro (codreg, anno);
|
||||||
|
|
||||||
if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
|
if (tiporeg == 1 || tiporeg == 2)//se si tratta di un movimento iva
|
||||||
@ -1054,6 +1055,7 @@ bool TListaMov_application::preprocess_page(int file,int counter)
|
|||||||
_tipodoc = curmov.get(MOV_TIPODOC);
|
_tipodoc = curmov.get(MOV_TIPODOC);
|
||||||
_codval = curmov.get(MOV_CODVALI);
|
_codval = curmov.get(MOV_CODVALI);
|
||||||
_totdoc = curmov.get_real(MOV_TOTDOC);
|
_totdoc = curmov.get_real(MOV_TOTDOC);
|
||||||
|
_ritenute = curmov.get_real(MOV_RITFIS) + curmov.get_real(MOV_RITSOC);
|
||||||
|
|
||||||
if (_tipo_elenco != _tipo_clifo_prec && _tipo_clifo_prec != "")
|
if (_tipo_elenco != _tipo_clifo_prec && _tipo_clifo_prec != "")
|
||||||
printer().formfeed();
|
printer().formfeed();
|
||||||
@ -1348,6 +1350,7 @@ print_action TListaMov_application::postprocess_page(int file,int count)
|
|||||||
int rr = 1;
|
int rr = 1;
|
||||||
print_intra(rr);
|
print_intra(rr);
|
||||||
_totdocumenti += _totdoc;
|
_totdocumenti += _totdoc;
|
||||||
|
_totritenute += _ritenute;
|
||||||
TRecnotype pos, items;
|
TRecnotype pos, items;
|
||||||
bool FINITO = FALSE;
|
bool FINITO = FALSE;
|
||||||
|
|
||||||
@ -1361,8 +1364,8 @@ print_action TListaMov_application::postprocess_page(int file,int count)
|
|||||||
cur->save_status();
|
cur->save_status();
|
||||||
++(*cur);
|
++(*cur);
|
||||||
// long numrsucc = cur->file(LF_MOV).get_long(MOV_NUMREG);
|
// long numrsucc = cur->file(LF_MOV).get_long(MOV_NUMREG);
|
||||||
_tipoelsucc = cur->file(LF_MOV).get(MOV_TIPO);
|
_tipoelsucc = cur->curr(LF_MOV).get(MOV_TIPO);
|
||||||
_codclifosucc = cur->file(LF_MOV).get_long(MOV_CODCF);
|
_codclifosucc = cur->curr(LF_MOV).get_long(MOV_CODCF);
|
||||||
--(*cur);
|
--(*cur);
|
||||||
cur->restore_status();
|
cur->restore_status();
|
||||||
}
|
}
|
||||||
@ -1370,24 +1373,26 @@ print_action TListaMov_application::postprocess_page(int file,int count)
|
|||||||
if (FINITO || (_tipo_elenco != _tipoelsucc)||(_codcf != _codclifosucc))
|
if (FINITO || (_tipo_elenco != _tipoelsucc)||(_codcf != _codclifosucc))
|
||||||
{
|
{
|
||||||
set_row(rr++,"");
|
set_row(rr++,"");
|
||||||
if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
|
if (_tipo_elenco == "C")
|
||||||
set_row(rr++, FR("@bTotali Cliente@18gDocumenti Totale documenti@47gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp."));
|
set_row(rr++, FR("@bTotali Cliente@18gDocumenti Totale documenti@45gRitenute/IVA CEE@68gImponibile@86gImposta@102gop. esenti@119gop. non imp."));
|
||||||
else
|
else
|
||||||
set_row(rr++, FR("@bTotali Fornitore@18gDocumenti Totale documenti@49gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp."));
|
set_row(rr++, FR("@bTotali Fornitore@18gDocumenti Totale documenti@45gRitenute/IVA CEE@68gImponibile@86gImposta@102gop. esenti@119gop. non imp."));
|
||||||
set_row(rr, "@b@18g%9d", _documenti);
|
set_row(rr, "@b@18g%9d", _documenti);
|
||||||
set_row(rr, "@b@28g%r", &_totdocumenti);
|
set_row(rr, "@b@28g%r", &_totdocumenti);
|
||||||
set_row(rr, "@b@57g%r", &_totimponibile);
|
set_row(rr, "@b@45g%r", &_totritenute);
|
||||||
set_row(rr, "@b@73g%r", &_totimposta);
|
set_row(rr, "@b@62g%r", &_totimponibile);
|
||||||
set_row(rr, "@b@92g%r", &_op_esenti);
|
set_row(rr, "@b@79g%r", &_totimposta);
|
||||||
set_row(rr, "@b@110g%r", &_op_non_imp);
|
set_row(rr, "@b@96g%r", &_op_esenti);
|
||||||
|
set_row(rr, "@b@113g%r", &_op_non_imp);
|
||||||
|
|
||||||
//incrementa i totali generali di stampa!!!
|
//incrementa i totali generali di stampa!!!
|
||||||
_gen_documenti += _documenti;
|
_gen_documenti += _documenti;
|
||||||
_gen_totdocumenti += _totdocumenti;
|
_gen_totdocumenti += _totdocumenti;
|
||||||
_gen_totimponibile += _totimponibile;
|
_gen_totritenute += _totritenute;
|
||||||
_gen_totimposta += _totimposta;
|
_gen_totimponibile += _totimponibile;
|
||||||
_gen_op_esenti += _op_esenti;
|
_gen_totimposta += _totimposta;
|
||||||
_gen_op_non_imp += _op_non_imp;
|
_gen_op_esenti += _op_esenti;
|
||||||
|
_gen_op_non_imp += _op_non_imp;
|
||||||
|
|
||||||
_totimposta = 0;
|
_totimposta = 0;
|
||||||
_totimponibile = 0;
|
_totimponibile = 0;
|
||||||
@ -1395,33 +1400,36 @@ print_action TListaMov_application::postprocess_page(int file,int count)
|
|||||||
_op_non_imp = 0;
|
_op_non_imp = 0;
|
||||||
_documenti = 0;
|
_documenti = 0;
|
||||||
_totdocumenti = 0;
|
_totdocumenti = 0;
|
||||||
|
_totritenute = 0;
|
||||||
//return REPEAT_PAGE;
|
//return REPEAT_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FINITO) //ha veramente finito questa stupida stampa: stampa i totali generali!
|
if (FINITO) //ha veramente finito questa stupida stampa: stampa i totali generali!
|
||||||
{
|
{
|
||||||
TString blank = "";
|
const TString& blank = EMPTY_STRING;
|
||||||
set_row(rr++,(const char*)blank);
|
set_row(rr++,(const char*)blank);
|
||||||
set_row(rr++,(const char*)blank);
|
set_row(rr++,(const char*)blank);
|
||||||
set_row(rr++,(const char*)blank);
|
set_row(rr++,(const char*)blank);
|
||||||
|
|
||||||
set_row(rr++, FR("@bTOTALI GENERALI @18gDocumenti Totale documenti@47gAllegati:@63gImponibile@82gImposta@95gop. esenti@110gop. non imp."));
|
set_row(rr++, FR("@bTOTALI GENERALI @18gDocumenti Totale documenti@45gRitenute/IVA CEE@68gImponibile@88gImposta@102gop. esenti@119gop. non imp."));
|
||||||
|
|
||||||
set_row(rr, "@b@18g%9d", _gen_documenti);
|
set_row(rr, "@b@18g%9d", _gen_documenti);
|
||||||
set_row(rr, "@b@28g%r", &_gen_totdocumenti);
|
set_row(rr, "@b@28g%r", &_gen_totdocumenti);
|
||||||
set_row(rr, "@b@57g%r", &_gen_totimponibile);
|
set_row(rr, "@b@45g%r", &_gen_totritenute);
|
||||||
set_row(rr, "@b@73g%r", &_gen_totimposta);
|
set_row(rr, "@b@62g%r", &_gen_totimponibile);
|
||||||
set_row(rr, "@b@89g%r", &_gen_op_esenti);
|
set_row(rr, "@b@79g%r", &_gen_totimposta);
|
||||||
set_row(rr, "@b@104g%r", &_gen_op_non_imp);
|
set_row(rr, "@b@96g%r", &_gen_op_esenti);
|
||||||
|
set_row(rr, "@b@113g%r", &_gen_op_non_imp);
|
||||||
|
|
||||||
//alla fine della stampa azzera i totali generali
|
//alla fine della stampa azzera i totali generali
|
||||||
_gen_documenti = 0;
|
_gen_documenti = 0;
|
||||||
_gen_totdocumenti = 0;
|
_gen_totdocumenti = 0;
|
||||||
_gen_totimponibile = 0;
|
_gen_totritenute = 0;
|
||||||
_gen_totimposta = 0;
|
_gen_totimponibile = 0;
|
||||||
_gen_op_esenti = 0;
|
_gen_totimposta = 0;
|
||||||
_gen_op_non_imp = 0;
|
_gen_op_esenti = 0;
|
||||||
}
|
_gen_op_non_imp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (rr > 1)
|
if (rr > 1)
|
||||||
return REPEAT_PAGE;
|
return REPEAT_PAGE;
|
||||||
@ -1894,7 +1902,7 @@ void TListaMov_application::incrementa_totali()
|
|||||||
const TString4 codiva = rmoviva.get(RMI_CODIVA);
|
const TString4 codiva = rmoviva.get(RMI_CODIVA);
|
||||||
|
|
||||||
const TRectype& tabiva = cache().get("%IVA", codiva);
|
const TRectype& tabiva = cache().get("%IVA", codiva);
|
||||||
if ((_tipo_elenco == "C")||(_tipo_elenco == "c"))
|
if (_tipo_elenco == "C")
|
||||||
{
|
{
|
||||||
const int colonna = tabiva.get_int("S7");
|
const int colonna = tabiva.get_int("S7");
|
||||||
if ((colonna == 1)||(colonna == 3))
|
if ((colonna == 1)||(colonna == 3))
|
||||||
@ -1910,14 +1918,16 @@ void TListaMov_application::incrementa_totali()
|
|||||||
const int colonna = tabiva.get_int("S8");
|
const int colonna = tabiva.get_int("S8");
|
||||||
if ((colonna == 1)||(colonna == 3)||(colonna == 4))
|
if ((colonna == 1)||(colonna == 3)||(colonna == 4))
|
||||||
_totimposta += imposta;
|
_totimposta += imposta;
|
||||||
if (colonna == 1)
|
switch (colonna)
|
||||||
_totimponibile += imponibile;
|
{
|
||||||
else
|
case 1: _totimponibile += imponibile; break;
|
||||||
if (colonna == 3)
|
case 3: _op_esenti += imponibile; break;
|
||||||
_op_esenti += imponibile;
|
case 4: _op_non_imp += imponibile; break;
|
||||||
else
|
default:
|
||||||
if (colonna == 4)
|
TString msg; msg << TR("Codice IVA senza colonna allegato fornitori '") << codiva << "'";
|
||||||
_op_non_imp += imponibile;
|
xvtil_statbar_set(msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2214,12 +2224,14 @@ void TListaMov_application::init_print(const TMask& msk)
|
|||||||
_numeroregp = 0;
|
_numeroregp = 0;
|
||||||
_documenti = 0;
|
_documenti = 0;
|
||||||
_totdocumenti = 0;
|
_totdocumenti = 0;
|
||||||
|
_totritenute = 0;
|
||||||
_totimponibile = 0;
|
_totimponibile = 0;
|
||||||
_totimposta = 0;
|
_totimposta = 0;
|
||||||
_op_esenti = 0;
|
_op_esenti = 0;
|
||||||
_op_non_imp = 0;
|
_op_non_imp = 0;
|
||||||
_gen_documenti = 0;
|
_gen_documenti = 0;
|
||||||
_gen_totdocumenti = 0;
|
_gen_totdocumenti = 0;
|
||||||
|
_gen_totritenute = 0;
|
||||||
_gen_totimponibile = 0;
|
_gen_totimponibile = 0;
|
||||||
_gen_totimposta = 0;
|
_gen_totimposta = 0;
|
||||||
_gen_op_esenti = 0;
|
_gen_op_esenti = 0;
|
||||||
|
@ -683,7 +683,14 @@ bool TLiquidazione_app::residuo_da_liquidare(long numreg, int numrig, const TDat
|
|||||||
imposta += TImporto(sez, id.get(RMI_IMPOSTA).as_real());
|
imposta += TImporto(sez, id.get(RMI_IMPOSTA).as_real());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (imponib.valore() > ZERO)
|
|
||||||
|
bool is_good = imponib.valore() > ZERO;
|
||||||
|
if (!is_good)
|
||||||
|
{
|
||||||
|
const real totdoc = cache().get(LF_MOV, numreg, MOV_TOTDOC);
|
||||||
|
is_good = totdoc > ZERO;
|
||||||
|
}
|
||||||
|
if (is_good)
|
||||||
{
|
{
|
||||||
importo_res = importo.valore();
|
importo_res = importo.valore();
|
||||||
imponib_res = imponib.valore();
|
imponib_res = imponib.valore();
|
||||||
@ -972,7 +979,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
|||||||
const bool cau_intra = rcs.get_bool("INTRACOM");
|
const bool cau_intra = rcs.get_bool("INTRACOM");
|
||||||
const bool cau_valintra = rcs.get_bool("VALINTRA");
|
const bool cau_valintra = rcs.get_bool("VALINTRA");
|
||||||
|
|
||||||
if (_mov->get_long(MOV_NUMREG) == 31838)
|
if (_mov->get_long(MOV_NUMREG) == 63630)
|
||||||
int cazzone = 1;
|
int cazzone = 1;
|
||||||
|
|
||||||
// Inizio gestione IVA differita
|
// Inizio gestione IVA differita
|
||||||
|
@ -554,9 +554,9 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina)
|
|||||||
// determina casistica
|
// determina casistica
|
||||||
enum { mm, tt, mt, tm, boh } history = boh;
|
enum { mm, tt, mt, tm, boh } history = boh;
|
||||||
real divide_by_three = 1.0;
|
real divide_by_three = 1.0;
|
||||||
char thh = *_freqviva;
|
const char thh = *_freqviva;
|
||||||
|
|
||||||
const TString16 thyear = _year;
|
const TString4 thyear = _year;
|
||||||
_year.format("%d", atoi(_year)-1);
|
_year.format("%d", atoi(_year)-1);
|
||||||
|
|
||||||
if (!look_lia())
|
if (!look_lia())
|
||||||
|
@ -1936,7 +1936,7 @@ bool TStampa_registri_app::print_IVAxCassa(int da_month, int a_month)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TString query;
|
TString query;
|
||||||
query = "USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))&&(MOV.REG=#REG)&&(TIPOMOV>2)&&(STR(IMPONIBILE>0))";
|
query = "USE IVADIFF SELECT (BETWEEN(DATAREGP,#DAL,#AL))&&(MOV.REG=#REG)&&(TIPOMOV>2)&&(STR(MOV.TOTDOC>0))";
|
||||||
query << "\nBY DATAREGP DATAREG";
|
query << "\nBY DATAREGP DATAREG";
|
||||||
query << "\nJOIN MOV INTO NUMREG==NUMREG";
|
query << "\nJOIN MOV INTO NUMREG==NUMREG";
|
||||||
query << "\nJOIN CLIFO TO MOV INTO TIPOCF==TIPO CODCF==CODCF";
|
query << "\nJOIN CLIFO TO MOV INTO TIPOCF==TIPO CODCF==CODCF";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user