Causato enorme scompiglio: cambiate LIA e PLA in %LIA e %PLA.
Ora la chiave richiede anche un codice ditta all'inizio di CODTAB git-svn-id: svn://10.65.10.50/trunk@992 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									d84c99c5ec
								
							
						
					
					
						commit
						c3ae6d78ab
					
				| @ -3,6 +3,7 @@ | |||||||
| #include <xvtmacro.h> | #include <xvtmacro.h> | ||||||
| #include <applicat.h> | #include <applicat.h> | ||||||
| #include <tabutil.h> | #include <tabutil.h> | ||||||
|  | #include <utility.h> | ||||||
| 
 | 
 | ||||||
| #include "cg2101.h" | #include "cg2101.h" | ||||||
| #include "cg2103.h" | #include "cg2103.h" | ||||||
| @ -11,7 +12,6 @@ | |||||||
| #include <rmov.h> | #include <rmov.h> | ||||||
| #include <rmoviva.h> | #include <rmoviva.h> | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| // Calcola l'anno di esercizio di una data                                
 | // Calcola l'anno di esercizio di una data                                
 | ||||||
| // Certified 99%
 | // Certified 99%
 | ||||||
| int date2esc(const TDate& d, int* prevesc) | int date2esc(const TDate& d, int* prevesc) | ||||||
| @ -149,15 +149,12 @@ char TMovimentoPN::frequenza_versamenti(int year) const | |||||||
|    |    | ||||||
|   if (firm != last_firm || year != last_year) |   if (firm != last_firm || year != last_year) | ||||||
|   { |   { | ||||||
|     TString16 key; |     TString16 key; key.format("%05ld%d", firm, year); | ||||||
|     key << year; |     TTable lia("%LIA"); | ||||||
|     TTable lia("LIA"); |  | ||||||
|     lia.setkey(1); |  | ||||||
|     lia.put("CODTAB", key); |     lia.put("CODTAB", key); | ||||||
|     if (lia.read() != NOERR) |     if (lia.read() != NOERR) | ||||||
|     {  |     {  | ||||||
|       TLocalisamfile nditte(LF_NDITTE); |       TLocalisamfile nditte(LF_NDITTE); | ||||||
|       nditte.setkey(1); |  | ||||||
|       nditte.put("CODDITTA", firm); |       nditte.put("CODDITTA", firm); | ||||||
|       nditte.read(); |       nditte.read(); | ||||||
|       last_freq = nditte.get_char("FREQVIVA"); |       last_freq = nditte.get_char("FREQVIVA"); | ||||||
|  | |||||||
| @ -145,11 +145,12 @@ bool TRegistro::read_att() | |||||||
|   if (err != NOERR) |   if (err != NOERR) | ||||||
|     _att.zero(); |     _att.zero(); | ||||||
|      |      | ||||||
|   TString16 chiave;             // Anno - Attivita' - Tipo Attivita' (fissata a 1)
 |   TString16 chiave;             // Ditta - Anno - Attivita' - Tipo Attivita' (fissata a 1)
 | ||||||
|  |   chiave.format("%5ld", main_app().get_firm()); | ||||||
|   chiave << year();             // non fare << year() << attivita()
 |   chiave << year();             // non fare << year() << attivita()
 | ||||||
|   chiave << attivita() << "1"; |   chiave << attivita() << "1"; | ||||||
|      |      | ||||||
|   TTable pla("PLA"); |   TTable pla("%PLA"); | ||||||
|   attiv.setkey(1); |   attiv.setkey(1); | ||||||
|   pla.put("CODTAB", chiave); |   pla.put("CODTAB", chiave); | ||||||
|   if (pla.read() == NOERR) |   if (pla.read() == NOERR) | ||||||
|  | |||||||
| @ -157,19 +157,26 @@ bool TLiquidazione_app::user_create() | |||||||
|   _ppa_codatt  = new TRecfield(*_ppa_r,"CODTAB",4,9); |   _ppa_codatt  = new TRecfield(*_ppa_r,"CODTAB",4,9); | ||||||
|   _ppa_month   = new TRecfield(*_ppa_r,"CODTAB",10,11); |   _ppa_month   = new TRecfield(*_ppa_r,"CODTAB",10,11); | ||||||
|   _ppa_kind    = new TRecfield(*_ppa_r,"CODTAB",12,12);  |   _ppa_kind    = new TRecfield(*_ppa_r,"CODTAB",12,12);  | ||||||
|  | 
 | ||||||
|   _plm_anno    = new TRecfield(*_plm_r,"CODTAB",0,3); |   _plm_anno    = new TRecfield(*_plm_r,"CODTAB",0,3); | ||||||
|   _plm_codatt  = new TRecfield(*_plm_r,"CODTAB",4,9); |   _plm_codatt  = new TRecfield(*_plm_r,"CODTAB",4,9); | ||||||
|   _plm_mese    = new TRecfield(*_plm_r,"CODTAB",10,11); |   _plm_mese    = new TRecfield(*_plm_r,"CODTAB",10,11); | ||||||
|   _pla_anno    = new TRecfield(*_pla_r,"CODTAB",0,3); | 
 | ||||||
|   _pla_codatt  = new TRecfield(*_pla_r,"CODTAB",4,9); |   _pla_ditta    = new TRecfield(*_pla_r,"CODTAB",0,4); | ||||||
|  |   _pla_anno    = new TRecfield(*_pla_r,"CODTAB",5,8); | ||||||
|  |   _pla_codatt  = new TRecfield(*_pla_r,"CODTAB",9,14); | ||||||
|  | 
 | ||||||
|   _del_ditta   = new TRecfield(*_del_r,"CODTAB",0,4); |   _del_ditta   = new TRecfield(*_del_r,"CODTAB",0,4); | ||||||
|   _del_anno    = new TRecfield(*_del_r,"CODTAB",5,8); |   _del_anno    = new TRecfield(*_del_r,"CODTAB",5,8); | ||||||
|   _del_mese    = new TRecfield(*_del_r,"CODTAB",9,10); |   _del_mese    = new TRecfield(*_del_r,"CODTAB",9,10); | ||||||
|   _del_tipo    = new TRecfield(*_del_r,"CODTAB",11,11); |   _del_tipo    = new TRecfield(*_del_r,"CODTAB",11,11); | ||||||
|  | 
 | ||||||
|   _lim_anno    = new TRecfield(*_lim_r,"CODTAB",0,3); |   _lim_anno    = new TRecfield(*_lim_r,"CODTAB",0,3); | ||||||
|   _lim_mese    = new TRecfield(*_lim_r,"CODTAB",4,6); |   _lim_mese    = new TRecfield(*_lim_r,"CODTAB",4,6); | ||||||
|  |    | ||||||
|   _lam_anno    = new TRecfield(*_lam_r,"CODTAB",0,3); |   _lam_anno    = new TRecfield(*_lam_r,"CODTAB",0,3); | ||||||
|   _lam_mese    = new TRecfield(*_lam_r,"CODTAB",4,6); |   _lam_mese    = new TRecfield(*_lam_r,"CODTAB",4,6); | ||||||
|  |    | ||||||
|   _rmb_anno    = new TRecfield(*_rmb_r,"CODTAB",0,3); |   _rmb_anno    = new TRecfield(*_rmb_r,"CODTAB",0,3); | ||||||
|   _rmb_mese    = new TRecfield(*_rmb_r,"CODTAB",4,6); |   _rmb_mese    = new TRecfield(*_rmb_r,"CODTAB",4,6); | ||||||
|   _rmb_codiva  = new TRecfield(*_rmb_r,"CODTAB",7,10); |   _rmb_codiva  = new TRecfield(*_rmb_r,"CODTAB",7,10); | ||||||
|  | |||||||
| @ -277,8 +277,11 @@ class TLiquidazione_app : public TPrint_application | |||||||
|   TRecfield* _plm_anno; |   TRecfield* _plm_anno; | ||||||
|   TRecfield* _plm_codatt; |   TRecfield* _plm_codatt; | ||||||
|   TRecfield* _plm_mese; |   TRecfield* _plm_mese; | ||||||
|  |    | ||||||
|  |   TRecfield* _pla_ditta; | ||||||
|   TRecfield* _pla_anno; |   TRecfield* _pla_anno; | ||||||
|   TRecfield* _pla_codatt; |   TRecfield* _pla_codatt; | ||||||
|  |    | ||||||
|   TRecfield* _del_ditta; |   TRecfield* _del_ditta; | ||||||
|   TRecfield* _del_anno; |   TRecfield* _del_anno; | ||||||
|   TRecfield* _del_mese; |   TRecfield* _del_mese; | ||||||
|  | |||||||
| @ -320,10 +320,11 @@ bool TLiquidazione_app::look_pla(const char* a, bool create) | |||||||
|   char buf[10]; strcpy(buf,a); |   char buf[10]; strcpy(buf,a); | ||||||
|   buf[strlen(buf) - 1] = '1'; |   buf[strlen(buf) - 1] = '1'; | ||||||
|    |    | ||||||
|   (*_pla_codatt) = format("%06ld", atol(buf)); |   (*_pla_ditta)  = format("%05ld", get_firm()); | ||||||
|   (*_pla_anno)   = _year; |   (*_pla_anno)   = _year; | ||||||
|  |   (*_pla_codatt) = format("%06ld", atol(buf)); | ||||||
| 
 | 
 | ||||||
|   TString s = _pla_r->get("CODTAB"); |   TString16 s = _pla_r->get("CODTAB"); | ||||||
|   _pla->read(); |   _pla->read(); | ||||||
|   ok = _pla->good(); |   ok = _pla->good(); | ||||||
|    |    | ||||||
| @ -333,8 +334,9 @@ bool TLiquidazione_app::look_pla(const char* a, bool create) | |||||||
|     // alla creazione del PLA
 |     // alla creazione del PLA
 | ||||||
|     // si prendono i valori di prorata e plafond dall'anno scorso       
 |     // si prendono i valori di prorata e plafond dall'anno scorso       
 | ||||||
|     _pla_r->zero(); |     _pla_r->zero(); | ||||||
|     (*_pla_codatt) = format("%06ld", atol(buf)); |     (*_pla_ditta)  = format("%05ld", get_firm()); | ||||||
|     (*_pla_anno)   = atoi(_year) - 1; |     (*_pla_anno)   = atoi(_year) - 1; | ||||||
|  |     (*_pla_codatt) = format("%06ld", atol(buf)); | ||||||
|     if (_pla->read() == NOERR) |     if (_pla->read() == NOERR) | ||||||
|     { |     { | ||||||
|       es_b1 = _pla->get_real("R1"); |       es_b1 = _pla->get_real("R1"); | ||||||
| @ -453,7 +455,7 @@ bool TLiquidazione_app::look_del(int month, int type, bool create) | |||||||
| bool TLiquidazione_app::look_lia(bool create, int year) | bool TLiquidazione_app::look_lia(bool create, int year) | ||||||
| { | { | ||||||
|   if (year == 0) year = atoi(_year); |   if (year == 0) year = atoi(_year); | ||||||
|   TString16 y; y << year; |   TString16 y; y.format("%05ld%04d", get_firm(), year); | ||||||
|    |    | ||||||
|   _lia->zero(); |   _lia->zero(); | ||||||
|   _lia->put("CODTAB", y); |   _lia->put("CODTAB", y); | ||||||
|  | |||||||
| @ -618,6 +618,7 @@ void TLiquidazione_app::describe_consistence(const char* codatt) | |||||||
|   TString att = codatt; |   TString att = codatt; | ||||||
| 
 | 
 | ||||||
|   _pla->zero(); |   _pla->zero(); | ||||||
|  |   *_pla_ditta  = get_firm(); | ||||||
|   *_pla_anno   = pryear; |   *_pla_anno   = pryear; | ||||||
|   *_pla_codatt = att; |   *_pla_codatt = att; | ||||||
|    |    | ||||||
|  | |||||||
| @ -41,8 +41,8 @@ HIDDEN int compare_rows(const TObject** o1, const TObject** o2) | |||||||
| 
 | 
 | ||||||
| HIDDEN int compare_fields(const TObject** o1, const TObject** o2) | HIDDEN int compare_fields(const TObject** o1, const TObject** o2) | ||||||
| { | { | ||||||
|   TRigaiva* r1 = (TRigaiva*)*o1; |   const TRigaiva* r1 = (const TRigaiva*)*o1; | ||||||
|   TRigaiva* r2 = (TRigaiva*)*o2; |   const TRigaiva* r2 = (const TRigaiva*)*o2; | ||||||
|   TString16 campo1; |   TString16 campo1; | ||||||
|   TString16 campo2; |   TString16 campo2; | ||||||
|    |    | ||||||
| @ -623,8 +623,7 @@ void TReg_print::build_nomiditte(TProgind* pnd) | |||||||
|     if (good)  |     if (good)  | ||||||
|     {    |     {    | ||||||
|       // check no parametri liquidazione                                               
 |       // check no parametri liquidazione                                               
 | ||||||
|       TApplication::set_firm(dt.get_long("CODDITTA"));    |       if (!look_lia(dt.get_long("CODDITTA"))) good = FALSE;  | ||||||
|       if (!look_lia()) good = FALSE;  |  | ||||||
|     } |     } | ||||||
|     _n_ditte++; |     _n_ditte++; | ||||||
|     TToken_string* d = new TToken_string(64); |     TToken_string* d = new TToken_string(64); | ||||||
| @ -658,8 +657,8 @@ bool TReg_print::user_create() | |||||||
|   _tabinl = new TTable("%INL"); |   _tabinl = new TTable("%INL"); | ||||||
|   _tablim = new TTable("LIM"); |   _tablim = new TTable("LIM"); | ||||||
|   _tabpim = new TTable("PIM"); |   _tabpim = new TTable("PIM"); | ||||||
|   _tablia = new TTable("LIA"); |   _tablia = new TTable("%LIA"); | ||||||
|   _tabpla = new TTable("PLA"); |   _tabpla = new TTable("%PLA"); | ||||||
|   _tabppa = new TTable("PPA"); |   _tabppa = new TTable("PPA"); | ||||||
|   _tabvid = new TTable("VID");  |   _tabvid = new TTable("VID");  | ||||||
|   _clifo  = new TLocalisamfile(LF_CLIFO); |   _clifo  = new TLocalisamfile(LF_CLIFO); | ||||||
| @ -1401,7 +1400,7 @@ void TReg_print::set_page_tot_reg() | |||||||
| 
 | 
 | ||||||
| void TReg_print::stampa_plafonds(int r) | void TReg_print::stampa_plafonds(int r) | ||||||
| { | { | ||||||
|   TTable pla ("PLA");   |   TTable pla ("%PLA");   | ||||||
|   TTable ppa ("PPA");  |   TTable ppa ("PPA");  | ||||||
|   TString80 chiave; |   TString80 chiave; | ||||||
|   int num; |   int num; | ||||||
| @ -1418,8 +1417,7 @@ void TReg_print::stampa_plafonds(int r) | |||||||
|   //char buf[10]; strcpy(buf,_codatt);
 |   //char buf[10]; strcpy(buf,_codatt);
 | ||||||
|   //buf[strlen(buf) - 1] = '1';
 |   //buf[strlen(buf) - 1] = '1';
 | ||||||
|    |    | ||||||
|   chiave = ""; |   chiave = format("%5ld", get_firm()); | ||||||
|   //chiave << _annoes << buf;
 |  | ||||||
|   chiave << _annoes; |   chiave << _annoes; | ||||||
|   chiave << _codatt << "1"; |   chiave << _codatt << "1"; | ||||||
|   pla.put("CODTAB", chiave); |   pla.put("CODTAB", chiave); | ||||||
| @ -2374,9 +2372,9 @@ bool TReg_print::set_print(int n) | |||||||
|   return FALSE; |   return FALSE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool TReg_print::look_lia() | bool TReg_print::look_lia(long firm) | ||||||
| { | { | ||||||
|   TString16 y; y << _annoes; |   TString16 y; y.format("%05ld%04d", firm, _annoes); | ||||||
|    |    | ||||||
|   _tablia->zero(); |   _tablia->zero(); | ||||||
|   _tablia->put("CODTAB", y); |   _tablia->put("CODTAB", y); | ||||||
| @ -2406,8 +2404,7 @@ bool TReg_print::stampa_registri_IVA(const TMask& m) | |||||||
|       _frequiva    = _ditte->row(i).get_char(3); |       _frequiva    = _ditte->row(i).get_char(3); | ||||||
|       _intesta_liq = FALSE;  |       _intesta_liq = FALSE;  | ||||||
|       _stampa_mese = 13; |       _stampa_mese = 13; | ||||||
|       TApplication::set_firm(_ditta); |       look_lia(_ditta);  | ||||||
|       look_lia();  |  | ||||||
|       ok = compila_reg(m);    |       ok = compila_reg(m);    | ||||||
|       if (!ok) continue; |       if (!ok) continue; | ||||||
|       if (_tipo_stampa == 2 || _tipo_stampa == 4) |       if (_tipo_stampa == 2 || _tipo_stampa == 4) | ||||||
|  | |||||||
| @ -84,7 +84,7 @@ protected: | |||||||
|   bool          stampa_totali_finali();      |   bool          stampa_totali_finali();      | ||||||
|   bool          stampa_datareg(); |   bool          stampa_datareg(); | ||||||
|   bool          stampa_registri_IVA(const TMask&); |   bool          stampa_registri_IVA(const TMask&); | ||||||
|   bool          look_lia(); |   bool          look_lia(long firm); | ||||||
|   void          set_choice_limits(TMask&); |   void          set_choice_limits(TMask&); | ||||||
|   void          build_ditte_sheet();  |   void          build_ditte_sheet();  | ||||||
|   void          cerca_reg(const TString&, byte*); |   void          cerca_reg(const TString&, byte*); | ||||||
|  | |||||||
| @ -158,7 +158,7 @@ void CG4500_application::create_files() | |||||||
|   _nditte = new TLocalisamfile(LF_NDITTE); |   _nditte = new TLocalisamfile(LF_NDITTE); | ||||||
|   _esc    = new TTable("ESC"); |   _esc    = new TTable("ESC"); | ||||||
|   _reg    = new TTable("REG"); |   _reg    = new TTable("REG"); | ||||||
|   _lia    = new TTable("LIA");  |   _lia    = new TTable("%LIA");  | ||||||
|   _lbu    = new TTable("%LBU"); |   _lbu    = new TTable("%LBU"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -253,7 +253,7 @@ bool CG4500_application::set() | |||||||
| 
 | 
 | ||||||
| bool CG4500_application::setta() | bool CG4500_application::setta() | ||||||
| { | { | ||||||
|   TTable TabLia ("LIA"); |   TTable TabLia ("%LIA"); | ||||||
|   TLocalisamfile nditte (LF_NDITTE); |   TLocalisamfile nditte (LF_NDITTE); | ||||||
|   TMask m ("cg4500b"); |   TMask m ("cg4500b"); | ||||||
|   KEY tasto; |   KEY tasto; | ||||||
| @ -264,19 +264,19 @@ bool CG4500_application::setta() | |||||||
|   TString anno ( format("%04d", aivap+1) );  |   TString anno ( format("%04d", aivap+1) );  | ||||||
|    |    | ||||||
|   TabLia.zero(); |   TabLia.zero(); | ||||||
|   TabLia.put("CODTAB", anno); |   TabLia.put("CODTAB", format("%05ld%d", get_firm(), anno)); | ||||||
|   if (TabLia.read() == NOERR) |   if (TabLia.read() == NOERR) | ||||||
|     m.set(F_FREQUENZA, TabLia.get("S7")); |     m.set(F_FREQUENZA, TabLia.get("S7")); | ||||||
|   else |   else | ||||||
|   {   |   {   | ||||||
|     TabLia.zero(); |     TabLia.zero(); | ||||||
|     TabLia.put("CODTAB", _annop); |     TabLia.put("CODTAB", format("%05ld%d", get_firm(), _annop)); | ||||||
|     if (TabLia.read() == NOERR) |     if (TabLia.read() == NOERR) | ||||||
|       m.set(F_FREQUENZA, TabLia.get("S7")); |       m.set(F_FREQUENZA, TabLia.get("S7")); | ||||||
|     else |     else | ||||||
|     {       |     {       | ||||||
|       nditte.zero(); |       nditte.zero(); | ||||||
|       nditte.put("CODDITTA", main_app().get_firm()); |       nditte.put("CODDITTA", get_firm()); | ||||||
|       if (nditte.read() == NOERR) |       if (nditte.read() == NOERR) | ||||||
|         m.set(F_FREQUENZA, nditte.get(NDT_FREQVIVA)); |         m.set(F_FREQUENZA, nditte.get(NDT_FREQVIVA)); | ||||||
|     } |     } | ||||||
| @ -399,7 +399,7 @@ bool CG4500_application::apertura_es() | |||||||
| bool CG4500_application::apertura_iva() | bool CG4500_application::apertura_iva() | ||||||
| { | { | ||||||
|   TTable TabReg ("REG");  |   TTable TabReg ("REG");  | ||||||
|   TTable TabLia ("LIA"); |   TTable TabLia ("%LIA"); | ||||||
|   TTable TabLbu ("%LBU"); |   TTable TabLbu ("%LBU"); | ||||||
|   TLocalisamfile nditte (LF_NDITTE); |   TLocalisamfile nditte (LF_NDITTE); | ||||||
|   TDate data; |   TDate data; | ||||||
| @ -525,20 +525,20 @@ bool CG4500_application::apertura_iva() | |||||||
| 
 | 
 | ||||||
|   //viene aggiornata la tabella LIA (liquidazione iva annuale)
 |   //viene aggiornata la tabella LIA (liquidazione iva annuale)
 | ||||||
|   TabLia.zero(); |   TabLia.zero(); | ||||||
|   TabLia.put ("CODTAB", annoiva); |   TabLia.put ("CODTAB", format("%05ld%d", get_firm(), annoiva)); | ||||||
|   if (TabLia.read() == NOERR) |   if (TabLia.read() == NOERR) | ||||||
|     TabLia.remove(); |     TabLia.remove(); | ||||||
|    |    | ||||||
|   ok = FALSE;  |   ok = FALSE;  | ||||||
|   TabLia.zero(); |   TabLia.zero(); | ||||||
|   TRectype newrec (TabLia.curr());    |   TRectype newrec (TabLia.curr());    | ||||||
|   TabLia.put ("CODTAB", _annop); |   TabLia.put ("CODTAB", format("%05ld%d", get_firm(), _annop)); | ||||||
|    |    | ||||||
|   if (TabLia.read() == NOERR) |   if (TabLia.read() == NOERR) | ||||||
|   { |   { | ||||||
|     ok = TRUE; |     ok = TRUE; | ||||||
|     newrec = TabLia.curr(); |     newrec = TabLia.curr(); | ||||||
|     newrec.put("CODTAB", annoiva); |     newrec.put("CODTAB", format("%05ld%d", get_firm(), annoiva)); | ||||||
|     newrec.put("S7", _frequenza); |     newrec.put("S7", _frequenza); | ||||||
|      |      | ||||||
|     TabLia.write(newrec); |     TabLia.write(newrec); | ||||||
|  | |||||||
| @ -14,10 +14,10 @@ | |||||||
| #include <attiv.h> | #include <attiv.h> | ||||||
| #include <nditte.h> | #include <nditte.h> | ||||||
|                                  |                                  | ||||||
| #define TAB_LIA "LIA"                                 | #define TAB_LIA "%LIA"                                 | ||||||
| #define TAB_PLA "PLA"                                 | #define TAB_PLA "%PLA"                                 | ||||||
|                                  |                                  | ||||||
| class CG5300_App : public TRelation_application | class TParaliq_app : public TRelation_application | ||||||
| {  | {  | ||||||
|   TRelation *       _rel; |   TRelation *       _rel; | ||||||
|   TMask *           _msk; |   TMask *           _msk; | ||||||
| @ -25,8 +25,8 @@ class CG5300_App : public TRelation_application | |||||||
|   TLocalisamfile *  _ditte; |   TLocalisamfile *  _ditte; | ||||||
|   int               _yearliq; |   int               _yearliq; | ||||||
|   TTable *          _pla; |   TTable *          _pla; | ||||||
|   TArray            _atts;  // array di stringhe con i codici attivita'
 |   TString_array     _atts;  // array di stringhe con i codici attivita'
 | ||||||
|   TArray            _tips;  // array di stringhe con i tipi attivita'
 |   TString_array     _tips;  // array di stringhe con i tipi attivita'
 | ||||||
|   long              _lastditta; |   long              _lastditta; | ||||||
|   TString16         _freqiva; |   TString16         _freqiva; | ||||||
| 
 | 
 | ||||||
| @ -36,6 +36,7 @@ protected: | |||||||
| 
 | 
 | ||||||
|   virtual bool         user_create(); |   virtual bool         user_create(); | ||||||
|   virtual bool         user_destroy(); |   virtual bool         user_destroy(); | ||||||
|  |   virtual void         on_firm_change(); | ||||||
|    |    | ||||||
|   // minchia di cristo
 |   // minchia di cristo
 | ||||||
|   virtual TRelation*   get_relation() const    { return _rel;  } |   virtual TRelation*   get_relation() const    { return _rel;  } | ||||||
| @ -53,18 +54,17 @@ protected: | |||||||
|   virtual int          write(const TMask& m) { return rewrite(m);} |   virtual int          write(const TMask& m) { return rewrite(m);} | ||||||
|   virtual int          read(TMask& m);   |   virtual int          read(TMask& m);   | ||||||
|    |    | ||||||
|   void init_ditta(TMask&); |  | ||||||
|   // notifier
 |   // notifier
 | ||||||
|   static bool          sheet_action(int r, KEY k); |   static bool          sheet_action(int r, KEY k); | ||||||
|    |    | ||||||
| public: | public: | ||||||
|    |    | ||||||
|   CG5300_App() { _lastditta = 0L;} |   TParaliq_app() { _lastditta = 0L;} | ||||||
|   virtual ~CG5300_App() {}	 |   virtual ~TParaliq_app() {}	 | ||||||
| }; | }; | ||||||
|                                        |                                        | ||||||
| 
 | 
 | ||||||
| void CG5300_App::check_registers(int year) | void TParaliq_app::check_registers(int year) | ||||||
| { | { | ||||||
| 	// controlla che per ogni data attivita' esistano almeno un registro
 | 	// controlla che per ogni data attivita' esistano almeno un registro
 | ||||||
| 	// acquisti, vendite e giornale; warning appropriato in caso negativo 
 | 	// acquisti, vendite e giornale; warning appropriato in caso negativo 
 | ||||||
| @ -76,8 +76,7 @@ void CG5300_App::check_registers(int year) | |||||||
| 	const byte R_ALL = R_ACQ | R_VEN; | 	const byte R_ALL = R_ACQ | R_VEN; | ||||||
| 
 | 
 | ||||||
| 	bool is_giornale = FALSE;        | 	bool is_giornale = FALSE;        | ||||||
| 	 |   byte flags = 0x00;       | ||||||
|     byte flags = 0x00;       |  | ||||||
| 
 | 
 | ||||||
| 	for (int i = 0; i < _atts.items(); i++) | 	for (int i = 0; i < _atts.items(); i++) | ||||||
| 	{ | 	{ | ||||||
| @ -120,25 +119,27 @@ void CG5300_App::check_registers(int year) | |||||||
| }                                       | }                                       | ||||||
|                                             |                                             | ||||||
| 
 | 
 | ||||||
| void CG5300_App::init_ditta(TMask& m) | void TParaliq_app::on_firm_change() | ||||||
| {      | {      | ||||||
|   // qui per evitare casini da cambio ditta
 |  | ||||||
|   const long newditta = get_firm(); |   const long newditta = get_firm(); | ||||||
| 
 | 
 | ||||||
|   if (newditta != _lastditta) |   if (newditta != _lastditta) | ||||||
|   { |   { | ||||||
|     _lastditta = newditta; |     _lastditta = newditta; | ||||||
|     _atts.destroy();  |     _atts.destroy();  | ||||||
|  |     _tips.destroy(); | ||||||
|  |      | ||||||
|     _attiv->zero(); |     _attiv->zero(); | ||||||
|     _attiv->put(ATT_CODDITTA, m.get(F_CODDITTA)); |     _attiv->put(ATT_CODDITTA, newditta); | ||||||
|     TRectype r(_attiv->curr()); |     TRectype r(_attiv->curr()); | ||||||
| 
 | 
 | ||||||
|     for(_attiv->read(_isgteq); _attiv->status() == NOERR && _attiv->curr() == r;  |     for(_attiv->read(_isgteq);  | ||||||
| 	_attiv->next()) |         _attiv->status() == NOERR && _attiv->curr() == r;  | ||||||
|  | 	      _attiv->next()) | ||||||
|     { |     { | ||||||
|       // istanzia array _atts on le attivita' della ditta corrente
 |       // istanzia array _atts on le attivita' della ditta corrente
 | ||||||
|       _atts.add(new TString(_attiv->get(ATT_CODATT))); |       _atts.add(_attiv->get(ATT_CODATT)); | ||||||
|       _tips.add(new TString(_attiv->get(ATT_TIPOATT))); |       _tips.add(_attiv->get(ATT_TIPOATT)); | ||||||
|     } |     } | ||||||
|     _ditte->put(NDT_CODDITTA, _lastditta); |     _ditte->put(NDT_CODDITTA, _lastditta); | ||||||
|     if (_ditte->read() == NOERR) |     if (_ditte->read() == NOERR) | ||||||
| @ -148,7 +149,7 @@ void CG5300_App::init_ditta(TMask& m) | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool CG5300_App::user_create() | bool TParaliq_app::user_create() | ||||||
| { | { | ||||||
|   TConfig d(CONFIG_DITTA); |   TConfig d(CONFIG_DITTA); | ||||||
|    |    | ||||||
| @ -163,7 +164,7 @@ bool CG5300_App::user_create() | |||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool CG5300_App::user_destroy()   | bool TParaliq_app::user_destroy()   | ||||||
| {                | {                | ||||||
|   delete _rel; |   delete _rel; | ||||||
|   delete _attiv; |   delete _attiv; | ||||||
| @ -173,21 +174,20 @@ bool CG5300_App::user_destroy() | |||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool CG5300_App::sheet_action(int r, KEY k)   | bool TParaliq_app::sheet_action(int r, KEY k)   | ||||||
| {                     | {                     | ||||||
|   // non si possono cancellare o aggiungere righe in PLA
 |   // non si possono cancellare o aggiungere righe in PLA
 | ||||||
|   return (k != K_DEL && k != K_INS); |   return (k != K_DEL && k != K_INS); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void  CG5300_App::init_query_mode(TMask& m) | void  TParaliq_app::init_query_mode(TMask& m) | ||||||
| { | { | ||||||
|   // svuota tutto
 |   // svuota tutto
 | ||||||
|   TSheet_field& sh = (TSheet_field&)m.field(F_SHEET_PLA); |   TSheet_field& sh = (TSheet_field&)m.field(F_SHEET_PLA); | ||||||
|   sh.reset(); |   sh.reset(); | ||||||
|   init_ditta(m); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void  CG5300_App::init_insert_mode(TMask& m) | void  TParaliq_app::init_insert_mode(TMask& m) | ||||||
| { | { | ||||||
|   TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); |   TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); | ||||||
|   TToken_string tt(60); |   TToken_string tt(60); | ||||||
| @ -196,8 +196,8 @@ void  CG5300_App::init_insert_mode(TMask& m) | |||||||
| 
 | 
 | ||||||
|   for (int i = 0; i < _atts.items(); i++) |   for (int i = 0; i < _atts.items(); i++) | ||||||
|   { |   { | ||||||
|     TString& att = (TString&)_atts[i]; |     TString& att  = _atts.row(i); | ||||||
|     TString& tips = (TString&)_tips[i]; |     TString& tips = _tips.row(i); | ||||||
| 
 | 
 | ||||||
|     // cerca l'attivita' in pla   
 |     // cerca l'attivita' in pla   
 | ||||||
|     tt = "";     |     tt = "";     | ||||||
| @ -211,15 +211,15 @@ void  CG5300_App::init_insert_mode(TMask& m) | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int CG5300_App::rewrite(const TMask& m) | int TParaliq_app::rewrite(const TMask& m) | ||||||
| {                   | {                   | ||||||
|   // scrive LIA
 |   // scrive %LIA
 | ||||||
|   // scrive tutte le righe di PLA a partire dalle righe sheet  
 |   // scrive tutte le righe di %PLA a partire dalle righe sheet  
 | ||||||
|   static int oldyear; |   static int oldyear; | ||||||
|    |    | ||||||
|   TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); |   TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); | ||||||
|   const TString16 year(m.get(F_YEAR)); |   const long firm = m.get_long(F_CODDITTA); | ||||||
|   int yr = atoi(year); |   const int year = m.get_int(F_YEAR); | ||||||
|    |    | ||||||
|   int err = NOERR; |   int err = NOERR; | ||||||
| 	bool was = FALSE; | 	bool was = FALSE; | ||||||
| @ -229,9 +229,10 @@ int CG5300_App::rewrite(const TMask& m) | |||||||
|     TToken_string&  tt = sf.row(i); |     TToken_string&  tt = sf.row(i); | ||||||
|     const TString&  att = (TString&) _atts[i]; |     const TString&  att = (TString&) _atts[i]; | ||||||
|     const TString16 tips(tt.get(1)); |     const TString16 tips(tt.get(1)); | ||||||
|  |     const TString16 codtab(format("%05ld%4d%s1", firm, year, (const char *)att)); | ||||||
|      |      | ||||||
|     _pla->zero(); |     _pla->zero(); | ||||||
|     _pla->put("CODTAB", format("%s%s1", (const char *) year, (const char *) att)); |     _pla->put("CODTAB", codtab); | ||||||
|      was =_pla->read() == NOERR;  |      was =_pla->read() == NOERR;  | ||||||
|      if (!was) _pla->zero(); |      if (!was) _pla->zero(); | ||||||
|       |       | ||||||
| @ -240,7 +241,7 @@ int CG5300_App::rewrite(const TMask& m) | |||||||
|      real es_a8b  = _pla->get_real("R6"); |      real es_a8b  = _pla->get_real("R6"); | ||||||
|      real es_a9   = _pla->get_real("R7"); |      real es_a9   = _pla->get_real("R7"); | ||||||
|      |      | ||||||
|     _pla->put("CODTAB", format("%s%s1", (const char *) year, (const char *) att)); |     _pla->put("CODTAB", codtab); | ||||||
|     // scrive i campi (vedi a read() per i nomi) 
 |     // scrive i campi (vedi a read() per i nomi) 
 | ||||||
|     // in base alla riga sheet	
 |     // in base alla riga sheet	
 | ||||||
|     _pla->put("S7", tips);         // tipo attivita'
 |     _pla->put("S7", tips);         // tipo attivita'
 | ||||||
| @ -257,7 +258,7 @@ int CG5300_App::rewrite(const TMask& m) | |||||||
|      	es_a8b  != _pla->get_real("R6") || |      	es_a8b  != _pla->get_real("R6") || | ||||||
|      	es_a9   != _pla->get_real("R7") || |      	es_a9   != _pla->get_real("R7") || | ||||||
|      	m.field(F_CRED_PREC).dirty()) |      	m.field(F_CRED_PREC).dirty()) | ||||||
|      { |     { | ||||||
|      	// invalida la prima liquidazione calcolata se ce n'e'
 |      	// invalida la prima liquidazione calcolata se ce n'e'
 | ||||||
|      	TTable lim("LIM"); |      	TTable lim("LIM"); | ||||||
| 
 | 
 | ||||||
| @ -265,27 +266,24 @@ int CG5300_App::rewrite(const TMask& m) | |||||||
| 
 | 
 | ||||||
|      	for (lim.first(); !lim.eof(); lim.next()) |      	for (lim.first(); !lim.eof(); lim.next()) | ||||||
|      	{ |      	{ | ||||||
|      		if (yr == atoi(lim_anno)) |      		if (year == atoi(lim_anno)) | ||||||
|      		{ |      		{ | ||||||
|      			lim.put("B0",""); |      			lim.put("B0",""); | ||||||
|      			lim.rewrite(); |      			lim.rewrite(); | ||||||
|      			break; |      			break; | ||||||
|      		} |      		} | ||||||
|      	} |      	} | ||||||
|      } |     } | ||||||
| 
 |  | ||||||
|   } |   } | ||||||
|   TTable & lia = (TTable&)_rel->lfile(); |  | ||||||
|    |    | ||||||
|   lia.zero(); |   TTable& lia = (TTable&)_rel->lfile(); | ||||||
|   lia.put("CODTAB", year); |   lia.put("CODTAB", format("%05ld%d", firm, year)); | ||||||
|   was = lia.read() == NOERR; |   was = lia.read() == NOERR; | ||||||
|   if (!was) lia.zero(); |   if (!was) lia.zero(); | ||||||
|   m.autosave(get_relation()); |   m.autosave(_rel); | ||||||
|   if (err == NOERR) err = (was ? lia.rewrite() : lia.write()); |   if (err == NOERR) err = (was ? lia.rewrite() : lia.write()); | ||||||
|   if (err == NOERR && year == _yearliq)  |   if (err == NOERR && year == _yearliq)  | ||||||
|   { |   { | ||||||
|     _ditte->zero(); |  | ||||||
|     _ditte->put(NDT_CODDITTA, _lastditta); |     _ditte->put(NDT_CODDITTA, _lastditta); | ||||||
|     if (_ditte->read() == NOERR) |     if (_ditte->read() == NOERR) | ||||||
|     { |     { | ||||||
| @ -296,14 +294,14 @@ int CG5300_App::rewrite(const TMask& m) | |||||||
|                 |                 | ||||||
|   // per ogni anno liquidazione controlla (una volta) l'esistenza
 |   // per ogni anno liquidazione controlla (una volta) l'esistenza
 | ||||||
|   // dei registri fondamentali
 |   // dei registri fondamentali
 | ||||||
|   if (yr != oldyear && err == NOERR) |   if (year != oldyear && err == NOERR) | ||||||
|   	 check_registers(yr); |   	 check_registers(year); | ||||||
|   oldyear = yr; |   oldyear = year; | ||||||
|    |    | ||||||
|   return err; |   return err; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int   CG5300_App::read(TMask& m) | int   TParaliq_app::read(TMask& m) | ||||||
| { | { | ||||||
|   // legge da LIA (si istanziano i campi credito prec. e Freq. Vers
 |   // legge da LIA (si istanziano i campi credito prec. e Freq. Vers
 | ||||||
|   // prende le attivita' una per una da _atts e 
 |   // prende le attivita' una per una da _atts e 
 | ||||||
| @ -311,7 +309,8 @@ int   CG5300_App::read(TMask& m) | |||||||
|   m.autoload(get_relation());  |   m.autoload(get_relation());  | ||||||
|   TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); |   TSheet_field& sf = (TSheet_field&)m.field(F_SHEET_PLA); | ||||||
|   TToken_string tt(60); |   TToken_string tt(60); | ||||||
|   const TString16 year(m.get(F_YEAR)); |   const long firm = get_firm(); | ||||||
|  |   const int year = m.get_int(F_YEAR); | ||||||
|    |    | ||||||
|   sf.reset(); |   sf.reset(); | ||||||
|   for (int i = 0; i < _atts.items(); i++) |   for (int i = 0; i < _atts.items(); i++) | ||||||
| @ -320,8 +319,7 @@ int   CG5300_App::read(TMask& m) | |||||||
| 
 | 
 | ||||||
|     // cerca l'attivita' in pla   
 |     // cerca l'attivita' in pla   
 | ||||||
|     _pla->zero(); |     _pla->zero(); | ||||||
|     _pla->put("CODTAB", format("%s%s1", (const char *) year,  |     _pla->put("CODTAB", format("%05ld%d%s1", firm, year, (const char *) att)); | ||||||
|     	                       (const char *) att)); |  | ||||||
|     tt = "";     |     tt = "";     | ||||||
|     tt.add(att); |     tt.add(att); | ||||||
|     if (_pla->read() == NOERR) |     if (_pla->read() == NOERR) | ||||||
| @ -349,7 +347,7 @@ int   CG5300_App::read(TMask& m) | |||||||
| 
 | 
 | ||||||
| int cg5300(int argc, char* argv[]) | int cg5300(int argc, char* argv[]) | ||||||
| { | { | ||||||
|   CG5300_App a; |   TParaliq_app a; | ||||||
|   a.run(argc, argv, "Parametri liquidazione"); |   a.run(argc, argv, "Parametri liquidazione"); | ||||||
|   return 0; |   return 0; | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| #include "cg5300a.h" | #include "cg5300a.h" | ||||||
|  | 
 | ||||||
| TOOLBAR "" 0 20 0 2 | TOOLBAR "" 0 20 0 2 | ||||||
| 
 | 
 | ||||||
| #include <toolbar.h> | #include <toolbar.h> | ||||||
| @ -7,16 +8,17 @@ ENDPAGE | |||||||
| 
 | 
 | ||||||
| PAGE "Parametri liquidazione" -1 -1 78 15 | PAGE "Parametri liquidazione" -1 -1 78 15 | ||||||
| 
 | 
 | ||||||
| GROUPBOX DLG_NULL 71 3 | GROUPBOX DLG_NULL 75 4 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 4 0 "Ditta" |   PROMPT 2 0 "Ditta" | ||||||
|   FLAGS "R" |   FLAGS "R" | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| NUMBER F_CODDITTA 5 | NUMBER F_CODDITTA 5 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 6 1 "Codice " |   PROMPT 4 1 "Codice " | ||||||
|   FLAGS "DFGR" |   FLAGS "FZ" | ||||||
|  |   FIELD CODTAB[1,5] | ||||||
|   USE LF_NDITTE |   USE LF_NDITTE | ||||||
|   INPUT CODDITTA F_CODDITTA |   INPUT CODDITTA F_CODDITTA | ||||||
|   DISPLAY "Codice" CODDITTA |   DISPLAY "Codice" CODDITTA | ||||||
| @ -24,49 +26,54 @@ BEGIN | |||||||
|   OUTPUT F_CODDITTA CODDITTA |   OUTPUT F_CODDITTA CODDITTA | ||||||
|   OUTPUT F_RAGSOC RAGSOC |   OUTPUT F_RAGSOC RAGSOC | ||||||
|   CHECKTYPE REQUIRED |   CHECKTYPE REQUIRED | ||||||
|  |   KEY 1 | ||||||
| END  | END  | ||||||
| 
 | 
 | ||||||
| STRING F_RAGSOC 50 | STRING F_RAGSOC 50 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 20 1 "" |   PROMPT 20 1 "" | ||||||
|   FLAGS "D" |   USE LF_NDITTE KEY 2 | ||||||
|  |   INPUT RAGSOC F_RAGSOC | ||||||
|  |   DISPLAY "Ragione Sociale@50" RAGSOC | ||||||
|  |   DISPLAY "Codice" CODDITTA | ||||||
|  |   COPY OUTPUT F_CODDITTA | ||||||
|  |   CHECKTYPE REQUIRED | ||||||
| END  | END  | ||||||
| 
 | 
 | ||||||
| NUMBER F_YEAR 4 | NUMBER F_YEAR 4 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 6 3 "Anno                  " |   PROMPT 4 2 "Anno   " | ||||||
|   HELP "Anno d'esercizio" |   FIELD CODTAB[6,9] | ||||||
|   FIELD LIA->CODTAB |   USE %LIA | ||||||
|   USE LIA |   INPUT CODTAB[1,5] F_CODDITTA | ||||||
|   INPUT CODTAB F_YEAR |   INPUT CODTAB[6,9] F_YEAR | ||||||
|   DISPLAY "Anno@40" CODTAB |   DISPLAY "Codice Ditta" CODTAB[1,5] | ||||||
|   DISPLAY "@2" S0 |   DISPLAY "Anno IVA" CODTAB[6,9] | ||||||
|   OUTPUT F_YEAR CODTAB |   OUTPUT F_YEAR CODTAB[6,9] | ||||||
|   KEY 1  |   KEY 1  | ||||||
|   FLAGS "Z" |  | ||||||
|   CHECKTYPE REQUIRED |   CHECKTYPE REQUIRED | ||||||
|   ADD NONE       |   ADD NONE       | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| GROUPBOX DLG_NULL 71 5 | GROUPBOX DLG_NULL 75 5 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 4 4 "Parametri ditta" |   PROMPT 2 4 "Parametri ditta" | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| LIST F_FREQ_VERS 1 14 | LIST F_FREQ_VERS 1 14 | ||||||
| BEGIN  | BEGIN  | ||||||
|   PROMPT 6 5 "Frequenza versamenti  " |   PROMPT 4 5 "Frequenza versamenti  " | ||||||
|   HELP "Indicare la frequenza dei versamenti delle liquidazioni IVA" |   HELP "Indicare la frequenza dei versamenti delle liquidazioni IVA" | ||||||
|   ITEM "M|Mensile" |   ITEM "M|Mensile" | ||||||
|   ITEM "T|Trimestrale" |   ITEM "T|Trimestrale" | ||||||
|   FIELD LIA->S7 |   FIELD S7 | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| NUMBER F_CRED_PREC 15 | NUMBER F_CRED_PREC 15 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 6 6 "Credito precedente    " |   PROMPT 4 6 "Credito precedente    " | ||||||
|   HELP "Eventuale credito di imposta dell'anno precedente" |   HELP "Eventuale credito di imposta dell'anno precedente" | ||||||
|   FIELD LIA->R0 |   FIELD R0 | ||||||
|   PICTURE  "." |   PICTURE  "." | ||||||
|   FLAGS "R" |   FLAGS "R" | ||||||
|   NUM_CALC ROUND(#THIS_FIELD,-3) |   NUM_CALC ROUND(#THIS_FIELD,-3) | ||||||
| @ -74,9 +81,9 @@ END | |||||||
| 
 | 
 | ||||||
| NUMBER F_CRED_COST 15 | NUMBER F_CRED_COST 15 | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 6 7 "Credito di costo      " |   PROMPT 4 7 "Credito di costo      " | ||||||
|   HELP "Eventuale credito di costo dell'anno precedente" |   HELP "Eventuale credito di costo dell'anno precedente" | ||||||
|   FIELD LIA->R5 |   FIELD R5 | ||||||
|   PICTURE  "." |   PICTURE  "." | ||||||
|   FLAGS "R" |   FLAGS "R" | ||||||
|   NUM_CALC ROUND(#THIS_FIELD,-3) |   NUM_CALC ROUND(#THIS_FIELD,-3) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user