Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la version 1.7 patch 054 aga sul main trunk git-svn-id: svn://10.65.10.50/trunk@9655 c028cbd2-c16b-5b4b-a496-9718f37d4682
209 lines
5.7 KiB
C++
Executable File
209 lines
5.7 KiB
C++
Executable File
#include <applicat.h>
|
|
#include <automask.h>
|
|
#include <form.h>
|
|
#include <printer.h>
|
|
#include <recarray.h>
|
|
#include <utility.h>
|
|
|
|
#include "ce3.h"
|
|
#include "ce3300a.h"
|
|
#include "ce3300.h"
|
|
#include "celib.h"
|
|
|
|
//-----FORM--------------------------------------------------------------------------------------//
|
|
|
|
class TForm_prospettocesp : public TForm_cespiti
|
|
{
|
|
|
|
public:
|
|
virtual bool validate(TForm_item &cf, TToken_string &s);
|
|
void set_testata() {set_header(1,TRUE);}
|
|
void set_pedata() {set_footer(1,FALSE); set_footer(1,TRUE);}
|
|
TForm_prospettocesp();
|
|
|
|
virtual ~TForm_prospettocesp();
|
|
};
|
|
|
|
TForm_prospettocesp::TForm_prospettocesp() :TForm_cespiti ("ce3300a") //costruttore
|
|
{
|
|
}
|
|
|
|
TForm_prospettocesp::~TForm_prospettocesp()
|
|
{
|
|
}
|
|
|
|
bool TForm_prospettocesp::validate(TForm_item &cf, TToken_string &s)
|
|
{
|
|
return TForm_cespiti::validate(cf,s); //richiama la validate standard della classe genitore (TForm_cespiti)
|
|
}
|
|
|
|
//-----AUTOMASK---------------------------------------------------------------------------------//
|
|
|
|
class TStampaprospetto_mask : public TAutomask
|
|
{
|
|
TRelation * _rel;
|
|
TCursor * _cur;
|
|
|
|
protected:
|
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
public:
|
|
|
|
TStampaprospetto_mask();
|
|
|
|
virtual ~TStampaprospetto_mask(){};
|
|
};
|
|
|
|
TStampaprospetto_mask::TStampaprospetto_mask() :TAutomask ("ce3300a")
|
|
{
|
|
ditta_cespiti().init_mask(* this);
|
|
}
|
|
|
|
bool TStampaprospetto_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
{
|
|
switch (o.dlg())
|
|
{
|
|
case F_SITFISC :
|
|
if (e == fe_close)
|
|
{
|
|
if (!get_bool(F_SITFISC) && !get_bool(F_SITCIV) && !get_bool(F_SITGEST)) //deve essere selezionata almeno 1 situaz.
|
|
return error_box("Selezionare almeno una delle Situazioni da stampare");
|
|
}
|
|
break;
|
|
default: break;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
//-----SKELETON APPLICATION------------------------------------------------------------------------------------------//
|
|
|
|
class TStampa_prospetto : public TSkeleton_application
|
|
{
|
|
TStampaprospetto_mask * _mask;
|
|
TForm_prospettocesp * _form;
|
|
|
|
protected:
|
|
virtual bool create();
|
|
virtual bool destroy();
|
|
virtual void main_loop();
|
|
|
|
void print_header( const int tipo );
|
|
void print_footer();
|
|
|
|
public:
|
|
TStampa_prospetto() {}
|
|
};
|
|
|
|
bool TStampa_prospetto::create()
|
|
{
|
|
open_files(LF_CESPI, LF_SALCE, LF_AMMCE, LF_MOVCE, LF_AMMMV, 0);
|
|
_mask = new TStampaprospetto_mask;
|
|
_form = new TForm_prospettocesp();
|
|
|
|
return TSkeleton_application::create();
|
|
}
|
|
|
|
bool TStampa_prospetto::destroy()
|
|
{
|
|
delete _mask;
|
|
delete _form;
|
|
return TSkeleton_application::destroy();
|
|
}
|
|
|
|
|
|
void TStampa_prospetto::print_header( const int tipo )
|
|
{
|
|
_form->find_field('H', odd_page, FF_CODDITTA).set(_mask->get(F_CODDITTA));
|
|
_form->find_field('H', odd_page, FF_DESCRDITTA).set(_mask->get(F_DESCRDITTA));
|
|
_form->find_field('H', odd_page, FF_GRUPPO).set(_mask->get(F_GRUPPO));
|
|
_form->find_field('H', odd_page, FF_D_GRUPPO).set(_mask->get(F_D_GRUPPO));
|
|
_form->find_field('H', odd_page, FF_SPECIE).set(_mask->get(F_SPECIE));
|
|
_form->find_field('H', odd_page, FF_D_SPECIE).set(_mask->get(F_D_SPECIE));
|
|
|
|
switch(tipo) //in base al(ai) tipo(i) di situazione cambia una riga dell'header
|
|
{
|
|
case 1:
|
|
_form->find_field('H', odd_page, FF_SITUAZIONE).set("fiscale");
|
|
break;
|
|
case 2:
|
|
_form->find_field('H', odd_page, FF_SITUAZIONE).set("civilistica");
|
|
break;
|
|
case 3:
|
|
_form->find_field('H', odd_page, FF_SITUAZIONE).set("gestionale");
|
|
break;
|
|
}
|
|
_form->set_testata();
|
|
}
|
|
|
|
void TStampa_prospetto::print_footer()
|
|
{
|
|
_form->set_pedata();
|
|
}
|
|
|
|
/////////////////////////////////////THE ROUTINE LIVES HERE!!!///////////////////////////////
|
|
|
|
void TStampa_prospetto::main_loop()
|
|
{
|
|
_mask->set(F_SITFISC,"X");
|
|
while (_mask->run() == K_ENTER)
|
|
{
|
|
/* TRectype rec(LF_CESPI);
|
|
TString filtro;
|
|
TCursor& cursore = *_form->cursor();
|
|
const int esercizio = _mask->get_int(F_ESERCIZIO);
|
|
filtro.format("STR(%d->CODES <= %d)",LF_SALCE, esercizio); //filtro:codes(nel file salce)<=esercizio(dato dalla maschera)
|
|
TString80 key; key.format("%4d",esercizio);
|
|
const TRectype& cce = cache().get("CCE", key);
|
|
_ammvenduti = cce.get_bool("B3");
|
|
|
|
const int r = _mask->get_int(F_TIPOSTAMPA); //in base al tipo di stampa selezionato setta il cursore
|
|
switch (r)
|
|
{
|
|
case 0:
|
|
cursore.setkey(1); // setta la chiave (nel caso si fosse scelta in precedenza la 2)
|
|
if (!_mask->field(F_CODCESP).empty())
|
|
rec.put("IDCESPITE", _mask->get(F_CODCESP));
|
|
break;
|
|
case 1:
|
|
cursore.setkey(2); // setta la chiave 2
|
|
|
|
rec.put("CODCGRA", _mask->get_int(F_GRUPPO));
|
|
rec.put("CODSPA", _mask->get(F_SPECIE));
|
|
if (!_mask->field(F_CATCESP).empty())
|
|
rec.put("CODCAT", _mask->get_int(F_CATCESP));
|
|
break;
|
|
case 2:
|
|
if (!_mask->field(F_IMPCESP).empty())
|
|
filtro << format (" && (%d->CODIMP == \"%s\")", LF_CESPI, (const char *) _mask->get(F_IMPCESP)); //estende il filtro con il campo CODIMP
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
cursore.setregion(rec,rec);
|
|
cursore.setfilter(filtro,TRUE);
|
|
|
|
long num = cursore.items();
|
|
cursore.freeze();
|
|
printer().open();
|
|
|
|
for (cursore=0; cursore.pos()<num; ++cursore)
|
|
{
|
|
if (_mask->get_bool(F_SITFISC))
|
|
print_percespite(1);
|
|
if (_mask->get_bool(F_SITCIV))
|
|
print_percespite(2);
|
|
if (_mask->get_bool(F_SITGEST))
|
|
print_percespite(3);
|
|
}
|
|
printer().close();
|
|
cursore.freeze(FALSE); */
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int ce3300(int argc, char* argv[])
|
|
{
|
|
TStampa_prospetto a;
|
|
a.run(argc,argv,"Stampa prospetto cespiti");
|
|
return 0;
|
|
} |