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
This commit is contained in:
parent
de3ebb3f29
commit
22ddbe22d7
136
ha/ha1300.cpp
Executable file
136
ha/ha1300.cpp
Executable file
@ -0,0 +1,136 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
#include <reputils.h>
|
||||
|
||||
#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;
|
||||
}
|
1
ha/ha1300a.h
Executable file
1
ha/ha1300a.h
Executable file
@ -0,0 +1 @@
|
||||
#define F_PATH 201
|
19
ha/ha1300a.uml
Executable file
19
ha/ha1300a.uml
Executable file
@ -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 <elabar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user