Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 848 git-svn-id: svn://10.65.10.50/trunk@14993 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			166 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			166 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <dongle.h>
 | 
						|
#include <recarray.h>
 | 
						|
#include <tabapp.h>
 | 
						|
#include <user.h>
 | 
						|
 | 
						|
#include "vd0.h"
 | 
						|
#include "vdtbopd.h"
 | 
						|
 | 
						|
#define OPDTAB "OPD"
 | 
						|
 | 
						|
#ifndef TTable_application
 | 
						|
#define TTable_application Tab_application
 | 
						|
#endif
 | 
						|
 | 
						|
TTable_application& app() { return (TTable_application&)main_app(); }
 | 
						|
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
// TVendita_dettaglio_tables
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TVendita_dettaglio_tables : public TTable_application
 | 
						|
{
 | 
						|
 | 
						|
protected:
 | 
						|
  virtual TString& get_mask_name(TString& name) const;
 | 
						|
  virtual TMask* set_mask(TMask* m);
 | 
						|
  virtual void init_query_mode(TMask& m);
 | 
						|
  virtual void init_query_insert_mode(TMask& m);
 | 
						|
  virtual void init_insert_mode(TMask& m);
 | 
						|
  virtual void init_modify_mode(TMask& m) { init_insert_mode(m);}
 | 
						|
  virtual bool user_create() ;
 | 
						|
 | 
						|
  virtual int read(TMask& m);
 | 
						|
  virtual int write(const TMask& m);
 | 
						|
  virtual int rewrite(const TMask& m);
 | 
						|
  virtual bool remove();
 | 
						|
  
 | 
						|
  virtual void ini2mask(TConfig& ini, TMask& m, bool query);
 | 
						|
  virtual void mask2ini(const TMask& m, TConfig& ini);
 | 
						|
 | 
						|
public:
 | 
						|
	TVendita_dettaglio_tables() {}
 | 
						|
	virtual ~TVendita_dettaglio_tables() {}
 | 
						|
};
 | 
						|
 | 
						|
TString& TVendita_dettaglio_tables::get_mask_name(TString& name) const
 | 
						|
{
 | 
						|
  name = get_tabname();
 | 
						|
  if (name[0] == '%') name.ltrim(1);
 | 
						|
  name.insert("vdtb", 0);
 | 
						|
  return name;
 | 
						|
}
 | 
						|
 | 
						|
TMask* TVendita_dettaglio_tables::set_mask(TMask* m)
 | 
						|
{
 | 
						|
  if (m == NULL)
 | 
						|
  {
 | 
						|
    const TString& tn = get_tabname();
 | 
						|
    TString name; get_mask_name(name);
 | 
						|
 | 
						|
		m = new TMask(name);
 | 
						|
  }
 | 
						|
  return TTable_application::set_mask(m);
 | 
						|
}
 | 
						|
 | 
						|
bool TVendita_dettaglio_tables::user_create()
 | 
						|
{
 | 
						|
	const TString & tabname = argv(2);
 | 
						|
 | 
						|
	if (tabname == OPDTAB && user() != dongle().administrator())
 | 
						|
		return error_box(FR("L'utente %s non e' abilitato all'esecuzione di questo programma"), (const char*)user());
 | 
						|
	return TTable_application::user_create();
 | 
						|
}
 | 
						|
 | 
						|
void TVendita_dettaglio_tables::init_query_mode(TMask& m)
 | 
						|
{
 | 
						|
	if (get_tabname() == OPDTAB)
 | 
						|
	{
 | 
						|
		m.show(F_USERTAB);
 | 
						|
		m.enable(F_USERTAB);
 | 
						|
		m.hide(F_USER);
 | 
						|
		m.disable(F_USER);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
void TVendita_dettaglio_tables::init_query_insert_mode(TMask& m)
 | 
						|
{
 | 
						|
	if (get_tabname() == OPDTAB)
 | 
						|
	{
 | 
						|
		m.show(F_USER);
 | 
						|
		m.enable(F_USER);
 | 
						|
		m.hide(F_USERTAB);
 | 
						|
		m.disable(F_USERTAB);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
void TVendita_dettaglio_tables::init_insert_mode(TMask& m)
 | 
						|
{
 | 
						|
	if (get_tabname() == OPDTAB)
 | 
						|
	{
 | 
						|
		m.enable_default();
 | 
						|
		const TString & name = cache().get(LF_USER, m.get(F_USERTAB), USR_USERDESC);
 | 
						|
 | 
						|
		m.set(F_USERDESC, name);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
int TVendita_dettaglio_tables::read(TMask& m)
 | 
						|
{
 | 
						|
  const TString& tn = get_tabname();
 | 
						|
  const int err = TTable_application::read(m);
 | 
						|
 | 
						|
  return err;
 | 
						|
}
 | 
						|
 | 
						|
int TVendita_dettaglio_tables::write(const TMask& m)
 | 
						|
{
 | 
						|
  const TString& tn = get_tabname();
 | 
						|
  const int err = TTable_application::write(m);
 | 
						|
 | 
						|
  return err;
 | 
						|
}
 | 
						|
 | 
						|
int TVendita_dettaglio_tables::rewrite(const TMask& m)
 | 
						|
{
 | 
						|
  const TString& tn = get_tabname();
 | 
						|
  const int err = TTable_application::rewrite(m);
 | 
						|
 | 
						|
  return err;
 | 
						|
}
 | 
						|
 | 
						|
bool TVendita_dettaglio_tables::remove()
 | 
						|
{
 | 
						|
  const bool ok = TTable_application::remove();
 | 
						|
 | 
						|
  return ok;
 | 
						|
}
 | 
						|
 | 
						|
void TVendita_dettaglio_tables::ini2mask(TConfig& ini, TMask& m, bool query)
 | 
						|
{
 | 
						|
  TTable_application::ini2mask(ini, m, query);
 | 
						|
}
 | 
						|
 | 
						|
void TVendita_dettaglio_tables::mask2ini(const TMask& m, TConfig& ini)
 | 
						|
{
 | 
						|
  TTable_application::mask2ini(m, ini);
 | 
						|
}
 | 
						|
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
// Main
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
 | 
						|
int vd0100(int argc, char* argv[])
 | 
						|
{
 | 
						|
  if (argc > 2)
 | 
						|
  {
 | 
						|
    TString name;
 | 
						|
    name << TR("Tabella ") << argv[2];
 | 
						|
    TVendita_dettaglio_tables a;
 | 
						|
    a.run(argc, argv, name);
 | 
						|
  }
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
 |