046e2c06cb
Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 848 git-svn-id: svn://10.65.10.50/trunk@14993 c028cbd2-c16b-5b4b-a496-9718f37d4682
145 lines
3.2 KiB
C++
Executable File
145 lines
3.2 KiB
C++
Executable File
#include <applicat.h>
|
||
#include <automask.h>
|
||
#include <confapp.h>
|
||
#include <reprint.h>
|
||
|
||
#include "../ve/velib07.h"
|
||
|
||
#include "vd1.h"
|
||
#include "vd1600.h"
|
||
|
||
|
||
////////////////
|
||
// MASCHERA
|
||
////////////////
|
||
class TPrint_dettaglio_scontrini_mask : public TAutomask
|
||
{
|
||
|
||
protected:
|
||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||
|
||
public:
|
||
TPrint_dettaglio_scontrini_mask(const char tipo);
|
||
virtual ~TPrint_dettaglio_scontrini_mask();
|
||
};
|
||
|
||
TPrint_dettaglio_scontrini_mask::TPrint_dettaglio_scontrini_mask(const char tipo)
|
||
: TAutomask("vd1600") //NON si puo' chiamare vd1600a perche' in tal caso la...
|
||
//..maschera scatta 2 volte (scatta anche quella omonima del report)
|
||
{ //la maschera gestisce i 2 casi di stampa giornaliera e di periodo accendendo e spegnendo i campi
|
||
if (tipo == 'G')
|
||
{
|
||
set_caption(TR("Riepilogo scontrini giornaliero"));
|
||
hide(F_ADATA);
|
||
disable(F_DADATA);
|
||
field(F_DADATA).set_prompt(PR("In data "));
|
||
}
|
||
else
|
||
{
|
||
set_caption(TR("Riepilogo scontrini"));
|
||
}
|
||
}
|
||
|
||
TPrint_dettaglio_scontrini_mask::~TPrint_dettaglio_scontrini_mask() {}
|
||
|
||
bool TPrint_dettaglio_scontrini_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||
{
|
||
switch (o.dlg())
|
||
{
|
||
case F_CODCASSA:
|
||
if (e == fe_init)
|
||
{
|
||
TConfig conf(CONFIG_WST);
|
||
o.set(conf.get("NCASSA"));
|
||
o.check(STARTING_CHECK);
|
||
}
|
||
break;
|
||
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;
|
||
case F_CODNUM:
|
||
if (e == fe_init)
|
||
{
|
||
TConfig conf(CONFIG_DITTA, "vd");
|
||
o.set(conf.get("CODNUM"));
|
||
o.check(STARTING_CHECK);
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
////////////////////////////////////////////////////////
|
||
// REPORT
|
||
////////////////////////////////////////////////////////
|
||
class TPrint_dettaglio_scontrini_rep : public TDocument_report
|
||
{
|
||
protected:
|
||
virtual bool use_mask() {return false;}
|
||
};
|
||
|
||
|
||
|
||
///////////////////////////////
|
||
// APPLICAZIONE
|
||
///////////////////////////////
|
||
class TPrint_dettaglio_scontrini : public TSkeleton_application
|
||
{
|
||
char _tipo;
|
||
|
||
protected:
|
||
virtual void main_loop();
|
||
virtual bool create();
|
||
|
||
};
|
||
|
||
void TPrint_dettaglio_scontrini::main_loop()
|
||
{
|
||
TPrint_dettaglio_scontrini_mask mask(_tipo);
|
||
while (mask.run() == K_ENTER)
|
||
{
|
||
TReport_book book;
|
||
TString path = mask.get(F_REPORT);
|
||
if (path.empty())
|
||
path = "vd1600a";
|
||
TPrint_dettaglio_scontrini_rep rep;
|
||
rep.load(path);
|
||
|
||
rep.mask2report(mask);
|
||
book.add(rep);
|
||
book.print_or_preview();
|
||
}
|
||
}
|
||
|
||
bool TPrint_dettaglio_scontrini::create()
|
||
{
|
||
if (argc()>2)
|
||
_tipo = argv(2)[0]; // se c'<27>, prende il tipo di stampa dalla linea di comando
|
||
else
|
||
_tipo = 'G'; //per default stampa il giornaliero
|
||
|
||
return TSkeleton_application:: create();
|
||
}
|
||
|
||
int vd1600(int argc, char* argv[])
|
||
{
|
||
TPrint_dettaglio_scontrini a;
|
||
a.run(argc, argv, "Riepilogo dettaglio scontrini");
|
||
return 0;
|
||
}
|