Patch level :2.2 390

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :aggiunta modalità allo sheet delle commesse/cdc uguale a quella della CA


git-svn-id: svn://10.65.10.50/trunk@13869 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2006-03-31 12:43:10 +00:00
parent 1184d0e150
commit 7acca48b02

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <progind.h>
#include <reprint.h>
#include "ci1200.h"
@ -348,27 +349,69 @@ void TRiepiloghi_report::set_filter(const TRiepiloghi_mask& msk, int cms_row)
class TRiepiloghi_app : public TSkeleton_application
{
protected:
const TMultilevel_code_info& get_first_level() const;
virtual void main_loop();
};
//metodo per accattarsi o' primo livello della configurazione CA
const TMultilevel_code_info& TRiepiloghi_app::get_first_level() const
{
TConfig& cfg = ca_config();
const TString& first_lev = cfg.get("Level(1)");
const int logic = first_lev == "CDC" ? LF_CDC : LF_COMMESSE;
return ca_multilevel_code_info(logic);
}
void TRiepiloghi_app::main_loop()
{
TRiepiloghi_mask m;
while (m.run() != K_QUIT)
TRiepiloghi_mask mask;
while (mask.run() != K_QUIT)
{
TReport_book book;
TRiepiloghi_report rep;
const TString& repname = m.get(F_REPORT);
const TString& repname = mask.get(F_REPORT);
rep.load(repname);
TSheet_field& sf = m.sfield(F_COMMESSE);
if (sf.items() == 0)
sf.row(-1);
for (int i = 0; i < sf.items(); i++)
{
rep.set_filter(m, i);
book.add(rep);
}
TSheet_field& sheet = mask.sfield(F_COMMESSE);
TString video_string; //stringa che compare nella progind
if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)...
{
TToken_string& row = sheet.row(-1); //crea la prima riga dello sheet
const TMultilevel_code_info& liv1 = get_first_level(); //stabilisce quale è il primo livello (tra CDC e CMS)..
TISAM_recordset set(liv1.logic() == LF_CDC ? "USE CDC" : "USE COMMESSE"); //..e di conseguenza scrive la use giusta
TProgind pi(set.items(), video_string, true, true);
for (int i = 0; set.move_to(i); i++) //fighissimo metodo per scandire un file in 1 riga!
{
pi.addstatus(1);
if (pi.iscancelled())
break;
row = set.get((unsigned int)0).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
video_string = TR("Scansione");
video_string << " " << row; //completa la stringa da visualizzare sulla progind
pi.set_text(video_string);
for (int l = liv1.levels()-2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring
row.insert("|", liv1.total_len(l));
rep.set_filter(mask, 0); //fa la set filter sulla prima riga (che è quella usata)
book.add(rep);
}
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
}
else //se ha almeno una riga sullo sheet delle cms/cdc...
{
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
{
rep.set_filter(mask, r); //..chiama il metodone globale che crea e compila il file..
//..temporaneo i cui dati riempiranno il report
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
}
}
book.print_or_preview();
}