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