From 291fd33916c59e7069b9136223765f76849eedf9 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Mar 2005 14:20:42 +0000 Subject: [PATCH] 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 --- ca/ca1.cpp | 15 +++++++++ ca/ca1.h | 1 + ca/ca1100.alx | 17 +++++++++++ ca/ca1100.cpp | 33 ++++++++++++++++++++ ca/calib02.cpp | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ ca/calib02.h | 29 ++++++++++++++++++ 6 files changed, 178 insertions(+) create mode 100755 ca/ca1.cpp create mode 100755 ca/ca1.h create mode 100755 ca/ca1100.alx create mode 100755 ca/ca1100.cpp create mode 100755 ca/calib02.cpp create mode 100755 ca/calib02.h diff --git a/ca/ca1.cpp b/ca/ca1.cpp new file mode 100755 index 000000000..69bb70f92 --- /dev/null +++ b/ca/ca1.cpp @@ -0,0 +1,15 @@ +#include + +#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; +} diff --git a/ca/ca1.h b/ca/ca1.h new file mode 100755 index 000000000..7ad33d31d --- /dev/null +++ b/ca/ca1.h @@ -0,0 +1 @@ +int ca1100(int argc, char* argv[]); diff --git a/ca/ca1100.alx b/ca/ca1100.alx new file mode 100755 index 000000000..f06c04fd9 --- /dev/null +++ b/ca/ca1100.alx @@ -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 +; diff --git a/ca/ca1100.cpp b/ca/ca1100.cpp new file mode 100755 index 000000000..bd884c7e8 --- /dev/null +++ b/ca/ca1100.cpp @@ -0,0 +1,33 @@ +#include +#include + +#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; +} + diff --git a/ca/calib02.cpp b/ca/calib02.cpp new file mode 100755 index 000000000..214867146 --- /dev/null +++ b/ca/calib02.cpp @@ -0,0 +1,83 @@ +#include + +#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); } + diff --git a/ca/calib02.h b/ca/calib02.h new file mode 100755 index 000000000..e759d7cb4 --- /dev/null +++ b/ca/calib02.h @@ -0,0 +1,29 @@ +#ifndef __CALIB02_H +#define __CALIB02_H + +#ifndef __REPORT_H +#include +#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