Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@19894 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
271dbdf96a
commit
f5c157abf6
118
lv/lv4300.cpp
118
lv/lv4300.cpp
@ -1,6 +1,7 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
|
#include <reputils.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include "../ce/ammce.h"
|
#include "../ce/ammce.h"
|
||||||
@ -13,11 +14,6 @@
|
|||||||
#include "lv4100.h"
|
#include "lv4100.h"
|
||||||
#include "lv4300a.h"
|
#include "lv4300a.h"
|
||||||
|
|
||||||
#include <pconti.h>
|
|
||||||
#include <mov.h>
|
|
||||||
#include <rmov.h>
|
|
||||||
#include <rmoviva.h>
|
|
||||||
|
|
||||||
#define CGC_DITTA 0
|
#define CGC_DITTA 0
|
||||||
#define CGC_GRUPPO 1
|
#define CGC_GRUPPO 1
|
||||||
#define CGC_SPECIE 2
|
#define CGC_SPECIE 2
|
||||||
@ -120,6 +116,10 @@ class TImporta_cesp : public TSkeleton_application
|
|||||||
{
|
{
|
||||||
TImporta_cesp_mask* _msk;
|
TImporta_cesp_mask* _msk;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool log_error(TLog_report& log, const char* msg, const TRecordset& recset, const int err=NOERR);
|
||||||
|
bool search_gr_sp_ca(const int gruppo, const char* specie, const int categoria);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
@ -127,74 +127,110 @@ public:
|
|||||||
void transfer(const TFilename& file);
|
void transfer(const TFilename& file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool TImporta_cesp::search_gr_sp_ca(const int gruppo, const char* specie, const int categoria)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TImporta_cesp::log_error(TLog_report& log, const char* msg, const TRecordset& recset, const int err)
|
||||||
|
{
|
||||||
|
TString message;
|
||||||
|
message << TR("Riga") << ' ' << recset.current_row() << ": " << msg << err=NOERR ? " " : format("%d", err);
|
||||||
|
log.log(2, message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void TImporta_cesp::transfer(const TFilename& file)
|
void TImporta_cesp::transfer(const TFilename& file)
|
||||||
{
|
{
|
||||||
const TFilename outdir(_msk->get(F_PATHOUT));
|
TImporta_cogeco_recset recset(file);
|
||||||
TImporta_cogeco_recset s(file);
|
TString caption; _msk->get_caption(caption);
|
||||||
TProgind pi(s.items(),"Importazione cespiti in corso ...",true,true);
|
TProgind pi(recset.items(), caption, true, true);
|
||||||
const long ditta = _msk->get_long(F_CODITTA);
|
const long ditta = _msk->get_long(F_CODITTA);
|
||||||
const TEsercizi_contabili esc;
|
const TEsercizi_contabili esc;
|
||||||
int lastesc = esc.last();
|
int lastesc = esc.last();
|
||||||
long ntran = 1;
|
long ntran = 1;
|
||||||
|
TLog_report log(caption);
|
||||||
|
|
||||||
for (bool ok = s.move_to(1); ok ; ok = s.move_next())
|
for (bool ok = recset.move_to(1); ok ; ok = recset.move_next())
|
||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
if (!pi.addstatus(1))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const long dt = s.get(CGC_DITTA).as_int();
|
const long dt = recset.get(CGC_DITTA).as_int();
|
||||||
|
|
||||||
if (ditta != dt)
|
if (ditta != dt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const long codces = s.get(CGC_NPROGR).as_int();
|
const long codces = recset.get(CGC_NPROGR).as_int();
|
||||||
|
|
||||||
// verifico il codice cespite padre
|
// verifico il codice cespite padre
|
||||||
const long codpadre = s.get(CGC_CEINCR).as_int();
|
const long codpadre = recset.get(CGC_CEINCR).as_int();
|
||||||
//const long codpadre = s.get(CGC_CODPADRE); secondo me e' corretto questo! chiedere
|
//const long codpadre = recset.get(CGC_CODPADRE); secondo me e' corretto questo! chiedere
|
||||||
|
|
||||||
if (codpadre == ZERO) // nuovo cespite
|
if (codpadre == ZERO) // nuovo cespite
|
||||||
{
|
{
|
||||||
// creo record anagrafica cespi
|
// creo record anagrafica cespi
|
||||||
TLocalisamfile cespi(LF_CESPI);
|
TLocalisamfile cespi(LF_CESPI);
|
||||||
cespi.put(CESPI_IDCESPITE, format("%010ld", codces));
|
cespi.put(CESPI_IDCESPITE, format("%010ld", codces));
|
||||||
cespi.put(CESPI_CODCGR, s.get(CGC_GRUPPO).as_string());
|
const int gr = recset.get(CGC_GRUPPO).as_int();
|
||||||
cespi.put(CESPI_CODSP, s.get(CGC_SPECIE).as_string());
|
const char* sp = recset.get(CGC_SPECIE).as_string();
|
||||||
cespi.put(CESPI_CODCAT, s.get(CGC_CESPITE).as_string());
|
const int ca = recset.get(CGC_CESPITE).as_int();
|
||||||
cespi.put(CESPI_DESC, s.get(CGC_DESCR).as_string());
|
if (search_gr_sp_ca(gr, sp, ca))
|
||||||
cespi.put(CESPI_DTFUNZ, s.get(CGC_DATAINIZAMM).as_string());
|
{
|
||||||
cespi.put(CESPI_DTALIEN, s.get(CGC_DATAALIENENAZIONE).as_string());
|
cespi.put(CESPI_CODCGR, recset.get(CGC_GRUPPO).as_string());
|
||||||
cespi.put(CESPI_TPSPEMAN, 1);
|
cespi.put(CESPI_CODSP, recset.get(CGC_SPECIE).as_string());
|
||||||
|
cespi.put(CESPI_CODCAT, recset.get(CGC_CESPITE).as_string());
|
||||||
|
cespi.put(CESPI_DESC, recset.get(CGC_DESCR).as_string());
|
||||||
|
TDate data(recset.get(CGC_DATAINIZAMM).as_string());
|
||||||
|
if (data.ok())
|
||||||
|
cespi.put(CESPI_DTFUNZ, data);
|
||||||
|
data = TDate(recset.get(CGC_DATAALIENENAZIONE).as_string());
|
||||||
|
if (data.ok())
|
||||||
|
cespi.put(CESPI_DTALIEN, data);
|
||||||
|
cespi.put(CESPI_TPSPEMAN, 1);
|
||||||
|
|
||||||
// creo record salce
|
// creo record salce
|
||||||
TLocalisamfile salce(LF_SALCE);
|
TLocalisamfile salce(LF_SALCE);
|
||||||
salce.put(SALCE_IDCESPITE, cespi.get(CESPI_IDCESPITE));
|
salce.put(SALCE_IDCESPITE, cespi.get(CESPI_IDCESPITE));
|
||||||
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, s.get(CGC_COSTOACQ).as_string());
|
salce.put(SALCE_CSTO, recset.get(CGC_COSTOACQ).as_string());
|
||||||
|
|
||||||
// creo record ammce
|
// creo record ammce
|
||||||
TLocalisamfile ammce(LF_AMMCE);
|
TLocalisamfile ammce(LF_AMMCE);
|
||||||
ammce.put(AMMCE_IDCESPITE, salce.get(CESPI_IDCESPITE));
|
ammce.put(AMMCE_IDCESPITE, salce.get(CESPI_IDCESPITE));
|
||||||
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, s.get(CGC_FONDOAMMORT).as_real());
|
ammce.put(AMMCE_QNORP, recset.get(CGC_FONDOAMMORT).as_real());
|
||||||
ammce.put(AMMCE_QANTP, s.get(CGC_TOTAMMANTIC).as_real());
|
ammce.put(AMMCE_QANTP, recset.get(CGC_TOTAMMANTIC).as_real());
|
||||||
|
|
||||||
// scrivo i record dei cespiti
|
// scrivo i record dei cespiti
|
||||||
int err = cespi.write();
|
int err = cespi.write();
|
||||||
if (err == NOERR)
|
if (err != NOERR)
|
||||||
err = salce.write();
|
log_error(log, TR("Errore in scrittura anagrafica cespiti "), recset, err);
|
||||||
if (err == NOERR)
|
else
|
||||||
err = ammce.write();
|
{
|
||||||
|
err = salce.write();
|
||||||
|
if (err != NOERR)
|
||||||
|
log_error(log, TR("Errore in scrittura saldi cespiti "), recset, err);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = ammce.write();
|
||||||
|
if (err != NOERR)
|
||||||
|
log_error(log, TR("Errore in scrittura ammortamento cespiti "), recset, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// chiedere cosa fare perche' non ho capito cosa devo sommare!!
|
// chiedere cosa fare perche' non ho capito cosa devo sommare!!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (log.recordset()->items() > 0)
|
||||||
|
log.preview();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TImporta_cesp::create()
|
bool TImporta_cesp::create()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user