diff --git a/ca/ca3800.cpp b/ca/ca3800.cpp
index 7f51e4e25..13ed08d56 100755
--- a/ca/ca3800.cpp
+++ b/ca/ca3800.cpp
@@ -96,7 +96,7 @@ TPrint_bilancio_cms_mask::TPrint_bilancio_cms_mask()
///////////////////////////////////////////////////////////////
class TPrint_bilancio_cms_recordset : public TRecordset
{
- TArray _righe;
+ TString_array _righe;
TRecnotype _curr;
TArray _colonne;
@@ -127,12 +127,44 @@ bool TPrint_bilancio_cms_recordset::move_to(TRecnotype pos)
void TPrint_bilancio_cms_recordset::requery()
{
- TArray cms1_1, cms1_2, cms2_1, cms2_2;
+ //prende le date di inizio e fine dell'eserizio selezionato sulla maschera
+ TString4 anno;
+ anno << _anno;
+ const TRectype& esc = cache().get("ESC", anno);
+ const TDate datainiesc = esc.get("D0");
+ const TDate datafinesc = esc.get("D1");
+
+ //deve procedere al confronto tra le date inizio-fine esercizio e quelle inizio-fine commessa..
+ //..per spostare il record in esame nell'array corretto
+ TString_array cms[4];
TISAM_recordset commesse("USE COMMESSE");
for (bool ok = commesse.move_first(); ok; ok = commesse.move_next())
{
const TDate dataini = commesse.get(COMMESSE_DATAINIZIO).as_date();
const TDate datafine = commesse.get(COMMESSE_DATAFINE).as_date();
+ //e' inutile considerare le commesse terminate prima dell'esercizio selezionato..
+ //..cioe' nel passato oppure che iniziano nel futuro!
+ if (datafine >= datainiesc && dataini <= datafinesc)
+ {
+ int indice = datafine <= datafinesc ? 0 : 2;
+ if (dataini >= datainiesc)
+ indice++;
+ TToken_string riga_array;
+ riga_array << indice;
+ riga_array.add(commesse.get(COMMESSE_CODCMS).as_string());
+ riga_array.add(commesse.get(COMMESSE_DESCRIZ).as_string());
+ cms[indice].add(riga_array);
+ }
+ }
+ //merging dei 4 arrayini cms nell'arrayone _righe da mandare in stampa
+ _righe.destroy();
+ for (int i = 0; i < 4; i++)
+ {
+ const int tot = cms[i].items();
+ for (int j = 0; j < tot; j++)
+ {
+ _righe.TArray::add(cms[i].remove(j));
+ }
}
}
@@ -143,6 +175,32 @@ const TVariant& TPrint_bilancio_cms_recordset::get(unsigned int column) const
const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) const
{
+ if (_curr >= 0 && _curr < items())
+ {
+ TToken_string& riga = (TToken_string&)_righe.row(_curr);
+
+ if (*column_name == '#')
+ column_name++;
+
+ TVariant& var = get_tmp_var();
+ if (strcmp(column_name, "ANNO") == 0)
+ {
+ var.set(_anno);
+ } else
+ if (strcmp(column_name, "LEVEL") == 0)
+ {
+ var.set(riga.get_int(0));
+ } else
+ if (strcmp(column_name, "CODCMS") == 0)
+ {
+ var = riga.get(1);
+ } else
+ if (strcmp(column_name, "DESCRIZ") == 0)
+ {
+ var = riga.get(2);
+ }
+ return var;
+ }
return NULL_VARIANT;
}
diff --git a/ca/ca3800a.rep b/ca/ca3800a.rep
index b66517236..164837a15 100755
--- a/ca/ca3800a.rep
+++ b/ca/ca3800a.rep
@@ -3,7 +3,7 @@
Bilancio commessa CA
-
+
#SYSTEM.RAGSOC
@@ -15,34 +15,68 @@
#REPORT.PAGE
-
+
-
- MESSAGE RESET,F1.101
-MESSAGE RESET,F1.102
+
-
- CONTO
+
+ LEVEL C; 2
- MESSAGE RESET,F2.101
-MESSAGE RESET,F2.102
-MESSAGE RESET,F2.103
-
-
+
+
+ LEVEL
+
+
+
+
+
+
+
+
+
+ ANNO
+
+
+
+ LEVEL
+ MESSAGE COPY,F2.101
+
+
+ ANNO
+ MESSAGE COPY,F2.102
-
- CODNUM+ANNO+NUMRD
-
+
+ LEVEL
+
+ LEVEL
+
+
+
+
+
+
+
+
+
+ LEVEL
+ MESSAGE COPY,F3.101
@@ -52,27 +86,51 @@ MESSAGE RESET,F2.103
CODCMS
- DESCR
+ DESCRIZ
-
-
-
-
+
-
+
+
-
-
+
+
+ F2.101
+
+
+
+
+
+
+
+
+
+ F2.102
+
+
+
+ MESSAGE COPY,F2.101
-
- 0 #B1.100 !
-
+
+
+
+ F3.101
+
+
+
+
+
+
+
USE COMMESSE
\ No newline at end of file