campo-sirio/co/co2200.cpp

106 lines
2.4 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 "co2.h"
#include "co2200a.h"
#include "socicoop.h"
////////////////////////////////////////////////////////
// MASCHERA
////////////////////////////////////////////////////////
class TStampaSociDataLic_mask : public TAutomask
{
protected:
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TStampaSociDataLic_mask();
virtual ~TStampaSociDataLic_mask() {};
};
TStampaSociDataLic_mask::TStampaSociDataLic_mask() :TAutomask ("co2200a")
{
}
bool TStampaSociDataLic_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
{
return true;
}
/////////////////////////////////////////////////////////////
// REPORT
/////////////////////////////////////////////////////////////
class TStampaSociDataLic_report : public TReport
{
protected:
virtual bool use_mask() { return false; }
public:
TStampaSociDataLic_report() {}
};
////////////////////////////////////////////////////////
// APPLICAZIONE
////////////////////////////////////////////////////////
class TStampaSociDataLic : public TSkeleton_application
{
public:
virtual void main_loop();
};
void TStampaSociDataLic::main_loop()
{
TStampaSociDataLic_mask m;
while (m.run() == K_ENTER)
{
TStampaSociDataLic_report rep;
TReport_book book;
if (rep.load("co2200a"))
{
TString use(rep.recordset()->query_text());
const int pos = use.find("JOIN");
const int ordinamento = m.get_int(F_ORDINAMENTO);
if (pos > 0)
{
switch (ordinamento)
{
case 2:
use.insert("BY 20.RAGSOC\n", pos);
break;
case 3:
use.insert("BY SOCICOOP.DATASCALIC\n", pos);
break;
default:
use.insert("BY 20.CODCF\n", pos);
break;
}
}
rep.set_recordset(use);
}
rep.recordset()->set_var("#DASOCIO", TVariant(m.get(F_DASOCIO)));
rep.recordset()->set_var("#ASOCIO", TVariant(m.get(F_ASOCIO)));
rep.recordset()->set_var("#DADATA", TVariant(m.get(F_DADATA)));
rep.recordset()->set_var("#ADATA", TVariant(m.get(F_ADATA)));
rep.recordset()->set_var("#MESE", TVariant(m.get(F_ADATA).mid(3,2)));
book.add(rep);
book.print_or_preview();
}
}
int co2200(int argc, char* argv[])
{
TStampaSociDataLic a;
a.run(argc, argv, TR("Stampa soci per data licenza"));
return 0;
}