Patch level : 10.0 no patch
Files correlati : Ricompilazione Demo : [ ] importazione galileo cantieri git-svn-id: svn://10.65.10.50/trunk@19775 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0411450568
commit
b630af6d91
323
ps/pe0001100.cpp
323
ps/pe0001100.cpp
@ -2,6 +2,7 @@
|
||||
#include <automask.h>
|
||||
#include <execp.h>
|
||||
#include <progind.h>
|
||||
#include <real.h>
|
||||
#include <reputils.h>
|
||||
#include <utility.h>
|
||||
#include <relation.h>
|
||||
@ -16,145 +17,73 @@
|
||||
#include <causali.h>
|
||||
#include <clifo.h>
|
||||
#include <mov.h>
|
||||
#include <rmov.h>
|
||||
#include <rmoviva.h>
|
||||
|
||||
class TImporta_mov_recset : public TAS400_recordset
|
||||
#define AT01CM 0 // Record attivo/sospeso/annullato DIZSMAS - ATTI
|
||||
#define DT01CM 1 // Data stampa per G.Gen.le DIZSMAS - DATS
|
||||
#define NR01CM 2 // Numero azione di aggiornamento DIZSMAS - NRAZ
|
||||
#define TPMVCM 3 // Flag IVA I=IVA =no IVA DIZSMAS - TPMV
|
||||
#define CDDTCM 4 // Codice Ditta DIZSMAS - CDDT
|
||||
#define AAPRCM 5 // Anno Operazione DIZSMAS - AAPR
|
||||
#define ANNPCM 6 // Anno Reg.DA GESTIRE DIZSMAS - ANNP
|
||||
#define TPGICM 7 // Giornale IVA TB=GI DIZSMAS - TPGI
|
||||
#define DTOPCM 8 // Data operazione DIZSMAS - DATS
|
||||
#define NONPCM 9 // Nr. Operaz./Nr. Prot. DIZSMAS - NONP
|
||||
#define NRRGCM 10 // Numero Riga 2 DIZSMAS - NRR2
|
||||
#define NRGICM 11 // Nr Riga Giornale DIZSMAS - NRGI
|
||||
#define CONTCM 12 // Gr. Conto Sottoconto DIZSMAS - CONT
|
||||
#define DIVICM 13 // Divisione TB=DI DIZSMAS - DIVI
|
||||
#define NPARCM 14 // Nr Partita DIZSMAS - NPAR
|
||||
#define AAOPCM 15 // Anno partita DIZSMAS - ANNO
|
||||
#define DTRGCM 16 // Data registrazione DIZSMAS - DATS
|
||||
#define CAUSCM 17 // Causale TB=CA DIZSMAS - CAUS
|
||||
#define DSUPCM 18 // Descrizione Supplementare DIZSMAS - DSUP
|
||||
#define IMPOCM 19 // Importo "-"=Avere DIZSMAS - IMPO
|
||||
#define CDVACM 19 // Codice Valuta TB=VA DIZSMAS - CDVA
|
||||
#define CAMBCM 20 // Cambio DIZSMAS - CAMB
|
||||
#define IMVACM 21 // Importo Valuta DIZSMAS - IMVA
|
||||
#define CDPGCM 22 // Codice di Pagamento TB=CP DIZSMAS - CDPG
|
||||
#define DT1SCM 23 // Data I^ scadenza DIZSMAS - DATS
|
||||
#define DTDOCM 24 // Data documento DIZSMAS - DATS
|
||||
#define NRDOCM 25 // N° Documento DIZSMAS - NUDO
|
||||
#define CCTPCM 26 // Centri Costo Tipico TB=CC DIZSMAS - CCTP
|
||||
#define NCOMCM 27 // Numero Commessa DIZSMAS - NCOM
|
||||
#define CDSCCM 28 // Codice Sottocommessa DIZSMAS - CDSC
|
||||
#define INDECM 29 // Indetraibilità % DIZSMAS - INDE
|
||||
#define CDIVCM 30 // Codice IVA DIZSMAS - CDIV
|
||||
#define IMPSCM 31 // Imposta DIZSMAS - IMPS
|
||||
#define CDAGCM 32 // Codice Agente DIZSMAS - CDAG
|
||||
#define DTVBCM 33 // Data Liquidazione Iva Sospesa DIZSMAS - DATS
|
||||
#define FLSBCM 34 // Flag *=Stampato Bollato DIZSMAS - FLSB
|
||||
#define FSBICM 35 // Flag *=Stampato Boll.IVA DIZSMAS - FSBI
|
||||
#define FLVZCM 36 // V=Var.S=Storno P=Liq.prec. E=Esig.Sosp. DIZSMAS - FLVZ
|
||||
#define FLIICM 37 // Flag IVA Irrecup. " "=I irr. DIZSMAS - FLII
|
||||
#define FLTSCM 38 // Flag Tipo Sollecito DIZSMAS - FLTS
|
||||
#define FLEPCM 39 // *=Est.EP Non è più usato DIZSMAS - FLEP
|
||||
#define DPERCM 40 // Dati Personalizzabili DIZSMAS - DPER
|
||||
#define CONSCM 41 // Gr.Co.Sottoc.Sostitutivo DIZSMAS - CONS
|
||||
#define DTSTCM 42 // Nr.progr. rateo/risconto -
|
||||
#define USERCM 43 // Utente DIZSMAS - NOMU
|
||||
#define DTUMCM 44 // Data ultima manutenzione DIZSMAS - DATS
|
||||
#define TPUMCM 45 // Tipo ultima manutenzione DIZSMAS - FLAG
|
||||
#define FL01CM 46 // Flag Generico DIZSMAS - FLAG
|
||||
#define FL02CM 47 // Flag Generico DIZSMAS - FLAG
|
||||
#define FL03CM 48 // Flag Generico DIZSMAS - FLAG
|
||||
#define FL04CM 49 // Flag Generico DIZSMAS - FLAG
|
||||
#define FL05CM 50 // Flag Generico DIZSMAS - FLAG
|
||||
#define CMBECM 51 // Cambio EURO DIZSMAS - CAME
|
||||
#define IMVACM2 52 // Importo Val 2 DIZSMAS - IMPO
|
||||
#define IMPSCM2 53 // Imposta 2 DIZSMAS - IMPS
|
||||
|
||||
class TImporta_mov_recset : public TCSV_recordset
|
||||
{
|
||||
const TVariant& get_field(const TAS400_column_info& fi) const;
|
||||
|
||||
public:
|
||||
TImporta_mov_recset(const char* query = "");
|
||||
virtual ~TImporta_mov_recset() { }
|
||||
TImporta_mov_recset(const char* query = "") : TCSV_recordset(TString("CSV(;)\n") << query) {}
|
||||
virtual ~TImporta_mov_recset() {}
|
||||
};
|
||||
|
||||
TImporta_mov_recset::TImporta_mov_recset(const char* query)
|
||||
: TAS400_recordset(TString("AS400(269,0,0)\n") << query)
|
||||
{
|
||||
|
||||
// questi sono i campi dell'applicazione originaria servono solo di esempio!!!
|
||||
create_field("Impianto", 0, 8);
|
||||
create_field("Cliente", 8, 3);
|
||||
create_field("Filler01", 11, 14);
|
||||
create_field("Schede", 25, 5, _intfld);
|
||||
create_field("Data", 30, 8, _datefld);
|
||||
create_field("Ora", 38, 8);
|
||||
create_field("Pompa", 46, 2);
|
||||
create_field("Prodotto", 48, 15);
|
||||
create_field("Volume", 63, 15, _realfld);
|
||||
create_field("Importo", 78, 15, _realfld);
|
||||
create_field("Prezzo", 93, 15, _realfld);
|
||||
create_field("Note", 108, 20);
|
||||
create_field("Ins.Manuale", 128, 1);
|
||||
create_field("Num. Buono", 129, 10, _realfld);
|
||||
create_field("DataStampa", 139, 8, _datefld);
|
||||
create_field("OraStampa", 147, 8);
|
||||
create_field("Fller02", 155, 1);
|
||||
create_field("Contatore", 156, 10, _realfld);
|
||||
create_field("Num. Fattura", 166, 10, _realfld);
|
||||
create_field("Sconto", 176, 15, _realfld);
|
||||
create_field("Mess Inc.", 191, 4);
|
||||
create_field("ID", 195, 10, _realfld);
|
||||
create_field("Ora Registrazione", 205, 8);
|
||||
create_field("Venduto", 213, 1);
|
||||
create_field("Temperatura", 214, 15, _realfld);
|
||||
create_field("Densitŕ", 229, 15, _realfld);
|
||||
create_field("Fatt54b", 244, 15, _realfld);
|
||||
create_field("Data", 259, 8, _datefld);
|
||||
|
||||
// questi sono i campi per Sicuri
|
||||
create_field("AT01CM" 1 1 1 Record attivo/sospeso/annullato DIZSMAS - ATTI
|
||||
create_field("DT01CM" P 2 6 5 8 0 Data stampa per G.Gen.le DIZSMAS - DATS
|
||||
create_field("NR01CM" P 7 11 5 9 0 Numero azione di aggiornamento DIZSMAS - NRAZ
|
||||
create_field("TPMVCM" A 12 12 1 Flag IVA I=IVA =no IVA DIZSMAS - TPMV
|
||||
create_field("CDDTCM" A 13 14 2 Codice Ditta DIZSMAS - CDDT
|
||||
create_field("AAPRCM" A 15 15 1 Anno Operazione DIZSMAS - AAPR
|
||||
create_field("ANNPCM" S 16 19 4 4 0 Anno Reg.DA GESTIRE DIZSMAS - ANNP
|
||||
create_field("TPGICM" A 20 20 1 Giornale IVA TB=GI DIZSMAS - TPGI
|
||||
create_field("DTOPCM" P 21 25 5 8 0 Data operazione DIZSMAS - DATS
|
||||
create_field("NONPCM" S 26 32 7 7 0 Nr. Operaz./Nr. Prot. DIZSMAS - NONP
|
||||
create_field("NRRGCM" S 33 37 5 5 0 Numero Riga 2 DIZSMAS - NRR2
|
||||
create_field("NRGICM" P 38 41 4 7 0 Nr Riga Giornale DIZSMAS - NRGI
|
||||
create_field("CONTCM" A 42 51 10 Gr. Conto Sottoconto DIZSMAS - CONT
|
||||
create_field("DIVICM" A 52 52 1 Divisione TB=DI DIZSMAS - DIVI
|
||||
create_field("NPARCM" S 53 59 7 7 0 Nr Partita DIZSMAS - NPAR
|
||||
create_field("AAOPCM" S 60 63 4 4 0 Anno partita DIZSMAS - ANNO
|
||||
create_field("DTRGCM" P 64 68 5 8 0 Data registrazione DIZSMAS - DATS
|
||||
create_field("CAUSCM" A 69 70 2 Causale TB=CA DIZSMAS - CAUS
|
||||
create_field("DSUPCM" A 71 95 25 Descrizione Supplementare DIZSMAS - DSUP
|
||||
create_field("IMPOCM" P 96 102 7 13 2 Importo "-"=Avere DIZSMAS - IMPO
|
||||
create_field("CDVACM" A 103 104 2 Codice Valuta TB=VA DIZSMAS - CDVA
|
||||
create_field("CAMBCM" P 105 111 7 13 6 Cambio DIZSMAS - CAMB
|
||||
create_field("IMVACM" P 112 118 7 13 2 Importo Valuta DIZSMAS - IMVA
|
||||
create_field("CDPGCM" A 119 121 3 Codice di Pagamento TB=CP DIZSMAS - CDPG
|
||||
create_field("DT1SCM" P 122 126 5 8 0 Data I^ scadenza DIZSMAS - DATS
|
||||
create_field("DTDOCM" P 127 131 5 8 0 Data documento DIZSMAS - DATS
|
||||
create_field("NRDOCM" P 132 135 4 7 0 N° Documento DIZSMAS - NUDO
|
||||
create_field("CCTPCM" A 136 138 3 Centri Costo Tipico TB=CC DIZSMAS - CCTP
|
||||
create_field("NCOMCM" A 139 143 5 Numero Commessa DIZSMAS - NCOM
|
||||
create_field("CDSCCM" A 144 158 15 Codice Sottocommessa DIZSMAS - CDSC
|
||||
create_field("INDECM" P 159 160 2 3 0 Indetraibilitŕ % DIZSMAS - INDE
|
||||
create_field("CDIVCM" A 161 162 2 Codice IVA DIZSMAS - CDIV
|
||||
create_field("IMPSCM" P 163 169 7 13 2 Imposta DIZSMAS - IMPS
|
||||
create_field("CDAGCM" A 170 172 3 Codice Agente DIZSMAS - CDAG
|
||||
create_field("DTVBCM" P 173 177 5 8 0 Data Liquidazione Iva Sospesa DIZSMAS - DATS
|
||||
create_field("FLSBCM" A 178 178 1 Flag *=Stampato Bollato DIZSMAS - FLSB
|
||||
create_field("FSBICM" A 179 179 1 Flag *=Stampato Boll.IVA DIZSMAS - FSBI
|
||||
create_field("FLVZCM" A 180 180 1 V=Var.S=Storno P=Liq.prec. E=Esig.Sosp. DIZSMAS - FLVZ
|
||||
create_field("FLIICM" A 181 181 1 Flag IVA Irrecup. " "=I irr. DIZSMAS - FLII
|
||||
create_field("FLTSCM" A 182 182 1 Flag Tipo Sollecito DIZSMAS - FLTS
|
||||
create_field("FLEPCM" A 183 183 1 *=Est.EP Non č piů usato DIZSMAS - FLEP
|
||||
create_field("DPERCM" A 184 193 10 Dati Personalizzabili DIZSMAS - DPER
|
||||
create_field("CONSCM" A 194 203 10 Gr.Co.Sottoc.Sostitutivo DIZSMAS - CONS
|
||||
create_field("DTSTCM" S 204 210 7 7 0 Nr.progr. rateo/risconto -
|
||||
create_field("USERCM" A 211 220 10 Utente DIZSMAS - NOMU
|
||||
create_field("DTUMCM" P 221 225 5 8 0 Data ultima manutenzione DIZSMAS - DATS
|
||||
create_field("TPUMCM" A 226 226 1 Tipo ultima manutenzione DIZSMAS - FLAG
|
||||
create_field("FL01CM" A 227 227 1 Flag Generico DIZSMAS - FLAG
|
||||
create_field("FL02CM" A 228 228 1 Flag Generico DIZSMAS - FLAG
|
||||
create_field("FL03CM" A 229 229 1 Flag Generico DIZSMAS - FLAG
|
||||
create_field("FL04CM" A 230 230 1 Flag Generico DIZSMAS - FLAG
|
||||
create_field("FL05CM" A 231 231 1 Flag Generico DIZSMAS - FLAG
|
||||
create_field("CMBECM" P 232 238 7 13 6 Cambio EURO DIZSMAS - CAME
|
||||
create_field("IMVACM2" P 239 245 7 13 2 Importo Val 2 DIZSMAS - IMPO
|
||||
create_field("IMPSCM2" P 246 252 7 13 2 Imposta 2 DIZSMAS - IMPS
|
||||
}
|
||||
|
||||
const TVariant& TImporta_mov_recset::get_field(const TAS400_column_info& ci) const
|
||||
{
|
||||
if (ci._type == _datefld)
|
||||
{
|
||||
TVariant & var = get_tmp_var();
|
||||
const TRecnotype n = current_row();
|
||||
if (n >= 0 && n < items())
|
||||
{
|
||||
const TString& str = row(n).mid(ci._pos, ci._width);
|
||||
long ansi = 20000000L + atoi(str.right(2)) * 10000 + atoi(str.mid(3,2)) * 100 + atoi(str.left(2));
|
||||
|
||||
if (ansi > 20510000L)
|
||||
ansi -= 1000000L;
|
||||
var = TDate(ansi);
|
||||
}
|
||||
|
||||
return var;
|
||||
}
|
||||
else
|
||||
if (ci._type == _realfld)
|
||||
{
|
||||
TVariant & var = get_tmp_var();
|
||||
const TRecnotype n = current_row();
|
||||
if (n >= 0 && n < items())
|
||||
{
|
||||
const TString& str = row(n).mid(ci._pos, ci._width);
|
||||
|
||||
var = real(real::ita2eng(str));
|
||||
}
|
||||
|
||||
return var;
|
||||
}
|
||||
return TAS400_recordset::get_field(ci);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAutomask
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -183,7 +112,7 @@ bool TImporta_mov_mask::on_field_event(TOperable_field& f, TField_event e, long
|
||||
TArray_sheet as(-1, -1, 72, 20, TR("Selezione file"),
|
||||
"File@32");
|
||||
TFilename path = get(F_PATH);
|
||||
path.add("*.csv"); //files delle testate
|
||||
path.add("*.txt"); //files delle testate
|
||||
list_files(path, as.rows_array());
|
||||
TFilename name;
|
||||
FOR_EACH_ARRAY_ROW(as.rows_array(), i, row)
|
||||
@ -213,8 +142,6 @@ class TImporta_mov : public TSkeleton_application
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
TImporta_mov_mask* _msk;
|
||||
TConfig* _configfile;
|
||||
|
||||
|
||||
//protected:
|
||||
|
||||
@ -230,57 +157,108 @@ public:
|
||||
|
||||
bool TImporta_mov::transfer(const TFilename& file)
|
||||
{
|
||||
TFilename tempdir;
|
||||
TImporta_mov_recset s(file);
|
||||
|
||||
TProgind pi(s.items(),"Importazione movimenti in corso ...",true,true);
|
||||
TConfig * _conf = NULL;
|
||||
long nmov = - 1;
|
||||
int nrigac = 0;
|
||||
int nrigai = 0;
|
||||
|
||||
_configfile->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
|
||||
|
||||
_configfile->set("Action","INSERT");
|
||||
_configfile->set("Mode","AUTO");
|
||||
|
||||
_configfile->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
|
||||
|
||||
_configfile->set(MOV_TIPO,"F");
|
||||
_configfile->set(MOV_CODCF, _msk->get(F_CODCF));
|
||||
|
||||
_configfile->set(MOV_CODCAUS, _msk->get(F_CODCAU));
|
||||
|
||||
_configfile->set(MOV_DATAREG, _msk->get(F_DATAREG));
|
||||
|
||||
|
||||
int nriga = 1;
|
||||
tempdir.tempdir();
|
||||
|
||||
for (bool ok=s.move_first();ok;ok=s.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
const long n = s.get(NONPCM).as_int();
|
||||
if (n != nmov )
|
||||
{
|
||||
nmov = n;
|
||||
delete _conf;
|
||||
_conf = NULL;
|
||||
}
|
||||
if (_conf = NULL)
|
||||
{
|
||||
TFilename temp;
|
||||
|
||||
TString8 paragraph;
|
||||
paragraph.format("%d,%d",LF_RMOVIVA,nriga++);
|
||||
_configfile->set_paragraph(paragraph);
|
||||
temp.temp(tempdir,"trn");
|
||||
_conf = new TConfig(temp);
|
||||
_conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
|
||||
_conf->set("Action","INSERT");
|
||||
_conf->set("Mode","AUTO");
|
||||
|
||||
TString16 codcom = s.get(0).as_string();
|
||||
real imp = s.get(1).as_real();
|
||||
_conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
|
||||
|
||||
_configfile->set(RMI_IMPONIBILE,imp.string());
|
||||
_configfile->set(RMI_CODIVA,_msk->get(F_CODIVA));
|
||||
_configfile->set(RMI_CODCMS,codcom);
|
||||
_conf->set(MOV_TIPO,"F"); // come
|
||||
_conf->set(MOV_CODCF, _msk->get(F_CODCF));
|
||||
_conf->set(MOV_CODCAUS, s.get(CAUSCM).as_string());
|
||||
_conf->set(MOV_DATAREG, s.get(DTRGCM).as_string());
|
||||
_conf->set(MOV_CODPAG, s.get(CDPGCM).as_string());
|
||||
_conf->set(MOV_DATADOC, s.get(DTDOCM).as_string());
|
||||
_conf->set(MOV_NUMDOC, s.get(NRDOCM).as_string());
|
||||
nrigac = 0;
|
||||
nrigai = 0;
|
||||
}
|
||||
const TString conto = s.get(CONTCM).as_string();
|
||||
|
||||
if (conto.full())
|
||||
{
|
||||
TString8 paragraph;
|
||||
|
||||
paragraph.format("%d,%d",LF_RMOV,nrigac++);
|
||||
_conf->set_paragraph(paragraph);
|
||||
real importo = s.get(IMPOCM).as_real();
|
||||
char sez = 'D';
|
||||
|
||||
if (importo < ZERO)
|
||||
{
|
||||
importo = -importo;
|
||||
sez = 'A';
|
||||
}
|
||||
_conf->set(RMV_SEZIONE, sez);
|
||||
_conf->set(RMV_IMPORTO, importo.string());
|
||||
}
|
||||
else
|
||||
{
|
||||
TString8 paragraph;
|
||||
real importo = s.get(IMPOCM).as_real();
|
||||
char sez = 'D';
|
||||
|
||||
paragraph.format("%d,%d",LF_RMOVIVA,nrigai++);
|
||||
_conf->set_paragraph(paragraph);
|
||||
if (importo < ZERO)
|
||||
{
|
||||
importo = -importo;
|
||||
sez = 'A';
|
||||
}
|
||||
_conf->set(RMI_IMPONIBILE, importo.string());
|
||||
|
||||
// INDECM 29 come si fa ?
|
||||
_conf->set(RMI_CODIVA, s.get(CDIVCM).as_string());
|
||||
real imposta = s.get(IMPSCM).as_real();
|
||||
|
||||
paragraph.format("%d,%d",LF_RMOVIVA,nrigai++);
|
||||
_conf->set_paragraph(paragraph);
|
||||
if (imposta < ZERO) // giusto ?
|
||||
imposta = -imposta;
|
||||
_conf->set(RMI_IMPOSTA, imposta.string());
|
||||
}
|
||||
}
|
||||
delete _conf;
|
||||
|
||||
_configfile->set_paragraph("Transaction");
|
||||
|
||||
TString app;
|
||||
|
||||
app << "cg2 -0 -i" << tempdir << "/*.trn";
|
||||
TExternal_app primanota(app);
|
||||
primanota.run();
|
||||
message_box(TR("Importazione movimenti completata"));
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* nomeini = "pe0001100fatt.ini";
|
||||
|
||||
bool TImporta_mov::create()
|
||||
{
|
||||
xvt_fsys_removefile(nomeini);
|
||||
_configfile = new TConfig(nomeini);
|
||||
|
||||
_msk = new TImporta_mov_mask();
|
||||
|
||||
return TSkeleton_application::create();
|
||||
@ -289,7 +267,6 @@ bool TImporta_mov::create()
|
||||
bool TImporta_mov::destroy()
|
||||
{
|
||||
delete _msk;
|
||||
delete _configfile;
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
@ -299,20 +276,10 @@ void TImporta_mov::main_loop()
|
||||
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));
|
||||
if (transfer(name))
|
||||
{
|
||||
|
||||
TString app;
|
||||
app << "cg2 -0 -i" << nomeini;
|
||||
TExternal_app primanota(app);
|
||||
primanota.run();
|
||||
|
||||
message_box(TR("Importazione movimenti completata"));
|
||||
}
|
||||
transfer(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user