Patch level : 12.0 382

Files correlati     : tc3.exe tc3100a.msk

Importazione da Ericsoft

1 - possibilità di selezionare più file da importare)
2 - importare le anagrafiche partendo "dal basso" del file .txt
3 - attualmente il programma si chiude una volta eseguito il trasferimento. Deve invece rimanere sulla maschera di trasferimento

git-svn-id: svn://10.65.10.50/branches/R_10_00@23757 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-04-26 23:16:00 +00:00
parent 93354dec55
commit 143db44411
3 changed files with 81 additions and 43 deletions

View File

@ -466,14 +466,13 @@ void TImportaEricsoft::gest_localita(TString& comune, TString& cap, TString& cod
void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
{
char tipo = 'C';
TClifo_recset s(file);
TLocalisamfile clifo(LF_CLIFO);
TProgind pi(s.items(),"Importazione Clienti in corso...",true,true);
const bool aggclifor = !_msk->get_bool( F_NOAGGCLIFOR);
const bool reverseload = _msk->get_bool(F_REVLOAD);
for (bool ok=s.move_first();ok;ok=s.move_next())
for (bool ok= reverseload ? s.move_last() : s.move_first(); ok; reverseload ? ok = s.move_prev() : ok=s.move_next())
{
if (!pi.addstatus(1))
break;
@ -519,8 +518,8 @@ void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
found = clifo.read() == NOERR;
}
clifo.setkey(1);
if (!found)
if (!found || aggclifor)
{
clifo.put(CLI_TIPOCF, "F");
clifo.put(CLI_CODCF, cofi);
@ -542,7 +541,7 @@ void TImportaEricsoft::upload_cli(const TFilename& file, TLog_report& log)
TString80 comune = s.get(5).as_string(); //comune o localita'
TString prov = s.get(6).as_string();
TString codcom;
gest_localita(comune, cap, codcom, prov);
//se cap è pieno, allora inseriscilo
@ -849,7 +848,7 @@ void TImportaEricsoft::upload_mov(const TFilename& file, TLog_report& log)
clifo.setkey(6);
clifo.zero();
clifo.put(CLI_TIPOCF, "C");
clifo.put(CLI_TIPOCF, tipocf);
clifo.put(CLI_RICALT, key);
if (clifo.read() == NOERR)
codcf = clifo.get_long(CLI_CODCF);
@ -1015,7 +1014,7 @@ void TImportaEricsoft::upload_mov(const TFilename& file, TLog_report& log)
ini->set(MOV_CAMBIO, cambio.string());
}
}
/* else
else
if (nriga == 0 && tipocf.full())
{
ini->set_paragraph(format("%d,%d",LF_RMOV, ++nriga));
@ -1030,7 +1029,7 @@ void TImportaEricsoft::upload_mov(const TFilename& file, TLog_report& log)
ini->set(RMV_CONTO, conto);
ini->set(RMV_SOTTOCONTO, sottoconto);
ini->set(RMV_ROWTYPE, "T");
} */
}
}
if (numreg > 0L)
{
@ -1048,18 +1047,27 @@ bool TImportaEricsoft::transfer()
//prelevo il path dei file da caricare dalla maschera
TFilename path = _msk->get(F_PATH);
const short ids [] = {F_CLIFOR,F_MOV,0};
//eseguo tutte le importazioni (una alla volta)
for (int i = 0; ids[i]; i++)
TFilename name = _msk->get(F_CLIFOR);
if (name.full())
{
//prelevo di volta in volta il nome del file giusto dalla maschera:
//prima il file Anagrafiche, poi quello delle fatture e poi quello delle ricevute
TFilename name = _msk->get(ids[i]);
//se sono riuscito a prelevare un nome di file, allora:
if (name.full())
//costruisco il nome del file
TFilename full = path;
full.add(name);
//se eiste il file, esegui l'elaborazione corretta
if (full.exist())
upload_cli(full, log);
}
TSheet_field & sh = _msk->sfield(F_MOVSH);
const int items = sh.items();
for(int f = 0; f <items; f++)
{
name = sh.row(f).get(0);
if (name.full())
{
//costruisco il nome del file
TFilename full = path;
@ -1067,14 +1075,7 @@ bool TImportaEricsoft::transfer()
//se eiste il file, esegui l'elaborazione corretta
if (full.exist())
{
switch (i)
{
case 0: upload_cli(full, log); break;
case 1: upload_mov(full, log1); break;
default: break;
}
}
upload_mov(full, log1);
}
}
@ -1106,9 +1107,7 @@ bool TImportaEricsoft::destroy()
void TImportaEricsoft::main_loop()
{
KEY tasto;
tasto = _msk->run();
if (tasto == K_ENTER)
while (_msk->run() == K_ENTER)
if (transfer())
message_box(TR("Importazione completata"));
}

View File

@ -1,8 +1,13 @@
// campi della maschera tc3100a Importazione da Ericsoft
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_PATH 103
#define F_CLIFOR 104
#define F_MOV 105
#define F_VERBOSE 106
#define F_CODDITTA 201
#define F_RAGSOC 202
#define F_PATH 203
#define F_CLIFOR 204
#define F_MOVSH 205
#define F_VERBOSE 206
#define F_NOAGGCLIFOR 207
#define F_REVLOAD 208
#define F_MOV 101

View File

@ -47,7 +47,7 @@ BEGIN
//FIELD RAGSOC
END
GROUPBOX DLG_NULL 76 6
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 2 4 "@bSorgente"
END
@ -67,16 +67,50 @@ BEGIN
FIELD ReCFInFile
END
STRING F_MOV 18
SPREADSHEET F_MOVSH 50 6
BEGIN
PROMPT 3 7 "Movimenti "
FLAGS "B"
FIELD ReMovInFile
PROMPT 3 8 "Movimenti"
ITEM "File sorgente@50"
END
BOOLEAN F_VERBOSE
BEGIN
PROMPT 3 11 "Output Dettagliato"
PROMPT 3 16 "Output Dettagliato"
END
BOOLEAN F_NOAGGCLIFOR
BEGIN
PROMPT 3 18 "Non aggiornare le anagrafiche esistenti"
END
BOOLEAN F_REVLOAD
BEGIN
PROMPT 3 20 "Importa le anagrafiche a partire dall'ultima"
END
ENDPAGE
ENDMASK
PAGE "" -1 -1 80 11
STRING F_MOV 50
BEGIN
PROMPT 3 3 "File sorgente "
FLAGS "B"
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 "Conferma"
PICTURE TOOL_OK
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 "Fine"
MESSAGE EXIT,K_QUIT
PICTURE TOOL_QUIT
END
ENDPAGE