Patch level : 12.0 1096
Files correlati : cg4.exe Commento : Corretta la stampa dei progressivi sui registri nel caso di provressivi precedenti
This commit is contained in:
parent
1a2184724d
commit
4fbb00fdb5
@ -1,6 +1,7 @@
|
|||||||
#include "cg0800a.h"
|
#include "cg0800a.h"
|
||||||
|
|
||||||
TOOLBAR "topbar" 0 0 0 2
|
TOOLBAR "topbar" 0 0 0 2
|
||||||
|
|
||||||
BUTTON DLG_PRINT 2 2
|
BUTTON DLG_PRINT 2 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Stampa"
|
PROMPT 1 1 "Stampa"
|
||||||
|
@ -956,8 +956,6 @@ bool TStampa_registri_app::user_destroy()
|
|||||||
// del periodo precedente.
|
// del periodo precedente.
|
||||||
void TStampa_registri_app::calcola_progressivi()
|
void TStampa_registri_app::calcola_progressivi()
|
||||||
{
|
{
|
||||||
TString80 chiave, codtab;
|
|
||||||
|
|
||||||
int num=0;
|
int num=0;
|
||||||
if (_tipo_stampa == libro_unico)
|
if (_tipo_stampa == libro_unico)
|
||||||
num = _fino_a_mese; else
|
num = _fino_a_mese; else
|
||||||
@ -965,52 +963,57 @@ void TStampa_registri_app::calcola_progressivi()
|
|||||||
num = _datareg.month();
|
num = _datareg.month();
|
||||||
|
|
||||||
// Chiave per selezione records progressivi
|
// Chiave per selezione records progressivi
|
||||||
chiave << _annoIVA << _codatt;
|
|
||||||
|
|
||||||
//calcolo i totali del periodo; calcola anche i totali da Periodo Precedente (se _annoIVA > 1997)
|
//calcolo i totali del periodo; calcola anche i totali da Periodo Precedente (se _annoIVA > 1997)
|
||||||
//_codatt e' gia' Z perche' lo leggo dal registro
|
//_codatt e' gia' Z perche' lo leggo dal registro
|
||||||
//calcolo i totali progressivi e del periodo (tra questi anche quelli di cui periodo precedente)
|
//calcolo i totali progressivi e del periodo (tra questi anche quelli di cui periodo precedente)
|
||||||
for (int i=1; i<=num; i++)
|
for (int i=1; i<=num; i++)
|
||||||
{
|
{
|
||||||
const int start = 0, stop = (i == num) ? 1 : 0;
|
TRelation * rel = new TRelation(_tabname);
|
||||||
|
TRectype from(rel->curr());
|
||||||
|
TRectype to(rel->curr());
|
||||||
|
|
||||||
for (int j = start; j <= stop; j++)
|
TString keyf;
|
||||||
|
TString keyt;
|
||||||
|
TString select("(CODTAB[11,15]==\"");
|
||||||
|
|
||||||
|
select << _codreg << format("%02d", i) << "\")";
|
||||||
|
|
||||||
|
keyf <<_annoIVA << _codatt << 1 << _codreg << format("%02d", i);
|
||||||
|
keyt << _annoIVA << _codatt << 2 << _codreg << format("%02d", i);
|
||||||
|
from.put("CODTAB", keyf);
|
||||||
|
to.put("CODTAB", keyt);
|
||||||
|
|
||||||
|
TCursor c(rel, select, 1, &from, &to, 0x2);
|
||||||
|
TRectype & r = c.curr();
|
||||||
|
const int items = c.items();
|
||||||
|
|
||||||
|
for (c = 0L; c.pos() < items; ++c)
|
||||||
{
|
{
|
||||||
const bool calc_prp = j == 1; // Calcola progressivi precedenti
|
const TString & codtab = r.get("CODTAB");
|
||||||
TTable tab(calc_prp ? "PRP" : _tabname);
|
|
||||||
|
|
||||||
tab.zero();
|
|
||||||
tab.put("CODTAB", chiave);
|
|
||||||
|
|
||||||
const TRectype r(tab.curr());
|
|
||||||
|
|
||||||
tab.read(_isgteq);
|
|
||||||
for (; !tab.eof() && tab.curr() == r; tab.next())
|
|
||||||
{
|
|
||||||
codtab = tab.get("CODTAB");
|
|
||||||
TString4 codreg = codtab.mid(10,3); codreg.trim();
|
|
||||||
const int mese = atoi(codtab.mid(13, 2));
|
const int mese = atoi(codtab.mid(13, 2));
|
||||||
if (_codreg == codreg && mese == i)
|
|
||||||
{
|
|
||||||
const TString4 codiva = codtab.mid(16,4);
|
const TString4 codiva = codtab.mid(16,4);
|
||||||
const int tipodet = atoi(codtab.mid(20,1));
|
const int tipodet = atoi(codtab.mid(20,1));
|
||||||
real impo = tab.get_real("R0");
|
real impo = r.get_real("R0");
|
||||||
real impos = tab.get_real("R1");
|
real impos = r.get_real("R1");
|
||||||
real implo = tab.get_real("R2");
|
real implo = r.get_real("R2");
|
||||||
|
|
||||||
//se il registro e' corrispettivi l'imponibile e l'iva li trovo in S2
|
//se il registro e' corrispettivi l'imponibile e l'iva li trovo in S2
|
||||||
if (_corrispettivi)
|
if (_corrispettivi)
|
||||||
{
|
{
|
||||||
TToken_string cs (tab.get("S2"),'!');
|
TToken_string cs (r.get("S2"),'!');
|
||||||
|
|
||||||
impo = cs.get(0);
|
impo = cs.get(0);
|
||||||
impos = cs.get(1);
|
impos = cs.get(1);
|
||||||
}
|
}
|
||||||
//se in sospensione d'imposta l'imponibile e l'iva li trovo in R11 e R12
|
//se in sospensione d'imposta l'imponibile e l'iva li trovo in R11 e R12
|
||||||
if (_sosp_imposta)
|
if (_sosp_imposta)
|
||||||
{
|
{
|
||||||
impo = tab.get_real("R11");
|
impo = r.get_real("R11");
|
||||||
impos = tab.get_real("R12");
|
impos = r.get_real("R12");
|
||||||
}
|
}
|
||||||
TToken_string fatt_rit (tab.get("S1"),'!');
|
TToken_string fatt_rit (r.get("S1"),'!');
|
||||||
|
|
||||||
real im (fatt_rit.get(0));
|
real im (fatt_rit.get(0));
|
||||||
real is (fatt_rit.get(1));
|
real is (fatt_rit.get(1));
|
||||||
impo += im;
|
impo += im;
|
||||||
@ -1018,18 +1021,12 @@ void TStampa_registri_app::calcola_progressivi()
|
|||||||
implo += im+is;
|
implo += im+is;
|
||||||
if (impo != ZERO || impos != ZERO || implo != ZERO)
|
if (impo != ZERO || impos != ZERO || implo != ZERO)
|
||||||
{
|
{
|
||||||
if (!calc_prp && _tipo_stampa != prova)
|
if (_tipo_stampa != prova)
|
||||||
_tot_iva_array.add_riga(ZERO,ZERO,ZERO,impo,impos,implo,codiva); // progressivi
|
_tot_iva_array.add_riga(ZERO,ZERO,ZERO,impo,impos,implo,codiva); // progressivi
|
||||||
if (mese == num)
|
if (mese == num)
|
||||||
{
|
|
||||||
if (calc_prp)
|
|
||||||
_tot_prec_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva); // periodo prec
|
|
||||||
else
|
|
||||||
_tot_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva); // periodo
|
_tot_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva); // periodo
|
||||||
}
|
}
|
||||||
}
|
if (_tipo_reg == acquisto) //registro acquisti
|
||||||
|
|
||||||
if (!calc_prp && _tipo_reg == acquisto) //registro acquisti
|
|
||||||
{
|
{
|
||||||
if (impo != ZERO || impos != ZERO)
|
if (impo != ZERO || impos != ZERO)
|
||||||
{
|
{
|
||||||
@ -1039,9 +1036,71 @@ void TStampa_registri_app::calcola_progressivi()
|
|||||||
_iva_array.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,0,true, 0); // periodo
|
_iva_array.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,0,true, 0); // periodo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // for cursor
|
||||||
|
TRelation * relp = new TRelation("PRP");
|
||||||
|
TRectype fromp(relp->curr());
|
||||||
|
TRectype top(relp->curr());
|
||||||
|
|
||||||
|
keyf.trim();
|
||||||
|
keyt.trim();
|
||||||
|
fromp.put("CODTAB", keyf);
|
||||||
|
top.put("CODTAB", keyt);
|
||||||
|
|
||||||
|
TCursor cp(relp, select, 1, &fromp, &top, 0x2);
|
||||||
|
TRectype & rp = cp.curr();
|
||||||
|
const int itemsp = cp.items();
|
||||||
|
|
||||||
|
for (cp = 0L; cp.pos() < itemsp; ++cp)
|
||||||
|
{
|
||||||
|
const TString & codtab = rp.get("CODTAB");
|
||||||
|
const int mese = atoi(codtab.mid(13, 2));
|
||||||
|
const TString4 codiva = codtab.mid(16, 4);
|
||||||
|
const int tipodet = atoi(codtab.mid(20, 1));
|
||||||
|
real impo = rp.get_real("R0");
|
||||||
|
real impos = rp.get_real("R1");
|
||||||
|
real implo = rp.get_real("R2");
|
||||||
|
|
||||||
|
//se il registro e' corrispettivi l'imponibile e l'iva li trovo in S2
|
||||||
|
if (_corrispettivi)
|
||||||
|
{
|
||||||
|
TToken_string cs(rp.get("S2"), '!');
|
||||||
|
|
||||||
|
impo = cs.get(0);
|
||||||
|
impos = cs.get(1);
|
||||||
}
|
}
|
||||||
} // for table
|
//se in sospensione d'imposta l'imponibile e l'iva li trovo in R11 e R12
|
||||||
} // for start to stop
|
if (_sosp_imposta)
|
||||||
|
{
|
||||||
|
impo = rp.get_real("R11");
|
||||||
|
impos = rp.get_real("R12");
|
||||||
|
}
|
||||||
|
TToken_string fatt_rit(rp.get("S1"), '!');
|
||||||
|
real im(fatt_rit.get(0));
|
||||||
|
real is(fatt_rit.get(1));
|
||||||
|
|
||||||
|
impo += im;
|
||||||
|
impos += is;
|
||||||
|
implo += im + is;
|
||||||
|
if (impo != ZERO || impos != ZERO || implo != ZERO)
|
||||||
|
{
|
||||||
|
if (mese == num - 1)
|
||||||
|
{
|
||||||
|
_tot_prec_iva_array.add_riga(impo, impos, implo, ZERO, ZERO, ZERO, codiva); // periodo prec
|
||||||
|
_tot_iva_array.add_riga(impo, impos, implo, ZERO, ZERO, ZERO, codiva);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mese == num)
|
||||||
|
_tot_iva_array.add_riga(-impo, -impos, -implo, ZERO, ZERO, ZERO, codiva); // periodo prec
|
||||||
|
if (_tipo_stampa != prova)
|
||||||
|
{
|
||||||
|
_tot_iva_array.add_riga(ZERO, ZERO, ZERO, -impo, -impos, -implo, codiva); // progressivi
|
||||||
|
if (_tipo_reg == acquisto && (impo != ZERO || impos != ZERO))
|
||||||
|
_iva_array.add_riga(ZERO, ZERO, -impo, -impos, codiva, tipodet, 0, true, 0); //progressivi
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // for cursor
|
||||||
} // for i to num
|
} // for i to num
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4072,7 +4131,7 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
|
|||||||
TString80 chiave; chiave << _annoIVA << _tabreg->get("S8");
|
TString80 chiave; chiave << _annoIVA << _tabreg->get("S8");
|
||||||
|
|
||||||
// Calcolo riepilogo del periodo e progressivi in caso di stampa su bollato
|
// Calcolo riepilogo del periodo e progressivi in caso di stampa su bollato
|
||||||
for (int i=1; i<=m; i++)
|
/* for (int i=1; i<=m; i++)
|
||||||
{
|
{
|
||||||
int start = 0, stop = i==m ? 1 : 0; // Per il mese attuale si calcolano anche i progressivi precedenti a questo periodo (PRP)
|
int start = 0, stop = i==m ? 1 : 0; // Per il mese attuale si calcolano anche i progressivi precedenti a questo periodo (PRP)
|
||||||
for (int j = start; j <= stop; j++)
|
for (int j = start; j <= stop; j++)
|
||||||
@ -4136,8 +4195,8 @@ bool TStampa_registri_app::stampa_riepilogo(int m)
|
|||||||
}
|
}
|
||||||
} // for table
|
} // for table
|
||||||
} // for start to stop
|
} // for start to stop
|
||||||
} // for i to m
|
} // for i to m */
|
||||||
|
calcola_progressivi();
|
||||||
if (vect.items() > 0)
|
if (vect.items() > 0)
|
||||||
{
|
{
|
||||||
stampato = true;
|
stampato = true;
|
||||||
|
@ -450,7 +450,7 @@ int TParaliq_app::read(TMask& m)
|
|||||||
TCursor cur(&relpla, "", 1, &pla, &pla);
|
TCursor cur(&relpla, "", 1, &pla, &pla);
|
||||||
const TRecnotype items = cur.items();
|
const TRecnotype items = cur.items();
|
||||||
|
|
||||||
sf.destroy();
|
sf.reset();
|
||||||
if (items == 0)
|
if (items == 0)
|
||||||
init_array(sf); // Carica tutti i codici attività
|
init_array(sf); // Carica tutti i codici attività
|
||||||
else
|
else
|
||||||
|
@ -112,30 +112,9 @@ class TProgind;
|
|||||||
|
|
||||||
|
|
||||||
static const char * __date_field_name[] = { MOV_DATAREG, MOV_DATACOMP, MOV_DATACOMPCR };
|
static const char * __date_field_name[] = { MOV_DATAREG, MOV_DATACOMP, MOV_DATACOMPCR };
|
||||||
|
typedef enum { iva_errata = -1, nessuna_iva = 0, iva_vendite = 1, iva_acquisti = 2, libro_giornale = 5, iva_generica = 9 } TipoIVA;
|
||||||
enum TipoIVA
|
typedef enum { tm_nessuno = 0, tm_fattura = 1, tm_nota_credito = 2, tm_pagamento = 3, tm_insoluto = 5, tm_pagamento_insoluto = 6 } tipo_movimento;
|
||||||
{
|
typedef enum {
|
||||||
iva_errata = -1,
|
|
||||||
nessuna_iva = 0,
|
|
||||||
iva_vendite = 1,
|
|
||||||
iva_acquisti = 2,
|
|
||||||
libro_giornale = 5,
|
|
||||||
iva_generica = 9
|
|
||||||
};
|
|
||||||
|
|
||||||
enum tipo_movimento
|
|
||||||
{
|
|
||||||
tm_nessuno = 0,
|
|
||||||
tm_fattura = 1,
|
|
||||||
tm_nota_credito = 2,
|
|
||||||
tm_pagamento = 3,
|
|
||||||
tm_insoluto = 5,
|
|
||||||
tm_pagamento_insoluto = 6
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
enum cgrowtypes
|
|
||||||
{
|
|
||||||
cgrowtype_contabile = ' ', // riga contabile
|
cgrowtype_contabile = ' ', // riga contabile
|
||||||
cgrowtype_totale = 'T', // Totale documento
|
cgrowtype_totale = 'T', // Totale documento
|
||||||
cgrowtype_abbattivo = 'A', // Abbuoni attivi
|
cgrowtype_abbattivo = 'A', // Abbuoni attivi
|
||||||
@ -153,47 +132,12 @@ enum cgrowtypes
|
|||||||
cgrowtype_imponibile = 'I', // Imponibile/contropartita saldaconto
|
cgrowtype_imponibile = 'I', // Imponibile/contropartita saldaconto
|
||||||
cgrowtype_clisplit = '1', // Cliente per scissione pagamenti art.17-ter DPR 633/72
|
cgrowtype_clisplit = '1', // Cliente per scissione pagamenti art.17-ter DPR 633/72
|
||||||
cgrowtype_spese = 'G' // Spese del saladaconto
|
cgrowtype_spese = 'G' // Spese del saladaconto
|
||||||
};
|
} cgrowtypes;
|
||||||
|
typedef enum { nessuna_sospensione, sospensione_normale, vol_affari, liquidazione } tipo_sospensione;
|
||||||
enum tipo_sospensione
|
typedef enum { DataLimite = 1, UltimaImmissione} tipobil;
|
||||||
{
|
typedef enum { saldo_normale, saldo_apertura, saldo_chiusura} tiposal;
|
||||||
nessuna_sospensione,
|
typedef enum { Registrazione, Competenza, CostiRicavi } TTipo_data;
|
||||||
sospensione_normale,
|
typedef enum { vendita = 1, acquisto = 2, riepilogativo = 3, incassi = 4, giornale = 5, sociale = 6, cespiti = 7, giornale_magazzino = 9 } tiporeg;
|
||||||
vol_affari,
|
|
||||||
liquidazione
|
|
||||||
};
|
|
||||||
|
|
||||||
enum tipobil
|
|
||||||
{
|
|
||||||
DataLimite = 1,
|
|
||||||
UltimaImmissione
|
|
||||||
};
|
|
||||||
|
|
||||||
enum tiposal
|
|
||||||
{
|
|
||||||
saldo_normale,
|
|
||||||
saldo_apertura,
|
|
||||||
saldo_chiusura
|
|
||||||
};
|
|
||||||
|
|
||||||
enum TTipo_data
|
|
||||||
{
|
|
||||||
Registrazione,
|
|
||||||
Competenza,
|
|
||||||
CostiRicavi
|
|
||||||
};
|
|
||||||
|
|
||||||
enum tiporeg
|
|
||||||
{
|
|
||||||
vendita = 1,
|
|
||||||
acquisto = 2,
|
|
||||||
riepilogativo = 3,
|
|
||||||
incassi = 4,
|
|
||||||
giornale = 5,
|
|
||||||
sociale = 6,
|
|
||||||
cespiti = 7,
|
|
||||||
giornale_magazzino = 9
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool check_mov(const int tipomovprovv, const TString & provvis)
|
inline bool check_mov(const int tipomovprovv, const TString & provvis)
|
||||||
{
|
{
|
||||||
|
@ -172,6 +172,7 @@ public: // TObject
|
|||||||
real imposta(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola l'imposta sull'imponibile l'imposta e la ritorna
|
real imposta(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola l'imposta sull'imponibile l'imposta e la ritorna
|
||||||
real scorpora(real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Scorpora dall'imponibile l'imposta e la ritorna
|
real scorpora(real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Scorpora dall'imponibile l'imposta e la ritorna
|
||||||
real lordo(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola il lordo dell'imponibile l'imposta e la ritorna
|
real lordo(const real& imponibile, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola il lordo dell'imponibile l'imposta e la ritorna
|
||||||
|
real imponibile(const real& imposta, int ndec = AUTO_DECIMALS, const char * codval = "") const; // Calcola l'imponibile dell'imposta e lo ritorna
|
||||||
|
|
||||||
// bool reverse_charge() const;
|
// bool reverse_charge() const;
|
||||||
// bool reverse_charge_pubb() const;
|
// bool reverse_charge_pubb() const;
|
||||||
|
@ -403,26 +403,25 @@ bool TRiga_array::add_riga(const real& imponibile, const real& imposta, const
|
|||||||
const char* codiva)
|
const char* codiva)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i = 0; i < items(); i++)
|
|
||||||
|
for (int i = 0; !found && i < items(); i++)
|
||||||
{
|
{
|
||||||
TRiga& r = riga(i);
|
TRiga& r = riga(i);
|
||||||
if (r._codiva==codiva)
|
|
||||||
|
found = r._codiva == codiva;
|
||||||
|
if (found)
|
||||||
{
|
{
|
||||||
found = true;
|
|
||||||
r._imponibile += imponibile;
|
r._imponibile += imponibile;
|
||||||
r._imposta += imposta;
|
r._imposta += imposta;
|
||||||
r._implordo += implordo;
|
r._implordo += implordo;
|
||||||
r._imponibilep += imponibilep;
|
r._imponibilep += imponibilep;
|
||||||
r._impostap += impostap;
|
r._impostap += impostap;
|
||||||
r._implordop += implordop;
|
r._implordop += implordop;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
add(new TRiga(imponibile, imposta, implordo, imponibilep, impostap, implordop, codiva));
|
||||||
TRiga* r = new TRiga(imponibile,imposta,implordo,imponibilep,impostap,implordop,codiva);
|
|
||||||
add(r);
|
|
||||||
}
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user