Patch level : 4.0 572

Files correlati     : cg7.exe cg7300a.ini cg7300a.msk
Ricompilazione Demo : [ ]
Commento            : prime prove su trasferimento sispac


git-svn-id: svn://10.65.10.50/trunk@14658 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2006-12-20 11:07:27 +00:00
parent 0aa5e6ac0b
commit 14a01dabc2
3 changed files with 57 additions and 91 deletions

View File

@ -71,32 +71,24 @@ bool TInvioS_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
class TInvioS : public TSkeleton_application class TInvioS : public TSkeleton_application
{ {
TCursor* _cur; TCursor* _cur;
TInvioS_mask* _msk; TInvioS_mask* _msk;
TInvioS_file* _trasfile; TInvioS_file* _trasfile;
long _nrecords, _nrecsfattvend, _nrecsfattacqu, _nrecsmocontab; TConfig* _configfile;
int _nfiles;
long _nrecsdettaglio;
TString16 _descrdettaglio;
TDate _dataini, _datafin; TDate _dataini, _datafin;
bool _totale, _finemov;
protected: protected:
virtual bool create(void); virtual bool create(void);
virtual bool destroy(void); virtual bool destroy(void);
virtual void main_loop() ; virtual void main_loop() ;
void invio_sispac(); void invio_sispac();
long i_sispac_clifor(const bool invio = TRUE); long i_sispac_clifor(const char* tipocf, const bool invio = TRUE);
long i_sispac_movcont(const bool invio = TRUE); long i_sispac_movcont(const bool invio = TRUE);
long i_sispac_moviva(const bool invio = TRUE); long i_sispac_moviva(const bool invio = TRUE);
public: public:
int get_nfiles() {return _nfiles;};
long get_nrecords() {return _nrecords;};
long get_nrecsdettaglio() {return _nrecsdettaglio;};
TString16& get_descrdettaglio() {return _descrdettaglio;};
const bool totale() {return _totale;};
const bool finemov() {return _finemov;};
TInvioS_file* apri_file(const char* nome); TInvioS_file* apri_file(const char* nome);
void chiudi_file(TInvioS_file* trasfile); void chiudi_file(TInvioS_file* trasfile);
TConfig& config() {return *_configfile;};
TInvioS() {} ; TInvioS() {} ;
virtual ~TInvioS() {} ; virtual ~TInvioS() {} ;
}; };
@ -126,16 +118,12 @@ void TInvioS_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TS
} }
else if (code == "_CODPAG") else if (code == "_CODPAG")
{ {
TFilename configname = "cg7300a.ini"; valore = app().config().get(str, "PAGAMENTI");
TConfig configfile(configname);
valore = configfile.get(str, "PAGAMENTI");
} }
else if (code == "_OPZIONI") else if (code == "_OPZIONI")
{ {
TString in(s.get()); TString in(s.get());
TFilename configname = "cg7300a.ini"; valore = app().config().get(in, "OPZIONI");
TConfig configfile(configname);
valore = configfile.get(in, "OPZIONI");
} }
else if (code == "_IMPORTO") else if (code == "_IMPORTO")
{ {
@ -206,7 +194,6 @@ TInvioS_file* TInvioS::apri_file(const char* nome)
filename.ext("txt"); filename.ext("txt");
if (filename.exist()) if (filename.exist())
remove(filename); remove(filename);
TInvioS_file* trasfile = new TInvioS_file(filename); TInvioS_file* trasfile = new TInvioS_file(filename);
trasfile->open(filename,'w'); trasfile->open(filename,'w');
trasfile->force_record_separator(); trasfile->force_record_separator();
@ -223,13 +210,16 @@ long TInvioS::i_sispac_movcont(const bool invio)
{ {
TRectype da(LF_MOV); TRectype da(LF_MOV);
TRectype a(LF_MOV); TRectype a(LF_MOV);
da.put(MOV_DATAREG, _dataini); TDate dataini = _msk->get_date(F_DATAINI);
a.put(MOV_DATAREG, _datafin); TDate datafin = _msk->get_date(F_DATAFIN);
if (dataini.ok())
da.put(MOV_DATAREG, dataini);
if (datafin.ok())
a.put(MOV_DATAREG, datafin);
TRelation rel(LF_MOV); TRelation rel(LF_MOV);
rel.add(LF_RMOV, "NUMREG==NUMREG", 1); rel.add(LF_RMOV, "NUMREG==NUMREG", 1);
rel.add(LF_CLIFO, "TIPOCF==TIPO|CODCF==CODCF", 1); rel.add(LF_CLIFO, "TIPOCF==TIPO|CODCF==CODCF", 1);
TCursor cur(&rel, "", 2, &da, &a); TCursor cur(&rel, "", 2, &da, &a);
const long cur_items = cur.items(); const long cur_items = cur.items();
if (cur_items != 0) if (cur_items != 0)
{ {
@ -303,14 +293,21 @@ long TInvioS::i_sispac_moviva(const bool invio)
return 0; return 0;
} }
long TInvioS::i_sispac_clifor(const bool invio) long TInvioS::i_sispac_clifor(const char* tipocf, const bool invio)
{ {
TInvioS_file* trasfile = apri_file("clifor.txt"); TString80 nomefile = "FILE";
nomefile << tipocf;
TInvioS_file* trasfilecf = apri_file(_configfile->get(nomefile, "OPZIONI"));
TRelation rel(LF_CLIFO); TRelation rel(LF_CLIFO);
rel.add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1); rel.add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1);
rel.add(LF_ANAGFIS,"CODANAGR==CODANAGPER", 1); rel.add(LF_ANAGFIS,"CODANAGR==CODANAGPER", 1);
rel.add(LF_ANAG,"TIPOA==TIPOPERS|CODANAGR==CODANAGPER", 1); rel.add(LF_ANAG,"TIPOA==TIPOPERS|CODANAGR==CODANAGPER", 1);
TString80 filtro;
filtro = "20->TIPOCF == \"";
filtro << tipocf;
filtro << "\"";
TCursor cur(&rel); TCursor cur(&rel);
cur.setfilter(filtro, TRUE);
const long cur_items = cur.items(); const long cur_items = cur.items();
if (cur_items != 0 && invio) if (cur_items != 0 && invio)
{ {
@ -319,80 +316,60 @@ long TInvioS::i_sispac_clifor(const bool invio)
for (cur = 0; cur.pos() < cur_items; ++(cur)) for (cur = 0; cur.pos() < cur_items; ++(cur))
{ {
TRecord_text rec; TRecord_text rec;
const char tipocf = cur.curr().get_char(CLI_TIPOCF); rec.set_type(tipocf);
if (tipocf == 'C') trasfilecf->autoload(rec, cur);
rec.set_type("C"); trasfilecf->write(rec);
else
rec.set_type("F");
trasfile->autoload(rec, cur);
trasfile->write(rec);
} }
} }
chiudi_file(trasfile); chiudi_file(trasfilecf);
return cur_items+cur_items; return 0;
} }
//metodone globale che chiama, come un menu, i vari sottometodi in base alle scelte sulla maschera //metodone globale che chiama, come un menu, i vari sottometodi in base alle scelte sulla maschera
void TInvioS::invio_sispac() void TInvioS::invio_sispac()
{ {
//prende i parametri dal file di configurazione dell'applicazione
TFilename configname = "cg7300a.ini";
TConfig configfile(configname);
//prepara il file su cui scrivere, ovvero il _trasfile
TFilename filename = _msk->get(F_DESTINAZIONE);
filename.add(configfile.get("FILEMOVIM", "OPZIONI"));
if (fexist(filename))
remove(filename);
_trasfile = new TInvioS_file(filename);
_trasfile->open(filename,'w');
if (_msk->get_bool(F_CLIFOR)) if (_msk->get_bool(F_CLIFOR))
i_sispac_clifor(); {
i_sispac_clifor("C");
i_sispac_clifor("F");
}
if (_msk->get_bool(F_MOVCONT)) if (_msk->get_bool(F_MOVCONT))
{ {
TString80 filename = _configfile->get("FILEM", "OPZIONI");
_trasfile = apri_file(filename);
i_sispac_movcont(); i_sispac_movcont();
i_sispac_moviva(); i_sispac_moviva();
chiudi_file(_trasfile);
} }
_trasfile->close();
delete _trasfile;
_trasfile = NULL;
} }
bool TInvioS::create() bool TInvioS::create()
{ {
_msk = new TInvioS_mask(); _msk = new TInvioS_mask();
_trasfile = NULL; TFilename configname = "cg7300a.ini";
configname.custom_path();
_configfile = new TConfig(configname);
return TSkeleton_application::create(); return TSkeleton_application::create();
} }
bool TInvioS::destroy() bool TInvioS::destroy()
{ {
if (_trasfile) delete _configfile;
delete _trasfile; delete _msk;
delete _msk;
return TSkeleton_application::destroy(); return TSkeleton_application::destroy();
} }
void TInvioS::main_loop() void TInvioS::main_loop()
{ {
TFilename configname = "cg7300a.ini"; _msk->set(F_NUMEROINVIO, _configfile->get_int("NUMEROINVIO","OPZIONI")+1);
configname.custom_path(); _msk->set(F_DATAINI, _configfile->get("DATA","OPZIONI"));
TConfig configfile(configname); _msk->set(F_DESTINAZIONE, _configfile->get("PERCORSO","OPZIONI"));
_msk->set(F_NUMEROINVIO, configfile.get_int("NUMEROINVIO","OPZIONI")+1);
_msk->set(F_DATAINI, configfile.get("DATA","OPZIONI"));
_msk->set(F_DESTINAZIONE, configfile.get("PERCORSO","OPZIONI"));
while (_msk->run() != K_QUIT) while (_msk->run() != K_QUIT)
{ {
_totale = false; _configfile->set("NUMEROINVIO", _msk->get(F_NUMEROINVIO),"OPZIONI");
_finemov = false; _configfile->set("DATA", _msk->get_date(F_DATAFIN),"OPZIONI");
configfile.set("NUMEROINVIO", _msk->get(F_NUMEROINVIO),"OPZIONI"); _configfile->set("PERCORSO", _msk->get(F_DESTINAZIONE),"OPZIONI");
configfile.set("DATA", _msk->get_date(F_DATAFIN),"OPZIONI"); _configfile->set_paragraph("PAGAMENTI");
configfile.set("PERCORSO", _msk->get(F_DESTINAZIONE),"OPZIONI");
configfile.set_paragraph("CAUSALI");
_dataini = _msk->get_date(F_DATAINI); _dataini = _msk->get_date(F_DATAINI);
_datafin = _msk->get_date(F_DATAFIN); _datafin = _msk->get_date(F_DATAFIN);
const char tipoinvio = _msk->get(F_TIPOINVIO)[0]; const char tipoinvio = _msk->get(F_TIPOINVIO)[0];

View File

@ -1,7 +1,8 @@
[OPZIONI] [OPZIONI]
DATA = DATA =
FILECLIFO = clifo.txt FILEC = cli.txt
FILEMOVIM = movim.txt FILEF = for.txt
FILEM = mov.txt
NUMEROINVIO = NUMEROINVIO =
PERCORSO = c:\temp\ PERCORSO = c:\temp\

View File

@ -23,58 +23,46 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
GROUPBOX DLG_NULL 76 6 GROUPBOX DLG_NULL 76 4
BEGIN BEGIN
PROMPT 2 4 "Dati da inviare" PROMPT 2 4 "Dati da inviare"
END END
BOOLEAN F_CLIFOR BOOLEAN F_CLIFOR
BEGIN BEGIN
PROMPT 3 7 "Clienti/Fornitori" PROMPT 3 5 "Clienti/Fornitori"
END END
BOOLEAN F_MOVCONT BOOLEAN F_MOVCONT
BEGIN BEGIN
PROMPT 3 8 "Movimenti" PROMPT 3 6 "Movimenti"
MESSAGE TRUE,ENABLE F_DATAFIN MESSAGE TRUE,ENABLE F_DATAFIN
END END
LISTBOX F_TIPOINVIO 20 LISTBOX F_TIPOINVIO 20
BEGIN BEGIN
PROMPT 2 10 "Invio a " PROMPT 2 8 "Invio a "
ITEM "S|Sispac/Cosmo" ITEM "S|Sispac/Cosmo"
END END
STRING F_DESTINAZIONE 20 STRING F_DESTINAZIONE 20
BEGIN BEGIN
PROMPT 2 11 "Destinazione " PROMPT 2 9 "Destinazione "
END END
NUMBER F_NUMEROINVIO 2 NUMBER F_NUMEROINVIO 2
BEGIN BEGIN
PROMPT 2 12 "Numero invio " PROMPT 2 10 "Numero invio "
END END
DATE F_DATAINI DATE F_DATAINI
BEGIN BEGIN
PROMPT 20 12 "Data iniz. " PROMPT 20 10 "Data iniz. "
END END
DATE F_DATAFIN DATE F_DATAFIN
BEGIN BEGIN
PROMPT 44 12 "Data fin. " PROMPT 44 10 "Data fin. "
END
BUTTON F_RIPRISTINA 20
BEGIN
PROMPT 2 14 "Annulla invio"
MESSAGE SHOW,F_DATARIPRISTINO|ENABLE,F_DATARIPRISTINO
END
DATE F_DATARIPRISTINO
BEGIN
PROMPT 25 14 "Annulla invio fino al "
FLAGS "HD"
END END
BUTTON DLG_OK 9 2 BUTTON DLG_OK 9 2