Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@19968 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2010-01-21 14:00:10 +00:00
parent fdd6ab5834
commit d823720761
2 changed files with 37 additions and 16 deletions

View File

@ -167,6 +167,7 @@ void TImporta_saldi::transfer(const TFilename& file)
TImporta_cogeco_recset s(file); TImporta_cogeco_recset s(file);
TProgind pi(s.items(),"Importazione saldi in corso ...",true,true); TProgind pi(s.items(),"Importazione saldi in corso ...",true,true);
TConfig * conf = NULL; TConfig * conf = NULL;
TFilename filename;
long ntran = 1L; long ntran = 1L;
int nrow = 1; int nrow = 1;
int anno = 0; int anno = 0;
@ -211,15 +212,22 @@ void TImporta_saldi::transfer(const TFilename& file)
{ {
if (conf != NULL) if (conf != NULL)
{ {
const bool null_mov = (nrow==1);
if (!null_mov)
set_rmov(*conf, nrow++, totmov, conto_ap); set_rmov(*conf, nrow++, totmov, conto_ap);
delete conf; delete conf;
conf = NULL; conf = NULL;
totmov.reset();
if (null_mov)
{
remove_file(filename);
ntran--;
}
} }
TFilename temp(outdir); filename = outdir;
temp.add(format("lv41%05ld.ini", ntran++)); filename.add(format("lv41%05ld.ini", ntran++));
conf = new TConfig(filename);
conf = new TConfig(temp);
conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
conf->set("Action","INSERT"); conf->set("Action","INSERT");
conf->set("Mode","AUTO"); conf->set("Mode","AUTO");
@ -248,8 +256,17 @@ void TImporta_saldi::transfer(const TFilename& file)
} }
if (conf != NULL) if (conf != NULL)
{ {
const bool null_mov = (nrow==1);
if (!null_mov)
set_rmov(*conf, nrow++, totmov, conto_ap); set_rmov(*conf, nrow++, totmov, conto_ap);
delete conf; delete conf;
conf = NULL;
totmov.reset();
if (null_mov)
{
remove_file(filename);
ntran--;
}
} }
if (yesno_box(FR("Si desidera confermare l'importazione di %ld movimenti"), ntran -1)) if (yesno_box(FR("Si desidera confermare l'importazione di %ld movimenti"), ntran -1))

View File

@ -40,7 +40,7 @@
#define CGC_VALORVEN 23 #define CGC_VALORVEN 23
#define CGC_DATAINIZAMM 24 #define CGC_DATAINIZAMM 24
#define CGC_DATAACCANTONAM 25 #define CGC_DATAACCANTONAM 25
#define CGC_DATAALIENENAZIONE 26 #define CGC_DATAALIENAZIONE 26
#define CGC_PERCDAAMM 27 #define CGC_PERCDAAMM 27
#define CGC_RIFERFATTVEN 28 #define CGC_RIFERFATTVEN 28
#define CGC_RIFERFATTACQ 29 #define CGC_RIFERFATTACQ 29
@ -180,16 +180,20 @@ void TImporta_cesp::transfer(const TFilename& file)
if (search_gr_sp_ca(gr, sp, ca)) if (search_gr_sp_ca(gr, sp, ca))
{ {
cespi.put(CESPI_CODCGR, gr); cespi.put(CESPI_CODCGRA, gr);
cespi.put(CESPI_CODSP, sp); cespi.put(CESPI_CODSPA, sp);
cespi.put(CESPI_CODCAT, ca); cespi.put(CESPI_CODCAT, ca);
cespi.put(CESPI_DESC, recset.get(CGC_DESCR).as_string()); cespi.put(CESPI_DESC, recset.get(CGC_DESCR).as_string());
if (TDate::isdate(recset.get(CGC_DATAINIZAMM).as_string()))
{
TDate data(recset.get(CGC_DATAINIZAMM).as_string()); TDate data(recset.get(CGC_DATAINIZAMM).as_string());
if (data.ok())
cespi.put(CESPI_DTFUNZ, data); cespi.put(CESPI_DTFUNZ, data);
data = TDate(recset.get(CGC_DATAALIENENAZIONE).as_string()); }
if (data.ok()) if (TDate::isdate(recset.get(CGC_DATAALIENAZIONE).as_string()))
{
TDate data(recset.get(CGC_DATAALIENAZIONE).as_string());
cespi.put(CESPI_DTALIEN, data); cespi.put(CESPI_DTALIEN, data);
}
cespi.put(CESPI_TPSPEMAN, 1); cespi.put(CESPI_TPSPEMAN, 1);
// creo record salce // creo record salce
@ -198,7 +202,7 @@ void TImporta_cesp::transfer(const TFilename& file)
salce.put(SALCE_CODES, lastesc); // verificare se ultimo esercizio va bene (2010?) salce.put(SALCE_CODES, lastesc); // verificare se ultimo esercizio va bene (2010?)
salce.put(SALCE_TPSALDO, 1); // verificare se saldo iniziale (1) va bene salce.put(SALCE_TPSALDO, 1); // verificare se saldo iniziale (1) va bene
salce.put(SALCE_NUMELE, 1); salce.put(SALCE_NUMELE, 1);
salce.put(SALCE_CSTO, recset.get(CGC_COSTOACQ).as_real()); salce.put(SALCE_CSTO, recset.get_real(CGC_COSTOACQ));
// creo record ammce // creo record ammce
ammce.zero(); ammce.zero();
@ -206,8 +210,8 @@ void TImporta_cesp::transfer(const TFilename& file)
ammce.put(AMMCE_CODES, salce.get(SALCE_CODES)); ammce.put(AMMCE_CODES, salce.get(SALCE_CODES));
ammce.put(AMMCE_TPSALDO, salce.get(SALCE_TPSALDO)); ammce.put(AMMCE_TPSALDO, salce.get(SALCE_TPSALDO));
ammce.put(AMMCE_TPAMM, 1); // verificare se tipo amm = 1 va bene ammce.put(AMMCE_TPAMM, 1); // verificare se tipo amm = 1 va bene
ammce.put(AMMCE_QNORP, recset.get(CGC_FONDOAMMORT).as_real()); ammce.put(AMMCE_QNORP, recset.get_real(CGC_FONDOAMMORT));
ammce.put(AMMCE_QANTP, recset.get(CGC_TOTAMMANTIC).as_real()); ammce.put(AMMCE_QANTP, recset.get_real(CGC_TOTAMMANTIC));
// scrivo i record dei cespiti // scrivo i record dei cespiti
int err = cespi.write(); int err = cespi.write();