From 45da7bd5cda6bab6d58842e84fd57308809d3745 Mon Sep 17 00:00:00 2001 From: angelo Date: Tue, 28 May 1996 09:39:05 +0000 Subject: [PATCH] Modificata la gestione delle attivazioni/utenti tramite spreadsheet con moduli in ordine alfabetico. git-svn-id: svn://10.65.10.50/trunk@2918 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0100a.h | 5 + ba/ba1400.cpp | 104 ++++++++++++---- ba/ba1400a.uml | 273 ++++++---------------------------------- ba/ba1500.cpp | 331 ++++++++++++++++++++++++++++++++++--------------- ba/ba1500.h | 23 ++++ ba/ba1500a.h | 23 +++- ba/ba1500a.uml | 231 ++++++---------------------------- 7 files changed, 435 insertions(+), 555 deletions(-) create mode 100755 ba/ba1500.h diff --git a/ba/ba0100a.h b/ba/ba0100a.h index e3d186fd2..28bedf479 100755 --- a/ba/ba0100a.h +++ b/ba/ba0100a.h @@ -1,6 +1,7 @@ #define F_USER 101 #define F_PASSWORD 102 #define F_USERDESC 103 +#define F_MODULI 104 #define F_BASE 200 #define F_74 201 #define F_75 202 @@ -36,3 +37,7 @@ #define F_EF 234 #define F_DB 235 #define F_SP 236 + +#define F_NOMEMOD 101 +#define F_ENABLE 102 +#define F_CODE 103 diff --git a/ba/ba1400.cpp b/ba/ba1400.cpp index 3e90fa8c4..04debb342 100755 --- a/ba/ba1400.cpp +++ b/ba/ba1400.cpp @@ -3,14 +3,17 @@ #include #include #include +#include #include "ba1.h" +#include "ba1500.h" #include "ba0100a.h" class TSet_users : public TRelation_application { TMask* _msk; TRelation* _rel; + TInformazione_moduli* _im; virtual bool user_create(); virtual bool user_destroy(); @@ -18,15 +21,18 @@ class TSet_users : public TRelation_application virtual bool changing_mask(int mode) { return FALSE;} virtual TRelation* get_relation() const { return _rel;} virtual int read(TMask& m); + void put_in_record(const TMask& m); virtual int write(const TMask& m); virtual int rewrite(const TMask& m); - void enable_aut(TMask& m); + void enable_aut(TMask& m); static bool user_handler(TMask_field& f, KEY key); static bool password_handler(TMask_field& f, KEY key); + static bool k_notify(TSheet_field & f, int r, KEY k); virtual void init_query_mode(TMask& m) { enable_aut(m);} - virtual void init_insert_mode(TMask& m) { enable_aut(m);} + virtual void init_insert_mode(TMask& m) { build_sheet(m,NULL); enable_aut(m);} virtual void init_modify_mode(TMask& m) { enable_aut(m);} - + TSheet_field& sheet_field() { return (TSheet_field&) _msk->field(F_MODULI);} + void build_sheet(TMask& m, const TRelation* r); public: TSet_users() : _msk(NULL), _rel(NULL) {} @@ -53,35 +59,73 @@ bool TSet_users::password_handler(TMask_field& f, KEY key) return ok; } +void TSet_users::build_sheet(TMask& m, const TRelation* r) +{ + TString autstr; + TSheet_field& sf = sheet_field(); + if (r != NULL) + autstr = r->lfile().get("AUTSTR"); + const int l = autstr.len(); + sf.destroy(); + + for (int i = 0; i < ENDAUT; i++) + { + TString d( _im->get_description_by_order(i)); + if (d.trim().empty()) continue; + TToken_string& riga = sf.row(i); + riga = d; + const int module = _im->get_module_by_order(i); + if (r!= NULL && moduleunassigned(); + TSheet_field& sf = sheet_field(); + const int itms = sf.items(); + for (int i = 0; i < itms; i++) { - if (i == MUAUT) continue; - const int pos = _msk->id2pos(F_BASE + i); - if (pos >= 0) + const int module = _im->get_module_by_order(i+uns); + TToken_string& riga = sf.row(i); + if (module == BAAUT || module == MUAUT) { - TMask_field& f = m.fld(pos); - - f.enable_default(); - if (f.enabled()) - f.enable(!prassi && has_module(i, CHK_DONGLE)); - if (prassi) f.set("X"); + sf.disable_cell(i,1); + riga.add("X",1); + } + else + { + sf.enable_cell(i,1,!prassi && has_module(module, CHK_DONGLE)); + if (prassi) riga.add("X",1); } } } +bool TSet_users::k_notify(TSheet_field& f, int r, KEY k) +{ + if (k == K_INS) + return FALSE; + return TRUE; +} + bool TSet_users::user_create() { if (user() != "PRASSI") return error_box("Utente non abilitato all'uso di questo programma"); _msk = new TMask("ba1400a") ; _rel = new TRelation(LF_USER); - _msk->field(F_MU).disable(); _msk->set_handler(F_USER, user_handler); _msk->set_handler(F_PASSWORD, password_handler); + TSheet_field& sf = sheet_field(); + sf.set_notify(k_notify); + _im = new TInformazione_moduli; + return TRUE; } @@ -90,28 +134,45 @@ int TSet_users::read(TMask& m) { TRelation_application::read(m); const TRelation *r = get_relation(); - + build_sheet(m,r); m.set(F_PASSWORD, decode(r->lfile().get("PASSWORD"))); return NOERR; } -int TSet_users::write(const TMask& m) +void TSet_users::put_in_record(const TMask& m) { TRelation *r = get_relation(); TString16 s(encode(m.get(F_PASSWORD))); + TString autstr(ENDAUT); + TSheet_field& sf = sheet_field(); + const int itms = sf.items(); + autstr.fill(' '); + for (int i=0; ilfile().put("AUTSTR", (const char *) autstr); r->lfile().put("PASSWORD", (const char *) s); +} + +int TSet_users::write(const TMask& m) + +{ + put_in_record(m); return TRelation_application::write(m); } int TSet_users::rewrite(const TMask& m) { - TRelation *r = get_relation(); - TString16 s(encode(m.get(F_PASSWORD))); - - r->lfile().put("PASSWORD", s); + put_in_record(m); return TRelation_application::rewrite(m); } @@ -120,6 +181,7 @@ bool TSet_users::user_destroy() { if (_msk != NULL) delete _msk; if (_rel != NULL) delete _rel; + if (_im != NULL) delete _im; return TRUE; } diff --git a/ba/ba1400a.uml b/ba/ba1400a.uml index 7bca6a3a0..9be72a397 100755 --- a/ba/ba1400a.uml +++ b/ba/ba1400a.uml @@ -6,11 +6,6 @@ ENDPAGE PAGE "Gestione moduli" -1 -1 35 7 -GROUPBOX DLG_NULL 78 15 -BEGIN - PROMPT 0 4 "Moduli" -END - STRING F_USER 8 BEGIN PROMPT 1 1 "Utente " @@ -31,245 +26,53 @@ STRING F_USERDESC 50 BEGIN PROMPT 1 2 "Descrizione " FIELD USERDESC - MESSAGE "X",F_BASE END STRING F_PASSWORD 8 BEGIN PROMPT 1 3 "Password " HELP "Inserire la password" - MESSAGE "X",F_BASE - MESSAGE "X",F_MU END -BOOLEAN F_BASE +SPREADSHEET F_MODULI 78 BEGIN - PROMPT 1 5 "Base" - FLAGS "D" - FIELD AUTSTR[1,1] -END - -BOOLEAN F_74 -BEGIN - PROMPT 31 5 "Modello 740" - FIELD AUTSTR[2,2] -END - -BOOLEAN F_75 -BEGIN - PROMPT 59 5 "Modello 750" - FIELD AUTSTR[3,3] -END - -BOOLEAN F_76 -BEGIN - PROMPT 1 6 "Modello 760" - FIELD AUTSTR[4,4] -END - -BOOLEAN F_77 -BEGIN - PROMPT 31 6 "Modello 770" - FIELD AUTSTR[5,5] -END - -BOOLEAN F_GI -BEGIN - PROMPT 59 6 "Gestione IVA" - FIELD AUTSTR[6,6] -END - -BOOLEAN F_SE -BEGIN - PROMPT 1 7 "Cont.Semplificata" - FIELD AUTSTR[7,7] -END - -BOOLEAN F_CG -BEGIN - PROMPT 31 7 "Contabilita'" - FIELD AUTSTR[8,8] -END - -BOOLEAN F_ST -BEGIN - PROMPT 59 7 "Gestione Studi" - FIELD AUTSTR[9,9] -END - -BOOLEAN F_MI -BEGIN - PROMPT 1 8 "Modello IVA 11" - FIELD AUTSTR[10,10] -END - -BOOLEAN F_AI -BEGIN - PROMPT 31 8 "Archiviazione immagini" - FIELD AUTSTR[11,11] - FLAGS "D" -END - -BOOLEAN F_CE -BEGIN - PROMPT 59 8 "Cespiti" - FIELD AUTSTR[12,12] -END - -BOOLEAN F_AD -BEGIN - PROMPT 1 9 "Anagrafici dichar." - FIELD AUTSTR[13,13] -END - -BOOLEAN F_SC -BEGIN - PROMPT 31 9 "Saldaconto" - FIELD AUTSTR[14,14] -END - -BOOLEAN F_MU -BEGIN - PROMPT 59 9 "Multiutenza" - FIELD AUTSTR[15,15] -END - -BOOLEAN F_CM -BEGIN - PROMPT 1 10 "Gestione Commesse" - FIELD AUTSTR[16,16] -END - -BOOLEAN F_73 -BEGIN - PROMPT 31 10 "Modello 730" - FIELD AUTSTR[17,17] -END - -BOOLEAN F_AT -BEGIN - PROMPT 59 10 "AVIS Assist" - FIELD AUTSTR[18,18] -END - -BOOLEAN F_IN -BEGIN - PROMPT 1 11 "Elenchi Intrac." - FIELD AUTSTR[19,19] -END - -BOOLEAN F_PO -BEGIN - PROMPT 31 11 "Modulo Penna Ottica" - FIELD AUTSTR[20,20] - FLAGS "D" -END - -BOOLEAN F_AB -BEGIN - PROMPT 59 11 "Analisi bil." - FIELD AUTSTR[21,21] -END - -BOOLEAN F_NI -BEGIN - PROMPT 1 12 "Nota Integrativa" - FIELD AUTSTR[22,22] -END - -BOOLEAN F_NR -BEGIN - PROMPT 31 12 "Nota Integrativa Rid." - FIELD AUTSTR[23,23] -END - -BOOLEAN F_PC -BEGIN - PROMPT 59 12 "Parcellazione" - FIELD AUTSTR[24,24] -END - -BOOLEAN F_AF -BEGIN - PROMPT 1 13 "Autoformazione" - FIELD AUTSTR[25,25] - FLAGS "D" -END - -BOOLEAN F_IC -BEGIN - PROMPT 31 13 "Gestione ICI" - FIELD AUTSTR[26,26] -END - -BOOLEAN F_IS -BEGIN - PROMPT 59 13 "Gestione ISI" - FIELD AUTSTR[27,27] -END - -BOOLEAN F_TC -BEGIN - PROMPT 1 14 "Tecnico Contabile" - FIELD AUTSTR[28,28] - FLAGS "D" -END - -BOOLEAN F_TM -BEGIN - PROMPT 31 14 "Tecnico App.Merci" - FIELD AUTSTR[29,29] - FLAGS "D" -END - -BOOLEAN DLG_NULL -BEGIN - PROMPT 59 14 "" - FIELD AUTSTR[30,30] - FLAGS "D" -END - -BOOLEAN DLG_NULL -BEGIN - PROMPT 1 15 "" - FIELD AUTSTR[31,31] - FLAGS "D" -END - -BOOLEAN F_VE -BEGIN - PROMPT 31 15 "Vendite" - FIELD AUTSTR[32,32] -END - -BOOLEAN F_MG -BEGIN - PROMPT 59 15 "Magazzino" - FIELD AUTSTR[33,33] -END - -BOOLEAN F_OR -BEGIN - PROMPT 1 16 "Ordini" - FIELD AUTSTR[34,34] -END - -BOOLEAN F_EF -BEGIN - PROMPT 31 16 "Gestione effetti" - FIELD AUTSTR[35,35] -END - -BOOLEAN F_DB -BEGIN - PROMPT 59 16 "Distinta Base" - FIELD AUTSTR[36,36] -END - -BOOLEAN F_SP -BEGIN - PROMPT 1 17 "Statistiche e Provvigioni" - FIELD AUTSTR[38,38] + PROMPT 0 5 "Moduli" + ITEM "Modulo@40" + ITEM "Abilitato@C" + ITEM "Codice" +END + +ENDPAGE + +ENDMASK + +PAGE "Campo" -1 -1 60 11 + +STRING F_NOMEMOD 40 +BEGIN + PROMPT 1 3 "Modulo " + FLAGS "D" +END + +BOOLEAN F_ENABLE +BEGIN + PROMPT 11 5 "Abilitato " +END + +NUMBER F_CODE 3 +BEGIN + PROMPT 1 7 "Codice " + FLAGS "D" +END + +BUTTON DLG_OK 9 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_CANCEL 9 2 +BEGIN + PROMPT -22 -1 "" END ENDPAGE diff --git a/ba/ba1500.cpp b/ba/ba1500.cpp index ca5582d95..204727c72 100755 --- a/ba/ba1500.cpp +++ b/ba/ba1500.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include #include @@ -9,22 +9,98 @@ #include #include "ba1.h" -#include "ba0100a.h" +#include "ba1500.h" #include "ba1500a.h" #define USERADR 26952 #define AGAADR 26953 #define PRASSIADR 26954 +#define PROCOMADR 26956 #define K1 0x4500 -#define LBYTEMASK 0x00FF +#define LBYTEMASK 0x00FF #define UBYTEMASK 0xFF00 #define MAXAUT 49 -enum KeyType { _user_key, _aga_key, _prassi_key}; +enum KeyType { _user_key, _aga_key, _prassi_key, _procom_key}; #define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0) #define BITSET(w,p,v) ((v) ? ((w) |= (0x0001 << (p))) : ((w) &= (~(0x0001 << (p))))) +TInformazione_moduli::TInformazione_moduli() +{ + int mod = 0; + char _buffer[256]; + TString s; + TToken_string t; + + _unassigned_modules = 0; + ifstream in("prassi.aut"); + while (!in.eof() && in.good()) + { + in.getline(_buffer, sizeof(_buffer),'\n'); + s = _buffer; + s.trim(); + if (s.empty()) break; + const int l = s.len(); + if (l > 2) + { + t = format("%-40s",(const char*)s.right(l-3)); + t.add(s.left(2)); + } + else + { + t = " "; t.add(" "); + _unassigned_modules++; + } + t.add(mod++); + _infos.add(t); + } + + if (in.bad() && !in.eof()) + error_box("Si e' verificato un errore leggendo il file di descrizione moduli."); + + _infos.sort(); + for (int i=0;i=0 && index=0 && index=0 && index