diff --git a/src/cg/cg1500a1.rep b/src/cg/cg1500a1.rep
index 0236ff5bc..540716e77 100644
--- a/src/cg/cg1500a1.rep
+++ b/src/cg/cg1500a1.rep
@@ -93,7 +93,7 @@ GET_FIRM_DATA
-
+
GRUPPO1
@@ -151,7 +151,7 @@ THEN
-
+
@@ -220,7 +220,7 @@ THEN
THEN
-
+
@@ -232,7 +232,7 @@ THEN
#THIS !
-
+
diff --git a/src/cg/cg1500a2.rep b/src/cg/cg1500a2.rep
index bf2d76bd0..6b42a76d2 100644
--- a/src/cg/cg1500a2.rep
+++ b/src/cg/cg1500a2.rep
@@ -93,7 +93,7 @@ GET_FIRM_DATA
-
+
GRUPPO1
@@ -151,7 +151,7 @@ THEN
-
+
@@ -189,8 +189,8 @@ THEN
THEN
- #307-#308
- #THIS @
+ #307+#308
+ #THIS @
0
E;
IF
@@ -220,7 +220,7 @@ THEN
THEN
-
+
@@ -232,7 +232,7 @@ THEN
#THIS !
-
+
diff --git a/src/cg/cg1501.cpp b/src/cg/cg1501.cpp
index 2a5ebebd6..7e58b8144 100644
--- a/src/cg/cg1501.cpp
+++ b/src/cg/cg1501.cpp
@@ -214,6 +214,10 @@ bool TBilancio_mask::on_field_event(TOperable_field& o, TField_event e, long jol
show(F_QUADRATURA, bilancio == 2 && tipo_stampa == 1 && data == datalim);
}
break;
+ case F_NORMALI:
+ if (e == fe_init && o.mask().get(DLG_PROFILE).blank())
+ o.set("X");
+ break;
}
return true;
}
@@ -249,6 +253,29 @@ void TSezioni_contrapposte_recset::calculate_saldo(const TRectype & rec)
else
_last_saldo.data_limite_bilancio(tipo_data, _last_conto.gruppo(), _last_conto.conto(), _last_conto.sottoconto(), _dataini, _datalim, _last_indbil, _tipi_mov);
}
+ if (_esercizio_prec > 0)
+ {
+ if (_last_indbil > 2 && _last_indbil < 5)
+ {
+ TSaldo prec;
+ if (_contsep.full())
+ prec.saldo_cont_sep(tipo_data, _last_conto.gruppo(), _last_conto.conto(), _last_conto.sottoconto(), _esercizio_prec, _datalim, _last_indbil, _contsep, _tipi_mov);
+ else
+ prec.ultima_immissione_bilancio(_esercizio_prec, _last_conto.gruppo(), _last_conto.conto(), _last_conto.sottoconto(), _last_indbil, _tipi_mov, false);
+ TImporto s('D', prec.saldo());
+
+ _sbilancio_prec += s;
+ }
+ else
+ {
+ TImporto s('D', _last_saldo.saldoini());
+
+ _sbilancio_prec += s;
+ }
+ }
+
+
+
}
void TSezioni_contrapposte_recset::update_record(const TRectype & rec) // da fare
@@ -257,7 +284,6 @@ void TSezioni_contrapposte_recset::update_record(const TRectype & rec) // da far
TString key;
TImporto s('D', _last_saldo.saldoini());
- _sbilancio_prec += s;
s += TImporto('D', _last_saldo.prgdare());
s += TImporto('A', _last_saldo.prgavere());
s.valore().round(TCurrency::get_firm_dec());
@@ -544,6 +570,10 @@ void TSezioni_contrapposte_recset::update_index() // da fare
void TSezioni_contrapposte_recset::set_filter(const TMask& msk)
{
_esercizio = msk.get_int(F_ANNO);
+ if (_esercizio > 0)
+ _esercizio_prec = esercizi().pred(_esercizio);
+ else
+ _esercizio_prec = 0;
_tipo_data = msk.get_int(F_STAMPA);
_dataini = msk.get_date(F_DATAINI);
_datalim = msk.get_date(F_DATALIM);
@@ -672,12 +702,12 @@ TRecordset* TSezioni_contrapposte::recordset() const
void TSezioni_contrapposte::init(const char * name, int sez)
{
TFilename repname(name);
- const int sez_bil = (sez + 1) * 2 - 1;
+ const int sez_bil = sez * 2 - 1;
repname = repname.name_only();
if (atoi(repname.right(1)) > 0)
repname.rtrim(1);
- repname << (sez + 1);
+ repname << sez;
load(repname);
_recset->set_sez(sez_bil);
_st_codici_conto = _mask.get_bool(F_CODICI);
@@ -1273,7 +1303,7 @@ void TStampa_bilanci_avanzata::execute_print(TReport_book & book, TAutomask & ma
{
if (mask.get_int(F_BILANCIO) == SEZIONI_CONTRAPPOSTE)
{
- for (int i = 0; i < 4; i++)
+ for (int i = 1; i < 4; i++)
{
((TSezioni_contrapposte &)rep).init(report_name(mask), i);
TReport_application::execute_print(book, mask, rep, type);
diff --git a/src/cg/cg1501.h b/src/cg/cg1501.h
index abd27a10a..44a04dad5 100644
--- a/src/cg/cg1501.h
+++ b/src/cg/cg1501.h
@@ -76,6 +76,7 @@ class TSezioni_contrapposte_recset : TRecordset
int _sez_bil;
int _esercizio;
+ int _esercizio_prec;
int _tipo_data;
TDate _dataini;
TDate _datalim;