Patch level : 10.0 no patch
Files correlati :pi0001.exe Ricompilazione Demo : [ ] Commento : Conversione movimenti partite e cespiti GALILEO git-svn-id: svn://10.65.10.50/trunk@20062 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
01b0a1307c
commit
2db94d5fc0
@ -3,6 +3,8 @@
|
||||
#include <progind.h>
|
||||
#include <utility.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
#include <reputils.h>
|
||||
#include <textset.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
@ -75,6 +77,7 @@
|
||||
#define FL10PA 28 // Flag Generico DIZSMAS - FLAG
|
||||
#define CAMBPA2 29 // Cambio EURO DIZSMAS - CAME
|
||||
#define IMPOPA2 30 // Importo val 2 DIZSMAS - IMPO
|
||||
#define TIPOCF 31 // Creato da Roberto
|
||||
|
||||
|
||||
TObject* TCausali_cache::key2obj(const char* key)
|
||||
@ -174,19 +177,20 @@ bool build_rec(const TRelation& rel, void* pJolly)
|
||||
|
||||
TTable * gmm = (TTable * ) pJolly;
|
||||
long nmov = rel.lfile().get_long(MOV_NUMREG);
|
||||
TString key = rel.lfile().get(MOV_DESCR);
|
||||
int p = key.find("Part. ");
|
||||
TString part = rel.lfile().get(MOV_DESCR);
|
||||
int p = part.find("Part. ");
|
||||
|
||||
if (p >= 0)
|
||||
{
|
||||
p += 6;
|
||||
|
||||
const int p1 = key.find(" ", p);
|
||||
const int p1 = part.find(" ", p);
|
||||
|
||||
gmm->zero();
|
||||
if (p1 > p)
|
||||
key.cut(p1);
|
||||
key = key.mid(p);
|
||||
part.cut(p1);
|
||||
TString key(rel.lfile().get(MOV_TIPO));
|
||||
key << ',' << rel.lfile().get(MOV_CODCF) << ',' << part.mid(p);
|
||||
gmm->put("CODTAB", key);
|
||||
gmm->put("I0", nmov);
|
||||
gmm->write_rewrite();
|
||||
@ -199,7 +203,7 @@ void TImporta_sc::build_table()
|
||||
TTable gmm("GMM");
|
||||
TCursor mov(new TRelation(LF_MOV));
|
||||
|
||||
if (gmm.items() != mov.items())
|
||||
if (gmm.items() == 0)
|
||||
mov.scan(build_rec, &gmm, "Costruzione tabella di correlazione movimenti");
|
||||
}
|
||||
|
||||
@ -217,6 +221,7 @@ void TImporta_sc::transfer(const TFilename& file)
|
||||
TPartita * game = NULL;
|
||||
long nreg;
|
||||
TCausali_cache cache_causali;
|
||||
TLog_report log("Importazione partite");
|
||||
|
||||
build_table();
|
||||
for (bool ok=s.move_first();ok;ok=s.move_next())
|
||||
@ -227,18 +232,32 @@ void TImporta_sc::transfer(const TFilename& file)
|
||||
const int a = s.get(AAOPPA).as_int();
|
||||
const long p = s.get(NPARPA).as_int();
|
||||
|
||||
if (a == 0)
|
||||
continue;
|
||||
|
||||
if (anno != a || p != part )
|
||||
{
|
||||
anno = a;
|
||||
part = p;
|
||||
|
||||
TToken_string key(25, ',');
|
||||
const TString tipocf = s.get(TIPOCF).as_string();
|
||||
const long codcf = atol(s.get(CONTPA).as_string().mid(4));
|
||||
|
||||
key.add(tipocf);
|
||||
key.add(codcf);
|
||||
key.add(part);
|
||||
key.add(anno);
|
||||
|
||||
nreg = cache().get("GMM", key).get_long("I0");
|
||||
|
||||
if (nreg == 0)
|
||||
{
|
||||
const TString msg = format("Partita %s non trovata nei movimenti", (const char *) key);
|
||||
|
||||
log.log(0, msg);
|
||||
continue;
|
||||
}
|
||||
if (game != NULL)
|
||||
{
|
||||
game->write();
|
||||
@ -291,14 +310,14 @@ void TImporta_sc::transfer(const TFilename& file)
|
||||
|
||||
TImporto importo(sign < 0 ? 'A' : 'D', abs(residuo));
|
||||
importo.normalize(c.sezione(1));
|
||||
partita.add(PART_IMPTOTDOC, sign * importo.valore());
|
||||
partita.put(PART_IMPORTO, sign * importo.valore());
|
||||
partita.add(PART_IMPTOTDOC, importo.valore());
|
||||
partita.put(PART_IMPORTO, importo.valore());
|
||||
|
||||
TRiga_scadenze& scadenza = partita.new_row();
|
||||
|
||||
scadenza.put(SCAD_CODPAG, codpag);
|
||||
scadenza.put(SCAD_DATASCAD, s.get(DTSCPA).as_string());
|
||||
scadenza.put(SCAD_IMPORTO, sign * importo.valore());
|
||||
scadenza.put(SCAD_IMPORTO, importo.valore());
|
||||
scadenza.put(SCAD_TIPOPAG, partita.get(PART_TIPOPAG));
|
||||
}
|
||||
}
|
||||
@ -307,7 +326,9 @@ void TImporta_sc::transfer(const TFilename& file)
|
||||
game->write();
|
||||
delete game;
|
||||
}
|
||||
|
||||
TReport_book b;
|
||||
b.add(log);
|
||||
b.print_or_preview();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user