Corretti errori liquidazione relativi a:
- liquidazioni trimestrali (interfaccia e calcolo) - periodo di calcolo git-svn-id: svn://10.65.10.50/trunk@489 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									91709b3849
								
							
						
					
					
						commit
						5ca5c84738
					
				| @ -25,22 +25,12 @@ void CG4300_App::user_create() | |||||||
| 
 | 
 | ||||||
|   _ditte  = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte", |   _ditte  = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte", | ||||||
|                              "@1|Cod.@5|Ragione Sociale@50|Vers."); |                              "@1|Cod.@5|Ragione Sociale@50|Vers."); | ||||||
|   _n_ditte = 0l; |   _n_ditte = 0l;     | ||||||
| 
 |    | ||||||
|   pnd.addstatus(1); |   // prevediamo la data che usera'; se calcola la liq. di un altro anno
 | ||||||
| 
 |   // si fottera' la frequenza versamenti
 | ||||||
|   for (_nditte->first(); !_nditte->eof(); _nditte->next()) |   TDate oggi(TODAY);                     | ||||||
|   { |   _year.format("%d",oggi.year()); | ||||||
|     _n_ditte++; |  | ||||||
| 
 |  | ||||||
|     TToken_string* d = new TToken_string(64); |  | ||||||
|      |  | ||||||
|     // add record 
 |  | ||||||
|     d->add(_nditte_r->get("CODDITTA")); |  | ||||||
|     d->add(_nditte_r->get("RAGSOC")); |  | ||||||
|     d->add(_nditte_r->get("FREQVIVA")); |  | ||||||
|     _nomiditte.add(d); |  | ||||||
|   } |  | ||||||
| 
 | 
 | ||||||
|   pnd.addstatus(1); |   pnd.addstatus(1); | ||||||
|    |    | ||||||
| @ -48,7 +38,7 @@ void CG4300_App::user_create() | |||||||
|   _rel->add(LF_RMOVIVA,"NUMREG=NUMREG"); |   _rel->add(LF_RMOVIVA,"NUMREG=NUMREG"); | ||||||
| 
 | 
 | ||||||
|   _cur = new TCursor(_rel, "", 2); |   _cur = new TCursor(_rel, "", 2); | ||||||
|   (*_cur) = 0; |   //  (*_cur) = 0;
 | ||||||
| 
 | 
 | ||||||
|   _pim        = new TTable("PIM"); |   _pim        = new TTable("PIM"); | ||||||
|   _ppa        = new TTable("PPA");  |   _ppa        = new TTable("PPA");  | ||||||
| @ -106,6 +96,25 @@ void CG4300_App::user_create() | |||||||
|   _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); | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  |   pnd.addstatus(1); | ||||||
|  | 
 | ||||||
|  |   for (_nditte->first(); !_nditte->eof(); _nditte->next()) | ||||||
|  |   { | ||||||
|  |     if (!(TApplication::set_firm(_nditte_r->get_long("CODDITTA")))) | ||||||
|  |       continue;  | ||||||
|  |      | ||||||
|  |     _n_ditte++; | ||||||
|  |      | ||||||
|  |     TToken_string* d = new TToken_string(64); | ||||||
|  |      | ||||||
|  |     // add record 
 | ||||||
|  |     d->add(_nditte_r->get("CODDITTA")); | ||||||
|  |     d->add(_nditte_r->get("RAGSOC")); | ||||||
|  |     d->add(look_lia() ? _lia->get("S7") : _nditte_r->get("FREQVIVA")); | ||||||
|  |     _nomiditte.add(d); | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   pnd.addstatus(1); |   pnd.addstatus(1); | ||||||
|   set_real_picture(REAL_PICTURE); |   set_real_picture(REAL_PICTURE); | ||||||
| } | } | ||||||
| @ -164,17 +173,11 @@ bool CG4300_App::set_print(int n) | |||||||
|     { |     { | ||||||
|       if (_selected.ones() > 0l) |       if (_selected.ones() > 0l) | ||||||
|       { |       { | ||||||
|         /*        if (_year != yy) 
 |  | ||||||
|                   { |  | ||||||
|                   TString cond(format("ANNOES=%s",(const char*)_year)); |  | ||||||
|                   _cur->setfilter(cond); |  | ||||||
|                   }*/ |  | ||||||
|         TRectype& mov = _cur->curr(); |         TRectype& mov = _cur->curr(); | ||||||
|         TRectype  from(_cur->curr()); from.zero(); |         TRectype  from(_cur->curr()); from.zero(); | ||||||
|         TRectype  to(mov); |         TRectype  to(from); | ||||||
|         TDate f(1, 1, atoi(_year)); |         TDate f(1, 1, atoi(_year)); | ||||||
|         TDate t(1, _month, atoi(_year)); |         TDate t(1, _month, atoi(_year)); | ||||||
| 
 |  | ||||||
|         t.set_end_month(); |         t.set_end_month(); | ||||||
|         from.put(MOV_DATAREG, f); |         from.put(MOV_DATAREG, f); | ||||||
|         to.put(MOV_DATAREG, t); |         to.put(MOV_DATAREG, t); | ||||||
| @ -191,21 +194,15 @@ bool CG4300_App::set_print(int n) | |||||||
|     {  |     {  | ||||||
|       if (_calcall || _selected.ones() > 0l) |       if (_calcall || _selected.ones() > 0l) | ||||||
|       { |       { | ||||||
|         /*      if (_year != yy) 
 |  | ||||||
|                 { |  | ||||||
|                 TString cond(format("ANNOES=%s",(const char*)_year)); |  | ||||||
|                 _cur->setfilter(cond); |  | ||||||
|                 } */ |  | ||||||
|         TRectype & mov = _cur->curr(); |         TRectype & mov = _cur->curr(); | ||||||
|         TRectype from(_cur->curr()); from.zero(); |         TRectype from(_cur->curr()); from.zero(); | ||||||
|         TRectype to(mov); |         TRectype to(from); | ||||||
|         TDate f(1, _recalc == one ? _month : 1, atoi(_year)); |         TDate f(1, _recalc == one ? _month : 1, atoi(_year)); | ||||||
|         TDate t(1, _month, atoi(_year)); |         TDate t(1, _month, atoi(_year)); | ||||||
|          |  | ||||||
|         t.set_end_month(); |         t.set_end_month(); | ||||||
|         from.put(MOV_DATAREG, f); |         from.put(MOV_DATAREG, f); | ||||||
|         to.put(MOV_DATAREG, t); |         to.put(MOV_DATAREG, t); | ||||||
|         _cur->setregion(from, to); |         _cur->setregion(from, to);   | ||||||
|         extract_deleghe();  |         extract_deleghe();  | ||||||
|         return FALSE; |         return FALSE; | ||||||
|       }  |       }  | ||||||
| @ -218,21 +215,15 @@ bool CG4300_App::set_print(int n) | |||||||
|     {  |     {  | ||||||
|       if (_calcall || _selected.ones() > 0l) |       if (_calcall || _selected.ones() > 0l) | ||||||
|       { |       { | ||||||
|         /*     if (_year != yy) 
 |  | ||||||
|                { |  | ||||||
|                TString cond(format("ANNOES=%s",(const char*)_year)); |  | ||||||
|                _cur->setfilter(cond); |  | ||||||
|                }*/ |  | ||||||
|         TRectype & mov = _cur->curr(); |         TRectype & mov = _cur->curr(); | ||||||
|         TRectype from(_cur->curr()); from.zero(); |         TRectype from(_cur->curr()); from.zero(); | ||||||
|         TRectype to(mov);  |         TRectype to(from);  | ||||||
|         TDate f(1, _recalc == one ? _month : 1, atoi(_year)); |         TDate f(1, _recalc == one ? _month : 1, atoi(_year)); | ||||||
|         TDate t(1, _month, atoi(_year)); |         TDate t(1, _month, atoi(_year)); | ||||||
|          |  | ||||||
|         t.set_end_month(); |         t.set_end_month(); | ||||||
|         from.put(MOV_DATAREG, f); |         from.put(MOV_DATAREG, f); | ||||||
|         to.put(MOV_DATAREG, t); |         to.put(MOV_DATAREG, t); | ||||||
|         _cur->setregion(from, to); |         _cur->setregion(from, to);  | ||||||
|         recalc_acconti();  |         recalc_acconti();  | ||||||
|         return _isprint;  |         return _isprint;  | ||||||
|       }  |       }  | ||||||
|  | |||||||
| @ -108,7 +108,9 @@ bool CG4300_App::update_firm(int month, bool recalc) | |||||||
|       TString80 desatt = _nditte->curr(LF_ATTIV).get("DESCR"); |       TString80 desatt = _nditte->curr(LF_ATTIV).get("DESCR"); | ||||||
|        |        | ||||||
|       // attivita' mista: ce ne sono in realta' due
 |       // attivita' mista: ce ne sono in realta' due
 | ||||||
|       _mixed     = _nditte->curr().get_bool("FLIVA11Q"); |       // viene calcolato nel ciclo su tipoatt (che viene ripetuto solo
 | ||||||
|  |       // se diventa TRUE);
 | ||||||
|  |       _mixed     = FALSE; | ||||||
|        |        | ||||||
|       sprintf (buf,"Calcolo liquidazioni (%d)...\n%s: %s", |       sprintf (buf,"Calcolo liquidazioni (%d)...\n%s: %s", | ||||||
|                month, |                month, | ||||||
| @ -134,6 +136,7 @@ bool CG4300_App::update_firm(int month, bool recalc) | |||||||
|           _isplafond   = !(_p8.is_zero() && _p8b.is_zero() &&  |           _isplafond   = !(_p8.is_zero() && _p8b.is_zero() &&  | ||||||
|                            _p9.is_zero()); |                            _p9.is_zero()); | ||||||
|           _isservizio  = _pla->get("S7") == "S"; |           _isservizio  = _pla->get("S7") == "S"; | ||||||
|  |           _mixed       = _pla->get("S7") == "M" || _pla->get("S7") == "E"; | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|           _isservizio  = _nditte->curr(LF_ATTIV).get("TIPOATT") == "S"; |           _isservizio  = _nditte->curr(LF_ATTIV).get("TIPOATT") == "S"; | ||||||
| @ -145,7 +148,6 @@ bool CG4300_App::update_firm(int month, bool recalc) | |||||||
|         _isannual    = (_month == 12 && !mens && !_isbenzinaro) ||  |         _isannual    = (_month == 12 && !mens && !_isbenzinaro) ||  | ||||||
|           (_month == 13 && (mens || _isbenzinaro)); |           (_month == 13 && (mens || _isbenzinaro)); | ||||||
|         _isriepilogo = _month == 13; |         _isriepilogo = _month == 13; | ||||||
|         //        _isvent      = _pla->get_bool("B0");
 |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         for (_reg->first(); !_isvent && _reg->good(); _reg->next()) |         for (_reg->first(); !_isvent && _reg->good(); _reg->next()) | ||||||
|  | |||||||
| @ -16,21 +16,21 @@ bool CG4300_App::is_month_ok(int x, int month) | |||||||
|      // di liquidazione e (opz) non e' maggiore di quello scelto
 |      // di liquidazione e (opz) non e' maggiore di quello scelto
 | ||||||
| {  | {  | ||||||
|   if (month == -1) month = x; |   if (month == -1) month = x; | ||||||
|   return _nditte_r->get("FREQVIVA") == "M" ?  |   return _freqviva == "M" ?  | ||||||
|     ( x > 0 && x <= month) : |     ( x > 0 && x <= month) : | ||||||
|     ( x <= month && is_trim(x)); |     ( x <= month && is_trim(x)); | ||||||
| }  | }  | ||||||
| 
 | 
 | ||||||
| bool CG4300_App::is_first_month(int m) | bool CG4300_App::is_first_month(int m) | ||||||
| { | { | ||||||
|   return _nditte_r->get("FREQVIVA") == "M" ?  |   return _freqviva == "M" ?  | ||||||
|     m == 1 : m == 3; |     m == 1 : m == 3; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int CG4300_App::previous_month(int m) | int CG4300_App::previous_month(int m) | ||||||
| { | { | ||||||
|   if (m == 13) m = 12; |   if (m == 13) m = 12; | ||||||
|   if (_nditte_r->get("FREQVIVA") == "M") |   if (_freqviva == "M") | ||||||
|     return m == 1 ? 1 : m - 1; |     return m == 1 ? 1 : m - 1; | ||||||
|   else return m == 3 ? 3 : m - 3; |   else return m == 3 ? 3 : m - 3; | ||||||
| } | } | ||||||
| @ -51,7 +51,7 @@ bool CG4300_App::is_date_ok(TDate& d, int month) | |||||||
| { | { | ||||||
|   if (d.month() > month || d.year() != atoi(_year)) |   if (d.month() > month || d.year() != atoi(_year)) | ||||||
|     return FALSE; |     return FALSE; | ||||||
|   return _nditte_r->get("FREQVIVA") == "M" ?  |   return _freqviva == "M" ?  | ||||||
|     (d.month() == month): |     (d.month() == month): | ||||||
|   ((month - d.month()) >= 0 &&   |   ((month - d.month()) >= 0 &&   | ||||||
|    (month - d.month()) < 3); |    (month - d.month()) < 3); | ||||||
| @ -331,7 +331,7 @@ bool CG4300_App::look_lia(bool create, int year) | |||||||
|   { |   { | ||||||
|     _lia->zero(); |     _lia->zero(); | ||||||
|     _lia->put("CODTAB", y); |     _lia->put("CODTAB", y); | ||||||
|     _lia->put("S7", _nditte->curr().get("FREQVIVA")); |     _lia->put("S7", _freqviva); | ||||||
| 		_lia->write(); | 		_lia->write(); | ||||||
| 	} | 	} | ||||||
| 	return ok; | 	return ok; | ||||||
|  | |||||||
| @ -94,7 +94,7 @@ void CG4300_App::describe_name(int month, TToken_string& codatts) | |||||||
|   d->_s1 = _nditte->curr().get("RAGSOC"); |   d->_s1 = _nditte->curr().get("RAGSOC"); | ||||||
|   d->_s2 = _nditte->curr(LF_ATTIV).get("CODATT"); |   d->_s2 = _nditte->curr(LF_ATTIV).get("CODATT"); | ||||||
|   d->_s3 = codatts.items() == 1 ? (const char*)_nditte->curr(LF_ATTIV).get("DESCR")  : ""; |   d->_s3 = codatts.items() == 1 ? (const char*)_nditte->curr(LF_ATTIV).get("DESCR")  : ""; | ||||||
|   d->_s4 = _nditte->curr().get("FREQVIVA"); |   d->_s4 = _freqviva; | ||||||
|    |    | ||||||
|   d->_f1 = month; |   d->_f1 = month; | ||||||
|   d->_f2 = _isbenzinaro; |   d->_f2 = _isbenzinaro; | ||||||
| @ -113,7 +113,7 @@ void CG4300_App::describe_firm(int month) | |||||||
| 
 | 
 | ||||||
|   d->_s0 = _nditte->curr().get("CODDITTA"); |   d->_s0 = _nditte->curr().get("CODDITTA"); | ||||||
|   d->_s1 = _nditte->curr().get("RAGSOC"); |   d->_s1 = _nditte->curr().get("RAGSOC"); | ||||||
|   d->_s2 = _nditte->curr().get("FREQVIVA"); |   d->_s2 = _freqviva; | ||||||
|   d->_f1 = month; |   d->_f1 = month; | ||||||
|   _descr_arr.add(d); |   _descr_arr.add(d); | ||||||
| } | } | ||||||
| @ -479,7 +479,7 @@ void CG4300_App::describe_liq(int month, const char* codatts, _DescrItem* di) | |||||||
|   else  |   else  | ||||||
|     d->_r6 += _lim->get_real("R5"); // rettifiche a credito
 |     d->_r6 += _lim->get_real("R5"); // rettifiche a credito
 | ||||||
|    |    | ||||||
|   d->_f0 = _nditte->curr().get("FREQVIVA") == "T"; |   d->_f0 = _freqviva == "T"; | ||||||
|    |    | ||||||
|   // r7 = credito precedente    
 |   // r7 = credito precedente    
 | ||||||
|   d->_r7 = credito_prec(month); |   d->_r7 = credito_prec(month); | ||||||
| @ -616,7 +616,7 @@ void CG4300_App::set_att(_DescrItem& d) | |||||||
|   else |   else | ||||||
|   { |   { | ||||||
|     if (d._s4 == "T") |     if (d._s4 == "T") | ||||||
|       tim_title << format(" del %dx Trimestre %s", d._f1/3, (const char *) _year); |       tim_title << format(" del %do Trimestre %s", d._f1/3, (const char *) _year); | ||||||
|     else |     else | ||||||
|       tim_title << format(" del mese di %s %s", itom(d._f1),  |       tim_title << format(" del mese di %s %s", itom(d._f1),  | ||||||
|                           (const char*)_year);  |                           (const char*)_year);  | ||||||
| @ -671,21 +671,21 @@ void CG4300_App::set_plafond(_DescrItem& d) | |||||||
|           "MENSILE DEI PLAFOND"); |           "MENSILE DEI PLAFOND"); | ||||||
| 
 | 
 | ||||||
|   set_row(2,""); set_row(3,""); |   set_row(2,""); set_row(3,""); | ||||||
|   set_row(4,"Art. 8 1@ix@rcomma lettere a-b@31gDisponibile@48g%r", |   set_row(4,"Art. 8 1@io@rcomma lettere a-b@31gDisponibile@48g%r", | ||||||
|           &r1); |           &r1); | ||||||
|   set_row(5,"Utilizzato all'interno@48g%r", &(d._r0)); |   set_row(5,"Utilizzato all'interno@48g%r", &(d._r0)); | ||||||
|   set_row(6,"Utilizzato per l'importazione@48g%r@69gRiporto %r", |   set_row(6,"Utilizzato per l'importazione@48g%r@69gRiporto %r", | ||||||
|           &(d._r1), &(d._r2)); |           &(d._r1), &(d._r2)); | ||||||
| 
 | 
 | ||||||
|   set_row(7,""); |   set_row(7,""); | ||||||
|   set_row(8,"Art. 8bis 1@ix@rcomma@31gDisponibile@48g%r", |   set_row(8,"Art. 8bis 1@io@rcomma@31gDisponibile@48g%r", | ||||||
|           &r2); |           &r2); | ||||||
|   set_row(9,"Utilizzato all'interno@48g%r", &(d._r3)); |   set_row(9,"Utilizzato all'interno@48g%r", &(d._r3)); | ||||||
|   set_row(10,"Utilizzato per l'importazione@48g%r@69gRiporto %r", |   set_row(10,"Utilizzato per l'importazione@48g%r@69gRiporto %r", | ||||||
|           &(d._r4), &(d._r5)); |           &(d._r4), &(d._r5)); | ||||||
| 
 | 
 | ||||||
|   set_row(11,""); |   set_row(11,""); | ||||||
|   set_row(12,"Art. 9 1@ix@rcomma@31gDisponibile@48g%r", |   set_row(12,"Art. 9 1@io@rcomma@31gDisponibile@48g%r", | ||||||
|           &r3); |           &r3); | ||||||
|   set_row(13,"Utilizzato all'interno@48g%r", &(d._r6)); |   set_row(13,"Utilizzato all'interno@48g%r", &(d._r6)); | ||||||
|   set_row(14,"Utilizzato per l'importazione@48g%r@69gRiporto %r", |   set_row(14,"Utilizzato per l'importazione@48g%r@69gRiporto %r", | ||||||
|  | |||||||
| @ -36,7 +36,7 @@ bool CG4300_App::set_deleghe() | |||||||
|       for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next()) |       for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next()) | ||||||
|       { |       { | ||||||
|         TString cod  = _nditte_r->get("CODDITTA"); |         TString cod  = _nditte_r->get("CODDITTA"); | ||||||
|         TString vers = _nditte_r->get("FREQVIVA"); |         TString vers = _freqviva; | ||||||
| 
 | 
 | ||||||
|         TToken_string d(" "); |         TToken_string d(" "); | ||||||
|          |          | ||||||
| @ -96,7 +96,7 @@ bool CG4300_App::extract_deleghe() | |||||||
|     if (is_month_ok(_month)) |     if (is_month_ok(_month)) | ||||||
|     { |     { | ||||||
|       _isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4"); |       _isbenzinaro = _nditte->curr(LF_ATTIV).get_bool("ART74/4"); | ||||||
|       _freqviva    = _nditte->curr().get("FREQVIVA"); |       _freqviva    = look_lia() ? _lia->get("S7") : _nditte->curr().get("FREQVIVA"); | ||||||
|       bool   mens  = _freqviva == "M"; |       bool   mens  = _freqviva == "M"; | ||||||
|       _isannual    = (_month == 12 && !mens && !_isbenzinaro) || |       _isannual    = (_month == 12 && !mens && !_isbenzinaro) || | ||||||
|         (_month == 13 && (mens || _isbenzinaro)); |         (_month == 13 && (mens || _isbenzinaro)); | ||||||
| @ -177,7 +177,7 @@ bool CG4300_App::set_acconto() | |||||||
|       for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next()) |       for (l = 0l, _nditte->first(); !_nditte->eof(); l++, _nditte->next()) | ||||||
|       { |       { | ||||||
|         TString cod  = _nditte_r->get("CODDITTA"); |         TString cod  = _nditte_r->get("CODDITTA"); | ||||||
|         TString vers = _nditte_r->get("FREQVIVA"); |         TString vers = _freqviva; | ||||||
|          |          | ||||||
|         TToken_string d(" "); |         TToken_string d(" "); | ||||||
|          |          | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user