Patch level : 10.0 285
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 3.2 patch 1358 git-svn-id: svn://10.65.10.50/trunk@18723 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ae84547dcd
commit
d2e77b63fb
@ -1239,18 +1239,18 @@ bool TStampaPerCategorie::user_create()
|
||||
add_cursor(new TSorted_cursor(_rel,"SOG_CODSEZ|SOG_CODSOT","",3));
|
||||
_msk = new TMask("at2700a");
|
||||
|
||||
TFilename filename = "filecat";
|
||||
TFilename filename = "at2700";
|
||||
filename.ext("dbf");
|
||||
TFilename filetrr = "filecat";
|
||||
TFilename filetrr = "at2700";
|
||||
filetrr.ext("trr");
|
||||
if (!filetrr.custom_path())
|
||||
{
|
||||
filetrr = "recdesc/filecat";
|
||||
filetrr = "recdesc/at2700";
|
||||
filetrr.ext("trr");
|
||||
}
|
||||
_file = new TExternisamfile(filename, filetrr, FALSE);
|
||||
|
||||
TFilename namepers("filepers");
|
||||
TFilename namepers("at2700");
|
||||
namepers.ext("dbf");
|
||||
if (namepers.exist())
|
||||
_filepers = new TExternisamfile(namepers);
|
||||
|
12
at/at2700.trr
Executable file
12
at/at2700.trr
Executable file
@ -0,0 +1,12 @@
|
||||
1001
|
||||
8
|
||||
CODICE|3|8|0|Codice
|
||||
COGNOME|1|25|0|Cognome
|
||||
NOME|1|25|0|Nome
|
||||
SPOSATA|1|25|0|Cognome da sposata
|
||||
INDIRIZZO|1|30|0|Indirizzo
|
||||
STRADARIO|1|5|0|Stradario
|
||||
PRESSO|1|30|0|Presso
|
||||
LOCALITA|1|80|0|CAP, Localita, Prov.
|
||||
1
|
||||
CODICE|X
|
@ -593,11 +593,15 @@ bool TFrequenza::user_create()
|
||||
_form_eti = new TEti_freq_form(etformato);
|
||||
_stampa80 = config.get_bool("Stampa80");
|
||||
_form_let = new TEti_freq_form("ATLETTER");
|
||||
TFilename freqname = "file";
|
||||
TFilename freqname = "at2900";
|
||||
freqname.ext("dbf");
|
||||
TFilename freqtrr = "file";
|
||||
TFilename freqtrr = "at2900";
|
||||
freqtrr.ext("trr");
|
||||
freqtrr.custom_path();
|
||||
if (!freqtrr.custom_path())
|
||||
{
|
||||
freqtrr = "recdesc/at2900";
|
||||
freqtrr.ext("trr");
|
||||
}
|
||||
_file = new TExternisamfile(freqname, freqtrr, FALSE);
|
||||
|
||||
return TRUE;
|
||||
|
13
at/at2900.trr
Executable file
13
at/at2900.trr
Executable file
@ -0,0 +1,13 @@
|
||||
1001
|
||||
9
|
||||
CODICE|3|8|0|Codice
|
||||
COGNOME|1|25|0|Cognome
|
||||
NOME|1|25|0|Nome
|
||||
NOMINATIVO|1|100|0|Nominativo x famiglie
|
||||
SPOSATA|1|25|0|Cognome da sposata
|
||||
INDIRIZZO|1|30|0|Indirizzo
|
||||
STRADARIO|1|5|0|Stradario
|
||||
PRESSO|1|30|0|Presso
|
||||
LOCALITA|1|80|0|CAP, Localita, Prov.
|
||||
1
|
||||
CODICE
|
@ -105,13 +105,14 @@ protected:
|
||||
|
||||
const TString& find_comune(const TRecordset& soggetti) const;
|
||||
const TString& find_dencom_nasc(const TString& codcom) const;
|
||||
void crea_prima_riga(TEsporta_ON_recordset& csv, const TString& sezini, const TString& sezfin) const;
|
||||
|
||||
public:
|
||||
void esporta_soggetti(const TMask& msk) const;
|
||||
|
||||
};
|
||||
|
||||
void TEsporta_ON_app::esporta_soggetti(const TMask& m) const
|
||||
void TEsporta_ON_app::crea_prima_riga(TEsporta_ON_recordset& csv, const TString& sezini, const TString& sezfin) const
|
||||
{
|
||||
TConfig config("at9600a.ini");
|
||||
// query su soggetti
|
||||
@ -130,20 +131,45 @@ void TEsporta_ON_app::esporta_soggetti(const TMask& m) const
|
||||
// query su sezioni per stabilire cosa scrivere nel primo record
|
||||
// elenco delle sezioni trasferite separate da ','
|
||||
TString querysez;
|
||||
querysez << "USE SEZIONI";
|
||||
querysez << "USE SEZIONI\nSELECT CODSOT=''";
|
||||
if (sezini.not_empty())
|
||||
querysez << "\nFROM CODSEZ=\"" << sezini << "\"";
|
||||
if (sezini.not_empty())
|
||||
querysez << "\nTO CODSEZ=\"" << sezfin << "\"";
|
||||
TISAM_recordset sezioni(querysez);
|
||||
|
||||
TEsporta_ON_recordset csv;
|
||||
|
||||
// crea testata
|
||||
TToken_string ts("", ',');
|
||||
for (bool oks = sezioni.move_first(); oks; oks = sezioni.move_next())
|
||||
ts.add(sezioni.get(SEZ_CODSEZ).as_string());
|
||||
csv.new_rec(ts);
|
||||
}
|
||||
|
||||
void TEsporta_ON_app::esporta_soggetti(const TMask& m) const
|
||||
{
|
||||
TConfig config("at9600a.ini");
|
||||
|
||||
//query su sezioni
|
||||
const TString4 sezini = m.get(F_SEZINI);
|
||||
const TString4 sotini = m.get(F_SOTINI);
|
||||
const TString4 sezfin = m.get(F_SEZFIN);
|
||||
const TString4 sotfin = m.get(F_SOTFIN);
|
||||
TEsporta_ON_recordset csv;
|
||||
//crea la prima stupida riga
|
||||
crea_prima_riga(csv, sezini, sezfin);
|
||||
|
||||
|
||||
// query su soggetti
|
||||
TString query;
|
||||
query << "USE SOGGETTI KEY 3";
|
||||
|
||||
const TDate data = m.get_date(F_DATA);
|
||||
if (sezini.not_empty())
|
||||
query << "\nFROM CODSEZ=\"" << sezini << "\"";
|
||||
if (sezini.not_empty())
|
||||
query << "\nTO CODSEZ=\"" << sezfin << "\"";
|
||||
|
||||
TISAM_recordset soggetti(query);
|
||||
|
||||
const int items = soggetti.items();
|
||||
TProgind pi(items, "Estrazione soggetti...", true, true);
|
||||
@ -156,10 +182,12 @@ void TEsporta_ON_app::esporta_soggetti(const TMask& m) const
|
||||
const TString4& catdon = soggetti.get(SOG_CATDON).as_string();
|
||||
const TDate dataisc = soggetti.get(SOG_DATAISC).as_date();
|
||||
const bool passa = config.get_bool(catdon, "CATEGORIE");
|
||||
|
||||
const TString4& codsez = soggetti.get(SOG_CODSEZ).as_string();
|
||||
TString16 sez_on = config.get(codsez, "SEZIONI");
|
||||
if (sez_on.empty())
|
||||
sez_on = codsez;
|
||||
if (sez_on.empty())
|
||||
sez_on = codsez;
|
||||
|
||||
//if ((catdon == "01" || catdon == "04") && (dataisc.empty() || dataisc <= data))
|
||||
if (passa && (dataisc.empty() || dataisc <= data))
|
||||
{
|
||||
|
@ -50,4 +50,4 @@ AV=X
|
||||
DA=X
|
||||
|
||||
[GENERALE]
|
||||
NOMEFILE = reggioe.txt
|
||||
NOMEFILE = rimini.txt
|
@ -59,7 +59,7 @@ public:
|
||||
void ripristina_trasfer();
|
||||
void trasfer2tempfile();
|
||||
long leggi_tabella_tras();
|
||||
void componi_path(TMask*);
|
||||
bool componi_path(const TMask&);
|
||||
bool video_ripartenza();
|
||||
void ditta_ricevente();
|
||||
bool ripartenza();
|
||||
@ -131,23 +131,20 @@ bool TRic_archivi::destroy()
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
void TRic_archivi::componi_path(TMask* msk)
|
||||
bool TRic_archivi::componi_path(const TMask& msk)
|
||||
{
|
||||
TFilename path = msk->get(F_PATHNAME);
|
||||
TFilename path = msk.get(F_PATHNAME);
|
||||
|
||||
const TString8 drive = msk->get(F_DRIVE);
|
||||
const TString& drive = msk.get(F_DRIVE);
|
||||
// Inizio cazzata - da sostituire con _disketto = ::os_is_removable_drive(drive)
|
||||
if (drive == "A:" || drive == "B:")
|
||||
_disketto = TRUE;
|
||||
else
|
||||
_disketto = false;
|
||||
_disketto = drive == "A:" || drive == "B:";
|
||||
// Fine cazzata
|
||||
|
||||
const int pos = path.find(':');
|
||||
if (pos)
|
||||
path = path.mid(pos+1);
|
||||
|
||||
if (path.not_empty())
|
||||
if (path.full())
|
||||
{
|
||||
_marker << drive << "\\" << path << "\\marker";
|
||||
_trasfer << drive << "\\" << path << "\\trasfer";
|
||||
@ -161,6 +158,8 @@ void TRic_archivi::componi_path(TMask* msk)
|
||||
if (!_disketto)
|
||||
_pathname << drive << "\\";
|
||||
}
|
||||
|
||||
return _disketto;
|
||||
}
|
||||
|
||||
bool TRic_archivi::leggi_marker()
|
||||
@ -348,19 +347,17 @@ void TRic_archivi::main_loop()
|
||||
{
|
||||
if (_scelta == 'S')
|
||||
{
|
||||
TMask maskera("cg6400b");
|
||||
TMask* msk = &maskera;
|
||||
|
||||
KEY tasto = msk->run();
|
||||
TMask maskera("cg6400b");
|
||||
KEY tasto = maskera.run();
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
componi_path(msk);
|
||||
componi_path(maskera);
|
||||
|
||||
do
|
||||
{
|
||||
if (_disketto)
|
||||
{
|
||||
char drive = msk->get(F_DRIVE)[0];
|
||||
char drive = maskera.get(F_DRIVE)[0];
|
||||
if (yesno_box(FR("Inserire il dischetto %d nell' unita' %c"), _numdisk,drive))
|
||||
{
|
||||
if (!leggi_marker())
|
||||
@ -403,31 +400,28 @@ void TRic_archivi::main_loop()
|
||||
_tras_file->close(); // Chiude il trasfer letto dalla directory della ditta
|
||||
::remove(_trasf);
|
||||
TFilename tab = _tras_file->path(_dittaric);
|
||||
TFilename tabcdx = tab;
|
||||
TFilename tabdbf = tab;
|
||||
tabcdx.add("ttab.cdx");
|
||||
tabdbf.add("ttab.dbf");
|
||||
::remove(tabcdx);
|
||||
::remove(tabdbf);
|
||||
TFilename tabcdx = tab; tabcdx.add("ttab.cdx");
|
||||
TFilename tabdbf = tab; tabdbf.add("ttab.dbf");
|
||||
tabcdx.fremove();
|
||||
tabdbf.fremove();
|
||||
}
|
||||
}
|
||||
else
|
||||
if (_scelta == 'P')
|
||||
{
|
||||
TMask maskera("cg6400b");
|
||||
TMask* msk = &maskera;
|
||||
|
||||
KEY tasto = msk->run();
|
||||
|
||||
KEY tasto = maskera.run();
|
||||
|
||||
if (tasto == K_ENTER)
|
||||
{
|
||||
componi_path(msk);
|
||||
componi_path(maskera);
|
||||
|
||||
do
|
||||
{
|
||||
if (_disketto)
|
||||
{
|
||||
char drive = msk->get(F_DRIVE)[0];
|
||||
char drive = maskera.get(F_DRIVE)[0];
|
||||
if (yesno_box(FR("Inserire il dischetto %d nell' unita' %c"), _numdisk,drive))
|
||||
{
|
||||
if (!leggi_marker_rep())
|
||||
|
123
cg/cglib04.cpp
123
cg/cglib04.cpp
@ -485,12 +485,12 @@ bool TTransfer_file::read_control_rec()
|
||||
if (_tiporec != " 1")
|
||||
return false;
|
||||
|
||||
_nome_simb = _control_rec->sub(60,70);
|
||||
_ditta = atol(_control_rec->sub(70,75));
|
||||
_nultras = atoi(_control_rec->sub(75,78));
|
||||
_nome_simb = _control_rec->sub(60,70);
|
||||
_ditta = atol(_control_rec->sub(70,75));
|
||||
_nultras = atoi(_control_rec->sub(75,78));
|
||||
|
||||
const TString& tmp = _control_rec->sub(78,86);
|
||||
_dataultras = converti(tmp,true);
|
||||
_dataultras = converti(tmp, true);
|
||||
|
||||
_sigle_file = _control_rec->sub(86,95); _sigle_file.rtrim();
|
||||
_nrec_file = _control_rec->sub(95,149);
|
||||
@ -568,6 +568,7 @@ int TTransfer_file::lenrec(char sigla)
|
||||
return lenrec(i);
|
||||
}
|
||||
|
||||
/*
|
||||
long TTransfer_file::start(char sigla)
|
||||
{
|
||||
const int i = num(sigla);
|
||||
@ -576,34 +577,32 @@ long TTransfer_file::start(char sigla)
|
||||
|
||||
long TTransfer_file::start(int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return 1;
|
||||
else
|
||||
long s = 1;
|
||||
if (i > 0)
|
||||
{
|
||||
TToken_string& data = (TToken_string&)_index[i-1];
|
||||
return data.get_long(1) + 1;
|
||||
s += data.get_long(1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
long TTransfer_file::rec(int i)
|
||||
{
|
||||
long rec = 1;
|
||||
if (i > 0)
|
||||
{
|
||||
TToken_string& data = (TToken_string&)_index[i-1];
|
||||
rec += data.get_long(1);
|
||||
}
|
||||
return rec;
|
||||
}*/
|
||||
|
||||
long TTransfer_file::end(int i)
|
||||
{
|
||||
TToken_string& data = (TToken_string&)_index[i];
|
||||
return data.get_long(4);
|
||||
}
|
||||
|
||||
long TTransfer_file::rec(int i)
|
||||
{
|
||||
long rec = 1;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
TToken_string& data = (TToken_string&)_index[i-1];
|
||||
rec = (data.get_long(1)) + 1;
|
||||
}
|
||||
|
||||
return rec;
|
||||
}
|
||||
|
||||
int TTransfer_file::num(char sigla)
|
||||
{
|
||||
const int items = _index.items();
|
||||
@ -658,7 +657,7 @@ void TTransfer_file::readat(long recnum)
|
||||
int TTransfer_file::read_rec_trasfer(long numrec, int size)
|
||||
{
|
||||
go2rec(numrec);
|
||||
const word letti = fread((char*)(const char*)_record,sizeof(char),size,_trasfer);
|
||||
const size_t letti = fread(_record.get_buffer(), sizeof(char), size, _trasfer);
|
||||
return letti;
|
||||
}
|
||||
|
||||
@ -706,15 +705,14 @@ void TTransfer_file::put(const char* val, const char* file, int fieldnum,long re
|
||||
int TTransfer_file::write(long numrec, int size)
|
||||
{
|
||||
go2rec(numrec);
|
||||
const word scritti = fwrite((char*)(const char*)_record,sizeof(char),size,_trasfer);
|
||||
const size_t scritti = fwrite(_record,sizeof(char),size,_trasfer);
|
||||
return scritti;
|
||||
}
|
||||
|
||||
void TTransfer_file::writeat(const char* str,int size,int fieldnum,const char* file)
|
||||
{
|
||||
go2field(fieldnum,file);
|
||||
|
||||
const int nscritti = fwrite (str,1,size,_trasfer);
|
||||
const size_t nscritti = fwrite (str,1,size,_trasfer);
|
||||
}
|
||||
|
||||
void TTransfer_file::writeat(const char* str,int size,int fieldnum,const char* file, const long nrec)
|
||||
@ -868,12 +866,13 @@ void TTransfer_file::annulla_classi(int g, int c,bool conto)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// La gogna e' troppo poco: inguardabile!
|
||||
// Pointer e reference ben conditi con scansioni inutili della tabella ESC!
|
||||
int TTransfer_file::dataes(const TDate& d, int* prevesc, TDate& finesp)
|
||||
{
|
||||
*prevesc = 0;
|
||||
|
||||
|
||||
TTable esc("ESC");
|
||||
for (int err = esc.first(); err == NOERR; err = esc.next())
|
||||
{
|
||||
@ -887,6 +886,7 @@ int TTransfer_file::dataes(const TDate& d, int* prevesc, TDate& finesp)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
char TTransfer_file::TipoConto(int g, int c)
|
||||
{
|
||||
@ -2032,21 +2032,12 @@ int TTransfer_file::ultima_riga_partita(TString& record)
|
||||
|
||||
void TTransfer_file::write_tmp_movSC(TString& record)
|
||||
{
|
||||
TString annostr;
|
||||
|
||||
_nregSC = atol(record.sub(2,8));
|
||||
_numrigSC = atoi(record.sub(8,10));
|
||||
TString app (record.sub(26,28));
|
||||
int anno = atoi(app);
|
||||
if (anno < 80)
|
||||
annostr = "20";
|
||||
else
|
||||
annostr = "19";
|
||||
annostr << app;
|
||||
_annoSC = atoi(annostr);
|
||||
_annoSC = 2000 + atoi(record.sub(26,28));
|
||||
_numpartSC = record.sub(28,35);
|
||||
|
||||
int tipomov = atoi(record.sub(37,38));
|
||||
const int tipomov = atoi(record.sub(37,38));
|
||||
|
||||
if (_nregSC != _nregSC_p || _numrigSC != _numrigSC_p ||
|
||||
_annoSC != _annoSC_p || _numpartSC != _numpartSC_p)
|
||||
@ -2199,9 +2190,9 @@ void TTransfer_file::partita(TString& record)
|
||||
|
||||
do
|
||||
{
|
||||
int from = trc.from(key);
|
||||
int to = trc.to(key);
|
||||
TString16 fname = trc.field_name(key);
|
||||
const int from = trc.from(key);
|
||||
const int to = trc.to(key);
|
||||
const TString16 fname = trc.field_name(key);
|
||||
TString field = record.sub(from-1,to);
|
||||
int flag = trc.flag(key);
|
||||
int dec = trc.flag_bis(key);
|
||||
@ -2310,7 +2301,7 @@ void TTransfer_file::partita(TString& record)
|
||||
|
||||
if (flag == 2)
|
||||
{
|
||||
TString f = converti(field,false);
|
||||
const TString& f = converti(field,false);
|
||||
_deppart->put(fname,f);
|
||||
}
|
||||
else
|
||||
@ -2367,17 +2358,17 @@ void TTransfer_file::calcola_importo(TString& record)
|
||||
_tpart->readat(rec);
|
||||
}
|
||||
|
||||
// Scrive scadenza da record di sistema a record di file temporaneo
|
||||
void TTransfer_file::scadenza(TString& record)
|
||||
{
|
||||
const TMappa_trc& trc = mappa();
|
||||
TString sigla,key,app_imp,app_val;
|
||||
TString key,app_imp,app_val;
|
||||
int numfield = 150;
|
||||
TString tipoc;
|
||||
static bool prima_volta = true;
|
||||
|
||||
int tipomov = atoi(record.sub(37,38));
|
||||
|
||||
sigla = record.mid(0,2);
|
||||
const TString4 sigla = record.mid(0,2);
|
||||
key.format("%2s%d", (const char*)sigla,numfield);
|
||||
|
||||
if (trc.is_key((const char *) key))
|
||||
@ -2388,14 +2379,14 @@ void TTransfer_file::scadenza(TString& record)
|
||||
|
||||
do
|
||||
{
|
||||
int from = trc.from(key);
|
||||
int to = trc.to(key);
|
||||
TString fname = trc.field_name(key);
|
||||
const int from = trc.from(key);
|
||||
const int to = trc.to(key);
|
||||
const TString16 fname = trc.field_name(key);
|
||||
TString field = record.sub(from-1,to);
|
||||
int flag = trc.flag(key);
|
||||
int dec = trc.flag_bis(key);
|
||||
|
||||
TRecfield campo (*_depscad,fname);
|
||||
const TRecfield campo (*_depscad,fname);
|
||||
if (campo.type() == _realfld)
|
||||
{
|
||||
negativo(field);
|
||||
@ -3182,21 +3173,21 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
|
||||
_tmppart << path();
|
||||
_tmppart.add(TEMP_PART);
|
||||
_tpart = new TIsamtempfile(LF_PARTITE, _tmppart, true);
|
||||
//_deppart = new TRectype(LF_PARTITE);
|
||||
|
||||
trec.get(LF_PARTITE);
|
||||
_deppart = new TExtrectype (trec);
|
||||
_tmpscad = "%";
|
||||
_tmpscad << path();
|
||||
_tmpscad.add(TEMP_SCAD);
|
||||
_tscad = new TIsamtempfile(LF_SCADENZE, _tmpscad, true);
|
||||
//_depscad = new TRectype (LF_SCADENZE);
|
||||
|
||||
trec.get(LF_SCADENZE);
|
||||
_depscad = new TExtrectype (trec);
|
||||
_tmppagsca = "%";
|
||||
_tmppagsca << path();
|
||||
_tmppagsca << "\\" << TEMP_PAGSCA;
|
||||
_tpagsca = new TIsamtempfile(LF_PAGSCA, _tmppagsca, true);
|
||||
//_deppagsca = new TRectype (LF_PAGSCA);
|
||||
|
||||
trec.get(LF_PAGSCA);
|
||||
_deppagsca = new TExtrectype (trec);
|
||||
nrec_salda = atol(nrec.mid(pos*6,6));
|
||||
@ -3450,7 +3441,6 @@ void TTransfer_file::scrivi_IVA(long nrec)
|
||||
|
||||
_ttab->zero();
|
||||
_ttab->put("CODTAB", "U1");
|
||||
|
||||
for (int err = _ttab->read(_isgteq); err == NOERR; err = _ttab->next())
|
||||
{
|
||||
const TString& trec = _ttab->get("CODTAB").left(2);
|
||||
@ -3462,6 +3452,7 @@ void TTransfer_file::scrivi_IVA(long nrec)
|
||||
delete _prog;
|
||||
}
|
||||
|
||||
// Tarsferimento saldaconto da sistema
|
||||
void TTransfer_file::scrivi_SC(long nrec)
|
||||
{
|
||||
TString buffer(sizeT);
|
||||
@ -3595,15 +3586,14 @@ bool TTransfer_file::fcopytemp_PC(const char* orig, const char* dest)
|
||||
_tmppagsca.add(TEMP_PAGSCA);
|
||||
|
||||
_tpart = new TIsamtempfile(LF_PARTITE, _tmppart, true);
|
||||
//_deppart = new TRectype (LF_PARTITE);
|
||||
trec.get(LF_PARTITE);
|
||||
_deppart = new TExtrectype (trec);
|
||||
|
||||
_tscad = new TIsamtempfile(LF_SCADENZE, _tmpscad, true);
|
||||
//_depscad = new TRectype (LF_SCADENZE);
|
||||
trec.get(LF_SCADENZE);
|
||||
_depscad = new TExtrectype (trec);
|
||||
|
||||
_tpagsca = new TIsamtempfile(LF_PAGSCA, _tmppagsca, true);
|
||||
//_deppagsca = new TRectype (LF_PAGSCA);
|
||||
trec.get(LF_PAGSCA);
|
||||
_deppagsca = new TExtrectype (trec);
|
||||
}
|
||||
@ -4621,7 +4611,7 @@ static void align_numpart(char tipocf, TString& numpart)
|
||||
numpart.trim();
|
||||
}
|
||||
|
||||
void TTransfer_file::write_partite(TString& record)
|
||||
void TTransfer_file::write_partite(const TString& record)
|
||||
{
|
||||
TString sigla,key;
|
||||
int numfield = 1;
|
||||
@ -4815,13 +4805,15 @@ void TTransfer_file::write_partite(TString& record)
|
||||
_prog->addstatus(1);
|
||||
}
|
||||
|
||||
void TTransfer_file::write_scadenze(TString& record)
|
||||
// Trasferisce record scadenze da record trasfer PC a tscad.dbf
|
||||
void TTransfer_file::write_scadenze(const TString& record)
|
||||
{
|
||||
TString sigla,key;
|
||||
int numfield = 1;
|
||||
const TMappa_trc& trc = mappa();
|
||||
|
||||
const TString4 sigla = record.mid(0,2);
|
||||
int numfield = 1;
|
||||
|
||||
sigla = record.mid(0,2);
|
||||
TString8 key;
|
||||
key.format("%2s%d", (const char*)sigla,numfield);
|
||||
|
||||
_depscad->zero();
|
||||
@ -4916,7 +4908,7 @@ void TTransfer_file::write_scadenze(TString& record)
|
||||
|
||||
if (flag == 2)
|
||||
{
|
||||
TString f = converti(field,true);
|
||||
TString80 f = converti(field,true);
|
||||
_depscad->put(fname,f);
|
||||
}
|
||||
else
|
||||
@ -4946,7 +4938,7 @@ void TTransfer_file::write_scadenze(TString& record)
|
||||
_prog->addstatus(1);
|
||||
}
|
||||
|
||||
void TTransfer_file::write_pagsca(TString& record)
|
||||
void TTransfer_file::write_pagsca(const TString& record)
|
||||
{
|
||||
TString sigla,key;
|
||||
int numfield = 1;
|
||||
@ -5109,17 +5101,18 @@ void TTransfer_file::write_pagsca(TString& record)
|
||||
|
||||
bool TMappa_trc::leggi_modulo(const char* tracciato)
|
||||
{
|
||||
TFilename trcini(tracciato); trcini.custom_path();
|
||||
TScanner s(trcini);
|
||||
TString16 key;
|
||||
TString4 sigla;
|
||||
TScanner s(tracciato);
|
||||
while (s.ok())
|
||||
{
|
||||
const TString& line = s.line();
|
||||
if (line[0] == '#') continue; //Perche' e' un commento
|
||||
|
||||
TToken_string* record = new TToken_string(line);
|
||||
sigla = record->get(0);
|
||||
long numrec = record->get_long(1);
|
||||
record->get(0, sigla);
|
||||
const int numrec = record->get_int(1);
|
||||
key.format("%2s%d", (const char*)sigla,numrec);
|
||||
|
||||
add(key, record);
|
||||
|
14
cg/cglib04.h
14
cg/cglib04.h
@ -99,7 +99,6 @@ class TRic_recfield : public TObject
|
||||
virtual ~TRic_recfield() {}
|
||||
};
|
||||
|
||||
|
||||
class TMappa_trc : public TAssoc_array
|
||||
{
|
||||
public :
|
||||
@ -111,9 +110,6 @@ public :
|
||||
const char* field_name (const char* key) const;
|
||||
int flag (const char* key) const;
|
||||
int flag_bis (const char* key) const;
|
||||
|
||||
TMappa_trc() {};
|
||||
virtual ~TMappa_trc() {}
|
||||
};
|
||||
|
||||
class TTransfer_file
|
||||
@ -246,9 +242,9 @@ private:
|
||||
void write_righe_contabili(const TString& record);
|
||||
void write_righe_IVA(TString& record);
|
||||
// Funzioni utilizzate per la ricezione Saldaconto da PC
|
||||
void write_partite(TString& record);
|
||||
void write_scadenze(TString& record);
|
||||
void write_pagsca(TString& record);
|
||||
void write_partite(const TString& record);
|
||||
void write_scadenze(const TString& record);
|
||||
void write_pagsca(const TString& record);
|
||||
|
||||
int annoes_PC(const TString& data) const;
|
||||
void causale(TString& cau,TString& tipo,TString& descr);
|
||||
@ -335,10 +331,10 @@ public:
|
||||
long nrec(int i); // Ritorna il numero di record di quel file
|
||||
int lenrec(int i); // Ritorna la lunghezza del record del trasfer corrispondente a quel file
|
||||
int lenrec(char sigla); // Ritorna la stessa cosa ma con la sigla invece del numero
|
||||
long start(int i); // Inizio del file numero i
|
||||
// long start(int i); // Inizio del file numero i
|
||||
long start(char sigla); // Inizio del file sigla
|
||||
long end(int i); // Ritorna la posizione in byte corrispondente alla fine di quel file all'interno del trasfer
|
||||
long rec(int i);
|
||||
//long rec(int i);
|
||||
|
||||
long tot_rec() const { return _tot_rec; }
|
||||
|
||||
|
@ -340,6 +340,10 @@ B1|160|116|116|29|ULTCLASS|||
|
||||
B1|161|117|127|29|IMPORTO|||
|
||||
B1|162|128|140|29|IMPORTOVAL|3|3|
|
||||
B1|163|141|146|29|DATASCAD|2||
|
||||
B1|164|201|205|29|CODABIPR|||
|
||||
B1|165|206|210|29|CODCABPR|||
|
||||
B1|166|211|215|29|CODABI|||
|
||||
B1|167|216|220|29|CODCAB|||
|
||||
#
|
||||
# Tracciato Pagamenti scadenze
|
||||
#
|
||||
@ -355,3 +359,7 @@ B1|208|153|153|30|SEZ|||
|
||||
B1|209|117|127|30|IMPORTO|||
|
||||
B1|210|128|140|30|IMPORTOVAL|3|3|
|
||||
B1|211|1|1|30|IMP|||
|
||||
B1|164|201|205|30|CODABIPR|||
|
||||
B1|165|206|210|30|CODCABPR|||
|
||||
B1|166|211|215|30|CODABI|||
|
||||
B1|167|216|220|30|CODCAB|||
|
||||
|
@ -80,6 +80,7 @@ Trasferimento dati contabili
|
||||
Trasferimento commesse
|
||||
Importazione fatture di acquisto
|
||||
Importazione fatture di vendita
|
||||
Importazione spese
|
||||
|
||||
PS0816 AeC
|
||||
Caricamento listino personalizzato per AeC.
|
||||
|
@ -11,6 +11,7 @@ int main(int argc, char** argv)
|
||||
case 1: ps0713200(argc, argv); break; //Trasferimento commesse
|
||||
case 2: ps0713300(argc, argv); break; //Importazione fatture di acquisto per ATS
|
||||
case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita per ATS
|
||||
case 4: ps0713500(argc, argv); break; //Importazione spese per ATS
|
||||
default:
|
||||
ps0713100(argc, argv); break; //Trasferimento dati contabili per ATS
|
||||
}
|
||||
|
@ -2,3 +2,4 @@ int ps0713100(int argc, char* argv[]);
|
||||
int ps0713200(int argc, char* argv[]);
|
||||
int ps0713300(int argc, char* argv[]);
|
||||
int ps0713400(int argc, char* argv[]);
|
||||
int ps0713500(int argc, char* argv[]);
|
||||
|
314
ps/ps0713500.cpp
Executable file
314
ps/ps0713500.cpp
Executable file
@ -0,0 +1,314 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <execp.h>
|
||||
#include <progind.h>
|
||||
#include <reputils.h>
|
||||
#include <utility.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
#include <textset.h>
|
||||
#include <recarray.h>
|
||||
|
||||
|
||||
#include "tabutil.h"
|
||||
|
||||
#include "ps0713.h"
|
||||
#include "ps0713500a.h"
|
||||
|
||||
#include <rcausali.h>
|
||||
#include <clifo.h>
|
||||
#include <mov.h>
|
||||
#include <rmov.h>
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAutomask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TImportaSpese_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TImportaSpese_mask();
|
||||
};
|
||||
|
||||
TImportaSpese_mask::TImportaSpese_mask() :TAutomask ("ps0713500a")
|
||||
{
|
||||
}
|
||||
|
||||
bool TImportaSpese_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("*.csv"); //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;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
//// CLASSI DERIVATE PER IMPORTAZIONE DATI ////
|
||||
///////////////////////////////////////////////
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Recordset specifici per i dati da trasferire
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
//Piano dei conti
|
||||
class TImporta_spese_recordset : public TCSV_recordset
|
||||
{
|
||||
protected:
|
||||
virtual TRecnotype new_rec(const char* buf = NULL);
|
||||
|
||||
public:
|
||||
TImporta_spese_recordset(const char * fileName);
|
||||
};
|
||||
|
||||
TRecnotype TImporta_spese_recordset::new_rec(const char* buf)
|
||||
{
|
||||
TToken_string str(256,'\t'); //nuovo record tab separator
|
||||
|
||||
if(buf && *buf)
|
||||
{
|
||||
bool apici=false;
|
||||
|
||||
for (const char* c = buf; *c ; c++)
|
||||
{
|
||||
if (*c == '"')
|
||||
{
|
||||
apici = !apici;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*c == ',')
|
||||
{
|
||||
if (!apici)
|
||||
str << str.separator();
|
||||
else
|
||||
str << *c;
|
||||
}
|
||||
else
|
||||
str << *c;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const TRecnotype n = TText_recordset::new_rec(str);
|
||||
|
||||
if (n >= 0)
|
||||
row(n).separator(str.separator());
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
TImporta_spese_recordset::TImporta_spese_recordset(const char * fileName)
|
||||
: TCSV_recordset("CSV(,)")
|
||||
{
|
||||
load_file(fileName);
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
// TSkeleton_application
|
||||
///////////////////////////////////////
|
||||
class TSpeseCSV : public TSkeleton_application
|
||||
{
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
protected:
|
||||
void chiudi_movimento(TConfig& configfile, TImporto& tot_doc, TDate& data);
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
bool transfer(const TMask& msk);
|
||||
|
||||
TSpeseCSV() {};
|
||||
};
|
||||
|
||||
const char* const nomeini = "ps0713500ats.ini"; //non si conosce il perchè
|
||||
|
||||
void TSpeseCSV::chiudi_movimento(TConfig& configfile, TImporto& tot_doc, TDate& data)
|
||||
{
|
||||
//aggiungo i campi che mancano in testata
|
||||
configfile.set_paragraph("23");
|
||||
configfile.set(MOV_DATAREG, data);
|
||||
configfile.set(MOV_DATADOC, data);
|
||||
configfile.set(MOV_DATACOMP, data);
|
||||
|
||||
tot_doc.normalize();
|
||||
|
||||
//aggiungo la prima riga che bilancia le righe successive
|
||||
TString8 paragraph;
|
||||
paragraph.format("%d,%d",LF_RMOV,1);
|
||||
configfile.set_paragraph(paragraph);
|
||||
configfile.set(RMV_IMPORTO,tot_doc.valore().string());
|
||||
configfile.set(RMV_SEZIONE,tot_doc.sezione());
|
||||
|
||||
configfile.set_paragraph("Transaction");
|
||||
|
||||
TString app;
|
||||
app << "cg2 -0 -i" << nomeini;
|
||||
TExternal_app primanota(app);
|
||||
primanota.run();
|
||||
}
|
||||
|
||||
bool TSpeseCSV::transfer(const TMask& msk)
|
||||
{
|
||||
//genero il nome del file da caricare
|
||||
TFilename name = msk.get(F_PATH);
|
||||
name.add(msk.get(F_NAME));
|
||||
TImporta_spese_recordset s(name);
|
||||
|
||||
TProgind pi(s.items(),"Importazione spese in corso ...",true,true);
|
||||
|
||||
xvt_fsys_removefile(nomeini);
|
||||
TConfig configfile (nomeini, "Transaction"); //setto il paragrafo [Transaction] del file ini
|
||||
|
||||
TDate dataold, data;
|
||||
|
||||
int nriga = 2;
|
||||
TImporto tot_doc;
|
||||
|
||||
const TRectype& causale = cache().get(LF_RCAUSALI, msk.get(F_CODCAU));
|
||||
|
||||
|
||||
for (bool ok=s.move_first();ok;ok=s.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
|
||||
|
||||
TString80 tmp;
|
||||
|
||||
//importo
|
||||
tmp = s.get(2).as_string();
|
||||
|
||||
//evito di analizzare eventuali righe vuote
|
||||
if (tmp.blank())
|
||||
continue;
|
||||
|
||||
tmp.replace(',','.');
|
||||
tmp.strip("\"");
|
||||
const real imp = tmp;
|
||||
|
||||
if (!imp.is_zero())
|
||||
{
|
||||
|
||||
//codice commessa
|
||||
tmp = s.get(0).as_string();
|
||||
tmp.strip("\"");
|
||||
|
||||
const TRectype& commessa = cache().get("CMS", tmp);
|
||||
|
||||
//data
|
||||
tmp = s.get(1).as_string();
|
||||
tmp.strip("\"");
|
||||
|
||||
data.set_day(atoi(tmp.mid(0,2)));
|
||||
data.set_month(atoi(tmp.mid(3,2)));
|
||||
data.set_year(atoi(tmp.mid(6,4)));
|
||||
|
||||
//descrizione
|
||||
tmp = s.get(3).as_string();
|
||||
tmp.strip("\"");
|
||||
|
||||
if(data != dataold)
|
||||
{
|
||||
if (dataold.ok())
|
||||
chiudi_movimento(configfile, tot_doc, data);
|
||||
|
||||
TFilename filename(nomeini);
|
||||
filename.fremove();
|
||||
|
||||
configfile.set_paragraph("Transaction");
|
||||
configfile.set("Action","INSERT");
|
||||
configfile.set("Mode","AUTO");
|
||||
|
||||
configfile.set_paragraph("23"); //setto il paragrafo [23] del file ini (testata)
|
||||
configfile.set(MOV_CODCAUS, causale.get(RCA_CODCAUS));
|
||||
|
||||
configfile.set_paragraph("24,1");
|
||||
configfile.set(RMV_NUMRIG,1);
|
||||
configfile.set(RMV_GRUPPO, causale.get(RCA_GRUPPO));
|
||||
configfile.set(RMV_CONTO, causale.get(RCA_CONTO));
|
||||
configfile.set(RMV_SOTTOCONTO, causale.get(RCA_SOTTOCONTO));
|
||||
|
||||
tot_doc.reset();
|
||||
nriga = 2;
|
||||
dataold = data;
|
||||
}
|
||||
|
||||
TImporto importo('D', imp);
|
||||
importo.normalize();
|
||||
tot_doc -= importo;
|
||||
|
||||
TString8 paragraph;
|
||||
paragraph.format("%d,%d",LF_RMOV,nriga++);
|
||||
configfile.set_paragraph(paragraph);
|
||||
|
||||
configfile.set(RMV_IMPORTO,importo.valore().string());
|
||||
configfile.set(RMV_SEZIONE,importo.sezione());
|
||||
configfile.set(RMV_CODCMS,commessa.get("CODTAB"));
|
||||
configfile.set(RMV_DATAREG,data);
|
||||
configfile.set(RMV_GRUPPO,commessa.get("I1"));
|
||||
configfile.set(RMV_CONTO,commessa.get("I2"));
|
||||
configfile.set(RMV_SOTTOCONTO,commessa.get("I3"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
chiudi_movimento(configfile, tot_doc, data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TSpeseCSV::main_loop()
|
||||
{
|
||||
TImportaSpese_mask msk;
|
||||
|
||||
if (msk.run() == K_ENTER)
|
||||
{
|
||||
if (transfer(msk))
|
||||
{
|
||||
message_box(TR("Importazione spese completata"));
|
||||
xvt_fsys_removefile(nomeini);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TSpeseCSV& app() { return (TSpeseCSV&) main_app(); }
|
||||
|
||||
|
||||
int ps0713500 (int argc, char* argv[])
|
||||
{
|
||||
TSpeseCSV main_app;
|
||||
main_app.run(argc, argv, TR("Importazione Spese"));
|
||||
return true;
|
||||
}
|
8
ps/ps0713500a.h
Executable file
8
ps/ps0713500a.h
Executable file
@ -0,0 +1,8 @@
|
||||
//campi maschera ps0713400a
|
||||
|
||||
#define F_CODITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_PATH 103
|
||||
#define F_NAME 104
|
||||
#define F_CODCAU 105
|
||||
#define F_DESCAU 106
|
111
ps/ps0713500a.uml
Executable file
111
ps/ps0713500a.uml
Executable file
@ -0,0 +1,111 @@
|
||||
#include "ps0713500a.h"
|
||||
|
||||
TOOLBAR "" 0 20 0 2
|
||||
|
||||
BUTTON DLG_ELABORA 10 2
|
||||
BEGIN
|
||||
PICTURE BMP_ELABORA
|
||||
MESSAGE EXIT,K_ENTER
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
STRING DLG_PROFILE 50
|
||||
BEGIN
|
||||
PROMPT 9 -12 "Profilo "
|
||||
PSELECT
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Inserimento fatture" 0 0 0 -3
|
||||
|
||||
GROUPBOX DLG_NULL 90 3
|
||||
BEGIN
|
||||
PROMPT 2 1 "@bDitta corrente"
|
||||
END
|
||||
|
||||
NUMBER F_CODITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 2 "Codice "
|
||||
FLAGS "FD"
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_CODITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 23 2 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 90 4
|
||||
BEGIN
|
||||
PROMPT 2 4 "@bSorgente"
|
||||
END
|
||||
|
||||
STRING F_PATH 256 39
|
||||
BEGIN
|
||||
PROMPT 3 5 "Cartella "
|
||||
DSELECT
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD ComInPath
|
||||
FLAGS "M"
|
||||
END
|
||||
|
||||
STRING F_NAME 18
|
||||
BEGIN
|
||||
PROMPT 3 6 "File (*.csv) "
|
||||
FIELD ComInFile
|
||||
FLAGS "B"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 90 3
|
||||
BEGIN
|
||||
PROMPT 2 8 "@bCausale"
|
||||
END
|
||||
|
||||
STRING F_CODCAU 3
|
||||
BEGIN
|
||||
PROMPT 3 9 "Causale "
|
||||
FIELD CODCAU
|
||||
FLAGS "UZ"
|
||||
USE LF_CAUSALI
|
||||
INPUT CODCAUS F_CODCAU
|
||||
DISPLAY "Cod." CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Documento" TIPODOC
|
||||
DISPLAY "Registro" REG
|
||||
DISPLAY "Tipo movimento" TIPOMOV
|
||||
OUTPUT F_CODCAU CODCAUS
|
||||
OUTPUT F_DESCAU DESCR
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCAU 50
|
||||
BEGIN
|
||||
PROMPT 25 9 "Descrizione "
|
||||
FIELD DESCR
|
||||
USE LF_CAUSALI KEY 2
|
||||
INPUT DESCR F_DESCAU
|
||||
DISPLAY "Descrizione @50" DESCR
|
||||
DISPLAY "Cod." CODCAUS
|
||||
DISPLAY "Documento" TIPODOC
|
||||
DISPLAY "Registro" REG
|
||||
DISPLAY "Movimento" TIPOMOV
|
||||
COPY OUTPUT F_CODCAU
|
||||
END
|
||||
|
||||
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user