Aggiunta conversione tabelle UCS E UCC.

git-svn-id: svn://10.65.10.50/trunk@4530 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1997-06-05 14:25:34 +00:00
parent 8206fc155d
commit 8735010ff9

View File

@ -28,7 +28,7 @@
#include "..\cg\cglib.h"
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12|13] ditta"
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12|13|14] ditta"
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Applicazione di conversione archivi XBase, valida per tutti e 4 i tipi di DLL
@ -184,7 +184,8 @@ public:
void convert_caaf_m770() const;
void convert_rver_m770() const;
void remove_dta_ndx() const;
void convert_ucs() const;
void convert_ucc() const;
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
};
@ -314,6 +315,12 @@ bool TConversione_archivi::menu(MENU_TAG)
convert_rver_m770();
}
break;
case 14:
if (_codditta == 0)
{
convert_ucs();
convert_ucc();
}
default:
break;
}
@ -1119,15 +1126,15 @@ void TConversione_archivi::convert_enti_m770() const
for (err = tab.first(); err == NOERR; err = tab.next())
{
old_cod = tab.get("CODTAB");
if (old_cod.len() < 2)
{
TRectype new_rec(tab.curr());
new_cod.format("%02d",atoi(old_cod));
new_rec.put("CODTAB", new_cod);
tab.write(new_rec);
tab.remove();
}
old_cod = tab.get("CODTAB");
if (old_cod.len() < 2)
{
TRectype new_rec(tab.curr());
new_cod.format("%02d",atoi(old_cod));
new_rec.put("CODTAB", new_cod);
tab.write(new_rec);
tab.remove();
}
}
}
@ -1144,15 +1151,15 @@ void TConversione_archivi::convert_caaf_m770() const
for (err = tab.first(); err == NOERR; err = tab.next())
{
old_cod = tab.get("CODTAB");
if (old_cod.len() < 5)
{
TRectype new_rec(tab.curr());
new_cod.format("%05ld",atol(old_cod));
new_rec.put("CODTAB", new_cod);
tab.write(new_rec);
tab.remove();
}
old_cod = tab.get("CODTAB");
if (old_cod.len() < 5)
{
TRectype new_rec(tab.curr());
new_cod.format("%05ld",atol(old_cod));
new_rec.put("CODTAB", new_cod);
tab.write(new_rec);
tab.remove();
}
}
}
@ -1167,9 +1174,9 @@ void TConversione_archivi::convert_rver_m770() const
for (err = lf.first(); err == NOERR; err = lf.next())
{
progr_banca = lf.get_long("PROGBANC");
lf.put("PROGBANC", progr_banca);
lf.rewrite();
progr_banca = lf.get_long("PROGBANC");
lf.put("PROGBANC", progr_banca);
lf.rewrite();
}
}
@ -1333,6 +1340,80 @@ void TConversione_archivi::convert_saldi() const
}
}
// Effettua conversioni per tabella uffici centro servizi
void TConversione_archivi::convert_ucs() const
{
// Carica i Centri Servizi da modificare
TFilename fn;
fn.format("%sstd/tbucs00.txt", __ptprf);
if (fexist(fn))
{
TScanner c(fn);
TToken_string t;
TTable ucs("%UCS");
for (t = c.line(); t.not_empty(); t = c.line())
{
ucs.put("CODTAB",t.get(0));
if (ucs.read() == NOERR)
if (ucs.get("S1").empty())
{
ucs.put("S1",t.get(1));
ucs.put("S3",t.get(2));
ucs.put("S7",t.get(3));
ucs.put("S6",t.get(4));
ucs.rewrite();
}
}
}
// Carica il nuovo centro servizi di Cagliari
fn.format("%sstd/tbucs01.txt", __ptprf);
if (fexist(fn))
{
TSystemisamfile tabcom(LF_TABCOM);
tabcom.load(fn);
// Scorre tutti i comuni della provincia di Cagliari e gli cambia il codice Ufficio Centro Servizi
TRelation com_rel(LF_COMUNI);
TCursor cur(&com_rel,"PROVCOM==\"CA\"");
TRectype& rec = cur.curr();
const long items = cur.items();
TProgind p(items,"Conversione comuni in provincia di Cagliari",FALSE,TRUE);
for (long i = 0; i<items; i++)
{
p.addstatus(1L);
cur = i;
rec.put("UFFCSERV","104");
cur.file().rewrite();
}
}
}
// Effettua conversioni per uffici concessioni
void TConversione_archivi::convert_ucc() const
{
// Carica le nuove descrizioni per gli Uffici Concessioni
TFilename fn;
fn.format("%sstd/tbucc00.txt", __ptprf);
if (fexist(fn))
{
TScanner c(fn);
TToken_string t;
TTable ucc("%UCC");
TProgind p(1,"Conversione tabella Uffici Concessioni",FALSE,FALSE);
for (t = c.line(); t.not_empty(); t = c.line())
{
ucc.put("CODTAB",t.get(0));
if (ucc.read() == NOERR)
{
ucc.put("S2",t.get(1));
ucc.rewrite();
}
}
}
}
///////////////////////////////////////////////////////////
// Programma di conversione archivi speciale
///////////////////////////////////////////////////////////
@ -1341,7 +1422,7 @@ int main(int argc,char** argv)
{
const int r = (argc > 1) ? atoi(argv[1]) : 0;
if (r < 0 || r > 13)
if (r < 0 || r > 14)
{
error_box(usage);
return 100;