ef1c92ccc3
Files correlati : Ricompilazione Demo : [ ] Commento :aggiunta sottosezione con i gr.co.sott. riclassificati git-svn-id: svn://10.65.10.50/trunk@13788 c028cbd2-c16b-5b4b-a496-9718f37d4682
141 lines
2.9 KiB
C++
Executable File
141 lines
2.9 KiB
C++
Executable File
#include <applicat.h>
|
|
#include <execp.h>
|
|
#include <reprint.h>
|
|
|
|
#include "pconana.h"
|
|
#include "ca1.h"
|
|
#include "ca1400a.h"
|
|
#include "calib01.h"
|
|
#include "calib02.h"
|
|
|
|
////////////////////////////////////////
|
|
// Maschera
|
|
////////////////////////////////////////
|
|
class TMask_print_pdc : public TAutomask
|
|
{
|
|
|
|
protected:
|
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) {return true;}
|
|
public:
|
|
TMask_print_pdc();
|
|
virtual ~TMask_print_pdc() {}
|
|
};
|
|
|
|
TMask_print_pdc::TMask_print_pdc()
|
|
:TAutomask("ca1400a")
|
|
{
|
|
ca_create_fields(*this, 0, LF_PCONANA, 3, 2, F_DACONTO, F_DACONTO + 100, 0x0, "#DACONTO");
|
|
int nfields = ca_create_fields(*this, 0, LF_PCONANA, 3, 8, F_ACONTO, F_ACONTO + 100, 0x0, "#ACONTO");
|
|
for (int i = 0; i < nfields; i++)
|
|
{
|
|
TMask_field& daconto = field(F_DACONTO + i);
|
|
daconto.set_group(1);
|
|
daconto.check_type(CHECK_NORMAL);
|
|
TMask_field& aconto = field(F_ACONTO + i);
|
|
aconto.set_group(2);
|
|
aconto.check_type(CHECK_NORMAL);
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////
|
|
// Report
|
|
//////////////////////////////////////////
|
|
class TRep_print_pdc : public TAnal_report
|
|
{
|
|
bool _riclass;
|
|
int _minlen;
|
|
|
|
protected:
|
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
|
public:
|
|
TRep_print_pdc();
|
|
};
|
|
|
|
TRep_print_pdc::TRep_print_pdc()
|
|
{
|
|
//il file di riclassificazione ha almeno un record?
|
|
TLocalisamfile ric(LF_PANAPDC);
|
|
_riclass = ric.first() == NOERR;
|
|
|
|
//quale e' la lunghezza del piano dei conti tenendo conto di tutti i livelli tranne l'ultimo?
|
|
//questa qui!
|
|
_minlen = ca_multilevel_code_info(LF_PCONANA).total_len(-1);
|
|
}
|
|
|
|
bool TRep_print_pdc::get_usr_val(const TString& name, TVariant& var) const
|
|
{
|
|
if (name == "#SHOW_SUBSECTION")
|
|
{
|
|
bool show = false;
|
|
if (_riclass)
|
|
{
|
|
const TString& conto = recordset()->get(PCONANA_CODCONTO).as_string();
|
|
show = conto.len() > _minlen;
|
|
}
|
|
var.set(show);
|
|
return true;
|
|
}
|
|
return TAnal_report::get_usr_val(name, var);
|
|
}
|
|
|
|
///////////////////////////////////////////////
|
|
// Applicazione
|
|
///////////////////////////////////////////////
|
|
class TPrint_pdc : public TSkeleton_application
|
|
{
|
|
bool create();
|
|
|
|
public:
|
|
virtual void main_loop();
|
|
};
|
|
|
|
bool TPrint_pdc::create()
|
|
{
|
|
TConfig& cfg = ca_config();
|
|
const TString& pdc = cfg.get("Pdci", NULL, 1);
|
|
|
|
if (pdc.blank())
|
|
{
|
|
const bool use_cg1 = cfg.get_bool("UsePdcc");
|
|
|
|
if (use_cg1)
|
|
{
|
|
TExternal_app app("cg1 -0");
|
|
app.run(true);
|
|
return false;
|
|
}
|
|
else
|
|
return error_box(TR("Il piano dei conti analitico non e' stato configurato"));
|
|
}
|
|
return TSkeleton_application::create();
|
|
}
|
|
|
|
void TPrint_pdc::main_loop()
|
|
{
|
|
TFilename path;
|
|
TMask_print_pdc m;
|
|
|
|
while (m.run() == K_ENTER)
|
|
{
|
|
TReport_book book;
|
|
TRep_print_pdc rep;
|
|
|
|
path = m.get(F_REPORT);
|
|
if (path.empty())
|
|
path = "ca1400a";
|
|
rep.load(path);
|
|
rep.mask2report(m);
|
|
book.add(rep);
|
|
book.print_or_preview();
|
|
|
|
}
|
|
}
|
|
|
|
int ca1400(int argc, char* argv[])
|
|
{
|
|
TPrint_pdc a;
|
|
a.run(argc, argv, TR("Stampa piano dei conti analitica"));
|
|
return 0;
|
|
}
|
|
|