Patch level :2.2 178
Files correlati :ca3.exe Ricompilazione Demo : [ ] Commento : Stampa rendiconto: implementata la stampa per tutte le commesse in caso venga lasciato vuoto lo sheet nelle prima pagina git-svn-id: svn://10.65.10.50/trunk@13351 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a9ec6ae24d
commit
efcbae9cab
@ -1057,20 +1057,25 @@ void TPrint_rendiconto_ca_rep::set_filter(const TPrint_rendiconto_ca_mask& msk,
|
|||||||
class TPrint_rendiconto_ca : public TSkeleton_application
|
class TPrint_rendiconto_ca : public TSkeleton_application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
const TMultilevel_code_info& get_first_level() const;
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//metodo
|
||||||
|
const TMultilevel_code_info& TPrint_rendiconto_ca::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 TPrint_rendiconto_ca::main_loop()
|
void TPrint_rendiconto_ca::main_loop()
|
||||||
{
|
{
|
||||||
TPrint_rendiconto_ca_mask mask;
|
TPrint_rendiconto_ca_mask mask;
|
||||||
while (mask.run() == K_ENTER)
|
while (mask.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
|
||||||
const int n_righe_sheet = sheet.items();
|
|
||||||
//se lo sheet è vuoto aggiunge una riga vuota
|
|
||||||
if (n_righe_sheet == 0)
|
|
||||||
sheet.insert();
|
|
||||||
|
|
||||||
//report e book dei report
|
//report e book dei report
|
||||||
TReport_book book;
|
TReport_book book;
|
||||||
TString path = mask.get(F_REPORT);
|
TString path = mask.get(F_REPORT);
|
||||||
@ -1079,11 +1084,37 @@ void TPrint_rendiconto_ca::main_loop()
|
|||||||
TPrint_rendiconto_ca_rep rep;
|
TPrint_rendiconto_ca_rep rep;
|
||||||
rep.load(path);
|
rep.load(path);
|
||||||
|
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
|
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
||||||
|
if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)...
|
||||||
{
|
{
|
||||||
rep.set_filter(mask, r); //..chiama il metodone globale che crea e compila il file..
|
TToken_string& row = sheet.row(-1); //crea la prima riga dello sheet
|
||||||
//..temporaneo i cui dati riempiranno il report
|
|
||||||
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
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(), "Scansione commessa...", 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)
|
||||||
|
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(); //stampa il book dei report
|
book.print_or_preview(); //stampa il book dei report
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
bool is_required(int level) const;
|
bool is_required(int level) const;
|
||||||
const TString& prompt(int level) const;
|
const TString& prompt(int level) const;
|
||||||
const TFieldref& fieldref(int level, int key = 1) const;
|
const TFieldref& fieldref(int level, int key = 1) const;
|
||||||
|
int logic() const { return _logicnum; }
|
||||||
int parent() const { return _parentnum; }
|
int parent() const { return _parentnum; }
|
||||||
const TString& editor() const { return _editor; }
|
const TString& editor() const { return _editor; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user