#include #include #include #include "../ve/velib07.h" #include "vd1.h" #include "vd1300.h" //////////////// // MASCHERA //////////////// class TPrint_venduto_operatore_mask : public TAutomask { protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); public: TPrint_venduto_operatore_mask(); virtual ~TPrint_venduto_operatore_mask(); }; TPrint_venduto_operatore_mask::TPrint_venduto_operatore_mask() : TAutomask("vd1300") //NON si puo' chiamare vd1300a perche' in tal caso la... //..maschera scatta 2 volte (scatta anche quella omonima del report) { } TPrint_venduto_operatore_mask::~TPrint_venduto_operatore_mask() {} bool TPrint_venduto_operatore_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { switch (o.dlg()) { case F_DADATA: if (e == fe_modify) { const TDate dadata(o.get()); set(F_ANNO, dadata.year()); } break; case F_ADATA: if (e == fe_close) { const TDate adata(o.get()); const TDate dadata = get(F_DADATA); if (adata.year() != dadata.year() || adata < dadata) return error_box(TR("La data finale deve essere maggiore od uguale a quella finale ed appartenere allo stesso anno!")); } break; default: break; } return true; } //////////////////////////////////////////////////////// // REPORT //////////////////////////////////////////////////////// class TPrint_venduto_operatore_rep : public TDocument_report { protected: virtual bool use_mask() {return false;} }; /////////////////////////////// // APPLICAZIONE /////////////////////////////// class TPrint_venduto_operatore : public TSkeleton_application { protected: virtual void main_loop(); virtual bool create(); }; void TPrint_venduto_operatore::main_loop() { TPrint_venduto_operatore_mask mask; while (mask.run() == K_ENTER) { TReport_book book; TString path = mask.get(F_REPORT); if (path.empty()) path = "vd1300a"; TPrint_venduto_operatore_rep rep; rep.load(path); rep.mask2report(mask); book.add(rep); book.print_or_preview(); } } bool TPrint_venduto_operatore::create() { return TSkeleton_application:: create(); } int vd1300(int argc, char* argv[]) { TPrint_venduto_operatore a; a.run(argc, argv, "Riepilogo venduto per operatore"); return 0; }