2016-09-09 13:58:28 +00:00
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <defmask.h>
|
2021-12-13 22:21:30 +01:00
|
|
|
|
#include <repapp.h>
|
2016-09-09 13:58:28 +00:00
|
|
|
|
|
|
|
|
|
#include "ca3.h"
|
|
|
|
|
#include "ca3883.h"
|
|
|
|
|
#include "ca3883a.h"
|
|
|
|
|
#include "calib01.h"
|
|
|
|
|
#include "calib02.h"
|
|
|
|
|
#include "pconana.h"
|
2021-12-13 22:21:30 +01:00
|
|
|
|
#include "commesse.h"
|
2016-09-09 13:58:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
// MASCHERA
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
class TPrint_stima_ricavi_mask : public TAnal_report_mask
|
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TPrint_stima_ricavi_mask();
|
|
|
|
|
virtual ~TPrint_stima_ricavi_mask() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool TPrint_stima_ricavi_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
|
|
|
|
{
|
2021-12-13 22:21:30 +01:00
|
|
|
|
|
2016-09-09 13:58:28 +00:00
|
|
|
|
switch (o.dlg())
|
|
|
|
|
{
|
2021-12-13 22:21:30 +01:00
|
|
|
|
case DLG_REPORT:
|
|
|
|
|
if (e == fe_init)
|
|
|
|
|
set_report_class();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2016-09-09 13:58:28 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return TAnal_report_mask::on_field_event(o, e, jolly);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TPrint_stima_ricavi_mask::TPrint_stima_ricavi_mask()
|
|
|
|
|
:TAnal_report_mask("ca3900")
|
|
|
|
|
{
|
|
|
|
|
TConfig& cfg = ca_config();
|
|
|
|
|
const bool use_pdcc = cfg.get_bool("UsePdcc");
|
|
|
|
|
|
|
|
|
|
const TMultilevel_code_info& pconana_info = ca_multilevel_code_info(LF_PCONANA);
|
|
|
|
|
const int pconana_levels = pconana_info.levels();
|
|
|
|
|
|
|
|
|
|
int prefix = cfg.get_int("PdcPrefix");
|
|
|
|
|
if (prefix >= pconana_levels)
|
|
|
|
|
prefix = pconana_levels - 1;
|
|
|
|
|
|
|
|
|
|
// Controllo se voglio (e posso) usare il conto analitico come prefisso di quello contabile
|
|
|
|
|
if (use_pdcc && prefix > 0)
|
|
|
|
|
{
|
|
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
|
|
|
|
const int levels = info.levels();
|
|
|
|
|
if (levels >= 2 && prefix < levels && esistono_riclassificazioni())
|
|
|
|
|
{
|
|
|
|
|
ca_create_fields(*this, 0, LF_PCONANA, 1, 13, F_PRE1, F_PREDES1, 0x0, PCONANA_CODCONTO);
|
|
|
|
|
|
|
|
|
|
// Nascondi i campi che non fanno parte del prefisso
|
|
|
|
|
for (int i = 0; i < levels; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i < prefix)
|
|
|
|
|
{
|
|
|
|
|
field(F_PRE1 + i).check_type(CHECK_REQUIRED);
|
|
|
|
|
field(F_PRE1 + i).set_group(6);
|
|
|
|
|
field(F_PREDES1 + i).set_group(6);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
field(F_PRE1 + i).hide();
|
|
|
|
|
field(F_PREDES1 + i).hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// setta gli handlers a tutti i campi generati della maschera;senza questa chiamata la on_field_event
|
|
|
|
|
// non puo' funzionare sui campi generati!!!
|
|
|
|
|
set_handlers();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
// RECORDSET
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
class TPrint_stima_ricavi_recordset : public TPrint_saldana_recordset
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TPrint_stima_ricavi_recordset() : TPrint_saldana_recordset(9) {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
// REPORT
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
class TPrint_stima_ricavi_rep : public TAnal_report
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
protected:
|
2021-12-13 22:21:30 +01:00
|
|
|
|
// virtual bool set_recordset();
|
2016-09-09 13:58:28 +00:00
|
|
|
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
|
|
|
|
|
|
|
|
|
public:
|
2024-05-23 14:48:15 +02:00
|
|
|
|
// virtual const char * get_excel_header_section() override { return "H1"; }
|
|
|
|
|
virtual const char * get_excel_disabled_field() override { return "H0.100|H0.101|H0.201|H0.202|H0.203|H0.204|H0.205"; }
|
2016-09-09 13:58:28 +00:00
|
|
|
|
void set_filter(const TPrint_stima_ricavi_mask& msk);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool TPrint_stima_ricavi_rep::get_usr_val(const TString& name, TVariant& var) const
|
|
|
|
|
{
|
|
|
|
|
return TAnal_report::get_usr_val(name, var);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TPrint_stima_ricavi_rep::set_filter(const TPrint_stima_ricavi_mask& msk)
|
|
|
|
|
{
|
|
|
|
|
TPrint_stima_ricavi_recordset* recset = new TPrint_stima_ricavi_recordset();
|
|
|
|
|
|
2020-02-14 00:30:42 +01:00
|
|
|
|
recset->set_filter(msk);
|
2016-09-09 13:58:28 +00:00
|
|
|
|
TAnal_report::set_recordset(recset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
// APPLICAZIONE
|
|
|
|
|
////////////////////////////////////////////////////////
|
2021-12-13 22:21:30 +01:00
|
|
|
|
class TPrint_stima_ricavi : public TReport_application
|
2016-09-09 13:58:28 +00:00
|
|
|
|
{
|
|
|
|
|
TPrint_stima_ricavi_mask* _mask;
|
2021-12-13 22:21:30 +01:00
|
|
|
|
TPrint_stima_ricavi_rep* _rep;
|
2016-09-09 13:58:28 +00:00
|
|
|
|
|
|
|
|
|
protected:
|
2021-12-13 22:21:30 +01:00
|
|
|
|
virtual TReport & get_report(const TAutomask & m);
|
|
|
|
|
virtual TTrec * get_dbase_recdesc(TReport & rep, const TAutomask & mask);
|
|
|
|
|
virtual TAutomask & get_mask();
|
2022-03-14 09:02:46 +01:00
|
|
|
|
virtual void execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type & type);
|
2021-12-13 22:21:30 +01:00
|
|
|
|
virtual const char * output_name(const TAutomask & mask, const TReport & rep) const { return "stimaric"; }
|
|
|
|
|
virtual bool user_destroy();
|
2016-09-09 13:58:28 +00:00
|
|
|
|
|
2021-12-13 22:21:30 +01:00
|
|
|
|
public:
|
|
|
|
|
TPrint_stima_ricavi() : _mask(nullptr), _rep(nullptr) {}
|
|
|
|
|
~TPrint_stima_ricavi() {}
|
2016-09-09 13:58:28 +00:00
|
|
|
|
|
2021-12-13 22:21:30 +01:00
|
|
|
|
public:
|
|
|
|
|
};
|
|
|
|
|
TReport & TPrint_stima_ricavi::get_report(const TAutomask & m)
|
2016-09-09 13:58:28 +00:00
|
|
|
|
{
|
2021-12-13 22:21:30 +01:00
|
|
|
|
if (_rep == nullptr)
|
|
|
|
|
_rep = new TPrint_stima_ricavi_rep;
|
|
|
|
|
_rep->load(_mask->get(DLG_REPORT));
|
|
|
|
|
return *_rep;
|
2016-09-09 13:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 22:21:30 +01:00
|
|
|
|
TAutomask & TPrint_stima_ricavi::get_mask()
|
2016-09-09 13:58:28 +00:00
|
|
|
|
{
|
2021-12-13 22:21:30 +01:00
|
|
|
|
if (_mask == nullptr)
|
|
|
|
|
_mask = new TPrint_stima_ricavi_mask;
|
|
|
|
|
return *_mask;
|
2016-09-09 13:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 22:21:30 +01:00
|
|
|
|
TTrec * TPrint_stima_ricavi::get_dbase_recdesc(TReport & rep, const TAutomask & mask)
|
|
|
|
|
{
|
|
|
|
|
TTrec * desc = new TTrec;
|
|
|
|
|
TToken_string def;
|
|
|
|
|
TRectype cms(LF_COMMESSE);
|
|
|
|
|
TRectype fasi(LF_FASI);
|
|
|
|
|
TRectype cdc(LF_CDC);
|
|
|
|
|
|
|
|
|
|
desc->add_fielddef(cms.rec_des(), COMMESSE_CODCMS);
|
|
|
|
|
desc->add_fielddef(cms.rec_des(), COMMESSE_DESCRIZ);
|
|
|
|
|
desc->add_fielddef(cms.rec_des(), COMMESSE_DATAINIZIO);
|
|
|
|
|
desc->add_fielddef(cms.rec_des(), COMMESSE_DATAFINE);
|
|
|
|
|
desc->add_fielddef("BUDGETC", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("MATURATOC", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("AVANZC", _realfld, 6, 2);
|
|
|
|
|
desc->add_fielddef("FILLER", _alfafld, 1);
|
|
|
|
|
desc->add_fielddef("BUDGETR", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("MATURATOR", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("ACCERT", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("INTEG5", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("MARGINE", _realfld, 18, 2);
|
|
|
|
|
desc->add_fielddef("AVANZ", _realfld, 6, 2);
|
|
|
|
|
desc->add_fielddef("FILLER1", _alfafld, 1);
|
|
|
|
|
desc->add_fielddef(cms.rec_des(), COMMESSE_CONTSEP);
|
|
|
|
|
|
|
|
|
|
TString keydef(COMMESSE_CODCMS);
|
|
|
|
|
|
|
|
|
|
desc->add_keydef(keydef, true);
|
|
|
|
|
return desc;
|
|
|
|
|
}
|
2022-03-14 09:02:46 +01:00
|
|
|
|
void TPrint_stima_ricavi::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type & type)
|
2016-09-09 13:58:28 +00:00
|
|
|
|
{
|
2021-12-13 22:21:30 +01:00
|
|
|
|
((TPrint_stima_ricavi_rep &)rep).set_filter((TPrint_stima_ricavi_mask &)mask);
|
2024-05-23 14:48:15 +02:00
|
|
|
|
book.add(rep, type);
|
2016-09-09 13:58:28 +00:00
|
|
|
|
}
|
2024-05-23 14:48:15 +02:00
|
|
|
|
|
2021-12-13 22:21:30 +01:00
|
|
|
|
bool TPrint_stima_ricavi::user_destroy()
|
2016-09-09 13:58:28 +00:00
|
|
|
|
{
|
2021-12-13 22:21:30 +01:00
|
|
|
|
safe_delete(_mask);
|
|
|
|
|
safe_delete(_rep);
|
|
|
|
|
return TReport_application::user_destroy();
|
2016-09-09 13:58:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ca3900(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
TPrint_stima_ricavi a;
|
|
|
|
|
a.run(argc, argv, TR("Stampa stima ricavi di competenza"));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Istruzioni per i programmi ca3800 e ca3900
|
|
|
|
|
//------------------------------------------
|
|
|
|
|
// CA_3800
|
|
|
|
|
// Gestore maschera ca3800 (Analisi Bilancio di Commessa)
|
|
|
|
|
// Creatore del report e dell'applicazione
|
|
|
|
|
|
|
|
|
|
// CA_3801
|
|
|
|
|
// Gestore dei report a colonne variabili (stampa in base a struttura scelta per il PCONANA). Serve solo per ca3800.
|
|
|
|
|
|
|
|
|
|
// CA_3883
|
|
|
|
|
// Gestore del recordset per il calcolo dei valori da mettere sulle stampe (<28> il nucleo dei programmi ca3800 e ca3900)
|
|
|
|
|
|
|
|
|
|
// CA_3900
|
|
|
|
|
// Gestore maschera ca3900 (Stima ricavi di competenza)
|
2024-05-23 14:48:15 +02:00
|
|
|
|
// Creatore del report e dell'applicazione
|