Patch level : 2.2 no patch
Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunta Pasqua e Lunedi' dell'Angelo alle date git-svn-id: svn://10.65.10.50/trunk@13314 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									92151c5cd5
								
							
						
					
					
						commit
						758ff5de03
					
				@ -382,11 +382,28 @@ int TDate::week() const
 | 
				
			|||||||
  return int((*this - y) / 7 + 1);
 | 
					  return int((*this - y) / 7 + 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TDate::set_easter(int n)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (n > 0)
 | 
				
			||||||
 | 
							set_year(n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const int y = year();
 | 
				
			||||||
 | 
						const int g = y % 19;
 | 
				
			||||||
 | 
						const int c = y / 200;
 | 
				
			||||||
 | 
						const int h = (c - c / 4 - (8 * c + 13) / 25 + 19 * g+ 15) % 30;
 | 
				
			||||||
 | 
						const int i = h - (h / 28) * (1 - (29 / (h + 1)) * ((21 - g) / 11));
 | 
				
			||||||
 | 
						const int j = (y + y / 4 + i + 2 - c + c / 4) % 7;
 | 
				
			||||||
 | 
						const int l = i - j;
 | 
				
			||||||
 | 
						const int m = 3 + (l + 40) / 44;
 | 
				
			||||||
 | 
						set_month(m);
 | 
				
			||||||
 | 
						const int d = l + 28 - 31 * (m / 4);
 | 
				
			||||||
 | 
						set_day(d);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TDate::is_holiday() const
 | 
					bool TDate::is_holiday() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	bool holiday = wday() > 5;   // Week-end
 | 
						if (wday() > 5)   // Week-end
 | 
				
			||||||
	if (!holiday)
 | 
							return true;
 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
	const int d = day();
 | 
						const int d = day();
 | 
				
			||||||
	const int m = month();
 | 
						const int m = month();
 | 
				
			||||||
	 
 | 
						 
 | 
				
			||||||
@ -404,8 +421,17 @@ bool TDate::is_holiday() const
 | 
				
			|||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	if ((m == 12) && ((d == 8) || (d == 25) || (d == 26)))
 | 
						if ((m == 12) && ((d == 8) || (d == 25) || (d == 26)))
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
 | 
						if (m == 3 || m == 4 && wday() == 1)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TDate angelo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							angelo.set_easter(year());
 | 
				
			||||||
 | 
							++angelo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (angelo == *this)
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return holiday;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TDate& TDate::operator +=(long nday)
 | 
					TDate& TDate::operator +=(long nday)
 | 
				
			||||||
 | 
				
			|||||||
@ -122,6 +122,8 @@ public:
 | 
				
			|||||||
  // @cmember Permette di stabilire il criterio di formattazione delle date
 | 
					  // @cmember Permette di stabilire il criterio di formattazione delle date
 | 
				
			||||||
  void set_format(const char* f);
 | 
					  void set_format(const char* f);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  // @cmember Setta la data alla pasqua dell'anno indicato;
 | 
				
			||||||
 | 
					  void set_easter(int n = 0);
 | 
				
			||||||
  // @cmember Incrementa la data di un certo numero di giorni
 | 
					  // @cmember Incrementa la data di un certo numero di giorni
 | 
				
			||||||
  TDate& operator +=(long nday);
 | 
					  TDate& operator +=(long nday);
 | 
				
			||||||
  // @cmember Decrementa la data di un certo numero di giorni
 | 
					  // @cmember Decrementa la data di un certo numero di giorni
 | 
				
			||||||
 | 
				
			|||||||
@ -2209,19 +2209,7 @@ const char* TMask::get_caption(TString& str) const
 | 
				
			|||||||
void TMask::set_caption(const char* c)
 | 
					void TMask::set_caption(const char* c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TToken_string captions(c);
 | 
					  TToken_string captions(c);
 | 
				
			||||||
/*  for (int p = 0; p < _pages; p++)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    const char* cap = captions.get();
 | 
					 | 
				
			||||||
    if (cap == NULL) cap = captions.get(0);
 | 
					 | 
				
			||||||
    xvt_vobj_set_title(_pagewin[p], (char*)cap);   
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const int pos = id2pos(DLG_PAGETAGS + 100 * p);
 | 
					 | 
				
			||||||
    if (pos >= 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      TPage_field& tag = (TPage_field&)fld(pos);
 | 
					 | 
				
			||||||
      tag.set_prompt(c);
 | 
					 | 
				
			||||||
    }  
 | 
					 | 
				
			||||||
  } */
 | 
					 | 
				
			||||||
  // Kill page tags
 | 
					  // Kill page tags
 | 
				
			||||||
	byte p;
 | 
						byte p;
 | 
				
			||||||
	for ( p = 1; p <_pages; p++)
 | 
						for ( p = 1; p <_pages; p++)
 | 
				
			||||||
 | 
				
			|||||||
@ -3758,8 +3758,10 @@ const char* TDate_field::win2raw(
 | 
				
			|||||||
  // @flag OGGI | Inserisce la data del sistema
 | 
					  // @flag OGGI | Inserisce la data del sistema
 | 
				
			||||||
  // @flag DOMANI | Inserisce la data del giorno successivo a quella del sistema
 | 
					  // @flag DOMANI | Inserisce la data del giorno successivo a quella del sistema
 | 
				
			||||||
  // @flag PRIMO | Primo giorno dell'anno (01-01-aa)
 | 
					  // @flag PRIMO | Primo giorno dell'anno (01-01-aa)
 | 
				
			||||||
  // @flag ULTIMO | Ultimo giorno dell'anno (31-12-aa)
 | 
					  // @flag PASQUA | Giorno di pasqua
 | 
				
			||||||
 | 
					  // @flag ANGELO | Lunedi' dell'angelo
 | 
				
			||||||
  // @flag NATALE | Giorno di natale (25-12-aa)
 | 
					  // @flag NATALE | Giorno di natale (25-12-aa)
 | 
				
			||||||
 | 
					  // @flag ULTIMO | Ultimo giorno dell'anno (31-12-aa)
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
  TString& s = _ctl_data._park;
 | 
					  TString& s = _ctl_data._park;
 | 
				
			||||||
  s = datum; s.trim();
 | 
					  s = datum; s.trim();
 | 
				
			||||||
@ -3818,6 +3820,15 @@ const char* TDate_field::win2raw(
 | 
				
			|||||||
      {
 | 
					      {
 | 
				
			||||||
        g += 2;
 | 
					        g += 2;
 | 
				
			||||||
      } else
 | 
					      } else
 | 
				
			||||||
 | 
					      if (s.starts_with("PA")) // s == "PASQUA"
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									g.set_easter();
 | 
				
			||||||
 | 
								} else
 | 
				
			||||||
 | 
					      if (s.starts_with("AN")) // s == "ANGELO"
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									g.set_easter();
 | 
				
			||||||
 | 
									++g;
 | 
				
			||||||
 | 
								} else
 | 
				
			||||||
      if (s[0] == 'A') // s == "ALTROIERI"
 | 
					      if (s[0] == 'A') // s == "ALTROIERI"
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        g -= 2;
 | 
					        g -= 2;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user