From 22ddbe22d73fb00649eccd3015e5fbbb7c0bff5b Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@c028cbd2-c16b-5b4b-a496-9718f37d4682> Date: Mon, 11 Oct 2010 14:40:52 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'R_10_00'. git-svn-id: svn://10.65.10.50/branches/R_10_00@20989 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ha/ha1300.cpp | 136 +++++++++++++++++++++++++++++++++++++++++++++++++ ha/ha1300a.h | 1 + ha/ha1300a.uml | 19 +++++++ 3 files changed, 156 insertions(+) create mode 100755 ha/ha1300.cpp create mode 100755 ha/ha1300a.h create mode 100755 ha/ha1300a.uml diff --git a/ha/ha1300.cpp b/ha/ha1300.cpp new file mode 100755 index 000000000..3af313a21 --- /dev/null +++ b/ha/ha1300.cpp @@ -0,0 +1,136 @@ +#include +#include +#include +#include + +#include "halib.h" + +#include "ha1300a.h" + +#define UPLOAD_FILE "upload.d" + +/////////////////////////////////////////////////////////// +// TAutomask +/////////////////////////////////////////////////////////// +class TUpload2Campo_mask : public TAutomask +{ +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + +public: + TUpload2Campo_mask(); +}; + +bool TUpload2Campo_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + return true; +} + +TUpload2Campo_mask::TUpload2Campo_mask() : TAutomask ("ha1300a") +{ + TConfig config(CONFIG_DITTA, "ha"); + const TString& path = config.get("InputPath"); + set(F_PATH, path); +} + +/////////////////////////////////////// +// TSkeleton_application +/////////////////////////////////////// +class TUpload2Campo : public TSkeleton_application +{ + TFilename _intput_dir; + +protected: + void elabora_SU(THardy_upload_recordset& recset, TLog_report& log); + + void elabora(const TMask& mask); + +public: + virtual void main_loop(); + virtual bool create(); +}; + + +void TUpload2Campo::elabora_SU(THardy_upload_recordset& recset, TLog_report& log) +{ +} + + +void TUpload2Campo::elabora(const TMask& mask) +{ + TToken_string tipi_record("SU|TF|RF|SI|BR|VC"); + + //creazione del filename del file da importare + TFilename src_file = mask.get(F_PATH); + src_file.add(UPLOAD_FILE); + + THardy_upload_recordset recset(src_file); + const long items = recset.items(); + + //creazione progind e log + TProgind pi(items, TR("Acquisizione dati in corso..."), true, true); + TLog_report log("Segnalazioni su acquisizione"); + + //giro su tutti i record del terribile recordset per l'acquisizione dei dati + for (bool ok = recset.move_first(); ok; ok = recset.move_next()) + { + if (!pi.addstatus(1)) + break; + + //acquisizione tipo record da riga corrente del file di input + const TString& tipo_record = recset.get(0u).as_string(); + + const int pos = tipi_record.get_pos(tipo_record); + + //trattazione dei vari tracciati record + switch (pos) + { + case 0: //tipo record: SU (SetUp...ovvero agente) + elabora_SU(recset, log); + break; + case 1: //tipo record: TF (Testata Fattura) + break; + case 2: //tipo record: RF (Riga Fattura) + break; + case 3: //tipo record: SI (incasso documenti) + break; + case 4: //tipo record: BR (movimenti magazzino) + break; + case 5: //tipo record: VC (Variazioni Cliente) + break; + default: //se il tipo record non esiste nella lista dei tipi record si incazza e lo scrive! + { + TString msg; + msg << "Tipo record non riconosciuto " << tipo_record; + log.log_error(msg); + } + break; + } + + + + } //for (bool ok... +} + + +void TUpload2Campo::main_loop() +{ + TUpload2Campo_mask mask; + _intput_dir = mask.get(F_PATH); + while (mask.run() == K_ENTER) + { + elabora(mask); + } +} + +bool TUpload2Campo::create() +{ + return TSkeleton_application::create(); +} + +int ha1300(int argc, char* argv[]) +{ + TUpload2Campo a; + a.run(argc, argv, "Importazione dati da file"); + return 0; +} \ No newline at end of file diff --git a/ha/ha1300a.h b/ha/ha1300a.h new file mode 100755 index 000000000..625d883bf --- /dev/null +++ b/ha/ha1300a.h @@ -0,0 +1 @@ +#define F_PATH 201 \ No newline at end of file diff --git a/ha/ha1300a.uml b/ha/ha1300a.uml new file mode 100755 index 000000000..22c4becb2 --- /dev/null +++ b/ha/ha1300a.uml @@ -0,0 +1,19 @@ +#include "ha1300a.h" + +PAGE "Importazione dati da file upload" -1 -1 78 5 + +STRING F_PATH 256 45 +BEGIN + PROMPT 1 1 "Cartella file da importare " + FLAGS "D" +END + +ENDPAGE + +TOOLBAR "topbar" 0 0 0 2 + +#include + +ENDPAGE + +ENDMASK \ No newline at end of file