From 37b49c465c0f19557f2839cda85d46ab6e738b54 Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 12 Oct 2011 13:38:42 +0000 Subject: [PATCH] Patch level : Files correlati : cg0.exe cg1.exe cg1310.msk cgmenu.men Ricompilazione Demo : [ ] Commento : Permessa duplicazione codice fiscale di enti pubblici in anagrafica clifo Aggiunto programma per allineamento IBAN su CFBAN git-svn-id: svn://10.65.10.50/branches/R_10_00@22452 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0200.cpp | 5 +- cg/cg1.h | 2 + cg/cg1100.cpp | 24 ++++----- cg/cg1300.cpp | 29 ++++------- cg/cg1301.cpp | 23 ++++++++- cg/cg1301.h | 22 ++------ cg/cg1307.cpp | 3 +- cg/cg1307.h | 1 - cg/cg1308.cpp | 4 +- cg/cg1308.h | 1 - cg/cg1309.h | 1 - cg/cg1310.cpp | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++ cg/cg1310.uml | 39 ++++++++++++++ cg/cgmenu.men | 3 +- 14 files changed, 237 insertions(+), 59 deletions(-) delete mode 100755 cg/cg1307.h delete mode 100755 cg/cg1308.h delete mode 100755 cg/cg1309.h create mode 100644 cg/cg1310.cpp create mode 100644 cg/cg1310.uml diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index 4742f2f4b..4182e425f 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -276,7 +276,7 @@ HIDDEN bool paiv_handler(TMask_field& f, KEY key) if (ok) { const int alleg = m.get_int(F_ALLEG); - if (alleg != 4) + if (alleg != 4 && alleg != 7) { ok = no_dup_iva(f, key); if (ok) @@ -571,7 +571,7 @@ HIDDEN bool altnewcli_handler(TMask_field& f, KEY key) TToken_string key; app().get_next_key(key); - const long cod = (atol(key.get(3)) / divisore + 1) * divisore; + const long cod = (key.get_long(3) / divisore + 1) * divisore; m.set(F_CODCF, cod); if (m.mode() == MODE_QUERY) @@ -610,6 +610,7 @@ HIDDEN bool contrlav_handler(TMask_field& f, KEY key) } return true; } + void TClifo_application::on_config_change() { TConfig cnf(CONFIG_DITTA); diff --git a/cg/cg1.h b/cg/cg1.h index ab2880cc7..a360d66df 100755 --- a/cg/cg1.h +++ b/cg/cg1.h @@ -10,6 +10,8 @@ int cg1600(int argc, char* argv[]); int cg1700(int argc, char* argv[]); //int cg1800(int argc, char* argv[]); + + #endif // __CG1_H diff --git a/cg/cg1100.cpp b/cg/cg1100.cpp index 775278afb..18d66ae7d 100755 --- a/cg/cg1100.cpp +++ b/cg/cg1100.cpp @@ -1,6 +1,10 @@ // cg1100.cpp // Stampa piano dei conti +#ifdef WIN32 +#define _CRT_SECURE_NO_WARNINGS 1 +#endif + #include #include #include @@ -18,8 +22,6 @@ #include "cg1100.h" #include "cglib01.h" -const char * TAB_IVD = "%IVD"; - enum stampe { completa=1, con_IV_direttiva, @@ -1133,26 +1135,22 @@ void CG1100_application::intesta (stampe tipo) } -const TString & CG1100_application::descrizione_numero(char sezione, char lettera, int numr, const char * numero) +const TString& CG1100_application::descrizione_numero(char sezione, char lettera, int numr, const char * numero) { - TString key; + TString80 key; if (numr == 0) key.format("%c%c %-4s",sezione, lettera, numero); else key.format("%1c%1c%04d%-4s",sezione, lettera, numr, numero); - key.trim(); + key.rtrim(); - const TRectype & ivd = cache().get(TAB_IVD, key); - - return ivd.get("S0"); + return cache().get("%IVD", key, "S0"); } const TString & CG1100_application::descrizione_codcbl(const TString& codcbl) { - const TRectype & abpcon = cache().get(LF_ABPCON, codcbl); - - return abpcon.get("DESCRIZ"); + return cache().get(LF_ABPCON, codcbl, "DESCRIZ"); } bool CG1100_application::user_create() @@ -1174,7 +1172,9 @@ bool CG1100_application::user_create() _cur_senza_ana = add_cursor(new TCursor(rel_ana)); select_cursor(_cur_senza_ana); TCursor & c = *current_cursor(); - c.setfilter("((SOTTOCONTO!=0)&&(CODCBL==\"\")&&(201@->CODCBL==\"\")&&(202@->CODCBL==\"\"))||((SOTTOCONTO==0)&&(201@->CODCBL==\"\")&&(202@->CODCBL==\"\"))||((CONTO==0)&&(202@->CODCBL==\"\"))"); + c.setfilter("((SOTTOCONTO!=0)&&(CODCBL==\"\")&&(201@->CODCBL==\"\")&&(202@->CODCBL==\"\"))||" + "((SOTTOCONTO==0)&&(201@->CODCBL==\"\")&&(202@->CODCBL==\"\"))||" + "((CONTO==0)&&(202@->CODCBL==\"\"))"); select_cursor(_cur_std); _tipo_stampa = completa; _salto_pag = false; diff --git a/cg/cg1300.cpp b/cg/cg1300.cpp index feac4af3d..bedd19641 100755 --- a/cg/cg1300.cpp +++ b/cg/cg1300.cpp @@ -1,6 +1,11 @@ //******************************** //* Aggiornamento Tipo Attivita' * //******************************** +#include +#include +#include +#include + #include "cg1.h" #include "cg1301.h" #include "cg1302.h" @@ -8,14 +13,8 @@ #include "cg1304.h" #include "cg1305.h" #include "cg1306.h" -#include "cg1307.h" -#include "cg1308.h" -#include "cg1309.h" -#include "cglib01.h" -#include -#include -#include +#include "cglib01.h" #include @@ -92,13 +91,14 @@ int cg1300(int argc, char* argv[]) case 'A': { TAgg_attiv a; - a.run(argc, argv, TR("Aggiornamento tipo attivita' su movimenti iva")); + a.run(argc, argv, TR("Aggiornamento tipo attivitą su movimenti IVA")); } break; + case 'B': agg_iban(argc, argv); break; // cg1310 case 'C': { TAgg_codatt a; - a.run(argc, argv,TR("Aggiornamento codice attivita'")); + a.run(argc, argv,TR("Aggiornamento codice attivitą")); } break; case 'D': @@ -113,15 +113,8 @@ int cg1300(int argc, char* argv[]) a.run(argc, argv,TR("Aggiornamento codice esercizio")); } break; - case 'I': - { - TAgg_opintra a; - a.run(argc, argv, TR("Aggiornamento flag op. intracomunitarie")); - } - break; - case 'L': - controlla_PIVA(argc, argv); // cg1309 - break; + case 'I': agg_opintra(argc, argv); break; + case 'L': controlla_PIVA(argc, argv); break; // cg1309 case 'P': { TAgg_nprot a; diff --git a/cg/cg1301.cpp b/cg/cg1301.cpp index d0846a6e1..251b2a68b 100755 --- a/cg/cg1301.cpp +++ b/cg/cg1301.cpp @@ -1,6 +1,8 @@ //************************************************** //* Aggiornamento Flag Operazioni Intracomunitarie * //************************************************** + +#include #include #include #include @@ -10,7 +12,21 @@ #include #include -#include "cg1301.h" + +class TAgg_opintra : public TApplication +{ + TLocalisamfile* _causali; + +public: + virtual bool create(); + virtual bool destroy(); + virtual bool menu(MENU_TAG m); + + void look_mov(); + + TAgg_opintra() {}; + virtual ~TAgg_opintra() {}; +}; bool TAgg_opintra::create() { @@ -88,3 +104,8 @@ void TAgg_opintra::look_mov() } } +void agg_opintra(int argc, char* argv[]) +{ + TAgg_opintra aoi; + aoi.run(argc, argv, TR("Aggiornamento flag op. intracomunitarie")); +} diff --git a/cg/cg1301.h b/cg/cg1301.h index 4cc2af0e8..5fdc24162 100755 --- a/cg/cg1301.h +++ b/cg/cg1301.h @@ -1,17 +1,5 @@ -#include -#include - -class TAgg_opintra : public TApplication -{ - TLocalisamfile* _causali; - -public: - virtual bool create(); - virtual bool destroy(); - virtual bool menu(MENU_TAG m); - - void look_mov(); - - TAgg_opintra() {}; - virtual ~TAgg_opintra() {}; -}; +void agg_opintra(int argc, char* argv[]); +void elimina_zoppi(int argc, char* argv[]); +void setta_meseliq(int argc, char* argv[]); +void controlla_PIVA(int argc, char* argv[]); +void agg_iban(int argc, char* argv[]); diff --git a/cg/cg1307.cpp b/cg/cg1307.cpp index afc6f066e..4521a0c3c 100755 --- a/cg/cg1307.cpp +++ b/cg/cg1307.cpp @@ -554,9 +554,8 @@ void TElimina_zoppi::main_loop() while (m.run() != K_QUIT); } -int elimina_zoppi(int argc, char* argv[]) +void elimina_zoppi(int argc, char* argv[]) { TElimina_zoppi ez; ez.run(argc, argv, ez.app_name()); - return 0; } diff --git a/cg/cg1307.h b/cg/cg1307.h deleted file mode 100755 index a61b0b1f6..000000000 --- a/cg/cg1307.h +++ /dev/null @@ -1 +0,0 @@ -int elimina_zoppi(int argc, char* argv[]); diff --git a/cg/cg1308.cpp b/cg/cg1308.cpp index 0d4e6dcb4..29ee24722 100755 --- a/cg/cg1308.cpp +++ b/cg/cg1308.cpp @@ -7,7 +7,6 @@ #include #include "cg1300.h" -#include "cg1308.h" class TImposta_meseliq : public TSkeleton_application { @@ -74,9 +73,8 @@ void TImposta_meseliq::main_loop() } } -int setta_meseliq(int argc, char* argv[]) +void setta_meseliq(int argc, char* argv[]) { TImposta_meseliq a; a.run(argc, argv, TR("Impostazione mese liq.")); - return 0; } diff --git a/cg/cg1308.h b/cg/cg1308.h deleted file mode 100755 index a610e91ce..000000000 --- a/cg/cg1308.h +++ /dev/null @@ -1 +0,0 @@ -int setta_meseliq(int argc, char* argv[]); diff --git a/cg/cg1309.h b/cg/cg1309.h deleted file mode 100755 index 72a9809fc..000000000 --- a/cg/cg1309.h +++ /dev/null @@ -1 +0,0 @@ -void controlla_PIVA(int argc, char* argv[]); \ No newline at end of file diff --git a/cg/cg1310.cpp b/cg/cg1310.cpp new file mode 100644 index 000000000..3f166874c --- /dev/null +++ b/cg/cg1310.cpp @@ -0,0 +1,139 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include "cfban.h" + +/////////////////////////////////////////////////////////// +// TIBAN_mask +/////////////////////////////////////////////////////////// + +class TIBAN_mask : public TAutomask +{ +protected: + virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); + +public: + TIBAN_mask() : TAutomask("cg1310") { } +}; + +bool TIBAN_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) +{ + return true; +} + +/////////////////////////////////////////////////////////// +// TIBAN_app +/////////////////////////////////////////////////////////// + +class TIBAN_app : public TSkeleton_application +{ +protected: + void update(TRecord_array& a, TLog_report& log) const; + void elabora() const; + +public: + virtual void main_loop(); +}; + +void TIBAN_app::update(TRecord_array& a, TLog_report& log) const +{ + const TRectype& row = a.row(a.last_row()); + + TString msg; + msg << TR("Aggiornamento banca del ") + << row.get(CFBAN_TIPOCF) << '/' << row.get_long(CFBAN_CODCF) + << " : " << row.get(CFBAN_ABI) << '/' << row.get(CFBAN_CAB) + << " " << row.get(CFBAN_IBAN); + + log.log(0, msg); + + const int err = a.rewrite(); + if (err != NOERR) + { + msg.format(FR("Errore %d durante l'aggiornamento del file delle banche"), err); + log.log(2, msg); + } +} + +void TIBAN_app::elabora() const +{ + TLog_report log; + + TISAM_recordset clifo("USE CLIFO"); + TProgind pi(clifo.items(), clifo.cursor()->file(0).description()); + TRectype& curr = clifo.cursor()->curr(); + for (bool ok = clifo.move_first(); ok; ok = clifo.move_next()) + { + if (!pi.addstatus(1)) + break; + const TString80 iban = curr.get(CLI_IBAN); + const TString8 abi = curr.get(CLI_CODABI); + const TString8 cab = curr.get(CLI_CODCAB); + if (iban.len() > 15 || atoi(cab) >= 1000) + { + TString16 key; key.format("%c|%ld|V", curr.get_char(CLI_TIPOCF), curr.get_long(CLI_CODCF)); + TRecord_array cfban(key, LF_CFBAN); + if (iban.len() > 15) + { + int r = -1; + for (r = cfban.last_row(); r > 0; r = cfban.pred_row(r)) + { + const TRectype& row = cfban.row(r); + if (row.get(CFBAN_IBAN) == iban) + break; + } + if (r <= 0) + { + TRectype& row = cfban.row(-1, true); + row.put(CFBAN_IBAN, iban); + if (iban.starts_with("IT")) + { + row.put(CFBAN_ABI, iban.mid(6, 5)); + row.put(CFBAN_CAB, iban.mid(11, 5)); + row.put(CFBAN_NUMCC, iban.mid(16)); + } + update(cfban, log); + } + } + else + { + int r = -1; + for (r = cfban.last_row(); r > 0; r = cfban.pred_row(r)) + { + const TRectype& row = cfban.row(r); + if (row.get(CFBAN_ABI) == abi && row.get(CFBAN_CAB) == cab) + break; + } + if (r <= 0) + { + TRectype& row = cfban.row(-1, true); + row.put(CFBAN_ABI, abi); + row.put(CFBAN_CAB, cab); + row.put(CFBAN_NUMCC, curr.get(CLI_NUMCC)); + update(cfban, log); + } + } + } + } + + log.preview(); +} + +void TIBAN_app::main_loop() +{ + TIBAN_mask m; + if (m.run() == K_ENTER) + elabora(); +} + +void agg_iban(int argc, char* argv[]) +{ + TIBAN_app a; + a.run(argc, argv, TR("Allineamento IBAN")); +} diff --git a/cg/cg1310.uml b/cg/cg1310.uml new file mode 100644 index 000000000..f35e8dec5 --- /dev/null +++ b/cg/cg1310.uml @@ -0,0 +1,39 @@ +PAGE "Allineamento IBAN" -1 -1 60 5 + +NUMBER 101 5 +BEGIN + PROMPT 1 1 "Ditta " + FLAGS "FD" + USE LF_NDITTE + INPUT CODDITTA 101 + OUTPUT 102 RAGSOC + CHECKTYPE REQUIRED +END + +STRING 102 50 +BEGIN + PROMPT 7 2 "" + FLAGS "D" +END + + +TEXT DLG_NULL +BEGIN + PROMPT 1 3 "Questa procedura allinea il campo IBAN in anagrafica clienti/fornitori " +END + +TEXT DLG_NULL +BEGIN + PROMPT 1 4 "con l'elenco delle banche associate alla corrispondente anagrafica" +END + +ENDPAGE + +TOOLBAR "topbar" 0 0 0 2 + +#include + +ENDPAGE + + +ENDMASK \ No newline at end of file diff --git a/cg/cgmenu.men b/cg/cgmenu.men index 850600191..17aab8241 100755 --- a/cg/cgmenu.men +++ b/cg/cgmenu.men @@ -178,7 +178,8 @@ Item_08 = "Riorganizzazione codici esercizio", "cg1 -2 E", "FP" Item_09 = "Correzione righe di prima nota", "cg1 -2 Z", "FP" Item_10 = "Impostazione mese liquidazione", "cg1 -2 M", "FP" Item_11 = "Controllo P.I. e C.F. clienti/fornitori", "cg1 -2 L", "FP" -Item_12 = "Collegamento bilanci", [CGMENU_025] +Item_12 = "Allineamento IBAN su Banche x Cliente", "cg1 -2 B", "FP" +Item_13 = "Collegamento bilanci", [CGMENU_025] [CGMENU_019] Caption = "Invio"