Patch level :10.0 660

Files correlati     :ca3 and masks
Ricompilazione Demo : [ ]
Commento            :
Implementata l'anteprima in tutte le stampe di CA


git-svn-id: svn://10.65.10.50/trunk@20180 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-03-02 16:05:52 +00:00
parent 8e4d3a080a
commit 52ffd1164c
14 changed files with 515 additions and 280 deletions

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <defmask.h>
#include <execp.h>
#include <reprint.h>
@ -64,6 +65,20 @@ bool TPrint_movimenti_ca_mask::on_field_event(TOperable_field& o, TField_event e
{
switch (o.dlg())
{
case DLG_PRINT:
if (e == fe_button)
{
main_app().print();
return false;
}
break;
case DLG_PREVIEW:
if (e == fe_button)
{
main_app().preview();
return false;
}
break;
case F_TIPOSTAMPA:
if (e == fe_init || e == fe_modify)
{
@ -346,34 +361,21 @@ void TPrint_movimenti_ca_rep::set_filter(const TPrint_movimenti_ca_mask& msk, in
////////////////////////////////////////////////////////
class TPrint_movimenti_ca : public TSkeleton_application
{
TPrint_movimenti_ca_mask * _mask;
TPrint_movimenti_ca_mask* _mask;
protected:
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM
virtual bool create();
virtual bool destroy();
void print_or_preview(const bool stampa);
virtual void print();
virtual void preview();
public:
virtual void main_loop();
};
bool TPrint_movimenti_ca::create()
{
_mask = new TPrint_movimenti_ca_mask;
return TSkeleton_application::create();
}
bool TPrint_movimenti_ca::destroy()
void TPrint_movimenti_ca::print_or_preview(const bool stampa)
{
delete _mask;
return TSkeleton_application::destroy();
}
void TPrint_movimenti_ca::main_loop()
{
while (_mask->run() == K_ENTER)
{
//costruzione della query x il report in base ai parametri della maschera
TSheet_field& sheet = _mask->sfield(F_RIGHE);
const int n_righe_sheet = sheet.items();
@ -393,8 +395,28 @@ void TPrint_movimenti_ca::main_loop()
book.add(rep);
}
book.print_or_preview(); //stampa il book dei report
}
if (stampa)
book.print(); //stampa il book dei report
else
book.preview(); //anteprima il book dei report
}
void TPrint_movimenti_ca::print()
{
print_or_preview(true);
}
void TPrint_movimenti_ca::preview()
{
print_or_preview(false);
}
void TPrint_movimenti_ca::main_loop()
{
_mask = new TPrint_movimenti_ca_mask;
_mask->run();
delete _mask;
_mask = NULL;
}
int ca3100(int argc, char* argv[])

View File

@ -2,7 +2,7 @@
#include "camask.h"
TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
#include <aprintbar.h>
ENDPAGE
TOOLBAR "bottombar" 0 -2 0 1

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <defmask.h>
#include <execp.h>
#include <progind.h>
#include <reprint.h>
@ -68,6 +69,20 @@ bool TPrint_mastrini_ca_mask::on_field_event(TOperable_field& o, TField_event e,
{
switch (o.dlg())
{
case DLG_PRINT:
if (e == fe_button)
{
main_app().print();
return false;
}
break;
case DLG_PREVIEW:
if (e == fe_button)
{
main_app().preview();
return false;
}
break;
case F_TIPOCONTI:
if (e == fe_init || e == fe_modify)
{
@ -570,75 +585,100 @@ void TPrint_mastrini_ca_rep::set_filter(const TPrint_mastrini_ca_mask& msk, int
////////////////////////////////////////////////////////
class TPrint_mastrini_ca : public TSkeleton_application
{
TPrint_mastrini_ca_mask* _mask;
protected:
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM
void print_or_preview(const bool stampa);
virtual void print();
virtual void preview();
virtual void main_loop();
};
void TPrint_mastrini_ca::print()
{
print_or_preview(true);
}
void TPrint_mastrini_ca::preview()
{
print_or_preview(false);
}
void TPrint_mastrini_ca::print_or_preview(const bool stampa)
{
//report e book dei report
TReport_book book;
TString path = _mask->get(F_REPORT);
if (path.empty())
path = "ca3200a";
TPrint_mastrini_ca_rep rep;
rep.load(path);
TSheet_field& sheet = _mask->sfield(F_RIGHE);
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
//stabilisce quale è il primo livello (tra CDC e CMS)..
const TMultilevel_code_info& liv1 = *ca_multilevel_code_info_by_index(0);
const int logic1 = liv1.logic();
TISAM_recordset set(logic1 == LF_CDC ? "USE CDC" : "USE COMMESSE"); //..e di conseguenza scrive la use giusta
bool skip_closed = false;
if (logic1 == LF_COMMESSE)
skip_closed = !yesno_box(TR("E' stata richiesta la stampa di tutte le commesse:\n"
"Si desidera includere anche le commesse chiuse?"));
TProgind pi(set.items(), video_string, true, true);
for (bool sok = set.move_first(); sok; sok = set.move_next()) //fighissimo metodo per scandire un file in 1 riga!
{
if (!pi.addstatus(1))
break;
if (skip_closed && set.get(COMMESSE_CHIUSA).as_bool())
continue;
row = set.get(0u).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
//completa la stringa da visualizzare sulla progind
video_string.cut(0) << row << '\n' << set.get(1u);
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
{
FOR_EACH_SHEET_ROW(sheet, r, row)
{
rep.set_filter(*_mask, r);
book.add(rep);
}
}
if (stampa)
book.print(); //stampa il book dei report
else
book.preview(); //anteprima
}
void TPrint_mastrini_ca::main_loop()
{
TPrint_mastrini_ca_mask mask;
while (mask.run() == K_ENTER)
{
//report e book dei report
TReport_book book;
TString path = mask.get(F_REPORT);
if (path.empty())
path = "ca3200a";
TPrint_mastrini_ca_rep rep;
rep.load(path);
TSheet_field& sheet = mask.sfield(F_RIGHE);
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
//stabilisce quale è il primo livello (tra CDC e CMS)..
const TMultilevel_code_info& liv1 = *ca_multilevel_code_info_by_index(0);
const int logic1 = liv1.logic();
TISAM_recordset set(logic1 == LF_CDC ? "USE CDC" : "USE COMMESSE"); //..e di conseguenza scrive la use giusta
bool skip_closed = false;
if (logic1 == LF_COMMESSE)
skip_closed = !yesno_box(TR("E' stata richiesta la stampa di tutte le commesse:\n"
"Si desidera includere anche le commesse chiuse?"));
TProgind pi(set.items(), video_string, true, true);
for (bool sok = set.move_first(); sok; sok = set.move_next()) //fighissimo metodo per scandire un file in 1 riga!
{
if (!pi.addstatus(1))
break;
if (skip_closed && set.get(COMMESSE_CHIUSA).as_bool())
continue;
row = set.get(0u).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
//completa la stringa da visualizzare sulla progind
video_string.cut(0) << row << '\n' << set.get(1u);
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
{
FOR_EACH_SHEET_ROW(sheet, r, row)
{
rep.set_filter(mask, r);
book.add(rep);
}
}
book.print_or_preview(); //stampa il book dei report
}
_mask = new TPrint_mastrini_ca_mask;
_mask->run();
delete _mask;
_mask = NULL;
}
int ca3200(int argc, char* argv[])

View File

@ -2,7 +2,7 @@
#include "camask.h"
TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
#include <aprintbar.h>
ENDPAGE
TOOLBAR "bottombar" 0 -2 0 1

View File

@ -1,18 +1,17 @@
#include "ca3.h"
#include "calib01.h"
#include "calib02.h"
#include <defmask.h>
#include <execp.h>
#include <progind.h>
#include <reprint.h>
#include <pconti.h>
#include "movana.h"
#include "pconana.h"
#include "rmovana.h"
#include "../cg/cglib01.h"
#include "ca3.h"
#include "calib01.h"
#include "calib02.h"
#include "ca3300.h"
////////////////////////////////////////////////////////
@ -84,6 +83,21 @@ bool TPrint_bilancio_ca_mask::on_field_event(TOperable_field& o, TField_event e,
{
switch (o.dlg())
{
case DLG_PRINT:
if (e == fe_button)
{
main_app().print();
return false;
}
break;
case DLG_PREVIEW:
if (e == fe_button)
{
main_app().preview();
return false;
}
break;
case F_ANNO:
case F_BILANCIO:
case F_STAMPA:
@ -1006,60 +1020,87 @@ void TReport_bilancio_sezioni_contrapposte::set_filter(const TMask& m, int row)
class TPrint_bilancio_ca : public TSkeleton_application
{
TPrint_bilancio_ca_mask* _mask;
protected:
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM
void bilancio_a_sezioni_contrapposte(TMask& mask);
void bilancio_di_verifica(TMask& msk);
void bilancio_a_sezioni_contrapposte(const bool stampa);
void bilancio_di_verifica(const bool stampa);
void print_or_preview(const bool stampa);
virtual void print();
virtual void preview();
public:
virtual void main_loop();
};
void TPrint_bilancio_ca::bilancio_a_sezioni_contrapposte(TMask& mask)
void TPrint_bilancio_ca::bilancio_a_sezioni_contrapposte(const bool stampa)
{
TReport_bilancio_sezioni_contrapposte rep(mask.get(F_REPORT));
TReport_bilancio_sezioni_contrapposte rep(_mask->get(F_REPORT));
const int rows = mask.sfield(F_RIGHE).items();
const int rows = _mask->sfield(F_RIGHE).items();
TReport_book book;
for (int i = 0; i < rows; i++)
{
rep.set_filter(mask, i);
rep.set_filter(*_mask, i);
book.add(rep);
}
book.print_or_preview();
if (stampa)
book.print(); //stampa il book dei report
else
book.preview(); //anteprima
}
void TPrint_bilancio_ca::bilancio_di_verifica(TMask& mask)
void TPrint_bilancio_ca::bilancio_di_verifica(const bool stampa)
{
TReport_bilancio_verifica rep(mask.get(F_REPORT));
TReport_bilancio_verifica rep(_mask->get(F_REPORT));
const int rows = mask.sfield(F_RIGHE).items();
const int rows = _mask->sfield(F_RIGHE).items();
TReport_book book;
for (int i = 0; i < rows; i++)
{
rep.set_filter(mask, i);
rep.set_filter(*_mask, i);
book.add(rep);
}
book.print_or_preview();
if (stampa)
book.print(); //stampa il book dei report
else
book.preview(); //anteprima
}
void TPrint_bilancio_ca::print()
{
print_or_preview(true);
}
void TPrint_bilancio_ca::preview()
{
print_or_preview(false);
}
void TPrint_bilancio_ca::print_or_preview(const bool stampa)
{
TSheet_field& sf = _mask->sfield(F_RIGHE);
if (sf.empty())
sf.row(-1); // Aggiungo riga vuota
if (_mask->get(F_BILANCIO) == "C")
bilancio_a_sezioni_contrapposte(stampa);
else
bilancio_di_verifica(stampa);
}
void TPrint_bilancio_ca::main_loop()
{
TPrint_bilancio_ca_mask mask;
while (mask.run() != K_QUIT)
{
TSheet_field& sf = mask.sfield(F_RIGHE);
if (sf.empty())
sf.row(-1); // Aggiungo riga vuota
if (mask.get(F_BILANCIO) == "C")
bilancio_a_sezioni_contrapposte(mask);
else
bilancio_di_verifica(mask);
}
_mask = new TPrint_bilancio_ca_mask;
_mask->run();
delete _mask;
_mask = NULL;
}
int ca3300(int argc, char* argv[])

View File

@ -1,7 +1,7 @@
#include "ca3300.h"
TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
#include <aprintbar.h>
ENDPAGE
TOOLBAR "bottombar" 0 -2 0 1

View File

@ -83,6 +83,20 @@ bool TPag_per_cms_mask::on_field_event(TOperable_field& o, TField_event e, long
{
switch (o.dlg())
{
case DLG_PRINT:
if (e == fe_button)
{
main_app().print();
return false;
}
break;
case DLG_PREVIEW:
if (e == fe_button)
{
main_app().preview();
return false;
}
break;
case F_REPORT:
if (e == fe_button)
{
@ -1115,12 +1129,21 @@ void TPag_per_cms_rep::set_filter(const TPag_per_cms_mask& msk, const int cms_ro
class TPag_per_cms : public TSkeleton_application
{
TPag_per_cms_mask* _mask;
protected:
virtual void print();
virtual void preview();
void print_or_preview(const bool stampa);
virtual void main_loop();
public:
void stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book,
TPag_per_cms_rep& rep, const long dacodfor, const long acodfor,
const TString& campodata);
const TMultilevel_code_info& get_level_one() const;
virtual void main_loop();
};
//metodo per accattarsi o' primo livello della configurazione CA
@ -1176,7 +1199,17 @@ void TPag_per_cms::stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_bo
}
}
void TPag_per_cms::main_loop()
void TPag_per_cms::print()
{
print_or_preview(true);
}
void TPag_per_cms::preview()
{
print_or_preview(false);
}
void TPag_per_cms::print_or_preview(const bool stampa)
{
//il programma si puo' usare SOLO se in contabilita' analitica si usa il piano dei conti contabile
TConfig& cfg = ca_config();
@ -1187,38 +1220,46 @@ void TPag_per_cms::main_loop()
return;
}
TPag_per_cms_mask mask;
while (mask.run() == K_ENTER)
{
//report e book dei report
TReport_book book;
TString path = mask.get(F_REPORT);
if (path.empty())
path = "ca3600a";
TPag_per_cms_rep rep;
rep.load(path);
//report e book dei report
TReport_book book;
TString path = _mask->get(F_REPORT);
if (path.empty())
path = "ca3600a";
TPag_per_cms_rep rep;
rep.load(path);
//scelta tipo data di estrazione (registrazione, documento, pagamento)
//viene presa qui perche' serve subito alla set_filter del report prima che venga..
//..utilizzata nel recordset
TString16 campodata = PART_DATAREG;
switch(mask.get_int(F_TIPODATA))
{
case 1:campodata = PART_DATADOC;break;
case 2:campodata = PART_DATAPAG;break;
default:break;
}
//scelta tipo data di estrazione (registrazione, documento, pagamento)
//viene presa qui perche' serve subito alla set_filter del report prima che venga..
//..utilizzata nel recordset
TString16 campodata = PART_DATAREG;
switch(_mask->get_int(F_TIPODATA))
{
case 1: campodata = PART_DATADOC; break;
case 2: campodata = PART_DATAPAG; break;
default: break;
}
//scansione su tutti i fornitori selezionati; questa opzione e' praticamente utile solo..
//..quando il numero di fornitori selezionati non e' elevato;infatti,per ogni fornitore..
//..selezionato, viene eseguito tutto il giro del programma
const long dacodfor = mask.get_long(F_DACODFOR);
const long acodfor = mask.get_long(F_ACODFOR);
//scansione su tutti i fornitori selezionati; questa opzione e' praticamente utile solo..
//..quando il numero di fornitori selezionati non e' elevato;infatti,per ogni fornitore..
//..selezionato, viene eseguito tutto il giro del programma
const long dacodfor = _mask->get_long(F_DACODFOR);
const long acodfor = _mask->get_long(F_ACODFOR);
stampa_per_commessa(mask, book, rep, dacodfor, acodfor, campodata); //se non si specifica alcun clifo...
stampa_per_commessa(*_mask, book, rep, dacodfor, acodfor, campodata); //se non si specifica alcun clifo...
book.print_or_preview(); //stampa il book dei report
}
if (stampa)
book.print(); //stampa il book dei report
else
book.preview(); //anteprima
}
void TPag_per_cms::main_loop()
{
_mask = new TPag_per_cms_mask;
_mask->run();
delete _mask;
_mask = NULL;
}
int ca3600(int argc, char* argv[])

View File

@ -2,7 +2,7 @@
#include "camask.h"
TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
#include <aprintbar.h>
ENDPAGE
TOOLBAR "bottombar" 0 -2 0 1

View File

@ -78,6 +78,20 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
{
switch (o.dlg())
{
case DLG_PREVIEW: //gestione del tasto anteprima!
if (e == fe_button)
{
stop_run('A');
}
break;
case DLG_EXPORT:
if (e == fe_button)
{
TString path = get(F_PATH);
if (path.empty())
return error_box(TR("Specificare una cartella dove creare il file rendiconto.xls!"));
}
break;
#ifndef DBG
case F_RIGHE:
if (e == fe_init) //azzera le righe dello sheet con le commesse ad inizio programma
@ -142,14 +156,7 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
disable(F_PANDES1_FIN + k);
}
break;
case DLG_EXPORT:
if (e == fe_button)
{
TString path = get(F_PATH);
if (path.empty())
return error_box(TR("Specificare una cartella dove creare il file rendiconto.xls!"));
}
break;
default:
break;
}
@ -1978,7 +1985,7 @@ void TPrint_rendiconto_ca::main_loop()
{
//il programma deve cominciare l'eleaborazione solo nel caso di Stampa/Anteprima (K_ENTER) o Esportazione CSV (K_F6)
KEY key = mask.run();
if (key != K_ENTER && key != K_F6)
if (key == K_QUIT)
break;
//chiave di ordinamento del recordset; di base è 1 (utilizzato per la stampa); va lasciata qui per essere resettata..
@ -2119,10 +2126,10 @@ void TPrint_rendiconto_ca::main_loop()
rep.set_filter(mask, 0, recset_key, log); //fa la set filter sulla prima riga (che è quella usata)
//se stampa o anteprima..
if (key == K_ENTER)
book.add(rep);
else //esportazione in excel
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), 0);
if (key == K_F6)
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), 0); //esportazione in excel
else
book.add(rep);
}
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
}
@ -2133,18 +2140,21 @@ void TPrint_rendiconto_ca::main_loop()
rep.set_filter(mask, r, recset_key, log); //..chiama il metodone globale che crea e compila il file..
//..temporaneo i cui dati riempiranno il report
//se stampa o anteprima
if (key == K_ENTER)
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
else //esportazione in excel
if (key == K_F6) //esportazione in excel
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), r); //il recordset è del tipo TPrint_rendiconto
else
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
}
}
//se stampa o anteprima
//anteprima report degli errori rilevati
if (log.recordset()->items() > 0)
log.preview();
if (key == K_ENTER)
book.print_or_preview(); //stampa il book dei report
book.print(); //stampa il book dei report
else
book.preview(); //anteprima del book dei report
} //while(true)...
delete _msk;

View File

@ -106,7 +106,7 @@ BEGIN
PROMPT 2 10 "Digitare o selezionare attraverso la ricerca la cartella in cui creare il file rendiconto.xls. E' necessario indicare l'intero percorso!"
END
STRING F_PATH 256 40
STRING F_PATH 256 25
BEGIN
PROMPT 2 11 "Cartella dove esportare il file rendiconto.xls "
DSELECT

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <defmask.h>
#include "ca3.h"
#include "ca3883.h"
@ -67,6 +68,20 @@ bool TPrint_bilancio_cms_mask::on_field_event(TOperable_field& o, TField_event e
{
switch (o.dlg())
{
case DLG_PRINT:
if (e == fe_button)
{
main_app().print();
return false;
}
break;
case DLG_PREVIEW:
if (e == fe_button)
{
main_app().preview();
return false;
}
break;
case F_REPORT:
if (e == fe_button)
{
@ -228,106 +243,135 @@ TPrint_bilancio_cms_rep::TPrint_bilancio_cms_rep(const char* rep_name, const TSt
////////////////////////////////////////////////////////
class TPrint_bilancio_cms : public TSkeleton_application
{
public:
TPrint_bilancio_cms_mask* _mask;
protected:
void print_or_preview(const bool stampa);
virtual void print();
virtual void preview();
virtual void main_loop();
};
void TPrint_bilancio_cms::print()
{
print_or_preview(true);
}
void TPrint_bilancio_cms::preview()
{
print_or_preview(false);
}
void TPrint_bilancio_cms::print_or_preview(const bool stampa)
{
//report e book dei report
TReport_book book;
TString80 prefix;
for (short id = F_PRE1; id <= F_PRE3 && _mask->id2pos(id) > 0; id++)
prefix << _mask->get(id);
const int depth = _mask->get_int(F_DEPTH);
TString path = _mask->get(F_REPORT);
const int tipostampa = _mask->get_int(F_TIPOSTAMPA);
//fasi
const bool use_fasi = (tipostampa == 1) || (tipostampa == 3);
const TString& fase = _mask->get(F_FASE);
const bool group_fasi = tipostampa == 4;
const bool show_fasi = use_fasi && fase.empty();
//cdc
const bool use_cdc = (tipostampa == 2) || (tipostampa == 3);
const TString& cdc = _mask->get(F_CDC);
const bool group_cdc = tipostampa == 8;
const bool show_cdc = use_cdc && cdc.empty();
//descrizioni
const bool show_cms_descr = _mask->get_bool(F_SHOW_CMS_DESCR);
const bool show_cms_date = _mask->get_bool(F_SHOW_CMS_DATE);
if (path.empty())
{
path = _mask->get_report_class();
}
//crea il report in base ai parametri (tipo report,struttura,profondita' di stampa)
TPrint_bilancio_cms_rep rep(path, prefix, depth, show_fasi, show_cdc, show_cms_descr, show_cms_date);
//se e' una stampa di tipo fasi riassunte (crpa special edition) deve fare lo scanning di tutte le fasi..
//..singolarmente e stampare un report per ogni fase.Senno' stampa un solo report
if (group_fasi)
{
//stampa tutte le fasi distinte in modo riassuntivo (crpa dedicate)
TString_array lista_fasi;
//crea un TString_array con tutte le fasi distinte non ripetute
TISAM_recordset file_fasi("USE FASI");
for (TRecnotype j = 0; file_fasi.move_to(j); j++)
{
const TString16 curr_fase = file_fasi.get(FASI_CODFASE).as_string();
if (!curr_fase.empty() && lista_fasi.find(curr_fase) < 0)
lista_fasi.add(curr_fase);
}
lista_fasi.sort(); //ordina alfabeticamente l'arrayone
const long fasi_distinte = lista_fasi.items(); //numero di controllo
//se la stampa e' con tutte le fasi distinte riassunte (crpa dedicate) fa un rep per fase...
if (!lista_fasi.empty())
{
//per ogni fase crea un report e lo aggiunge al book
FOR_EACH_ARRAY_ROW(lista_fasi, i, row)
{
TString16 fase = lista_fasi.row(i);
rep.set_filter(*_mask, fase);
book.add(rep);
}
if (stampa)
book.print();
else
book.preview();
}
} //if(group_fasi...
else if (group_cdc)
{
//stampa tutte le fasi distinte in modo riassuntivo (crpa dedicate)
TString_array lista_cdc;
//crea un TString_array con tutte le fasi distinte non ripetute
TISAM_recordset file_cdc("USE CDC");
for (TRecnotype j = 0; file_cdc.move_to(j); j++)
{
const TString& curr_cdc = file_cdc.get(CDC_CODCOSTO).as_string();
rep.set_filter(*_mask, curr_cdc);
book.add(rep);
}
if (stampa)
book.print();
else
book.preview();
} //if(group_cdc...
else //...senno' stampa standard in un giro solo
{
rep.set_filter(*_mask, "");
book.add(rep);
if (stampa)
book.print();
else
book.preview();
}
}
void TPrint_bilancio_cms::main_loop()
{
TPrint_bilancio_cms_mask mask;
while (mask.run() == K_ENTER)
{
//report e book dei report
TReport_book book;
TString80 prefix;
for (short id = F_PRE1; id <= F_PRE3 && mask.id2pos(id) > 0; id++)
prefix << mask.get(id);
const int depth = mask.get_int(F_DEPTH);
TString path = mask.get(F_REPORT);
const int tipostampa = mask.get_int(F_TIPOSTAMPA);
//fasi
const bool use_fasi = (tipostampa == 1) || (tipostampa == 3);
const TString& fase = mask.get(F_FASE);
const bool group_fasi = tipostampa == 4;
const bool show_fasi = use_fasi && fase.empty();
//cdc
const bool use_cdc = (tipostampa == 2) || (tipostampa == 3);
const TString& cdc = mask.get(F_CDC);
const bool group_cdc = tipostampa == 8;
const bool show_cdc = use_cdc && cdc.empty();
//descrizioni
const bool show_cms_descr = mask.get_bool(F_SHOW_CMS_DESCR);
const bool show_cms_date = mask.get_bool(F_SHOW_CMS_DATE);
if (path.empty())
{
path = mask.get_report_class();
}
//crea il report in base ai parametri (tipo report,struttura,profondita' di stampa)
TPrint_bilancio_cms_rep rep(path, prefix, depth, show_fasi, show_cdc, show_cms_descr, show_cms_date);
//se e' una stampa di tipo fasi riassunte (crpa special edition) deve fare lo scanning di tutte le fasi..
//..singolarmente e stampare un report per ogni fase.Senno' stampa un solo report
if (group_fasi)
{
//stampa tutte le fasi distinte in modo riassuntivo (crpa dedicate)
TString_array lista_fasi;
//crea un TString_array con tutte le fasi distinte non ripetute
TISAM_recordset file_fasi("USE FASI");
for (TRecnotype j = 0; file_fasi.move_to(j); j++)
{
const TString16 curr_fase = file_fasi.get(FASI_CODFASE).as_string();
if (!curr_fase.empty() && lista_fasi.find(curr_fase) < 0)
lista_fasi.add(curr_fase);
}
lista_fasi.sort(); //ordina alfabeticamente l'arrayone
const long fasi_distinte = lista_fasi.items(); //numero di controllo
//se la stampa e' con tutte le fasi distinte riassunte (crpa dedicate) fa un rep per fase...
if (!lista_fasi.empty())
{
//per ogni fase crea un report e lo aggiunge al book
FOR_EACH_ARRAY_ROW(lista_fasi, i, row)
{
TString16 fase = lista_fasi.row(i);
rep.set_filter(mask, fase);
book.add(rep);
}
book.print_or_preview();
}
} //if(group_fasi...
else if (group_cdc)
{
//stampa tutte le fasi distinte in modo riassuntivo (crpa dedicate)
TString_array lista_cdc;
//crea un TString_array con tutte le fasi distinte non ripetute
TISAM_recordset file_cdc("USE CDC");
for (TRecnotype j = 0; file_cdc.move_to(j); j++)
{
const TString& curr_cdc = file_cdc.get(CDC_CODCOSTO).as_string();
rep.set_filter(mask, curr_cdc);
book.add(rep);
}
book.print_or_preview();
} //if(group_cdc...
else //...senno' stampa standard in un giro solo
{
rep.set_filter(mask, "");
book.add(rep);
book.print_or_preview();
}
}
_mask = new TPrint_bilancio_cms_mask;
_mask->run();
delete _mask;
_mask = NULL;
}
int ca3800(int argc, char* argv[])

View File

@ -1,9 +1,7 @@
#include "ca3883a.h"
TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
#include <aprintbar.h>
ENDPAGE
PAGE "Stampa bilancio commessa" 0 2 0 0

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <defmask.h>
#include "ca3.h"
#include "ca3883.h"
@ -59,6 +60,20 @@ bool TPrint_stima_ricavi_mask::on_field_event(TOperable_field& o, TField_event e
{
switch (o.dlg())
{
case DLG_PRINT:
if (e == fe_button)
{
main_app().print();
return false;
}
break;
case DLG_PREVIEW:
if (e == fe_button)
{
main_app().preview();
return false;
}
break;
case F_REPORT:
if (e == fe_button)
{
@ -178,27 +193,51 @@ void TPrint_stima_ricavi_rep::set_filter(const TPrint_stima_ricavi_mask& msk)
////////////////////////////////////////////////////////
class TPrint_stima_ricavi : public TSkeleton_application
{
public:
TPrint_stima_ricavi_mask* _mask;
protected:
void print_or_preview(const bool stampa);
virtual void print();
virtual void preview();
virtual void main_loop();
};
void TPrint_stima_ricavi::print()
{
print_or_preview(true);
}
void TPrint_stima_ricavi::preview()
{
print_or_preview(false);
}
void TPrint_stima_ricavi::print_or_preview(const bool stampa)
{
//report e book dei report
TReport_book book;
TString path = _mask->get(F_REPORT);
if (path.empty())
path = "ca3900a";
TPrint_stima_ricavi_rep rep;
rep.load(path);
rep.set_filter(*_mask);
book.add(rep);
if (stampa)
book.print();
else
book.preview();
}
void TPrint_stima_ricavi::main_loop()
{
TPrint_stima_ricavi_mask mask;
while (mask.run() == K_ENTER)
{
//report e book dei report
TReport_book book;
TString path = mask.get(F_REPORT);
if (path.empty())
path = "ca3900a";
TPrint_stima_ricavi_rep rep;
rep.load(path);
rep.set_filter(mask);
book.add(rep);
book.print_or_preview();
}
_mask = new TPrint_stima_ricavi_mask;
_mask->run();
delete _mask;
_mask = NULL;
}
int ca3900(int argc, char* argv[])

View File

@ -1,7 +1,7 @@
#include "ca3883a.h"
TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
#include <aprintbar.h>
ENDPAGE
PAGE "Stima ricavi di competenza" -1 -1 0 -3