612 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			612 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
// *******************************
 | 
						|
// LIBRERIA  di magazzino 
 | 
						|
// *******************************
 | 
						|
#ifndef __MGLIB_H 
 | 
						|
#define __MGLIB_H
 | 
						|
 | 
						|
#ifndef __RELATION_H
 | 
						|
#include <relation.h>
 | 
						|
#endif
 | 
						|
#ifndef __RECARRAY_H
 | 
						|
#include <recarray.h>
 | 
						|
#endif          
 | 
						|
#ifndef __VARREC_H
 | 
						|
#include <varrec.h>
 | 
						|
#endif
 | 
						|
#ifndef __MSKSHEET_H
 | 
						|
#include <msksheet.h>
 | 
						|
#endif
 | 
						|
#ifndef __FORM_H 
 | 
						|
#include "form.h"
 | 
						|
#endif
 | 
						|
#ifndef __ANAMAG_H 
 | 
						|
#include "anamag.h" 
 | 
						|
#endif
 | 
						|
#ifndef __UMART_H 
 | 
						|
#include "umart.h"
 | 
						|
#endif
 | 
						|
#ifndef __CODCORR_H 
 | 
						|
#include "codcorr.h"
 | 
						|
#endif
 | 
						|
#ifndef __DESLIN_H 
 | 
						|
#include "deslin.h"
 | 
						|
#endif
 | 
						|
#ifndef __MAG_H 
 | 
						|
#include "mag.h"
 | 
						|
#endif
 | 
						|
#ifndef __STOMAG_H 
 | 
						|
#include "stomag.h"
 | 
						|
#endif
 | 
						|
 | 
						|
#include <multirec.h> 
 | 
						|
 | 
						|
#include "..\cg\cglib.h"
 | 
						|
 | 
						|
/*class TMultiple_rectype ;
 | 
						|
//**************************************
 | 
						|
// classe per il controllo dei record composti da una testata e N file di righe
 | 
						|
// è implementato come un TRectype che contiene anche un TRecord_array
 | 
						|
//
 | 
						|
class TMultiple_rectype : public TAuto_variable_rectype
 | 
						|
{     
 | 
						|
  enum { maxfiles = 20};
 | 
						|
  // @ cmember Array di TRecord array per le righe 
 | 
						|
  TArray _files;  // 
 | 
						|
  // @ cmember flag indicatore  di record nuovo
 | 
						|
  bool _nuovo;
 | 
						|
  // @ cmember numero di file righe  
 | 
						|
  short _nfiles;    
 | 
						|
  // @ cmember file delle righe
 | 
						|
  int _logicnums[maxfiles];   
 | 
						|
  // @ cmember Array di nomi di campo "numeratore" delle righe
 | 
						|
  TString_array _numfields;   
 | 
						|
 | 
						|
protected:                                           
 | 
						|
  const TArray & files() const { return _files;}
 | 
						|
  // @ cmember funzione per costruire la chiave delle righe
 | 
						|
  virtual void set_body_key(TRectype & rowrec) pure; 
 | 
						|
  // @ cmember renumber la chiave del corpo
 | 
						|
  virtual long renum(long numdoc = -1) { return -1; }
 | 
						|
  virtual TRectype & get_body_record(int logicnum = 0) { return *(new TRectype(logicnum ? logicnum : _logicnums[0])); }
 | 
						|
  virtual void load_rows_file(int logicnum);
 | 
						|
  // @cmember Ritorna l'indice di <p _files> del numero logico passato
 | 
						|
  int log2ind(int logicnum) const;
 | 
						|
  virtual int find(int logicnum, const char * fieldname, const char * s, int from = 0, bool reverse = FALSE) const ;
 | 
						|
  virtual int write_rewrite(TBaseisamfile& f, bool re = FALSE) const;
 | 
						|
  void remove_body(int logicnum);
 | 
						|
  
 | 
						|
public:
 | 
						|
  //***********************
 | 
						|
  // struttura
 | 
						|
  // @ cmember restituisce il record di testata
 | 
						|
  const TAuto_variable_rectype& head() const { return *this; } // Ritorna la testata del documento
 | 
						|
  // @ cmember restituisce il record di testata
 | 
						|
  TAuto_variable_rectype& head() { return *this; } // Ritorna la testata del documento
 | 
						|
  
 | 
						|
  
 | 
						|
  // @ cmember restituisce il record array del corpo
 | 
						|
  TRecord_array & body(int logicnum = 0) const;
 | 
						|
  // @ cmember restituisce il numero di record nel corpo
 | 
						|
  int rows(int logicnum = 0) const { return body(logicnum).rows(); } 
 | 
						|
  
 | 
						|
   // @ cmember restituisce il record n-esimo del del corpo
 | 
						|
  virtual const TRecord_array & operator[](int logicnum) const { return (const TRecord_array &)((TMultiple_rectype *)this)->body(logicnum); }
 | 
						|
  // @ cmember restituisce il record n-esimo del del corpo
 | 
						|
  virtual TRecord_array & operator[](int logicnum) { return (TRecord_array &)body(logicnum); } 
 | 
						|
  
 | 
						|
  bool destroy_row(int n, bool pack = FALSE, int logicnum = 0) { return body(logicnum).destroy_row(n, pack); }
 | 
						|
  void destroy_rows(int logicnum = 0) { body(logicnum).destroy_rows(); }
 | 
						|
  
 | 
						|
  //***********************
 | 
						|
  // record e I/O
 | 
						|
  virtual void dirty_fields() {}
 | 
						|
  virtual void set_fields(TAuto_variable_rectype & rec) {}
 | 
						|
  virtual void reset_fields(TAuto_variable_rectype & rec) { rec.remove_field(); }
 | 
						|
 | 
						|
  virtual void renum_key(const char * kfield,const char * val);
 | 
						|
  virtual TRectype & operator =(const TRectype & r); 
 | 
						|
  virtual TRectype & operator =(const char * r); 
 | 
						|
  virtual void zero(char c = '\0');
 | 
						|
 | 
						|
  virtual int read(TRectype & rec, word op = _isequal, word lockop = _nolock);
 | 
						|
  virtual int read(word op = _isequal, word lockop = _nolock) { return read(*this, op, lockop); }
 | 
						|
  int read(TBaseisamfile & f, word op = _isequal, word lockop = _nolock) { return read(f.curr(), op, lockop); }
 | 
						|
  
 | 
						|
  virtual int write(TBaseisamfile& f) const
 | 
						|
    { return write_rewrite(f);}
 | 
						|
  virtual int rewrite(TBaseisamfile& f) const
 | 
						|
    { return write_rewrite(f,TRUE);}
 | 
						|
  virtual int remove(TBaseisamfile& f) const;
 | 
						|
 | 
						|
  int write() const { TBaseisamfile f(num()); return write(f);}
 | 
						|
  int rewrite() const { TBaseisamfile f(num()); return rewrite(f);}
 | 
						|
  int remove() const { TBaseisamfile f(num()); return remove(f);}
 | 
						|
                                     
 | 
						|
                                     
 | 
						|
  void add_file(int logicnum, const char * numfield);
 | 
						|
  //**************************
 | 
						|
  // @ cmember costruttore dal numero del file 
 | 
						|
  TMultiple_rectype(int hfn);
 | 
						|
  // @ cmember costruttore dal file 
 | 
						|
  TMultiple_rectype(const TBaseisamfile* file);
 | 
						|
  // @ cmember costruttore dal record 
 | 
						|
  TMultiple_rectype(const TRectype & rec);
 | 
						|
  // @ cmember costruttore di copia 
 | 
						|
  TMultiple_rectype(const TMultiple_rectype& r);
 | 
						|
  virtual ~TMultiple_rectype() {}
 | 
						|
};
 | 
						|
 | 
						|
*/
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
char * Nome_valorizz[];
 | 
						|
 | 
						|
typedef enum  {
 | 
						|
  valorizz_ultcos , valorizz_mediacos , valorizz_przlist , 
 | 
						|
  valorizz_coststd , valorizz_costmedio ,
 | 
						|
  valorizz_FIFOa  , valorizz_LIFOa  , 
 | 
						|
  valorizz_FIFO , valorizz_LIFO,
 | 
						|
  valorizz_FIFOr , valorizz_LIFOr
 | 
						|
} TTipo_valorizz;
 | 
						|
 | 
						|
class TArticolo : public TMultiple_rectype
 | 
						|
{          
 | 
						|
  TRecfield * _codice;                             
 | 
						|
 | 
						|
protected:
 | 
						|
  virtual const TString & get_str(const char* fieldname) const ;
 | 
						|
  virtual void set_body_key(TRectype & rowrec); 
 | 
						|
 | 
						|
public:
 | 
						|
 | 
						|
  virtual int read(const char * cod, word op = _isequal, word lockop = _nolock);
 | 
						|
  virtual int read(TRectype & rec, word op = _isequal, word lockop = _nolock) { return read( rec.get(ANAMAG_CODART), op, lockop); }
 | 
						|
 | 
						|
  TObject* dup() const { return new TArticolo(codice()); }
 | 
						|
 | 
						|
  const TString codice() const { return (const char *) *_codice;}  
 | 
						|
  const TString& descrizione(const char * lingua = NULL) const;
 | 
						|
 | 
						|
  bool unlock() ;
 | 
						|
  bool lock_and_prompt() ;
 | 
						|
  void update_ultcosti(real costo,TDate data) ;
 | 
						|
 | 
						|
  int find_um(const char * um, int from = 0) const { return find(LF_UMART, UMART_UM, um, from); }
 | 
						|
  int find_deslin(const char * deslin, int from = 0) const { return find(LF_DESLIN, DESLIN_CODLIN, deslin, from); }
 | 
						|
  int find_codcorr(const char * codcorr, int from = 0) const { return find(LF_CODCORR, CODCORR_CODARTALT, codcorr, from); }
 | 
						|
  TRecord_array & um() const { return body(LF_UMART); }
 | 
						|
  TRecord_array & deslin() const { return body(LF_DESLIN); }
 | 
						|
  TRecord_array & codcorr() const { return body(LF_CODCORR); }
 | 
						|
 | 
						|
  TArticolo(const char* codice = NULL);
 | 
						|
  TArticolo(const TRectype& rec);
 | 
						|
  virtual ~TArticolo();
 | 
						|
};  
 | 
						|
 | 
						|
class TArticolo_giacenza : public TArticolo
 | 
						|
{          
 | 
						|
  TString16 _anno_mag;
 | 
						|
  TString16 _anno_sto;
 | 
						|
  
 | 
						|
protected:
 | 
						|
  virtual const TString & get_str(const char* fieldname) const ;
 | 
						|
  virtual void set_body_key(TRectype & rowrec);
 | 
						|
  void set_anno_mag (const char * anno = NULL);
 | 
						|
  void set_anno_sto (const char * anno = NULL);
 | 
						|
  void reset_anno_mag () { set_anno_mag();}
 | 
						|
  void reset_anno_sto () { set_anno_sto();}
 | 
						|
 | 
						|
public:
 | 
						|
 | 
						|
  TObject* dup() const { return new TArticolo_giacenza(codice()); }
 | 
						|
  virtual void zero(char c = '\0');
 | 
						|
 | 
						|
  int find_mag(const char * annoes, const char * codmag = NULL, const char * livello = NULL, int from = 0) const ;
 | 
						|
  int find_storico(const char * annoesrif, const char * annoes = NULL, int from = 0) const;
 | 
						|
  TRecord_array & mag(const char * annoes) const;
 | 
						|
  TRecord_array & storico(const char * annoesrif) const;
 | 
						|
 | 
						|
  real ultimo_costo(const char * annoes) const;
 | 
						|
  real media_costi(const char * annoes) const;
 | 
						|
  real prezzo_listino(const char * annoes, const char * catven ,const char * codlist) const;
 | 
						|
  real costo_standard(const char * annoes) const;
 | 
						|
  real costo_medio(const char * annoes, const char * codmag, const char * livello) const; 
 | 
						|
  real LIFO_annuale(const char * annoes, const char * codmag, const char * livello,
 | 
						|
                    bool giacenza_effettiva = TRUE, bool valorizza_componenti = TRUE) const;
 | 
						|
  real FIFO_annuale(const char * annoes, const char * codmag, const char * livello,
 | 
						|
                    bool giacenza_effettiva = TRUE, bool valorizza_componenti = TRUE) const;
 | 
						|
  real LIFO(const char * annoes, const char * codmag, const char * livello,
 | 
						|
            bool giacenza_effettiva = TRUE, bool valorizza_componenti = TRUE) const;
 | 
						|
  real FIFO(const char * annoes, const char * codmag, const char * livello,
 | 
						|
            bool giacenza_effettiva = TRUE, bool valorizza_componenti = TRUE) const;
 | 
						|
  real LIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
 | 
						|
                            bool giacenza_effettiva = TRUE, bool valorizza_componenti = TRUE) const;
 | 
						|
  real FIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
 | 
						|
                            bool giacenza_effettiva = TRUE, bool valorizza_componenti = TRUE) const;
 | 
						|
                              
 | 
						|
  TArticolo_giacenza(const char* codice = NULL);
 | 
						|
  TArticolo_giacenza(const TRectype& rec);
 | 
						|
  virtual ~TArticolo_giacenza() {}
 | 
						|
};  
 | 
						|
 | 
						|
class THead_lines_record ;
 | 
						|
//**************************************
 | 
						|
// classe per il controllo dei record composti da una testata e N righe
 | 
						|
// è implementato come un TRectype che contiene anche un TRecord_array
 | 
						|
//
 | 
						|
class THead_lines_record : public TAuto_variable_rectype {
 | 
						|
 | 
						|
  // @ cmember Array di TRectype per le righe 
 | 
						|
  TRecord_array * _rows;  // 
 | 
						|
  // @ cmember flag indicatore  di record nuovo
 | 
						|
  bool _nuovo;
 | 
						|
  // @ cmember file principale  
 | 
						|
  int _file;    
 | 
						|
  // @ cmember file delle righe
 | 
						|
  int _rfile;   
 | 
						|
  // @ cmember nome del campo "numeratore" delle righe
 | 
						|
  TString _numfield; 
 | 
						|
 | 
						|
 | 
						|
protected:
 | 
						|
  // @ cmember restituisce la riga del corpo
 | 
						|
  virtual TRectype & row(int index) const;  
 | 
						|
  virtual void put_str(const char* fieldname, const char* val); 
 | 
						|
  // @ cmember funzione per estrarre dal record della testata la chiave delle righe
 | 
						|
  virtual void copy_linekey(const TRectype & headrecord, TRectype & linesrecord)=0; 
 | 
						|
  // @ cmember renumer la chiave del corpo
 | 
						|
  virtual long renum(long numdoc=-1)=0; 
 | 
						|
 | 
						|
  int write_rewrite(TBaseisamfile& f ,bool re = FALSE) const ;
 | 
						|
public:
 | 
						|
  //***********************
 | 
						|
  // struttura
 | 
						|
  // @ cmember restituisce il record di testata
 | 
						|
  const TAuto_variable_rectype& head() const { return *this; } // Ritorna la testata del documento
 | 
						|
  // @ cmember restituisce il record di testata
 | 
						|
  TAuto_variable_rectype& head() { return *this; } // Ritorna la testata del documento
 | 
						|
 | 
						|
  // @ cmember restituisce il numero di record nel corpo
 | 
						|
  int rows() const { return _rows->rows(); } 
 | 
						|
  // @ cmember restituisce il record array del corpo
 | 
						|
  TRecord_array * rows_record() { return _rows; } 
 | 
						|
  
 | 
						|
  // @ cmember restituisce il record n-esimo del del corpo
 | 
						|
  virtual const TRectype& operator[](int index) const 
 | 
						|
    { return (const TRectype&)((THead_lines_record *)this)->row(index); }
 | 
						|
  // @ cmember restituisce il record n-esimo del del corpo
 | 
						|
  virtual TRectype& operator[](int index) 
 | 
						|
    { return (TRectype&)row(index); } 
 | 
						|
  
 | 
						|
  TRectype & insert_row(int row, const char *tipo = NULL);
 | 
						|
  TRectype & new_row(const char *tipo = NULL);
 | 
						|
  bool destroy_row(int n, bool pack = FALSE) { return _rows->destroy_row(n, pack); }
 | 
						|
  void destroy_rows() { _rows->destroy_rows(); }
 | 
						|
  
 | 
						|
  //***********************
 | 
						|
  // record e I/O
 | 
						|
  virtual void dirty_fields();
 | 
						|
 | 
						|
  virtual const char *get_next_key() =0 ;
 | 
						|
  virtual void renum_key(const char * kfield,const char * val);
 | 
						|
  virtual TRectype & operator =(const TRectype & r); 
 | 
						|
  virtual TRectype & operator =(const char * r); 
 | 
						|
  virtual void zero(const char * fieldname);
 | 
						|
  virtual void zero(char c = '\0');
 | 
						|
 | 
						|
  void reset_fields(TAuto_variable_rectype & rec) { rec.remove_field(); }
 | 
						|
  virtual void set_fields(TAuto_variable_rectype & rec);
 | 
						|
    
 | 
						|
  virtual int readat(TBaseisamfile& f, TRecnotype nrec, word lockop= _nolock);
 | 
						|
  virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock);
 | 
						|
  
 | 
						|
  virtual int write(TBaseisamfile& f) const ;
 | 
						|
  virtual int rewrite(TBaseisamfile& f) const ;
 | 
						|
  virtual int remove(TBaseisamfile& f) const ;
 | 
						|
 | 
						|
  //**************************
 | 
						|
  // @ cmember costruttore dal numero del file 
 | 
						|
  THead_lines_record(int hfn, int rfn,const char *numfield);
 | 
						|
  // @ cmember costruttore dal file 
 | 
						|
  THead_lines_record(const TBaseisamfile* head_file,int rfn,const char *numfield);
 | 
						|
  // @ cmember costruttore dal record 
 | 
						|
  THead_lines_record(const TRectype & r,int rfn,const char *numfield);
 | 
						|
  // @ cmember costruttore di copia 
 | 
						|
  THead_lines_record(const THead_lines_record& r);
 | 
						|
  virtual ~THead_lines_record();
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
// **************************************
 | 
						|
// **************************************
 | 
						|
// **************************************
 | 
						|
// fine classi da portare in libreria:
 | 
						|
 | 
						|
// *******************************
 | 
						|
// LIBRERIA DI utility del magazzino
 | 
						|
// *******************************
 | 
						|
//#include "..\ve\velib03.h"
 | 
						|
 | 
						|
 | 
						|
#define MANY_MAG_LEV 10
 | 
						|
#define MAX_GIAC_LEVEL 4
 | 
						|
class TMag_livelli {
 | 
						|
  bool        _enabled[MANY_MAG_LEV];
 | 
						|
  int         _code_lenght[MANY_MAG_LEV];
 | 
						|
  TString     _name[MANY_MAG_LEV];
 | 
						|
  TString     _picture[MANY_MAG_LEV];
 | 
						|
  int _last_level;
 | 
						|
    
 | 
						|
public:
 | 
						|
  int last_level() const {return _last_level;}; // Ritorna il numero di livelli abilitati
 | 
						|
  const bool enabled(int levnum=1); // Ritorna se il livello è abilitato
 | 
						|
  const TString & name(int levnum);   // Ritorna il nome (descrizione) di quel livello
 | 
						|
  const TString & picture(int levnum);// Ritorna la stringa di picture per i codici gruppo di quel livello
 | 
						|
  const int code_lenght(int levnum);      // Ritorna la lunghezza dei codici gruppo di quel livello
 | 
						|
  const int packed_lenght(int levnum);    // Ritorna la lunghezza del codice compatto fino a quel livello
 | 
						|
  
 | 
						|
  void pack_grpcode(TString & pc, const TString &codlev, const int levnum);     // Inserisce il codice del gruppo del livello levnum in pc
 | 
						|
  TString unpack_grpcode(const TString & pc, const int levnum);     // Estrae il codice del gruppo del livello levnum da pc
 | 
						|
  TString build_tabcode(const TString & pc, const int levnum);
 | 
						|
 | 
						|
  TMag_livelli(const char *tabname);  // costruttore
 | 
						|
  ~TMag_livelli() {}; // distruttore
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
 | 
						|
// *******************************
 | 
						|
// *******************************
 | 
						|
// riconoscimento di metacaratteri
 | 
						|
class TR_automa;
 | 
						|
class TMetachar {
 | 
						|
  TR_automa * _au;
 | 
						|
  TString _language;
 | 
						|
  char _metach_mand[10];
 | 
						|
  char _metach_opz[10];
 | 
						|
 | 
						|
  void set_language(const char * language); // setta l'automa che ricosce il linguaggio passato
 | 
						|
  void add_tran(int statenum,unsigned char symbol,int next);// aggiunge le transizioni all'automa
 | 
						|
public:
 | 
						|
  const char * language() const;  // restituisce la stringa di metacaratteri del linguaggio riconosciuto
 | 
						|
  bool recognized(const char * pattern);
 | 
						|
 | 
						|
  bool has_opzchars(const char * pattern);
 | 
						|
  bool has_mandchars(const char * pattern);
 | 
						|
 | 
						|
  int maxstrlen(const char * pattern) const;
 | 
						|
  const char *mand_chars() {return _metach_mand;};   
 | 
						|
  const char *opz_chars() {return _metach_opz;};     
 | 
						|
  TMetachar(const char * str);
 | 
						|
  TMetachar();
 | 
						|
  ~TMetachar();
 | 
						|
};
 | 
						|
  
 | 
						|
// *********************
 | 
						|
// classe che incapsula le causali di magazzino (record della tabella CAU)
 | 
						|
typedef enum  {
 | 
						|
  s_giac,
 | 
						|
  s_acq,s_ent,
 | 
						|
  s_ven,s_usc,
 | 
						|
  s_ordc,s_ordf,
 | 
						|
  s_acl,s_incl,
 | 
						|
  s_prodc,s_prodf,
 | 
						|
  s_rim,
 | 
						|
  s_scart,
 | 
						|
  s_label
 | 
						|
} TTipo_saldomag; 
 | 
						|
 | 
						|
class TCausale_magazzino : public TRectype {
 | 
						|
public:
 | 
						|
  const char * get_codice() {return get("CODTAB");}
 | 
						|
  const char * get_descr() {return get("S0");}
 | 
						|
  const char get_tipoprz() {return get_char("S6");}
 | 
						|
  const char get_tipomov() {return get_char("S7");}
 | 
						|
  const char * get_raggfisc() {return get("S8");}
 | 
						|
  const char * get_collegata() {return get("S9");}
 | 
						|
  int sgn(TTipo_saldomag fieldname) ;
 | 
						|
  TCausale_magazzino(const char * codice);
 | 
						|
  ~TCausale_magazzino();
 | 
						|
};
 | 
						|
 | 
						|
class TLine_movmag ; // convenience...
 | 
						|
 | 
						|
// dati della linea di movimento di magazzino
 | 
						|
class TLine_movmag : public TObject {
 | 
						|
public: 
 | 
						|
  TString16 um;
 | 
						|
  real quant;
 | 
						|
  real prezzo;
 | 
						|
  int operator==(TLine_movmag &);
 | 
						|
  
 | 
						|
  virtual TObject* dup() const {return new TLine_movmag(*this);};
 | 
						|
  
 | 
						|
  TLine_movmag() {}; 
 | 
						|
  TLine_movmag(const TLine_movmag &); 
 | 
						|
  virtual ~TLine_movmag() {}; 
 | 
						|
};
 | 
						|
 | 
						|
// classe per la definizione dei movimenti di magazzino
 | 
						|
// ( un movimento (testata+righe) == un oggetto TMov_mag )
 | 
						|
class TMov_mag : public TMultiple_rectype {
 | 
						|
 | 
						|
  // 
 | 
						|
  TString16 _codcaus;
 | 
						|
  TString16 _annoes;
 | 
						|
  // 
 | 
						|
  TString16 _nextcod;
 | 
						|
  // 
 | 
						|
  TAssoc_array lines_to_add;  
 | 
						|
  TAssoc_array lines_to_subtract; 
 | 
						|
 | 
						|
protected:
 | 
						|
  virtual void set_body_key(TRectype & rowrec);
 | 
						|
  virtual bool renum(); // rinumerazione ;
 | 
						|
 | 
						|
  // ************ gestione saldi
 | 
						|
  // @member: compone le parti chiave + dati a partire dalla riga dello sheet
 | 
						|
  void line2key_data(int numriga, TToken_string &key,TLine_movmag &rest) const;
 | 
						|
  // @member: compone la chiave a partire dalla riga dello sheet
 | 
						|
  TToken_string line2key(int numriga) const;
 | 
						|
  // @member: compone la dati a partire dalla riga dello sheet
 | 
						|
  TLine_movmag line2data(int numriga) const;
 | 
						|
  // @member: estrae dalla Tokenstring della chiave i valori corrispondenti ai campi del file
 | 
						|
  static TString key2field(TToken_string &key,const char * f);
 | 
						|
  // @member: memorizza la linea come "da togliere"
 | 
						|
  int delete_line(TToken_string &key,TLine_movmag &rest);
 | 
						|
  // @member: memorizza la linea come "da aggiungere"
 | 
						|
  int insert_line(TToken_string &key,TLine_movmag &rest);
 | 
						|
  // @member: effettua l'aggiornamento dei saldi relativi alle giacenze interessate al movimento
 | 
						|
  int update_balances() const;
 | 
						|
  // @member: effettua l'aggiornamento dei saldi di una giacenza
 | 
						|
  int update_balances(TRectype & magrec, const TLine_movmag &l,TString16 codcaus,int sign) const;
 | 
						|
  // @member: effettua l'aggiornamento di un saldo di una giacenza
 | 
						|
  void update_balance(TRectype & magrec, const char * fieldname, real diff) const;
 | 
						|
 | 
						|
  static void giac_putkey(TLocalisamfile & mag,TString16 annoes,TToken_string curr_key);
 | 
						|
  static bool lock_anamag(const char *codart);
 | 
						|
  static bool unlock_anamag(const char *codart) ;
 | 
						|
 | 
						|
public:
 | 
						|
// IO ad alto livello
 | 
						|
  const char *get_next_key() ;
 | 
						|
  virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock);
 | 
						|
  virtual int remove(TBaseisamfile& f) const ;
 | 
						|
  virtual int write(TBaseisamfile& f) const ;
 | 
						|
  virtual int rewrite(TBaseisamfile& f) const ;
 | 
						|
  int force_update_bal();
 | 
						|
  
 | 
						|
  //
 | 
						|
  int codice_esercizio(TDate &d);
 | 
						|
  // costruttori e distruttori
 | 
						|
  TMov_mag();
 | 
						|
  virtual ~TMov_mag();
 | 
						|
  
 | 
						|
};
 | 
						|
 | 
						|
bool rebuild_balances(TString16 annoes, bool reset_giac=FALSE);
 | 
						|
 | 
						|
#define FORM_MAXGIACLEV 4 // numero di livelli giacenza nel form
 | 
						|
#define FORM_MAXARTLEV 8 // numero di livelli codice nel form
 | 
						|
#define UNKNOWN_NAME "-"
 | 
						|
 | 
						|
class TForm_stampemg : public TForm 
 | 
						|
{
 | 
						|
  bool _permag;
 | 
						|
  int _fromlivgiac,_tolivgiac,_fromlivart,_tolivart;
 | 
						|
  bool _sottocatmer;
 | 
						|
  TMag_livelli * _giaclev,*_artlev;
 | 
						|
  TDecoder *_giacgrp,*_artgrp;
 | 
						|
  bool setdettaglio(bool show, int fromlivart,int livart,int fromlivgiac,int livgiac,bool dettgiac);
 | 
						|
  void add_giaclev(TString &levname);
 | 
						|
 | 
						|
public:
 | 
						|
  void gruppogiac(TForm_item &cf, TToken_string &s);
 | 
						|
  void gruppoart(TForm_item &cf, TToken_string &s);
 | 
						|
  bool validate(TForm_item &cf, TToken_string &s);
 | 
						|
  void setcatmer(bool catmer,bool sottoc=FALSE);
 | 
						|
  bool setdett_perart(int fromlivart,int livart,int fromlivgiac,int livgiac,bool showmag, bool showdep);
 | 
						|
  bool setdett_permag(int fromlivart,int livart,int fromlivgiac,int livgiac,bool showmag, bool showdep,bool showdett);
 | 
						|
  TForm_stampemg(const char *name,const char *code) ;
 | 
						|
  ~TForm_stampemg();
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
#include "..\ve\sconti.h"
 | 
						|
 | 
						|
class TCondizione_vendita : public TObject
 | 
						|
{
 | 
						|
  TString80 _sconto;
 | 
						|
  TString16 _codiva;
 | 
						|
  bool _ivarid;
 | 
						|
  real _prezzo;
 | 
						|
  real _provv;
 | 
						|
  real _molt_sconto;
 | 
						|
  TLocalisamfile _condv;
 | 
						|
  TLocalisamfile _rcondv;
 | 
						|
  TLocalisamfile _sconti;
 | 
						|
  TLocalisamfile * _anamag; // file passato e posizionato esternamente
 | 
						|
  TLocalisamfile * _umart;  // file passato e posizionato esternamente
 | 
						|
  TConfig * _config_ditta;
 | 
						|
  bool _load_mask;
 | 
						|
 | 
						|
  bool cerca(int tiporicerca,const char * cod, const real & qta);    
 | 
						|
  
 | 
						|
protected:
 | 
						|
 | 
						|
  TRectype & testa() const { return  (_condv.curr()); }
 | 
						|
  TRectype & riga() const { return  (_rcondv.curr()); }
 | 
						|
  TLocalisamfile & anamag() const { CHECK(_anamag, "Anagrafica di magazzino non inizializzata") ; return *_anamag; }
 | 
						|
  TLocalisamfile & umart() const { CHECK(_umart, "Anagrafica di unita' di misura magazzino non inizializzata") ; return *_umart; }
 | 
						|
  
 | 
						|
public:
 | 
						|
  real get_prezzo() const { return _prezzo; }
 | 
						|
  
 | 
						|
  TConfig &config_ditta() const { return *_config_ditta; }
 | 
						|
  void set_config( TConfig & ditta){ _config_ditta = &ditta; }
 | 
						|
  void set_anamag(TLocalisamfile & anamag) { _anamag = &anamag; }
 | 
						|
  void set_umart(TLocalisamfile & umart) { _umart = &umart; }
 | 
						|
 | 
						|
  bool gestum() const { return _condv.get_bool("GESTUM"); }
 | 
						|
  
 | 
						|
  // prepara la ricerca 
 | 
						|
  void put_condv(const char *tipocv,const char * codcv,const char *catven,const char *tipocf,const char *codcf);
 | 
						|
  void put_listino(const char * codlist,const char *catven);
 | 
						|
  void put_contratto(const char * codcontr,const char *tipocf,const char *codcf);
 | 
						|
  void put_offerta(const char * codoff);
 | 
						|
  // ricerca il codice 
 | 
						|
  bool ricerca(const char * cod,const real & qta=0) ;
 | 
						|
 | 
						|
  TCondizione_vendita(TConfig * _ditta = NULL, TLocalisamfile * anamag = NULL, TLocalisamfile * umart = NULL);    
 | 
						|
  ~TCondizione_vendita() {}
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
#define TIPOREG_VEN 1
 | 
						|
#define TIPOREG_ACQ 2
 | 
						|
#define TIPOREG_IVA 3
 | 
						|
#define TIPOREG_INCPAG 4
 | 
						|
#define TIPOREG_GIO 5
 | 
						|
#define TIPOREG_LIBSOC 6
 | 
						|
#define TIPOREG_CESPIT 7
 | 
						|
#define TIPOREG_INVENT 8
 | 
						|
#define TIPOREG_GIOMAG 9
 | 
						|
 | 
						|
class TRegistro_std : public TRectype
 | 
						|
{           
 | 
						|
  TString80 _intest;
 | 
						|
 | 
						|
protected:
 | 
						|
  bool read(const char* cod, int year);
 | 
						|
 | 
						|
public:
 | 
						|
  int year() const;
 | 
						|
  const TString& code() const ;
 | 
						|
 | 
						|
  const TString & descr() const { return get("S0"); }
 | 
						|
  int tipo() const { return get_int("I0"); }
 | 
						|
 | 
						|
  const TString & cod_intest() const { return get("S7"); }
 | 
						|
  const TString intest() const;
 | 
						|
  const TString & luogo_conserv() const { return get("S1"); }
 | 
						|
  int pag_stampate() const{ return get_int("I1"); }
 | 
						|
  int pag_numerate() const{ return get_int("I2"); }
 | 
						|
  TDate vidimazione() const { return get_date("D0"); }
 | 
						|
  TDate scadenza() const { return get_date("D1"); }
 | 
						|
  TDate last_print() const { return get_date("D3"); }
 | 
						|
  bool stampa_intditta() const { return get_bool("B9"); }
 | 
						|
  
 | 
						|
  void set_pag_stampate(int p) { put("I1",p); }
 | 
						|
  void set_last_print(TDate &d) { put("D3",d); }
 | 
						|
 | 
						|
  bool write(bool re) const ;
 | 
						|
  bool rewrite() const {return write(TRUE);}
 | 
						|
 | 
						|
  TRegistro_std(const char* code = "", int year = 0);  
 | 
						|
  virtual ~TRegistro_std() {}
 | 
						|
};
 | 
						|
 | 
						|
#endif //__MGLIB_H
 |