Patch level : 12.0 1032
Files correlati : cg5.exe Commento : Corretto salvataggio versamenti a saldo di dicembre e scorporo interessi sui versamenti dei trimestrali.
This commit is contained in:
		
							parent
							
								
									e5c7066e37
								
							
						
					
					
						commit
						802beb8639
					
				@ -398,7 +398,7 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k)
 | 
			
		||||
		if (sh.items() == 5)
 | 
			
		||||
			month *= 3;
 | 
			
		||||
 | 
			
		||||
		if (month >13)
 | 
			
		||||
		if (month > 13)
 | 
			
		||||
			month = 13;
 | 
			
		||||
 | 
			
		||||
		if (sm.is_running() && !sm.stop_run(K_ENTER))
 | 
			
		||||
@ -426,7 +426,7 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k)
 | 
			
		||||
 | 
			
		||||
		app().set_liq_rows(sh);
 | 
			
		||||
 | 
			
		||||
		if (sm.is_running())
 | 
			
		||||
		/*if (sm.is_running())
 | 
			
		||||
		{
 | 
			
		||||
			// TBC controllare se sono i dati giusti in tt
 | 
			
		||||
			sm.field(S_RISULTATO).set(tt.get(cid2index(S_RISULTATO)));
 | 
			
		||||
@ -450,7 +450,7 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k)
 | 
			
		||||
			sv.set_row_cell(S_CONC, app().del()->get("S9"), nrow);
 | 
			
		||||
			sv.set_row_cell(S_VERSAMENTO, app().del()->get("R0"), nrow);
 | 
			
		||||
			sv.force_update(nrow);
 | 
			
		||||
		}
 | 
			
		||||
		}*/
 | 
			
		||||
	}
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
@ -548,21 +548,17 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k)
 | 
			
		||||
 | 
			
		||||
bool Visliq_app::calc_int(TMask_field& f, KEY k)
 | 
			
		||||
{
 | 
			
		||||
  if (k == K_TAB && f.dirty())
 | 
			
		||||
  if (f.running_check(k) && app()._freqviva == "T")
 | 
			
		||||
  {
 | 
			
		||||
	  TSheet_field& sv = *app()._vers_sheet;
 | 
			
		||||
	  const int sel = sv.selected();
 | 
			
		||||
	  int m = (sv.selected() + 1) * 3;
 | 
			
		||||
 | 
			
		||||
	int sel = sv.selected();
 | 
			
		||||
	int m = sv.selected() + 1;
 | 
			
		||||
	if (sv.items() < 12)
 | 
			
		||||
	{
 | 
			
		||||
	  m *= 3;
 | 
			
		||||
    if (m > 12)
 | 
			
		||||
      m = 12;
 | 
			
		||||
    if (app().look_lim(m))
 | 
			
		||||
	  {
 | 
			
		||||
		  const real intt = app()._lim->get_real("R10");
 | 
			
		||||
 | 
			
		||||
		if (intt > ZERO) // interessi
 | 
			
		||||
		{
 | 
			
		||||
      TExchange c;
 | 
			
		||||
		  real vers(f.get());
 | 
			
		||||
		  real vers_netto = vers * CENTO / (intt + CENTO);
 | 
			
		||||
@ -583,8 +579,6 @@ bool Visliq_app::calc_int(TMask_field& f, KEY k)
 | 
			
		||||
			sv.force_update(sel);
 | 
			
		||||
	  }
 | 
			
		||||
  }
 | 
			
		||||
	}
 | 
			
		||||
  }
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -926,7 +920,7 @@ bool Visliq_app::vis_one(int m)
 | 
			
		||||
    if (k == K_SAVE) 
 | 
			
		||||
    {
 | 
			
		||||
      { write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); }
 | 
			
		||||
      if (d_mod) { write_del(m); }
 | 
			
		||||
      if (d_mod) { write_del(m, 1); }
 | 
			
		||||
      l_mod = d_mod = false;   
 | 
			
		||||
      recorded = true;   
 | 
			
		||||
    }
 | 
			
		||||
@ -938,7 +932,7 @@ bool Visliq_app::vis_one(int m)
 | 
			
		||||
        if (kk == K_YES)
 | 
			
		||||
        {    
 | 
			
		||||
          if (l_mod) { write_liq(); recalc_next_liq(m, _liq_sheet, _vers_sheet); }
 | 
			
		||||
          if (d_mod) { write_del(m); }  
 | 
			
		||||
          if (d_mod) { write_del(m, 1); }  
 | 
			
		||||
          l_mod = d_mod = false;   
 | 
			
		||||
          recorded = true;
 | 
			
		||||
        } 
 | 
			
		||||
@ -1139,9 +1133,9 @@ void Visliq_app::recalc_liq_data(TViswin* vsw, real& rimb, real& rett, real& ver
 | 
			
		||||
    _lim->put("B0", "X");
 | 
			
		||||
  }
 | 
			
		||||
    
 | 
			
		||||
  real intr;
 | 
			
		||||
  real intr = itt;
 | 
			
		||||
 | 
			
		||||
  if (!itt.is_zero() && risul > ZERO)
 | 
			
		||||
  if (_freqviva == "T" && itt != ZERO && risul > ZERO)
 | 
			
		||||
  {
 | 
			
		||||
    // calcola interesse
 | 
			
		||||
    intr = risul * itt / CENTO;
 | 
			
		||||
@ -1472,13 +1466,14 @@ void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field
 | 
			
		||||
      _lim->put("R0",  risl);
 | 
			
		||||
      _lim->put("R12", risc);
 | 
			
		||||
      _lim->put("R13", risd);
 | 
			
		||||
      if (intt > ZERO) // interessi
 | 
			
		||||
      if (_freqviva == "T" && intt > ZERO) // interessi
 | 
			
		||||
      {
 | 
			
		||||
        real intr = risl * intt / real(100.0);
 | 
			
		||||
        intt = risl * intt / CENTO;
 | 
			
		||||
        if (_year >= 2000)
 | 
			
		||||
          round_imposta(intr);
 | 
			
		||||
        _lim->put("R14",intr);
 | 
			
		||||
          round_imposta(intt);
 | 
			
		||||
 | 
			
		||||
      }  
 | 
			
		||||
      _lim->put("R14", intt);
 | 
			
		||||
      _lim->put("R16", crf24);
 | 
			
		||||
      _lim->put("R20", autf24);
 | 
			
		||||
 | 
			
		||||
@ -1563,36 +1558,23 @@ void Visliq_app::recalc_next_liq(int start_month, TSheet_field* sl, TSheet_field
 | 
			
		||||
  look_lim(start_month);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Visliq_app::write_del(const int month, const char * codabi, const char * codcab, const char * codcon,
 | 
			
		||||
void Visliq_app::write_del(const int month, const int tipodel, const char * codabi, const char * codcab, const char * codcon,
 | 
			
		||||
	                         const TDate & d, const real& v, const real& i, bool stampato)
 | 
			
		||||
{ 
 | 
			
		||||
	int tipodel = 1;
 | 
			
		||||
 | 
			
		||||
	if (month == 12)
 | 
			
		||||
		tipodel = 7;
 | 
			
		||||
	else
 | 
			
		||||
		if (month == 13)
 | 
			
		||||
			tipodel = 2;
 | 
			
		||||
	const bool wasdel = look_del(month, tipodel);
 | 
			
		||||
	const bool wasdel = look_del(month, tipodel, true);
 | 
			
		||||
  TString8 abi(codabi == nullptr ?	_lim->get("S4") : codabi);
 | 
			
		||||
  TString8 cab(codcab == nullptr ? _lim->get("S5") : codcab);
 | 
			
		||||
  TString4 con(codcon == nullptr ? _lim->get("S6") : codcon);
 | 
			
		||||
  TDate  date(d == TDate(NULLDATE) ? _lim->get_date("D0") : d);
 | 
			
		||||
	const real vers(v >= ZERO ? v : _lim->get_real("R8"));
 | 
			
		||||
 | 
			
		||||
	if (!wasdel)
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
		look_del(month, tipodel, true);  // Crea delega
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (vers == ZERO)
 | 
			
		||||
			_del->remove();
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		real inter = i;
 | 
			
		||||
 | 
			
		||||
		if (i == ZERO)
 | 
			
		||||
		if (_freqviva == "T" && i == ZERO)
 | 
			
		||||
		{
 | 
			
		||||
			real percint = _lim->get_real("R10");
 | 
			
		||||
 | 
			
		||||
@ -1731,26 +1713,24 @@ void Visliq_app::read_general(TMask& m)
 | 
			
		||||
 | 
			
		||||
			// uso solo deleghe normali (tipo == 1), annuali (tipo == 2) e acconti (tipo == 7)                              
 | 
			
		||||
			int tipod = atoi(*_del_tipo);
 | 
			
		||||
 | 
			
		||||
			if (tipod < 3 || tipod == 7)
 | 
			
		||||
			{
 | 
			
		||||
 | 
			
		||||
      // somma versamenti nel mese adeguato  
 | 
			
		||||
				int m = atoi(*_del_mese);
 | 
			
		||||
      int month = atoi(*_del_mese);
 | 
			
		||||
 | 
			
		||||
				if (m >= 12)
 | 
			
		||||
					m = tipod == 7 ? 12 : 13;
 | 
			
		||||
				// supercauto
 | 
			
		||||
				if (m > 0)
 | 
			
		||||
			if (tipod == 1 || tipod == 7)
 | 
			
		||||
			{
 | 
			
		||||
					versamenti[m - 1] += _del->get_real("R0");
 | 
			
		||||
					interessi[m - 1] += _del->get_real("R1");
 | 
			
		||||
					date[m - 1] = _del->get_date("D0");
 | 
			
		||||
					TToken_string& b = banche[m - 1];
 | 
			
		||||
				if (month >= 12)
 | 
			
		||||
					month = tipod == 7 ? 12 : 13;
 | 
			
		||||
				// supercauto
 | 
			
		||||
				if (month > 0)
 | 
			
		||||
				{
 | 
			
		||||
					versamenti[month - 1] += _del->get_real("R0");
 | 
			
		||||
					interessi[month - 1] += _del->get_real("R1");
 | 
			
		||||
					date[month - 1] = _del->get_date("D0");
 | 
			
		||||
					TToken_string& b = banche[month - 1];
 | 
			
		||||
					b.add(_del->get("S7"), 0);
 | 
			
		||||
					b.add(_del->get("S8"), 1);
 | 
			
		||||
					b.add(_del->get("S9"), 2);
 | 
			
		||||
					stampato[m - 1] = _del->get_bool("B0");
 | 
			
		||||
					stampato[month - 1] = _del->get_bool("B0");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@ -1833,7 +1813,7 @@ void Visliq_app::write_general(TMask& m)
 | 
			
		||||
  
 | 
			
		||||
  for (int i = step; i < last_month; i += step)
 | 
			
		||||
  {
 | 
			
		||||
		int m = (i > 12) ? 13 : i;
 | 
			
		||||
		int m = (i > 12) ? 12 : i;
 | 
			
		||||
    // this is a true bordel                            
 | 
			
		||||
    const int row = (i/step) - 1;    
 | 
			
		||||
    
 | 
			
		||||
@ -1890,7 +1870,9 @@ void Visliq_app::write_general(TMask& m)
 | 
			
		||||
    if (ndbcr == "C") nrett = -nrett;
 | 
			
		||||
    
 | 
			
		||||
    // acconto (si considererà solo a dicembre)
 | 
			
		||||
    
 | 
			
		||||
// crea/aggiorna le deleghe
 | 
			
		||||
    if (nvers != overs || nint != oint || ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon || osta != nsta)
 | 
			
		||||
      write_del(m, i == 12 ? 7 : 1, nabi, ncab, ncon, ndate, nvers, nint, nsta);
 | 
			
		||||
		was_lim = look_lim(m);      
 | 
			
		||||
    if (!was_lim)
 | 
			
		||||
      carry = false; // blocca riporto crediti e debiti
 | 
			
		||||
@ -1916,8 +1898,6 @@ void Visliq_app::write_general(TMask& m)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
// ricalcola versamenti se occorre 
 | 
			
		||||
// e crea/aggiorna le deleghe
 | 
			
		||||
 | 
			
		||||
			if (nvers != overs || nint != oint|| ndate != odate || nabi != oabi || ncab != ocab || ncon != ocon || osta != nsta)
 | 
			
		||||
			{
 | 
			
		||||
		 		_lim->put("R8", nvers);
 | 
			
		||||
@ -1929,9 +1909,7 @@ void Visliq_app::write_general(TMask& m)
 | 
			
		||||
				_lim->put("S4", nabi);
 | 
			
		||||
				_lim->put("S5", ncab);
 | 
			
		||||
				_lim->put("S6", ncon);
 | 
			
		||||
				write_del(m, nabi, ncab, ncon, ndate, nvers, nint, nsta);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
      // se modificate rettifiche 
 | 
			
		||||
      // sistemare
 | 
			
		||||
      if (nrett != orett && !_from_one)
 | 
			
		||||
@ -2032,13 +2010,14 @@ void Visliq_app::write_general(TMask& m)
 | 
			
		||||
      _lim->put("R12", risc);
 | 
			
		||||
      _lim->put("R13", risd);
 | 
			
		||||
 | 
			
		||||
      if (intt > ZERO) // interessi
 | 
			
		||||
      if (_freqviva == "T" && intt > ZERO) // interessi
 | 
			
		||||
      {
 | 
			
		||||
        real intr = risl * intt / real(100.0);
 | 
			
		||||
        intt = risl * intt / CENTO;
 | 
			
		||||
        if (_year >= 2000)
 | 
			
		||||
          round_imposta(intr);
 | 
			
		||||
        _lim->put("R14",intr);
 | 
			
		||||
          round_imposta(intt);
 | 
			
		||||
 | 
			
		||||
      }  
 | 
			
		||||
      _lim->put("R14", intt);
 | 
			
		||||
      _lim->put("R16", crf24);
 | 
			
		||||
      _lim->put("R20", autf24);
 | 
			
		||||
      _lim->put("D1", dautf24);
 | 
			
		||||
 | 
			
		||||
@ -87,7 +87,7 @@ public:
 | 
			
		||||
  void read_general(TMask& m);
 | 
			
		||||
  void write_general(TMask& m);
 | 
			
		||||
  void write_liq() { _lim->rewrite();	}
 | 
			
		||||
  void write_del(const int month, const char * codabi = nullptr, const char * codcab = nullptr, const char * codcon = nullptr, 
 | 
			
		||||
  void write_del(const int month, const int tipodel, const char * codabi = nullptr, const char * codcab = nullptr, const char * codcon = nullptr, 
 | 
			
		||||
		             const TDate & d = TDate(NULLDATE), const real &v = MENOUNO, const real &i = ZERO, bool stampato = false);
 | 
			
		||||
  
 | 
			
		||||
  void set_freqviva();                          
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user