diff --git a/at/agaat.men b/at/agaat.men index 64186579f..fe6be2cf8 100755 --- a/at/agaat.men +++ b/at/agaat.men @@ -1,6 +1,6 @@ [AVIS_000] Caption = "Menu principale" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Archiviazione", [AVIS_001] @@ -9,12 +9,13 @@ Item_03 = "Benemerenze", [AVIS_003] Item_04 = "Stampe", [AVIS_004] Item_05 = "Statistiche", [AVIS_005] Item_06 = "Procedure personalizzate", [AVIS_006] -Item_07 = "Anagrafiche EUROCAMPO", [PRASSI_001] -Item_08 = "Manutenzione", [PRASSI_015] +Item_07 = "Anagrafiche EUROCAMPO", [AGA_001] +Item_08 = "Manutenzione", [AGA_015] +Item_09 = "Preferiti", [MENU_PREFERITI], "", 10216 [AVIS_001] Caption = "Archiviazione" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Soggetti", "at0 -0", "" @@ -29,7 +30,7 @@ Item_08 = "Tabelle", [AVIS_0012] [AVIS_0011] Caption = "Operazioni periodiche" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Chiusura", "at0 -5", "" @@ -39,7 +40,7 @@ Item_04 = "Verifica integrita' dati", "at8 -4", "" [AVIS_0012] Caption = "Tabelle" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Sezioni", "ba3 -3 batbsez 96", "" @@ -59,7 +60,7 @@ Item_14 = "Tipi/Esiti controlli sanitari", "ba3 -0 tcs", "" [AVIS_002] Caption = "Convocazioni" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Scadenze di donazione", "at4 -0", "" @@ -69,7 +70,7 @@ Item_04 = "Convocazioni su punto di prelievo", [AVIS_0021] [AVIS_0021] Caption = "Convocazioni su punto di prelievo" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Gestione", "at4 -4", "" @@ -78,7 +79,7 @@ Item_03 = "Stampa", "at4 -3", "" [AVIS_003] Caption = "Benemerenze" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Proposta benemerenza singola", "at1 -0", "" @@ -90,7 +91,7 @@ Item_06 = "Inserimento veloce", "at1 -5", "" [AVIS_004] Caption = "Stampe" -Picture = +Picture = Module = 17 Flags = "" Item_04 = "Segreteria", [AVIS_0041] @@ -99,7 +100,7 @@ Item_06 = "Di controllo", [AVIS_0043] [AVIS_0041] Caption = "Stampe segreteria" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Per categorie", "at2 -6", "" @@ -117,7 +118,7 @@ Item_12 = "Tessere associative singole", "at7 -1", "" [AVIS_0042] Caption = "Stampe sanitarie" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Sospesi", "at2 -0", "" @@ -130,7 +131,7 @@ Item_07 = "Turni per controlli sanitari", "at5 -2", "" [AVIS_0043] Caption = "Stampe di controllo" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Donazioni", "at6 -2", "" @@ -142,7 +143,7 @@ Item_05 = "Tabelle", [AVIS_00431] [AVIS_00431] Caption = "Stampe di controllo tabelle" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Sezioni", "at6 -1", "" @@ -159,7 +160,7 @@ Item_11 = "Professioni", "ba3 -1 prf", "" [AVIS_005] Caption = "Statistiche" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Mensile donazioni per tipo", "at3 -3" @@ -174,7 +175,7 @@ Item_09 = "Soggetti per comune domicilio", "at3 -8" [AVIS_006] Caption = "Procedure personalizzate" -Picture = +Picture = Module = 17 Flags = "" Item_01 = "Rimini", [AVIS_0061] @@ -183,7 +184,7 @@ Item_03 = "Parma", [AVIS_0063] [AVIS_0061] Caption = "Rimini: procedure personalizzate" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Acquisizione dati da CT", "at8 -2", "" @@ -192,7 +193,7 @@ Item_03 = "Estrazione dati per aggiornamento", "at9 -1", "" [AVIS_0062] Caption = "Bologna: procedure personalizzate" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Trasferimento dati a CT", "at8 -6", "" @@ -200,7 +201,7 @@ Item_02 = "Acquisizione dati da CT", "at8 -7", "" [AVIS_0063] Caption = "Parma: procedure personalizzate" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Aggiornamento dati da SIT", "at8 -8", "" @@ -210,25 +211,25 @@ Item_04 = "Conversione tipi donazione", "ba3 -0 pr2", "" Item_04 = "Estrazione dati per aggiornamento", "at9 -1", "" Item_04 = "Aggiornamento dati da estrazione", "at9 -2", "" -[PRASSI_001] +[AGA_001] Caption = "Gestione Anagrafiche" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Persone fisiche", "ba4 -1 F", "" Item_02 = "Persone giuridiche", "ba4 -1 G", "" Item_03 = "Ditte", "ba4 -2", "" Item_04 = "Ricerca Soci", "ba5", "" -Item_05 = "Tabelle ministeriali", [PRASSI_011] -Item_06 = "Tabelle", [PRASSI_002] +Item_05 = "Tabelle ministeriali", [AGA_011] +Item_06 = "Tabelle", [AGA_002] Item_07 = "Stampa anagrafiche", "ba6 -0", "" -Item_08 = "Stampa tabelle", [PRASSI_003] -Item_09 = "Stampa tabelle ministeriali", [PRASSI_012] +Item_08 = "Stampa tabelle", [AGA_003] +Item_09 = "Stampa tabelle ministeriali", [AGA_012] Item_10 = "Stampa fogli libri bollati", "ba3 -2", "" -[PRASSI_002] +[AGA_002] Caption = "Tabelle" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Codici IVA", "ba3 -0 %iva", "" @@ -243,25 +244,25 @@ Item_09 = "Vecchi cod.Attivita'", "ba3 -0 %ois", "" Item_10 = "Stati esteri", "ba3 -0 %sta", "" Item_11 = "Gestione profili deleghe e distinte", "ba2 -0", "" -[PRASSI_003] +[AGA_003] Caption = "Stampa tabelle" -Picture = +Picture = Module = 0 Flags = "" -Item_01 = "Codici IVA", "ba3 -1 %iva", "" -Item_02 = "Codici Attivita'", "ba3 -1 %ais", "" +Item_01 = "Codici IVA", "ba8 -5 %iva", "" +Item_02 = "Codici Attivita'", "ba8 -5 %ais", "" Item_03 = "Condizioni di pagamento", "ba3 -9", "" -Item_04 = "Classificazione pagamenti", "ba3 -1 %clr", "" -Item_05 = "Libri sociali", "ba3 -1 %itl", "" -Item_06 = "Banche", "ba3 -1 %ban", "" -Item_07 = "Codici statistici", "ba3 -1 %stt", "" -Item_08 = "Cariche sociali", "ba3 -1 %crs", "" -Item_09 = "Vecchi cod.Attivita'", "ba3 -1 %ois", "" -Item_10 = "Stati esteri", "ba3 -1 %sta", "" +Item_04 = "Classificazione pagamenti", "ba8 -5 %clr", "" +Item_05 = "Libri sociali", "ba8 -5 %itl", "" +Item_06 = "Banche", "ba8 -5 %ban", "" +Item_07 = "Codici statistici", "ba8 -5 %stt", "" +Item_08 = "Cariche sociali", "ba8 -5 %crs", "" +Item_09 = "Vecchi cod.Attivita'", "ba8 -5 %ois", "" +Item_10 = "Stati esteri", "ba8 -5 %sta", "" -[PRASSI_011] +[AGA_011] Caption = "Tabelle ministeriali" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Comuni", "ba4 -0", "" @@ -272,27 +273,36 @@ Item_05 = "Uffici IVA", "ba3 -0 %uiv", "" Item_06 = "Uffici registro", "ba3 -0 %ure", "" Item_07 = "Centri servizio", "ba3 -0 %ucs", "" -[PRASSI_012] +[AGA_012] Caption = "Stampa tabelle ministeriali" -Picture = +Picture = Module = 0 Flags = "" Item_01 = "Comuni", "ba6 -1", "" -Item_02 = "Uffici concessioni", "ba3 -1 %ucc", "" -Item_03 = "Uffici imposte dirette", "ba3 -1 %uid", "" -Item_04 = "Uffici IVA", "ba3 -1 %uiv", "" -Item_05 = "Uffici registro", "ba3 -1 %ure", "" -Item_06 = "Centri servizio", "ba3 -1 %ucs", "" +Item_02 = "Uffici concessioni", "ba8 -5 %ucc", "" +Item_03 = "Uffici imposte dirette", "ba8 -5 %uid", "" +Item_04 = "Uffici IVA", "ba8 -5 %uiv", "" +Item_05 = "Uffici registro", "ba8 -5 %ure", "" +Item_06 = "Centri servizio", "ba8 -5 %ucs", "" -[PRASSI_015] +[AGA_015] Caption = "Manutenzione" -Picture = +Picture = Module = 0 Flags = "" -Item_01 = "Archivi", "ba1", "" +Item_01 = "Archivi", "ba1 -0", "" Item_02 = "Compatta tutti i files", "ba1 -2", "" Item_03 = "Utenti", "ba1 -3 agaat.men", "" Item_04 = "Attivazione moduli", "ba1 -4", "" Item_05 = "Installazione moduli", "ba1 -6", "" -Item_06 = "Backup", "ba2 -1", "" +Item_06 = "Creazione dischi di installazione", "ba1 -5", "" +Item_07 = "Backup", "ba2 -1", "", 10213 +Item_08 = "Generatore query", "ba8 -1", "" +Item_09 = "Generatore report", "ba8 -2", "" +Item_10 = "Convertitore da form a report", "ba8 -3", "" +[MENU_PREFERITI] +Caption = "Preferiti" +Picture = +Module = 0 +Flags = "" diff --git a/at/at00.gif b/at/at00.gif new file mode 100755 index 000000000..875f5d936 Binary files /dev/null and b/at/at00.gif differ diff --git a/at/at01.gif b/at/at01.gif new file mode 100755 index 000000000..53e966717 Binary files /dev/null and b/at/at01.gif differ diff --git a/at/at02.gif b/at/at02.gif new file mode 100755 index 000000000..7d804c161 Binary files /dev/null and b/at/at02.gif differ diff --git a/at/at03.gif b/at/at03.gif new file mode 100755 index 000000000..0b909d165 Binary files /dev/null and b/at/at03.gif differ diff --git a/at/at04.gif b/at/at04.gif new file mode 100755 index 000000000..517f54d94 Binary files /dev/null and b/at/at04.gif differ diff --git a/at/at2600.cpp b/at/at2600.cpp index d618e2d1c..897ba6419 100755 --- a/at/at2600.cpp +++ b/at/at2600.cpp @@ -7,7 +7,6 @@ #include "sezioni.h" #include - #include "at2.h" #include "at2600a.h" #include "atlib.h" @@ -489,7 +488,6 @@ bool TStampaIscritti::user_create() _rel->add(LF_SEZIONI, "CODSEZ==CODSEZ|CODSOT==CODSOT"); _rel->add("LCP", "CODTAB==DOM_CODLOC",1,0,ALIAS_LCPDOM); _rel->add(LF_COMUNI, "COM==DOM_CODCOM",1,0,ALIAS_COMDOM); - add_cursor(new TCursor(_rel, "", 3)); _msk = new TMask("at2600a"); @@ -505,13 +503,13 @@ bool TStampaIscritti::user_create() if (iscrtrr.exist()) _fileiscr = new TExternisamfile(iscrname, iscrtrr, false); + return TRUE; } bool TStampaIscritti::user_destroy() { - if (_fileiscr != NULL) - delete _fileiscr; + delete _fileiscr; delete _form_eti; delete _msk; delete _rel; diff --git a/at/ba00.gif b/at/ba00.gif new file mode 100755 index 000000000..53e966717 Binary files /dev/null and b/at/ba00.gif differ diff --git a/at/ba01.gif b/at/ba01.gif new file mode 100755 index 000000000..53e966717 Binary files /dev/null and b/at/ba01.gif differ diff --git a/at/ba02.gif b/at/ba02.gif new file mode 100755 index 000000000..8c76d8384 Binary files /dev/null and b/at/ba02.gif differ diff --git a/at/ba03.gif b/at/ba03.gif new file mode 100755 index 000000000..0b909d165 Binary files /dev/null and b/at/ba03.gif differ diff --git a/at/ba04.bmp b/at/ba04.bmp new file mode 100755 index 000000000..848652d64 Binary files /dev/null and b/at/ba04.bmp differ diff --git a/at/logo.bmp b/at/logo.bmp new file mode 100755 index 000000000..d8d13b8be Binary files /dev/null and b/at/logo.bmp differ diff --git a/ba/ba0100.cpp b/ba/ba0100.cpp index de2318305..6c6cede0b 100755 --- a/ba/ba0100.cpp +++ b/ba/ba0100.cpp @@ -3,19 +3,19 @@ #include #include #include + #include #include #include -#include #include #include + #include #include #include -#include - #include +#include #include "ba0.h" #include "ba0101.h" @@ -31,19 +31,13 @@ #define DLG_TREE 301 #define DLG_LIST 302 -#ifdef XVAGA -#define MEN_FILE "bamenu.men" -#else -#define MEN_FILE "baprassi.men" -#endif - /////////////////////////////////////////////////////////// // TMenu_application declaration /////////////////////////////////////////////////////////// class TMenu_application : public TSkeleton_application { - const char* _name; + TFilename _menuname; TMenu _menu; int _tree_view; @@ -51,9 +45,6 @@ class TMenu_application : public TSkeleton_application TMask* _mask; - static int _last_button; - static bool _find_button; - protected: // TApplication virtual bool user_create(); virtual bool destroy(); @@ -62,6 +53,8 @@ protected: // TApplication virtual void on_firm_change(); virtual bool test_assistance_year() const; + const TString& ask_user_password(); + protected: void deconnect_user(); virtual void main_loop(); @@ -101,7 +94,7 @@ public: void reload_images(); TMenu& main_menu() { return _menu; } - TMenu_application(const char* name) : _name(name), _mask(NULL) { } + TMenu_application(const char* name) : _menuname(name), _mask(NULL) { } virtual ~TMenu_application() { } }; @@ -262,21 +255,21 @@ TPicture_mask::TPicture_mask(const char* name, int dx, int dy, { set_current(submenu); TFilename logoname; - const char* ext[3] = { "jpg", "gif", "bmp" }; - for (int i = 0; i < 3; i++) + const char* const ext[] = { "jpg", "png", "gif", "bmp", NULL }; + for (int i = 0; ext[i]; i++) { logoname = "logo"; logoname << '.' << ext[i]; if (logoname.custom_path()) + break; } TImage logo(logoname); - if(logo.ok()) + if (logo.ok()) { if (can_be_transparent(logo)) logo.convert_transparent_color(MASK_BACK_COLOR); _logo = new TImage(logo); - } } @@ -788,8 +781,9 @@ COLOR TColor_mask::cid2color(short cid) const // Menu application /////////////////////////////////////////////////////////// -int TMenu_application::_last_button = 0; -bool TMenu_application::_find_button = false; +//int TMenu_application::_last_button = 0; +//bool TMenu_application::_find_button = false; + bool TMenu_application::test_assistance_year() const { @@ -930,12 +924,12 @@ HIDDEN bool pwd_handler(TMask_field& fld, KEY key) if (key == K_F8) { TMask& m = fld.mask(); - TString16 pwd; - TString16 usr = dongle().administrator(&pwd); + TString pwd; + TString usr = dongle().administrator(&pwd); TLocalisamfile users(LF_USER); - users.put("USERNAME", usr); + users.put(USR_USERNAME, usr); users.read(); - pwd = decode(users.get("PASSWORD")); + pwd = decode(users.get(USR_PASSWORD)); m.set(F_USER, usr); m.set(F_PASSWORD, pwd); m.stop_run(K_ENTER); @@ -948,30 +942,34 @@ void TMenu_application::reload_images() _menu.reload_images(); } -bool TMenu_application::check_user() -{ +const TString& TMenu_application::ask_user_password() +{ + TString& utente = get_tmp_string(); + utente = user(); + +#ifndef _DEMO_ // Disabilita le voci di personalizzazione - for (int mi = 2; mi <= 6; mi++) + int mi; + for (mi = 2; mi <= 7; mi++) disable_menu_item(MENU_ITEM(mi)); - TString utente(user()); - -#ifdef _DEMO_ - user() = utente = dongle().administrator(); - const bool ok = TRUE; -#else - TMask m("ba0100a"); if (is_power_station()) + { m.set_handler(F_USER, pwd_handler); m.set_handler(F_PASSWORD, pwd_handler); } + m.set(F_USER, utente); + m.first_focus(F_PASSWORD); + TEdit_field& e = m.efield(F_USER); e.browse()->set_filter("ISGROUP!=\"X\""); + TLocalisamfile& users = e.browse()->cursor()->file(); + TString pwd; bool ok = false; for (int i = 0; i < 3 && !ok; i++) @@ -982,103 +980,164 @@ bool TMenu_application::check_user() m.first_focus(F_PASSWORD); } + if (m.run() == K_ESC) break; utente = m.get(F_USER); - const TString& pass = m.get(F_PASSWORD); - pwd = ""; + TString pwd; - TLocalisamfile users(LF_USER); - users.put("USERNAME", utente); + users.put(USR_USERNAME, utente); if (users.read() == NOERR) { - pwd = decode(users.get("PASSWORD")); + pwd = decode(users.get(USR_PASSWORD)); } else { + // Creo l'amministratore se necessario users.zero(); - if (utente == dongle().administrator(&pwd)) + if (utente == dongle().administrator(&pwd)) { - users.put("USERNAME", utente); - users.put("USERDESC", "Amministratore"); - users.put("PASSWORD", encode(pwd)); + users.put(USR_USERNAME, utente); + users.put(USR_USERDESC, "Amministratore"); + users.put(USR_PASSWORD, encode(pwd)); users.write(); } else utente.cut(0); } - - ok = utente.not_empty() && pwd.not_empty() && pwd == pass; - - if (ok) + + const TString& pass = m.get(F_PASSWORD); + ok = utente.full() && pwd == pass; + + if (ok) { - ok = !users.get_bool("CONNECTED"); - if (!ok) + if (users.get_bool("CONNECTED")) { ok = yesno_box("%s\n%s", - TR("L'utente risulta essere già collegato"), - TR("Si desidera continuare ugualmente?")); + TR("L'utente risulta essere già collegato"), + TR("Si desidera continuare ugualmente?")); } - - if (ok) - { - users.put("USERNAME", dongle().administrator()); - users.read(); - if (users.get("AUTSTR") == "CONVERTING") - { - TString msg; msg << TR("E' in corso una conversione archivi") << ":\n"; - if (utente == dongle().administrator()) - { - msg << TR("Si desidera continuare ugualmente?"); - ok = yesno_box(msg); - } - else - { - msg << TR("Accesso negato."); - ok = error_box(msg); - } - } - } - - if (ok) - { - dongle().logout(); - user() = utente; - ok = get_serial_number() >= 0; - if (!ok) - error_box(TR("Probabilmente è stato superato il numero massimo di utenti")); - } - } - else + } + else { error_box(TR("Utente e/o password errata: fare attenzione alle maiuscole")); - m.set(F_PASSWORD,""); + m.reset(F_PASSWORD); } - + } + + if (ok && utente != dongle().administrator() && users.curr().exist(USR_DATAPWD)) + { + TConfig studio_ini(CONFIG_STUDIO, "Main"); + const long expiration = studio_ini.get_long("PasswordExpiration"); + bool runba = expiration > 0; + while (runba) + { + runba = users.get(USR_PASSWORD).empty(); + if (!runba) + { + const TDate oggi(TODAY); + const TDate datapwd = users.get_date(USR_DATAPWD); + if (datapwd.ok()) + runba = expiration < (oggi-datapwd); // Password scaduta + else + { + // Scrivi la data se necessario + users.put(USR_DATAPWD, oggi); + users.rewrite(); + } + } + if (runba) + { + warning_box(TR("La password e' scaduta o vuota:\ne' necessario inserirne una nuova")); + user() = utente; + TExternal_app app("ba1 -3"); + app.run(); + users.reread(); + } + } + } + + if (!ok) + utente.cut(0); + + // Abilita le voci di personalizzazione + for (mi = 2; mi <= 7; mi++) + enable_menu_item(MENU_ITEM(mi)); +#endif + + return utente; +} + +bool TMenu_application::check_user() +{ + bool ok = false; + +#ifndef _DEMO_ + TString utente = user(); + + if (_mask == NULL) // Primo login della sessione; + { + TConfig campo_ini(CONFIG_INSTALL, "Main"); + const use_system_user = campo_ini.get_bool("AutoLogin"); + if (use_system_user) + ok = !cache().get(LF_USER, utente).empty(); + } + + if (!ok) + { + utente = ask_user_password(); + ok = utente.full(); + } + + if (ok) + { + const TString& autstr = cache().get(LF_USER, dongle().administrator(), USR_AUTSTR); + if (autstr == "CONVERTING") + { + TString msg; msg << TR("E' in corso una conversione archivi") << ":\n"; + if (user() == dongle().administrator()) + { + msg << TR("Si desidera continuare ugualmente?"); + ok = yesno_box(msg); + } + else + { + msg << TR("Accesso negato."); + ok = error_box(msg); + } + } + + if (ok) + { + dongle().logout(); + user() = utente; + ok = get_serial_number() >= 0; + if (!ok) + error_box(TR("Probabilmente è stato superato il numero massimo di utenti")); + } + if (ok) { TLocalisamfile users(LF_USER); users.put("USERNAME", utente); - users.read(_isequal, _lock); - users.put("CONNECTED", "X"); - users.rewrite(); + if (users.read(_isequal, _lock) == NOERR) + { + users.put("CONNECTED", "X"); + users.rewrite(); + } + + // Memorizza l'ultimo utente per riproporlo la prossima volta + TConfig campo_ini(CONFIG_INSTALL, "Main"); + campo_ini.set("User", utente); } - } -#endif // _DEMO_ + } +#else + ok = true; +#endif if (ok) { - if (utente != dongle().administrator()) - { - TConfig prawin(CONFIG_INSTALL, "Main"); - prawin.set("User", utente); - } - - // Abilita le voci di personalizzazione - for (int mi = 2; mi <= 6; mi++) - enable_menu_item(MENU_ITEM(mi)); - customize_colors(); // Aggiorna set di colori reload_images(); // Ritrasparentizza immagini xvt_dwin_invalidate_rect(TASK_WIN, NULL); // Ridisegna sfondo @@ -1161,7 +1220,7 @@ bool TMenu_application::test_programs() TString msg = TR("I seguenti moduli devono essere aggiornati prima dell'utilizzo:"); int update_needed = 0; - for (int module = 0; scan.line().not_empty(); module++) + for (int module = 0; scan.line().full(); module++) { if (dongle().active(module)) { @@ -1206,18 +1265,18 @@ bool TMenu_application::test_programs() (!more && !yesno_box(TR("Si desidera aggiornare i moduli adesso?")))) break; - const TString16 old_user = user(); + const TString old_user = user(); user() = dongle().administrator(); // Divento temporaneamente amministratore TExternal_app app("ba1 -6"); app.run(); user() = old_user; // Ripristino utente normale - more = TRUE; // ricontrolla + more = true; // ricontrolla if (sys_dll_changed()) //costringe ad uscire dal programma se si e' installato il modulo SY return false; } _menu.set_dangerous_modules(dangerous); - return TRUE; + return true; } bool TMenu_application::user_create() @@ -1258,7 +1317,7 @@ bool TMenu_application::user_create() if (!_menu.ok()) { TWait_cursor hourglass; - TFilename menu = _name; + TFilename menu = _menuname; menu.ext("men"); _menu.read(menu); update_preferred_tree(); @@ -1496,6 +1555,7 @@ bool TMenu_application::choose_study() { disable_menu_item(MENU_ITEM(4)); + TMask m(TR("Scelta studio"), 1, 62, 4); m.add_button(DLG_OK, 0, "", -12, -1, 10, 2); m.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2); @@ -1519,6 +1579,7 @@ bool TMenu_application::choose_study() enable_menu_item(MENU_ITEM(4)); + return ok; } @@ -1677,8 +1738,9 @@ void TMenu_application::update_preferred_tree() if (sm != NULL) { const int num = node.get_int(1); - if (num < sm->items()) + if (num >= 0 && num < sm->items()) pref->add(new TMenuitem(sm->item(num))); + } } } @@ -1937,6 +1999,10 @@ bool TMenu_application::menu(MENU_TAG mt) case MENU_ITEM(4): choose_study(); break; case MENU_ITEM(5): add_to_preferred(); break; case MENU_ITEM(6): manage_preferred(); break; + case MENU_ITEM(7): + if (check_user()) + _mask->stop_run(K_CTRL + 'R'); // Ricarica maschera + break; default: if (mt >= MENU_ITEM(50) && mt < MENU_ITEM(50+_preferred.items())) { @@ -1972,18 +2038,29 @@ bool TMenu_application::menu(MENU_TAG mt) int ba0100(int argc, char** argv) { TApplication::check_parameters(argc, argv); - if (user().blank()) + + TString& u = user(); + if (u.blank()) { - TConfig prawin(CONFIG_INSTALL, "Main"); - TString16 u = prawin.get("User"); - if (u.blank()) - u = dongle().administrator(); - user() = u; + TConfig campo_ini(CONFIG_INSTALL, "Main"); + const bool su = campo_ini.get_bool("AutoLogin"); + if (su) // usa utente di windows + { + xvt_sys_get_user_name(u.get_buffer(), u.size()+1); + u.upper(); + if (u == "ADMINISTRATOR") // Converti amministratore + u = dongle().administrator(); + } + if (u.blank()) + u = campo_ini.get("User"); // Ultimo utente usato + if (u.blank()) + u = dongle().administrator(); // Usa amministratore come extrema ratio } TFilename menu = (argc < 2) ? MEN_FILE : argv[1]; if (menu.custom_path()) + { TMenu_application *ma = new TMenu_application(menu); ma->run(argc, argv, TR("Menu Principale")); @@ -1993,4 +2070,4 @@ int ba0100(int argc, char** argv) error_box(FR("Non esiste il menu %s"), (const char*)menu); return 0; -} +} \ No newline at end of file diff --git a/ba/ba0101.cpp b/ba/ba0101.cpp index 0d4114cdb..bfcee74bb 100755 --- a/ba/ba0101.cpp +++ b/ba/ba0101.cpp @@ -674,6 +674,7 @@ TImage& TMenu::image(const char* name) const char* ext[4] = { "jpg", "gif", "bmp", "png" }; bool bFound = false; for (int i = 0; i < 4 && !bFound; i++) + { realname = name; realname.ext(ext[i]); @@ -762,4 +763,4 @@ TMenu::TMenu() : _current(NULL), _item(0) { } TMenu::~TMenu() -{ } +{ } \ No newline at end of file diff --git a/ba/ba1400.cpp b/ba/ba1400.cpp index 30e22e44b..5878bb313 100755 --- a/ba/ba1400.cpp +++ b/ba/ba1400.cpp @@ -157,7 +157,7 @@ protected: virtual bool user_create(); virtual bool user_destroy(); virtual TMask* get_mask(int mode) { return _msk; } - virtual bool changing_mask(int mode) { return FALSE; } + virtual bool changing_mask(int mode) { return false; } virtual TRelation* get_relation() const { return _rel; } virtual int read(TMask& m); @@ -190,7 +190,7 @@ protected: virtual bool user_create(); virtual bool user_destroy(); virtual TMask* get_mask(int mode) { return _msk;} - virtual bool changing_mask(int mode) { return FALSE;} + virtual bool changing_mask(int mode) { return false;} virtual TRelation* get_relation() const { return _rel;} virtual int read(TMask& m); virtual bool remove(); @@ -297,7 +297,6 @@ TSubmenu& TMenu::get_submenu(const char* name) return *sub; } - void TMenu::import(const char* filename, TString& first) { TFilename fname(filename); fname.custom_path(); @@ -313,7 +312,7 @@ void TMenu::import(const char* filename, TString& first) first = line; sub = &get_submenu(line); } else - if (line.compare("Caption", 7, TRUE) == 0) + if (line.compare("Caption", 7, true) == 0) { CHECK(sub, "Invalid menu file"); const int equal = line.find('='); @@ -322,14 +321,14 @@ void TMenu::import(const char* filename, TString& first) line.strip("\""); *sub = line; } else - if (line.compare("Module", 6, TRUE) == 0) + if (line.compare("Module", 6, true) == 0) { CHECK(sub, "Invalid menu file"); const int equal = line.find('='); CHECK(equal > 0, "Invalid menu Module"); sub->set_module(atoi(line.mid(equal+1))); } else - if (line.compare("Item", 4, TRUE) == 0) + if (line.compare("Item", 4, true) == 0) { CHECK(sub, "Invalid menu file"); const int equal = line.find('='); @@ -388,7 +387,7 @@ TMenu::TMenu(const char* menuname) bool TSet_users::user_handler(TMask_field& f, KEY key) { if (!f.mask().query_mode() || !f.to_check(key)) - return TRUE; + return true; const bool ok = f.get().find(' ') < 0; if (!ok) return f.error_box(TR("Il nome dell'utente non deve contenere spazi")); @@ -410,16 +409,45 @@ bool TSet_users::group_handler(TMask_field& f, KEY key) } app().build_sheet(&rec); } - return TRUE; + return true; } bool TSet_user_passwd::password_handler(TMask_field& f, KEY key) { - if (f.mask().query_mode() || key != K_ENTER) return TRUE; - const bool ok = f.get().len() > 3 && f.get().find(' ') < 0; + bool ok = true; - if (!ok) - return f.error_box(TR("La password deve essere lunga almeno 4 caratteri e non contenere spazi")); + if (key == K_ENTER && !f.mask().query_mode()) + { + const TString& pwd = f.get(); + const int pwdlen = pwd.len(); + + for (int i = pwdlen-1; i >= 0; i--) + { + if (pwd[i] >= 0 && pwd[i] <= ' ') + { + ok = error_box("La password contiene un carattere non valido."); + break; + } + } + + if (ok) + { + TConfig ini(CONFIG_STUDIO, "Main"); + const int minlen = ini.get_int("MinPwdLen", NULL, -1, 4); + if (pwdlen < minlen) + { + TString msg; msg.format(TR("La password deve essere lunga almeno %d caratteri."), minlen); + if (pwdlen == 0 && user() == dongle().administrator()) + { + msg << '\n' << TR("Si desidera continuare ugualmente?"); + ok = yesno_box(msg); + } + else + ok = f.error_box(msg); + } + } + } + return ok; } @@ -440,7 +468,7 @@ bool TSet_users::tree_handler(TMask_field& f, KEY key) { menu->properties(old) = sf.rows_array(); - const TString16 mod = old.left(2); + const TString4 mod = old.left(2); TString_array& mprop = menu->properties(mod); if (m.get_bool(F_NOWRITE)) { @@ -473,16 +501,16 @@ bool TSet_users::tree_handler(TMask_field& f, KEY key) sf.check_row(r); sf.force_update(); } - const TString16 mod = cmd.left(2); + const TString4 mod = cmd.left(2); const TString_array* mprop = menu->find_properties(mod); m.enable(F_NOWRITE); m.set(F_NOWRITE, mprop && mprop->items() ? "X" : ""); - m.field(F_NOWRITE).set_dirty(FALSE); + m.field(F_NOWRITE).set_dirty(false); } } } } - return TRUE; + return true; } bool TSet_users::p_notify(TSheet_field& f, int r, KEY k) @@ -498,7 +526,7 @@ bool TSet_users::p_notify(TSheet_field& f, int r, KEY k) default: break; } - return TRUE; + return true; } void TSet_user_passwd::build_sheet(const TRectype* r) @@ -600,14 +628,14 @@ bool TSet_user_passwd::user_has_module(int mod) bool TSet_users::k_notify(TSheet_field& f, int r, KEY k) { if (k == K_INS || k == K_DEL) - return FALSE; + return false; if (k == K_TAB) { TMask& m = f.sheet_mask(); m.enable(F_ENABLE, f.cell_enabled(r, f.cid2index(F_ENABLE))); } - return TRUE; + return true; } bool TSet_user_passwd::user_create() @@ -625,7 +653,7 @@ bool TSet_user_passwd::user_create() _msk->enable_page(1, superuser); _msk->enable(-G_SUPERUSER, superuser); - return TRUE; + return true; } bool TSet_users::user_create() @@ -646,7 +674,7 @@ bool TSet_users::user_create() _msk->tfield(F_PERMESSI).set_tree(_tree); _msk->sfield(F_PROPERTIES).set_notify(p_notify); - return TRUE; + return true; } int TSet_users::read(TMask& m) @@ -655,7 +683,7 @@ int TSet_users::read(TMask& m) const TRectype& r = get_relation()->curr(); build_sheet(&r); - const TString16 pwd = decode(r.get("PASSWORD")); + const char* pwd = decode(r.get("PASSWORD")); m.set(F_PASSWORD, pwd); m.set(F_PROVA, pwd); @@ -664,19 +692,22 @@ int TSet_users::read(TMask& m) return NOERR; } - void TSet_user_passwd::put_in_record(const TMask& m) { - const TString16 s = encode(m.get(F_PASSWORD)); TRectype& r = get_relation()->curr(); - if (_msk->get(F_USER) == user()) + const char* s = encode(m.get(F_PASSWORD)); + if (r.get("PASSWORD") != s) + { r.put("PASSWORD", s); - else - error_box(TR("Impossibile cambiare la password di altri utenti")); + if (r.exist("DATAPWD")) + r.put("DATAPWD", TDate(TODAY)); + } } void TSet_users::put_in_record(const TMask& m) { + TSet_user_passwd::put_in_record(m); + TString autstr(ENDAUT, ' '); TSheet_field& sf = sheet_field(); FOR_EACH_SHEET_ROW(sf, i, riga) @@ -687,9 +718,7 @@ void TSet_users::put_in_record(const TMask& m) autstr[module] = c; } - const TString16 s = encode(m.get(F_PASSWORD)); TRectype& r = get_relation()->curr(); - r.put("PASSWORD", s); r.put("AUTSTR", autstr); TToken_string prop_field(256, '\n'); @@ -726,10 +755,9 @@ bool TSet_users::remove() const bool ok = TRelation_application::remove(); if (ok) { - const TString16 u = get_relation()->curr().get("USERNAME"); TFilename file = firm2dir(-1); // Directory dati file.add("config"); // Directory configurazioni - file.add(u); // Nome utente + file.add(get_relation()->curr().get("USERNAME")); // Nome utente file.ext("ini"); // Estensione ::remove(file); } @@ -738,16 +766,18 @@ bool TSet_users::remove() bool TSet_user_passwd::user_destroy() { - if (_msk != NULL) delete _msk; - if (_rel != NULL) delete _rel; - if (_im != NULL) delete _im; - return TRUE; + if (_msk != NULL) delete _msk; + if (_rel != NULL) delete _rel; + if (_im != NULL) delete _im; + return true; } + bool TSet_users::user_destroy() { TSet_user_passwd::user_destroy(); - if (_tree != NULL) delete _tree; - return TRUE; + if (_tree != NULL) + delete _tree; + return true; } @@ -757,7 +787,7 @@ int TSet_user_passwd::read(TMask& m) const TRectype& r = get_relation()->curr(); build_sheet(&r); - const TString16 pwd =decode(r.get("PASSWORD")); + const char* pwd = decode(r.get("PASSWORD")); m.set(F_PASSWORD, pwd); m.set(F_PROVA, pwd); @@ -769,6 +799,7 @@ void TSet_user_passwd::init_query_mode(TMask& m) enable_aut(); _msk->set(F_USER,user()); _msk->send_key(K_AUTO_ENTER,0); + _msk->disable(DLG_NEWREC); _msk->disable(DLG_FINDREC); _msk->disable(DLG_DELREC); } @@ -776,8 +807,10 @@ void TSet_user_passwd::init_query_mode(TMask& m) void TSet_user_passwd::init_modify_mode(TMask& m) { enable_aut(); + _msk->disable(DLG_NEWREC); _msk->disable(DLG_FINDREC); _msk->disable(DLG_DELREC); + _msk->enable_page(1, false); } int ba1400(int argc, char** argv) diff --git a/ba/ba8200.cpp b/ba/ba8200.cpp index 816b3db3e..5a08dde1e 100755 --- a/ba/ba8200.cpp +++ b/ba/ba8200.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -917,6 +917,7 @@ void TQuery_mask::save_as(TRecordsetExportFormat fmt) return; } + xvt_fsys_save_dir(); TFilename path; path.tempdir(); @@ -1519,4 +1520,4 @@ int ba8200(int argc, char* argv[]) TSQL_recordset_app app; app.run(argc, argv, TR("Query Generator")); return 0; -} +} \ No newline at end of file diff --git a/ba/ba8300.cpp b/ba/ba8300.cpp index 463984e95..f3e89b230 100755 --- a/ba/ba8300.cpp +++ b/ba/ba8300.cpp @@ -21,6 +21,7 @@ /////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////// // TReport_sheet /////////////////////////////////////////////////////////// @@ -167,6 +168,7 @@ void TSection_properties_mask::vedo_non_vedo() show(F_CONDITION, /*type == 'B' &&*/ level > 0 && level < 10); show(F_GROUP_BY, type == 'H' && level > 1 && level < 10); show(F_SQL, type == 'B' && level > 10); + show(F_KEEP_WITH_NEXT, level > 1 && type == 'H'); show(F_CAN_BREAK, level > 0 && type == 'B'); show(F_HIDE_IF_NEEDED, level == 0 && type != 'B'); @@ -314,6 +316,7 @@ void TReport_properties_mask::set_report(const TReport& r) set(F_FONT_AUTO, r.use_printer_font()); set(F_ORIENTATION, r.orientation()); set(F_DX, r.user_defined_cpi()); + set(F_DY, r.lpi()); set_font_info(r.font()); set(F_CLASS, r.get_class()); @@ -341,6 +344,7 @@ void TReport_properties_mask::get_report(TReport& r) const r.set_orientation(get_int(F_ORIENTATION)); r.set_class(get(F_CLASS)); r.set_command_line(get(F_COMMAND)); + const TString& oldlib = r.get_libraries(); if (oldlib != get(F_INCLUDE)) @@ -973,7 +977,6 @@ bool TReport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly warning_box(TR("Nessuna riga risultato")); } delete rex; - } } break; diff --git a/ba/ba8300.h b/ba/ba8300.h index 51e0a55a8..9842e8e3f 100755 --- a/ba/ba8300.h +++ b/ba/ba8300.h @@ -56,9 +56,9 @@ #define F_ORIENTATION 169 #define F_CLASS 170 #define F_COMMAND 171 + #define F_SQL 201 #define F_IMPORT_QRY 202 #define F_NEW_QRY 203 #define F_SHOW_QRY 204 - diff --git a/ba/ba8300c.uml b/ba/ba8300c.uml index 2b372d5e5..b12639dae 100755 --- a/ba/ba8300c.uml +++ b/ba/ba8300c.uml @@ -49,6 +49,7 @@ END BOOLEAN F_DISABLED BEGIN PROMPT 24 4 "Disattivata" + END BOOLEAN F_PAGE_BREAK @@ -94,9 +95,18 @@ MEMO F_CONDITION 58 6 BEGIN // Visibile sezioni con livello > 0 PROMPT 1 8 "Condizione" + FLAGS "H" END +MEMO F_SQL 56 6 +BEGIN + // Visibile sezioni con livello > 10 + PROMPT 1 6 "Query" + FLAGS "H" + CHECKTYPE REQUIRED +END + BUTTON DLG_OK 10 2 BEGIN PROMPT -13 -1 "" @@ -231,4 +241,3 @@ END ENDPAGE ENDMASK - diff --git a/ba/ba8300d.uml b/ba/ba8300d.uml index f34e090de..544182709 100755 --- a/ba/ba8300d.uml +++ b/ba/ba8300d.uml @@ -24,6 +24,14 @@ BEGIN CHECKTYPE NORMAL END +RADIO F_ORIENTATION 1 24 +BEGIN + PROMPT 1 1 "@bOrientamento della carta" + ITEM "0|Impostazioni Stampante" + ITEM "1|Ritratto (Verticale)" + ITEM "2|Paesaggio (Orizzontale)" +END + NUMBER F_DY 2 BEGIN PROMPT 1 6 "Linee per pollice " @@ -54,11 +62,14 @@ END BUTTON DLG_CANCEL 10 2 BEGIN PROMPT -12 -1 "" + END BUTTON DLG_OK 10 2 + BEGIN PROMPT -22 -1 "" + END ENDPAGE @@ -68,6 +79,7 @@ PAGE "Parametri" -1 -1 60 16 SPREADSHEET F_PARAMS 0 -3 BEGIN PROMPT 1 1 "" + ITEM "Parametro@16" ITEM "Valore@50" END @@ -128,6 +140,26 @@ END ENDPAGE +PAGE "Allegati" -1 -1 60 16 + +SPREADSHEET F_LINK 0 -3 +BEGIN + PROMPT 1 1 "" + ITEM "Allegato@50" +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -12 -1 "" +END + +BUTTON DLG_OK 10 2 +BEGIN + PROMPT -22 -1 "" +END + +ENDPAGE + ENDMASK PAGE "Parametro" -1 -1 60 5 diff --git a/ba/ba8301.cpp b/ba/ba8301.cpp index 5bcfb06b4..5b2ab0df9 100755 --- a/ba/ba8301.cpp +++ b/ba/ba8301.cpp @@ -1700,7 +1700,9 @@ void TReport_window::draw_field(const TReport_field& rf) advanced_draw_rect(r, rf.pattern(), rf.border(), rf.fore_color(), rf.back_color(), rad, off); xvt_dwin_set_font(win(), rf.font().get_xvt_font(*this)); set_color(rf.fore_color(), rf.back_color()); - advanced_draw_text_line(*this, rf.picture(), r, rf.horizontal_alignment(), rf.vertical_alignment()); + + TString str = rf.picture(); + advanced_draw_paragraph(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment(), _default_row_height); } break; default : @@ -1734,7 +1736,7 @@ void TReport_window::draw_field(const TReport_field& rf) str << rf.id(); else str = rf.field(); - advanced_draw_text_line(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment()); + advanced_draw_paragraph(*this, str, r, rf.horizontal_alignment(), rf.vertical_alignment(), _default_row_height); break; } @@ -1801,7 +1803,6 @@ void TReport_window::update() draw_grid(); // Disegna griglia draw_bg(); - const TRectangle rect_riga(0,0,1000,100); RCT rct_riga; TWindow::log2dev(rect_riga, rct_riga); _default_row_height = rct_riga.bottom - rct_riga.top; diff --git a/ba/f155.dir b/ba/f155.dir new file mode 100755 index 000000000..817c594b8 --- /dev/null +++ b/ba/f155.dir @@ -0,0 +1,3 @@ +155 +0 +$multirel|0|0|96|0|Relazione molti a molti||| diff --git a/ba/f155.trr b/ba/f155.trr new file mode 100755 index 000000000..54af41044 --- /dev/null +++ b/ba/f155.trr @@ -0,0 +1,9 @@ +155 +4 +COD|1|5|0|Codice relazione +FIRST|1|20|0|Primo elemento +SECOND|1|20|0|Secondo elemento +DATA|1|50|0|Dati +2 +COD+FIRST+SECOND| +COD+SECOND+FIRST| diff --git a/ce/ce2300.cpp b/ce/ce2300.cpp index 147c0985e..6ec1afce9 100755 --- a/ce/ce2300.cpp +++ b/ce/ce2300.cpp @@ -92,6 +92,7 @@ bool TCesp2cg_qmask::on_field_event(TOperable_field& o, TField_event e, long jol } break; case F_CODCAT2: + case F_DESCAT: return ditta_cespiti().on_category_event(o, e, jolly); case F_IDCESPITE: if (e == fe_close) @@ -303,7 +304,7 @@ void TCesp2cg::init_insert_mode(TMask& m) init_mask(m); // Valori preimpostati "quasi" sempre buoni :-) - m.set(F_TIPO, 1); m.set(F_TIPOTRAS, "T"); + m.set(F_TIPO, 1); const TString& idcespite = m.get(F_IDCESPITE); if (!idcespite.blank()) diff --git a/ce/ce2300a.h b/ce/ce2300a.h index e55b82b48..040b536a3 100755 --- a/ce/ce2300a.h +++ b/ce/ce2300a.h @@ -16,9 +16,7 @@ #define F_CODCAT2 116 #define F_DESCAT2 117 #define F_IDCESPITE2 118 -#define F_TIPOTRAS 119 -#define F_CENTRO_COS 120 -#define F_COMPL 121 +#define F_COMPL 119 #define F_IMM_G 201 #define F_IMM_C 202 diff --git a/ce/ce2300a.uml b/ce/ce2300a.uml index 99c93fdfe..ecf5a4b8e 100755 --- a/ce/ce2300a.uml +++ b/ce/ce2300a.uml @@ -139,9 +139,9 @@ RADIOBUTTON F_TIPO 1 14 BEGIN PROMPT 0 6 "Selezione" ITEM "1|Categorie" - MESSAGE ENABLE,F_CODCAT|CLEAR,F_IDCESPITE|REQUIRED,F_CODCAT|NORMAL,F_IDCESPITE|"1",F_TIPO2 + MESSAGE ENABLE,F_CODCAT|CLEAR,F_DESCES|ENABLE,F_DESCAT|CLEAR,F_IDCESPITE|REQUIRED,F_CODCAT,NORMAL,F_IDCESPITE,NORMAL,F_DESCES|"1",F_TIPO2 ITEM "2|Cespiti" - MESSAGE ENABLE,F_IDCESPITE|CLEAR,F_CODCAT|NORMAL,F_CODCAT|REQUIRED,F_IDCESPITE|"2",F_TIPO2 + MESSAGE ENABLE,F_IDCESPITE|ENABLE,F_DESCES|CLEAR,F_DESCAT|CLEAR,F_CODCAT|NORMAL,F_CODCAT,REQUIRED,F_IDCESPITE,REQUIRED,F_DESCES|"2",F_TIPO2 GROUP 1 END @@ -150,10 +150,11 @@ BEGIN PROMPT 0 6 "Selezione" FLAGS "P" ITEM "1|Categorie" - MESSAGE ENABLE,F_CODCAT2|CLEAR,F_IDCESPITE2|REQUIRED,F_CODCAT2,NORMAL,F_IDCESPITE2 + MESSAGE ENABLE,F_CODCAT2|CLEAR,F_DESCES|ENABLE,F_DESCAT|CLEAR,F_IDCESPITE2|REQUIRED,F_CODCAT2,NORMAL,F_IDCESPITE2,NORMAL,F_DESCES ITEM "2|Cespiti" - MESSAGE ENABLE,F_IDCESPITE2|CLEAR,F_CODCAT2|NORMAL,F_CODCAT2,REQUIRED,F_IDCESPITE2 + MESSAGE ENABLE,F_IDCESPITE2|ENABLE,F_DESCES|CLEAR,F_DESCAT|CLEAR,F_CODCAT2|NORMAL,F_CODCAT2,REQUIRED,F_IDCESPITE2,REQUIRED,F_DESCES GROUP 2 + FLAGS "G" END @@ -184,7 +185,8 @@ END STRING F_DESCAT 70 54 BEGIN PROMPT 22 7 "" - FLAGS "D" + KEY 2 + FLAGS "B" END STRING F_IDCESPITE 10 @@ -218,16 +220,22 @@ BEGIN COPY OUTPUT F_IDCESPITE CHECKTYPE REQUIRED FIELD IDCESPITE - MESSAGE COPY,F_IDCESPITE KEY 1 - GROUP 2 - WARNING "Inserire un cespite valido" + GROUP 1 END STRING F_DESCES 50 47 BEGIN PROMPT 29 8 "" - FLAGS "D" + USE LF_CESPI KEY 2 + INPUT DESC F_DESCES + DISPLAY "Descrizione@50" DESC + DISPLAY "Cespite@10" IDCESPITE + DISPLAY "Categoria" CODCAT + COPY OUTPUT F_IDCESPITE + CHECKTYPE REQUIRED + KEY 2 + GROUP 1 END ENDPAGE diff --git a/ce/ce2300b.uml b/ce/ce2300b.uml new file mode 100755 index 000000000..cd31ca18d --- /dev/null +++ b/ce/ce2300b.uml @@ -0,0 +1,687 @@ +#include "ce2300a.h" + +TOOLBAR "Toolbar" 0 -3 0 3 + +BUTTON DLG_SAVEREC 10 2 +BEGIN + PROMPT -16 -11 "~Registra" + MESSAGE EXIT,K_SAVE + PICTURE BMP_SAVEREC + PICTURE BMP_SAVERECDN +END + +BUTTON DLG_NEWREC 10 2 +BEGIN + PROMPT -26 -11 "~Nuovo" + MESSAGE EXIT,K_INS + PICTURE BMP_NEWREC + PICTURE BMP_NEWRECDN +END + +BUTTON DLG_DELREC 10 2 +BEGIN + PROMPT -36 -11 "~Elimina" + MESSAGE EXIT,K_DEL + PICTURE BMP_DELREC + PICTURE BMP_DELRECDN +END + +BUTTON DLG_FINDREC 10 2 +BEGIN + PROMPT -46 -11 "Ri~cerca" + MESSAGE EXIT,K_F9 + PICTURE 126 +END + +BUTTON DLG_CANCEL 10 2 +BEGIN + PROMPT -56 -11 "~Annulla" + MESSAGE EXIT,K_ESC + PICTURE 102 +END + +BUTTON DLG_QUIT 10 2 +BEGIN + PROMPT -66 -11 "~Fine" + MESSAGE EXIT,K_QUIT + PICTURE BMP_QUIT + PICTURE BMP_QUITDN +END + +ENDPAGE + +PAGE "Collegamento Contabilità" -1 -1 78 10 + +GROUPBOX DLG_NULL 78 10 +BEGIN + PROMPT 0 1 "@bParametri ditta" +END + +NUMBER F_DITTA 5 +BEGIN + PROMPT 1 2 "Ditta " + FLAGS "DF" +END + +STRING F_RAGSOC 50 +BEGIN + PROMPT 26 2 "" + USE LF_NDITTE + INPUT CODDITTA F_DITTA + OUTPUT F_RAGSOC RAGSOC + CHECKTYPE NORMAL + FLAGS "D" +END + +NUMBER F_ESERCIZIO 4 +BEGIN + PROMPT 1 3 "Esercizio " + FLAGS "AZD" + USE CCE + JOIN ESC ALIAS 104 INTO CODTAB==CODTAB + INPUT CODTAB F_ESERCIZIO + DISPLAY "Codice esercizio" CODTAB + DISPLAY "Inizio esercizio" 104@->D0 + DISPLAY "Fine esercizio" 104@->D1 + OUTPUT F_ESERCIZIO CODTAB + OUTPUT F_INIZIO_ES 104@->D0 + OUTPUT F_FINE_ES 104@->D1 +END + +DATE F_INIZIO_ES +BEGIN + PROMPT 26 3 "Inizio " + FLAGS "D" +END + +DATE F_FINE_ES +BEGIN + PROMPT 50 3 "Fine " + FLAGS "D" +END + +NUMBER F_GRUPPO 2 +BEGIN + PROMPT 1 4 "Gruppo " + FLAGS "PZD" + FIELD CODGRUPPO + KEY 1 +END + +STRING F_SPECIE 4 +BEGIN + PROMPT 16 4 "Specie " + FLAGS "_PD" + USE CCB + JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10] + INPUT CODTAB[1,4] F_ESERCIZIO SELECT + INPUT CODTAB[5,6] F_GRUPPO + INPUT CODTAB[7,10] F_SPECIE + DISPLAY "Gruppo" CODTAB[5,6] + DISPLAY "Specie" CODTAB[7,10] + DISPLAY "Descrizione@50" 400@->S0 + OUTPUT F_GRUPPO CODTAB[5,6] + OUTPUT F_SPECIE CODTAB[7,10] + OUTPUT F_DESC_GRSP 400@->S0 + FIELD CODSPECIE +END + +STRING F_DESC_GRSP 60 45 +BEGIN + PROMPT 31 4 "" + FLAGS "D" +END + +RADIOBUTTON F_TIPO 1 14 +BEGIN + PROMPT 0 6 "Selezione" + ITEM "1|Categorie" + ITEM "2|Cespiti" + FLAGS "DG" +END + +NUMBER F_CODCAT 2 +BEGIN + PROMPT 16 7 "" + FLAGS "BZD" + CHECKTYPE REQUIRED + FIELD CODCAT + MESSAGE COPY,F_CODCAT2 +END + +STRING F_DESCAT 70 54 +BEGIN + PROMPT 22 7 "" + FLAGS "D" +END + +STRING F_IDCESPITE 10 +BEGIN + PROMPT 16 8 "" + FLAGS "UZD" + USE LF_COLLCES SELECT IDCESPITE!="" + JOIN LF_CESPI INTO IDCESPITE==IDCESPITE + INPUT CODGRUPPO F_GRUPPO SELECT + INPUT CODSPECIE F_SPECIE SELECT + INPUT IDCESPITE F_IDCESPITE + DISPLAY "Cespite@10" IDCESPITE + DISPLAY "Categoria" LF_CESPI->CODCAT + DISPLAY "Descrizione@50" LF_CESPI->DESC + OUTPUT F_IDCESPITE IDCESPITE + OUTPUT F_DESCES LF_CESPI->DESC + FIELD IDCESPITE +END + +BOOLEAN F_COMPL +BEGIN + PROMPT 18 8 "Chiave completa " + FLAGS "H" +END + +STRING F_DESCES 50 47 +BEGIN + PROMPT 29 8 "" + FLAGS "D" +END + +GROUPBOX DLG_NULL 78 9 +BEGIN + PROMPT 1 12 "" + FLAGS "R" +END + +TEXT DLG_NULL +BEGIN + PROMPT 25 11 "Gruppo" +END + +TEXT DLG_NULL +BEGIN + PROMPT 31 11 "Conto" +END + +TEXT DLG_NULL +BEGIN + PROMPT 37 11 "Sottoc." +END + +TEXT DLG_NULL +BEGIN + PROMPT 46 11 "Descrizione" +END + +NUMBER F_IMM_G 3 +BEGIN + PROMPT 2 13 "Immobilizzazione " + FIELD GRUPPO + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_IMM_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_IMM_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_IMM_C 3 +BEGIN + PROMPT 31 13 "" + FIELD CONTO + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")) + COPY INPUT F_IMM_G + INPUT CONTO F_IMM_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_IMM_G GRUPPO + OUTPUT F_IMM_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_IMM_S 6 +BEGIN + PROMPT 37 13 "" + FIELD SOTTOC + FLAGS "R" + USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" + COPY INPUT F_IMM_C + INPUT SOTTOCONTO F_IMM_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Sosp." SOSPESO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_IMM_S SOTTOCONTO + OUTPUT F_IMM_G GRUPPO + OUTPUT F_IMM_C CONTO + OUTPUT F_IMM_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_IMM_D 50 29 +BEGIN + PROMPT 46 13 "" + USE LF_PCON KEY 2 + INPUT DESCR F_IMM_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_IMM_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QNOR_G 3 +BEGIN + PROMPT 2 14 "Quote amm.to normale " + FIELD GRUPPOQNO + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_QNOR_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QNOR_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QNOR_C 3 +BEGIN + PROMPT 31 14 "" + FIELD CONTOQNO + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")) + COPY INPUT F_QNOR_G + INPUT CONTO F_QNOR_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QNOR_G GRUPPO + OUTPUT F_QNOR_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QNOR_S 6 +BEGIN + PROMPT 37 14 "" + FIELD SOTTOCQNO + FLAGS "R" + USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" + COPY INPUT F_QNOR_C + INPUT SOTTOCONTO F_QNOR_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Sosp." SOSPESO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QNOR_S SOTTOCONTO + OUTPUT F_QNOR_G GRUPPO + OUTPUT F_QNOR_C CONTO + OUTPUT F_QNOR_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_QNOR_D 50 29 +BEGIN + PROMPT 46 14 "" + USE LF_PCON KEY 2 + INPUT DESCR F_QNOR_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_QNOR_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QANT_G 3 +BEGIN + PROMPT 2 15 "Quote amm.to anticipato" + FIELD GRUPPOQAN + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_QANT_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QANT_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QANT_C 3 +BEGIN + PROMPT 31 15 "" + FIELD CONTOQAN + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")) + COPY INPUT F_QANT_G + INPUT CONTO F_QANT_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QANT_G GRUPPO + OUTPUT F_QANT_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QANT_S 6 +BEGIN + PROMPT 37 15 "" + FIELD SOTTOCQAN + FLAGS "R" + USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" + COPY INPUT F_QANT_C + INPUT SOTTOCONTO F_QANT_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Sosp." SOSPESO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QANT_S SOTTOCONTO + OUTPUT F_QANT_G GRUPPO + OUTPUT F_QANT_C CONTO + OUTPUT F_QANT_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_QANT_D 50 29 +BEGIN + PROMPT 46 15 "" + USE LF_PCON KEY 2 + INPUT DESCR F_QANT_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_QANT_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QACC_G 3 +BEGIN + PROMPT 2 16 "Quote amm.to accelerato" + FIELD GRUPPOQAC + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_QACC_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QACC_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QACC_C 3 +BEGIN + PROMPT 31 16 "" + FIELD CONTOQAC + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")) + COPY INPUT F_QACC_G + INPUT CONTO F_QACC_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QACC_G GRUPPO + OUTPUT F_QACC_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_QACC_S 6 +BEGIN + PROMPT 37 16 "" + FIELD SOTTOCQAC + FLAGS "R" + USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" + COPY INPUT F_QACC_C + INPUT SOTTOCONTO F_QACC_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Sosp." SOSPESO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_QACC_S SOTTOCONTO + OUTPUT F_QACC_G GRUPPO + OUTPUT F_QACC_C CONTO + OUTPUT F_QACC_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_QACC_D 50 29 +BEGIN + PROMPT 46 16 "" + USE LF_PCON KEY 2 + INPUT DESCR F_QACC_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_QACC_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FNOR_G 3 +BEGIN + PROMPT 2 17 "Fondo amm.to normale " + FIELD GRUPPOFN + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_FNOR_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FNOR_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FNOR_C 3 +BEGIN + PROMPT 31 17 "" + FIELD CONTOFN + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")&&(INDBIL==4)) + COPY INPUT F_FNOR_G + INPUT CONTO F_FNOR_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FNOR_G GRUPPO + OUTPUT F_FNOR_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FNOR_S 6 +BEGIN + PROMPT 37 17 "" + FIELD SOTTOCFN + FLAGS "R" + USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" + INPUT GRUPPO F_FNOR_G SELECT + INPUT CONTO F_FNOR_C SELECT + INPUT SOTTOCONTO F_FNOR_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Sosp." SOSPESO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FNOR_S SOTTOCONTO + OUTPUT F_FNOR_G GRUPPO + OUTPUT F_FNOR_C CONTO + OUTPUT F_FNOR_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_FNOR_D 50 29 +BEGIN + PROMPT 46 17 "" + USE LF_PCON KEY 2 + INPUT DESCR F_FNOR_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_FNOR_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FANT_G 3 +BEGIN + PROMPT 2 18 "Fondo amm.to anticipato" + FIELD GRUPPOFA + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_FANT_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FANT_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FANT_C 3 +BEGIN + PROMPT 31 18 "" + FIELD CONTOFA + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")&&(INDBIL==3)) + COPY INPUT F_FANT_G + INPUT CONTO F_FANT_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FANT_G GRUPPO + OUTPUT F_FANT_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FANT_S 6 +BEGIN + PROMPT 37 18 "" + FIELD SOTTOCFA + FLAGS "R" + USE LF_PCON KEY 1 SELECT SOTTOCONTO!="" + INPUT GRUPPO F_FANT_G SELECT + INPUT CONTO F_FANT_C SELECT + INPUT SOTTOCONTO F_FANT_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Sosp." SOSPESO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FANT_S SOTTOCONTO + OUTPUT F_FANT_G GRUPPO + OUTPUT F_FANT_C CONTO + OUTPUT F_FANT_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_FANT_D 50 29 +BEGIN + PROMPT 46 18 "" + USE LF_PCON KEY 2 + INPUT DESCR F_FANT_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_FANT_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FACC_G 3 +BEGIN + PROMPT 2 19 "Fondo amm.to accelerato" + FIELD GRUPPOACC + FLAGS "R" + USE LF_PCON KEY 1 SELECT CONTO="" + INPUT GRUPPO F_FACC_G + DISPLAY "Gruppo" GRUPPO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FACC_G GRUPPO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FACC_C 3 +BEGIN + PROMPT 31 19 "" + FIELD CONTOACC + FLAGS "R" + USE LF_PCON KEY 1 SELECT ((CONTO!="")&&(SOTTOCONTO="")) + COPY INPUT F_FACC_G + INPUT CONTO F_FACC_C + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Descrizione@50" DESCR + OUTPUT F_FACC_G GRUPPO + OUTPUT F_FACC_C CONTO + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +NUMBER F_FACC_S 6 +BEGIN + PROMPT 37 19 "" + FIELD SOTTOCACC + FLAGS "R" + USE LF_PCON SELECT SOTTOCONTO!="" + COPY INPUT F_FACC_C + INPUT SOTTOCONTO F_FACC_S + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sospeso" SOSPESO + OUTPUT F_FACC_S SOTTOCONTO + OUTPUT F_FACC_G GRUPPO + OUTPUT F_FACC_C CONTO + OUTPUT F_FACC_D DESCR + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +STRING F_FACC_D 50 29 +BEGIN + PROMPT 46 19 "" + USE LF_PCON KEY 2 + INPUT DESCR F_FACC_D + DISPLAY "Descrizione@50" DESCR + DISPLAY "Sosp." SOSPESO + DISPLAY "Gruppo" GRUPPO + DISPLAY "Conto" CONTO + DISPLAY "Sottoconto" SOTTOCONTO + COPY OUTPUT F_FACC_S + ADD RUN CG0 -0 + CHECKTYPE REQUIRED +END + +ENDPAGE + +ENDMASK + diff --git a/ce/ce3200.cpp b/ce/ce3200.cpp index b15d68792..7c2f7a9cc 100755 --- a/ce/ce3200.cpp +++ b/ce/ce3200.cpp @@ -240,6 +240,7 @@ void TStampa_storico::print_percespite( const int tipo) TEsercizi_contabili esc; const TDate& inies = esc[esercizio].inizio(); + if (!errore) do //se non c'é incongruenza di date procede alla stampa righe 2 { @@ -579,4 +580,4 @@ int ce3200(int argc, char* argv[]) TStampa_storico a; a.run(argc,argv,TR("Stampa schede cespiti")); return 0; -} +} \ No newline at end of file diff --git a/ce/f140.dir b/ce/f140.dir index f3414cd22..5f59840ec 100755 --- a/ce/f140.dir +++ b/ce/f140.dir @@ -1,3 +1,3 @@ 140 0 -$collces|0|0|110|0|Collegamento contabile cespiti||| +$collces|0|0|106|0|Collegamento contabile cespiti||| diff --git a/ce/f140.trr b/ce/f140.trr index f6b1c6a82..6391f5c13 100755 --- a/ce/f140.trr +++ b/ce/f140.trr @@ -1,13 +1,11 @@ 140 -30 +28 CODGRUPPO|2|2|0|Codice gruppo (CGCDGR) CODSPECIE|1|4|0|Codice specie (CGCDSP) TIPO|2|1|0|Tipo collegamento ("1" per categoria, "2" per cespite) (CGTIPO) IDCESPITE|1|10|0|Codice cespite (CGCESP) CODCAT|2|2|0|Codice categoria (CGCDCT) COMPL|8|1|0|Riferimenti completati per collegamento (CGCOMP) -TIPOTRAS|1|1|0|Tipo trasferimento (ovimenti, otali per sottoconto) (CGTRAS) -CODCC|2|3|0|Codice centro di costo (CGCCCE) GRUPPO|2|3|0|Gruppo cespite (CGRCES) CONTO|2|3|0|Conto cespite SOTTOC|3|6|0|Sottoconto cespite @@ -31,4 +29,4 @@ CONTOACC|2|3|0|Conto fondi acccelerati SOTTOCACC|3|6|0|Sottoconto fondi accelerati TRASF|8|1|0|Giá trasferito (CGMOVI) 1 -CODGRUPPO+CODSPECIE+CODCAT+IDCESPITE| +CODGRUPPO+CODSPECIE+TIPO+CODCAT+IDCESPITE| diff --git a/cg/cg0100a.uml b/cg/cg0100a.uml index 8a4301ed8..d61408807 100755 --- a/cg/cg0100a.uml +++ b/cg/cg0100a.uml @@ -250,6 +250,26 @@ BEGIN PROMPT 64 7 "" FLAGS "HD" GROUP 1 5 + ITEM " |" + ITEM "02|Bis" + ITEM "03|Ter" + ITEM "04|Quater" + ITEM "05|Quinquies" + ITEM "06|Sexies" +END + +LIST F_SUBH 9 +BEGIN + PROMPT 69 7 "" + + GROUP 1 5 + ITEM " |" + ITEM "02|Bis" + ITEM "03|Ter" + ITEM "04|Quater" + ITEM "05|Quinquies" + ITEM "06|Sexies" + KEY 1 END LIST F_SUBH 9 @@ -509,4 +529,3 @@ END ENDPAGE ENDMASK - diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 273d54f7e..cf026825d 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -200,6 +200,7 @@ bool TPrimanota_application::user_create() if (get_mask_swap_file(tmp)) xvt_fsys_removefile(tmp); + load_mask(0); load_colors(); @@ -724,6 +725,7 @@ void TPrimanota_application::init_insert_mode(TMask& m) xvt_fsys_removefile(tmp); } + } @@ -1184,6 +1186,7 @@ int TPrimanota_application::write(const TMask& m) { const TString4 causimm(causale().causale_inc_imm()); if (causimm.not_empty()) + genera_incasso(causimm); } } @@ -1810,6 +1813,8 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action) const bool bModify = xvt_str_compare_ignoring_case(action, "Modify") == 0; + const bool bModify = xvt_str_compare_ignoring_case(action, "Modify") == 0; + TFilename intrini; intrini.tempdir(); intrini.add("ActIntra.ini"); @@ -1918,6 +1923,7 @@ bool TPrimanota_application::link_intra(const TMask& m, const char* action) appname << "in0 -4 /i" << intrini; } + bool ok = false; if (!appname.empty()) { @@ -1965,11 +1971,13 @@ bool TPrimanota_application::link_anal(const TMask& msk, const char* action) long nExist = 0L; if (action[0] == 'I') + { // Cerco se c'e' almeno un conto interessato all'analitica // Se non ci sono conti analitici e' inutile inserire if (!bAnalBill) return false; + } else { @@ -2011,6 +2019,7 @@ bool TPrimanota_application::link_anal(const TMask& msk, const char* action) app.run(); return true; + } bool TPrimanota_application::protected_record(TRectype& mov) diff --git a/cg/cg2100.h b/cg/cg2100.h index ab3903fe4..63759fc12 100755 --- a/cg/cg2100.h +++ b/cg/cg2100.h @@ -76,8 +76,12 @@ #define CG_CONTO 105 #define CG_SOTTOCONTO 106 #define CG_DESCR 109 -#define CG_ROWTYPE 115 -#define CG_MASTRINO 199 +#define CG_COMMESSA 115 +#define CG_FASE 116 +#define CG_DESC_CDC 117 +#define CG_DESC_FASE 118 +#define CG_ROWTYPE 119 +#define CG_MASTRINO 200 // Campi ripetuti sulla seconda pagina #define H_DATAREG 201 diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index e784dcf8b..22cd62034 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -16,6 +16,7 @@ #include + /////////////////////////////////////////////////////////// // Funzioni di decodifica/calcolo /////////////////////////////////////////////////////////// @@ -705,6 +706,7 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k) } } } + } } @@ -1889,6 +1891,73 @@ bool TPrimanota_application::sheet_mastrino_handler(TMask_field& f, KEY k) return true; } +void TPrimanota_application::link_mastrino(const TBill& bill) const +{ + if (bill.ok()) + { + TPrimanota_application& a = app(); + const TMask& cm = a.curr_mask(); + + int anno = cm.get_int(F_ANNOES); + if (anno <= 0) + { + TDate date = cm.get(F_DATACOMP); + if (!date.ok()) + { + date = cm.get_date(F_DATAREG); + if (!date.ok()) + date = TDate(TODAY); + } + anno = a._esercizi.date2esc(date); + } + + TFilename ininame; ininame.tempdir(); ininame.add("mastrino.ini"); + if (anno > 0) + { + TConfig ini(ininame, "Transaction"); + ini.set("Action", "Modify"); + ini.set_paragraph("24"); + ini.set(RMV_ANNOES, anno); + ini.set(RMV_TIPOC, bill.tipo()); + ini.set(RMV_GRUPPO, bill.gruppo()); + ini.set(RMV_CONTO, bill.conto()); + ini.set(RMV_SOTTOCONTO, bill.sottoconto()); + } + if (ininame.exist()) + { + TString cmd; + cmd << "cg3 -5 -i" << ininame; + TExternal_app app(cmd); + app.run(); + xvt_fsys_removefile(ininame); + } + } +} + +bool TPrimanota_application::mastrino_handler(TMask_field& f, KEY k) +{ + if (k == K_SPACE) + { + TMask& m = f.mask(); + TBill bill; bill.get(m, F_GRUPPO, F_CONTO, F_SOTTOCONTO); + app().link_mastrino(bill); + } + return true; +} + +bool TPrimanota_application::sheet_mastrino_handler(TMask_field& f, KEY k) +{ + if (k == K_SPACE) + { + TMask& m = f.mask(); + const char tipo = m.get(CG_TIPO)[0]; + const short id_sotto = CG_SOTTOCONTO + (tipo <= ' ' ? 0 : (tipo == 'C' ? 100 : 200)); + TBill bill; bill.get(m, CG_GRUPPO, CG_CONTO, id_sotto, CG_TIPO); + app().link_mastrino(bill); + } + return true; +} + /////////////////////////////////////////////////////////// // Handlers dei campi della testata /////////////////////////////////////////////////////////// @@ -1937,6 +2006,7 @@ bool TPrimanota_application::num_handler(TMask_field& f, KEY key) { // Riempie a mano i campi necessari nel caso non sia stato usata la ricerca F9 m.set(F_DATAREG, mov.get(MOV_DATAREG), true); + m.set(F_CODCAUS, mov.get(MOV_CODCAUS)); f.set_focusdirty(false); @@ -1991,10 +2061,12 @@ bool TPrimanota_application::caus_modify_handler(TMask_field& f, KEY key) const TMask& m = f.mask(); const int ann = m.get_int(F_ANNOIVA); const TString& cau = f.get(); + const TCausale c(cau, ann); - if (!c.ok()) return false; + if (!c.ok()) + return false; - const TCausale& k = app().causale(); + const TCausale& k = app().causale(); const TString& msg = c.compatible(k); if (msg.not_empty()) // La causale non e' compatibile { diff --git a/cg/cg2102.h b/cg/cg2102.h index cc4fc2f9e..4b40158f0 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -206,7 +206,6 @@ protected: void init_mask(TMask& m); static TipoIVA reg2IVA(const char* registro, int anno); - static int type2pos(char tipo); static const real& cod2IVA(const TMask& m); static real scorpora(real& imponibile, const real& percentuale); static bool detraibile(TToken_string& row); @@ -283,6 +282,7 @@ protected: bool link_anal(const TMask& msk, const char* action); public: + static int type2pos(char tipo); static char row_type(const TToken_string& s); void type2colors(char tipor, COLOR& back, COLOR& fore); diff --git a/cg/cg2103.cpp b/cg/cg2103.cpp index 2a35b10d0..7d57a8262 100755 --- a/cg/cg2103.cpp +++ b/cg/cg2103.cpp @@ -206,13 +206,16 @@ char TCausale::sezione_ritsoc() const } char TCausale::sezione_ritfis() + { if (_sezione_ritfis == ' ') + { if (_rec.get_int(CAU_TIPOMOV) <= 2) _sezione_ritfis = sezione(8); // Fatture else _sezione_ritfis = sezione(12); // Pagamenti + } return _sezione_ritfis; } @@ -271,9 +274,7 @@ const TString& TCausale::compatible(const TCausale& c) const return msg; } - return EMPTY_STRING; - } bool TCausale::IVA2bill(const TCodiceIVA& iva, TBill& c) const diff --git a/cg/cg2105.cpp b/cg/cg2105.cpp index 7a56cd0cc..3d76d3f10 100755 --- a/cg/cg2105.cpp +++ b/cg/cg2105.cpp @@ -347,12 +347,12 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad, { const tipo_movimento tm = sum.tipo(); _can_solder = !(tm == tm_nota_credito || tm == tm_insoluto); - if (_can_solder) +/* if (_can_solder) { const TDate datasca(fatt.get(PART_DATADOC)); const TDate datapag(sum.get(PART_DATADOC)); _can_solder = datapag >= datasca; - } + } */ } // Mostra saldo solo se non e' ne' un acconto, ne' una nota di credito @@ -1339,6 +1339,16 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata, tipo_mov TBill contro; causale.bill(caus, contro); // Legge conto contropartita if (caus != 2 && contro.empty()) // Se non specificato ... causale.bill(caus = 2, contro); // ... prende il primo + if (contro.sottoconto() == 0L) + { + const int nrow = app().type2pos('I'); + + if (nrow >= 0) + { + TSheet_field & cgs = app().cgs(); + contro.get(cgs.row(nrow), 3); + } + } contro.put(pagamento, TRUE); // Scrive conto contropartita } #endif diff --git a/cg/cg3600.cpp b/cg/cg3600.cpp index b1e9f9e90..aa9f3dbc5 100755 --- a/cg/cg3600.cpp +++ b/cg/cg3600.cpp @@ -346,7 +346,6 @@ void TMastrino::read(const TBill& conto, caption.format(FR("Caricamento mastrino %03d.%03d.%06ld"), _conto.gruppo(), _conto.conto(), _conto.sottoconto()); TProgind pi(totrows, caption, false, true); - for (cur = 0L; cur.pos() < totrows; ++cur) { @@ -2251,30 +2250,14 @@ void TGrid_mask::handler(WINDOW win, EVENT* ep) if (_last_grid) { TGrid_field& sht = (TGrid_field&)*_last_grid; -#if (XVT_PTK_VERSION_MAJOR > 4) || (XVT_PTK_VERSION_MAJOR == 4 && XVT_PTK_VERSION_MINOR >= 50) MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR); - if (menu) + + if (menu != NULL) { const PNT& p = ep->v.mouse.where; - RCT cr; xvt_vobj_get_client_rect(win, &cr); - XVT_POPUP_ALIGNMENT pa = XVT_POPUP_CENTER; - if (p.h < cr.right / 3) - pa = XVT_POPUP_LEFT_ALIGN; - else - if (p.h > 2 * cr.right / 3) - pa = XVT_POPUP_RIGHT_ALIGN; - - xvt_menu_popup(menu->child, win, p, pa, NULL); + xvt_menu_popup(menu->child, win, p, XVT_POPUP_CENTER, 0); xvt_res_free_menu_tree(menu); } -#else - ASK_RESPONSE r = xvt_dm_post_ask(TR("Annulla"), TR("Ripristina"), TR("Salva"), - TR("Ordinamento delle colonne")); - if (r == RESP_2) - sht.reset_columns_order(); - if (r == RESP_2 || r == RESP_3) - sht.save_columns_order(); -#endif return; } } @@ -2284,16 +2267,10 @@ void TGrid_mask::handler(WINDOW win, EVENT* ep) { switch (ep->v.cmd.tag) { - case M_EDIT_UNDO: - _last_grid->reset_columns_order(); - case M_EDIT_COPY: - _last_grid->save_columns_order(); - break; - case M_EDIT_SEARCH: - _last_grid->on_key(K_F11); - break; - default: - break; + case BROWSE_BAR+1: _last_grid->save_columns_order(); break; + case BROWSE_BAR+2: _last_grid->reset_columns_order(); break; + case BROWSE_BAR+3: _last_grid->on_key(K_F11); break; + default: break; } return; } @@ -2456,8 +2433,6 @@ public: bool TMastrini_video::create() { xvtil_statbar_set("", TRUE); - - open_files(LF_RMOV, LF_MOV, LF_CAUSALI, 0); open_files(LF_SALDI, LF_PCON, 0); @@ -2507,7 +2482,6 @@ bool TMastrini_video::menu(MENU_TAG mt) { const TEsercizio& esercizio = esercizi.esercizio(codesc); qm.set(F_ESERCIZIO, codesc); - qm.set(F_DADATA, esercizio.inizio()); qm.set(F_ADATA, esercizio.fine()); } @@ -2515,13 +2489,6 @@ bool TMastrini_video::menu(MENU_TAG mt) KEY key = 0; while (key != K_QUIT) { -/* Ca$$ata tipica della Prassi - - qm.reset(F_SOTTOCONTO); // Azzera sottoconto - qm.reset(F_CLIENTE); // Azzera cliente - qm.reset(F_FORNITORE); // Azzera fornitore - qm.reset(-5); // Azzera causali -*/ key = qm.run(); switch (key) { @@ -2555,4 +2522,3 @@ int cg3600(int argc, char* argv[]) mv.run(argc, argv, TR("Mastrini")); return 0; } - diff --git a/cg/cg6900.cpp b/cg/cg6900.cpp index 0d067bfbe..a21d54387 100755 --- a/cg/cg6900.cpp +++ b/cg/cg6900.cpp @@ -636,23 +636,22 @@ bool TInv_cont::leggi_header() return TRUE; } -bool TInv_cont::record_controllo() +bool TInv_cont::record_controllo() const { +/* TString tiporecord = _control_rec.sub(0,2); - if (tiporecord != " 1") return FALSE; - return TRUE; +*/ + const TString& tiporecord = _control_rec.sub(0,2); + return atoi(tiporecord) == 1; } bool TInv_cont::esegui_controlli() { _esiste_record = leggi_header(); - - if (!controlli()) - return FALSE; - return TRUE; + return controlli(); } void TInv_cont::setta_parametri_record(TMask& m,const TString& flag) @@ -683,7 +682,7 @@ bool TInv_cont::controlli() bool TInv_cont::sub_controlli() { - long ditta_trasfer = _tras_file.ditta(); + const long ditta_trasfer = _tras_file.ditta(); if (_ditta == ditta_trasfer) { @@ -972,24 +971,20 @@ void TInv_cont::setta_tabella_studio(TMask& m,bool flag_ditta) void TInv_cont::setta_tabella_ditta(TMask& m,const char* flag, bool comp) { TTable ind ("%IND"); - TString dep; - - long ditta = m.get_long(F_DITTAINV); + TString8 dep; + const long ditta = m.get_long(F_DITTAINV); dep.format("%05ld", ditta); - - ind.zero(); ind.put("CODTAB", dep); + if (ind.read() == NOERR) { - int num = m.get_int(F_NUMULINV); - num++; - TDate data (m.get(F_DATALIM)); - ind.put("S6", flag); if (comp) { - ind.put("I0", (long)num); + const long num = m.get_int(F_NUMULINV)+1; + const TDate data (m.get(F_DATALIM)); + ind.put("I0", num); ind.put("D0", data); } ind.rewrite(); @@ -1060,6 +1055,7 @@ const char* TInv_cont::cerca_provincia(const TString& comcf) const { TString8 k; k << " |" << comcf; return cache().get(LF_COMUNI, k, COM_PROVCOM); + } bool TInv_cont::invio_tempfile(TMask& m) @@ -1954,9 +1950,8 @@ int cg6900 (int argc, char* argv[]) break; case 'C': { - TCanc_file_invio* a = new TCanc_file_invio; - a->run(argc, argv,"Eliminazione file invio"); - delete a; + TCanc_file_invio a; + a.run(argc, argv,"Eliminazione file invio"); } break; @@ -1965,4 +1960,4 @@ int cg6900 (int argc, char* argv[]) } return TRUE; -} +} \ No newline at end of file diff --git a/cg/cg6900.h b/cg/cg6900.h index 603fb7745..2a137351e 100755 --- a/cg/cg6900.h +++ b/cg/cg6900.h @@ -46,7 +46,8 @@ class TInv_cont : public TSkeleton_application TString _ocfpi, _ragsococc, _indocc, _capocc, _localocc, _provocc, _codvali, _codval; bool _esiste_ditta, _esiste_record, _inviato, _flag_provvis, _flag_bollato; long _ditta, _protiva, _uprotiva, _codcf, _numrec, _tot_rec; - long _dim_tot, _dim_disk,_dittaAS; + long _dittaAS; + unsigned long _dim_tot, _dim_disk; long _numrec_cau,_numrec_clifo,_numrec_pcon,_numrec_pn,_numrec_iva,_numrec_sc; int _num,_annoes; TDate _data, _datadoc, _data74ter,_datalimsk,_dataregiva,_datareg; @@ -64,7 +65,7 @@ public: {return FALSE;} bool esiste_tabella_studio(); - bool record_controllo(); + bool record_controllo() const; bool esegui_controlli(); bool leggi_header(); bool controlli(); @@ -136,15 +137,15 @@ public: void calcola_totale_record(); void scrivi_telefono(TString& app); - const char* cerca_provincia(const TString& comcf) const; - void cerca_dencom(const TString& comcf, TString& dencom) const; + const TString& cerca_provincia(const TString& comcf) const; + void cerca_dencom(TString& comcf,TString& dencom); static bool setta_maschera_hnd(TMask_field& f, KEY k); static bool messaggio_hnd (TMask_field& f, KEY k); - int calcola_numero_dischi(TMask& m,TString& floppy); - FILE* chiedi_disco(const char* name, int disk, TString& floppy, bool lettura); - bool scrivi_disco(TString& floppy, int disk, const char* work, FILE* i, TProgind& w); + int calcola_numero_dischi(TMask& m, const TString& floppy); + FILE* chiedi_disco(const char* name, int disk, const TString& floppy, bool lettura); + bool scrivi_disco(const TString& floppy, int disk, const char* work, FILE* i, TProgind& w); bool invio_contabilita_PC(); void invio_testata_causali(); @@ -164,4 +165,3 @@ public: }; HIDDEN TInv_cont& app() { return (TInv_cont &) main_app(); } - diff --git a/cg/cg6902.cpp b/cg/cg6902.cpp index 4eb69338a..fc4ccc43d 100755 --- a/cg/cg6902.cpp +++ b/cg/cg6902.cpp @@ -4,14 +4,13 @@ #include "cg6900.h" #include "cg6900a.h" -FILE* TInv_cont::chiedi_disco(const char* name, int disk, TString& floppy, bool lettura) +FILE* TInv_cont::chiedi_disco(const char* name, int disk, const TString& floppy, bool lettura) { FILE* f = NULL; + if (!xvt_fsys_is_removable_drive(floppy)) + return f; - char flop = floppy[0]; - if (flop != 'A' && flop != 'B') return f; - - message_box("Inserire il disco %d nel drive %c:", disk, flop); + message_box("Inserire il disco %d nel drive %c:", disk, floppy[0]); // name.ext(format("%03d", disk)); @@ -31,19 +30,25 @@ FILE* TInv_cont::chiedi_disco(const char* name, int disk, TString& floppy, bool return f; } -bool TInv_cont::scrivi_disco(TString& floppy, int disk, const char* work, +bool TInv_cont::scrivi_disco(const TString& floppy, int disk, const char* work, FILE* i, TProgind& w) { FILE* file = chiedi_disco(work, disk, floppy, FALSE); - if (floppy == "A" || floppy == "B") - if (file == NULL) return FALSE; - - if (floppy[0] != 'A' && floppy[0] != 'B') + + const bool is_floppy = xvt_fsys_is_removable_drive(floppy) != 0; + if (is_floppy) + { + if (file == NULL) + return FALSE; + } + else + { if (_dim_disk < _dim_tot) { - warning_box("Lo spazio su disco non e' sufficiente"); + warning_box(FR("Occorrono almeno %d Kb di spazio su disco"), int(_dim_tot/1024+1)); return FALSE; } + } TString str; str.format("%02d", disk); @@ -54,7 +59,6 @@ bool TInv_cont::scrivi_disco(TString& floppy, int disk, const char* work, TFilename path_m = floppy; path_m.add("marker"); TFilename path_t = floppy; path_t.add("trasfer"); - if (!fcopy(_marker,path_m)) // Copia il marker su disco return FALSE; @@ -63,7 +67,7 @@ bool TInv_cont::scrivi_disco(TString& floppy, int disk, const char* work, TString buffer(BUFSIZE); - long tot_scritti = BUFSIZE; + unsigned long tot_scritti = BUFSIZE; while (tot_scritti <= _dim_disk) { @@ -83,7 +87,7 @@ bool TInv_cont::scrivi_disco(TString& floppy, int disk, const char* work, return TRUE; } -int TInv_cont::calcola_numero_dischi(TMask& msk,TString& floppy) +int TInv_cont::calcola_numero_dischi(TMask& msk, const TString& floppy) { int numdisc = 1; @@ -107,7 +111,7 @@ int TInv_cont::calcola_numero_dischi(TMask& msk,TString& floppy) _dim_tot = dim_t + dim_m; //+dim_h; // Determina la dimensione totale - if (floppy[0] == 'A' || floppy[0] == 'B') + if (xvt_fsys_is_removable_drive(floppy)) { int item = msk.get_int(F_DIM); @@ -140,12 +144,7 @@ int TInv_cont::calcola_numero_dischi(TMask& msk,TString& floppy) } else { - _dim_disk = 16L*1024L*1024L; // 16 mega - for (; _dim_disk > 0; _dim_disk -= 1024L*1024L) - { - if (xvt_fsys_test_disk_free_space("", _dim_disk)) - break; - } + _dim_disk = xvt_fsys_get_disk_free_space(floppy, 'b'); } return numdisc; @@ -703,6 +702,7 @@ bool TInv_cont::invio_clifo() record.overwrite(str,133); //Localita' const TString4 provincia = cerca_provincia(comcf); + str.format("%-2s", (const char*) provincia); record.overwrite(str,153); //Provincia @@ -2043,4 +2043,4 @@ void TInv_cont::write_AS_imp(const real& importo, TString& record, int pos, int negPC2negAS(numero); numero.right_just(len, '0'); record.overwrite(numero, pos); -} +} \ No newline at end of file diff --git a/cg/cg6905.cpp b/cg/cg6905.cpp index 4c3326686..58d928f38 100755 --- a/cg/cg6905.cpp +++ b/cg/cg6905.cpp @@ -1,40 +1,18 @@ #include #include "cg6905.h" +#include "cglib04.h" -bool TCanc_file_invio::create() -{ - TApplication::create(); - - dispatch_e_menu (BAR_ITEM(1)); - - return TRUE; -} - -bool TCanc_file_invio::destroy() -{ - return TApplication::destroy(); -} - -bool TCanc_file_invio::set() +void TCanc_file_invio::main_loop() { - TString marker; - - _tras_file.remove_all(FALSE); + TTransfer_file tras_file; + tras_file.remove_all(false); + TFilename marker; marker = firm2dir(0); marker << "\\marker"; - ::remove(marker); + xvt_fsys_removefile(marker); - message_box("Eliminazione file di lavoro dell' invio terminata"); - - return FALSE; + message_box("Eliminazione file di lavoro dell'invio terminata"); } -bool TCanc_file_invio::menu(MENU_TAG m) -{ - if (m == BAR_ITEM(1)) - return set(); - - return FALSE; -} diff --git a/cg/cg6905.h b/cg/cg6905.h index db900f7e2..688c7ef9c 100755 --- a/cg/cg6905.h +++ b/cg/cg6905.h @@ -1,23 +1,10 @@ // Ripristino flag invio PN e IVA -#include -#include -#include +#include -#include "cglib04.h" - -class TCanc_file_invio : public TApplication +class TCanc_file_invio : public TSkeleton_application { - TTransfer_file _tras_file; - public: - virtual bool check_autorization() const - {return FALSE;} - virtual bool create(); - virtual bool destroy(); - virtual bool menu(MENU_TAG m); - - bool set(); - - TCanc_file_invio() {} + virtual bool check_autorization() const { return false; } + virtual void main_loop(); }; diff --git a/cg/cglib01.cpp b/cg/cglib01.cpp index de638a4f5..a89daf268 100755 --- a/cg/cglib01.cpp +++ b/cg/cglib01.cpp @@ -226,6 +226,7 @@ bool TEsercizi_contabili::code2range(int codice, TDate& dal, TDate& al) const ///////////////////////////////////////////////////////// + const char* iva2name(TipoIVA iva) { const char* i; @@ -982,6 +983,7 @@ int TBill::indicatore_bilancio() const return ib; } + bool TBill::sospeso() const { if (_tipo_cr < 0) tipo_cr(); // trick to load _sospeso diff --git a/cg/cglib01.h b/cg/cglib01.h index f75b0b926..3340744ae 100755 --- a/cg/cglib01.h +++ b/cg/cglib01.h @@ -247,4 +247,3 @@ public: enum TIndbil { ib_null, ib_attivita, ib_passivita, ib_costi, ib_ricavi, ib_conti_ordine }; #endif - diff --git a/cg/cglib02.cpp b/cg/cglib02.cpp index fa003a4f4..5705934f8 100755 --- a/cg/cglib02.cpp +++ b/cg/cglib02.cpp @@ -452,6 +452,7 @@ bool TSaldo::ultima_immissione_bilancio(int annoes,int g,int c,long s,int indbil const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const TDate& al, int indbil, bool provv) + { _saldo_iniziale = ZERO; _saldo = ZERO; @@ -467,7 +468,7 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const const TDate inizio = es.esercizio(codes).inizio(); _annoes = codes; - TString80 key; key.format("%04d| |%d|%d|%ld", _annoes, g, c, s); + TString80 key; key.format("%04d| |%d|%d|%ld", _annoes, g, c, s); const TRectype& saldo = cache().get(LF_SALDI, key); _saldo_iniziale = saldo.get_real(SLD_SALDO); @@ -543,6 +544,7 @@ const real& TSaldo::saldo_periodo(int g, int c, long s, const TDate& dal, const } } + if (p != NULL) delete p; } @@ -1082,4 +1084,3 @@ TImporto TBalance::saldo_finale_chiusura() const { return saldo_finale(TRUE); } - diff --git a/cg/cgp4.cpp b/cg/cgp4.cpp index 7b1d40775..6272a1ec1 100755 --- a/cg/cgp4.cpp +++ b/cg/cgp4.cpp @@ -8,16 +8,14 @@ int main(int argc,char** argv) switch (s) { - - case 1 : - cgp4100(argc,argv) ; break; // Importa stipendi in prima nota (OMASA) + cgp4200(argc,argv) ; break; // Importa stipendi in prima nota (OMASA) default: cgp4100(argc,argv) ; break; // Importazione clienti (GSA/CODFIDI) + } exit(0); return 0; } - diff --git a/cg/cgsaldac.cpp b/cg/cgsaldac.cpp index 03f3374f4..7d0dd51d3 100755 --- a/cg/cgsaldac.cpp +++ b/cg/cgsaldac.cpp @@ -502,6 +502,7 @@ TImporto TRiga_scadenze::esposto(bool valuta, const TDate & data_scad, const TDa } + bool TRiga_scadenze::modifica_pagamento(const TRectype& new_pag, const TValuta& valuta, char& old_ap, TImporto& old_abb, TImporto& old_diffcam, char& new_ap, TImporto& new_abb, TImporto& new_diffcam, @@ -2165,4 +2166,4 @@ TRiga_partite* TPartite_array::mov2rig(long numreg, int numrig) return &game->riga(r); } return NULL; -} +} \ No newline at end of file diff --git a/cm/cm1100.cpp b/cm/cm1100.cpp index bc9f03e3a..000ed34cb 100755 --- a/cm/cm1100.cpp +++ b/cm/cm1100.cpp @@ -901,6 +901,7 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag) const TBill conto(rmoviva); if (cms_in_range(codcms, codfase) && conto.indicatore_bilancio() != 5) + { TToken_string cms_fsc = codcms; if (codfase.not_empty()) @@ -968,6 +969,7 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag) const TString& codcms = rmov.get("CODCMS"); const TString& codfase = rmov.get("FASCMS"); + if (cms_in_range(codcms,codfase) && conto.indicatore_bilancio() != 5) { TToken_string cms_fsc = codcms; @@ -1068,6 +1070,7 @@ void TPag_per_cms::add_importo(TAssoc_array& assoc, const TRectype& rmov) const chiave.add(rmov.get("FASCMS")); chiave.add(rmov.get(RMV_NUMREG)); + TImporto* importo = (TImporto*)assoc.objptr(chiave); if (importo == NULL) { @@ -1094,6 +1097,7 @@ void TPag_per_cms::find_commesse_cg(const long nreg) const TString& codcms = rmov.get("CODCMS"); const TString& codfase = rmov.get("FASCMS"); + if (cms_in_range(codcms,codfase)) { const TBill conto(rmov); @@ -1384,4 +1388,4 @@ int cm1100(int argc, char* argv[]) TPag_per_cms a; a.run(argc,argv,TR("Stampa pagato per commessa")); return 0; -} +} \ No newline at end of file diff --git a/db/dblib.h b/db/dblib.h index 0e4061472..693a41951 100755 --- a/db/dblib.h +++ b/db/dblib.h @@ -97,10 +97,12 @@ protected: TObject* dup() const { return new TLavorazione(*this); } public: - const char* codice() const { return get("CODTAB"); } - const char* descr() const { return get("S0"); } - const char* um() const { return get("S6"); } + const char * codice() const { return get("CODTAB"); } + const char * descr() const { return get("S0"); } + const char * um() const { return get("S6"); } TUm_tempo um_temporale() const {return (TUm_tempo)get_char("I7");} + bool lavorazione_non_rilevata() const { return get_bool("B3");} + real percentuale_minima() const { return get_real("R0"); } real prezzo() const; void reset_linee(); diff --git a/db/dbtblav.h b/db/dbtblav.h index 1d01eeffa..59ecc28ad 100755 --- a/db/dbtblav.h +++ b/db/dbtblav.h @@ -13,6 +13,8 @@ #define F_DESUNTEMPO 113 #define F_UNMIS2 114 #define F_LINEESTD 115 +#define F_PERCMIN 116 +#define F_PRODNRIL 117 #define F_CODLIN 101 diff --git a/db/dbtblav.uml b/db/dbtblav.uml index cb1e2d13c..882b8dd6f 100755 --- a/db/dbtblav.uml +++ b/db/dbtblav.uml @@ -108,6 +108,18 @@ BEGIN FIELD B0 END +NUMBER F_PERCMIN 6 2 +BEGIN + PROMPT 2 10 "Tempo minimo " + FIELD R1 +END + +BOOLEAN F_PRODNRIL +BEGIN + PROMPT 51 10 "Produzione non rilevata" + FIELD B3 +END + ENDPAGE PAGE "Parametri di MRP" -1 -1 65 15 diff --git a/dt/dt0300.cpp b/dt/dt0300.cpp index 259dcede6..0ba6fe0ae 100755 --- a/dt/dt0300.cpp +++ b/dt/dt0300.cpp @@ -65,6 +65,8 @@ bool TConf_dt::load_mask_ditte(TMask* mask) row.add(workstring.get(1), 1); row.add(workstring.get(2), 2); row.add(workstring.get(3), 3); + row.add(workstring.get(4), 4); + row.add(workstring.get(5), 5); sf_ditte.check_row(sf_ditte.items()-1); } return TRUE; @@ -119,6 +121,8 @@ bool TConf_dt::save_mask_ditte(TMask* mask) workstring.add(line->get(1)); workstring.add(line->get(2)); workstring.add(line->get(3)); + workstring.add(line->get(4)); + workstring.add(line->get(5)); config_studio->set("ConfDitte", workstring, NULL, true, c++); } } @@ -178,4 +182,4 @@ int dt0300(int argc, char* argv[]) app.run(argc, argv, TR("Configurazione modulo")); return 0; -} +} \ No newline at end of file diff --git a/dt/dt0300a.h b/dt/dt0300a.h index 981aacf85..ec98ae39d 100755 --- a/dt/dt0300a.h +++ b/dt/dt0300a.h @@ -1,12 +1,16 @@ // definizione campi maschera dt0300a - configurazione modulo DTECH -#define F_CONF_DOC 201 // configurazione causali/documenti -#define F_CONF_CODPAG 202 // condizione pagamento standard -#define F_CONF_NETTO 203 // contabilizzazione al netto dello sconto +#define F_CONF_DOC 201 // configurazione causali/documenti +#define F_CONF_CODPAG 202 // condizione pagamento standard +#define F_CONF_NETTO 203 // contabilizzazione al netto dello sconto +#define F_CONF_SPESEACC1 204 // codice spese accessorie 1 +#define F_CONF_SPESEACC2 205 // codice spese accessorie 2 +#define F_CONF_SCONTOFIN 206 // codice spesa sconto finanziario -#define F_S_NEGOZIO 101 -#define F_S_CAUS 102 -#define F_S_TIPODOCDT 103 -#define F_S_TIPODOC 104 -#define F_S_STATO 105 -#define F_S_D_TIPODOC 106 -#define F_S_D_STATO 107 +#define F_S_NEGOZIO 101 +#define F_S_CAUS 102 +#define F_S_TIPODOCDT 103 + +#define F_S_TIPODOC 104 +#define F_S_STATO 105 +#define F_S_D_TIPODOC 106 +#define F_S_D_STATO 107 \ No newline at end of file diff --git a/dt/dt0300a.uml b/dt/dt0300a.uml index 7e2591384..facaff5b4 100755 --- a/dt/dt0300a.uml +++ b/dt/dt0300a.uml @@ -33,7 +33,7 @@ END STRING F_CONF_CODPAG 4 BEGIN - PROMPT 1 12 "Codice pagamento standard " + PROMPT 1 12 "Codice pagamento standard " HELP "Codice di pagamento" FIELD CondPag FLAGS "U" @@ -47,11 +47,49 @@ END BOOLEAN F_CONF_NETTO BEGIN - PROMPT 1 13 "Contabilizzazione al netto sconto" + PROMPT 40 12 "Contabilizzazione al netto sconto" HELP "Indicare se trasferire i documenti al netto dello sconto" FIELD ContNettoSconto END +STRING F_CONF_SPESEACC1 8 +BEGIN + PROMPT 1 13 "Cod. spese acc. 1 " + FIELD SpeseAcc1 + FLAGS "U" + USE SPP + INPUT CODTAB F_CONF_SPESEACC1 + DISPLAY "Codice " CODTAB + DISPLAY "Descrizione@50 " S0 + OUTPUT F_CONF_SPESEACC1 CODTAB + CHECKTYPE NORMAL +END + +STRING F_CONF_SPESEACC2 8 +BEGIN + PROMPT 1 14 "Cod. spese acc. 2 " + FIELD SpeseAcc2 + FLAGS "U" + USE SPP + INPUT CODTAB F_CONF_SPESEACC2 + DISPLAY "Codice " CODTAB + DISPLAY "Descrizione@50 " S0 + OUTPUT F_CONF_SPESEACC2 CODTAB + CHECKTYPE NORMAL +END + +STRING F_CONF_SCONTOFIN 8 +BEGIN + PROMPT 1 15 "Cod. spesa per sconto fin. " + FIELD ScontoFin + FLAGS "U" + USE SPP SELECT S9 != " " + INPUT CODTAB F_CONF_SCONTOFIN + DISPLAY "Codice " CODTAB + DISPLAY "Descrizione@50 " S0 + OUTPUT F_CONF_SCONTOFIN CODTAB + CHECKTYPE NORMAL +END ENDPAGE @@ -59,7 +97,7 @@ ENDMASK PAGE "" -1 -1 75 10 -STRING F_S_NEGOZIO 6 +STRING F_S_CODNEG 6 BEGIN PROMPT 1 1 "Negozio " END @@ -141,4 +179,4 @@ END ENDPAGE -ENDMASK +ENDMASK \ No newline at end of file diff --git a/dt/dt0400.cpp b/dt/dt0400.cpp index 2ed028b2f..c5e1c21d9 100755 --- a/dt/dt0400.cpp +++ b/dt/dt0400.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,7 @@ #include "rdoc.h" #include "..\cg\cglib01.h" +#include "..\ve\velib.h" // TAutomask @@ -48,15 +50,10 @@ protected: virtual void validate(TCursor& cur,TRecord_text &rec, TToken_string &val, TString& str); public: - TDT2Doc_file(const TString& file_name); + TDT2Doc_file(const TString& file_name, const TString& config_name) : TFile_text(file_name, config_name) {}; virtual ~TDT2Doc_file() { } }; -TDT2Doc_file::TDT2Doc_file(const TString& file_name) - : TFile_text(file_name, "dt0400a.ini") -{ -} - void TDT2Doc_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TString& str) { const TString code(s.get(0)); @@ -76,7 +73,6 @@ HIDDEN bool browse_file_handler(TMask_field& f, KEY k) FILE_SPEC fs; memset(&fs, 0, sizeof(FILE_SPEC)); strcpy(fs.type, ""); strcpy(fs.name, f.get()); - //strcpy(fs.creator, "ba1"); xvt_fsys_get_default_dir(&fs.dir); xvt_fsys_save_dir(); if (xvt_dm_post_file_open(&fs, TR("Selezione file")) == FL_OK) @@ -100,40 +96,47 @@ class TDT2Doc : public TSkeleton_application { TDT2Doc_mask* _msk; TDT2Doc_file* _trasfile; - TLocalisamfile* _clienti; + TLocalisamfile* _clifor; + TRelation* _rel; TCursor* _cur; TProgind* _prog; - TAssoc_array* _array_clienti; + TAssoc_array* _array_clifor; TAssoc_array* _confditte; TAssoc_array* _confdoc; TAssoc_array* _totalilordi; TAssoc_array* _castelletto; TAssoc_array* _primariga; - TString80 _cms, _condpag, _codnum, _negozio; + TString80 _cms, _condpag, _codnum, _negozio, _speseacc1, _speseacc2, _scontofin; bool _contnetto; - public: bool print_header(const TString80& percorso); + void print_line(const TString& rigastampa = ""); void print_footer(); virtual bool create(); virtual bool destroy(); virtual void main_loop(); - bool import_clienti(const TString80& percorso); - bool import_documenti(const TString80& percorso); - const long get_nextcodcf(); + bool import_clifor(const TFilename& percorso, const char tipocf); + bool import_documenti(const TFilename& percorso, const bool doc_attivi); + bool elabora_documenti(const bool doc_attivi); + const long get_nextcodcf(const char tipocf); bool load_conf_ditte(); bool load_conf_doc(); - bool check_negozio(const TString80& percorso); - bool TDT2Doc::error_msg(const TString& msg, const TString16& causale, const int numdoc, const TString& codice); + char check_negozio(const TFilename& percorso); + bool error_msg(const TString& msg, const TString16& causale, const int numdoc, const TString& codice); + void rename_file(const TFilename& percorso); + int get_numdoc(const TString& numdocrif, const TDate datadoc, const TString& _codnum, const TString& tipodoc, const long codcf); + int add_riga_doc(TDocumento* doc, TConfig& config); + TDT2Doc() {} }; TDT2Doc& app() { return (TDT2Doc&) main_app(); } -bool TDT2Doc::print_header(const TString80& percorso) +bool TDT2Doc::print_header(const TFilename& percorso) + { if (printer().open()) { @@ -155,7 +158,7 @@ bool TDT2Doc::print_header(const TString80& percorso) return TRUE; } else - return error_box("Errore in apertura stampante."); + return error_box(TR("Errore in apertura stampante.")); } void TDT2Doc::print_line(const TString& rigastampa) @@ -175,51 +178,71 @@ void TDT2Doc::print_footer() printer().close(); } -bool TDT2Doc::check_negozio(const TString80& percorso) +char TDT2Doc::check_negozio(const TFilename& percorso) { - TConfig config_studio = TConfig(CONFIG_STUDIO, "dt"); - int inizio = percorso.find("DF"); - inizio+=2; - const int fine = percorso.find('.'); - _negozio = percorso.mid(inizio, fine); - _negozio.trim(); - if (_confditte->is_key(_negozio)) + char tipocf = 'E'; + TConfig config_studio(CONFIG_STUDIO, "dt"); + TString80 nomefile(percorso.name()); + TString80 estensione(percorso.ext()); + const int fine = nomefile.find(estensione); + if (fine > 0) + nomefile = nomefile.sub(0,fine-1); + if (_confditte->is_key(nomefile)) { - TToken_string& config = (TToken_string&) _confditte->find(_negozio); - TString16 dittastr = config.get(); + TToken_string& config = (TToken_string&) _confditte->find(nomefile); + TString16 dittastr(config.get()); _cms = config.get(); _codnum = config.get(); + tipocf = config.get_char(); if (_codnum.empty()) - return error_box("Attenzione: manca la numerazione corrispondente al negozio. Completare la tabella prima di effettuare il trasferimento"); - const long ditta = atol(dittastr); - if (prefix().exist(ditta)) { - load_conf_doc(); - return set_firm(ditta); + error_box(TR("Attenzione: manca la numerazione corrispondente al negozio. Completare la tabella prima di effettuare il trasferimento")); + tipocf = 'E'; } else - return error_box("Attenzione: non esiste la ditta %ld; trasferimento annullato", ditta); + { + const long ditta = atol(dittastr); + if (prefix().exist(ditta)) + { + _negozio = nomefile.sub(2); + load_conf_doc(); + if (!set_firm(ditta)) + tipocf = 'E'; + } + else + { + error_box(TR("Attenzione: non esiste la ditta %ld; trasferimento annullato"), ditta); + tipocf = 'E'; + } + } } else - return error_box("Attenzione: manca la corrispondenza negozio - ditta; trasferimento annullato"); + { + error_box(TR("Attenzione: manca la corrispondenza negozio - ditta; trasferimento annullato")); + tipocf = 'E'; + } + return tipocf; } bool TDT2Doc::load_conf_ditte() { - TConfig config_studio = TConfig(CONFIG_STUDIO, "dt"); + TConfig config_studio(TConfig(CONFIG_STUDIO, "dt")); TToken_string workstring; _confditte->destroy(); for (int k = 0; config_studio.exist("ConfDitte", k); k++) { - workstring= config_studio.get("ConfDitte", NULL, k); - const TString16 negozio = workstring.get(0); - const TString16 ditta = workstring.get(1); - const TString80 cms = workstring.get(2); - const TString16 codnum = workstring.get(3); + workstring = config_studio.get("ConfDitte", NULL, k); + TString16 negozio(workstring.get(0)); + negozio << workstring.get(1); + const TString16 ditta(workstring.get(2)); + const TString80 cms(workstring.get(3)); + const TString16 codnum(workstring.get(4)); + const char attpass(workstring.get_char()); TToken_string config; config.add(ditta); config.add(cms); config.add(codnum); + config.add(attpass); _confditte->add(negozio, config); } return TRUE; @@ -248,6 +271,9 @@ bool TDT2Doc::load_conf_doc() } _condpag = config_studio.get("CondPag"); _contnetto = config_studio.get_bool("ContNettoSconto"); + _speseacc1 = config_studio.get("SpeseAcc1"); + _speseacc2 = config_studio.get("SpeseAcc2"); + _scontofin = config_studio.get("ScontoFin"); return TRUE; } @@ -258,9 +284,9 @@ bool TDT2Doc::create() _msk->set_handler(F_PERCORSO, browse_file_handler); _cms = " "; _condpag = " "; - _clienti = new TLocalisamfile(LF_CLIFO); + _clifor = new TLocalisamfile(LF_CLIFO); // array delle corrispondenze tra codici clienti - _array_clienti = new TAssoc_array(); + _array_clifor = new TAssoc_array(); // array della configurazione negozi/ditte _confditte = new TAssoc_array(); load_conf_ditte(); @@ -275,8 +301,10 @@ bool TDT2Doc::create() // primariga di ogni aliquota _primariga = new TAssoc_array(); return TSkeleton_application::create (); + } + bool TDT2Doc::destroy() { delete _primariga; @@ -284,8 +312,9 @@ bool TDT2Doc::destroy() delete _totalilordi; delete _confdoc; delete _confditte; - delete _array_clienti; - delete _clienti; + delete _array_clifor; + delete _clifor; + delete _msk; return TApplication::destroy(); } @@ -299,49 +328,74 @@ void TDT2Doc::main_loop() tasto = _msk->run(); if (tasto == K_ENTER) { - percorso = _msk->get(F_PERCORSO); - if (check_negozio(percorso)) + TFilename percorso(_msk->get(F_PERCORSO)); + const char tipocf = check_negozio(percorso); + if (tipocf != 'E') + { if (print_header(percorso)) { - _trasfile = new TDT2Doc_file(percorso); - import_clienti(percorso); - import_documenti(percorso); + const bool doc_attivi = tipocf == 'A'; + _trasfile = new TDT2Doc_file(percorso, (doc_attivi ? true, "dt0400a.ini" : "dt0400b.ini")); + import_clifor(percorso, (doc_attivi ? true, 'C' : 'F')); + int error = import_documenti(percorso, doc_attivi); configfile.set("PERCORSO", percorso, "OPZIONI"); delete _trasfile; - message_box(TR("Importazione documenti completata")); + if (!error) + { + rename_file(percorso); + message_box(TR("Importazione documenti completata")); + } + else + message_box(TR("Errori nell'importazione")); print_footer(); } + } } } -const long TDT2Doc::get_nextcodcf() +const long TDT2Doc::get_nextcodcf(const char tipocfchiesto) { - TLocalisamfile& clifo = *_clienti; + TLocalisamfile& clifo = *_clifor; long codcf = 1L ; - if (!clifo.empty()) - { - clifo.zero() ; - clifo.setkey(1) ; - clifo.put(CLI_TIPOCF, 'F'); - clifo.read(_isgteq) ; - if (clifo.good()) - clifo.prev() ; - clifo.setstatus(NOERR); - } - else clifo.last(); - if (clifo.good()) + if (tipocfchiesto == 'C') { - const TFixed_string tipocf(clifo.get(CLI_TIPOCF)); - if ( tipocf == "C") + if (!clifo.empty()) { - codcf = clifo.get_long(CLI_CODCF); - if (codcf == 999999) - clifo.prev(); - codcf = clifo.get_long(CLI_CODCF)+1; + clifo.zero() ; + clifo.setkey(1) ; + clifo.put(CLI_TIPOCF, 'F'); + clifo.read(_isgteq) ; + if (clifo.good()) + clifo.prev() ; + clifo.setstatus(NOERR); } - } + else clifo.last(); + if (clifo.good()) + { + const TFixed_string tipocf(clifo.get(CLI_TIPOCF)); + if ( tipocf == "C") + { + codcf = clifo.get_long(CLI_CODCF); + if (codcf == 999999) + clifo.prev(); + codcf = clifo.get_long(CLI_CODCF)+1; + } + } + } + else + { + clifo.last(); + if (clifo.good()) + { + const TFixed_string tipocf(clifo.get(CLI_TIPOCF)); + if ( tipocf == "C") + codcf = 1; + else + codcf = clifo.get_long(CLI_CODCF)+1; + } + } return codcf; } @@ -362,16 +416,117 @@ bool TDT2Doc::error_msg(const TString& msg, const TString16& causale, const int return TRUE; } -bool TDT2Doc::import_documenti(const TString80& percorso) +bool TDT2Doc::import_documenti(const TFilename& percorso, const bool doc_attivi) + { // eliminazione files delle elaborazioni precedenti TString_array transactions; - list_files("ditet*.ini", transactions); + TFilename dtfiles; dtfiles.tempdir(); + dtfiles.add("ditet*.ini"); + list_files(dtfiles, transactions); FOR_EACH_ARRAY_ROW(transactions, row, name) - remove(*name); - // lettura file - _trasfile->open(percorso, 'r'); - const long dimension = fsize(percorso); + remove_file(*name); + TFilename tempname; + if (doc_attivi) + _trasfile->open(percorso, 'r'); + else + { + // riordina i record del file di input documenti passivi per ndoc+tiporec + tempname.temp("", "txt"); + const size_t recordsize = 256; + char * buf = new char[recordsize]; + ifstream infile(percorso); + ofstream outfile(tempname); + TSort s(recordsize); + s.addsortkey(8, 3); + s.addsortkey(11, 10); + s.addsortkey(6, 2); + s.init(); + while (infile.getline(buf, recordsize) != NULL) + s.sort(buf); + s.endsort(); + delete buf; + const char * outbuf; + while ((outbuf = s.retrieve()) != NULL) + outfile << outbuf << endl; + _trasfile->open(tempname, 'r'); + } + bool error = elabora_documenti(doc_attivi); + _trasfile->close(); + if (tempname.exist()) + remove_file(tempname); + TString80 applicat; + applicat.format("ve0.exe -1 -i%s", (const char*) dtfiles); + TExternal_app gestdoc(applicat); + gestdoc.run(); + return error; +} + +int TDT2Doc::get_numdoc(const TString& numdocrif, const TDate datadoc, const TString& _codnum, const TString& tipodoc, const long codcf) +{ + int numdoc = 0; + TRelation rel(LF_DOC); + TRectype& curr = rel.curr(); + curr.put(DOC_TIPOCF, "F"); + curr.put(DOC_CODCF, codcf); + curr.put(DOC_PROVV, "D"); + curr.put(DOC_ANNO, datadoc.year()); + curr.put(DOC_DATADOC, datadoc); + curr.put(DOC_CODNUM, _codnum); + TCursor cur(&rel, "", 2, &curr, &curr); + const long items = cur.items(); + for (cur = 0; cur.pos() < items; ++cur) + { + TString80 ndr = cur.curr().get(DOC_NUMDOCRIF); + ndr.trim(); + if (ndr == numdocrif) + numdoc = cur.curr().get_int(DOC_NDOC); + } + return numdoc; +} + +int TDT2Doc::add_riga_doc(TDocumento* doc, TConfig& config) +{ + TRiga_documento& riga = doc->new_row(config.get(RDOC_TIPORIGA)); + riga.put(RDOC_QTA, config.get(RDOC_QTA)); + riga.put(RDOC_UMQTA,config.get(RDOC_UMQTA)); + riga.put(RDOC_CODIVA, config.get(RDOC_CODIVA)); + riga.put(RDOC_PREZZO, config.get(RDOC_PREZZO)); + return 0; +} + +void TDT2Doc::rename_file(const TFilename& percorso) +{ + TFilename newfile; + const TDate data(TODAY); + TString str = data.string(full,'-',full,full,amg_date); + str.strip("-"); + TFilename renamedfiles(percorso); + renamedfiles << str; + newfile = renamedfiles; + renamedfiles << "*.*"; + TString_array listfiles; + list_files(renamedfiles, listfiles); + int suffisso = 0; + FOR_EACH_ARRAY_ROW(listfiles, row, name) + { + TString80 namef(*name); + namef.trim(); + suffisso = atoi(namef.right(1)); + } + suffisso++; + newfile << suffisso; + if (fcopy(percorso, newfile)) + remove_file(percorso); + TString messaggio; + messaggio << "Il file " << percorso << " e' stato copiato in " << newfile; + print_line(messaggio); +} + +bool TDT2Doc::elabora_documenti(const bool doc_attivi) +{ + const long dimension = fsize(_trasfile->name()); + TProgind pi(dimension,"Importazione in corso..."); TConfig* docum=NULL; TString256 stampa; @@ -385,6 +540,8 @@ bool TDT2Doc::import_documenti(const TString80& percorso) real percsconto(ZERO); int numdoc; TString16 causale; + TDocumento* doc=NULL; + TRecord_text curr; while (_trasfile->read(curr) == NOERR && !pi.iscancelled() && err == NOERR) { @@ -396,43 +553,102 @@ bool TDT2Doc::import_documenti(const TString80& percorso) { if (sconto != ZERO && !_contnetto) { - TGeneric_distrib d(sconto, TCurrency::get_firm_dec(true)); + const int ndec = TCurrency::get_firm_dec(false); + TGeneric_distrib d(sconto, ndec); for (tl = (real*) _totalilordi->first_item(); tl != NULL; tl = (real*) _totalilordi->succ_item()) d.add(*tl); real totsconti(ZERO); for (tl = (real*) _totalilordi->first_item(); tl != NULL; tl = (real*) _totalilordi->succ_item()) { sconto = d.get(); - TString16 codiva = _totalilordi->get_hashobj()->key(); + const TString& codiva = _totalilordi->get_hashobj()->key(); TCodiceIVA codiceIVA(codiva); - codiceIVA.scorpora(sconto, TCurrency::get_firm_dec(true)); + codiceIVA.scorpora(sconto, ndec); real& imp_calcolato = *tl; - real& imp_castelletto = (real&) _castelletto->find(codiva); - codiceIVA.scorpora(imp_calcolato, TCurrency::get_firm_dec(true)); - real diff = imp_calcolato-sconto-imp_castelletto; - sconto = sconto + diff; - nriga++; - docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); - docum->set(RDOC_CHECKED, "X"); - docum->set(RDOC_TIPORIGA, "07"); - docum->set(RDOC_DESCR, "Sconto"); - TString16 str = sconto.string(TCurrency::get_firm_dec(true)); - docum->set(RDOC_PREZZO, str); - docum->set(RDOC_CODIVA, codiva); - docum->set(RDOC_CODCMS, _cms); - totsconti+=sconto; + if (_castelletto->is_key(codiva)) + { + real& imp_castelletto = (real&) _castelletto->find(codiva); + codiceIVA.scorpora(imp_calcolato, ndec); + real diff = imp_calcolato-sconto-imp_castelletto; + if (sconto != ZERO) + { + if (doc_attivi) + sconto += diff; + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "07"); + docum->set(RDOC_DESCR, "Sconto"); + docum->set(RDOC_PREZZO, sconto.string()); + docum->set(RDOC_CODIVA, codiva); + docum->set(RDOC_CODCMS, _cms); + add_riga_doc(doc, *docum); + totsconti+=sconto; + if (!doc_attivi) + { + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "01"); + docum->set(RDOC_CODART, codiva); + docum->set(RDOC_DESCR, "Pareggio sconto"); + docum->set(RDOC_QTA, "1"); + docum->set(RDOC_PREZZO, sconto.string()); + docum->set(RDOC_CODIVA, codiva); + docum->set(RDOC_CODCMS, _cms); + add_riga_doc(doc, *docum); + } + } + } + else + error = error_msg("incongruenza nel castelletto - iva assente ", causale, numdoc, codiva); } } else { for (tl = (real*) _totalilordi->first_item(); tl != NULL; tl = (real*) _totalilordi->succ_item()) { - TString16 codiva = _totalilordi->get_hashobj()->key(); + const TString& codiva = _totalilordi->get_hashobj()->key(); TCodiceIVA codiceIVA(codiva); real& imp_calcolato = *tl; - real& imp_castelletto = (real&) _castelletto->find(codiva); - codiceIVA.scorpora(imp_calcolato, TCurrency::get_firm_dec(true)); - real diff = imp_castelletto-imp_calcolato; + if (_castelletto->is_key(codiva)) + { + real& imp_castelletto = (real&) _castelletto->find(codiva); + codiceIVA.scorpora(imp_calcolato, TCurrency::get_firm_dec(true)); + real diff = imp_castelletto-imp_calcolato; + diff.round(2); + if (diff != ZERO) + { + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "01"); + docum->set(RDOC_DESCR, "Rettifica"); + docum->set(RDOC_PREZZO, diff.string()); + docum->set(RDOC_QTA, "1"); + docum->set(RDOC_CODIVA, codiva); + TString& codart = (TString&) _primariga->find(codiva); + docum->set(RDOC_CODART, codart); + docum->set(RDOC_CODCMS, _cms); + add_riga_doc(doc, *docum); + } + } + else + error = error_msg("incongruenza nel castelletto - iva assente ", causale, numdoc, codiva); + } + } + if ((!doc_attivi) && (doc!=NULL)) + { + // verifico tabella iva + TAssoc_array& tabella_iva = doc->tabella_iva(); + TRiepilogo_iva* riepilogo_iva; + // Scorre tutti gli elementi della tabella IVA del documento (elementi per codice iva) + for (riepilogo_iva = (TRiepilogo_iva*) tabella_iva.first_item(); riepilogo_iva != NULL; riepilogo_iva = (TRiepilogo_iva*) tabella_iva.succ_item()) + { + const TString& codiva_riep = riepilogo_iva->cod_iva().codice(); + real& imp_castelletto = (real&) _castelletto->find( codiva_riep); + real imponibile = riepilogo_iva->imponibile(); + real diff = imp_castelletto-imponibile; diff.round(2); if (diff != ZERO) { @@ -441,16 +657,17 @@ bool TDT2Doc::import_documenti(const TString80& percorso) docum->set(RDOC_CHECKED, "X"); docum->set(RDOC_TIPORIGA, "01"); docum->set(RDOC_DESCR, "Rettifica"); - TString16 str = diff.string(TCurrency::get_firm_dec()); - docum->set(RDOC_PREZZO, str); + docum->set(RDOC_PREZZO, diff.string()); docum->set(RDOC_QTA, "1"); - docum->set(RDOC_CODIVA, codiva); - TString& codart = (TString&) _primariga->find(codiva); + docum->set(RDOC_CODIVA, codiva_riep); + TString& codart = (TString&) _primariga->find(codiva_riep); docum->set(RDOC_CODART, codart); docum->set(RDOC_CODCMS, _cms); + add_riga_doc(doc, *docum); } } } + } // chiudo il file precedente _totalilordi->destroy(); @@ -463,17 +680,23 @@ bool TDT2Doc::import_documenti(const TString80& percorso) } if (error) // cancello il file perch'e la transazione non e' andata bene { - TFilename file = format("ditet%03d.ini",ntransac); - if (file.exist()) - remove(file); + TFilename dtfile; dtfile.tempdir(); + dtfile.add(format("ditet%03d.ini",ntransac)); + if (dtfile.exist()) + remove_file(dtfile); } error = FALSE; if (curr.type() == "01") { ntransac++; - docum = new TConfig(format("ditet%03d.ini",ntransac)); + TFilename dtfile; dtfile.tempdir(); + dtfile.add(format("ditet%03d.ini",ntransac)); + docum = new TConfig(dtfile); sconto = ZERO; - numdoc = atoi(curr.get(3)); + if (doc_attivi) + numdoc = atoi(curr.get(3)); + else + numdoc = 0; const TDate datadoc = (TDate) curr.get(4); causale = curr.get(10); causale << "|"; @@ -486,14 +709,12 @@ bool TDT2Doc::import_documenti(const TString80& percorso) const TString16 tipodoc = str.get(); if (tipodoc.not_empty()) { - TString16 codclidt; - codclidt = curr.get(5); - if (_array_clienti->is_key(codclidt)) + TString16 codcfdt; + codcfdt = curr.get(5); + if (_array_clifor->is_key(codcfdt)) { - TString& codcli = (TString&) _array_clienti->find(codclidt); - //ntransac++; + TString& codcf = (TString&) _array_clifor->find(codcfdt); nriga=0; - //docum = new TConfig(format("ditet%03d.ini",ntransac)); docum->set_paragraph("Transaction"); docum->set("Action","INSERT"); docum->set("Mode","AUTO"); @@ -502,10 +723,23 @@ bool TDT2Doc::import_documenti(const TString80& percorso) docum->set(DOC_PROVV, "D"); docum->set(DOC_CODNUM, _codnum); docum->set(DOC_TIPODOC, tipodoc); - docum->set(DOC_NDOC, numdoc); + if (!doc_attivi) + { + TString80 numdocrif = curr.get(3); + numdocrif.strip("/"); + numdocrif.strip("\\"); + numdocrif.strip("-"); + numdocrif.strip("_"); + numdocrif.trim(); + numdoc = get_numdoc(numdocrif, datadoc, _codnum, tipodoc, atol(codcf)); + docum->set(DOC_NUMDOCRIF, numdocrif); + docum->set(DOC_DATADOCRIF, datadoc); + } + if (numdoc != 0) + docum->set(DOC_NDOC, numdoc); docum->set(DOC_DATADOC, datadoc); - docum->set(DOC_TIPOCF, "C"); - docum->set(DOC_CODCF, codcli); + docum->set(DOC_TIPOCF, (doc_attivi ? "C": "F")); + docum->set(DOC_CODCF, codcf); TString16 codpag = curr.get(6); codpag.trim(); const TString16 codpagdt = cache().get("%DTP", codpag, "S4"); @@ -513,6 +747,11 @@ bool TDT2Doc::import_documenti(const TString80& percorso) docum->set(DOC_CODPAG, _condpag); else docum->set(DOC_CODPAG, codpagdt); + // istanzio TDocumento per fare le verifiche sul castelletto + if (doc != NULL) + delete doc; + doc = new TDocumento('D', datadoc.year(), _codnum, 0); + doc->set_tipo(tipodoc); } else error = error_msg("cliente non identificato", causale, numdoc, ""); @@ -543,6 +782,71 @@ bool TDT2Doc::import_documenti(const TString80& percorso) importo=importo/100; real* oggetto = new real(importo); _castelletto->add(codiva,(TObject*)oggetto); + + // creo le righe di doc. perche' nei doc.passivi non ci sono + if (!doc_attivi) + { + real imposta = (real) curr.get(10); + imposta=imposta/100; + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "01"); + docum->set(RDOC_CODART, codiva); + docum->set(RDOC_CODCMS, _cms); + if (!_primariga->is_key(codiva)) + { + TString* ca = new TString(codiva); + _primariga->add(codiva,(TObject*)ca); + } + docum->set(RDOC_DESCR, "Riga documento "); + real qta = 1; + TString str = qta.string(); + docum->set(RDOC_QTA, str); + docum->set(RDOC_UMQTA, "N."); + TCodiceIVA codiceIVA((const char*) codiva); + docum->set(RDOC_CODIVA, codiva); + real impostacalc = codiceIVA.imposta(importo); + str = importo.string(); + docum->set(RDOC_PREZZO, str); + add_riga_doc(doc, *docum); + if (imposta != impostacalc) //inserisco riga di rettifica IVA + { + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "15"); + docum->set(RDOC_CODART, codiva); + docum->set(RDOC_CODCMS, _cms); + if (!_primariga->is_key(codiva)) + { + TString* ca = new TString(codiva); + _primariga->add(codiva,(TObject*)ca); + } + docum->set(RDOC_DESCR, "Rettifica IVA "); + real qta = 1; + TString str = qta.string(); + docum->set(RDOC_QTA, str); + docum->set(RDOC_UMQTA, "N."); + TCodiceIVA codiceIVA((const char*) codiva); + docum->set(RDOC_CODIVA, codiva); + real diff = imposta - impostacalc; + str = diff.string(); + docum->set(RDOC_PREZZO, str); + add_riga_doc(doc, *docum); + } + real importoriga = importo+impostacalc; + if (_totalilordi->is_key(codiva)) + { + real& importor = (real&)_totalilordi->find(codiva); + importor+=importoriga; + } + else + { + real* oggetto = new real(importoriga); + _totalilordi->add(codiva,(TObject*)oggetto); + } + } } else error = error_msg("manca la corrispondenza iva" ,causale, numdoc, tabiva); @@ -555,6 +859,177 @@ bool TDT2Doc::import_documenti(const TString80& percorso) sconto = sconto/100; importodoc = importodoc + sconto; percsconto = sconto/importodoc; + + if (!doc_attivi) + { + TString str; + // sconto finanziario + real scontofin = (real) curr.get(9); + real importoriga = scontofin/100; + if (importoriga != ZERO) + { + const TString16 codiva = cache().get("SPP", _scontofin, "S3"); + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "02"); + docum->set(RDOC_CODART, _scontofin); + docum->set(RDOC_CODCMS, _cms); + docum->set(RDOC_DESCR, "Sconto finanziario"); + real qta = 1; + str = qta.string(); + docum->set(RDOC_QTA, str); + docum->set(RDOC_UMQTA, "N."); + TCodiceIVA codiceIVA((const char*) codiva); + docum->set(RDOC_CODIVA, codiva); + real imposta = codiceIVA.imposta(importoriga); + str = importoriga.string(); + docum->set(RDOC_PREZZO, str); + add_riga_doc(doc, *docum); + } + // spese accessorie 1 + char segno = curr.get(10)[0]; + importoriga = (real) curr.get(11); + importoriga = importoriga/100; + if (segno == '-') + importoriga = -importoriga; + if (importoriga != ZERO) + { + TString16 tabiva = curr.get(12); + tabiva.trim(); + tabiva.rpad(4); + str = curr.get(13); + str.trim(); + tabiva << str; + tabiva.rpad(7); + str = curr.get(14); + str.trim(); + tabiva << str; + const TString16 codiva = cache().get("%DTI", tabiva, "S4"); + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "02"); + docum->set(RDOC_CODART, _speseacc1); + docum->set(RDOC_CODCMS, _cms); + if (!_primariga->is_key(codiva)) + { + TString* ca = new TString(_speseacc1); + _primariga->add(codiva,(TObject*)ca); + } + docum->set(RDOC_DESCR, "Spese accessorie 1"); + real qta = 1; + str = qta.string(); + docum->set(RDOC_QTA, str); + docum->set(RDOC_UMQTA, "N."); + TCodiceIVA codiceIVA((const char*) codiva); + docum->set(RDOC_CODIVA, codiva); + real imposta = codiceIVA.imposta(importoriga); + str = importoriga.string(); + docum->set(RDOC_PREZZO, str); + add_riga_doc(doc, *docum); + if (_contnetto) + { + real importo = importoriga+imposta; + if (_totalilordi->is_key(codiva)) + { + real& importoi = (real&)_totalilordi->find(codiva); + importoi+=importo; } + else + { + real* oggetto = new real(importo); + _totalilordi->add(codiva,(TObject*)oggetto); + } + } + else //aggiungo la rettifica per far quadrare il castelletto + { + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "01"); + docum->set(RDOC_DESCR, "Rettifica spese acc. 1"); + importoriga = -importoriga; + str = importoriga.string(); + docum->set(RDOC_PREZZO, str); + docum->set(RDOC_QTA, "1"); + docum->set(RDOC_CODIVA, codiva); + TString& codart = (TString&) _primariga->find(codiva); + docum->set(RDOC_CODCMS, _cms); + add_riga_doc(doc, *docum); + } + } + // spese accessorie 2 + segno = curr.get(15)[0]; + importoriga = (real) curr.get(16); + importoriga = importoriga/100; + if (segno =='-') + importoriga = -importoriga; + if (importoriga != ZERO) + { + TString16 tabiva = curr.get(17); + tabiva.trim(); + tabiva.rpad(4); + TString str = curr.get(18); + str.trim(); + tabiva << str; + tabiva.rpad(7); + str = curr.get(19); + str.trim(); + tabiva << str; + const TString16 codiva = cache().get("%DTI", tabiva, "S4"); + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "02"); + docum->set(RDOC_CODART, _speseacc2); + docum->set(RDOC_CODCMS, _cms); + if (!_primariga->is_key(codiva)) + { + TString* ca = new TString(_speseacc2); + _primariga->add(codiva,(TObject*)ca); + } + docum->set(RDOC_DESCR, "Spese accessorie 2"); + real qta = 1; + str = qta.string(); + docum->set(RDOC_QTA, str); + docum->set(RDOC_UMQTA, "N."); + TCodiceIVA codiceIVA((const char*) codiva); + docum->set(RDOC_CODIVA, codiva); + real imposta = codiceIVA.imposta(importoriga); + str = importoriga.string(); + docum->set(RDOC_PREZZO, str); + add_riga_doc(doc, *docum); + if (_contnetto) + { + real importo = importoriga+imposta; + if (_totalilordi->is_key(codiva)) + { + real& importoi = (real&)_totalilordi->find(codiva); + importoi+=importo; } + else + { + real* oggetto = new real(importo); + _totalilordi->add(codiva,(TObject*)oggetto); + } + } + else // aggiungo la rettifica per far quadrare il castelletto + { + nriga++; + docum->set_paragraph(format("%d,%d",LF_RIGHEDOC, nriga)); + docum->set(RDOC_CHECKED, "X"); + docum->set(RDOC_TIPORIGA, "01"); + docum->set(RDOC_DESCR, "Rettifica spese acc. 2"); + importoriga = -importoriga; + str = importoriga.string(); + docum->set(RDOC_PREZZO, str); + docum->set(RDOC_QTA, "1"); + docum->set(RDOC_CODIVA, codiva); + TString& codart = (TString&) _primariga->find(codiva); + docum->set(RDOC_CODCMS, _cms); + add_riga_doc(doc, *docum); + } + } + } } else if ((!error) && (curr.type() == "04" || curr.type() == "05")) // righe documento { @@ -604,6 +1079,7 @@ bool TDT2Doc::import_documenti(const TString80& percorso) prezzo.round(TCurrency::get_firm_dec(true)); str = prezzo.string(); docum->set(RDOC_PREZZO, str); + add_riga_doc(doc, *docum); importoriga=prezzo*qta; importoriga = codiceIVA.lordo(importoriga, TCurrency::get_firm_dec(true)); if (_totalilordi->is_key(codiva)) @@ -616,28 +1092,31 @@ bool TDT2Doc::import_documenti(const TString80& percorso) real* oggetto = new real(importoriga); _totalilordi->add(codiva,(TObject*)oggetto); } - } else error = error_msg("manca la corrispondenza iva" ,causale, numdoc, tabiva); } } - _trasfile->close(); // chiudo l'ultimo file if (docum != NULL) delete docum; + if (doc != NULL) + delete doc; + if (error) // cancello il file perch'e la transazione non e' andata bene { - TFilename file = format("ditet%03d.ini",ntransac); - if (file.exist()) - remove(file); + TFilename dtfile; dtfile.tempdir(); + dtfile.add(format("ditet%03d.ini",ntransac)); + if (dtfile.exist()) + remove_file(dtfile); + } - TExternal_app gestdoc("ve0.exe -1 -iditet*.ini "); - gestdoc.run(); - return TRUE; + return error; + } -bool TDT2Doc::import_clienti(const TString80& percorso) +bool TDT2Doc::import_clifor(const TFilename& percorso, const char tipocf) + { // cache per i comuni TRecord_cache cache_comuni(LF_COMUNI, 2); @@ -647,8 +1126,9 @@ bool TDT2Doc::import_clienti(const TString80& percorso) TRelation rel(LF_CLIFO); TRectype& reccli = rel.curr(); TLocalisamfile& clifo = rel.lfile(); - _array_clienti->destroy(); + _array_clifor->destroy(); TString256 stampa; + int err = NOERR; TRecord_text curr; while (_trasfile->read(curr) == NOERR && !pi.iscancelled() && err == NOERR) @@ -665,37 +1145,37 @@ bool TDT2Doc::import_clienti(const TString80& percorso) { rel.lfile().setkey(4); reccli.zero(); - reccli.put(CLI_TIPOCF, 'C'); + reccli.put(CLI_TIPOCF, tipocf); reccli.put(CLI_COFI, cofi); if (reccli.read(rel.lfile())!=NOERR) { reccli.zero(); - const long codcf = get_nextcodcf(); - reccli.put(CLI_TIPOCF, 'C'); + const long codcf = get_nextcodcf(tipocf); + reccli.put(CLI_TIPOCF, tipocf); reccli.put(CLI_CODCF, codcf); reccli.put(CLI_RAGSOC, ragsoc); err = reccli.write(rel.lfile()); if (err != NOERR) - message_box("Errore in scrittura clienti %d", err); + message_box(TR("Errore in scrittura clienti/fornitori %d"), err); } } else if (!paiv.blank()) { rel.lfile().setkey(5); reccli.zero(); - reccli.put(CLI_TIPOCF, 'C'); + reccli.put(CLI_TIPOCF, tipocf); reccli.put(CLI_STATOPAIV, statopaiv); reccli.put(CLI_PAIV, paiv); if (reccli.read(rel.lfile())!=NOERR) { reccli.zero(); - const long codcf = get_nextcodcf(); - reccli.put(CLI_TIPOCF, 'C'); + const long codcf = get_nextcodcf(tipocf); + reccli.put(CLI_TIPOCF, tipocf); reccli.put(CLI_CODCF, codcf); reccli.put(CLI_RAGSOC, ragsoc); err = reccli.write(rel.lfile()); if (err != NOERR) - message_box("Errore in scrittura clienti %d", err); + message_box(TR("Errore in scrittura clienti/fornitori %d"), err); } } _trasfile->autosave(rel, curr); @@ -720,10 +1200,10 @@ bool TDT2Doc::import_clienti(const TString80& percorso) } rel.rewrite(); // aggiungo il cliente all'array per ritrovarlo sui documenti - const TString16 codcli = rel.curr().get(CLI_CODCF); - const TString16 codclidt = curr.get(3); - if (!_array_clienti->is_key(codclidt)) - _array_clienti->add(codclidt, codcli); + const TString16 codcf = rel.curr().get(CLI_CODCF); + const TString16 codcfdt = curr.get(3); + if (!_array_clifor->is_key(codcfdt)) + _array_clifor->add(codcfdt, codcf); } } _trasfile->close(); @@ -736,4 +1216,3 @@ int dt0400(int argc, char* argv[]) main_app.run(argc, argv, TR("Importazione documenti")); return TRUE; } - diff --git a/dt/dt0400b.ini b/dt/dt0400b.ini new file mode 100755 index 000000000..579fd6bcf --- /dev/null +++ b/dt/dt0400b.ini @@ -0,0 +1,514 @@ +[MAIN] +DECSEP = , +RECORDSEP = \n +TYPEFIELD = 1 +TYPEPOS = 6 +TYPELEN = 2 + +[TYPE STRINGA] +DATA = S + +[TYPE DATA] +DATA = D +LENGTH=10 + +[TYPE NUMERO] +DATA = N + +[TYPE IMPORTO] +DATA = N +LENGTH=10 +DECIMAL=2 + +[TYPE QTA] +DATA = N +LENGTH=11 +DECIMAL=3 + + +[RECORD 01] +NAME(0) = CODICE NEGOZIO +TYPE(0) = STRINGA +POSITION(0) = 0 +LENGTH(0) = 6 + +NAME(1) = TIPO RECORD +TYPE(1) = STRINGA +POSITION(1) = 6 +LENGTH(1) = 2 + +NAME(2) = TIPO DOCUMENTO +TYPE(2) = STRINGA +POSITION(2) = 8 +LENGTH(2) = 3 + +NAME(3) = NUMERO DOCUMENTO +TYPE(3) = NUMERO +POSITION(3) = 11 +LENGTH(3) = 10 + +NAME(4) = DATA DOCUMENTO +TYPE(4) = DATA +POSITION(4) = 21 +LENGTH(4) = 10 + +NAME(5) = CODICE CLIENTE +TYPE(5) = STRINGA +POSITION(5) = 31 +LENGTH(5) = 8 + +NAME(6) = CODICE PAGAMENTO +TYPE(6) = STRINGA +POSITION(6) = 39 +LENGTH(6) = 3 + +NAME(7) = CODICE DILAZIONE PAGAMENTO +TYPE(7) = STRINGA +POSITION(7) = 42 +LENGTH(7) = 2 + +NAME(8) = DATA DI ESTRAZIONE +TYPE(8) = DATA +POSITION(8) = 44 +LENGTH(8) = 10 + +NAME(9) = FLAG DI DOCUMENTO RECUPERATO +TYPE(9) = STRINGA +POSITION(9) = 54 +LENGTH(9) = 1 + +NAME(10) = CAUSALE +TYPE(10) = STRINGA +POSITION(10) = 55 +LENGTH(10) = 3 + +[RECORD 02] +NAME(0) = CODICE NEGOZIO +TYPE(0) = STRINGA +POSITION(0) = 0 +LENGTH(0) = 6 + +NAME(1) = TIPO RECORD +TYPE(1) = STRINGA +POSITION(1) = 6 +LENGTH(1) = 2 + +NAME(2) = TIPO DOCUMENTO +TYPE(2) = STRINGA +POSITION(2) = 8 +LENGTH(2) = 3 + +NAME(3) = NUMERO DOCUMENTO +TYPE(3) = NUMERO +POSITION(3) = 11 +LENGTH(3) = 10 + +NAME(4) = DATA DOCUMENTO +TYPE(4) = DATA +POSITION(4) = 21 +LENGTH(4) = 10 + +NAME(5) = ALIQUOTA IVA +TYPE(5) = STRINGA +POSITION(5) = 31 +LENGTH(5) = 4 + +NAME(6) = ARTICOLO LEGGE IVA +TYPE(6) = STRINGA +POSITION(6) = 35 +LENGTH(6) = 3 + +NAME(7) = COMMA LEGGE IVA +TYPE(7) = STRINGA +POSITION(7) = 38 +LENGTH(7) = 2 + +NAME(8) = SEGNO IMPORTO +TYPE(8) = STRINGA +POSITION(8) = 40 +LENGTH(8) = 1 + +NAME(9) = IMPONIBILE +TYPE(9) = IMPORTO +POSITION(9) = 41 +LENGTH(9) = 10 + +NAME(10) = IMPOSTA +TYPE(10) = IMPORTO +POSITION(10) = 51 +LENGTH(10) = 10 + +[RECORD 03] +NAME(0) = CODICE NEGOZIO +TYPE(0) = STRINGA +POSITION(0) = 0 +LENGTH(0) = 6 + +NAME(1) = TIPO RECORD +TYPE(1) = STRINGA +POSITION(1) = 6 +LENGTH(1) = 2 + +NAME(2) = TIPO DOCUMENTO +TYPE(2) = STRINGA +POSITION(2) = 8 +LENGTH(2) = 3 + +NAME(3) = NUMERO DOCUMENTO +TYPE(3) = NUMERO +POSITION(3) = 11 +LENGTH(3) = 10 + +NAME(4) = DATA DOCUMENTO +TYPE(4) = DATA +POSITION(4) = 21 +LENGTH(4) = 10 + +NAME(5) = TOTALE DOCUMENTO +TYPE(5) = IMPORTO +POSITION(5) = 31 +LENGTH(5) = 10 + +NAME(6) = TOTALE SCONTI +TYPE(6) = IMPORTO +POSITION(6) = 41 +LENGTH(6) = 10 + +NAME(7) = TOTALE A PAGARE +TYPE(7) = IMPORTO +POSITION(7) = 51 +LENGTH(7) = 10 + +NAME(8) = CODICE STATO PAGAMENTO +TYPE(8) = STRINGA +POSITION(8) = 61 +LENGTH(8) = 1 + +NAME(9) = SCONTO FINANZIARIO +TYPE(9) = IMPORTO +POSITION(9) = 62 +LENGTH(9) = 10 + +NAME(10) = SEGNO SPESE ACC. 1 +TYPE(10) = STRINGA +POSITION(10) = 72 +LENGTH(10) = 1 + +NAME(11) = IMPONIBILE SPESE ACC. 1 +TYPE(11) = IMPORTO +POSITION(11) = 73 +LENGTH(11) = 10 + +NAME(12) = ALIQUOTA SPESE ACC. 1 +TYPE(12) = STRINGA +POSITION(12) = 83 +LENGTH(12) = 4 + +NAME(13) = ARTICOLO SPESE ACC. 1 +TYPE(13) = STRINGA +POSITION(13) = 87 +LENGTH(13) = 3 + +NAME(14) = COMMA SPESE ACC. 1 +TYPE(14) = STRINGA +POSITION(14) = 90 +LENGTH(14) = 2 + +NAME(15) = SEGNO SPESE ACC. 2 +TYPE(15) = STRINGA +POSITION(15) = 92 +LENGTH(15) = 1 + +NAME(16) = IMPONIBILE SPESE ACC. 2 +TYPE(16) = IMPORTO +POSITION(16) = 93 +LENGTH(16) = 10 + +NAME(17) = ALIQUOTA SPESE ACC. 2 +TYPE(17) = STRINGA +POSITION(17) = 103 +LENGTH(17) = 4 + +NAME(18) = ARTICOLO SPESE ACC. 2 +TYPE(18) = STRINGA +POSITION(18) = 107 +LENGTH(18) = 3 + +NAME(19) = COMMA SPESE ACC. 2 +TYPE(19) = STRINGA +POSITION(19) = 110 +LENGTH(19) = 2 + +[RECORD 04] +NAME(0) = CODICE NEGOZIO +TYPE(0) = STRINGA +POSITION(0) = 0 +LENGTH(0) = 6 + +NAME(1) = TIPO RECORD +TYPE(1) = STRINGA +POSITION(1) = 6 +LENGTH(1) = 2 + +NAME(2) = TIPO DOCUMENTO +TYPE(2) = STRINGA +POSITION(2) = 8 +LENGTH(2) = 3 + +NAME(3) = NUMERO DOCUMENTO +TYPE(3) = NUMERO +POSITION(3) = 11 +LENGTH(3) = 6 + +NAME(4) = DATA DOCUMENTO +TYPE(4) = DATA +POSITION(4) = 17 +LENGTH(4) = 10 + +NAME(5) = CAUSALE +TYPE(5) = STRINGA +POSITION(5) = 27 +LENGTH(5) = 5 + +NAME(6) = CODICE ARTICOLO +TYPE(6) = STRINGA +POSITION(6) = 32 +LENGTH(6) = 15 + +NAME(7) = DESCRIZIONE ARTICOLO +TYPE(7) = STRINGA +POSITION(7) = 47 +LENGTH(7) = 35 + +NAME(8) = QUANTITA +TYPE(8) = QTA +POSITION(8) = 82 +LENGTH(8) = 11 + +NAME(9) = UNITA DI MISURA +TYPE(9) = STRINGA +POSITION(9) = 93 +LENGTH(9) = 2 + +NAME(10) = PREZZO UNITARIO +TYPE(10) = IMPORTO +POSITION(10) = 95 +LENGTH(10) = 10 + +NAME(11) = ALIQUOTA IVA +TYPE(11) = STRINGA +POSITION(11) = 105 +LENGTH(11) = 4 + +NAME(12) = ARTICOLO LEGGE IVA +TYPE(12) = STRINGA +POSITION(12) = 109 +LENGTH(12) = 3 + +NAME(19) = COMMA LEGGE IVA +TYPE(19) = STRINGA +POSITION(19) = 112 +LENGTH(19) = 2 + +NAME(13) = SCONTO A VALORE +TYPE(13) = IMPORTO +POSITION(13) = 114 +LENGTH(13) = 10 + +NAME(14) = IMPORTO TOTALE RIGA +TYPE(14) = IMPORTO +POSITION(14) = 114 +LENGTH(14) = 10 + +NAME(15) = CODICE FORNITORE +TYPE(15) = STRINGA +POSITION(15) = 134 +LENGTH(15) = 8 + +NAME(16) = NUMERO RIFERIMENTO BOLLA +TYPE(16) = NUMERO +POSITION(16) = 142 +LENGTH(16) = 6 + +NAME(17) = DATA RIFERIMENTO BOLLA +TYPE(17) = DATA +POSITION(17) = 148 +LENGTH(17) = 10 + +NAME(18) = CODICE REPARTO CASSA +TYPE(18) = STRINGA +POSITION(18) = 158 +LENGTH(18) = 3 + +[RECORD 05] +NAME(0) = CODICE NEGOZIO +TYPE(0) = STRINGA +POSITION(0) = 0 +LENGTH(0) = 6 + +NAME(1) = TIPO RECORD +TYPE(1) = STRINGA +POSITION(1) = 6 +LENGTH(1) = 2 + +NAME(2) = TIPO DOCUMENTO +TYPE(2) = STRINGA +POSITION(2) = 8 +LENGTH(2) = 3 + +NAME(3) = NUMERO DOCUMENTO +TYPE(3) = NUMERO +POSITION(3) = 11 +LENGTH(3) = 6 + +NAME(4) = DATA DOCUMENTO +TYPE(4) = DATA +POSITION(4) = 17 +LENGTH(4) = 10 + +NAME(5) = CAUSALE +TYPE(5) = STRINGA +POSITION(5) = 27 +LENGTH(5) = 5 + +NAME(6) = CODICE ARTICOLO +TYPE(6) = STRINGA +POSITION(6) = 32 +LENGTH(6) = 15 + +NAME(7) = DESCRIZIONE ARTICOLO +TYPE(7) = STRINGA +POSITION(7) = 47 +LENGTH(7) = 35 + +NAME(8) = QUANTITA +TYPE(8) = QTA +POSITION(8) = 82 +LENGTH(8) = 11 + +NAME(9) = UNITA DI MISURA +TYPE(9) = STRINGA +POSITION(9) = 93 +LENGTH(9) = 2 + +NAME(10) = PREZZO UNITARIO +TYPE(10) = IMPORTO +POSITION(10) = 95 +LENGTH(10) = 10 + +NAME(11) = ALIQUOTA IVA +TYPE(11) = STRINGA +POSITION(11) = 105 +LENGTH(11) = 4 + +NAME(12) = ARTICOLO LEGGE IVA +TYPE(12) = STRINGA +POSITION(12) = 109 +LENGTH(12) = 5 + +NAME(19) = COMMA LEGGE IVA +TYPE(19) = STRINGA +POSITION(19) = 112 +LENGTH(19) = 2 + +NAME(13) = SCONTO A VALORE +TYPE(13) = IMPORTO +POSITION(13) = 114 +LENGTH(13) = 10 + +NAME(14) = IMPORTO TOTALE RIGA +TYPE(14) = IMPORTO +POSITION(14) = 114 +LENGTH(14) = 10 + +NAME(15) = CODICE FORNITORE +TYPE(15) = STRINGA +POSITION(15) = 134 +LENGTH(15) = 8 + +NAME(16) = NUMERO RIFERIMENTO BOLLA +TYPE(16) = NUMERO +POSITION(16) = 142 +LENGTH(16) = 6 + +NAME(17) = DATA RIFERIMENTO BOLLA +TYPE(17) = DATA +POSITION(17) = 148 +LENGTH(17) = 10 + +NAME(18) = CODICE REPARTO CASSA +TYPE(18) = STRINGA +POSITION(18) = 158 +LENGTH(18) = 3 + +[RECORD 06] +NAME(0) = CODICE NEGOZIO +TYPE(0) = STRINGA +POSITION(0) = 0 +LENGTH(0) = 6 + +NAME(1) = TIPO RECORD +TYPE(1) = STRINGA +POSITION(1) = 6 +LENGTH(1) = 2 + +NAME(2) = TIPO DOCUMENTO +TYPE(2) = STRINGA +POSITION(2) = 8 +LENGTH(2) = 3 + +NAME(3) = CODICE FORNITORE +TYPE(3) = STRINGA +POSITION(3) = 11 +LENGTH(3) = 8 + +NAME(4) = RAGIONE SOCIALE 1 +TYPE(4) = STRINGA +POSITION(4) = 19 +LENGTH(4) = 30 + +NAME(5) = RAGIONE SOCIALE 2 +TYPE(5) = STRINGA +POSITION(5) = 49 +LENGTH(5) = 30 + +NAME(6) = INDIRIZZO +TYPE(6) = STRINGA +LENGTH(6) = 40 +POSITION(6) = 79 +FIELD(6) = 20->INDCF + +NAME(7) = CAP +TYPE(7) = STRINGA +LENGTH(7) = 5 +POSITION(7) = 119 +FIELD(7) = 20->CAPCF + +NAME(8) = LOCALITA +TYPE(8) = STRINGA +LENGTH(8) = 20 +POSITION(8) = 124 +FIELD(8) = 20->LOCALITACF + +NAME(9) = COMUNE +TYPE(9) = STRINGA +POSITION(9) = 144 +LENGTH(9) = 30 + +NAME(10) = PROVINCIA +TYPE(10) = STRINGA +POSITION(10) = 174 +LENGTH(10) = 2 + +NAME(11) = PARTITA IVA +TYPE(11) = STRINGA +POSITION(11) = 176 +LENGTH(11) = 11 +FIELD(11) = 20->PAIV + +NAME(12) = CODICE FISCALE +TYPE(12) = STRINGA +POSITION(12) = 187 +LENGTH(12) = 16 +FIELD(12) = 20->COFI + diff --git a/ef/ef0500.cpp b/ef/ef0500.cpp index 7af1d1c36..5c568525a 100755 --- a/ef/ef0500.cpp +++ b/ef/ef0500.cpp @@ -834,6 +834,17 @@ bool TDistinta_form::validate(TForm_item &cf, TToken_string &s) cf.set(valore); } else if (in == "CFPI") + { + valore = _firmrel->curr(LF_ANAG).get("PAIV"); + valore.trim(); + if (valore.empty()) + { + valore = _firmrel->curr(LF_ANAG).get("COFI"); + valore.trim(); + } + cf.set(valore); + } else + if (in == "CFPI") { valore = _firmrel->curr(LF_ANAG).get("PAIV"); valore.trim(); diff --git a/htmlhelp/index.html b/htmlhelp/index.html index 732acbd58..d3cfaa448 100755 --- a/htmlhelp/index.html +++ b/htmlhelp/index.html @@ -1,7 +1,6 @@ -OneRed by DoubleOne - +Campo @@ -12,4 +11,4 @@ - + \ No newline at end of file diff --git a/htmlhelp/pages/alto.html b/htmlhelp/pages/alto.html index 422253661..1cd8420e2 100755 --- a/htmlhelp/pages/alto.html +++ b/htmlhelp/pages/alto.html @@ -1,7 +1,7 @@ - DoubleOne + Campo @@ -21,4 +21,4 @@ - + \ No newline at end of file diff --git a/htmlhelp/pages/home.html b/htmlhelp/pages/home.html index f61a56176..d06a455a9 100755 --- a/htmlhelp/pages/home.html +++ b/htmlhelp/pages/home.html @@ -1,6 +1,6 @@ -OneRed by DoubleOne +Campo