Aggiunto oggetto TCursor_sheet_recno; innestato nella TSelection_mask al
posto dei normali TCursor_sheet. L'oggetto in questione ha in piu' un TBit_array utilizzato nei filtri delle stampe scadenzario/scaduto. Ogni elemento di questo TBit_array e' posto a uno in corrispondenza del numero di record del CLI/FO o CONTO selezionato. Sono state apportate le dovute modifiche ai metodi di TSelection_mask che ritornano i TCursor_sheet ed in piu' sono stati resi virtuali 2 metodi (reset_sheet e cur_sheet) per una classe derivata da usare sempre in stampa scadenzario/scaduto. In scselmsk.h sono stati aggiunti alcuni identificatori (Relativi a PCON). git-svn-id: svn://10.65.10.50/trunk@2224 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									e057d0b9f7
								
							
						
					
					
						commit
						2b33f854d2
					
				
							
								
								
									
										101
									
								
								sc/scselect.cpp
									
									
									
									
									
								
							
							
						
						
									
										101
									
								
								sc/scselect.cpp
									
									
									
									
									
								
							@ -1,5 +1,58 @@
 | 
			
		||||
#include "scselect.h"                    
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// TCursor_sheet_recno                                                       //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
TCursor_sheet_recno::TCursor_sheet_recno(TCursor * cursor, const char* fields,
 | 
			
		||||
            const char * title, const char * head, byte buttons)
 | 
			
		||||
: TCursor_sheet(cursor, fields, title, head, buttons)
 | 
			
		||||
{
 | 
			
		||||
  _recnos.reset();
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
bool TCursor_sheet_recno::on_key(KEY k)
 | 
			
		||||
{
 | 
			
		||||
    switch(k)
 | 
			
		||||
    {
 | 
			
		||||
    case K_SPACE: 
 | 
			
		||||
    {
 | 
			
		||||
      *cursor() = selected(); // Posiziona il cursore 
 | 
			
		||||
      rec_check(cursor()->file().recno(), !checked(selected()));
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
    case K_F2: 
 | 
			
		||||
      rec_uncheck(-1); 
 | 
			
		||||
      break;
 | 
			
		||||
    case K_F3:   
 | 
			
		||||
      rec_check(-1);
 | 
			
		||||
      break;
 | 
			
		||||
    default: 
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  return TCursor_sheet::on_key(k);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TCursor_sheet_recno::rec_check(long n, bool on)
 | 
			
		||||
{
 | 
			
		||||
  if (n < 0)
 | 
			
		||||
  {
 | 
			
		||||
    if (on)
 | 
			
		||||
    {
 | 
			
		||||
      _recnos.set(cursor()->size()); // Force the size of Bit_array
 | 
			
		||||
      _recnos.set();
 | 
			
		||||
    } 
 | 
			
		||||
    else
 | 
			
		||||
      _recnos.reset();
 | 
			
		||||
  }     
 | 
			
		||||
  else           
 | 
			
		||||
      _recnos.set(n, on);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// TSelection_mask                                                           //
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
TSelection_mask::TSelection_mask(const char* name)
 | 
			
		||||
               : TMask(name), _who('C'), _key(1), _clifo_rel(NULL),
 | 
			
		||||
                 _cli_cur_k1(NULL), _cli_cur_k2(NULL), _for_cur_k1(NULL), _for_cur_k2(NULL)
 | 
			
		||||
@ -7,24 +60,22 @@ TSelection_mask::TSelection_mask(const char* name)
 | 
			
		||||
  // crea relazioni, cursori e cursor_sheets
 | 
			
		||||
  _clifo_rel  = new TRelation(LF_CLIFO);
 | 
			
		||||
  
 | 
			
		||||
  TRectype filter(LF_CLIFO);
 | 
			
		||||
  filter.put("TIPOCF", "C");
 | 
			
		||||
  _cli_cur_k1 = new TCursor(_clifo_rel, "", 1, &filter, &filter);
 | 
			
		||||
  _cli_cur_k2 = new TCursor(_clifo_rel, "", 2, &filter, &filter);
 | 
			
		||||
  _cli_cur_k1 = new TCursor(_clifo_rel, "TIPOCF=\"C\"", 1);
 | 
			
		||||
  _cli_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"C\"", 2);
 | 
			
		||||
  
 | 
			
		||||
   _cli_sh_k1 = new TCursor_sheet(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice",
 | 
			
		||||
  
 | 
			
		||||
  _cli_sh_k1 = new TCursor_sheet_recno(_cli_cur_k1, " |CODCF|RAGSOC", "Selezione clienti per codice",
 | 
			
		||||
                                 "@1|Codice|Ragione Sociale@50");
 | 
			
		||||
  _cli_sh_k2 = new TCursor_sheet(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale",
 | 
			
		||||
  _cli_sh_k2 = new TCursor_sheet_recno(_cli_cur_k2, " |RAGSOC|CODCF", "Selezione clienti per ragione sociale",
 | 
			
		||||
                                 "@1|Ragione Sociale@50|Codice");
 | 
			
		||||
  
 | 
			
		||||
  if (id2pos(SC_CLIFO) >= 0)
 | 
			
		||||
  {
 | 
			
		||||
    filter.put("TIPOCF", "F");
 | 
			
		||||
    _for_cur_k1 = new TCursor(_clifo_rel, "", 1, &filter, &filter);
 | 
			
		||||
    _for_cur_k2 = new TCursor(_clifo_rel, "", 2, &filter, &filter);
 | 
			
		||||
    _for_sh_k1 = new TCursor_sheet(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice",
 | 
			
		||||
    _for_cur_k1 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 1);
 | 
			
		||||
    _for_cur_k2 = new TCursor(_clifo_rel, "TIPOCF=\"F\"", 2);
 | 
			
		||||
    _for_sh_k1 = new TCursor_sheet_recno(_for_cur_k1, " |CODCF|RAGSOC", "Selezione fornitori per codice",
 | 
			
		||||
                                   "@1|Codice|Ragione Sociale@50");
 | 
			
		||||
    _for_sh_k2 = new TCursor_sheet(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale",
 | 
			
		||||
    _for_sh_k2 = new TCursor_sheet_recno(_for_cur_k2, " |RAGSOC|CODCF", "Selezione fornitori per ragione sociale",
 | 
			
		||||
                                   "@1|Ragione Sociale@50|Codice");
 | 
			
		||||
  }
 | 
			
		||||
                                 
 | 
			
		||||
@ -60,24 +111,28 @@ void TSelection_mask::set_handler(short fld_id, CONTROL_HANDLER handler)
 | 
			
		||||
    fld(pos).set_handler(handler);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TCursor_sheet& TSelection_mask::cur_sheet()
 | 
			
		||||
TCursor_sheet_recno& TSelection_mask::cur_sheet()
 | 
			
		||||
{             
 | 
			
		||||
  TCursor_sheet* cs;
 | 
			
		||||
  TCursor_sheet_recno* cs;
 | 
			
		||||
  if (get_key() == 1) cs = get_who() == 'C' ? _cli_sh_k1 : _for_sh_k1;
 | 
			
		||||
  else                cs = get_who() == 'C' ? _cli_sh_k2 : _for_sh_k2;
 | 
			
		||||
  
 | 
			
		||||
  CHECK(cs, "Can't use a NULL TCursor_sheet");
 | 
			
		||||
  CHECK(cs, "Can't use a NULL TCursor_sheet_recno");
 | 
			
		||||
  return *cs;
 | 
			
		||||
}                 
 | 
			
		||||
 | 
			
		||||
void TSelection_mask::reset_sheets()
 | 
			
		||||
{
 | 
			
		||||
  _cli_sh_k1->uncheck(-1);
 | 
			
		||||
  _cli_sh_k1->rec_uncheck(-1);
 | 
			
		||||
  _cli_sh_k2->uncheck(-1);
 | 
			
		||||
  _cli_sh_k2->rec_uncheck(-1);
 | 
			
		||||
  if (_for_sh_k1)
 | 
			
		||||
  {
 | 
			
		||||
    _for_sh_k1->uncheck(-1);
 | 
			
		||||
    _for_sh_k1->rec_uncheck(-1);
 | 
			
		||||
    _for_sh_k2->uncheck(-1);
 | 
			
		||||
    _for_sh_k2->rec_uncheck(-1);
 | 
			
		||||
  }  
 | 
			
		||||
  reset(SC_CFCODFR);
 | 
			
		||||
  reset(SC_CFCODTO);
 | 
			
		||||
@ -88,7 +143,7 @@ void TSelection_mask::reset_sheets()
 | 
			
		||||
// Seleziona tutti i clienti con codice compreso tra due estremi
 | 
			
		||||
void TSelection_mask::select_clifo_range(long from, long to)
 | 
			
		||||
{
 | 
			
		||||
  TCursor_sheet& c = cur_sheet();
 | 
			
		||||
  TCursor_sheet_recno& c = cur_sheet();
 | 
			
		||||
  const long items = c.items();
 | 
			
		||||
  const int key = get_key();
 | 
			
		||||
  
 | 
			
		||||
@ -118,12 +173,16 @@ void TSelection_mask::select_clifo_range(long from, long to)
 | 
			
		||||
    if (cod >= from && cod <= to)
 | 
			
		||||
    {
 | 
			
		||||
      c.check(i);
 | 
			
		||||
      c.rec_check(i);
 | 
			
		||||
      nsel ++;         
 | 
			
		||||
      if (firs == 0l) firs = cod;
 | 
			
		||||
      last = cod; 
 | 
			
		||||
    }
 | 
			
		||||
    else c.uncheck(i);
 | 
			
		||||
    
 | 
			
		||||
    else 
 | 
			
		||||
    {
 | 
			
		||||
      c.uncheck(i);
 | 
			
		||||
      c.rec_uncheck(i);
 | 
			
		||||
    }
 | 
			
		||||
    if (cod == from) cod1ok = TRUE; 
 | 
			
		||||
    if (cod == to)   cod2ok = TRUE; 
 | 
			
		||||
  }     
 | 
			
		||||
@ -141,7 +200,7 @@ void TSelection_mask::set_clifo_limits()
 | 
			
		||||
{  
 | 
			
		||||
  long first = 0, last = 0, nsel = 0;
 | 
			
		||||
  
 | 
			
		||||
  TCursor_sheet& c = cur_sheet();
 | 
			
		||||
  TCursor_sheet_recno& c = cur_sheet();
 | 
			
		||||
  const long items = c.items();
 | 
			
		||||
  const int key = get_key();
 | 
			
		||||
  
 | 
			
		||||
@ -172,7 +231,7 @@ bool TSelection_mask::bfrom_handler(TMask_field& f, KEY k)
 | 
			
		||||
  if (k == K_SPACE)
 | 
			
		||||
  {  
 | 
			
		||||
    TSelection_mask& m = (TSelection_mask&)f.mask();
 | 
			
		||||
    TCursor_sheet& c = m.cur_sheet();
 | 
			
		||||
    TCursor_sheet_recno& c = m.cur_sheet();
 | 
			
		||||
    
 | 
			
		||||
    c.disable_check();
 | 
			
		||||
    if (c.run() == K_ENTER)
 | 
			
		||||
@ -192,7 +251,7 @@ bool TSelection_mask::bto_handler(TMask_field& f, KEY k)
 | 
			
		||||
  if (k == K_SPACE)
 | 
			
		||||
  {
 | 
			
		||||
    TSelection_mask& m = (TSelection_mask&)f.mask();
 | 
			
		||||
    TCursor_sheet& c = m.cur_sheet();
 | 
			
		||||
    TCursor_sheet_recno& c = m.cur_sheet();
 | 
			
		||||
    c.disable_check();
 | 
			
		||||
    if (c.run() == K_ENTER)
 | 
			
		||||
    {      
 | 
			
		||||
@ -260,7 +319,7 @@ bool TSelection_mask::bselect_handler(TMask_field& f, KEY k)
 | 
			
		||||
  if (k == K_SPACE)
 | 
			
		||||
  {
 | 
			
		||||
    TSelection_mask& m = (TSelection_mask&)f.mask();
 | 
			
		||||
    TCursor_sheet& c = m.cur_sheet();
 | 
			
		||||
    TCursor_sheet_recno& c = m.cur_sheet();
 | 
			
		||||
    c.enable_check();
 | 
			
		||||
    c.run();
 | 
			
		||||
    m.set_clifo_limits();
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,21 @@
 | 
			
		||||
#include "scselmsk.h"                    
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class TCursor_sheet_recno : public TCursor_sheet
 | 
			
		||||
{
 | 
			
		||||
  TBit_array _recnos;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    virtual bool on_key(KEY k);
 | 
			
		||||
public:    
 | 
			
		||||
  TCursor_sheet_recno(TCursor * cursor, const char* fields,
 | 
			
		||||
            const char * title, const char * head, byte buttons = 0); 
 | 
			
		||||
  virtual ~TCursor_sheet_recno() {}
 | 
			
		||||
  bool rec_checked(TRecnotype n)  { return _recnos[n]; }
 | 
			
		||||
  void rec_check(TRecnotype n, bool on = TRUE) ;
 | 
			
		||||
  void rec_uncheck(TRecnotype n) { rec_check(n,FALSE); }      
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TSelection_mask : public TMask
 | 
			
		||||
{            
 | 
			
		||||
  TRelation*     _clifo_rel;
 | 
			
		||||
@ -25,10 +40,10 @@ class TSelection_mask : public TMask
 | 
			
		||||
  TCursor*       _for_cur_k1;
 | 
			
		||||
  TCursor*       _for_cur_k2;
 | 
			
		||||
 | 
			
		||||
  TCursor_sheet* _cli_sh_k1;
 | 
			
		||||
  TCursor_sheet* _cli_sh_k2;
 | 
			
		||||
  TCursor_sheet* _for_sh_k1;
 | 
			
		||||
  TCursor_sheet* _for_sh_k2;        
 | 
			
		||||
  TCursor_sheet_recno* _cli_sh_k1;
 | 
			
		||||
  TCursor_sheet_recno* _cli_sh_k2;
 | 
			
		||||
  TCursor_sheet_recno* _for_sh_k1;
 | 
			
		||||
  TCursor_sheet_recno* _for_sh_k2;        
 | 
			
		||||
  
 | 
			
		||||
  char           _who;      
 | 
			
		||||
  int            _key;
 | 
			
		||||
@ -43,7 +58,7 @@ protected:
 | 
			
		||||
  void set_who(char w) { _who = w; }
 | 
			
		||||
  void set_key (int  k) { _key  = k; }
 | 
			
		||||
 | 
			
		||||
  void reset_sheets();
 | 
			
		||||
  virtual void reset_sheets();
 | 
			
		||||
 | 
			
		||||
  // handlers
 | 
			
		||||
  static bool bfrom_handler(TMask_field& f, KEY k);
 | 
			
		||||
@ -56,7 +71,7 @@ protected:
 | 
			
		||||
  static bool rsortcf_handler(TMask_field& f, KEY k);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TCursor_sheet& cur_sheet();     
 | 
			
		||||
  virtual TCursor_sheet_recno& cur_sheet();     
 | 
			
		||||
  
 | 
			
		||||
  char get_who() const { return _who; }
 | 
			
		||||
  int get_key() const { return _key; }
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,15 @@
 | 
			
		||||
#define SC_CLIFO     309
 | 
			
		||||
#define SC_SORTCF    310  
 | 
			
		||||
#define SC_NSEL      311  
 | 
			
		||||
#define SC_SORTCFPCON 312  
 | 
			
		||||
#define SC_PCONCODFR1 313
 | 
			
		||||
#define SC_PCONCODFR2 314
 | 
			
		||||
#define SC_PCONCODFR3 315
 | 
			
		||||
#define SC_PCONCODTO1 316
 | 
			
		||||
#define SC_PCONCODTO2 317
 | 
			
		||||
#define SC_PCONCODTO3 318
 | 
			
		||||
#define SC_PCONBUTFR  319
 | 
			
		||||
#define SC_PCONBUTTO  320
 | 
			
		||||
 | 
			
		||||
#define BASE_EC_PROFILE "PEC"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user