Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@19875 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fa3bf76463
commit
6c6dee8c47
202
lv/lv4100.cpp
202
lv/lv4100.cpp
@ -1,7 +1,6 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <lffiles.h>
|
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
@ -9,8 +8,7 @@
|
|||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
#include <textset.h>
|
//#include <tabutil.h>
|
||||||
#include <tabutil.h>
|
|
||||||
|
|
||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib01.h"
|
||||||
|
|
||||||
@ -23,39 +21,40 @@
|
|||||||
#include <rmov.h>
|
#include <rmov.h>
|
||||||
#include <rmoviva.h>
|
#include <rmoviva.h>
|
||||||
|
|
||||||
#define DITTA_PK 0
|
#define CGC_DITTA_PK 0
|
||||||
#define TIPO 1
|
#define CGC_TIPO 1
|
||||||
#define GRUPPO 2
|
#define CGC_GRUPPO 2
|
||||||
#define CONTO 3
|
#define CGC_CONTO 3
|
||||||
#define SOTTOCONTO 4
|
#define CGC_SOTTOCONTO 4
|
||||||
#define ANNO 5
|
#define CGC_ANNO 5
|
||||||
#define VALUTA 6
|
#define CGC_VALUTA 6
|
||||||
#define CREAZIONE 7
|
#define CGC_CREAZIONE 7
|
||||||
#define PROGR_DARE 8
|
#define CGC_PROGR_DARE 8
|
||||||
#define PROGR_AVERE 9
|
#define CGC_PROGR_AVERE 9
|
||||||
#define SALDO_APERTURA 10
|
#define CGC_SALDO_APERTURA 10
|
||||||
#define SALDO_CHIUSURA 11
|
#define CGC_SALDO_CHIUSURA 11
|
||||||
#define ULT_PAG_PART 12
|
#define CGC_ULT_PAG_PART 12
|
||||||
#define DARE_PARTITARIO 13
|
#define CGC_DARE_PARTITARIO 13
|
||||||
#define AVERE_PARTITARIO 14
|
#define CGC_AVERE_PARTITARIO 14
|
||||||
#define DATAAGG_PARTITARIO 15
|
#define CGC_DATAAGG_PARTITARIO 15
|
||||||
|
|
||||||
|
real TImporta_cogeco_recset::get_real(int idx) const
|
||||||
/*const TVariant& TImporta_saldi_recset::get(unsigned int column) const
|
|
||||||
{
|
{
|
||||||
TString str = TCSV_recordset::get(column).as_string();
|
TString80 imp = get(idx).as_string();
|
||||||
TVariant& var = get_tmp_var();
|
imp.strip(".");
|
||||||
int len = str.len();
|
imp.replace(',', '.');
|
||||||
|
return real(imp);
|
||||||
if (len == 0)
|
}
|
||||||
return NULL_VARIANT;
|
|
||||||
if (str[len -1] == '"')
|
bool TImporta_cogeco_recset::get_bill(TBill& bill) const
|
||||||
str.rtrim(1);
|
{
|
||||||
if (str[0] == '"')
|
const int g = get(CGC_GRUPPO).as_int();
|
||||||
str.ltrim(1);
|
const int c = get(CGC_CONTO).as_int();
|
||||||
var.set(str);
|
const long s = get(CGC_SOTTOCONTO).as_int();
|
||||||
return var;
|
bill.set(g, c, s);
|
||||||
} */
|
return bill.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TAutomask
|
// TAutomask
|
||||||
@ -105,31 +104,60 @@ bool TImporta_saldi_mask::on_field_event(TOperable_field& f, TField_event e, lon
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// TSkeleton_application
|
// TSkeleton_application
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
class TImporta_saldi : public TSkeleton_application
|
class TImporta_saldi : public TSkeleton_application
|
||||||
{
|
{
|
||||||
virtual bool check_autorization() const {return false;}
|
TImporta_saldi_mask* _msk;
|
||||||
virtual const char * extra_modules() const {return "ba";}
|
|
||||||
|
|
||||||
TImporta_saldi_mask* _msk;
|
protected:
|
||||||
|
void set_rmov(TConfig& conf, const int nrow, const TImporto& imp,
|
||||||
//protected:
|
const TBill& bill) const;
|
||||||
|
void delete_ini(const TFilename& outdir) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
void transfer(const TFilename& file);
|
void transfer(const TFilename& file);
|
||||||
|
|
||||||
TImporta_saldi() {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TImporta_saldi::set_rmov(TConfig& conf, const int nrow, const TImporto& imp,
|
||||||
|
const TBill& bill) const
|
||||||
|
{
|
||||||
|
TString8 paragraph;
|
||||||
|
paragraph.format("%d,%d", LF_RMOV, nrow);
|
||||||
|
conf.set_paragraph(paragraph);
|
||||||
|
|
||||||
|
const char strsez[2] = {imp.sezione(), '\0'};
|
||||||
|
conf.set(RMV_SEZIONE, strsez);
|
||||||
|
conf.set(RMV_IMPORTO, imp.valore().string());
|
||||||
|
conf.set(RMV_GRUPPO, bill.gruppo());
|
||||||
|
conf.set(RMV_CONTO, bill.conto());
|
||||||
|
conf.set(RMV_SOTTOCONTO, bill.sottoconto());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TImporta_saldi::delete_ini(const TFilename& outdir) const
|
||||||
|
{
|
||||||
|
if (outdir.exist())
|
||||||
|
{
|
||||||
|
for (int ntran=1;;ntran++)
|
||||||
|
{
|
||||||
|
TFilename temp(outdir);
|
||||||
|
temp.add(format("lv41%05ld.ini", ntran++));
|
||||||
|
if (!temp.fremove())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
make_dir(outdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TImporta_saldi::transfer(const TFilename& file)
|
void TImporta_saldi::transfer(const TFilename& file)
|
||||||
{
|
{
|
||||||
TFilename outdir(_msk->get(F_PATHOUT));
|
const TFilename outdir(_msk->get(F_PATHOUT));
|
||||||
TImporta_cogeco_recset s(file);
|
TImporta_cogeco_recset s(file);
|
||||||
TProgind pi(s.items(),"Importazione saldi in corso ...",true,true);
|
TProgind pi(s.items(),"Importazione saldi in corso ...",true,true);
|
||||||
TConfig * conf = NULL;
|
TConfig * conf = NULL;
|
||||||
@ -142,57 +170,49 @@ void TImporta_saldi::transfer(const TFilename& file)
|
|||||||
TConfig cditta(CONFIG_DITTA, "cg");
|
TConfig cditta(CONFIG_DITTA, "cg");
|
||||||
const TString4 ctypes("GCF");
|
const TString4 ctypes("GCF");
|
||||||
const TString8 causale = cditta.get("CoCaAp");
|
const TString8 causale = cditta.get("CoCaAp");
|
||||||
const int gruppoap = cditta.get_int("CsBiApG");
|
const TBill conto_ap(cditta.get_int("CsBiApG"),
|
||||||
const int contoap = cditta.get_int("CsBiApC");
|
cditta.get_int("CsBiApC"),
|
||||||
const long sottocontoap = cditta.get_long("CsBiApS");
|
cditta.get_long("CsBiApS"));
|
||||||
|
|
||||||
int lastgruppo = 0;
|
int lastgruppo = 0;
|
||||||
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;
|
||||||
TString8 paragraph;
|
|
||||||
|
|
||||||
for (bool ok=s.move_first();ok;ok=s.move_next())
|
delete_ini(outdir);
|
||||||
|
|
||||||
|
for (bool ok=s.move_to(1);ok;ok=s.move_next())
|
||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
if (!pi.addstatus(1))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const long dt = s.get(DITTA_PK).as_int();
|
const long dt = s.get(CGC_DITTA_PK).as_int();
|
||||||
|
|
||||||
if (ditta != dt)
|
if (ditta != dt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const int es = s.get(ANNO).as_int();
|
const int es = s.get(CGC_ANNO).as_int();
|
||||||
|
|
||||||
if (codes != es)
|
if (codes != es)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ctypes.find(s.get(TIPO).as_string()[0]) < 0)
|
if (ctypes.find(s.get(CGC_TIPO).as_string()[0]) < 0)
|
||||||
continue;
|
continue;
|
||||||
int gruppo = s.get(GRUPPO).as_int();
|
|
||||||
int conto = s.get(CONTO).as_int();
|
|
||||||
long sottoconto = s.get(SOTTOCONTO).as_int();
|
|
||||||
|
|
||||||
if (lastgruppo != gruppo && nrow >= 99)
|
TBill bill;
|
||||||
|
if (!s.get_bill(bill))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (lastgruppo != bill.gruppo() || nrow >= 99)
|
||||||
{
|
{
|
||||||
if (conf != NULL)
|
if (conf != NULL)
|
||||||
{
|
{
|
||||||
paragraph.format("%d,%d",LF_RMOV,nrow++);
|
set_rmov(*conf, nrow++, totmov, conto_ap);
|
||||||
conf->set_paragraph(paragraph);
|
|
||||||
conf->set(RMV_SEZIONE, totmov.sezione());
|
|
||||||
conf->set(RMV_IMPORTO, totmov.valore().string());
|
|
||||||
conf->set(RMV_GRUPPO, gruppoap);
|
|
||||||
conf->set(RMV_CONTO, contoap);
|
|
||||||
conf->set(RMV_SOTTOCONTO, sottocontoap);
|
|
||||||
delete conf;
|
delete conf;
|
||||||
|
conf = NULL;
|
||||||
}
|
}
|
||||||
conf = NULL;
|
|
||||||
TFilename temp(outdir);
|
|
||||||
|
|
||||||
temp << '/' << format("%05ld", ntran++);
|
TFilename temp(outdir);
|
||||||
temp.ext("ini");
|
temp.add(format("lv41%05ld.ini", ntran++));
|
||||||
if (fexist(temp))
|
|
||||||
remove_file(temp);
|
|
||||||
conf = new TConfig(temp);
|
conf = new TConfig(temp);
|
||||||
conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
|
conf->set_paragraph("Transaction"); //setto il paragrafo [Transaction] del file ini
|
||||||
conf->set("Action","INSERT");
|
conf->set("Action","INSERT");
|
||||||
@ -201,55 +221,41 @@ void TImporta_saldi::transfer(const TFilename& file)
|
|||||||
conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
|
conf->set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
|
||||||
conf->set(MOV_CODCAUS, causale);
|
conf->set(MOV_CODCAUS, causale);
|
||||||
conf->set(MOV_DATAREG, dataop.stringa());
|
conf->set(MOV_DATAREG, dataop.stringa());
|
||||||
conf->set(MOV_DESCR, "Ripresa Saldi");
|
conf->set(MOV_DESCR, TR("Ripresa Saldi"));
|
||||||
nrow = 1;
|
nrow = 1;
|
||||||
lastgruppo = gruppo;
|
lastgruppo = bill.gruppo();
|
||||||
}
|
}
|
||||||
|
|
||||||
real val = s.get(SALDO_APERTURA).as_real();
|
const real val = s.get_real(CGC_SALDO_APERTURA);
|
||||||
|
|
||||||
TImporto impmov(val > ZERO ? 'D' : 'A', abs(val));
|
TImporto impmov(val > ZERO ? 'D' : 'A', abs(val));
|
||||||
const TImporto pdare('D', s.get(PROGR_DARE).as_real());
|
const TImporto pdare('D', s.get_real(CGC_PROGR_DARE));
|
||||||
const TImporto pavere('A', s.get(PROGR_AVERE).as_real());
|
const TImporto pavere('A', s.get_real(CGC_PROGR_AVERE));
|
||||||
|
|
||||||
impmov += pdare;
|
impmov += pdare;
|
||||||
impmov += pavere;
|
impmov += pavere;
|
||||||
|
|
||||||
if (impmov.valore() != ZERO)
|
if (!impmov.is_zero())
|
||||||
{
|
{
|
||||||
paragraph.format("%d,%d",LF_RMOV,nrow++);
|
set_rmov(*conf, nrow++, impmov, bill);
|
||||||
conf->set_paragraph(paragraph);
|
|
||||||
conf->set(RMV_SEZIONE, impmov.sezione());
|
|
||||||
conf->set(RMV_IMPORTO, impmov.valore().string());
|
|
||||||
conf->set(RMV_GRUPPO, gruppo);
|
|
||||||
conf->set(RMV_CONTO, conto);
|
|
||||||
conf->set(RMV_SOTTOCONTO, sottoconto);
|
|
||||||
totmov -= impmov;
|
totmov -= impmov;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (conf != NULL)
|
if (conf != NULL)
|
||||||
{
|
{
|
||||||
paragraph.format("%d,%d",LF_RMOV,nrow++);
|
set_rmov(*conf, nrow++, totmov, conto_ap);
|
||||||
conf->set_paragraph(paragraph);
|
|
||||||
conf->set(RMV_SEZIONE, totmov.sezione());
|
|
||||||
conf->set(RMV_IMPORTO, totmov.valore().string());
|
|
||||||
conf->set(RMV_GRUPPO, gruppoap);
|
|
||||||
conf->set(RMV_CONTO, contoap);
|
|
||||||
conf->set(RMV_SOTTOCONTO, sottocontoap);
|
|
||||||
delete conf;
|
delete conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yesno_box(FR("Si desidera confermare l'importazione di %ld movimenti"), ntran -1))
|
if (yesno_box(FR("Si desidera confermare l'importazione di %ld movimenti"), ntran -1))
|
||||||
{
|
{
|
||||||
TString app;
|
TFilename app = outdir;
|
||||||
|
app.add("lv41*.ini");
|
||||||
app << "cg2 -0 -i" << outdir << "/*.ini";
|
app.insert("cg2 -0 -i");
|
||||||
TExternal_app primanota(app);
|
TExternal_app primanota(app);
|
||||||
primanota.run(true);
|
primanota.run(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TImporta_saldi::create()
|
bool TImporta_saldi::create()
|
||||||
{
|
{
|
||||||
_msk = new TImporta_saldi_mask();
|
_msk = new TImporta_saldi_mask();
|
||||||
@ -277,12 +283,10 @@ void TImporta_saldi::main_loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TImporta_saldi& app() { return (TImporta_saldi&) main_app(); }
|
|
||||||
|
|
||||||
|
|
||||||
int lv4100 (int argc, char* argv[])
|
int lv4100 (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TImporta_saldi main_app;
|
TImporta_saldi main_app;
|
||||||
main_app.run(argc, argv, TR("Importazione contabilità Galileo"));
|
main_app.run(argc, argv, TR("Importazione contabilità COGECO"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
12
lv/lv4100.h
12
lv/lv4100.h
@ -1,8 +1,18 @@
|
|||||||
|
#ifndef __LV4100_H__
|
||||||
|
#define __LV4100_H__
|
||||||
|
|
||||||
|
#ifndef __TEXTSET_H__
|
||||||
|
#include <textset.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class TImporta_cogeco_recset : public TCSV_recordset
|
class TImporta_cogeco_recset : public TCSV_recordset
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
real get_real(int idx) const;
|
||||||
|
bool get_bill(TBill& bill) const;
|
||||||
TImporta_cogeco_recset(const char* query = "") : TCSV_recordset(TString("CSV(\";)\n") << query) {}
|
TImporta_cogeco_recset(const char* query = "") : TCSV_recordset(TString("CSV(\";)\n") << query) {}
|
||||||
virtual ~TImporta_cogeco_recset() {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
#include "lv4100a.h"
|
#include "lv4100a.h"
|
||||||
|
|
||||||
TOOLBAR "" 0 0 0 2
|
TOOLBAR "" 0 0 0 2
|
||||||
|
#include "elabar.h"
|
||||||
BUTTON DLG_ELABORA 10 2
|
|
||||||
BEGIN
|
|
||||||
PICTURE BMP_ELABORA
|
|
||||||
MESSAGE EXIT,K_ENTER
|
|
||||||
PROMPT -12 -1 "E~labora"
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_QUIT 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -22 -1 ""
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
TOOLBAR "" 0 21 0 2
|
TOOLBAR "" 0 21 0 2
|
||||||
@ -26,7 +14,7 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Importazione contabilità Galileo" 0 0 0 -3
|
PAGE "Importazione contabilità COGECO" 0 0 0 -3
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 90 3
|
GROUPBOX DLG_NULL 90 3
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -49,7 +37,7 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 90 5
|
GROUPBOX DLG_NULL 90 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 "@bSorgente"
|
PROMPT 2 4 "@bSorgente"
|
||||||
END
|
END
|
||||||
@ -84,7 +72,7 @@ END
|
|||||||
|
|
||||||
DATE F_DATAMOV
|
DATE F_DATAMOV
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 3 7 "Data mov. "
|
PROMPT 3 8 "Data mov. "
|
||||||
FIELD DataMov
|
FIELD DataMov
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
109
lv/lv4200.cpp
109
lv/lv4200.cpp
@ -27,18 +27,18 @@
|
|||||||
#include <rmov.h>
|
#include <rmov.h>
|
||||||
#include <rmoviva.h>
|
#include <rmoviva.h>
|
||||||
|
|
||||||
#define TIPO 0
|
#define CGC_TIPO 0
|
||||||
#define ANNO 1
|
#define CGC_ANNO 1
|
||||||
#define NUMEROPARTITA 2
|
#define CGC_NUMEROPARTITA 2
|
||||||
#define CODCF 3
|
#define CGC_CODCF 3
|
||||||
#define NUMERO REC. 4
|
#define CGC_NUMERO REC. 4
|
||||||
#define CAMBIO 5
|
#define CGC_CAMBIO 5
|
||||||
#define VALUTA 6
|
#define CGC_VALUTA 6
|
||||||
#define TIPODOC 7
|
#define CGC_TIPODOC 7
|
||||||
#define DATA_DOCUM 8
|
#define CGC_DATA_DOCUM 8
|
||||||
#define SCADENZA 9
|
#define CGC_SCADENZA 9
|
||||||
#define IMPORTO 10
|
#define CGC_IMPORTO 10
|
||||||
#define IMPORTO_VAL 11
|
#define CGC_IMPORTO_VAL 11
|
||||||
|
|
||||||
class TCausali_cache : public TCache
|
class TCausali_cache : public TCache
|
||||||
{
|
{
|
||||||
@ -116,56 +116,51 @@ bool TImporta_sc_mask::on_field_event(TOperable_field& f, TField_event e, long j
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// TSkeleton_application
|
// TSkeleton_application
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
class TImporta_sc : public TSkeleton_application
|
class TImporta_sc : public TSkeleton_application
|
||||||
{
|
{
|
||||||
virtual bool check_autorization() const {return false;}
|
TImporta_sc_mask* _msk;
|
||||||
virtual const char * extra_modules() const {return "ba";}
|
|
||||||
|
|
||||||
TImporta_sc_mask* _msk;
|
|
||||||
|
|
||||||
//protected:
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
void transfer(const TFilename& file);
|
void transfer(const TFilename& file);
|
||||||
|
|
||||||
TImporta_sc() {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void TImporta_sc::transfer(const TFilename& file)
|
void TImporta_sc::transfer(const TFilename& file)
|
||||||
{
|
{
|
||||||
TImporta_cogeco_recset s(file);
|
TImporta_cogeco_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;
|
||||||
int anno = 0;
|
int anno = 0;
|
||||||
int part;
|
int part = 0;
|
||||||
TPartita * game;
|
char tipocf = ' ';
|
||||||
|
long sottoconto = 0L;
|
||||||
|
TPartita* game = NULL;
|
||||||
TCausali_cache cache_causali;
|
TCausali_cache cache_causali;
|
||||||
TToken_string key;
|
TToken_string key;
|
||||||
const TString8 codcausc(_msk->get(F_CODCAUSC));
|
const TString4 codcausc(_msk->get(F_CODCAUSC));
|
||||||
const TString8 codcausf(_msk->get(F_CODCAUSF));
|
const TString4 codcausf(_msk->get(F_CODCAUSF));
|
||||||
TImporto totdoc;
|
TImporto totdoc;
|
||||||
|
for (bool ok=s.move_to(1);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 int a = s.get(CGC_ANNO).as_int();
|
||||||
const int a = s.get(ANNO).as_int();
|
const long p = s.get(CGC_NUMEROPARTITA).as_int();
|
||||||
const long p = s.get(NUMEROPARTITA).as_int();
|
const char t = s.get(CGC_CODCF).as_string()[0];
|
||||||
|
const long s = s.get(CGC_CODCF).as_int();
|
||||||
if (anno != a || p != part )
|
// leggo tutte le righe di partita e le metto in un array
|
||||||
|
if (anno != a || p != part || tipo != t || sottoconto != s)
|
||||||
{
|
{
|
||||||
anno = a;
|
anno = a;
|
||||||
part = p;
|
part = p;
|
||||||
|
tipocf = t;
|
||||||
|
sottoconto = s;
|
||||||
|
|
||||||
if (game != NULL)
|
if (game != NULL)
|
||||||
{
|
{
|
||||||
@ -173,69 +168,54 @@ void TImporta_sc::transfer(const TFilename& file)
|
|||||||
game->riga(r).put(PART_IMPTOTDOC, totdoc.valore());
|
game->riga(r).put(PART_IMPTOTDOC, totdoc.valore());
|
||||||
game->write();
|
game->write();
|
||||||
delete game;
|
delete game;
|
||||||
|
game = NULL;
|
||||||
}
|
}
|
||||||
game = NULL;
|
|
||||||
totdoc.reset();
|
totdoc.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char tipocf = s.get(CODCF).as_string()[0]; // ?? verificare
|
|
||||||
const long sottoconto = s.get(CODCF).as_int();
|
|
||||||
TToken_string key;
|
TToken_string key;
|
||||||
|
|
||||||
key.cut(0);
|
key.cut(0);
|
||||||
key.add(tipocf);
|
key.add(tipocf);
|
||||||
key.add(sottoconto);
|
key.add(sottoconto);
|
||||||
|
|
||||||
const TRectype & clifo = cache().get(LF_CLIFO, key);
|
const TRectype & clifo = cache().get(LF_CLIFO, key);
|
||||||
|
|
||||||
int gruppo = clifo.get_int(CLI_GRUPPO);
|
int gruppo = clifo.get_int(CLI_GRUPPO);
|
||||||
int conto = clifo.get_int(CLI_CONTO);
|
int conto = clifo.get_int(CLI_CONTO);
|
||||||
const TCausale & c = cache_causali.causale(tipocf == 'C' ? codcausc : codcausf, anno);
|
const TCausale& c = cache_causali.causale(tipocf == 'C' ? codcausc : codcausf, anno);
|
||||||
|
|
||||||
if (gruppo == 0)
|
if (gruppo == 0)
|
||||||
{
|
{
|
||||||
TBill cc;
|
TBill cc;
|
||||||
|
|
||||||
c.bill(1, cc);
|
c.bill(1, cc);
|
||||||
gruppo = cc.gruppo();
|
gruppo = cc.gruppo();
|
||||||
conto = cc.conto();
|
conto = cc.conto();
|
||||||
}
|
}
|
||||||
|
|
||||||
TBill codclifo(gruppo, conto, sottoconto);
|
TBill codclifo(gruppo, conto, sottoconto);
|
||||||
const int tipodoc = s.get(TIPODOC).as_int();
|
const int tipodoc = s.get(CGC_TIPODOC).as_int();
|
||||||
const TDate datadoc = s.get(DATA_DOCUM).as_date();
|
const TDate datadoc = s.get(CGC_DATA_DOCUM).as_date();
|
||||||
|
|
||||||
if (game == NULL)
|
if (game == NULL)
|
||||||
game = new TPartita(codclifo, anno, format("%7d", part));
|
game = new TPartita(codclifo, anno, format("%7d", part));
|
||||||
|
|
||||||
TRiga_partite& partita = game->new_row();
|
TRiga_partite& partita = game->new_row();
|
||||||
|
|
||||||
partita.put(PART_TIPOMOV, c.tipomov());
|
partita.put(PART_TIPOMOV, c.tipomov());
|
||||||
partita.put(PART_DATAREG, datadoc);
|
partita.put(PART_DATAREG, datadoc);
|
||||||
partita.put(PART_DATADOC, datadoc);
|
partita.put(PART_DATADOC, datadoc);
|
||||||
partita.put(PART_CODCAUS, c.codice());
|
partita.put(PART_CODCAUS, c.codice());
|
||||||
partita.put(PART_REG, c.reg().name());
|
partita.put(PART_REG, c.reg().name());
|
||||||
partita.put(PART_SEZ, c.sezione(1));
|
partita.put(PART_SEZ, c.sezione(1));
|
||||||
|
|
||||||
partita.put(PART_SOTTOCONTO, codclifo.sottoconto());
|
partita.put(PART_SOTTOCONTO, codclifo.sottoconto());
|
||||||
const TString8 codpag(clifo.get(MOV_CODPAG)); // ?? verificare
|
const TString8 codpag(clifo.get(CLIFO_CODPAG)); // ?? verificare
|
||||||
TPagamento pag(codpag);
|
TPagamento pag(codpag);
|
||||||
partita.put(PART_CODPAG, codpag);
|
//partita.put(PART_CODPAG, codpag);
|
||||||
partita.put(PART_TIPOPAG, pag.tipo_rata(0));
|
partita.put(PART_TIPOPAG, pag.tipo_rata(0));
|
||||||
|
|
||||||
partita.put(PART_GRUPPOCL, codclifo.gruppo());
|
partita.put(PART_GRUPPOCL, codclifo.gruppo());
|
||||||
partita.put(PART_CONTOCL, codclifo.conto());
|
partita.put(PART_CONTOCL, codclifo.conto());
|
||||||
|
|
||||||
const real val = s.get(IMPORTO).as_real();
|
const real val = s.get(CGC_IMPORTO).as_real();
|
||||||
TImporto importo(val.sign() < 0 ? 'A' : 'D', abs(val));
|
TImporto importo(val.sign() < 0 ? 'A' : 'D', abs(val));
|
||||||
importo.normalize(c.sezione(1));
|
importo.normalize(c.sezione(1));
|
||||||
totdoc += importo; // somma se e' fattura ??? verificare
|
totdoc += importo; // somma se e' fattura ??? verificare
|
||||||
partita.put(PART_IMPORTO, importo.valore());
|
partita.put(PART_IMPORTO, importo.valore());
|
||||||
|
|
||||||
TRiga_scadenze& scadenza = partita.new_row(); // ?? da fare
|
TRiga_scadenze& scadenza = partita.new_row(); // ?? da fare
|
||||||
|
|
||||||
scadenza.put(SCAD_CODPAG, codpag);
|
scadenza.put(SCAD_CODPAG, codpag);
|
||||||
scadenza.put(SCAD_DATASCAD, s.get(SCADENZA).as_string());
|
scadenza.put(SCAD_DATASCAD, s.get(CGC_SCADENZA).as_string());
|
||||||
scadenza.put(SCAD_IMPORTO, importo.valore());
|
scadenza.put(SCAD_IMPORTO, importo.valore());
|
||||||
scadenza.put(SCAD_TIPOPAG, partita.get(PART_TIPOPAG));
|
scadenza.put(SCAD_TIPOPAG, partita.get(PART_TIPOPAG));
|
||||||
}
|
}
|
||||||
@ -246,14 +226,11 @@ void TImporta_sc::transfer(const TFilename& file)
|
|||||||
game->write();
|
game->write();
|
||||||
delete game;
|
delete game;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TImporta_sc::create()
|
bool TImporta_sc::create()
|
||||||
{
|
{
|
||||||
_msk = new TImporta_sc_mask();
|
_msk = new TImporta_sc_mask();
|
||||||
|
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,13 +253,9 @@ void TImporta_sc::main_loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TImporta_sc& app() { return (TImporta_sc&) main_app(); }
|
|
||||||
|
|
||||||
|
|
||||||
int lv4200 (int argc, char* argv[])
|
int lv4200 (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TImporta_sc main_app;
|
TImporta_sc main_app;
|
||||||
main_app.run(argc, argv, TR("Importazione saldaconto"));
|
main_app.run(argc, argv, TR("Importazione saldaconto COGECO"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -5,4 +5,6 @@
|
|||||||
#define F_PATH 103
|
#define F_PATH 103
|
||||||
#define F_NAME 104
|
#define F_NAME 104
|
||||||
#define F_CODCAUSC 105
|
#define F_CODCAUSC 105
|
||||||
#define F_CODCAUSF 106
|
#define F_CODCAUSF 106
|
||||||
|
#define F_DESCRCAUSC 107
|
||||||
|
#define F_DESCRCAUSF 108
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
#include "lv4200a.h"
|
#include "lv4200a.h"
|
||||||
|
|
||||||
TOOLBAR "" 0 0 0 2
|
TOOLBAR "" 0 0 0 2
|
||||||
|
#include "elabar.h"
|
||||||
BUTTON DLG_ELABORA 10 2
|
|
||||||
BEGIN
|
|
||||||
PICTURE BMP_ELABORA
|
|
||||||
MESSAGE EXIT,K_ENTER
|
|
||||||
PROMPT -12 -1 "E~labora"
|
|
||||||
END
|
|
||||||
|
|
||||||
BUTTON DLG_QUIT 10 2
|
|
||||||
BEGIN
|
|
||||||
PROMPT -22 -1 ""
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
TOOLBAR "" 0 21 0 2
|
TOOLBAR "" 0 21 0 2
|
||||||
@ -26,7 +14,7 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Importazione saldaconto" 0 0 0 -3
|
PAGE "Importazione saldaconto COGECO" 0 0 0 -3
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 90 3
|
GROUPBOX DLG_NULL 90 3
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -69,6 +57,57 @@ BEGIN
|
|||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 90 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 8 "Causali"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_CODCAUSC 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 3 9 "Clienti "
|
||||||
|
FLAGS "UZ"
|
||||||
|
USE LF_CAUSALI
|
||||||
|
INPUT CODCAUS F_CODCAUSC
|
||||||
|
DISPLAY "Codice" CODCAUS
|
||||||
|
DISPLAY "Descrizione@60" DESCR
|
||||||
|
OUTPUT F_CODCAUSC CODCAUS
|
||||||
|
OUTPUT F_DESCRCAUSC DESCR
|
||||||
|
CHECKTYPE REEQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCRCAUSC 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 20 9 ""
|
||||||
|
USE LF_CAUSALI KEY 2
|
||||||
|
INPUT DESCR F_DESCRCAUSC
|
||||||
|
DISPLAY "Descrizione@60" DESCR
|
||||||
|
DISPLAY "Codice" CODCAUS
|
||||||
|
COPY OUTPUT F_CODCAUSC
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_CODCAUSF 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 3 10 "Fornitori "
|
||||||
|
FLAGS "UZ"
|
||||||
|
COPY USE F_CODCAUSC
|
||||||
|
INPUT CODCAUS F_CODCAUSF
|
||||||
|
COPY DISPLAY F_CODCAUSC
|
||||||
|
OUTPUT F_CODCAUSF CODCAUS
|
||||||
|
OUTPUT F_DESCRCAUSF DESCR
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCRCAUSF 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 20 10 ""
|
||||||
|
COPY USE F_DESCRCAUSC
|
||||||
|
INPUT DESCR F_DESCRCAUSF
|
||||||
|
COPY DISPLAY F_DESCRCAUSC
|
||||||
|
COPY OUTPUT F_CODCAUSF
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user