campo-sirio/co/co1900.cpp

96 lines
2.2 KiB
C++
Raw Normal View History

#include <applicat.h>
#include <automask.h>
#include <form.h>
#include <report.h>
#include <reprint.h>
#include <tabutil.h>
#include <textset.h>
#include "co1.h"
#include "co1900a.h"
#include "socicoop.h"
////////////////////////////////////////////////////////
// MASCHERA
////////////////////////////////////////////////////////
class TStampaProgConf_mask : public TAutomask
{
protected:
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TStampaProgConf_mask();
virtual ~TStampaProgConf_mask() {};
};
TStampaProgConf_mask::TStampaProgConf_mask() :TAutomask ("co1900a")
{
}
bool TStampaProgConf_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
return true;
}
/////////////////////////////////////////////////////////////
// REPORT
/////////////////////////////////////////////////////////////
class TStampaProgConf_report : public TReport
{
protected:
virtual bool use_mask() { return false; }
public:
TStampaProgConf_report() {}
};
////////////////////////////////////////////////////////
// APPLICAZIONE
////////////////////////////////////////////////////////
class TStampaProgConf : public TSkeleton_application
{
public:
virtual void main_loop();
};
void TStampaProgConf::main_loop()
{
TStampaProgConf_mask m;
while (m.run() == K_ENTER)
{
TStampaProgConf_report rep;
TReport_book book;
const int formato = m.get_int(F_FORMATO);
if (rep.load(formato==1 ? "co1900b" : "co1900a"))
{
const int ordinamento = m.get_int(F_ORDINAMENTO);
if (ordinamento == 2)
{
TString use(rep.recordset()->query_text());
const int pos = use.find("JOIN");
if ( pos > 0)
use.insert("BY 20.RAGSOC\n", pos);
rep.set_recordset(use);
}
}
rep.recordset()->set_var("#DASOCIO", TVariant(m.get(F_DASOCIO)));
TString to(m.get(F_ASOCIO));
to << "999999";
rep.recordset()->set_var("#ASOCIO", TVariant(to));
rep.recordset()->set_var("#ANNO", m.get(F_ANNO));
rep.recordset()->set_var("#MESE", m.get(F_MESE));
book.add(rep);
book.print_or_preview();
}
}
int co1900(int argc, char* argv[])
{
TStampaProgConf a;
a.run(argc, argv, TR("Stampa progressivi conferimenti"));
return 0;
}