2002-02-26 16:20:19 +00:00
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <automask.h>
|
|
|
|
|
#include <printer.h>
|
|
|
|
|
#include <recarray.h>
|
|
|
|
|
|
|
|
|
|
#include "celib.h"
|
|
|
|
|
#include "ce3400.h"
|
|
|
|
|
#include "ce3600a.h"
|
|
|
|
|
|
|
|
|
|
#include "../cg/cglib01.h"
|
|
|
|
|
|
|
|
|
|
#include "ammce.h"
|
|
|
|
|
#include "ammmv.h"
|
|
|
|
|
#include "cespi.h"
|
|
|
|
|
#include "movce.h"
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Main Form
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TLM_form : public TCespi_list_form
|
|
|
|
|
{
|
|
|
|
|
TCursor* _cur;
|
|
|
|
|
int _tiposit;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual TRelation* relation() const { return _cur->relation(); }
|
|
|
|
|
virtual TCursor* cursor() const { return _cur; }
|
|
|
|
|
virtual bool validate(TForm_item& fld, TToken_string& val);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void set_cursor(TCursor& cur) { _cur = &cur; }
|
|
|
|
|
void set_testata(const TMask& m);
|
|
|
|
|
|
|
|
|
|
TPrint_section& corpo() { return section('B', odd_page); }
|
|
|
|
|
|
|
|
|
|
TLM_form();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void TLM_form::set_testata(const TMask& m)
|
|
|
|
|
{
|
|
|
|
|
TCespi_list_form::set_testata(m);
|
|
|
|
|
_tiposit = m.get_int(F_SITUAZIONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TLM_form::validate(TForm_item& fld, TToken_string& val)
|
|
|
|
|
{
|
|
|
|
|
const char* cmd = val.get(0);
|
2004-03-16 20:40:21 +00:00
|
|
|
|
if (xvt_str_compare_ignoring_case(cmd, "_RIVGEN") == 0)
|
2002-02-26 16:20:19 +00:00
|
|
|
|
{
|
|
|
|
|
const TRectype& mov = relation()->curr();
|
2007-09-17 15:33:04 +00:00
|
|
|
|
fld.set(mov.get(_tiposit == 2 ? MOVCE_RIVGC : MOVCE_RIVGF));
|
2002-02-26 16:20:19 +00:00
|
|
|
|
return TRUE;
|
2007-09-17 15:33:04 +00:00
|
|
|
|
}
|
|
|
|
|
if (xvt_str_compare_ignoring_case(cmd, "_VNONAMM") == 0)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& mov = relation()->curr();
|
|
|
|
|
real vnonamm = mov.get_real(_tiposit == 2 ? MOVCE_VNONAMMC : MOVCE_VNONAMM);
|
|
|
|
|
vnonamm += mov.get_real(MOVCE_VNONAMM06);
|
|
|
|
|
fld.set(vnonamm.string());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2002-02-26 16:20:19 +00:00
|
|
|
|
return TCespi_list_form::validate(fld, val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TLM_form::TLM_form() : TCespi_list_form("ce3600a")
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Main Mask
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TLM_mask : public TAutomask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TLM_mask() : TAutomask("ce3600a") { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TLM_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
|
|
|
|
{
|
|
|
|
|
bool ok = TRUE;
|
|
|
|
|
switch (f.dlg())
|
|
|
|
|
{
|
|
|
|
|
case F_CODCAT:
|
|
|
|
|
case F_D_CODCAT:
|
|
|
|
|
{
|
|
|
|
|
TDitta_cespiti& dc = ditta_cespiti();
|
|
|
|
|
ok = dc.on_category_event(f, e, jolly);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
// Main Application
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
class TLM_app : public TSkeleton_application
|
|
|
|
|
{
|
|
|
|
|
TLM_form* _form;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void main_loop();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
void print_mov();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void TLM_app::print_mov()
|
|
|
|
|
{
|
|
|
|
|
TPrint_section& corpo = _form->corpo();
|
|
|
|
|
_form->print_section(corpo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TLM_app::main_loop()
|
|
|
|
|
{
|
|
|
|
|
TLM_mask m;
|
|
|
|
|
ditta_cespiti().init_mask(m);
|
|
|
|
|
while (m.run() != K_QUIT)
|
|
|
|
|
{
|
|
|
|
|
const int ese = m.get_int(F_ESERCIZIO);
|
|
|
|
|
const int gruppo = m.get_int(F_GRUPPO);
|
|
|
|
|
const TString4 specie = m.get(F_SPECIE);
|
|
|
|
|
ditta_cespiti().set_attivita(ese, gruppo, specie);
|
|
|
|
|
|
|
|
|
|
const int tiposit = m.get_int(F_SITUAZIONE);
|
|
|
|
|
const int order = m.get_int(F_ORDINAMENTO);
|
|
|
|
|
const int codcat = m.get_int(F_CODCAT);
|
|
|
|
|
const TString& codmov = m.get(F_TIPOMOV);
|
|
|
|
|
const TString& codimp = m.get(F_CODIMP);
|
|
|
|
|
|
|
|
|
|
TLM_form form; _form = &form;
|
|
|
|
|
|
|
|
|
|
TRelation rel(LF_MOVCE);
|
|
|
|
|
|
|
|
|
|
TString expr;
|
|
|
|
|
expr << "IDCESPITE==IDCESPITE";
|
|
|
|
|
rel.add(LF_CESPI, expr);
|
|
|
|
|
expr << "|IDMOV==IDMOV|TPAMM==" << tiposit;
|
|
|
|
|
rel.add(LF_MOVAM, expr);
|
|
|
|
|
|
|
|
|
|
const TRectype& cespi = rel.curr(LF_CESPI);
|
|
|
|
|
|
2004-03-16 20:40:21 +00:00
|
|
|
|
TDate fromdate(m.get(F_FROM_DATE));
|
|
|
|
|
TDate todate(m.get(F_TO_DATE));
|
2002-02-26 16:20:19 +00:00
|
|
|
|
TString filter;
|
|
|
|
|
if (fromdate.ok())
|
2002-05-31 10:35:40 +00:00
|
|
|
|
filter << "(ANSI(" << MOVCE_DTMOV << ")>=\"" << fromdate.string(ANSI) << "\")";
|
2002-02-26 16:20:19 +00:00
|
|
|
|
if (todate.ok())
|
|
|
|
|
{
|
|
|
|
|
if (filter.not_empty()) filter << "&&";
|
2002-05-31 10:35:40 +00:00
|
|
|
|
filter << "(ANSI(" << MOVCE_DTMOV << ")<=\"" << todate.string(ANSI) << "\")";
|
2002-02-26 16:20:19 +00:00
|
|
|
|
}
|
|
|
|
|
if (codmov.not_empty())
|
|
|
|
|
{
|
|
|
|
|
if (filter.not_empty()) filter << "&&";
|
|
|
|
|
filter << '(' << MOVCE_CODMOV << "==\"" << codmov << "\")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* orderby = order == 1 ? "DTMOV|IDMOV" : "IDMOV";
|
|
|
|
|
TSorted_cursor cur(&rel, orderby, filter);
|
|
|
|
|
|
|
|
|
|
const long items = cur.items();
|
|
|
|
|
if (items > 0)
|
|
|
|
|
{
|
|
|
|
|
cur.freeze();
|
|
|
|
|
form.set_cursor(cur);
|
|
|
|
|
form.set_testata(m);
|
|
|
|
|
printer().open();
|
|
|
|
|
for (cur = 0L; cur.pos() < items; ++cur)
|
|
|
|
|
{
|
|
|
|
|
// Controllo qui la validit<69> per non incasinare il valutatore con stringhe e numeri
|
|
|
|
|
if (cespi.get_int(CESPI_CODCGRA) != gruppo || cespi.get(CESPI_CODSPA) != specie)
|
|
|
|
|
continue;
|
|
|
|
|
if (codcat > 0 && cespi.get_int(CESPI_CODCAT) != codcat)
|
|
|
|
|
continue;
|
|
|
|
|
if (codimp.not_empty() && cespi.get(CESPI_CODIMP) != codimp)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
print_mov();
|
|
|
|
|
}
|
|
|
|
|
printer().close();
|
|
|
|
|
}
|
2005-10-05 16:54:32 +00:00
|
|
|
|
xvtil_statbar_set("");
|
2002-02-26 16:20:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ce3600(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TLM_app app;
|
2003-05-12 15:03:40 +00:00
|
|
|
|
app.run(argc, argv, TR("Lista Movimenti"));
|
2002-02-26 16:20:19 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|