From 7685566cd8694c8079ac01d3dc6ea57342b96ab6 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 20 May 1996 13:17:58 +0000 Subject: [PATCH] Correttta maschera di gestione progressivi IVA git-svn-id: svn://10.65.10.50/trunk@2856 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- cg/cg0400.cpp | 79 +++++++++++++++++++++++++++++++++++--------------- cg/cg0400.h | 29 +++++++++--------- cg/cg0400a.uml | 46 +++++++++-------------------- 3 files changed, 83 insertions(+), 71 deletions(-) diff --git a/cg/cg0400.cpp b/cg/cg0400.cpp index f7d503a25..e53913d76 100755 --- a/cg/cg0400.cpp +++ b/cg/cg0400.cpp @@ -112,7 +112,7 @@ bool TIva_array::add_riga(const tiporec& tipo, const real& imponibile, return found; }; -class CG0400_application : public TPrintapp +class TProgressivi_iva : public TPrintapp { TTable* _tabpim, * _tabreg, * _tabais, * _tablia; TLocalisamfile* _nditte, * _anag, * _com, * _attiv; @@ -128,7 +128,10 @@ class CG0400_application : public TPrintapp TString _datast, _cod_att; Importi _mesi[13]; liste _tipo_lista; - + +protected: + static bool tipo_handler(TMask_field& f, KEY k); + public: virtual bool user_create(); @@ -151,7 +154,7 @@ public: char look_lia(long ditta = 0l); void look_pim(); - CG0400_application(){}; + TProgressivi_iva(){}; }; HIDDEN int compare_rows(const TObject** o1, const TObject** o2) @@ -162,7 +165,7 @@ HIDDEN int compare_rows(const TObject** o1, const TObject** o2) return (strcmp((const char*)r1->_codiva, (const char*)r2->_codiva)); } -const char* CG0400_application::desc_attivita(const char* codatt) +const char* TProgressivi_iva::desc_attivita(const char* codatt) { TTable attiv ("%AIS"); attiv.zero(); @@ -174,7 +177,7 @@ const char* CG0400_application::desc_attivita(const char* codatt) return TMP; } -const char* CG0400_application::desc_iva(const char* cod) +const char* TProgressivi_iva::desc_iva(const char* cod) { TTable tab_iva("%IVA"); TString codtab(format("%-4s", cod)); @@ -189,7 +192,7 @@ const char* CG0400_application::desc_iva(const char* cod) return TMP; } -char CG0400_application::look_lia(long ditta) +char TProgressivi_iva::look_lia(long ditta) { if (ditta == 0l) ditta = get_firm(); @@ -204,7 +207,7 @@ char CG0400_application::look_lia(long ditta) return _tablia->get_char("S7"); } -bool CG0400_application::user_create() +bool TProgressivi_iva::user_create() { _tabpim = new TTable(TAB_PIM); _tabreg = new TTable(TAB_REG); @@ -222,7 +225,7 @@ bool CG0400_application::user_create() return TRUE; } -bool CG0400_application::user_destroy() +bool TProgressivi_iva::user_destroy() { delete _tabpim; delete _tabreg; @@ -236,7 +239,7 @@ bool CG0400_application::user_destroy() return TRUE; } -void CG0400_application::azzera_mesi() +void TProgressivi_iva::azzera_mesi() { for (int i=0; i<=12; i++) { @@ -245,7 +248,7 @@ void CG0400_application::azzera_mesi() } } -void CG0400_application::look_pim() +void TProgressivi_iva::look_pim() { TTable pim("PIM"); for (pim.first(); !pim.eof(); pim.next()) @@ -317,7 +320,7 @@ void CG0400_application::look_pim() _gen1_array.sort(compare_rows); // ordinamento per codice iva } -void CG0400_application::cerca_i_pim() +void TProgressivi_iva::cerca_i_pim() { TTable pim("PIM"); for (pim.first(); !pim.eof(); pim.next()) @@ -484,9 +487,33 @@ void CG0400_application::cerca_i_pim() impo = impos = ZERO; } } + +bool TProgressivi_iva::tipo_handler(TMask_field& f, KEY k) +{ + if (k == K_SPACE) + { + TMask& m = f.mask(); + const int livello = m.get_int(F_LIVELLO); + const int tipo = atoi(f.get()); + bool tab = FALSE, tabe = FALSE, tabel = FALSE; + if (livello == 1) + { + tab = tipo == 1; + tabe = tipo == 2; + } + else + { + tabel = tipo == 2; + } + m.show(F_TIPOTAB, tab); + m.show(F_TIPOTABE, tabe); + m.show(F_TIPOTABEL, tabel); + } + + return TRUE; +} - -bool CG0400_application::set_print(int m) +bool TProgressivi_iva::set_print(int m) { TString16 masc = ""; @@ -506,6 +533,12 @@ bool CG0400_application::set_print(int m) TMask msk(masc); + switch(m) + { + case 1 :msk.set_handler(F_TIPO, tipo_handler); + default:break; + } + if (msk.run() != K_ENTER) return FALSE; switch (_tipo_lista) @@ -574,7 +607,7 @@ break; return TRUE; } -void CG0400_application::calcola_totali(real& imp, real& imps) +void TProgressivi_iva::calcola_totali(real& imp, real& imps) { for (int i=0; i<=12; i++) { @@ -583,7 +616,7 @@ void CG0400_application::calcola_totali(real& imp, real& imps) } } -void CG0400_application::cerca_tipo(TIva_array& iva_array,tiporec t, +void TProgressivi_iva::cerca_tipo(TIva_array& iva_array,tiporec t, real& imp, real& imps, real& det) { int k = 0; @@ -605,7 +638,7 @@ void CG0400_application::cerca_tipo(TIva_array& iva_array,tiporec t, } } -bool CG0400_application::preprocess_page(int file, int counter) +bool TProgressivi_iva::preprocess_page(int file, int counter) { reset_print(); @@ -657,7 +690,7 @@ break; return TRUE; } -void CG0400_application::prospetto_pagina(TGen_array& gen, TIva_array& iva) +void TProgressivi_iva::prospetto_pagina(TGen_array& gen, TIva_array& iva) { real t_impov,t_imposv,t_impoa,t_imposa,t_impobd,t_imposbd; t_impov = t_imposv = t_impoa = t_imposa = t_impobd = t_imposbd = ZERO; @@ -809,7 +842,7 @@ TRectype& look_com (const char* cod, TLocalisamfile *comuni) return comuni->curr(); } -void CG0400_application::get_dati_ditta() +void TProgressivi_iva::get_dati_ditta() { TLocalisamfile nditte(LF_NDITTE); TLocalisamfile anag(LF_ANAG); @@ -859,7 +892,7 @@ void CG0400_application::get_dati_ditta() } } -int CG0400_application::stampa_intestazione_ditta() +int TProgressivi_iva::stampa_intestazione_ditta() { int r = 1; TString riga(132); @@ -880,7 +913,7 @@ int CG0400_application::stampa_intestazione_ditta() return r; } -void CG0400_application::setta_intestazione() +void TProgressivi_iva::setta_intestazione() { int r = 1; @@ -961,7 +994,7 @@ void CG0400_application::setta_intestazione() set_header(++r, "@29gImponibile@60gImposta"); } -void CG0400_application::preprocess_header() +void TProgressivi_iva::preprocess_header() { if (_tipo_lista == stampa) { @@ -1026,7 +1059,7 @@ void CG0400_application::preprocess_header() } } -print_action CG0400_application::postprocess_page(int file, int counter) +print_action TProgressivi_iva::postprocess_page(int file, int counter) { switch (_tipo_lista) { @@ -1056,7 +1089,7 @@ return NEXT_PAGE; int cg0400(int argc,char* argv[]) { - CG0400_application a; + TProgressivi_iva a; a.run(argc, argv, "Riepilogo progressivi IVA"); return 0; } diff --git a/cg/cg0400.h b/cg/cg0400.h index a92cc1cb1..88ac2f6fb 100755 --- a/cg/cg0400.h +++ b/cg/cg0400.h @@ -1,23 +1,22 @@ #ifndef __CG0400_H #define __CG0400_H -#define TAB_REG "REG" -#define TAB_PIM "PIM" +#define TAB_REG "REG" +#define TAB_PIM "PIM" -#define F_CODDITTA 101 -#define F_ANNO 102 -#define F_TIPO 103 -#define F_LIVELLO 104 -#define F_CODIVA 105 -#define F_TIPOTAB 106 -#define F_TIPOTABE 107 -#define F_ATTIVITA 108 -#define F_TIPOTABEL 109 -#define F_RAGSOC 110 -#define F_TIPO1 111 +#define F_CODDITTA 101 +#define F_ANNO 102 +#define F_TIPO 103 +#define F_LIVELLO 104 +#define F_CODIVA 105 +#define F_TIPOTAB 106 +#define F_TIPOTABE 107 +#define F_ATTIVITA 108 +#define F_TIPOTABEL 109 +#define F_RAGSOC 110 #define F_DATASTAMPA 112 -#define F_MESE 113 -#define F_STAMPA 114 +#define F_MESE 113 +#define F_STAMPA 114 #endif // __CG0400_H diff --git a/cg/cg0400a.uml b/cg/cg0400a.uml index dae362db6..77900376b 100755 --- a/cg/cg0400a.uml +++ b/cg/cg0400a.uml @@ -11,7 +11,7 @@ NUMBER F_CODDITTA 5 BEGIN PROMPT 2 1 "Ditta " FLAGS "ZFR" - USE LF_NDITTE KEY 1 + USE LF_NDITTE INPUT CODDITTA F_CODDITTA DISPLAY "Ditta" CODDITTA DISPLAY "Ragione sociale@50" RAGSOC @@ -41,42 +41,22 @@ BEGIN CHECKTYPE REQUIRED END -RADIOBUTTON F_TIPO 18 +RADIOBUTTON F_LIVELLO 24 BEGIN - PROMPT 2 5 "Tipo progressivi " - HELP "Tipo di riepilogo da effettuare" - ITEM "1|Vendite" - MESSAGE HIDE,F_TIPOTABE|HIDE,F_TIPOTABEL|SHOW,F_TIPOTAB - MESSAGE COPY,F_TIPO1 - ITEM "2|Acquisti" - MESSAGE SHOW,F_TIPOTABE|HIDE,F_TIPOTABEL|HIDE,F_TIPOTAB - MESSAGE COPY,F_TIPO1 - KEY 1 -END - -RADIOBUTTON F_TIPO1 18 -BEGIN - PROMPT 2 5 "Tipo progressivi " - HELP "Tipo di riepilogo da effettuare" - ITEM "1|Vendite" - MESSAGE HIDE,F_TIPOTABE|HIDE,F_TIPOTABEL|HIDE,F_TIPOTAB - MESSAGE COPY,F_TIPO - ITEM "2|Acquisti" - MESSAGE HIDE,F_TIPOTABE|SHOW,F_TIPOTABEL|HIDE,F_TIPOTAB - MESSAGE COPY,F_TIPO - KEY 1 -END - -RADIOBUTTON F_LIVELLO 21 -BEGIN - PROMPT 37 5 "Livello progressivi " + PROMPT 2 5 "Livello progressivi" HELP "Tipo di raggruppamento dei riepiloghi" ITEM "1|Per aliquota" - MESSAGE HIDE,F_ATTIVITA|SHOW,F_CODIVA|SHOW,F_TIPOTAB - MESSAGE HIDE,F_TIPO1|SHOW,F_TIPO|K_SPACE,F_TIPO + MESSAGE HIDE,F_ATTIVITA|SHOW,F_CODIVA|K_SPACE,F_TIPO ITEM "2|Per attivita'" - MESSAGE SHOW,F_ATTIVITA|HIDE,F_CODIVA|HIDE,F_TIPOTAB - MESSAGE HIDE,F_TIPO|SHOW,F_TIPO1|K_SPACE,F_TIPO1 + MESSAGE SHOW,F_ATTIVITA|HIDE,F_CODIVA|K_SPACE,F_TIPO +END + +RADIOBUTTON F_TIPO 24 +BEGIN + PROMPT 40 5 "Tipo progressivi " + HELP "Tipo di riepilogo da effettuare" + ITEM "1|Vendite" + ITEM "2|Acquisti" END STRING F_CODIVA 4