Files correlati : mg4.exe mg4300.msk mg4300.frm Ricompilazione Demo : [ ] Commento : Corretta stampa registro di magazzino in definitiva git-svn-id: svn://10.65.10.50/branches/R_10_00@21033 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			91 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
// **************************************
 | 
						|
// **************************************
 | 
						|
// **************************************
 | 
						|
// *** classi per la libreria 
 | 
						|
// ***
 | 
						|
//*****
 | 
						|
#include <diction.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include "mglib.h"
 | 
						|
 | 
						|
 | 
						|
// ************************************************
 | 
						|
// TEMP!!!!!!!!!!!!!!!!
 | 
						|
 | 
						|
TRegistro_std::TRegistro_std(const char* cod, int year) : TRectype(LF_TAB)
 | 
						|
{
 | 
						|
  if (!read(cod, year))
 | 
						|
    fatal_box(TR("Il codice richiesto non è stato trovato nei registri"));
 | 
						|
  TTable itl("%ITL");
 | 
						|
  itl.put("CODTAB",cod_intest());
 | 
						|
  itl.read();
 | 
						|
  _intest=itl.get("S0");
 | 
						|
}
 | 
						|
 | 
						|
bool TRegistro_std::read(const char* cod, int year)
 | 
						|
{               
 | 
						|
  if (year <= 0) 
 | 
						|
  {
 | 
						|
    const TDate oggi(TODAY);
 | 
						|
    year = oggi.year();
 | 
						|
  }
 | 
						|
 | 
						|
  int err = ~NOERR;
 | 
						|
  
 | 
						|
  TTable reg("REG");
 | 
						|
  reg.setkey(1);
 | 
						|
  if (cod && *cod > ' ')
 | 
						|
  {
 | 
						|
    TString16 chiave; chiave.format("%04d%s", year, cod);
 | 
						|
    reg.put("CODTAB", chiave);
 | 
						|
    err = reg.read(); 
 | 
						|
  }
 | 
						|
  *((TRectype *)this) = reg.curr();
 | 
						|
  
 | 
						|
  return err == NOERR;
 | 
						|
}           
 | 
						|
 | 
						|
bool TRegistro_std::write(bool rewrite) const 
 | 
						|
{               
 | 
						|
  int err = ~NOERR;
 | 
						|
  TTable reg("REG");
 | 
						|
  if (rewrite)
 | 
						|
    err = reg.rewrite_write(*this); 
 | 
						|
  else
 | 
						|
    err = reg.write(*this); 
 | 
						|
  return err == NOERR;
 | 
						|
}           
 | 
						|
 | 
						|
 | 
						|
 | 
						|
int TRegistro_std::year() const 
 | 
						|
{                
 | 
						|
  TString16 anno(get("CODTAB")); 
 | 
						|
  anno.cut(4);
 | 
						|
  return atoi(anno);
 | 
						|
}   
 | 
						|
 | 
						|
 | 
						|
const TString& TRegistro_std::code() const 
 | 
						|
{ 
 | 
						|
  return get("CODTAB").mid(4);
 | 
						|
}
 | 
						|
 | 
						|
const TString TRegistro_std::intest() const
 | 
						|
{
 | 
						|
  return _intest;
 | 
						|
}
 | 
						|
 | 
						|
int TRegistro_std::lock()
 | 
						|
{
 | 
						|
  TTable reg("REG");
 | 
						|
  reg.put("CODTAB",this->get("CODTAB"));
 | 
						|
  return reg.read(_lock); 
 | 
						|
}
 | 
						|
 | 
						|
int TRegistro_std::unlock()
 | 
						|
{
 | 
						|
  TTable reg("REG");
 | 
						|
  reg.put("CODTAB",this->get("CODTAB"));
 | 
						|
  return reg.read(_unlock); 
 | 
						|
} |