From 2432323f6fe9d8649b3f675cc04369065694d5fa Mon Sep 17 00:00:00 2001 From: luca Date: Mon, 5 Feb 2007 16:24:30 +0000 Subject: [PATCH] Patch level :4.0 606 Files correlati :ca3.exe Ricompilazione Demo : [ ] Commento :effettuato il sort in ordine alfabetico delle commesse e delle fasi nella stampa bilancio di commessa git-svn-id: svn://10.65.10.50/trunk@14844 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ca/ca3800.cpp | 39 ++++++++++++++++++++++++++++++++++++--- ca/ca3883.cpp | 14 ++++++++------ 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/ca/ca3800.cpp b/ca/ca3800.cpp index a98731fc5..bbfea2543 100755 --- a/ca/ca3800.cpp +++ b/ca/ca3800.cpp @@ -301,6 +301,38 @@ TAssoc_array& TPrint_bilancio_cms_recordset::get_row(TAssoc_array& cms, const ch } +static int righe_compare(const TObject** o1, const TObject** o2) +{ + TAssoc_array& a1 = *(TAssoc_array*)*o1; + TAssoc_array& a2 = *(TAssoc_array*)*o2; + + int cmp = 0; + + const int l1 = atoi(*(TString*)a1.objptr("LEVEL")); + const int l2 = atoi(*(TString*)a2.objptr("LEVEL")); + cmp = l1 - l2; + if (cmp == 0) + { + const TString& c1 = *(TString*)a1.objptr("CODCMS"); + const TString& c2 = *(TString*)a2.objptr("CODCMS"); + cmp = c1.compare(c2); + if (cmp == 0) + { + const TString& f1 = *(TString*)a1.objptr("FASE"); + const TString& f2 = *(TString*)a2.objptr("FASE"); + cmp = f1.compare(f2); + } + else + { + const int z1 = c1.starts_with("DETR_"); + const int z2 = c2.starts_with("DETR_"); + if (z1 || z2) + cmp = z1 - z2; + } + } + + return cmp; +} void TPrint_bilancio_cms_recordset::requery() { @@ -383,7 +415,7 @@ void TPrint_bilancio_cms_recordset::requery() const int anno = saldana.get(SALDANA_ANNO).as_int(); if (anno < _anno) { - TString cazzo_cod; cazzo_cod.format("DETR_%02d", _anno - 1); + TString16 cazzo_cod; cazzo_cod.format("DETR_%04d", _anno - 1); TString cazzo_descr = "DETRAZIONE PER COMPETENZA "; cazzo_descr << (_anno - 1); TAssoc_array& riga_array = get_row(cms[indice], CMS_DEL_CAZZO, indice, cazzo_cod, @@ -403,7 +435,7 @@ void TPrint_bilancio_cms_recordset::requery() { TAssoc_array& a = cms[i]; TObject* cazzo_cms = NULL; - + FOR_EACH_ASSOC_OBJECT(a, h, k, r) { TObject* obj = h->remove_obj(); @@ -412,9 +444,10 @@ void TPrint_bilancio_cms_recordset::requery() else _righe.add(obj); // Copia nella destinazione la riga corrente e la toglie dall'originale } - if (cazzo_cms != NULL) + if (cazzo_cms != NULL) _righe.add(cazzo_cms); } //for(int... + _righe.sort(righe_compare); //sorting delle commesse } const TVariant& TPrint_bilancio_cms_recordset::get(unsigned int column) const diff --git a/ca/ca3883.cpp b/ca/ca3883.cpp index b164eab5e..1903dfa0f 100755 --- a/ca/ca3883.cpp +++ b/ca/ca3883.cpp @@ -269,15 +269,15 @@ bool TCRPA_report::generate_columns (TString_array& codici, TString_array& testa TReport_section& head = section('H', j); if (head.items() > 0) { - TString ps; + TString ps(256); + ps = "MESSAGE "; //i campi dei totali da resettare sono tanti quante le colonne generate //k=0 per includere la colonna 69!!! usata nel caso i ricavi siano solo di livello 1 (depth=1) for (int k = 0; k <= codici.items(); k++) { - if (ps.full()) - ps << "\n"; - ps << "MESSAGE RESET,F"; - ps << head.level() << '.' << (k+model_id); + if (k > 0) + ps << '|'; + ps << "RESET,F" << head.level() << '.' << (k+model_id); } head.set_prescript(ps); } @@ -294,7 +294,9 @@ bool TCRPA_report::generate_columns (TString_array& codici, TString_array& testa else offset_and_fill_columns(foot, codici, model_id); } - +#ifdef DBG + save("cazzone.rep"); +#endif return true; }