Patch level : 2.2
Files correlati : ca1 Ricompilazione Demo : [ ] Commento : Aggiunta stampa anagrafiche della contabilita' analitica git-svn-id: svn://10.65.10.50/trunk@12813 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
24eb190b9d
commit
291fd33916
15
ca/ca1.cpp
Executable file
15
ca/ca1.cpp
Executable file
@ -0,0 +1,15 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "ca1.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int r = (argc > 1) ? argv[1][1] - '0' : 0;
|
||||
switch (r)
|
||||
{
|
||||
case 1: break;
|
||||
default: ca1100(argc,argv); break; // stampa centri di costo
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
17
ca/ca1100.alx
Executable file
17
ca/ca1100.alx
Executable file
@ -0,0 +1,17 @@
|
||||
\ Messaggi specifici per stampa anagrafiche analitica (ca1 -0)
|
||||
|
||||
: MESSAGE_FORMAT_COSTO ( -- )
|
||||
CA_FORMAT_COSTO
|
||||
;
|
||||
|
||||
: MESSAGE_FORMAT_COMMESSA ( -- )
|
||||
CA_FORMAT_COMMESSA
|
||||
;
|
||||
|
||||
: MESSAGE_FORMAT_FASE ( -- )
|
||||
CA_FORMAT_FASE
|
||||
;
|
||||
|
||||
: MESSAGE_FORMAT_CONTO ( -- )
|
||||
CA_FORMAT_CONTO
|
||||
;
|
33
ca/ca1100.cpp
Executable file
33
ca/ca1100.cpp
Executable file
@ -0,0 +1,33 @@
|
||||
#include <applicat.h>
|
||||
#include <reprint.h>
|
||||
|
||||
#include "ca1.h"
|
||||
#include "calib02.h"
|
||||
|
||||
|
||||
class TPrint_ca : public TSkeleton_application
|
||||
{
|
||||
public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void TPrint_ca::main_loop()
|
||||
{
|
||||
TFilename path;
|
||||
while (select_custom_file(path, "rep", "ca1100"))
|
||||
{
|
||||
TReport_book book;
|
||||
TAnal_report rep;
|
||||
rep.load(path);
|
||||
book.add(rep);
|
||||
book.print_or_preview();
|
||||
}
|
||||
}
|
||||
|
||||
int ca1100(int argc, char* argv[])
|
||||
{
|
||||
TPrint_ca a;
|
||||
a.run(argc, argv, TR("Stampa anagrafiche"));
|
||||
return 0;
|
||||
}
|
||||
|
83
ca/calib02.cpp
Executable file
83
ca/calib02.cpp
Executable file
@ -0,0 +1,83 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "calib01.h"
|
||||
#include "calib02.h"
|
||||
|
||||
size_t TAnal_report::get_usr_words(TString_array& words) const
|
||||
{
|
||||
TReport::get_usr_words(words);
|
||||
|
||||
const char* const name[] =
|
||||
{
|
||||
"CA_FORMAT_COSTO",
|
||||
"CA_FORMAT_COMMESSA",
|
||||
"CA_FORMAT_FASE",
|
||||
"CA_FORMAT_CONTO",
|
||||
NULL
|
||||
};
|
||||
|
||||
((TAnal_report*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile
|
||||
size_t i;
|
||||
for (i = 0; name[i] != NULL; i++)
|
||||
words.add(name[i]);
|
||||
|
||||
return words.items();
|
||||
}
|
||||
|
||||
bool TAnal_report::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
||||
{
|
||||
if (opcode < _first_msg)
|
||||
return TReport::execute_usr_word(opcode, stack);
|
||||
opcode -= _first_msg;
|
||||
switch (opcode)
|
||||
{
|
||||
case 0 : msg_format_costo(stack); break;
|
||||
case 1 : msg_format_commessa(stack); break;
|
||||
case 2 : msg_format_fase(stack); break;
|
||||
case 3 : msg_format_conto(stack); break;
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TAnal_report::msg_format(int logicnum, TVariant_stack& stack)
|
||||
{
|
||||
const TString& str_in = curr_field()->get().as_string();
|
||||
if (str_in.not_empty())
|
||||
{
|
||||
TString80 separator = " ";
|
||||
if (stack.items() > 0)
|
||||
separator = stack.pop().as_string();
|
||||
if (separator.not_empty())
|
||||
{
|
||||
const TMultilevel_code_info& mci = ca_multilevel_code_info(logicnum);
|
||||
TString str_out;
|
||||
for (int i = 0; i < mci.levels(); i++)
|
||||
{
|
||||
const TFieldref& fld = mci.fieldref(i);
|
||||
const TString& str = str_in.sub(fld.from(), fld.to());
|
||||
if (str.not_empty())
|
||||
{
|
||||
if (i > 0) str_out << separator;
|
||||
str_out << str;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
curr_field()->set(str_out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TAnal_report::msg_format_costo (TVariant_stack& stack)
|
||||
{ msg_format(LF_CDC, stack); }
|
||||
|
||||
void TAnal_report::msg_format_commessa(TVariant_stack& stack)
|
||||
{ msg_format(LF_COMMESSE, stack); }
|
||||
|
||||
void TAnal_report::msg_format_fase (TVariant_stack& stack)
|
||||
{ msg_format(LF_FASI, stack); }
|
||||
|
||||
void TAnal_report::msg_format_conto (TVariant_stack& stack)
|
||||
{ msg_format(LF_PCONANA, stack); }
|
||||
|
29
ca/calib02.h
Executable file
29
ca/calib02.h
Executable file
@ -0,0 +1,29 @@
|
||||
#ifndef __CALIB02_H
|
||||
#define __CALIB02_H
|
||||
|
||||
#ifndef __REPORT_H
|
||||
#include <report.h>
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnal_rapport
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TAnal_report : public TReport
|
||||
{
|
||||
unsigned int _first_msg;
|
||||
|
||||
protected: // protected is safer
|
||||
virtual size_t get_usr_words(TString_array& words) const;
|
||||
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
|
||||
|
||||
void msg_format(int logicnum, TVariant_stack& stack);
|
||||
void msg_format_costo (TVariant_stack& stack);
|
||||
void msg_format_commessa(TVariant_stack& stack);
|
||||
void msg_format_fase (TVariant_stack& stack);
|
||||
void msg_format_conto (TVariant_stack& stack);
|
||||
|
||||
public: // meglio pubic?
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user