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 <applicat.h>
#include <defmask.h>
#include <execp.h> #include <execp.h>
#include <reprint.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()) 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: case F_TIPOSTAMPA:
if (e == fe_init || e == fe_modify) if (e == fe_init || e == fe_modify)
{ {
@ -351,28 +366,15 @@ class TPrint_movimenti_ca : public TSkeleton_application
protected: protected:
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM
virtual bool create(); void print_or_preview(const bool stampa);
virtual bool destroy(); virtual void print();
virtual void preview();
public:
virtual void main_loop(); 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 //costruzione della query x il report in base ai parametri della maschera
TSheet_field& sheet = _mask->sfield(F_RIGHE); TSheet_field& sheet = _mask->sfield(F_RIGHE);
@ -393,8 +395,28 @@ void TPrint_movimenti_ca::main_loop()
book.add(rep); 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[]) int ca3100(int argc, char* argv[])

View File

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

View File

@ -1,4 +1,5 @@
#include <applicat.h> #include <applicat.h>
#include <defmask.h>
#include <execp.h> #include <execp.h>
#include <progind.h> #include <progind.h>
#include <reprint.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()) 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: case F_TIPOCONTI:
if (e == fe_init || e == fe_modify) if (e == fe_init || e == fe_modify)
{ {
@ -570,26 +585,39 @@ void TPrint_mastrini_ca_rep::set_filter(const TPrint_mastrini_ca_mask& msk, int
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
class TPrint_mastrini_ca : public TSkeleton_application class TPrint_mastrini_ca : public TSkeleton_application
{ {
TPrint_mastrini_ca_mask* _mask;
protected: protected:
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM 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(); virtual void main_loop();
}; };
void TPrint_mastrini_ca::print()
void TPrint_mastrini_ca::main_loop()
{ {
TPrint_mastrini_ca_mask mask; print_or_preview(true);
while (mask.run() == K_ENTER) }
void TPrint_mastrini_ca::preview()
{
print_or_preview(false);
}
void TPrint_mastrini_ca::print_or_preview(const bool stampa)
{ {
//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);
if (path.empty()) if (path.empty())
path = "ca3200a"; path = "ca3200a";
TPrint_mastrini_ca_rep rep; TPrint_mastrini_ca_rep rep;
rep.load(path); rep.load(path);
TSheet_field& sheet = mask.sfield(F_RIGHE); TSheet_field& sheet = _mask->sfield(F_RIGHE);
TString video_string; //stringa che compare nella progind TString video_string; //stringa che compare nella progind
if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)... if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)...
{ {
@ -623,7 +651,7 @@ void TPrint_mastrini_ca::main_loop()
for (int l = liv1.levels()-2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring for (int l = liv1.levels()-2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring
row.insert("|", liv1.total_len(l)); row.insert("|", liv1.total_len(l));
rep.set_filter(mask, 0); //fa la set filter sulla prima riga (che è quella usata) rep.set_filter(*_mask, 0); //fa la set filter sulla prima riga (che è quella usata)
book.add(rep); book.add(rep);
} }
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
@ -632,13 +660,25 @@ void TPrint_mastrini_ca::main_loop()
{ {
FOR_EACH_SHEET_ROW(sheet, r, row) FOR_EACH_SHEET_ROW(sheet, r, row)
{ {
rep.set_filter(mask, r); rep.set_filter(*_mask, r);
book.add(rep); 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
} }
void TPrint_mastrini_ca::main_loop()
{
_mask = new TPrint_mastrini_ca_mask;
_mask->run();
delete _mask;
_mask = NULL;
} }
int ca3200(int argc, char* argv[]) int ca3200(int argc, char* argv[])

View File

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

View File

@ -1,18 +1,17 @@
#include "ca3.h" #include <defmask.h>
#include "calib01.h"
#include "calib02.h"
#include <execp.h> #include <execp.h>
#include <progind.h> #include <progind.h>
#include <reprint.h> #include <reprint.h>
#include <pconti.h> #include <pconti.h>
#include "movana.h" #include "movana.h"
#include "pconana.h" #include "pconana.h"
#include "rmovana.h" #include "rmovana.h"
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#include "ca3.h"
#include "calib01.h"
#include "calib02.h"
#include "ca3300.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()) 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_ANNO:
case F_BILANCIO: case F_BILANCIO:
case F_STAMPA: 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 class TPrint_bilancio_ca : public TSkeleton_application
{ {
TPrint_bilancio_ca_mask* _mask;
protected: protected:
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM
void bilancio_a_sezioni_contrapposte(TMask& mask); void bilancio_a_sezioni_contrapposte(const bool stampa);
void bilancio_di_verifica(TMask& msk); 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(); 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; TReport_book book;
for (int i = 0; i < rows; i++) for (int i = 0; i < rows; i++)
{ {
rep.set_filter(mask, i); rep.set_filter(*_mask, i);
book.add(rep); 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; TReport_book book;
for (int i = 0; i < rows; i++) for (int i = 0; i < rows; i++)
{ {
rep.set_filter(mask, i); rep.set_filter(*_mask, i);
book.add(rep); 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() void TPrint_bilancio_ca::main_loop()
{ {
TPrint_bilancio_ca_mask mask; _mask = new TPrint_bilancio_ca_mask;
while (mask.run() != K_QUIT) _mask->run();
{ delete _mask;
TSheet_field& sf = mask.sfield(F_RIGHE); _mask = NULL;
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);
}
} }
int ca3300(int argc, char* argv[]) int ca3300(int argc, char* argv[])

View File

@ -1,7 +1,7 @@
#include "ca3300.h" #include "ca3300.h"
TOOLBAR "topbar" 0 0 0 2 TOOLBAR "topbar" 0 0 0 2
#include <printbar.h> #include <aprintbar.h>
ENDPAGE ENDPAGE
TOOLBAR "bottombar" 0 -2 0 1 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()) 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: case F_REPORT:
if (e == fe_button) 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 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: public:
void stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book, void stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book,
TPag_per_cms_rep& rep, const long dacodfor, const long acodfor, TPag_per_cms_rep& rep, const long dacodfor, const long acodfor,
const TString& campodata); const TString& campodata);
const TMultilevel_code_info& get_level_one() const; const TMultilevel_code_info& get_level_one() const;
virtual void main_loop();
}; };
//metodo per accattarsi o' primo livello della configurazione CA //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 //il programma si puo' usare SOLO se in contabilita' analitica si usa il piano dei conti contabile
TConfig& cfg = ca_config(); TConfig& cfg = ca_config();
@ -1187,12 +1220,9 @@ void TPag_per_cms::main_loop()
return; return;
} }
TPag_per_cms_mask mask;
while (mask.run() == K_ENTER)
{
//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);
if (path.empty()) if (path.empty())
path = "ca3600a"; path = "ca3600a";
TPag_per_cms_rep rep; TPag_per_cms_rep rep;
@ -1202,7 +1232,7 @@ void TPag_per_cms::main_loop()
//viene presa qui perche' serve subito alla set_filter del report prima che venga.. //viene presa qui perche' serve subito alla set_filter del report prima che venga..
//..utilizzata nel recordset //..utilizzata nel recordset
TString16 campodata = PART_DATAREG; TString16 campodata = PART_DATAREG;
switch(mask.get_int(F_TIPODATA)) switch(_mask->get_int(F_TIPODATA))
{ {
case 1: campodata = PART_DATADOC; break; case 1: campodata = PART_DATADOC; break;
case 2: campodata = PART_DATAPAG; break; case 2: campodata = PART_DATAPAG; break;
@ -1212,13 +1242,24 @@ void TPag_per_cms::main_loop()
//scansione su tutti i fornitori selezionati; questa opzione e' praticamente utile solo.. //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.. //..quando il numero di fornitori selezionati non e' elevato;infatti,per ogni fornitore..
//..selezionato, viene eseguito tutto il giro del programma //..selezionato, viene eseguito tutto il giro del programma
const long dacodfor = mask.get_long(F_DACODFOR); const long dacodfor = _mask->get_long(F_DACODFOR);
const long acodfor = mask.get_long(F_ACODFOR); 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...
if (stampa)
book.print(); //stampa il book dei report
else
book.preview(); //anteprima
book.print_or_preview(); //stampa il book dei report
} }
void TPag_per_cms::main_loop()
{
_mask = new TPag_per_cms_mask;
_mask->run();
delete _mask;
_mask = NULL;
} }
int ca3600(int argc, char* argv[]) int ca3600(int argc, char* argv[])

View File

@ -2,7 +2,7 @@
#include "camask.h" #include "camask.h"
TOOLBAR "topbar" 0 0 0 2 TOOLBAR "topbar" 0 0 0 2
#include <printbar.h> #include <aprintbar.h>
ENDPAGE ENDPAGE
TOOLBAR "bottombar" 0 -2 0 1 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()) 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 #ifndef DBG
case F_RIGHE: case F_RIGHE:
if (e == fe_init) //azzera le righe dello sheet con le commesse ad inizio programma 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); disable(F_PANDES1_FIN + k);
} }
break; 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: default:
break; 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) //il programma deve cominciare l'eleaborazione solo nel caso di Stampa/Anteprima (K_ENTER) o Esportazione CSV (K_F6)
KEY key = mask.run(); KEY key = mask.run();
if (key != K_ENTER && key != K_F6) if (key == K_QUIT)
break; break;
//chiave di ordinamento del recordset; di base è 1 (utilizzato per la stampa); va lasciata qui per essere resettata.. //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) rep.set_filter(mask, 0, recset_key, log); //fa la set filter sulla prima riga (che è quella usata)
//se stampa o anteprima.. //se stampa o anteprima..
if (key == K_ENTER) if (key == K_F6)
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), 0); //esportazione in excel
else
book.add(rep); book.add(rep);
else //esportazione in excel
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), 0);
} }
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet 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.. 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 //..temporaneo i cui dati riempiranno il report
//se stampa o anteprima //se stampa o anteprima
if (key == K_ENTER) if (key == K_F6) //esportazione in excel
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
else //esportazione in excel
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), r); //il recordset è del tipo TPrint_rendiconto 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) if (log.recordset()->items() > 0)
log.preview(); log.preview();
if (key == K_ENTER) 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)... } //while(true)...
delete _msk; 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!" 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 END
STRING F_PATH 256 40 STRING F_PATH 256 25
BEGIN BEGIN
PROMPT 2 11 "Cartella dove esportare il file rendiconto.xls " PROMPT 2 11 "Cartella dove esportare il file rendiconto.xls "
DSELECT DSELECT

View File

@ -1,4 +1,5 @@
#include <applicat.h> #include <applicat.h>
#include <defmask.h>
#include "ca3.h" #include "ca3.h"
#include "ca3883.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()) 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: case F_REPORT:
if (e == fe_button) if (e == fe_button)
{ {
@ -228,45 +243,58 @@ TPrint_bilancio_cms_rep::TPrint_bilancio_cms_rep(const char* rep_name, const TSt
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
class TPrint_bilancio_cms : public TSkeleton_application 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(); virtual void main_loop();
}; };
void TPrint_bilancio_cms::main_loop() void TPrint_bilancio_cms::print()
{ {
TPrint_bilancio_cms_mask mask; print_or_preview(true);
while (mask.run() == K_ENTER) }
void TPrint_bilancio_cms::preview()
{
print_or_preview(false);
}
void TPrint_bilancio_cms::print_or_preview(const bool stampa)
{ {
//report e book dei report //report e book dei report
TReport_book book; TReport_book book;
TString80 prefix; TString80 prefix;
for (short id = F_PRE1; id <= F_PRE3 && mask.id2pos(id) > 0; id++) for (short id = F_PRE1; id <= F_PRE3 && _mask->id2pos(id) > 0; id++)
prefix << mask.get(id); prefix << _mask->get(id);
const int depth = mask.get_int(F_DEPTH); const int depth = _mask->get_int(F_DEPTH);
TString path = mask.get(F_REPORT); TString path = _mask->get(F_REPORT);
const int tipostampa = mask.get_int(F_TIPOSTAMPA); const int tipostampa = _mask->get_int(F_TIPOSTAMPA);
//fasi //fasi
const bool use_fasi = (tipostampa == 1) || (tipostampa == 3); const bool use_fasi = (tipostampa == 1) || (tipostampa == 3);
const TString& fase = mask.get(F_FASE); const TString& fase = _mask->get(F_FASE);
const bool group_fasi = tipostampa == 4; const bool group_fasi = tipostampa == 4;
const bool show_fasi = use_fasi && fase.empty(); const bool show_fasi = use_fasi && fase.empty();
//cdc //cdc
const bool use_cdc = (tipostampa == 2) || (tipostampa == 3); const bool use_cdc = (tipostampa == 2) || (tipostampa == 3);
const TString& cdc = mask.get(F_CDC); const TString& cdc = _mask->get(F_CDC);
const bool group_cdc = tipostampa == 8; const bool group_cdc = tipostampa == 8;
const bool show_cdc = use_cdc && cdc.empty(); const bool show_cdc = use_cdc && cdc.empty();
//descrizioni //descrizioni
const bool show_cms_descr = mask.get_bool(F_SHOW_CMS_DESCR); const bool show_cms_descr = _mask->get_bool(F_SHOW_CMS_DESCR);
const bool show_cms_date = mask.get_bool(F_SHOW_CMS_DATE); const bool show_cms_date = _mask->get_bool(F_SHOW_CMS_DATE);
if (path.empty()) if (path.empty())
{ {
path = mask.get_report_class(); path = _mask->get_report_class();
} }
//crea il report in base ai parametri (tipo report,struttura,profondita' di stampa) //crea il report in base ai parametri (tipo report,struttura,profondita' di stampa)
@ -297,10 +325,13 @@ void TPrint_bilancio_cms::main_loop()
FOR_EACH_ARRAY_ROW(lista_fasi, i, row) FOR_EACH_ARRAY_ROW(lista_fasi, i, row)
{ {
TString16 fase = lista_fasi.row(i); TString16 fase = lista_fasi.row(i);
rep.set_filter(mask, fase); rep.set_filter(*_mask, fase);
book.add(rep); book.add(rep);
} }
book.print_or_preview(); if (stampa)
book.print();
else
book.preview();
} }
} //if(group_fasi... } //if(group_fasi...
@ -313,21 +344,34 @@ void TPrint_bilancio_cms::main_loop()
for (TRecnotype j = 0; file_cdc.move_to(j); j++) for (TRecnotype j = 0; file_cdc.move_to(j); j++)
{ {
const TString& curr_cdc = file_cdc.get(CDC_CODCOSTO).as_string(); const TString& curr_cdc = file_cdc.get(CDC_CODCOSTO).as_string();
rep.set_filter(mask, curr_cdc); rep.set_filter(*_mask, curr_cdc);
book.add(rep); book.add(rep);
} }
book.print_or_preview(); if (stampa)
book.print();
else
book.preview();
} //if(group_cdc... } //if(group_cdc...
else //...senno' stampa standard in un giro solo else //...senno' stampa standard in un giro solo
{ {
rep.set_filter(mask, ""); rep.set_filter(*_mask, "");
book.add(rep); book.add(rep);
book.print_or_preview(); if (stampa)
book.print();
else
book.preview();
} }
} }
void TPrint_bilancio_cms::main_loop()
{
_mask = new TPrint_bilancio_cms_mask;
_mask->run();
delete _mask;
_mask = NULL;
} }
int ca3800(int argc, char* argv[]) int ca3800(int argc, char* argv[])

View File

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

View File

@ -1,4 +1,5 @@
#include <applicat.h> #include <applicat.h>
#include <defmask.h>
#include "ca3.h" #include "ca3.h"
#include "ca3883.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()) 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: case F_REPORT:
if (e == fe_button) 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 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(); virtual void main_loop();
}; };
void TPrint_stima_ricavi::main_loop() void TPrint_stima_ricavi::print()
{ {
TPrint_stima_ricavi_mask mask; print_or_preview(true);
while (mask.run() == K_ENTER) }
void TPrint_stima_ricavi::preview()
{
print_or_preview(false);
}
void TPrint_stima_ricavi::print_or_preview(const bool stampa)
{ {
//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);
if (path.empty()) if (path.empty())
path = "ca3900a"; path = "ca3900a";
TPrint_stima_ricavi_rep rep; TPrint_stima_ricavi_rep rep;
rep.load(path); rep.load(path);
rep.set_filter(mask); rep.set_filter(*_mask);
book.add(rep); book.add(rep);
book.print_or_preview();
if (stampa)
book.print();
else
book.preview();
} }
void TPrint_stima_ricavi::main_loop()
{
_mask = new TPrint_stima_ricavi_mask;
_mask->run();
delete _mask;
_mask = NULL;
} }
int ca3900(int argc, char* argv[]) int ca3900(int argc, char* argv[])

View File

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