diff --git a/cg/cg0500a.uml b/cg/cg0500a.uml index c519d1b41..c9e61f1e4 100755 --- a/cg/cg0500a.uml +++ b/cg/cg0500a.uml @@ -15,7 +15,7 @@ END STRING F_COD_CAUS 3 BEGIN - PROMPT 3 1 "Codice " + PROMPT 2 1 "Codice " HELP "Codice identificativo della causale" FIELD LF_CAUSALI->CODCAUS KEY 1 @@ -36,7 +36,7 @@ END STRING F_DESCR 50 BEGIN - PROMPT 15 1 "Descrizione " + PROMPT 15 1 "Descriz. " FIELD LF_CAUSALI->DESCR USE LF_CAUSALI KEY 2 INPUT DESCR F_DESCR diff --git a/cg/cg2100.cpp b/cg/cg2100.cpp index 01efcb3d9..7cab61df3 100755 --- a/cg/cg2100.cpp +++ b/cg/cg2100.cpp @@ -55,6 +55,8 @@ TMask* TPrimanota_application::load_mask(int n) break; case 2: { + m->set_handler(F_DATADOC, doc_handler); + m->set_handler(F_NUMDOC, doc_handler); m->set_handler(F_DATA74TER, data74ter_handler); m->set_handler(F_PROTIVA, protiva_handler); m->set_handler(F_CLIENTE, clifo_handler); @@ -140,6 +142,8 @@ bool TPrimanota_application::user_create() set_search_field(F_NUMREG); // Set field for default search + read_firm_params(); + load_mask(0); return TRUE; @@ -215,8 +219,6 @@ bool TPrimanota_application::read_caus(const char* cod, int year) { const long protiva = _causale.reg().protocol() + 1; m->set(F_PROTIVA, protiva); // Aggiorna protocollo IVA - if (sal) - m->set(F_NUMRIF, m->get(F_NUMDOC)); } } @@ -337,7 +339,14 @@ void TPrimanota_application::read_firm_params() TConfig c(CONFIG_DITTA, "cg"); _ges_val = c.get_bool("GesVal"); _ges_sal = c.get_bool("GesSal"); - _rif_par = c.get_bool("RifPar"); +} + +bool TPrimanota_application::change_config(const char* var, const char* old, const char* val) +{ + const TFixed_string v(var); + if (v == "GesVal") _ges_val = *val > ' '; else + if (v == "GesSal") _ges_sal = *val > ' '; + return TRUE; } @@ -385,7 +394,6 @@ void TPrimanota_application::init_mask(TMask& m) void TPrimanota_application::init_query_mode(TMask& m) { - read_firm_params(); enable_menu_item(M_FILE_PRINT); } diff --git a/cg/cg2102.cpp b/cg/cg2102.cpp index c2cde1b2e..c3badf34d 100755 --- a/cg/cg2102.cpp +++ b/cg/cg2102.cpp @@ -1285,6 +1285,30 @@ bool TPrimanota_application::data74ter_handler(TMask_field& f, KEY key) return ok; } +bool TPrimanota_application::doc_handler(TMask_field& f, KEY key) +{ + if (key == K_TAB) + { + TMask& m = f.mask(); + const TString& val = f.get(); + + if (!val.empty() && m.field(F_ANNORIF).active()) + { // Se c'e' gestione saldaconto + if (f.dlg() == F_DATADOC) + { + const TDate dd(val); + m.set(F_ANNORIF, dd.year()); // copia data documento + } + else + { + m.set(F_NUMRIF, val); // copia numero documento + } + } + } + + return TRUE; +} + bool TPrimanota_application::occas_code_handler(TMask_field& f, KEY key) { if (key == K_TAB) diff --git a/cg/cg2102.h b/cg/cg2102.h index 7343604fd..1bf6e5191 100755 --- a/cg/cg2102.h +++ b/cg/cg2102.h @@ -40,7 +40,6 @@ class TPrimanota_application : public TRelation_application TLibro_giornale _giornale; // Libro giornale corrente TipoIVA _iva; // Tipo di IVA corrente bool _ges_val, _ges_sal; // Gestione valuta e saldaconto - bool _rif_par; // Riferimento parita (NUM_DOC | PROTIVA) bool _savenew; // Registra e nuovo bool _iva_showed; // Lo sheet IVA e' gia' stato visualizzato una volta? @@ -59,6 +58,7 @@ class TPrimanota_application : public TRelation_application static bool datareg_handler(TMask_field& f, KEY key); static bool datacomp_handler(TMask_field& f, KEY key); static bool data74ter_handler(TMask_field& f, KEY key); + static bool doc_handler(TMask_field& f, KEY key); static bool protiva_handler(TMask_field& f, KEY key); static bool clifo_handler(TMask_field& f, KEY key); static bool totale_handler(TMask_field& f, KEY key); @@ -93,6 +93,7 @@ protected: virtual bool user_create(); virtual bool user_destroy(); virtual void print(); + virtual bool change_config(const char* var, const char* old, const char* val); virtual bool changing_mask(int mode); virtual TMask* get_mask(int mode); virtual TRelation* get_relation() const { return _rel; } @@ -121,9 +122,9 @@ protected: char clifo() const { return iva() == iva_vendite ? 'C' : 'F'; } bool gestione_valuta() const { return _ges_val; } bool gestione_saldaconto() const { return _ges_sal; } - bool riferimento_partita() const { return _rif_par; } void fill_sheet(TMask& m) const; + void read_firm_params(); void init_mask(TMask& m); diff --git a/cg/cg5200.cpp b/cg/cg5200.cpp index 6106b4479..7696b2b4a 100755 --- a/cg/cg5200.cpp +++ b/cg/cg5200.cpp @@ -1,11 +1,10 @@ // cg5200.cpp - Visualizzazione saldi -#include +#include +#include #include #include -#include #include -#include #include #include @@ -16,8 +15,6 @@ #include "cglib.h" #include "cg5200.h" -//HIDDEN const char* REAL_PICTURE = "###.###.###.###"; - class TRiga_array : public TArray { public: @@ -101,14 +98,11 @@ bool TRiga_array::add_riga(const TRectype& rec_saldi) return found; } -bool sottoc_handler (TMask_field& f, KEY k); - -class CG5200_application : public TBrowse_application +class TSaldibrowse_application : public TBrowse_application { - friend bool sottoc_handler (TMask_field& f, KEY k); TMask* _msk; - TLocalisamfile* _pcon,* _clifo; + TLocalisamfile* _clifo; TCursor * _cur; TRelation * _rel,* _rel1; TRiga_array _riga; @@ -125,6 +119,8 @@ protected: virtual int read(TMask& m); virtual void init_query_mode(TMask&); virtual void init_modify_mode(TMask&); + + static bool sottoc_handler (TMask_field& f, KEY k); public: void add_r(int,int,real&,real&,real&,char,real&,real&, @@ -135,29 +131,29 @@ public: TMask* main_mask() const {return _msk;} TSheet_field& ss() const { return (TSheet_field&)_msk->field(F_SHEET_SALDI);} - CG5200_application() {} + TSaldibrowse_application() {} }; -HIDDEN CG5200_application * app() { return (CG5200_application*) MainApp(); } +HIDDEN TSaldibrowse_application& app() { return (TSaldibrowse_application&) main_app(); } -void CG5200_application::init_query_mode(TMask& m) +void TSaldibrowse_application::init_query_mode(TMask& m) { m.disable(DLG_FINDREC); } -void CG5200_application::init_modify_mode(TMask& m) +void TSaldibrowse_application::init_modify_mode(TMask& m) { m.disable(DLG_FINDREC); } -bool CG5200_application::fai_filtro() +bool TSaldibrowse_application::fai_filtro() { TSaldo sld; int annop = 0; char tipo; _saldo_gruppo = _saldo_conto = _saldo_sottoc = FALSE; - TMask* m = app()->main_mask(); + TMask* m = app().main_mask(); tipo = m->get(F_TIPOCF)[0]; _anno = m->get_int(F_ANNO); _g = m->get_int(F_GRUPPO); @@ -213,31 +209,34 @@ bool CG5200_application::fai_filtro() return TRUE; } -bool sottoc_handler(TMask_field& f, KEY key) +bool TSaldibrowse_application::sottoc_handler(TMask_field& f, KEY key) { - const short id = f.dlg(); - const int gruppo = f.mask().get_int(F_GRUPPO); - const int conto = f.mask().get_int(F_CONTO); - const long sottoconto = f.mask().get_long(id); - TLocalisamfile& pconti = app()->get_relation()->lfile(); - - if ( key == K_TAB ) + if ( key == K_TAB) { - if (!f.focusdirty() && gruppo == 0 && conto == 0) return TRUE; - - if (sottoconto != 0 && conto == 0) - { - f.warning_box("Manca il CONTO"); - f.mask().stop_run(K_ESC); - return FALSE; - } - if (conto != 0 && gruppo == 0) - { - f.warning_box("Manca il GRUPPO"); - f.mask().stop_run(K_ESC); - return FALSE; - } - + const int gruppo = f.mask().get_int(F_GRUPPO); + const int conto = f.mask().get_int(F_CONTO); + if (gruppo == 0 || conto == 0) return TRUE; + + const short id = f.dlg(); + const long sottoconto = atol(f.get()); + TLocalisamfile& pconti = app().get_relation()->lfile(); + + /* + if (!f.focusdirty() && gruppo == 0 && conto == 0) return TRUE; + + if (sottoconto != 0 && conto == 0) + { + f.warning_box("Manca il CONTO"); + f.mask().stop_run(K_ESC); + return FALSE; + } + if (conto != 0 && gruppo == 0) + { + f.warning_box("Manca il GRUPPO"); + f.mask().stop_run(K_ESC); + return FALSE; + } + */ if (id == F_SOTTOCONTO) { pconti.zero(); @@ -255,10 +254,10 @@ bool sottoc_handler(TMask_field& f, KEY key) f.mask().stop_run(K_AUTO_ENTER); } else return f.warning_box("Registrazione assente"); - } - if (id == F_SOTTOC_CLIENTE || id == F_SOTTOC_FORN) + } + else { - char tipo = id == F_SOTTOC_CLIENTE ? 'C' : 'F'; + const char tipo = id == F_SOTTOC_CLIENTE ? 'C' : 'F'; TLocalisamfile clifo (LF_CLIFO); if (sottoconto != 0) { @@ -309,14 +308,13 @@ bool sottoc_handler(TMask_field& f, KEY key) return TRUE; } -bool CG5200_application::user_create() +bool TSaldibrowse_application::user_create() { _msk = new TMask("cg5200a"); _msk->set_handler(F_SOTTOCONTO, sottoc_handler); _msk->set_handler(F_SOTTOC_CLIENTE, sottoc_handler); _msk->set_handler(F_SOTTOC_FORN, sottoc_handler); disable_all(); - _pcon = new TLocalisamfile(LF_PCON); _clifo = new TLocalisamfile(LF_CLIFO); _rel = new TRelation(LF_PCON); _rel1 = new TRelation(LF_SALDI); @@ -326,16 +324,18 @@ bool CG5200_application::user_create() return TRUE; } -void CG5200_application::disable_all() +void TSaldibrowse_application::disable_all() { - for (int i = 0; i < 17; i++) - ss().enable_column(i,FALSE); + /* + for (int i = 0; i < 17; i++) + ss().enable_column(i,FALSE); + */ + ss().disable(); } -bool CG5200_application::user_destroy() +bool TSaldibrowse_application::user_destroy() { delete _msk; - delete _pcon; delete _clifo; delete _rel; delete _rel1; @@ -344,7 +344,7 @@ bool CG5200_application::user_destroy() return TRUE; } -int CG5200_application::read(TMask& m) +int TSaldibrowse_application::read(TMask& m) { m.autoload(_rel); fai_filtro(); @@ -354,8 +354,8 @@ int CG5200_application::read(TMask& m) return NOERR; } -void CG5200_application::add_r(int numrig,int a,real& pds,real& pas,real& sc,char f,real& si,real& pd, - real& pa,real& s,TDate& d,long n,real& pdp,real& pap,real& sp) +void TSaldibrowse_application::add_r(int numrig,int a,real& pds,real& pas,real& sc,char f,real& si,real& pd, + real& pa,real& s,TDate& d,long n,real& pdp,real& pap,real& sp) { TSheet_field& cs = ss(); char segno = ' '; @@ -437,7 +437,7 @@ void CG5200_application::add_r(int numrig,int a,real& pds,real& pas,real& sc,cha riga.add(segno,16); } -void CG5200_application::compilasheet() +void TSaldibrowse_application::compilasheet() { char flagsal = ' '; real saldo = ZERO; @@ -529,7 +529,7 @@ void CG5200_application::compilasheet() int cg5200(int argc, char* argv[]) { - CG5200_application a; + TSaldibrowse_application a; a.run(argc, argv, "Visualizzazione saldi"); return 0; } diff --git a/cg/cg5200a.uml b/cg/cg5200a.uml index 85afa8228..b2b5b68de 100755 --- a/cg/cg5200a.uml +++ b/cg/cg5200a.uml @@ -50,7 +50,7 @@ BEGIN DISPLAY "Gruppo" GRUPPO DISPLAY "Descrizione@50" DESCR OUTPUT F_GRUPPO GRUPPO - //OUTPUT F_DESCR_CONTO DESCR + CHECKTYPE NORMAL FLAGS "R" END @@ -68,9 +68,9 @@ BEGIN DISPLAY "Descrizione@50" DESCR OUTPUT F_CONTO CONTO OUTPUT F_GRUPPO GRUPPO - //OUTPUT F_DESCR_CLIENTE DESCR - //OUTPUT F_DESCR_FORN DESCR - //OUTPUT F_DESCR_CONTO DESCR +//OUTPUT F_DESCR_CLIENTE DESCR +//OUTPUT F_DESCR_FORN DESCR + OUTPUT F_DESCR_CONTO DESCR FLAGS "R" CHECKTYPE NORMAL WARNING "Conto inesistente o mancante" @@ -140,13 +140,12 @@ BEGIN DISPLAY "Conto" CONTO DISPLAY "Sottoconto" SOTTOCONTO DISPLAY "Descrizione@50" DESCR - OUTPUT F_SOTTOCONTO SOTTOCONTO OUTPUT F_GRUPPO GRUPPO OUTPUT F_CONTO CONTO - //OUTPUT F_DESCR_CONTO DESCR + OUTPUT F_SOTTOCONTO SOTTOCONTO + OUTPUT F_DESCR_CONTO DESCR //OUTPUT F_DESCR_CLIENTE DESCR //OUTPUT F_DESCR_FORN DESCR - //CHECKTYPE NORMAL //MESSAGE COPY,F_SOTTOC_FORN //MESSAGE COPY,F_SOTTOC_CLIENTE FLAGS "R" @@ -172,7 +171,7 @@ BEGIN OUTPUT F_GRUPPO GRUPPO OUTPUT F_CONTO_CLIENTE CONTO //OUTPUT F_DESCR_CONTO RAGSOC -//OUTPUT F_DESCR_CLIENTE RAGSOC + OUTPUT F_DESCR_CLIENTE RAGSOC //OUTPUT F_DESCR_FORN RAGSOC FLAGS "R" CHECKTYPE NORMAL @@ -196,7 +195,7 @@ BEGIN OUTPUT F_SOTTOC_FORN CODCF OUTPUT F_GRUPPO GRUPPO OUTPUT F_CONTO_FORN CONTO -// OUTPUT F_DESCR_FORN RAGSOC + OUTPUT F_DESCR_FORN RAGSOC // OUTPUT F_DESCR_CONTO RAGSOC // OUTPUT F_DESCR_CLIENTE RAGSOC FLAGS "R" @@ -210,6 +209,7 @@ END STRING F_DESCR_CONTO 50 BEGIN PROMPT 4 4 "Descrizione " + FIELD DESCR HELP "Descrizione del conto da visualizzare" USE LF_PCON KEY 2 INPUT DESCR F_DESCR_CONTO @@ -218,7 +218,7 @@ BEGIN DISPLAY "Conto" CONTO DISPLAY "Sottoconto" SOTTOCONTO COPY OUTPUT F_SOTTOCONTO - KEY 1 + KEY 1 CHECKTYPE NORMAL GROUP 1 END @@ -259,23 +259,23 @@ END SPREADSHEET F_SHEET_SALDI BEGIN - PROMPT 2 6 "" + PROMPT 0 6 "" ITEM "Es." - ITEM " Saldo iniziale" + ITEM " Saldo iniziale@15" ITEM "" - ITEM "Progr.Att.: Dare" - ITEM " Avere" - ITEM " Saldo" + ITEM "Progr.Att.: Dare@15" + ITEM " Avere@15" + ITEM " Saldo@15" ITEM "" - ITEM "Progr.Mov.Elim.: Dare" - ITEM " Avere" + ITEM "Progr.Mov.Elim.: Dare@15" + ITEM " Avere@15" ITEM "Saldo complessivo" ITEM "" ITEM "Ult.Op.: Data" ITEM " Numero" - ITEM "Progr.Mov.Prov.: Dare" - ITEM " Avere" - ITEM " Saldo" + ITEM "Progr.Mov.Prov.: Dare@15" + ITEM " Avere@15" + ITEM " Saldo@15" ITEM "" END @@ -410,34 +410,11 @@ BEGIN HELP "Sezione del saldo progressivi dei moviemnti provvisori del conto" END -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -12 -1 "" -END - BUTTON DLG_CANCEL 9 2 BEGIN - PROMPT -22 -1 "" + PROMPT -11 -1 "" END -/* -BUTTON DLG_OK 9 2 -BEGIN - PROMPT -13 -1 "" -END - -BUTTON DLG_CANCEL 9 2 -BEGIN - PROMPT -23 -1 "" -END - -BUTTON DLG_NULL 9 2 -BEGIN - PROMPT -33 -1 "Azzera" - MESSAGE RESET,1@ -END -*/ - ENDPAGE ENDMASK