Files correlati : Ricompilazione Demo : [ ] Commento : Tolte chiamate residue a os_dep.h Aggiunta la possibilita' di arrotondare le quantita' in base all'unita' di misura git-svn-id: svn://10.65.10.50/trunk@11028 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			123 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			123 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <automask.h>
 | 
						|
#include <printer.h>
 | 
						|
#include <tabapp.h>
 | 
						|
 | 
						|
#include "vetbnum.h"
 | 
						|
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
// TVendite_mask
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TVendite_mask : public TAutomask
 | 
						|
{
 | 
						|
  TString _tab;  // Voglio la tabella sempre sotto mano
 | 
						|
 | 
						|
protected:
 | 
						|
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
						|
 | 
						|
  bool is_table(const char* tab) const { return _tab == tab; }
 | 
						|
  
 | 
						|
  void get_printer_config(TString& name) const;
 | 
						|
  bool get_printer_name(TString& name) const;
 | 
						|
  void reset_printer_config() const;
 | 
						|
 | 
						|
  bool on_num_event(TOperable_field& o, TField_event e, long jolly);
 | 
						|
 | 
						|
public:
 | 
						|
  TVendite_mask(const char* name);
 | 
						|
  virtual ~TVendite_mask() { }
 | 
						|
};
 | 
						|
 | 
						|
void TVendite_mask::get_printer_config(TString& config) const
 | 
						|
{
 | 
						|
  config = _tab;  
 | 
						|
  for (TEditable_field* f = get_key_field(1, TRUE); f; 
 | 
						|
       f = get_key_field(1, FALSE)) if (f->shown())
 | 
						|
    config << f->get();
 | 
						|
}
 | 
						|
 | 
						|
bool TVendite_mask::get_printer_name(TString& name) const
 | 
						|
{
 | 
						|
  TString config; get_printer_config(config);  
 | 
						|
  TConfig ini(CONFIG_STAMPE, config);              
 | 
						|
  name = ini.get("Name");
 | 
						|
  return name.not_empty();
 | 
						|
}
 | 
						|
 | 
						|
void TVendite_mask::reset_printer_config() const
 | 
						|
{
 | 
						|
  TString16 config; get_printer_config(config);  
 | 
						|
  TConfig ini(CONFIG_STAMPE, config);              
 | 
						|
  ini.remove_all();
 | 
						|
}
 | 
						|
 | 
						|
bool TVendite_mask::on_num_event(TOperable_field& o, TField_event e, long jolly)
 | 
						|
{
 | 
						|
  switch(o.dlg())
 | 
						|
  {
 | 
						|
  case NUM_DEFPRINTER:
 | 
						|
    if (e == fe_button && !query_mode())
 | 
						|
    {
 | 
						|
      TPrinter& pr = printer();
 | 
						|
      TString16 config; get_printer_config(config);
 | 
						|
      pr.read_configuration(config);
 | 
						|
      pr.set();
 | 
						|
      e = fe_init;
 | 
						|
    }
 | 
						|
    if (e == fe_init)
 | 
						|
    {
 | 
						|
      TString name; get_printer_name(name);
 | 
						|
      o.set(name);
 | 
						|
    }
 | 
						|
    if (e == fe_close && o.empty())
 | 
						|
      reset_printer_config();
 | 
						|
    break;
 | 
						|
  default: 
 | 
						|
    break;
 | 
						|
  }
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TVendite_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
						|
{
 | 
						|
  if (is_table("NUM"))
 | 
						|
    return on_num_event(o, e, jolly);
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
TVendite_mask::TVendite_mask(const char* name) : TAutomask(name) 
 | 
						|
{ 
 | 
						|
  const TFixed_string n(name);
 | 
						|
  _tab = n.mid(4,3);
 | 
						|
  _tab.upper();
 | 
						|
}
 | 
						|
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
// TVendite_tabapp
 | 
						|
///////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TVendite_tabapp : public TTable_application
 | 
						|
{
 | 
						|
protected:
 | 
						|
  virtual TMask* set_mask(TMask* m);
 | 
						|
 | 
						|
public:
 | 
						|
};
 | 
						|
 | 
						|
TMask* TVendite_tabapp::set_mask(TMask* m)
 | 
						|
{
 | 
						|
  if (m == NULL)
 | 
						|
  {
 | 
						|
    TFilename mn; get_mask_name(mn);
 | 
						|
    m = new TVendite_mask(mn);
 | 
						|
  }
 | 
						|
  return TTable_application::set_mask(m);
 | 
						|
}
 | 
						|
 | 
						|
int ve0400(int argc, char* argv[])
 | 
						|
{
 | 
						|
  TVendite_tabapp vta;
 | 
						|
  vta.run(argc, argv, "Tabella Vendite");
 | 
						|
  return 0;
 | 
						|
}
 |