387 lines
11 KiB
C++
387 lines
11 KiB
C++
|
#include <applicat.h>
|
||
|
#include <automask.h>
|
||
|
#include <execp.h>
|
||
|
#include <lffiles.h>
|
||
|
#include <progind.h>
|
||
|
#include <real.h>
|
||
|
#include <recarray.h>
|
||
|
#include <reputils.h>
|
||
|
#include <utility.h>
|
||
|
#include <relation.h>
|
||
|
#include <reprint.h>
|
||
|
#include <textset.h>
|
||
|
#include <tabutil.h>
|
||
|
|
||
|
#include "../ce/ammce.h"
|
||
|
#include "../ce/cespi.h"
|
||
|
#include "../ce/salce.h"
|
||
|
|
||
|
#include "../cg/cglib01.h"
|
||
|
|
||
|
#include "lv4.h"
|
||
|
#include "lv4100.h"
|
||
|
#include "lv4300a.h"
|
||
|
|
||
|
#include <pconti.h>
|
||
|
#include <mov.h>
|
||
|
#include <rmov.h>
|
||
|
#include <rmoviva.h>
|
||
|
|
||
|
#define DITTA 0
|
||
|
#define GRUPPO 1
|
||
|
#define SPECIE 2
|
||
|
#define CESPITE 3
|
||
|
#define CODPADRE 4
|
||
|
#define CEINCR 5
|
||
|
#define NPROGR 6
|
||
|
#define DESCR 7
|
||
|
#define CEALIQ1 8
|
||
|
#define PERCAMMANTIC 9
|
||
|
#define COSTOACQ 10
|
||
|
#define COSTODAAMM 11
|
||
|
#define RIVALUTAZIONE 12
|
||
|
#define RETTIFICHE 13
|
||
|
#define FONDOAMMORT 14
|
||
|
#define TOTAMMANTIC 15
|
||
|
#define RIVALUTAMM 16
|
||
|
#define CEDIMRIVALUTAMM 17
|
||
|
#define AMMORTINDEDUCIBILE 18
|
||
|
#define CREDIMPOSTA 19
|
||
|
#define VENDCOSTOACQ 20
|
||
|
#define VENDFDOAMM 21
|
||
|
#define PLUSREINVEST 22
|
||
|
#define VALORVEN 23
|
||
|
#define DATAINIZAMM 24
|
||
|
#define DATAACCANTONAM 25
|
||
|
#define DATAALIENENAZIONE 26
|
||
|
#define PERCDAAMM 27
|
||
|
#define RIFERFATTVEN 28
|
||
|
#define RIFERFATTACQ 29
|
||
|
#define CODFOR 30
|
||
|
#define CEDITFIL 31
|
||
|
#define RIFERACQ 32
|
||
|
#define CODCLI 33
|
||
|
#define INAMMCOSTOES 34
|
||
|
#define IMMATERIALI 35
|
||
|
#define TIPOAMMORT 36
|
||
|
#define CESSIONE 37
|
||
|
#define RIFERVEN 38
|
||
|
#define CEMANRIP 39
|
||
|
#define PERCAMMSTD 40
|
||
|
#define NQUOTEANTCALC 41
|
||
|
#define NUMMOVCESP 42
|
||
|
#define VENDFDOANT 43
|
||
|
#define AMMDIPPADRE 44
|
||
|
|
||
|
///////////////////////////////////////////////////////////
|
||
|
// TAutomask
|
||
|
///////////////////////////////////////////////////////////
|
||
|
|
||
|
class TImporta_cesp_mask : public TAutomask
|
||
|
{
|
||
|
protected:
|
||
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||
|
|
||
|
public:
|
||
|
TImporta_cesp_mask();
|
||
|
};
|
||
|
|
||
|
TImporta_cesp_mask::TImporta_cesp_mask() :TAutomask ("lv4300a")
|
||
|
{
|
||
|
}
|
||
|
|
||
|
bool TImporta_cesp_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||
|
{
|
||
|
switch (f.dlg())
|
||
|
{
|
||
|
//giochetto per avere la lista dei files validi nella directory di trasferimento!
|
||
|
case F_NAME:
|
||
|
if (e == fe_button)
|
||
|
{
|
||
|
TArray_sheet as(-1, -1, 72, 20, TR("Selezione file"),
|
||
|
"File@32");
|
||
|
TFilename path = get(F_PATH);
|
||
|
path.add("*.txt"); //files delle testate
|
||
|
list_files(path, as.rows_array());
|
||
|
TFilename name;
|
||
|
FOR_EACH_ARRAY_ROW(as.rows_array(), i, row)
|
||
|
{
|
||
|
name = *row;
|
||
|
*row = name.name();
|
||
|
}
|
||
|
if (as.run() == K_ENTER)
|
||
|
{
|
||
|
f.set(as.row(as.selected()));
|
||
|
}
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
///////////////////////////////////////
|
||
|
// TSkeleton_application
|
||
|
///////////////////////////////////////
|
||
|
class TImporta_cesp : public TSkeleton_application
|
||
|
{
|
||
|
virtual bool check_autorization() const {return false;}
|
||
|
virtual const char * extra_modules() const {return "ve";}
|
||
|
|
||
|
TImporta_cesp_mask* _msk;
|
||
|
|
||
|
//protected:
|
||
|
|
||
|
|
||
|
public:
|
||
|
virtual bool create();
|
||
|
virtual bool destroy();
|
||
|
virtual void main_loop();
|
||
|
void transfer(const TFilename& file);
|
||
|
|
||
|
TImporta_cesp() {};
|
||
|
};
|
||
|
|
||
|
void TImporta_cesp::transfer(const TFilename& file)
|
||
|
{
|
||
|
TFilename outdir(_msk->get(F_PATHOUT));
|
||
|
TImporta_cogeco_recset s(file);
|
||
|
TProgind pi(s.items(),"Importazione cespiti in corso ...",true,true);
|
||
|
const long ditta = _msk->get_long(F_CODITTA);
|
||
|
long ntran = 1;
|
||
|
TString str(50);
|
||
|
const TEsercizi_contabili esc;
|
||
|
int lastes = esc.last();
|
||
|
|
||
|
for (bool ok = s.move_first(); ok ; ok = s.move_next())
|
||
|
{
|
||
|
if (!pi.addstatus(1))
|
||
|
break;
|
||
|
|
||
|
const long dt = s.get(DITTA).as_int();
|
||
|
|
||
|
if (ditta != dt)
|
||
|
continue;
|
||
|
|
||
|
TFilename temp(outdir);
|
||
|
|
||
|
temp << '/' << format("%05ld", ntran++);
|
||
|
temp.ext("ini");
|
||
|
if (fexist(temp))
|
||
|
remove_file(temp);
|
||
|
TConfig conf(temp);
|
||
|
conf.set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
|
||
|
conf.set("Action","INSERT");
|
||
|
conf.set("Mode","AUTO");
|
||
|
|
||
|
conf.set_paragraph("139"); // setto il paragrafo cespi
|
||
|
const long codces = s.get(NPROGR).as_int();
|
||
|
|
||
|
conf.set(CESPI_IDCESPITE, format("%010ld", codces));
|
||
|
conf.set(CESPI_CODCGR, s.get(GRUPPO).as_string());
|
||
|
conf.set(CESPI_CODSP, s.get(SPECIE).as_string());
|
||
|
conf.set(CESPI_CODCAT, s.get(CESPITE).as_string());
|
||
|
conf.set(CESPI_DESC, s.get(DESCR).as_string());
|
||
|
|
||
|
conf.set(CESPI_DTFUNZ, s.get(DATAINIZAMM).as_string());
|
||
|
conf.set(CESPI_DTALIEN, s.get(DATAALIENENAZIONE).as_string());
|
||
|
conf.set(CESPI_TPSPEMAN, 1);
|
||
|
|
||
|
/*
|
||
|
#define CESPI_CODCGRA "CODCGRA"
|
||
|
#define CESPI_CODSPA "CODSPA"
|
||
|
#define CESPI_CODIMP "CODIMP"
|
||
|
#define CESPI_CODLOC "CODLOC"
|
||
|
#define CESPI_CODORIG "CODORIG"
|
||
|
#define CESPI_DTCOMP "DTCOMP"
|
||
|
#define CESPI_AMMPROP "AMMPROP"
|
||
|
#define CESPI_ESCLPR "ESCLPR"
|
||
|
#define CESPI_TPSPEMAN "TPSPEMAN"
|
||
|
#define CESPI_USOPROM "USOPROM"
|
||
|
#define CESPI_LEASING "LEASING"
|
||
|
#define CESPI_TUIR "TUIR"
|
||
|
#define CESPI_USATO "USATO"
|
||
|
#define CESPI_ANNIRIC "ANNIRIC"
|
||
|
#define CESPI_PMAT "PMAT"
|
||
|
#define CESPI_PIMM "PIMM"
|
||
|
#define CESPI_VINCOLO "VINCOLO"
|
||
|
#define CESPI_PMINP "PMINP"
|
||
|
#define CESPI_PMAXP "PMAXP"
|
||
|
#define CESPI_CODVAL "CODVAL"
|
||
|
#define CESPI_FLGTPVEI "FLGTPVEI"
|
||
|
#define CESPI_VEIDIP "VEIDIP"
|
||
|
#define CESPI_STABILIM "STABILIM"
|
||
|
#define CESPI_REPARTO "REPARTO"
|
||
|
#define CESPI_IDIMP "IDIMP"
|
||
|
#define CESPI_PERCIMP "PERCIMP"
|
||
|
#define CESPI_FABBR06 "FABBR06"
|
||
|
|
||
|
#define CEALIQ1 8
|
||
|
#define PERCAMMANTIC 9
|
||
|
#define COSTODAAMM 11
|
||
|
#define RIVALUTAZIONE 12
|
||
|
#define RETTIFICHE 13
|
||
|
#define FONDOAMMORT 14
|
||
|
#define TOTAMMANTIC 15
|
||
|
#define RIVALUTAMM 16
|
||
|
#define CEDIMRIVALUTAMM 17
|
||
|
#define AMMORTINDEDUCIBILE 18
|
||
|
#define CREDIMPOSTA 19
|
||
|
#define VENDCOSTOACQ 20
|
||
|
#define VENDFDOAMM 21
|
||
|
#define PLUSREINVEST 22
|
||
|
#define VALORVEN 23
|
||
|
#define PERCDAAMM 27
|
||
|
#define RIFERFATTVEN 28
|
||
|
#define RIFERFATTACQ 29
|
||
|
#define CODFOR 30
|
||
|
#define CEDITFIL 31
|
||
|
#define RIFERACQ 32
|
||
|
#define CODCLI 33
|
||
|
#define INAMMCOSTOES 34
|
||
|
#define IMMATERIALI 35
|
||
|
#define TIPOAMMORT 36
|
||
|
#define CESSIONE 37
|
||
|
#define RIFERVEN 38
|
||
|
#define CEMANRIP 39
|
||
|
#define PERCAMMSTD 40
|
||
|
#define NQUOTEANTCALC 41
|
||
|
#define NUMMOVCESP 42
|
||
|
#define VENDFDOANT 43
|
||
|
#define AMMDIPPADRE 44
|
||
|
*/
|
||
|
conf.set_paragraph("143"); // setto il paragrafo del file salce
|
||
|
conf.set(SALCE_NUMELE, 1);
|
||
|
conf.set(SALCE_CSTO, s.get(COSTOACQ).as_string());
|
||
|
/*
|
||
|
#define SALCE_IDCESPITE "IDCESPITE"
|
||
|
#define SALCE_CODES "CODES"
|
||
|
#define SALCE_TPSALDO "TPSALDO"
|
||
|
#define SALCE_NUMELE "NUMELE"
|
||
|
#define SALCE_CSTO "CSTO"
|
||
|
#define SALCE_VNONAMM "VNONAMM"
|
||
|
#define SALCE_VNONAMM06 "VNONAMM06"
|
||
|
#define SALCE_VNONAMMC "VNONAMMC"
|
||
|
#define SALCE_PLUSREIN "PLUSREIN"
|
||
|
#define SALCE_RIV75 "RIV75"
|
||
|
#define SALCE_RIV83 "RIV83"
|
||
|
#define SALCE_RIV90 "RIV90"
|
||
|
#define SALCE_ANNIPOST90 "ANNIPOST90"
|
||
|
#define SALCE_ANNIPOST91 "ANNIPOST91"
|
||
|
#define SALCE_RIV91 "RIV91"
|
||
|
#define SALCE_RIVGF "RIVGF"
|
||
|
#define SALCE_RIVGC "RIVGC"
|
||
|
#define SALCE_VSPMANU "VSPMANU"
|
||
|
#define SALCE_ANNIAMM "ANNIAMM"
|
||
|
#define SALCE_DTSTBOLL "DTSTBOLL"
|
||
|
|
||
|
val = s.get(VLICAS).as_real() + s.get(VVICAS).as_real(); // civ
|
||
|
val = s.get(VLINAS2).as_real() + s.get(VAVIAS2).as_real(); // gest */
|
||
|
conf.set_paragraph("136"); // setto il paragrafo del file ammce
|
||
|
/*
|
||
|
#define AMMCE_IDCESPITE "IDCESPITE"
|
||
|
#define AMMCE_CODES "CODES"
|
||
|
#define AMMCE_TPSALDO "TPSALDO"
|
||
|
#define AMMCE_TPAMM "TPAMM"
|
||
|
#define AMMCE_SCELTE "SCELTE"
|
||
|
#define AMMCE_AMMRIT "AMMRIT"
|
||
|
#define AMMCE_CSCEN "CSCEN"
|
||
|
#define AMMCE_FZPER "FZPER"
|
||
|
#define AMMCE_PNOR "PNOR"
|
||
|
#define AMMCE_PACC "PACC"
|
||
|
#define AMMCE_PANT "PANT"
|
||
|
#define AMMCE_FZQUO "FZQUO"
|
||
|
#define AMMCE_QNOR "QNOR"
|
||
|
#define AMMCE_QACC "QACC"
|
||
|
#define AMMCE_QANT "QANT"
|
||
|
#define AMMCE_QPERSE "QPERSE"
|
||
|
#define AMMCE_FPRIVATO "FPRIVATO"
|
||
|
#define AMMCE_QPPRIVATE "QPPRIVATE"
|
||
|
#define AMMCE_QNORP "QNORP"
|
||
|
#define AMMCE_QACCP "QACCP"
|
||
|
#define AMMCE_QANTP "QANTP"
|
||
|
#define AMMCE_QPERSEP "QPERSEP"
|
||
|
#define AMMCE_FPRIVATOP "FPRIVATOP"
|
||
|
#define AMMCE_QPPRIVATEP "QPPRIVATEP"
|
||
|
#define AMMCE_MSG01 "MSG01"
|
||
|
#define AMMCE_MSG02 "MSG02"
|
||
|
#define AMMCE_MSG03 "MSG03"
|
||
|
#define AMMCE_MSG04 "MSG04"
|
||
|
#define AMMCE_MSG05 "MSG05"
|
||
|
#define AMMCE_MSGD05 "MSGD05"
|
||
|
#define AMMCE_MSG06 "MSG06"
|
||
|
#define AMMCE_FRINGEBEN "FRINGEBEN"
|
||
|
|
||
|
val = s.get(VAMNAS).as_real(); val amm norm fisc
|
||
|
val = s.get(PFANAS).as_real() + s.get(VAFNAS).as_real(); prog amm norm fisc
|
||
|
val = s.get(VAMAAS).as_real(); val amm ant fisc
|
||
|
val = s.get(PFAAAS).as_real() + s.get(VAFAAS).as_real(); prog amm ant fisc
|
||
|
val = s.get(VALFAS).as_real(); val amm acc fisc
|
||
|
|
||
|
val = s.get(VANCAS).as_real(); val amm norm civ
|
||
|
val = s.get(FANCAS).as_real() + s.get(VFNCAS).as_real(); prog amm norm civ
|
||
|
val = s.get(VAACAS).as_real(); val amm ant civ
|
||
|
val = s.get(FAACAS).as_real() + s.get(VFACAS).as_real(); prog amm ant civ
|
||
|
val = s.get(VALCAS).as_real(); val amm acc civ
|
||
|
|
||
|
val = s.get(VAMNAS2).as_real(); val amm norm gest
|
||
|
val = s.get(PFANAS2).as_real() + s.get(VAFNAS2).as_real(); prog amm norm gest
|
||
|
val = s.get(VAMAAS2).as_real(); val amm ant gest
|
||
|
val = s.get(PFAAAS2).as_real() + s.get(VAFAAS2).as_real(); prog amm ant gest
|
||
|
val = s.get(VALCAS).as_real(); val amm acc gest
|
||
|
??? conf.set(, s.get(VLICAS2 51 // Valore Iniziale Civil.2 DIZSMAS - VLIN
|
||
|
conf.set(, s.get(VVICAS2 52 // Variaz. Valore Iniz. Civ.2 DIZSMAS - VAVI
|
||
|
conf.set(, s.get(VANCAS2 53 // Valore Ammort.Normale Civ.2 DIZSMAS - VAMN
|
||
|
conf.set(, s.get(VAACAS2 54 // Valore Ammort.Anti.Civil.2 DIZSMAS - VAMA
|
||
|
conf.set(, s.get(FANCAS2 55 // Progr.Fondo Amm.Norm Civ.2 DIZSMAS - PFAN
|
||
|
*/
|
||
|
}
|
||
|
if (yesno_box(FR("Si desidera confermare l'importazione di %ld record di cespiti"), ntran - 1))
|
||
|
{
|
||
|
TString app;
|
||
|
|
||
|
app << "ce0 -4 -i" << outdir << "/*.ini";
|
||
|
TExternal_app primanota(app);
|
||
|
primanota.run(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
bool TImporta_cesp::create()
|
||
|
{
|
||
|
_msk = new TImporta_cesp_mask();
|
||
|
|
||
|
return TSkeleton_application::create();
|
||
|
}
|
||
|
|
||
|
bool TImporta_cesp::destroy()
|
||
|
{
|
||
|
delete _msk;
|
||
|
return TApplication::destroy();
|
||
|
}
|
||
|
|
||
|
void TImporta_cesp::main_loop()
|
||
|
{
|
||
|
KEY tasto;
|
||
|
tasto = _msk->run();
|
||
|
if (tasto == K_ENTER)
|
||
|
{
|
||
|
//genero il nome del file da caricare
|
||
|
TFilename name = _msk->get(F_PATH);
|
||
|
name.add(_msk->get(F_NAME));
|
||
|
transfer(name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
TImporta_cesp& app() { return (TImporta_cesp&) main_app(); }
|
||
|
|
||
|
|
||
|
int lv4300 (int argc, char* argv[])
|
||
|
{
|
||
|
TImporta_cesp main_app;
|
||
|
main_app.run(argc, argv, TR("Importazione cespiti"));
|
||
|
return true;
|
||
|
}
|