Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@22484 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									6f9049b1be
								
							
						
					
					
						commit
						cd50f8224a
					
				@ -641,9 +641,9 @@ TCurrency::TCurrency(const real& num, const TExchange& exc, bool price)
 | 
			
		||||
 | 
			
		||||
bool same_values(const char * valuea, const char * valueb)
 | 
			
		||||
{     
 | 
			
		||||
  if (valuea == NULL || *valuea == '\0')
 | 
			
		||||
  if (valuea == NULL || *valuea <= ' ')
 | 
			
		||||
    valuea = TCurrency::get_firm_val();
 | 
			
		||||
  if (valueb == NULL || *valueb == '\0')
 | 
			
		||||
  if (valueb == NULL || *valueb <= ' ')
 | 
			
		||||
    valueb = TCurrency::get_firm_val();
 | 
			
		||||
    
 | 
			
		||||
  return xvt_str_compare_ignoring_case(valuea, valueb) == 0;  
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										140
									
								
								include/expr.cpp
									
									
									
									
									
								
							
							
						
						
									
										140
									
								
								include/expr.cpp
									
									
									
									
									
								
							@ -1,6 +1,7 @@
 | 
			
		||||
#define __EXPR_CPP
 | 
			
		||||
#include <expr.h>
 | 
			
		||||
#include <date.h>
 | 
			
		||||
#include <diction.h>
 | 
			
		||||
#include <validate.h>
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -710,14 +711,14 @@ void TExpression::eval()
 | 
			
		||||
      {
 | 
			
		||||
        const real & r2 = evalstack.pop_real();
 | 
			
		||||
        real & r1 = evalstack.peek_real();
 | 
			
		||||
        r1 = real(r1 * r2 / 100.0);
 | 
			
		||||
        r1 = real(r1 * r2 / CENTO);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    case _scorp:
 | 
			
		||||
      {
 | 
			
		||||
        const real & r2 = evalstack.pop_real();
 | 
			
		||||
        real & r1 = evalstack.peek_real();
 | 
			
		||||
        r1 -= r1 * r2 / (r2 + 100.0);
 | 
			
		||||
        r1 -= r1 * r2 / (r2 + CENTO);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    case _if:
 | 
			
		||||
@ -834,6 +835,15 @@ void TExpression::eval()
 | 
			
		||||
        s.right_just(len, '0');
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    case _scon2perc:
 | 
			
		||||
      {
 | 
			
		||||
        const TString& s = evalstack.pop_string();
 | 
			
		||||
        TString80 tmp;
 | 
			
		||||
        real perc;
 | 
			
		||||
        scontoexpr2perc(s, false, tmp, perc);
 | 
			
		||||
        evalstack.push(perc);
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      NFCHECK("operazione non valida %d", (int) instr.getsym());
 | 
			
		||||
      break;
 | 
			
		||||
@ -853,12 +863,12 @@ HIDDEN char  _tok[81];
 | 
			
		||||
 | 
			
		||||
TCodesym TExpression::tok2fun(const char* tok) const
 | 
			
		||||
{                                                   
 | 
			
		||||
  const int MAX_TOK = 33;
 | 
			
		||||
  const int MAX_TOK = 34;
 | 
			
		||||
  HIDDEN const char* fnstr[MAX_TOK] = { "ANSI",    "BETWEEN","CEIL",    "CF_CHECK","COS",   
 | 
			
		||||
                                        "EXP",     "EXP10",  "IF",      "LEFT",    "LEN",     
 | 
			
		||||
                                        "LOG",     "LOG10",  "MAX",     "MID",     "MIN",     
 | 
			
		||||
                                        "NUM",     "PERC",   "PI_CHECK","POW",     "RIGHT",
 | 
			
		||||
                                        "ROUND",   "SCORP",  "SIN",     "SQR",     "SQRT",   
 | 
			
		||||
                                        "ROUND",   "SCON2PERC", "SCORP","SIN",     "SQR",     "SQRT",   
 | 
			
		||||
                                        "STR",     "SUBSTR", "TAN",     "TRIM",    "TRUNC",  
 | 
			
		||||
                                        "UPPER",   "YEAR",   "ZEROFILL" };
 | 
			
		||||
  
 | 
			
		||||
@ -866,9 +876,9 @@ TCodesym TExpression::tok2fun(const char* tok) const
 | 
			
		||||
                                        _exp,    _exp10,   _if,       _left,     _len,      
 | 
			
		||||
                                        _log,    _log10,   _max,      _mid,      _min,      
 | 
			
		||||
                                        _num,    _perc,    _picheck,  _pow,      _right,    
 | 
			
		||||
                                        _round,  _scorp,   _sin,      _sqr,      _sqrt,   
 | 
			
		||||
                                        _str,    _substr,  _tan,      _trim,     _trunc,  
 | 
			
		||||
                                        _upper,  _year,    _zerofill };
 | 
			
		||||
                                        _round,  _scon2perc,_scorp,   _sin,      _sqr,
 | 
			
		||||
                                        _sqrt,   _str,     _substr,  _tan,      _trim,
 | 
			
		||||
                                        _trunc,  _upper,  _year,    _zerofill };
 | 
			
		||||
                                  
 | 
			
		||||
  int f = 0, l = MAX_TOK-1, i = MAX_TOK/2;                    
 | 
			
		||||
  for (;;)
 | 
			
		||||
@ -1185,6 +1195,7 @@ TCodesym TExpression::__factor(TCodesym startsym)
 | 
			
		||||
  case _trim:
 | 
			
		||||
  case _len:
 | 
			
		||||
  case _year:
 | 
			
		||||
  case _scon2perc:
 | 
			
		||||
    sym = __function(1);
 | 
			
		||||
    _code.add(startsym);
 | 
			
		||||
    break;
 | 
			
		||||
@ -1336,3 +1347,118 @@ const char* TExpression::last_token() const
 | 
			
		||||
{
 | 
			
		||||
  return _tok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// Utility sugli sconti
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
bool scontoexpr2perc(const TString& exp, bool signal , TString & goodexp, real & val_perc )
 | 
			
		||||
{
 | 
			
		||||
  bool valid = true;
 | 
			
		||||
 | 
			
		||||
  goodexp.cut(0);  
 | 
			
		||||
  // Elimina gli spazi molesti
 | 
			
		||||
//  work.strip_spaces( );
 | 
			
		||||
  val_perc = UNO;
 | 
			
		||||
  if (exp.full())
 | 
			
		||||
  {
 | 
			
		||||
    TString80 num;
 | 
			
		||||
    bool dec = false;      // Flag che indica se si attende l'inizio di un numero
 | 
			
		||||
    bool startnum = true;  // Flag che indica se siamo all'inizio di un numero   
 | 
			
		||||
    int errorchar = ' ';
 | 
			
		||||
    
 | 
			
		||||
    // Flag che indica se sono nella parte decimale di un numero
 | 
			
		||||
    for (const char* s  = exp; *s  && errorchar == ' '; s++)
 | 
			
		||||
    { 
 | 
			
		||||
      const char c = *s;
 | 
			
		||||
      switch(c)
 | 
			
		||||
      {
 | 
			
		||||
      case '+': 
 | 
			
		||||
      case '-':
 | 
			
		||||
        // Se ero in in numero ...
 | 
			
		||||
        if( !startnum )
 | 
			
		||||
        {
 | 
			
		||||
          // Aggiunge il numero alla sequenza
 | 
			
		||||
          const real newval = num;
 | 
			
		||||
          val_perc *= ( CENTO - newval ) / CENTO;
 | 
			
		||||
          goodexp << num;
 | 
			
		||||
        }
 | 
			
		||||
        // Inizia il nuovo numero
 | 
			
		||||
        num = (c == '-') ? "-" : "+";  
 | 
			
		||||
        startnum = true;
 | 
			
		||||
        dec = false;
 | 
			
		||||
        break;         
 | 
			
		||||
      case '0':  
 | 
			
		||||
      case '1':
 | 
			
		||||
      case '2':
 | 
			
		||||
      case '3':
 | 
			
		||||
      case '4':
 | 
			
		||||
      case '5':
 | 
			
		||||
      case '6':
 | 
			
		||||
      case '7':
 | 
			
		||||
      case '8':
 | 
			
		||||
      case '9':
 | 
			
		||||
        num << c;
 | 
			
		||||
        startnum = false;
 | 
			
		||||
        break;
 | 
			
		||||
      case '.':
 | 
			
		||||
      case ',':
 | 
			
		||||
        if(!dec)
 | 
			
		||||
        {
 | 
			
		||||
          if( startnum )
 | 
			
		||||
            num << '0';        // Se occorreva un numero ci metto lo 0
 | 
			
		||||
          num << '.';          // Interpreto la virgola come punto
 | 
			
		||||
          dec = true;       
 | 
			
		||||
          startnum = true;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
          errorchar = c;        // Se siamo già nella parte decimale segnala un errore
 | 
			
		||||
        break;
 | 
			
		||||
      case ' ':
 | 
			
		||||
        break;
 | 
			
		||||
      default:
 | 
			
		||||
        errorchar = c;
 | 
			
		||||
        break;         
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // Controlla la validità
 | 
			
		||||
    valid = errorchar == ' ';
 | 
			
		||||
    
 | 
			
		||||
    if (valid)
 | 
			
		||||
    {
 | 
			
		||||
      // Aggiunge l'ultimo numero preso
 | 
			
		||||
      const real lastval = num; 
 | 
			
		||||
      val_perc *= ( CENTO - lastval ) / CENTO;
 | 
			
		||||
      goodexp << num; // Assegna la nuova espressione formattata bene     
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      if (signal)          // Se richiesto segnala l'errore
 | 
			
		||||
        warning_box(FR("Espressione di sconto non valida. Errore sul carattere %c."), errorchar);
 | 
			
		||||
      val_perc = UNO;      // Azzera la sequenza di percentuali
 | 
			
		||||
      goodexp = "";
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return valid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool is_real_discount(const TString& exp)
 | 
			
		||||
{
 | 
			
		||||
  if (exp.blank())
 | 
			
		||||
    return false;
 | 
			
		||||
	TString80 good;
 | 
			
		||||
	real perc;
 | 
			
		||||
	return scontoexpr2perc(exp, false , good, perc) && perc != UNO;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
real prezzo_scontato(const real& prezzo, const TString& sconto)
 | 
			
		||||
{    
 | 
			
		||||
  if (sconto.full())
 | 
			
		||||
  {
 | 
			
		||||
    TString80 exp;
 | 
			
		||||
    real val_sconto;
 | 
			
		||||
    if (scontoexpr2perc(sconto, false , exp, val_sconto) && val_sconto != UNO)
 | 
			
		||||
      return prezzo * val_sconto;
 | 
			
		||||
  }               
 | 
			
		||||
  return prezzo;
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
@ -76,7 +76,8 @@ enum TCodesym {
 | 
			
		||||
  _cfcheck,        // @emem controlla il codice fiscale (+stato)
 | 
			
		||||
  _picheck,        // @emem controlla la partita IVA (+stato)
 | 
			
		||||
  _year,           // @emem estrae l'anno da una data
 | 
			
		||||
  _zerofill        // @emem riepie di zeri l'inizio di una stringa 
 | 
			
		||||
  _zerofill,       // @emem riepie di zeri l'inizio di una stringa 
 | 
			
		||||
  _scon2perc       // @emem converte una espressione in percentuale di sconto
 | 
			
		||||
};
 | 
			
		||||
// @doc INTERNAL
 | 
			
		||||
 | 
			
		||||
@ -510,4 +511,8 @@ public:
 | 
			
		||||
	{}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool is_real_discount(const TString& exp);
 | 
			
		||||
bool scontoexpr2perc(const TString& exp, bool signal, TString& goodexp, real& val_perc);
 | 
			
		||||
real prezzo_scontato(const real& prezzo, const TString& sconto);
 | 
			
		||||
 | 
			
		||||
#endif // __EXPR_H
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@
 | 
			
		||||
#include <user.h>
 | 
			
		||||
 | 
			
		||||
HIDDEN const char* const MASK_EXT = "msk";
 | 
			
		||||
HIDDEN BOOLEAN _bShowGrid = FALSE;
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TMask methods
 | 
			
		||||
@ -922,9 +923,32 @@ long TMask::handler(WINDOW w, EVENT* ep)
 | 
			
		||||
    return 0L;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (ep->type == E_UPDATE && w == page_win(0))
 | 
			
		||||
  if (ep->type == E_UPDATE)
 | 
			
		||||
  {
 | 
			
		||||
    if (source_file().find("custom") > 0)
 | 
			
		||||
    if (_bShowGrid)
 | 
			
		||||
    {
 | 
			
		||||
      RCT rct; xvt_vobj_get_client_rect(w, &rct);
 | 
			
		||||
      DRAW_CTOOLS dct;
 | 
			
		||||
      xvt_dwin_get_draw_ctools(w, &dct);
 | 
			
		||||
      dct.fore_color = PROMPT_COLOR;
 | 
			
		||||
      dct.back_color = MASK_BACK_COLOR;
 | 
			
		||||
      dct.opaque_text = TRUE;
 | 
			
		||||
      dct.pen.color = PROMPT_COLOR;
 | 
			
		||||
      dct.pen.pat = PAT_SOLID;
 | 
			
		||||
      dct.pen.style = P_SOLID;
 | 
			
		||||
      dct.pen.width = 0;
 | 
			
		||||
      xvt_dwin_set_draw_ctools(w, &dct);
 | 
			
		||||
 | 
			
		||||
      for (int y = ROWY; y < rct.bottom; y += ROWY)
 | 
			
		||||
      {
 | 
			
		||||
        PNT pt0 = { y, rct.left }, pt1 = { y, rct.right};
 | 
			
		||||
        xvt_dwin_draw_set_pos(w, pt0);
 | 
			
		||||
        xvt_dwin_draw_line(w, pt1);
 | 
			
		||||
        char text[8]; sprintf(text, "%d", y/ROWY);
 | 
			
		||||
        xvt_dwin_draw_text(w, pt0.h, pt0.v, text, -1);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    if (w == page_win(0) && source_file().find("custom") > 0)
 | 
			
		||||
    {
 | 
			
		||||
      RCT rct; xvt_vobj_get_client_rect(w, &rct);
 | 
			
		||||
      rct.left += 2; rct.right -= 2; rct.bottom -= 2;
 | 
			
		||||
@ -1005,6 +1029,13 @@ bool TMask::on_key(
 | 
			
		||||
  case K_F12:
 | 
			
		||||
		send_key(K_F12, focus_field().dlg());
 | 
			
		||||
    break;
 | 
			
		||||
  case K_SHIFT+K_F11:
 | 
			
		||||
		if (is_power_station())
 | 
			
		||||
    {
 | 
			
		||||
      _bShowGrid = !_bShowGrid;
 | 
			
		||||
      xvt_dwin_invalidate_rect(curr_win(), NULL);
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  case K_CTRL+'+':
 | 
			
		||||
    if (is_running()) 
 | 
			
		||||
    {      
 | 
			
		||||
 | 
			
		||||
@ -399,6 +399,8 @@ public:
 | 
			
		||||
	bool add_row_auto();
 | 
			
		||||
	bool error_box(const char* msg);
 | 
			
		||||
 | 
			
		||||
  bool point2cell(const PNT& pnt, short& id, long& row) const;
 | 
			
		||||
  
 | 
			
		||||
  // @cmember Costruttore
 | 
			
		||||
  TSpreadsheet(WINDOW parent, short dlg, short x, short y, short dx, short dy, const char* maskname, int maskno, const char* head, TSheet_field* owner);
 | 
			
		||||
  // @cmember Distruttore
 | 
			
		||||
@ -2619,6 +2621,45 @@ bool TSpreadsheet::error_box(const char* msg)
 | 
			
		||||
	return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TSpreadsheet::point2cell(const PNT& pnt, short& id, long& row) const
 | 
			
		||||
{
 | 
			
		||||
  RCT rct; xi_get_rect(_obj, (XI_RCT*)&rct);
 | 
			
		||||
  bool inside = xvt_rect_has_point(&rct, pnt) != 0;
 | 
			
		||||
  id = DLG_NULL;
 | 
			
		||||
  row = -1;
 | 
			
		||||
  if (inside)
 | 
			
		||||
  {
 | 
			
		||||
    int num_cols;
 | 
			
		||||
    XI_OBJ** column = xi_get_member_list(_obj, &num_cols);
 | 
			
		||||
    for (int c = 0; c < num_cols; c++)
 | 
			
		||||
    {
 | 
			
		||||
      xi_get_rect(column[c], (XI_RCT*)&rct);
 | 
			
		||||
      if (xvt_rect_has_point(&rct, pnt))
 | 
			
		||||
      {
 | 
			
		||||
        id = column[c]->cid;
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int first_vis, last_vis; 
 | 
			
		||||
    int rows = xi_get_visible_rows(_obj, &first_vis, &last_vis);
 | 
			
		||||
    if (rows > 0)
 | 
			
		||||
    {
 | 
			
		||||
      XI_OBJ row1; XI_MAKE_ROW(&row1, _obj, first_vis);
 | 
			
		||||
      XI_OBJ row2; XI_MAKE_ROW(&row2, _obj, last_vis);
 | 
			
		||||
      XI_RCT r1; xi_get_rect(&row1, &r1);
 | 
			
		||||
      XI_RCT r2; xi_get_rect(&row2, &r2);
 | 
			
		||||
      const int r = first_vis + (pnt.v - r1.top) / (r1.bottom-r1.top);
 | 
			
		||||
      if (r >= first_vis && r <= last_vis)
 | 
			
		||||
      {
 | 
			
		||||
        const long* handle = xi_get_list_info(_obj, &rows);
 | 
			
		||||
        row = handle[r - first_vis];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return inside;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TSheet_field
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
@ -3656,3 +3697,9 @@ const int TSheet_field::current_column() const
 | 
			
		||||
  int sel = s->_cur_col;
 | 
			
		||||
  return sel;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TSheet_field::point2cell(const PNT& pnt, short& id, long& row) const
 | 
			
		||||
{
 | 
			
		||||
  TSpreadsheet& s = (TSpreadsheet&)*_ctl;
 | 
			
		||||
  return s.point2cell(pnt, id, row);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -289,6 +289,7 @@ public:
 | 
			
		||||
 | 
			
		||||
  // @cmember Restituisce il numero della colonna corrente
 | 
			
		||||
  const int current_column() const;
 | 
			
		||||
  bool point2cell(const PNT& pnt, short& id, long& row) const;
 | 
			
		||||
 | 
			
		||||
	virtual bool error_box(const char* fmt, ...) const;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -132,6 +132,7 @@ void TLog_report::reset()
 | 
			
		||||
  TText_recordset* csv = (TText_recordset*)recordset();
 | 
			
		||||
  if (csv)
 | 
			
		||||
    csv->destroy();
 | 
			
		||||
  _msg = _war = _err = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TLog_report::log(int sev, const char* msg)
 | 
			
		||||
@ -156,12 +157,18 @@ bool TLog_report::log(int sev, const char* msg)
 | 
			
		||||
    {
 | 
			
		||||
      csv->set(0u, TVariant((long)sev));
 | 
			
		||||
      csv->set(1, TVariant(msg));
 | 
			
		||||
      switch (sev)
 | 
			
		||||
      {
 | 
			
		||||
      case  0: _msg++; break;
 | 
			
		||||
      case  1: _war++; break;
 | 
			
		||||
      default: _err++; break;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TLog_report::TLog_report(const char* title, const char* name) : _kill_duplicates(false)
 | 
			
		||||
TLog_report::TLog_report(const char* title, const char* name) : _kill_duplicates(false), _msg(0), _war(0), _err(0)
 | 
			
		||||
{
 | 
			
		||||
  load(name);
 | 
			
		||||
  if (recordset() == NULL)
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,7 @@ class TLog_report : public TReport
 | 
			
		||||
{
 | 
			
		||||
  TString _title;
 | 
			
		||||
  bool _kill_duplicates;
 | 
			
		||||
  size_t _msg, _war, _err;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  virtual bool use_mask() { return false; }
 | 
			
		||||
@ -47,6 +48,11 @@ public:
 | 
			
		||||
  void set_title(const char* title);
 | 
			
		||||
  void kill_duplicates(bool k = true) { _kill_duplicates = k; }
 | 
			
		||||
  const TString& title() const { return _title; }
 | 
			
		||||
  size_t messages() const { return _msg; }
 | 
			
		||||
  size_t warnings() const { return _war; }
 | 
			
		||||
  size_t errors() const   { return _err; }
 | 
			
		||||
  size_t rows() const { return messages() + warnings() + errors(); } 
 | 
			
		||||
 | 
			
		||||
  TLog_report(const char* title = "", const char* name = "bagn010a");
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1760,7 +1760,7 @@ bool TToken_string::get(
 | 
			
		||||
  long& tok) const // @parm long da ritornare
 | 
			
		||||
{
 | 
			
		||||
  TString16 str;
 | 
			
		||||
  bool found = get(n, str);
 | 
			
		||||
  const bool found = get(n, str);
 | 
			
		||||
  tok = found ? atol(str) : 0L;
 | 
			
		||||
  return found;
 | 
			
		||||
}
 | 
			
		||||
@ -1770,11 +1770,21 @@ bool TToken_string::get(
 | 
			
		||||
  real& tok) const // @parm real da ritornare
 | 
			
		||||
{
 | 
			
		||||
  TString80 str;
 | 
			
		||||
  const bool found = get(n, str);
 | 
			
		||||
  tok = found ? real(str) : ZERO;
 | 
			
		||||
  return found;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TToken_string::get(
 | 
			
		||||
  int n,           // @parm Posizione del token da ritornare (0 = primo, -1 = prossimo, -2 = ultimo, n = n-simo)
 | 
			
		||||
  TDate& tok) const // @parm TDate da ritornare
 | 
			
		||||
{
 | 
			
		||||
  TString16 str;
 | 
			
		||||
  bool found = get(n, str);
 | 
			
		||||
  if (found)
 | 
			
		||||
    tok = real(str);
 | 
			
		||||
  if (found && TDate::isdate(str))
 | 
			
		||||
    tok = TDate(str);
 | 
			
		||||
  else
 | 
			
		||||
    tok = ZERO;
 | 
			
		||||
    tok = botime;
 | 
			
		||||
  return found;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,6 +5,11 @@
 | 
			
		||||
#include <object.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __DATE_H
 | 
			
		||||
class TDate;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define SAFE_PIPE_CHR '¦'
 | 
			
		||||
 | 
			
		||||
// @doc EXTERNAL
 | 
			
		||||
@ -612,6 +617,8 @@ public:
 | 
			
		||||
  bool get(int n, long& tok) const;
 | 
			
		||||
  // @cmember Ritorna l'ennesimo real
 | 
			
		||||
  bool get(int n, real& tok) const;
 | 
			
		||||
  // @cmember Ritorna l'ennesima data
 | 
			
		||||
  bool get(int n, TDate& tok) const;
 | 
			
		||||
  
 | 
			
		||||
  // @cmember Ritorna la posizione dell'item s
 | 
			
		||||
  int get_pos(const char* s);
 | 
			
		||||
 | 
			
		||||
@ -119,6 +119,9 @@
 | 
			
		||||
#define BMP_SARROWU   197
 | 
			
		||||
#define BMP_SARROWD   198
 | 
			
		||||
 | 
			
		||||
#define BMP_PAGAMENTO 224
 | 
			
		||||
#define BMP_INSOLUTO  225
 | 
			
		||||
 | 
			
		||||
//immagini bottoni barre strumenti principali
 | 
			
		||||
//-------------------------------------------
 | 
			
		||||
#define TOOL_OK         101
 | 
			
		||||
@ -197,6 +200,8 @@
 | 
			
		||||
#define TOOL_TODATAINI    221
 | 
			
		||||
#define TOOL_TODATAFIN    222
 | 
			
		||||
#define TOOL_TOCALC       223
 | 
			
		||||
#define TOOL_PAGAMENTO    224
 | 
			
		||||
#define TOOL_INSOLUTO     225
 | 
			
		||||
 | 
			
		||||
#define TOOL_DAY_WORK     233
 | 
			
		||||
#define TOOL_DAY_HOLY     234
 | 
			
		||||
 | 
			
		||||
@ -532,9 +532,10 @@ long daytime()
 | 
			
		||||
  return timeloc->tm_sec + timeloc->tm_min * 100L  + timeloc->tm_hour * 10000L;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// DON'T cache this bool because hostname can be local or server
 | 
			
		||||
static bool is_aga_station(const char* hostname)
 | 
			
		||||
{
 | 
			
		||||
   const char* const ranger[] = { "ARCHIMEDE", "BATMOBILE", "KIRK", "MOBILE", "SPOCK", NULL };
 | 
			
		||||
  const char* const ranger[] = { "BATMOBILE", "KIRK", "MOBILE", "SPOCK", NULL };
 | 
			
		||||
  for (int i = 0; ranger[i]; i++)
 | 
			
		||||
    if (xvt_str_compare_ignoring_case(hostname, ranger[i]) == 0)
 | 
			
		||||
      return true;
 | 
			
		||||
 | 
			
		||||
@ -73,42 +73,6 @@ HIDDEN bool _emptycopy_val(TMask_field& f, KEY)
 | 
			
		||||
 | 
			
		||||
HIDDEN bool check_pi_estera(const TString& st, const TString& paiva)
 | 
			
		||||
{
 | 
			
		||||
/*
 | 
			
		||||
 const char* stpi[] = { "AT09", "BE10", "DE09", "DK08", "EL08", "ES09", 
 | 
			
		||||
                         "FI08", "FR11", "GB05", "GB09", "GB12", "IE08",
 | 
			
		||||
                         "LU08", "NL12", "PT09", "SE12", "SM05", NULL };
 | 
			
		||||
  bool lenok = false;
 | 
			
		||||
  bool known = false;
 | 
			
		||||
  
 | 
			
		||||
  for (int g = 0; stpi[g] && !lenok; g++)
 | 
			
		||||
  {
 | 
			
		||||
    if (st.compare(stpi[g], 2, true) == 0)      // Se lo stato corrisponde
 | 
			
		||||
    {
 | 
			
		||||
      known = true;
 | 
			
		||||
      lenok = paiva.len() == atoi(stpi[g]+2);   // Confronto lunghezza
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
      if (known)  // Inutile cercare ancora
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
  } 
 | 
			
		||||
  if (known)
 | 
			
		||||
  {
 | 
			
		||||
    if (lenok)
 | 
			
		||||
    {
 | 
			
		||||
      if (st=="AT")   // Controllo speciale per l'Austria che comincia per U
 | 
			
		||||
        lenok = paiva[0] == 'U' && real::is_natural(paiva.mid(1)); else
 | 
			
		||||
      if (st=="BE")   // Controllo speciale per il Belgio che comincia per 0
 | 
			
		||||
        lenok = paiva[0] == '0' && real::is_natural(paiva); else
 | 
			
		||||
      if (st=="NL")   // Controllo speciale per l'Olanda che ha una B in posizione 10
 | 
			
		||||
        lenok = paiva[9] == 'B' && real::is_natural(paiva.left(9)); 
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    lenok = true;  // Gli stati ignoti hanno sempre lunghezza corretta!
 | 
			
		||||
  return lenok;  
 | 
			
		||||
*/
 | 
			
		||||
  const int len = paiva.len();
 | 
			
		||||
  const char* p = paiva;
 | 
			
		||||
  const bool nat = real::is_natural(p);
 | 
			
		||||
@ -813,7 +777,7 @@ HIDDEN bool _sconto_val(TMask_field& f, KEY key)
 | 
			
		||||
          break;         
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      // Controlla la validita`
 | 
			
		||||
      // Controlla la validità
 | 
			
		||||
      ok = errorchar == ' ';
 | 
			
		||||
      
 | 
			
		||||
      if (ok)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user