From 8735010ff9d1eabc6c6bff249a17bf91793b125e Mon Sep 17 00:00:00 2001 From: angelo Date: Thu, 5 Jun 1997 14:25:34 +0000 Subject: [PATCH] Aggiunta conversione tabelle UCS E UCC. git-svn-id: svn://10.65.10.50/trunk@4530 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/bacnv.cpp | 129 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 105 insertions(+), 24 deletions(-) diff --git a/ba/bacnv.cpp b/ba/bacnv.cpp index 6f3cd3cef..e16340fcd 100755 --- a/ba/bacnv.cpp +++ b/ba/bacnv.cpp @@ -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 1) ? atoi(argv[1]) : 0; - if (r < 0 || r > 13) + if (r < 0 || r > 14) { error_box(usage); return 100;