131 lines
3.0 KiB
C++
131 lines
3.0 KiB
C++
|
#include <applicat.h>
|
||
|
#include <automask.h>
|
||
|
#include <progind.h>
|
||
|
#include <recarray.h>
|
||
|
#include <relation.h>
|
||
|
#include <report.h>
|
||
|
#include <textset.h>
|
||
|
|
||
|
#include "../ba/ba8500.h"
|
||
|
|
||
|
#include "ha3700a.h"
|
||
|
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// Report
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TPrint_storico_report : public TReport
|
||
|
{
|
||
|
protected:
|
||
|
virtual bool use_mask() { return false; }
|
||
|
|
||
|
public:
|
||
|
TPrint_storico_report();
|
||
|
};
|
||
|
|
||
|
TPrint_storico_report::TPrint_storico_report()
|
||
|
{
|
||
|
load("ha3700a");
|
||
|
}
|
||
|
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// Maschera
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TPrint_storico_mask : public TAutomask
|
||
|
{
|
||
|
protected:
|
||
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||
|
|
||
|
public:
|
||
|
void elabora();
|
||
|
TPrint_storico_mask();
|
||
|
virtual ~TPrint_storico_mask() {}
|
||
|
};
|
||
|
|
||
|
|
||
|
void TPrint_storico_mask::elabora()
|
||
|
{
|
||
|
//prende un tot di dati dalla maschera per stabilire la query
|
||
|
const TString& codag = get(F_CODAG);
|
||
|
const long codcf = get_long(F_CODCF);
|
||
|
const int codindsp = get_int(F_CODINDSP);
|
||
|
|
||
|
const TString& codart = get(F_CODART);
|
||
|
const long progressivo = get_long(F_PROGRESSIVO);
|
||
|
TString16 codtab;
|
||
|
codtab.format("%-5s%07d", (const char*)codart, progressivo);
|
||
|
const TString& matricola = get(F_MATRICOLA);
|
||
|
const TString& tipo = get(F_TIPO);
|
||
|
|
||
|
//genera la query parametrica
|
||
|
TString query;
|
||
|
query << "USE &HAHIS";
|
||
|
query << "\nSELECT (BETWEEN(S7[1,1];#TIPO;#TIPO))&&(BETWEEN(TRIM(401@->S0[6,20]);#MATRICOLA;#MATRICOLA))&&(BETWEEN(122->CODAGE,#CODAG,#CODAG))&&(BETWEEN(I0,#CODCF,#CODCF))&&(BETWEEN(I1,#INDSPED,#INDSPED))";
|
||
|
query << "\nBY 122->CODAGE I0 I1 CODTAB[1,12]";
|
||
|
query << "\nJOIN &HAATT ALIAS 401 INTO CODTAB=CODTAB[1,12]";
|
||
|
query << "\nJOIN CFVEN INTO TIPOCF=\"C\" CODCF==I0";
|
||
|
query << "\nJOIN AGENTI TO CFVEN INTO CODAGE==CODAG";
|
||
|
query << "\nFROM CODTAB=#CODART";
|
||
|
query << "\nTO CODTAB=#CODART";
|
||
|
|
||
|
/*TISAM_recordset recset(query);
|
||
|
recset.set_var("#MATRICOLA", matricola);
|
||
|
recset.set_var("#CODAG", codag);
|
||
|
recset.set_var("#CODCF", codcf);
|
||
|
recset.set_var("#CODTAB", codtab);*/
|
||
|
|
||
|
//const long recset_items = recset.items();
|
||
|
|
||
|
//appiccia il recordset al report
|
||
|
TPrint_storico_report rep;
|
||
|
rep.set_recordset(query);
|
||
|
rep.mask2report(*this);
|
||
|
rep.preview();
|
||
|
}
|
||
|
|
||
|
|
||
|
bool TPrint_storico_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||
|
{
|
||
|
/*switch (o.dlg())
|
||
|
{
|
||
|
}*/
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
TPrint_storico_mask::TPrint_storico_mask() : TAutomask("ha3700a")
|
||
|
{
|
||
|
}
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// Applicazione
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TPrint_storico : public TKlarkKent_app
|
||
|
{
|
||
|
protected:
|
||
|
|
||
|
public:
|
||
|
virtual void main_loop();
|
||
|
};
|
||
|
|
||
|
|
||
|
void TPrint_storico::main_loop()
|
||
|
{
|
||
|
TPrint_storico_mask mask;
|
||
|
|
||
|
while (mask.run() == K_ENTER)
|
||
|
{
|
||
|
mask.elabora();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int ha3700(int argc, char* argv[])
|
||
|
{
|
||
|
TPrint_storico app;
|
||
|
app.run(argc, argv, TR("Stampa storico attrezzature"));
|
||
|
return 0;
|
||
|
}
|