Patch level : 10.0 no patch

Files correlati     :pe0001.exe
Ricompilazione Demo : [ ]
Commento            :

Conversione movimenti partite e cespiti GALILEO


git-svn-id: svn://10.65.10.50/trunk@19857 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-01-03 20:31:09 +00:00
parent efbe3bc066
commit d54d44ed34
7 changed files with 501 additions and 637 deletions

View File

@ -158,7 +158,7 @@ bool TImporta_mov_mask::on_field_event(TOperable_field& f, TField_event e, long
class TImporta_mov : public TSkeleton_application class TImporta_mov : public TSkeleton_application
{ {
virtual bool check_autorization() const {return false;} virtual bool check_autorization() const {return false;}
virtual const char * extra_modules() const {return "ve";} virtual const char * extra_modules() const {return "ba";}
TImporta_mov_mask* _msk; TImporta_mov_mask* _msk;
@ -249,6 +249,7 @@ void TImporta_mov::transfer(const TFilename& file)
TString4 gruppo; TString4 gruppo;
TString4 conto; TString4 conto;
TString8 sottoconto; TString8 sottoconto;
TString descr(50);
const int codes = _msk->get_int(F_ANNOES); const int codes = _msk->get_int(F_ANNOES);
const long ditta = _msk->get_long(F_CODITTA); const long ditta = _msk->get_long(F_CODITTA);
const TEsercizi_contabili esc; const TEsercizi_contabili esc;
@ -286,6 +287,7 @@ void TImporta_mov::transfer(const TFilename& file)
dataop = d; dataop = d;
nmov = n; nmov = n;
if (conf != NULL) if (conf != NULL)
delete conf; delete conf;
conf = NULL; conf = NULL;
@ -321,12 +323,21 @@ void TImporta_mov::transfer(const TFilename& file)
conf->set(MOV_NUMDOC, ndoc); conf->set(MOV_NUMDOC, ndoc);
conf->set(MOV_STAMPATO, "X"); conf->set(MOV_STAMPATO, "X");
conf->set(MOV_REGST, "X"); conf->set(MOV_REGST, "X");
descr == s.get(DSUPCM).as_string();
iva = s.get(TPMVCM).as_string() == "I"; iva = s.get(TPMVCM).as_string() == "I";
if (iva) if (iva)
{ {
TToken_string key(25, ',');
key.add(s.get(NPARCM).as_int());
key.add(s.get(AAOPCM).as_int());
descr << " Part. " << key;
conf->set(MOV_REG, s.get(TPGICM).as_string()); conf->set(MOV_REG, s.get(TPGICM).as_string());
conf->set(MOV_PROTIVA, n); conf->set(MOV_PROTIVA, n);
} }
conf->set(MOV_DESCR, descr);
nrigac = 1; nrigac = 1;
rows.destroy(); rows.destroy();
impcg.destroy(); impcg.destroy();

View File

@ -13,6 +13,9 @@
#include <tabutil.h> #include <tabutil.h>
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#include "../cg/cg2103.h"
#include "../cg/cgsaldac.h"
#include "../cg/cgpagame.h"
#include "pe0001.h" #include "pe0001.h"
#include "pe0001200a.h" #include "pe0001200a.h"
@ -22,61 +25,88 @@
#include <rmov.h> #include <rmov.h>
#include <rmoviva.h> #include <rmoviva.h>
#define AT01CM 0 // Record attivo/sospeso/annullato DIZSMAS - ATTI // Tracciato File: FGA5DAT/CGSCA00F - CGSCA : Scadenze INDEX 9/12/09 17:43:05 Pag. 1
#define DT01CM 1 // Data stampa per G.Gen.le DIZSMAS - DATS #define TR01CD 0 // A=Att./Sosp./Ann/Estr.ant.ft DIZSMAS - ATTI
#define NR01CM 2 // Numero azione di aggiornamento DIZSMAS - NRAZ #define DT01CD 1 // Data ult.manut. DIZSMAS - DATS
#define TPMVCM 3 // Flag IVA I=IVA =no IVA DIZSMAS - TPMV #define NR01CD 2 // Numero azione di aggiornamento DIZSMAS - NRAZ
#define CDDTCM 4 // Codice Ditta DIZSMAS - CDDT #define CDDTCD 3 // Codice Ditta DIZSMAS - CDDT
#define AAPRCM 5 // Anno Operazione DIZSMAS - AAPR #define AAPRCD 4 // Anno Operazione DIZSMAS - AAPR Key 1
#define ANNPCM 6 // Anno Reg.DA GESTIRE DIZSMAS - ANNP #define ANNPCD 5 // Anno Reg.DA GESTIRE DIZSMAS - ANNP
#define TPGICM 7 // Giornale IVA TB=GI DIZSMAS - TPGI #define TPGICD 6 // Giornale IVA TB=GI DIZSMAS - TPGI Key 2
#define DTOPCM 8 // Data operazione DIZSMAS - DATS #define DTOPCD 7 // Data operazione DIZSMAS - DATS Key 3
#define NONPCM 9 // Nr. Operaz./Nr. Prot. DIZSMAS - NONP #define NONPCD 8 // Nr. Operaz./Nr. Prot. DIZSMAS - NONP Key 4
#define NRRGCM 10 // Numero Riga 2 DIZSMAS - NRR2 #define NRRGCD 9 // Numero Riga 2 DIZSMAS - NRR2 Key 5
#define NRGICM 11 // Nr Riga Giornale DIZSMAS - NRGI #define PROGCD 10 // Progressivo DIZSMAS - PROG Key 6
#define CONTCM 12 // Gr. Conto Sottoconto DIZSMAS - CONT #define IMPOCD 11 // Importo "-"=Avere DIZSMAS - IMPO
#define DIVICM 13 // Divisione TB=DI DIZSMAS - DIVI #define CDVACD 12 // Codice Valuta TB=VA DIZSMAS - CDVA
#define NPARCM 14 // Nr Partita DIZSMAS - NPAR #define CAMBCD 13 // Cambio DIZSMAS - CAMB
#define AAOPCM 15 // Anno partita DIZSMAS - ANNO #define IMVACD 14 // Importo Valuta DIZSMAS - IMVA
#define DTRGCM 16 // Data registrazione DIZSMAS - DATS #define SCADCD 15 // Data scadenza DIZSMAS - DATS
#define CAUSCM 17 // Causale TB=CA DIZSMAS - CAUS #define TIPOCD 16 // Tipo Effetto DIZSMAS - TIPO
#define DSUPCM 18 // Descrizione Supplementare DIZSMAS - DSUP #define GEINCD 17 // * = Generato RCD su Insoluti DIZSMAS - FLAG
#define IMPOCM 19 // Importo "-"=Avere DIZSMAS - IMPO #define CAMBCD2 18 // Cambio EURO DIZSMAS - CAME
#define CDVACM 20 // Codice Valuta TB=VA DIZSMAS - CDVA #define IMVACD2 19 // Importo val2 DIZSMAS - IMPO
#define CAMBCM 21 // Cambio DIZSMAS - CAMB
#define IMVACM 22 // Importo Valuta DIZSMAS - IMVA // Tracciato File: FGA5DAT/CGSPA00F - CGSPA : Scadenze partite aperte 9/12/09 17:43:12 Pag. 1
#define CDPGCM 23 // Codice di Pagamento TB=CP DIZSMAS - CDPG #define AT01PA 0 // Tipo provvisorio DIZSMAS - ATTI
#define DT1SCM 24 // Data I^ scadenza DIZSMAS - DATS #define CONTPA 1 // Gr. Conto Sottoconto DIZSMAS - CONT1
#define DTDOCM 25 // Data documento DIZSMAS - DATS #define DIVIPA 2 // Divisione TB=DI DIZSMAS - DIVI
#define NRDOCM 26 // N° Documento DIZSMAS - NUDO #define AAOPPA 3 // Anno partita DIZSMAS - ANNO
#define CCTPCM 27 // Centri Costo Tipico TB=CC DIZSMAS - CCTP #define NPARPA 4 // Nr Partita DIZSMAS - NPAR
#define NCOMCM 28 // Numero Commessa DIZSMAS - NCOM #define NONPPA 5 // Nr. Operaz./Nr. Prot. DIZSMAS - NONP
#define CDSCCM 29 // Codice Sottocommessa DIZSMAS - CDSC #define DTRGPA 6 // Data registrazione DIZSMAS - DATS
#define INDECM 30 // Indetraibilità % DIZSMAS - INDE #define IMPOPA 7 // Importo "-"=Avere DIZSMAS - IMPO
#define CDIVCM 31 // Codice IVA DIZSMAS - CDIV #define CDVAPA 8 // Codice Valuta TB=VA DIZSMAS - CDVA
#define IMPSCM 32 // Imposta DIZSMAS - IMPS #define CAMBPA 9 // Cambio DIZSMAS - CAMB
#define CDAGCM 33 // Codice Agente DIZSMAS - CDAG #define IMVAPA 10 // Importo Valuta DIZSMAS - IMVA
#define DTVBCM 34 // Data Liquidazione Iva Sospesa DIZSMAS - DATS #define DTSCPA 11 // Data scadenza DIZSMAS - DATS
#define FLSBCM 35 // Flag *=Stampato Bollato DIZSMAS - FLSB #define DTDOPA 12 // Data documento DIZSMAS - DATS
#define FSBICM 36 // Flag *=Stampato Boll.IVA DIZSMAS - FSBI #define NRDOPA 13 // N° Documento DIZSMAS - NUDO
#define FLVZCM 37 // V=Var.S=Storno P=Liq.prec. E=Esig.Sosp. DIZSMAS - FLVZ #define CDRAPA 14 // Codice rata Tab.ET DIZSMAS - TIPO
#define FLIICM 38 // Flag IVA Irrecup. " "=I irr. DIZSMAS - FLII #define TIPOPA 15 // Tipo Effetto DIZSMAS - TIPO
#define FLTSCM 39 // Flag Tipo Sollecito DIZSMAS - FLTS #define DSTIPA 16 // Descr.tipo rata -
#define FLEPCM 40 // *=Est.EP Non è più usato DIZSMAS - FLEP #define NREFPA 17 // Nr.effetto attivo DIZSMAS - NREF
#define DPERCM 41 // Dati Personalizzabili DIZSMAS - DPER #define NREPPA 18 // Nr.effetto passivo DIZSMAS - NREF
#define CONSCM 42 // Gr.Co.Sottoc.Sostitutivo DIZSMAS - CONS #define FL01PA 19 // Flag Generico DIZSMAS - FLAG
#define DTSTCM 43 // Nr.progr. rateo/risconto - #define FL02PA 20 // Flag Generico DIZSMAS - FLAG
#define USERCM 44 // Utente DIZSMAS - NOMU #define FL03PA 21 // Flag Generico DIZSMAS - FLAG
#define DTUMCM 45 // Data ultima manutenzione DIZSMAS - DATS #define FL04PA 22 // Flag Generico DIZSMAS - FLAG
#define TPUMCM 46 // Tipo ultima manutenzione DIZSMAS - FLAG #define FL05PA 23 // Flag Generico DIZSMAS - FLAG
#define FL01CM 47 // Flag Generico DIZSMAS - FLAG #define FL06PA 24 // Flag Generico DIZSMAS - FLAG
#define FL02CM 48 // Flag Generico DIZSMAS - FLAG #define FL07PA 25 // Flag Generico DIZSMAS - FLAG
#define FL03CM 49 // Flag Generico DIZSMAS - FLAG #define FL08PA 26 // Flag Generico DIZSMAS - FLAG
#define FL04CM 50 // Flag Generico DIZSMAS - FLAG #define FL09PA 27 // Flag Generico DIZSMAS - FLAG
#define FL05CM 51 // Flag Generico DIZSMAS - FLAG #define FL10PA 28 // Flag Generico DIZSMAS - FLAG
#define CMBECM 52 // Cambio EURO DIZSMAS - CAME #define CAMBPA2 29 // Cambio EURO DIZSMAS - CAME
#define IMVACM2 53 // Importo Val 2 DIZSMAS - IMPO #define IMPOPA2 30 // Importo val 2 DIZSMAS - IMPO
#define IMPSCM2 54 // Imposta 2 DIZSMAS - IMPS
class TCausali_cache : public TCache
{
protected:
virtual TObject* key2obj(const char* key);
public:
const TCausale& causale(const char* codice, int annoiva);
};
TObject* TCausali_cache::key2obj(const char* key)
{
// Metodo bastardo per evitare TToken_string temporanee "a randa"
// sfrutto chiave a lunghezza fissa
const int anno = atoi(key);
const char* codice = key+5;
TCausale* pcaus = new TCausale(codice, anno);
return pcaus;
}
const TCausale& TCausali_cache::causale(const char* codice, int annoiva)
{
// Metodo bastardo per evitare TToken_string temporanee "a randa"
// creo chiave a lunghezza fissa anno+codice = 9999|AAA
TString8 key;
key.format("%04d|%s", annoiva, codice);
return *(const TCausale*)objptr(key);
}
class TImporta_sc_recset : public TCSV_recordset class TImporta_sc_recset : public TCSV_recordset
{ {
@ -158,7 +188,7 @@ bool TImporta_sc_mask::on_field_event(TOperable_field& f, TField_event e, long j
class TImporta_sc : public TSkeleton_application class TImporta_sc : public TSkeleton_application
{ {
virtual bool check_autorization() const {return false;} virtual bool check_autorization() const {return false;}
virtual const char * extra_modules() const {return "ve";} virtual const char * extra_modules() const {return "ba";}
TImporta_sc_mask* _msk; TImporta_sc_mask* _msk;
@ -169,288 +199,152 @@ public:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual void main_loop(); virtual void main_loop();
void build_IVA(TConfig & conf, TArray & rows, TString_array & concg, TArray & impcg); void build_table();
void transfer(const TFilename& file); void transfer(const TFilename& file);
TImporta_sc() {}; TImporta_sc() {};
}; };
void TImporta_sc::build_IVA(TConfig & conf, TArray & rows, TString_array & concg, TArray & impcg) bool build_rec(const TRelation& rel, void* pJolly)
{ {
const int items = rows.items(); CHECK(pJolly != NULL, "Null Table");
TString paragraph;
if (items > 0) TTable * gmm = (TTable * ) pJolly;
long nmov = rel.lfile().get_long(MOV_NUMREG);
TString key = rel.lfile().get(MOV_DESCR);
int p = key.find("Part. ");
if (p >= 0)
{ {
int nrigai = 1; p += 6;
int i = 0;
TString *gcs = (TString *)concg.first_item();
real imptot = *((real *) impcg.first_item());
TString4 gruppo = gcs->left(2);
TString4 conto = gcs->mid(2, 2);
TString8 sottoconto = gcs->right(6);
while (i < items) const int p1 = key.find(" ", p);
{
TRectype & rec = (TRectype &)rows[i]; gmm->zero();
real imp = rec.get(RMI_IMPONIBILE); key.cut(p1);
real iva = rec.get(RMI_IMPOSTA); key = key.mid(p);
if (imp <= imptot) gmm->put("CODTAB", key);
i++; gmm->put("I0", nmov);
else gmm->write_rewrite();
{
TCodiceIVA codiva(rec.get(RMI_CODIVA));
imp -= imptot;
rec.put(RMI_IMPONIBILE, imp);
imp = imptot;
real iv = codiva.imposta(imptot);
iva -= iv;
rec.put(RMI_IMPOSTA, iva);
iva = iv;
}
imptot -= imp;
paragraph.format("%d,%d",LF_RMOVIVA,nrigai++);
conf.set_paragraph(paragraph);
conf.set(RMI_CODIVA, rec.get(RMI_CODIVA));
conf.set(RMI_TIPODET, rec.get(RMI_TIPODET));
conf.set(RMI_IMPONIBILE, imp.string());
conf.set(RMI_IMPOSTA, iva.string());
conf.set(RMI_GRUPPO, gruppo);
conf.set(RMI_CONTO, conto);
conf.set(RMI_SOTTOCONTO, sottoconto);
if (imptot <= 0)
{
gcs = (TString *)concg.succ_item();
if (gcs == NULL)
break;
imptot = *((real *) impcg.succ_item());
gruppo = gcs->left(2);
conto = gcs->mid(2, 2);
sottoconto = gcs->right(6);
}
}
} }
return true;
}
void TImporta_sc::build_table()
{
TTable gmm("GMM");
TCursor mov(new TRelation(LF_MOV));
if (gmm.items() != mov.items())
mov.scan(build_rec, &gmm, "Costruzione tabella di correlazione movimenti");
} }
void TImporta_sc::transfer(const TFilename& file) void TImporta_sc::transfer(const TFilename& file)
{ {
TFilename outdir(_msk->get(F_PATHOUT));
TImporta_sc_recset s(file); TImporta_sc_recset s(file);
TProgind pi(s.items(),"Importazione saldaconto in corso ...",true,true); TProgind pi(s.items(),"Importazione saldaconto in corso ...",true,true);
TConfig * conf = NULL; TConfig * conf = NULL;
long nmov = - 1;
int anno = 0; int anno = 0;
TString8 reg; int part;
TDate dataop;
int nrigac = 1;
long ntran = 1L;
bool iva = false;
TString4 gruppo; TString4 gruppo;
TString4 conto; TString4 conto;
TString8 sottoconto; TString8 sottoconto;
const int codes = _msk->get_int(F_ANNOES); TString descr(50);
const long ditta = _msk->get_long(F_CODITTA); TPartita * game;
const TEsercizi_contabili esc; long nreg;
TArray rows; TCausali_cache cache_causali;
TArray impcg;
TString_array concg;
for (bool ok=s.move_first();ok;ok=s.move_next()) for (bool ok=s.move_first();ok;ok=s.move_next())
{ {
if (!pi.addstatus(1)) if (!pi.addstatus(1))
break; break;
const long dt = s.get(CDDTCM).as_int(); const int a = s.get(AAOPPA).as_int();
const long p = s.get(NPARPA).as_int();
if (ditta != dt) if (anno != a || p != part )
continue;
const TDate datareg(s.get(DTRGCM).as_int());
if (datareg.year() == 2009)
int i = 1;
const int es = esc.date2esc(datareg);
if (codes != es)
continue;
const int a = s.get(AAPRCM).as_int();
const TString8 r = s.get(TPGICM).as_string();
const TDate d(s.get(DTOPCM).as_int());
const long n = s.get(NONPCM).as_int();
if (anno != a || reg != r || dataop != d || n != nmov )
{ {
if (iva && conf != NULL)
build_IVA(*conf, rows, concg, impcg);
anno = a; anno = a;
reg = r; part = p;
dataop = d;
nmov = n;
if (conf != NULL) const TString8 reg = s.get(DIVIPA).as_string();
delete conf; const TDate dataop(s.get(DTRGPA).as_int());
conf = NULL; const long nmov = s.get(NONPPA).as_int();
TFilename temp(outdir); TToken_string key(25, ',');
temp << '/' << format("%05ld", ntran++); key.add(anno);
temp.ext("ini"); key.add(reg);
if (fexist(temp)) key.add(dataop.string());
remove_file(temp); key.add(nmov);
conf = new TConfig(temp);
conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
conf->set("Action","INSERT");
conf->set("Mode","AUTO");
conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata) nreg = cache().get("GMM", key).get_long("I0");
TString8 codcaus = s.get(CAUSCM).as_string();
if (atoi(codcaus) != 0)
codcaus << '0';
conf->set(MOV_CODCAUS, codcaus);
conf->set(MOV_DATAREG, datareg.string());
const int codpag = s.get(CDPGCM).as_int();
if (codpag != 0)
conf->set(MOV_CODPAG, format("%03d", codpag));
TDate datadoc(s.get(DTDOCM).as_int());
conf->set(MOV_DATADOC, datadoc.string());
TString16 ndoc = s.get(NRDOCM).as_string(); if (game != NULL)
if (ndoc == "0")
ndoc.cut(0);
conf->set(MOV_NUMDOC, ndoc);
conf->set(MOV_STAMPATO, "X");
conf->set(MOV_REGST, "X");
iva = s.get(TPMVCM).as_string() == "I";
if (iva)
{ {
conf->set(MOV_REG, s.get(TPGICM).as_string()); game->write();
conf->set(MOV_PROTIVA, n); delete game;
} }
nrigac = 1; game = NULL;
rows.destroy();
impcg.destroy();
concg.destroy();
} }
const TString gcs = s.get(CONTCM).as_string();
TString4 sez("D");
if (gcs.full()) TToken_string keymov;
{
TString8 paragraph;
real importo = s.get(IMPOCM).as_real();
if (importo < ZERO) keymov.add(nreg);
{ const TRectype & mov = cache().get(LF_MOV, keymov);
importo = -importo;
sez = "A";
}
gruppo = gcs.left(2);
conto = gcs.mid(2, 2);
sottoconto = gcs.right(6);
if (iva)
{
TToken_string key;
key.add(gruppo); keymov.add(1);
key.add(conto);
const TString4 tipocf = cache().get(LF_PCON, key, PCN_TMCF);
if (tipocf.full()) const TRectype & rmov = cache().get(LF_RMOV, keymov);
{ TBill clifo(rmov);
conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
conf->set(MOV_TIPO, tipocf);
conf->set(MOV_CODCF, sottoconto);
conf->set(MOV_TOTDOC, importo.string());
paragraph.format("%d,%d",LF_RMOV,nrigac++);
conf->set_paragraph(paragraph);
conf->set(RMV_SEZIONE, sez);
conf->set(RMV_TIPOC, tipocf);
conf->set(RMV_IMPORTO, importo.string());
conf->set(RMV_GRUPPO, gruppo);
conf->set(RMV_CONTO, conto);
conf->set(RMV_SOTTOCONTO, sottoconto);
conf->set(RMV_ROWTYPE, "T");
}
else
{
concg.add(gcs);
impcg.add(importo);
}
}
else
{
paragraph.format("%d,%d",LF_RMOV,nrigac++);
conf->set_paragraph(paragraph);
conf->set(RMV_SEZIONE, sez);
conf->set(RMV_IMPORTO, importo.string());
conf->set(RMV_GRUPPO, gruppo);
conf->set(RMV_CONTO, conto);
conf->set(RMV_SOTTOCONTO, sottoconto);
}
}
else
if (iva)
{
TString8 paragraph;
real importo = s.get(IMPOCM).as_real();
real imposta = s.get(IMPSCM).as_real();
if (importo < ZERO) const TCausale & c = cache_causali.causale(mov.get(MOV_CODCAUS), mov.get_int(MOV_ANNOIVA));
{
importo = -importo; if (game == NULL)
sez = "A"; game = new TPartita(clifo, anno, format("%7d", part));
}
if (imposta < ZERO) // giusto ?
imposta = -imposta;
const real ind = s.get(INDECM).as_real(); TRiga_partite& partita = game->new_row();
const TString4 codiva = s.get(CDIVCM).as_string();
if (ind > ZERO && ind < CENTO) partita.put(PART_TIPOMOV, c.tipomov());
{ partita.put(PART_DATAREG, mov.get(MOV_DATAREG));
TRectype rec(LF_RMOVIVA); partita.put(PART_DATADOC, mov.get(MOV_DATADOC));
partita.put(PART_NUMDOC, mov.get(MOV_NUMDOC));
descr = s.get(DSTIPA).as_string();
if (descr.blank())
descr = mov.get(MOV_DESCR);
partita.put(PART_DESCR, descr);
partita.put(PART_CODCAUS, c.codice());
partita.put(PART_REG, c.reg().name());
partita.put(PART_SEZ, c.sezione(1));
real impind = importo * ind / 100; partita.put(PART_SOTTOCONTO, clifo.sottoconto());
real ivaind = importo * ind / 100; const TString8 codpag(mov.get(MOV_CODPAG));
impind.round(2); TPagamento pag(codpag);
ivaind.round(2); partita.put(PART_CODPAG, codpag);
importo -= impind; partita.put(PART_TIPOPAG, pag.tipo_rata(0));
imposta -= ivaind;
rec.put(RMI_CODIVA, codiva);
rec.put(RMI_TIPODET, "9");
rec.put(RMI_IMPONIBILE, impind.string());
rec.put(RMI_IMPOSTA, ivaind.string());
rec.put(RMI_GRUPPO, gruppo);
rec.put(RMI_CONTO, conto);
rec.put(RMI_SOTTOCONTO, sottoconto);
rows.add(rec);
}
TRectype rec(LF_RMOVIVA);
rec.put(RMI_CODIVA, codiva); partita.put(PART_GRUPPOCL, clifo.gruppo());
if (ind >= CENTO) partita.put(PART_CONTOCL, clifo.conto());
rec.put(RMI_TIPODET, "9"); partita.put(PART_PROTIVA, mov.get(MOV_PROTIVA));
rec.put(RMI_IMPONIBILE, importo.string());
rec.put(RMI_IMPOSTA, imposta.string()); real residuo = s.get(IMPOPA).as_real();
rec.put(RMI_GRUPPO, gruppo); TImporto importo(residuo.sign() < 0 ? 'A' : 'D', abs(residuo));
rec.put(RMI_CONTO, conto); importo.normalize(c.sezione(1));
rec.put(RMI_SOTTOCONTO, sottoconto); partita.add(PART_IMPTOTDOC, importo.valore());
rows.add(rec); partita.put(PART_IMPORTO, importo.valore());
}
} TRiga_scadenze& scadenza = partita.new_row();
if (conf != NULL)
delete conf;
if (yesno_box(FR("Si desidera confermare l'importazione di %ld record di saldaconto"), ntran -1)) scadenza.put(SCAD_CODPAG, mov.get(MOV_CODPAG));
scadenza.put(SCAD_DATASCAD, s.get(DTSCPA).as_string());
scadenza.put(SCAD_IMPORTO, importo.valore());
scadenza.put(SCAD_TIPOPAG, partita.get(PART_TIPOPAG));
}
if (game != NULL)
{ {
TString app; game->write();
delete game;
app << "cg2 -0 -i" << outdir << "/*.ini";
TExternal_app primanota(app);
primanota.run(true);
} }
} }

View File

@ -4,5 +4,3 @@
#define F_RAGSOC 102 #define F_RAGSOC 102
#define F_PATH 103 #define F_PATH 103
#define F_NAME 104 #define F_NAME 104
#define F_ANNOES 105
#define F_PATHOUT 106

View File

@ -49,7 +49,7 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
GROUPBOX DLG_NULL 90 5 GROUPBOX DLG_NULL 90 4
BEGIN BEGIN
PROMPT 2 4 "@bSorgente" PROMPT 2 4 "@bSorgente"
END END
@ -69,33 +69,6 @@ BEGIN
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
NUMBER F_ANNOES 4
BEGIN
PROMPT 3 7 "Esercizio "
USE ESC
INPUT CODTAB F_ANNOES
DISPLAY "Codice Esercizio" CODTAB
DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio " D1
OUTPUT F_ANNOES CODTAB
FIELD AnnoEs
CHECKTYPE REQUIRED
END
GROUPBOX DLG_NULL 90 4
BEGIN
PROMPT 2 9 "@bDestinazione"
END
STRING F_PATHOUT 256 39
BEGIN
PROMPT 3 10 "Cartella "
DSELECT
CHECKTYPE REQUIRED
FIELD ComOutPath
END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -12,6 +12,10 @@
#include <textset.h> #include <textset.h>
#include <tabutil.h> #include <tabutil.h>
#include "../ce/ammce.h"
#include "../ce/cespi.h"
#include "../ce/salce.h"
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#include "pe0001.h" #include "pe0001.h"
@ -22,61 +26,133 @@
#include <rmov.h> #include <rmov.h>
#include <rmoviva.h> #include <rmoviva.h>
#define AT01CM 0 // Record attivo/sospeso/annullato DIZSMAS - ATTI // Tracciato File: FGA5DAT/AMANA00F - AMANA : Anagrafico Cespiti INDEX UNIQUE 26/11/09 12:15:29 Pag. 1
#define DT01CM 1 // Data stampa per G.Gen.le DIZSMAS - DATS
#define NR01CM 2 // Numero azione di aggiornamento DIZSMAS - NRAZ #define AT01AA 0 // Record attivo/sospeso/annullato DIZSMAS - ATTI
#define TPMVCM 3 // Flag IVA I=IVA =no IVA DIZSMAS - TPMV #define DT01AA 1 // Data ult.manut. DIZSMAS - DATS
#define CDDTCM 4 // Codice Ditta DIZSMAS - CDDT #define NR01AA 2 // Numero azione di aggiornamento DIZSMAS - NRAZ
#define AAPRCM 5 // Anno Operazione DIZSMAS - AAPR #define CDDTAA 3 // Codice Ditta DIZSMAS - CDDT
#define ANNPCM 6 // Anno Reg.DA GESTIRE DIZSMAS - ANNP #define CCESAA 4 // Codice Cespite DIZSMAS - CCES Key 1
#define TPGICM 7 // Giornale IVA TB=GI DIZSMAS - TPGI #define DCESAA 5 // Descr. Cespite DIZSMAS - DCES
#define DTOPCM 8 // Data operazione DIZSMAS - DATS #define SIGLAA 6 // Sigla DIZSMAS - SIGL
#define NONPCM 9 // Nr. Operaz./Nr. Prot. DIZSMAS - NONP #define DACEAA 7 // Descr. Aggiun. Cespite DIZSMAS - DACE
#define NRRGCM 10 // Numero Riga 2 DIZSMAS - NRR2 #define MATRAA 8 // Matricola DIZSMAS - MATR
#define NRGICM 11 // Nr Riga Giornale DIZSMAS - NRGI #define UMBAAA 9 // Unita' Misura Base DIZSMAS - UMBA
#define CONTCM 12 // Gr. Conto Sottoconto DIZSMAS - CONT #define UBMAAA 10 // Ubicazione Magazzino DIZSMAS - UBMA
#define DIVICM 13 // Divisione TB=DI DIZSMAS - DIVI #define CDNAAA 11 // Cod.Natura del Bene DIZSMAS - CDNA
#define NPARCM 14 // Nr Partita DIZSMAS - NPAR #define CDAFAA 12 // Codice Ammortamento Fiscale DIZSMAS - CDAF
#define AAOPCM 15 // Anno partita DIZSMAS - ANNO #define CDACAA 13 // Codice Ammortamento Civilis. DIZSMAS - CDAC
#define DTRGCM 16 // Data registrazione DIZSMAS - DATS #define CDATAA 14 // Codice Ammortamento Tecnico DIZSMAS - CDAT
#define CAUSCM 17 // Causale TB=CA DIZSMAS - CAUS #define CCTPAA 15 // Centri Costo Tipico TB=CC DIZSMAS - CCTP
#define DSUPCM 18 // Descrizione Supplementare DIZSMAS - DSUP #define NCOMAA 16 // Numero Commessa DIZSMAS - NCOM
#define IMPOCM 19 // Importo "-"=Avere DIZSMAS - IMPO #define CDSCAA 17 // Codice Sottocommessa DIZSMAS - CDSC
#define CDVACM 20 // Codice Valuta TB=VA DIZSMAS - CDVA #define CLA1AA 18 // Classe 1 DIZSMAS - CLA1
#define CAMBCM 21 // Cambio DIZSMAS - CAMB #define CLA2AA 19 // Classe 2 DIZSMAS - CLA2
#define IMVACM 22 // Importo Valuta DIZSMAS - IMVA #define CLA3AA 20 // Classe 3 DIZSMAS - CLA3
#define CDPGCM 23 // Codice di Pagamento TB=CP DIZSMAS - CDPG #define CLA4AA 21 // Classe 4 DIZSMAS - CLA4
#define DT1SCM 24 // Data I^ scadenza DIZSMAS - DATS #define CLA5AA 22 // Classe 5 DIZSMAS - CLA5
#define DTDOCM 25 // Data documento DIZSMAS - DATS #define DTIAAA 23 // Data Inizio Ammort. DIZSMAS - DATS
#define NRDOCM 26 // N° Documento DIZSMAS - NUDO #define DTITAA 24 // Data Inizio Ammort.Tecnico DIZSMAS - DATS
#define CCTPCM 27 // Centri Costo Tipico TB=CC DIZSMAS - CCTP #define DTFAAA 25 // Data Fine Ammort. DIZSMAS - DATS
#define NCOMCM 28 // Numero Commessa DIZSMAS - NCOM #define FLSMAA 26 // Flag Soggetto a Manut. S/ DIZSMAS - FLSM
#define CDSCCM 29 // Codice Sottocommessa DIZSMAS - CDSC #define CCEPAA 27 // Codice Cespite DIZSMAS - CCES
#define INDECM 30 // Indetraibilità % DIZSMAS - INDE
#define CDIVCM 31 // Codice IVA DIZSMAS - CDIV // Tracciato File: FGA5DAT/AMANI00F - AMANI : Anagrafico Cespiti: Valori iniziali INDEX UNIQUE 26/11/09 12:16:06 Pag. 1
#define IMPSCM 32 // Imposta DIZSMAS - IMPS
#define CDAGCM 33 // Codice Agente DIZSMAS - CDAG #define DT01AAS 0 // Data ult.manut. DIZSMAS - DATS
#define DTVBCM 34 // Data Liquidazione Iva Sospesa DIZSMAS - DATS #define CDDTAAS 1 // Codice Ditta DIZSMAS - CDDT
#define FLSBCM 35 // Flag *=Stampato Bollato DIZSMAS - FLSB #define CCESAAS 2 // Codice Cespite DIZSMAS - CCES Key 1
#define FSBICM 36 // Flag *=Stampato Boll.IVA DIZSMAS - FSBI #define CCERAA 3 // Cesp. Rif. DIZSMAS - CCES
#define FLVZCM 37 // V=Var.S=Storno P=Liq.prec. E=Esig.Sosp. DIZSMAS - FLVZ #define VLIFAA 4 // Val.iniziale Fiscale DIZSMAS - $PRO
#define FLIICM 38 // Flag IVA Irrecup. " "=I irr. DIZSMAS - FLII #define DTIFAA 5 // Data Inizio Ammort.Fiscale DIZSMAS - DATS
#define FLTSCM 39 // Flag Tipo Sollecito DIZSMAS - FLTS #define VLICAA 6 // Val.iniziale Civilistico DIZSMAS - $PRO
#define FLEPCM 40 // *=Est.EP Non è più usato DIZSMAS - FLEP #define DTICAA 7 // Data Inizio Ammort.Civilistico DIZSMAS - DATS
#define DPERCM 41 // Dati Personalizzabili DIZSMAS - DPER #define VLG1AA 8 // Valore iniziale Gestion.1 DIZSMAS - $PRO
#define CONSCM 42 // Gr.Co.Sottoc.Sostitutivo DIZSMAS - CONS #define DTG1AA 9 // Data Inizio Ammort.Gestion.1 DIZSMAS - DATS
#define DTSTCM 43 // Nr.progr. rateo/risconto - #define VLG2AA 10 // Valore iniziale Gestion.2 DIZSMAS - $PRO
#define USERCM 44 // Utente DIZSMAS - NOMU #define DTG2AA 11 // Data Inizio Ammort.Gestion.2 DIZSMAS - DATS
#define DTUMCM 45 // Data ultima manutenzione DIZSMAS - DATS #define VLG3AA 12 // Valore iniziale Gestion.3 DIZSMAS - $PRO
#define TPUMCM 46 // Tipo ultima manutenzione DIZSMAS - FLAG #define DTG3AA 13 // Data Inizio Ammort.Gestion.3 DIZSMAS - DATS
#define FL01CM 47 // Flag Generico DIZSMAS - FLAG #define VLG4AA 14 // Valore iniziale Gestion.4 DIZSMAS - $PRO
#define FL02CM 48 // Flag Generico DIZSMAS - FLAG #define DTG4AA 15 // Data Inizio Ammort.Gestion.4 DIZSMAS - DATS
#define FL03CM 49 // Flag Generico DIZSMAS - FLAG #define VLG5AA 16 // Valore iniziale Gestion.5 DIZSMAS - $PRO
#define FL04CM 50 // Flag Generico DIZSMAS - FLAG #define DTG5AA 17 // Data Inizio Ammort.Gestion.5 DIZSMAS - DATS
#define FL05CM 51 // Flag Generico DIZSMAS - FLAG #define CAMBAA 18 // Cambio EURO DIZSMAS - CAME
#define CMBECM 52 // Cambio EURO DIZSMAS - CAME #define VLIFAA2 19 // Val.iniz.Fisc. 2 DIZSMAS - $PRO
#define IMVACM2 53 // Importo Val 2 DIZSMAS - IMPO #define VLICAA2 20 // Val.iniz. Civil. 2 DIZSMAS - $PRO
#define IMPSCM2 54 // Imposta 2 DIZSMAS - IMPS #define VLG1AA2 21 // Val. iniz. Gest.1/2 DIZSMAS - $PRO
#define VLG2AA2 22 // Val. iniz. Gest.2/2 DIZSMAS - $PRO
#define VLG3AA2 23 // Val. iniz. Gest.3/2 DIZSMAS - $PRO
#define VLG4AA2 24 // Val. iniz. Gest.4/2 DIZSMAS - $PRO
#define VLG5AA2 25 // Val. iniz. Gest.5/2 DIZSMAS - $PRO
#define FLG1AA 26 // Amm. inf. Gest.1/2 DIZSMAS - $FLG
#define FLG2AA 27 // Amm. inf. Gest.2/2 DIZSMAS - $FLG
#define FLG3AA 28 // Amm. inf. Gest.3/2 DIZSMAS - $FLG
#define FLG4AA 29 // Amm. inf. Gest.4/2 DIZSMAS - $FLG
#define FLG5AA 30 // Amm. inf. Gest.5/2 DIZSMAS - $FLG
#define DTAQAA 31 // Data Acquisizione Cespite DIZSMAS - DATS
#define CDCLAA 32 // Codice Centro Lavoro -
#define CDMUAA 33 // Codice Macchina Utensile -
#define DPERAA 34 // Dati personalizzabili
// Tracciato File: FGA5DAT/AMSTO00F - AMSTO : Storico Movimenti Cespiti *NOMAX IN 26/11/09 12:16:29 Pag. 1
#define AT01AS 0 // Record attivo/sospeso/annullato DIZSMAS - ATTI
#define DT01AS 1 // Data ult.manut. DIZSMAS - DATS
#define NR01AS 2 // Numero azione di aggiornamento DIZSMAS - NRAZ
#define CDDTAS 3 // Codice Ditta DIZSMAS - CDDT
#define CCESAS 4 // Codice Cespite DIZSMAS - CCES Key 1
#define ANNOAS 5 // Anno Competenza DIZSMAS - ANNO
#define DTIAAS 6 // Data Inizio Ammort. DIZSMAS - DATS
#define DTFAAS 7 // Data Fine Ammort. DIZSMAS - DATS Key 2
#define VLINAS 8 // Valore Iniziale DIZSMAS - VLIN
#define VAVIAS 9 // Variazione Valore Iniziale DIZSMAS - VAVI
#define PAGNAS 10 // % Ammort. Normale DIZSMAS - PAGN
#define VAMNAS 11 // Valore Ammortamento Normale DIZSMAS - VAMN
#define PAGAAS 12 // % Ammort. Anticipato DIZSMAS - PAGA
#define VAMAAS 13 // Valore Ammortamento Anticip. DIZSMAS - VAMA
#define PFANAS 14 // Progr.Fondo Ammort.Normale DIZSMAS - PFAN
#define VAFNAS 15 // Variaz. Fondo Ammort.Norm. DIZSMAS - VAFN
#define PFAAAS 16 // Progr.Fondo Ammort.Anticip. DIZSMAS - PFAA
#define VAFAAS 17 // Variaz. Fondo Ammort.Antic. DIZSMAS - VAFA
#define RESAAS 18 // Residuo da Ammortizzare DIZSMAS - RESA
#define VAREAS 19 // Variazione Residuo da Amm. DIZSMAS - VARE
#define PALFAS 20 // % Amm. Accelerato Fiscale DIZSMAS - PAGN
#define VALFAS 21 // Valore Ammort.Accelerato Fiscale DIZSMAS - VAMN
#define M1LFAS 22 // Mese Iniziale Accelerato Fiscale DIZSMAS - MMOP
#define M2LFAS 23 // Mese Finale Accelerato Fiscale DIZSMAS - MMOP
#define VLICAS 24 // Valore Iniziale Civilistico DIZSMAS - VLIN
#define VVICAS 25 // Variaz. Valore Iniz. Civil. DIZSMAS - VAVI
#define PANCAS 26 // % Ammort.Normale Civilistico DIZSMAS - PAGN
#define VANCAS 27 // Valore Ammort.Normale Civil. DIZSMAS - VAMN
#define PAACAS 28 // % Ammort.Anticipato Civilis. DIZSMAS - PAGA
#define VAACAS 29 // Valore Ammort.Anticip.Civil. DIZSMAS - VAMA
#define FANCAS 30 // Progr.Fondo Amm.Normale Civ. DIZSMAS - PFAN
#define VFNCAS 31 // Variaz. Fondo Amm.Norm. Civ. DIZSMAS - VAFN
#define FAACAS 32 // Progr.Fondo Amm.Anticip.Civ. DIZSMAS - PFAA
#define VFACAS 33 // Variaz. Fondo Amm.Antic.Civ. DIZSMAS - VAFA
#define RESCAS 34 // Residuo da Ammortizzare Civ. DIZSMAS - RESA
#define VRECAS 35 // Variaz. Residuo da Amm. Civ. DIZSMAS - VARE
#define PALCAS 36 // % Amm. Accelerato Civilistico DIZSMAS - PAGN
#define VALCAS 37 // Valore Ammort.Accelerato Civilistico DIZSMAS - VAMN
#define M1LCAS 38 // Mese Iniziale Accelerato Civilistico DIZSMAS - MMOP
#define M2LCAS 39 // Mese Finale Accelerato Civilistico DIZSMAS - MMOP
#define CAMBAS 40 // Cambio EURO DIZSMAS - CAME
#define VLINAS2 41 // Val.iniz.2 DIZSMAS - VLIN
#define VAVIAS2 42 // Var.iniz.2 DIZSMAS - VAVI
#define VAMNAS2 43 // Val.Amm.Nor.2 DIZSMAS - VAMN
#define VAMAAS2 44 // Val.Amm.Ant.2 DIZSMAS - VAMA
#define PFANAS2 45 // Prg.Fondo Nor.2 DIZSMAS - PFAN
#define VAFNAS2 46 // Var.Fondo Nor.2 DIZSMAS - VAFN
#define PFAAAS2 47 // Prg.Fondo Ant.2 DIZSMAS - PFAA
#define VAFAAS2 48 // Var.Fondo Ant.2 DIZSMAS - VAFA
#define RESAAS2 49 // Residuo.2 DIZSMAS - RESA
#define VAREAS2 50 // Var.Res.2 DIZSMAS - VARE
#define VLICAS2 51 // Valore Iniziale Civil.2 DIZSMAS - VLIN
#define VVICAS2 52 // Variaz. Valore Iniz. Civ.2 DIZSMAS - VAVI
#define VANCAS2 53 // Valore Ammort.Normale Civ.2 DIZSMAS - VAMN
#define VAACAS2 54 // Valore Ammort.Anti.Civil.2 DIZSMAS - VAMA
#define FANCAS2 55 // Progr.Fondo Amm.Norm Civ.2 DIZSMAS - PFAN
class TImporta_cesp_recset : public TCSV_recordset class TImporta_cesp_recset : public TCSV_recordset
{ {
@ -169,285 +245,202 @@ public:
virtual bool create(); virtual bool create();
virtual bool destroy(); virtual bool destroy();
virtual void main_loop(); virtual void main_loop();
void build_IVA(TConfig & conf, TArray & rows, TString_array & concg, TArray & impcg); void transfer(const TFilename& file, const TFilename& filesto);
void transfer(const TFilename& file);
TImporta_cesp() {}; TImporta_cesp() {};
}; };
void TImporta_cesp::build_IVA(TConfig & conf, TArray & rows, TString_array & concg, TArray & impcg) void TImporta_cesp::transfer(const TFilename& file, const TFilename& filesto)
{
const int items = rows.items();
TString paragraph;
if (items > 0)
{
int nrigai = 1;
int i = 0;
TString *gcs = (TString *)concg.first_item();
real imptot = *((real *) impcg.first_item());
TString4 gruppo = gcs->left(2);
TString4 conto = gcs->mid(2, 2);
TString8 sottoconto = gcs->right(6);
while (i < items)
{
TRectype & rec = (TRectype &)rows[i];
real imp = rec.get(RMI_IMPONIBILE);
real iva = rec.get(RMI_IMPOSTA);
if (imp <= imptot)
i++;
else
{
TCodiceIVA codiva(rec.get(RMI_CODIVA));
imp -= imptot;
rec.put(RMI_IMPONIBILE, imp);
imp = imptot;
real iv = codiva.imposta(imptot);
iva -= iv;
rec.put(RMI_IMPOSTA, iva);
iva = iv;
}
imptot -= imp;
paragraph.format("%d,%d",LF_RMOVIVA,nrigai++);
conf.set_paragraph(paragraph);
conf.set(RMI_CODIVA, rec.get(RMI_CODIVA));
conf.set(RMI_TIPODET, rec.get(RMI_TIPODET));
conf.set(RMI_IMPONIBILE, imp.string());
conf.set(RMI_IMPOSTA, iva.string());
conf.set(RMI_GRUPPO, gruppo);
conf.set(RMI_CONTO, conto);
conf.set(RMI_SOTTOCONTO, sottoconto);
if (imptot <= 0)
{
gcs = (TString *)concg.succ_item();
if (gcs == NULL)
break;
imptot = *((real *) impcg.succ_item());
gruppo = gcs->left(2);
conto = gcs->mid(2, 2);
sottoconto = gcs->right(6);
}
}
}
}
void TImporta_cesp::transfer(const TFilename& file)
{ {
TFilename outdir(_msk->get(F_PATHOUT)); TFilename outdir(_msk->get(F_PATHOUT));
TImporta_cesp_recset s(file); TImporta_cesp_recset s(file);
TImporta_cesp_recset st(fileSTO);
TProgind pi(s.items(),"Importazione cespiti in corso ...",true,true); TProgind pi(s.items(),"Importazione cespiti in corso ...",true,true);
TConfig * conf = NULL;
long nmov = - 1;
int anno = 0;
TString8 reg;
TDate dataop;
int nrigac = 1;
long ntran = 1L;
bool iva = false;
TString4 gruppo;
TString4 conto;
TString8 sottoconto;
const int codes = _msk->get_int(F_ANNOES);
const long ditta = _msk->get_long(F_CODITTA); const long ditta = _msk->get_long(F_CODITTA);
long ntran = 1;
TString str(50);
const TEsercizi_contabili esc; const TEsercizi_contabili esc;
TArray rows; int lastes = esc.last();
TArray impcg;
TString_array concg;
for (bool ok=s.move_first();ok;ok=s.move_next()) for (bool ok = s.move_first() && st.move_first(); ok ; ok = s.move_next() && st.move_next())
{ {
if (!pi.addstatus(1)) if (!pi.addstatus(1))
break; break;
const long dt = s.get(CDDTCM).as_int(); const long dt = s.get(CDDTAA).as_int();
if (ditta != dt) if (ditta != dt)
continue; continue;
const TDate datareg(s.get(DTRGCM).as_int());
if (datareg.year() == 2009)
int i = 1;
const int es = esc.date2esc(datareg);
if (codes != es) TFilename temp(outdir);
continue;
const int a = s.get(AAPRCM).as_int();
const TString8 r = s.get(TPGICM).as_string();
const TDate d(s.get(DTOPCM).as_int());
const long n = s.get(NONPCM).as_int();
if (anno != a || reg != r || dataop != d || n != nmov ) 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(CCESAA).as_int();
conf.set(CESPI_IDCESPITE, format("%010ld", codces));
str = s.get(DCESAA).as_string();
str << ' ' << s.get(SIGLAA).as_string();
str << ' ' << s.get(DACEAA).as_string();
str << ' ' << s.get(MATRAA).as_string();
str.left(60);
conf.set(CESPI_DESC, str);
conf.set(CESPI_DTFUNZ, s.get(DTIAAA).as_string());
conf.set(CESPI_DTALIEN, s.get(DTFAAA).as_string());
conf.set(CESPI_TPSPEMAN, s.get(FLSMAA).as_bool() ? 2 : 1);
/*
#define CESPI_CODCGRA "CODCGRA"
#define CESPI_CODSPA "CODSPA"
#define CESPI_CODCGR "CODCGR"
#define CESPI_CODSP "CODSP"
#define CESPI_CODCAT "CODCAT"
#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_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"
*/
long dtst = st.get(CDDTAS).as_int();
long codcesst = st.get(CCESAS).as_int();
if (ditta == dtst && codces == codcesst)
{ {
if (iva && conf != NULL) int annoes = st.get(ANNOAS).as_bool();
build_IVA(*conf, rows, concg, impcg);
anno = a;
reg = r;
dataop = d;
nmov = n;
if (conf != NULL)
delete conf;
conf = NULL;
TFilename temp(outdir);
temp << '/' << format("%05ld", ntran++);
temp.ext("ini");
if (fexist(temp))
remove_file(temp);
conf = new TConfig(temp);
conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
conf->set("Action","INSERT");
conf->set("Mode","AUTO");
conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
TString8 codcaus = s.get(CAUSCM).as_string();
if (atoi(codcaus) != 0)
codcaus << '0';
conf->set(MOV_CODCAUS, codcaus);
conf->set(MOV_DATAREG, datareg.string());
const int codpag = s.get(CDPGCM).as_int();
if (codpag != 0)
conf->set(MOV_CODPAG, format("%03d", codpag));
TDate datadoc(s.get(DTDOCM).as_int()); while (annoes != lastes)
conf->set(MOV_DATADOC, datadoc.string());
TString16 ndoc = s.get(NRDOCM).as_string();
if (ndoc == "0")
ndoc.cut(0);
conf->set(MOV_NUMDOC, ndoc);
conf->set(MOV_STAMPATO, "X");
conf->set(MOV_REGST, "X");
iva = s.get(TPMVCM).as_string() == "I";
if (iva)
{ {
conf->set(MOV_REG, s.get(TPGICM).as_string()); ok = st.move_next();
conf->set(MOV_PROTIVA, n); if (ok)
{
dtst = st.get(CDDTAS).as_int();
codcesst = st.get(CCESAS).as_int();
annoes = st.get(ANNOAS).as_bool();
if (ditta != dtst || codces != codcesst)
break;
}
} }
nrigac = 1; conf.set_paragraph("143"); // setto il paragrafo del file salce
rows.destroy(); conf.set(SALCE_NUMELE, 1);
impcg.destroy(); real val = s.get(VLINAS).as_real() + s.get(VAVIAS).as_real();
concg.destroy(); conf.set(SALCE_CSTO, val.string());
/*
#define SALCE_IDCESPITE "IDCESPITE"
#define SALCE_CODES "CODES"
#define SALCE_TPSALDO "TPSALDO"
#define SALCE_NUMELE "NUMELE"
#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 */
} }
const TString gcs = s.get(CONTCM).as_string();
TString4 sez("D");
if (gcs.full())
{
TString8 paragraph;
real importo = s.get(IMPOCM).as_real();
if (importo < ZERO)
{
importo = -importo;
sez = "A";
}
gruppo = gcs.left(2);
conto = gcs.mid(2, 2);
sottoconto = gcs.right(6);
if (iva)
{
TToken_string key;
key.add(gruppo);
key.add(conto);
const TString4 tipocf = cache().get(LF_PCON, key, PCN_TMCF);
if (tipocf.full())
{
conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
conf->set(MOV_TIPO, tipocf);
conf->set(MOV_CODCF, sottoconto);
conf->set(MOV_TOTDOC, importo.string());
paragraph.format("%d,%d",LF_RMOV,nrigac++);
conf->set_paragraph(paragraph);
conf->set(RMV_SEZIONE, sez);
conf->set(RMV_TIPOC, tipocf);
conf->set(RMV_IMPORTO, importo.string());
conf->set(RMV_GRUPPO, gruppo);
conf->set(RMV_CONTO, conto);
conf->set(RMV_SOTTOCONTO, sottoconto);
conf->set(RMV_ROWTYPE, "T");
}
else
{
concg.add(gcs);
impcg.add(importo);
}
}
else
{
paragraph.format("%d,%d",LF_RMOV,nrigac++);
conf->set_paragraph(paragraph);
conf->set(RMV_SEZIONE, sez);
conf->set(RMV_IMPORTO, importo.string());
conf->set(RMV_GRUPPO, gruppo);
conf->set(RMV_CONTO, conto);
conf->set(RMV_SOTTOCONTO, sottoconto);
}
}
else
if (iva)
{
TString8 paragraph;
real importo = s.get(IMPOCM).as_real();
real imposta = s.get(IMPSCM).as_real();
if (importo < ZERO)
{
importo = -importo;
sez = "A";
}
if (imposta < ZERO) // giusto ?
imposta = -imposta;
const real ind = s.get(INDECM).as_real();
const TString4 codiva = s.get(CDIVCM).as_string();
if (ind > ZERO && ind < CENTO)
{
TRectype rec(LF_RMOVIVA);
real impind = importo * ind / 100;
real ivaind = importo * ind / 100;
impind.round(2);
ivaind.round(2);
importo -= impind;
imposta -= ivaind;
rec.put(RMI_CODIVA, codiva);
rec.put(RMI_TIPODET, "9");
rec.put(RMI_IMPONIBILE, impind.string());
rec.put(RMI_IMPOSTA, ivaind.string());
rec.put(RMI_GRUPPO, gruppo);
rec.put(RMI_CONTO, conto);
rec.put(RMI_SOTTOCONTO, sottoconto);
rows.add(rec);
}
TRectype rec(LF_RMOVIVA);
rec.put(RMI_CODIVA, codiva);
if (ind >= CENTO)
rec.put(RMI_TIPODET, "9");
rec.put(RMI_IMPONIBILE, importo.string());
rec.put(RMI_IMPOSTA, imposta.string());
rec.put(RMI_GRUPPO, gruppo);
rec.put(RMI_CONTO, conto);
rec.put(RMI_SOTTOCONTO, sottoconto);
rows.add(rec);
}
} }
if (conf != NULL) if (yesno_box(FR("Si desidera confermare l'importazione di %ld record di cespiti"), ntran - 1))
delete conf;
if (yesno_box(FR("Si desidera confermare l'importazione di %ld record di cespiti"), ntran -1))
{ {
TString app; TString app;
app << "cg2 -0 -i" << outdir << "/*.ini"; app << "ce0 -4 -i" << outdir << "/*.ini";
TExternal_app primanota(app); TExternal_app primanota(app);
primanota.run(true); primanota.run(true);
} }
@ -476,7 +469,9 @@ void TImporta_cesp::main_loop()
//genero il nome del file da caricare //genero il nome del file da caricare
TFilename name = _msk->get(F_PATH); TFilename name = _msk->get(F_PATH);
name.add(_msk->get(F_NAME)); name.add(_msk->get(F_NAME));
transfer(name); TFilename namesto = _msk->get(F_PATH);
name.add(_msk->get(F_NAME_STO));
transfer(name, namesto);
} }
} }

View File

@ -4,5 +4,5 @@
#define F_RAGSOC 102 #define F_RAGSOC 102
#define F_PATH 103 #define F_PATH 103
#define F_NAME 104 #define F_NAME 104
#define F_ANNOES 105 #define F_NAME_STO 105
#define F_PATHOUT 106 #define F_PATHOUT 106

View File

@ -69,20 +69,13 @@ BEGIN
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
NUMBER F_ANNOES 4 STRING F_NAME_STO 18
BEGIN BEGIN
PROMPT 3 7 "Esercizio " PROMPT 3 7 "File Sto. "
USE ESC FIELD ComInFileSto
INPUT CODTAB F_ANNOES
DISPLAY "Codice Esercizio" CODTAB
DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio " D1
OUTPUT F_ANNOES CODTAB
FIELD AnnoEs
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
GROUPBOX DLG_NULL 90 4 GROUPBOX DLG_NULL 90 4
BEGIN BEGIN
PROMPT 2 9 "@bDestinazione" PROMPT 2 9 "@bDestinazione"