127 lines
2.6 KiB
C++
127 lines
2.6 KiB
C++
|
#include <applicat.h>
|
||
|
#include <automask.h>
|
||
|
#include <confapp.h>
|
||
|
#include <reprint.h>
|
||
|
|
||
|
#include "../ve/velib07.h"
|
||
|
|
||
|
#include "vd1.h"
|
||
|
#include "vd1200.h"
|
||
|
|
||
|
|
||
|
////////////////
|
||
|
// MASCHERA
|
||
|
////////////////
|
||
|
class TPrint_riepilogo_incassi_mask : public TAutomask
|
||
|
{
|
||
|
|
||
|
protected:
|
||
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||
|
|
||
|
public:
|
||
|
TPrint_riepilogo_incassi_mask();
|
||
|
virtual ~TPrint_riepilogo_incassi_mask();
|
||
|
};
|
||
|
|
||
|
TPrint_riepilogo_incassi_mask::TPrint_riepilogo_incassi_mask()
|
||
|
: TAutomask("vd1200") //NON si puo' chiamare vd1200a perche' in tal caso la...
|
||
|
//..maschera scatta 2 volte (scatta anche quella omonima del report)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
TPrint_riepilogo_incassi_mask::~TPrint_riepilogo_incassi_mask() {}
|
||
|
|
||
|
bool TPrint_riepilogo_incassi_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_CODNUM:
|
||
|
if (e == fe_init)
|
||
|
{
|
||
|
TConfig conf(CONFIG_DITTA, "vd");
|
||
|
o.set(conf.get("CODNUM"));
|
||
|
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;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
////////////////////////////////////////////////////////
|
||
|
// REPORT
|
||
|
////////////////////////////////////////////////////////
|
||
|
class TPrint_riepilogo_incassi_rep : public TDocument_report
|
||
|
{
|
||
|
protected:
|
||
|
virtual bool use_mask() {return false;}
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
///////////////////////////////
|
||
|
// APPLICAZIONE
|
||
|
///////////////////////////////
|
||
|
class TPrint_riepilogo_incassi : public TSkeleton_application
|
||
|
{
|
||
|
|
||
|
protected:
|
||
|
virtual void main_loop();
|
||
|
virtual bool create();
|
||
|
|
||
|
};
|
||
|
|
||
|
void TPrint_riepilogo_incassi::main_loop()
|
||
|
{
|
||
|
TPrint_riepilogo_incassi_mask mask;
|
||
|
while (mask.run() == K_ENTER)
|
||
|
{
|
||
|
TReport_book book;
|
||
|
TString path = mask.get(F_REPORT);
|
||
|
if (path.empty())
|
||
|
path = "vd1200a";
|
||
|
TPrint_riepilogo_incassi_rep rep;
|
||
|
rep.load(path);
|
||
|
|
||
|
rep.mask2report(mask);
|
||
|
book.add(rep);
|
||
|
book.print_or_preview();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool TPrint_riepilogo_incassi::create()
|
||
|
{
|
||
|
return TSkeleton_application:: create();
|
||
|
}
|
||
|
|
||
|
int vd1200(int argc, char* argv[])
|
||
|
{
|
||
|
TPrint_riepilogo_incassi a;
|
||
|
a.run(argc, argv, "Riepilogo incassi");
|
||
|
return 0;
|
||
|
}
|