76ef9b8e9f
Files correlati : ca1.exe ca1100a.rep Ricompilazione Demo : [ ] Commento : Aggiunto livello di stampa legato alla cofigurazione dei centri di costo git-svn-id: svn://10.65.10.50/branches/R_10_00@22569 c028cbd2-c16b-5b4b-a496-9718f37d4682
107 lines
2.3 KiB
C++
Executable File
107 lines
2.3 KiB
C++
Executable File
#include <applicat.h>
|
|
#include <automask.h>
|
|
#include <reprint.h>
|
|
|
|
#include "ca1.h"
|
|
#include "calib01.h"
|
|
#include "calib02.h"
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TEthero_rep
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TEthero_rep : public TAnal_report
|
|
{
|
|
protected:
|
|
virtual bool use_mask() { return true; }
|
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
|
};
|
|
|
|
bool TEthero_rep::get_usr_val(const TString& name, TVariant& var) const
|
|
{
|
|
// Ricava informazioni sulla struttura dei livelli di analitica
|
|
// es. CA_LEVEL_CDC_LEN_1 ricava la lunghezza del primo livello dei centri di costo
|
|
if (name.starts_with("#CA_INFO_"))
|
|
{
|
|
TToken_string tok(name, '_');
|
|
|
|
TString8 filename; tok.get(2, filename);
|
|
const int logicnum = table2logic(filename);
|
|
|
|
TString16 info; tok.get(3, info);
|
|
|
|
int level = 1; tok.get(4, level);
|
|
if (level > 0) level--;
|
|
|
|
const TMultilevel_code_info& code = ca_multilevel_code_info(logicnum);
|
|
|
|
if (info.starts_with("TOTAL"))
|
|
{
|
|
var.set(code.total_len(level));
|
|
return true;
|
|
} else
|
|
if (info.starts_with("LEN"))
|
|
{
|
|
var.set(code.len(level));
|
|
return true;
|
|
}
|
|
} else
|
|
if (name.starts_with("CODCCOSTO_1")) // shortcut for CODCCOSTO[1,#CA_LEVEL_CDC_LEN_1]
|
|
{
|
|
if (get_record_field("CODCCOSTO", var))
|
|
{
|
|
const TMultilevel_code_info& code = ca_multilevel_code_info(LF_CDC);
|
|
const TString& cdc = var.as_string().left(code.len(0));
|
|
var.set(cdc);
|
|
return true;
|
|
}
|
|
}
|
|
return TAnal_report::get_usr_val(name, var);
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// TPrint_ca
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TPrint_ca : public TSkeleton_application
|
|
{
|
|
protected:
|
|
void print_rep(const TFilename& n) const;
|
|
|
|
public:
|
|
virtual void main_loop();
|
|
};
|
|
|
|
void TPrint_ca::print_rep(const TFilename& n) const
|
|
{
|
|
TEthero_rep rep;
|
|
if (rep.load(n))
|
|
while(rep.print_or_preview());
|
|
}
|
|
|
|
void TPrint_ca::main_loop()
|
|
{
|
|
TFilename path;
|
|
|
|
if (argc() > 2)
|
|
{
|
|
path = argv(2);
|
|
path.ext("rep");
|
|
if (path.custom_path())
|
|
{
|
|
print_rep(path);
|
|
return;
|
|
}
|
|
}
|
|
while (select_custom_file(path, "rep", "ca1100"))
|
|
print_rep(path);
|
|
}
|
|
|
|
int ca1100(int argc, char* argv[])
|
|
{
|
|
TPrint_ca a;
|
|
a.run(argc, argv, TR("Stampa analitica"));
|
|
return 0;
|
|
}
|
|
|