diff --git a/ca/ca3800.cpp b/ca/ca3800.cpp
index 5e23d37a3..7a60a9a2a 100755
--- a/ca/ca3800.cpp
+++ b/ca/ca3800.cpp
@@ -159,6 +159,7 @@ class TPrint_bilancio_cms_recordset : public TRecordset
private:
int _anno;
+ int _depth;
bool _vitaintera, _use_fasi;
char _tipostima;
@@ -173,7 +174,7 @@ protected:
virtual const TVariant& get(unsigned int column) const;
virtual const TVariant& get(const char* column_name) const;
- void parse_bill(const TString& bill, TString& gruppo, TString& conto) const;
+ void parse_bill(const TString& bill, TString& conto) const;
int estrai_saldi(const TRecordset& saldana, const int indbil,
TImporto& saldo, TImporto& saldop) const;
void aggiorna_importo(TAssoc_array& riga_array, const TString& livello,
@@ -194,7 +195,7 @@ bool TPrint_bilancio_cms_recordset::move_to(TRecnotype pos)
}
-void TPrint_bilancio_cms_recordset::parse_bill(const TString& bill, TString& gruppo, TString& conto) const
+void TPrint_bilancio_cms_recordset::parse_bill(const TString& bill, TString& conto) const
{
TConfig& cfg = ca_config();
const TMultilevel_code_info& pconana_info = ca_multilevel_code_info(LF_PCONANA);
@@ -203,12 +204,10 @@ void TPrint_bilancio_cms_recordset::parse_bill(const TString& bill, TString& gru
//lunghezza dell'eventuale prefisso di gruppo e conto
const int prefix_len = (prefix >= 0) ? pconana_info.total_len(prefix) : 0;
- const int gruppo_len = pconana_info.len(prefix + 1);
- const int conto_len = pconana_info.len(prefix + 2);
+ const int conto_end = pconana_info.total_len(_depth) - prefix_len;
- //stringhe con gruppo e conto da mettere nel record dell'assoc_array
- gruppo = bill.mid(prefix_len, gruppo_len);
- conto = bill.mid(prefix_len, gruppo_len + conto_len);
+ //stringa con cio' che segue il prefisso ed e' richiesto
+ conto = bill.mid(prefix_len, conto_end);
}
@@ -368,8 +367,9 @@ void TPrint_bilancio_cms_recordset::requery()
TAssoc_array& riga_array = get_row(cms[indice], chiave, indice, codcms, fase,
rec_commesse.get(COMMESSE_DESCRIZ));
//aggiunge gli importi e normalizza
- TString80 gruppo, conto;
- parse_bill(conto_anale, gruppo, conto);
+ const char* gruppo = indbil == 3 ? "COSTI" : "RICAVI";
+ TString80 conto;
+ parse_bill(conto_anale, conto);
aggiorna_importo(riga_array, gruppo, indbil, saldana);
aggiorna_importo(riga_array, conto, indbil, saldana);
@@ -439,6 +439,11 @@ const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) cons
var.set(_tipostima == 'T' ? "T" : "C");
}
else
+ if (strcmp(column_name, "LEVEL") == 0)
+ {
+ var.set(_depth);
+ }
+ else
if (strcmp(column_name, "AVANZAMENTO") == 0)
{
//Calcola lo stato di avanzamento della commessa
@@ -497,8 +502,8 @@ void TPrint_bilancio_cms_recordset::set_filter(const TPrint_bilancio_cms_mask& m
TString80 prefix;
for (short id = F_PRE1; id <= F_PRE3 && msk.id2pos(id) > 0; id++)
prefix << msk.get(id);
-
_indicatori.set_prefix(prefix);
+ _depth = msk.get_int(F_DEPTH);
}
////////////////////////////////////////////////////////
diff --git a/ca/ca3800a.rep b/ca/ca3800a.rep
index 6605e3d86..c7d5c7384 100755
--- a/ca/ca3800a.rep
+++ b/ca/ca3800a.rep
@@ -125,12 +125,29 @@ MESSAGE RESET,F3.108
MESSAGE ADD,F3.69
- #MARGINE
+ #RICAVI-#COSTI
MESSAGE ADD,F3.169
#PERCMARGINE
+ #RICAVI @
+0
+=
+IF
+0
+ELSE
+1
+#COSTI @
+#RICAVI @
+F;
+-
+100
+*
+0
+ROUND
+THEN
+#THIS !
diff --git a/ca/ca3883.cpp b/ca/ca3883.cpp
index ca4670633..ac3691b96 100755
--- a/ca/ca3883.cpp
+++ b/ca/ca3883.cpp
@@ -142,14 +142,24 @@ void TCRPA_report::analize_pconana_structure (const TString& prefix, const int d
}
}
//se c'e' piu' di un campo da stampare per i Ricavi -> ci vuole un campo Totale per i ricavi
- if (codici_r.items() > 1)
+ if (codici_r.items() >= 1)
{
+ if (codici_r.items() == 1) //se il campo da stampare e' uno solo va
+ {
+ codici_r.destroy();
+ testate_r.destroy();
+ }
codici_r.add("#RICAVI");
testate_r.add(TR("RICAVI"));
}
//..analogo per i Costi
- if (codici_c.items() > 1)
+ if (codici_c.items() >= 1)
{
+ if (codici_c.items() == 1)
+ {
+ codici_c.destroy();
+ testate_c.destroy();;
+ }
codici_c.add("#COSTI");
testate_c.add(TR("COSTI"));
}
@@ -194,10 +204,13 @@ void TCRPA_report::offset_and_fill_columns(TReport_section& rep_sect, const TStr
}
if (sect_type == 'H')
new_field->set_picture(str_arr.row(i));
- else
+ if (sect_type == 'B')
new_field->set_field(str_arr.row(i));
+ if (sect_type == 'F')
+ new_field->set_field("");
}
+ //sposta a destra gli ultimi campi non generati
const TReport_field& ultimo_campo = rep_sect.field(rep_sect.last());
const TPoint offset(ultimo_campo.get_rect().right() - rep_field.get_rect().right(), 0);
@@ -214,6 +227,7 @@ bool TCRPA_report::generate_columns (TString_array& codici, TString_array& testa
//sezioni del report da modificare
TReport_section& h0 = section('H', 0);
TReport_section& b1 = section('B', 1);
+ TReport_section& f3 = section('F', 3);
//controllo dell'esistenza dei campi modello da replicare e loro duplicazione e riempimento!
TReport_field* b1_69 = b1.find_field(69);
@@ -226,6 +240,11 @@ bool TCRPA_report::generate_columns (TString_array& codici, TString_array& testa
return warning_box(TR("Manca l'intestazione della colonna modello (H0.69)"));
offset_and_fill_columns(h0, testate);
+ TReport_field* f3_69 = f3.find_field(69);
+ if (f3_69 == NULL)
+ return warning_box(TR("Manca l'intestazione della colonna modello (F3.69)"));
+ offset_and_fill_columns(f3, codici);
+
return true;
}