552 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			552 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| // *******************************
 | ||
| // LIBRERIA  di magazzino 
 | ||
| // *******************************
 | ||
| #ifndef __MGLIB_H 
 | ||
| #define __MGLIB_H
 | ||
| 
 | ||
| #ifndef __MULTIREC_H
 | ||
| #include <multirec.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
 | ||
| 
 | ||
| #ifndef __RMOVMAG_H 
 | ||
| #include "rmovmag.h"
 | ||
| #endif
 | ||
| 
 | ||
| 
 | ||
| typedef enum  {
 | ||
|   riga_nongenerata=' ',
 | ||
|   riga_automatica='A',
 | ||
|   riga_dadocumento='D'
 | ||
| } TTipo_rigamovmag;
 | ||
| 
 | ||
| char * Nome_valorizz[];
 | ||
| 
 | ||
| typedef enum  {
 | ||
|   valorizz_costmedio,
 | ||
|   valorizz_ultcos, 
 | ||
|   valorizz_mediacos, 
 | ||
|   valorizz_przlist, 
 | ||
|   valorizz_coststd, 
 | ||
|   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);
 | ||
| 
 | ||
|   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, const char * codmag = NULL, int from = 0) const;
 | ||
|   TRecord_array & mag(const char * annoes) const;
 | ||
|   TRecord_array & storico(const char * annoesrif) const;
 | ||
|   
 | ||
|   // La seguente funzione riporta le rimanenze finali dell'esercizio oldes come
 | ||
|   // rimanenze iniziali dell'esercizio newes, valorizzando secondo il tipo passato
 | ||
|   // Si suppone che i saldi siano coerenti con i movimenti (effettuare una rebuild_balances()
 | ||
|   // di oldes.
 | ||
|   bool riporta_saldi(const char * oldes, const char* newes, const TTipo_valorizz tipo, const char * catven ,const char * codlist);
 | ||
|   
 | ||
|   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;
 | ||
|                               
 | ||
|   real giacenza_corretta(const TRectype & rec ,bool giacenza_effettiva,bool valorizza_componenti) const ;
 | ||
| 
 | ||
|   TArticolo_giacenza(const char* codice = NULL);
 | ||
|   TArticolo_giacenza(const TRectype& rec);
 | ||
|   virtual ~TArticolo_giacenza() {}
 | ||
| };  
 | ||
| 
 | ||
| // *******************************
 | ||
| // LIBRERIA DI utility del magazzino
 | ||
| // *******************************
 | ||
| //#define MANY_MAG_LEV 10
 | ||
| //#define MAX_GIAC_LEVEL 4
 | ||
| 
 | ||
| #define MANY_MAG_LEV 10
 | ||
| #define MAX_GIAC_LEVEL 4
 | ||
|   
 | ||
| class TR_automa;
 | ||
|   
 | ||
| class TMetachar : public TObject
 | ||
| {
 | ||
|   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:
 | ||
|   // @cmember restituisce la lunghezza massima della stringa che soddisfa il formato passato
 | ||
|   static int maxstrlen(const char * format);
 | ||
| 
 | ||
|   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);
 | ||
| 
 | ||
| 
 | ||
|   const char *mand_chars() {return _metach_mand;};   
 | ||
|   const char *opz_chars() {return _metach_opz;};     
 | ||
|   TMetachar(const char * str);
 | ||
|   TMetachar();
 | ||
|   virtual ~TMetachar();
 | ||
| };
 | ||
| 
 | ||
| class TCodice_livelli : public TObject
 | ||
| {
 | ||
|   long _last_firm;
 | ||
| 
 | ||
|   int         _code_length[MANY_MAG_LEV];
 | ||
|   TString     _name[MANY_MAG_LEV];
 | ||
|   TString     _picture[MANY_MAG_LEV];
 | ||
|   int         _last_level;
 | ||
|   TDecoder    *_gruppi;
 | ||
| 
 | ||
| protected:
 | ||
|   bool _lev_enabled;
 | ||
|   TArray _metachars;
 | ||
| 
 | ||
|   void load(bool e, const char *tabcod,const char *tabgrp);  
 | ||
|   void add_metachar(int lev);
 | ||
|   
 | ||
|   void update_firm();
 | ||
|   void test_firm();
 | ||
|     
 | ||
| public:
 | ||
|   // Ritorna il numero di livelli abilitati
 | ||
|   int last_level() const { return enabled() ? _last_level : 0; }
 | ||
|   // Abilita la gestione dei livelli 
 | ||
|   void enable(bool on=TRUE) ; 
 | ||
|   // Ritorna se la gestione dei livelli <20> abilitata
 | ||
|   const bool enabled() const ; 
 | ||
|   // Ritorna se il livello specificato <20> abilitato
 | ||
|   const bool enabled(int levnum) const ; 
 | ||
|   // Ritorna il nome (descrizione) di quel livello
 | ||
|   const TString & name(int levnum) const ;   
 | ||
|   // Ritorna la stringa di picture per i codici gruppo di quel livello
 | ||
|   const TString & picture(int levnum) const;
 | ||
|   // Ritorna la lunghezza dei codici gruppo di quel livello
 | ||
|   const int code_length(int levnum) const ;      
 | ||
|   // Ritorna la posizione iniziale del codice gruppo di quel livello
 | ||
|   const int code_start(int levnum) const ;      
 | ||
|   // Ritorna la lunghezza del codice compatto fino a quel livello
 | ||
|   const int packed_length(int levnum) const ;    
 | ||
|   // Restituisce la descrizione del gruppo dato il codice compatto
 | ||
|   const TString & group_descr(const char * packed_code, int levnum) const; 
 | ||
|   // Setta la colonna del campo livello codice di uno sheet in base alle abilitazioni 
 | ||
|   void set_sheetcolumn(TSheet_field &fld_righe,int field, int lev) const;
 | ||
|   
 | ||
|   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) const ;     // Estrae il codice del gruppo del livello levnum da pc
 | ||
|   TString build_tabcode(const TString & pc, const int levnum) const ;
 | ||
| 
 | ||
|   // Restituisce il formato previsto per il codice (default==ultimo livello)
 | ||
|   const char * code_format(int levnum=-1) const ; 
 | ||
|   // Restituisce se <p codepart> e' riconosciuto come codice articolo (default==ultimo livello)
 | ||
|   bool fit_to_format(const char *codepart, int levnum=-1) const ; 
 | ||
| 
 | ||
| /*  bool has_mandchars(const char * pattern);
 | ||
|   bool has_opzchars(const char * pattern);
 | ||
|   const char * opz_chars();
 | ||
|   const char * mand_chars();*/
 | ||
| 
 | ||
|   virtual void init() pure;
 | ||
| 
 | ||
|   TCodice_livelli();          // costruttore
 | ||
|   virtual ~TCodice_livelli(); // distruttore
 | ||
| };
 | ||
| 
 | ||
| 
 | ||
| class TCodart_livelli : public TCodice_livelli
 | ||
| {
 | ||
| public:
 | ||
|   virtual void init();
 | ||
| 
 | ||
|   TCodart_livelli();  // costruttore
 | ||
|   virtual ~TCodart_livelli() ; // distruttore
 | ||
| };
 | ||
| 
 | ||
| 
 | ||
| class TCodgiac_livelli : public TCodice_livelli
 | ||
| {
 | ||
| public:
 | ||
|   virtual void init();
 | ||
| 
 | ||
|   TCodgiac_livelli();  // costruttore
 | ||
|   virtual ~TCodgiac_livelli() {}; // distruttore
 | ||
| };
 | ||
| 
 | ||
| 
 | ||
| // *********************
 | ||
| // classe che incapsula tutti i magazzini 
 | ||
| class TMagazzini : public TRecord_cache
 | ||
| {
 | ||
|   TString16 _stdmag;
 | ||
|   TString16 _stddep;
 | ||
|   TConfig _mgconfig;
 | ||
| public:
 | ||
|   const TString & standardmag() const 
 | ||
|   { return _stdmag;} 
 | ||
|   const TString & standarddep() const 
 | ||
|   { return _stddep;}   
 | ||
|   bool gestmag() const 
 | ||
|   {return ((TMagazzini *) this)->_mgconfig.get_bool("GESMAG");}
 | ||
|   bool gestdep() const 
 | ||
|   {return ((TMagazzini *) this)->_mgconfig.get_bool("GESDEPOSITI");}
 | ||
|   bool gestubi_man() const 
 | ||
|   {return ((TMagazzini *) this)->_mgconfig.get("GESUBICAZ")=="M";}
 | ||
|   bool gestubi_tab() const 
 | ||
|   {return ((TMagazzini *) this)->_mgconfig.get("GESUBICAZ")=="T";}
 | ||
|   bool gestmultimag() const 
 | ||
|   {return ((TMagazzini *) this)->_mgconfig.get_bool("GESMULTIMAG");}
 | ||
| 
 | ||
|   TMagazzini();
 | ||
|   virtual ~TMagazzini() {}
 | ||
| };
 | ||
| 
 | ||
| 
 | ||
| // *********************
 | ||
| // 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,
 | ||
|   s_user1,
 | ||
|   s_user2,
 | ||
|   s_user3,
 | ||
|   s_user4,
 | ||
|   s_user5,
 | ||
|   s_user6
 | ||
| } TTipo_saldomag; 
 | ||
| 
 | ||
| class TCausale_magazzino : public TRectype
 | ||
| {
 | ||
| public:
 | ||
|   const TString & codice() const {return get("CODTAB");}
 | ||
|   const TString & descr() const {return get("S0");}
 | ||
|   char tipoprz() const {return get_char("S6");}
 | ||
|   char tipomov() const {return get_char("S7");}
 | ||
|   const TString & raggfisc() {return get("S8");}
 | ||
|   const TString & caus_collegata() {return get("S9");}
 | ||
|   int sgn(TTipo_saldomag fieldname) ;
 | ||
|   bool update_qta() {return !get_bool("B1");}
 | ||
|   bool update_val() {return !get_bool("B0");}
 | ||
|   bool update_ultcos() {return get_bool("B2");}
 | ||
|   bool is_fiscale();
 | ||
|   TCausale_magazzino(const char * codice);
 | ||
|   virtual ~TCausale_magazzino() {}
 | ||
| };
 | ||
| 
 | ||
| class TLine_movmag ; // convenience...
 | ||
| 
 | ||
| // classe per la definizione dei movimenti di magazzino
 | ||
| // ( un movimento (testata+righe) == un oggetto TMov_mag )
 | ||
| class TMov_mag : public TMultiple_rectype
 | ||
| {
 | ||
| 
 | ||
|   // 
 | ||
|   TString16 _annoes;
 | ||
|   // 
 | ||
|   TArticolo_giacenza curr_art;
 | ||
|   TAssoc_array lines_to_add;  
 | ||
|   TAssoc_array lines_to_subtract; 
 | ||
| 
 | ||
|   static TRecord_cache cache_causali;
 | ||
| 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 line_deleted(TToken_string &key,TLine_movmag &rest);
 | ||
|   // @member: memorizza la linea come "da aggiungere"
 | ||
|   int line_inserted(TToken_string &key,TLine_movmag &rest);
 | ||
|   // @member: effettua l'aggiornamento dei saldi relativi alle giacenze interessate al movimento
 | ||
|   int update_balances() ;
 | ||
|   // @member: effettua l'aggiornamento dei saldi di una giacenza
 | ||
|   int update_balances(TRectype & magrec, const TLine_movmag &l,int sign) ;
 | ||
|   // @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) ;
 | ||
|   virtual const char * codmag_rauto(int r) const { return NULL;}
 | ||
|   virtual const char * prezzo_rauto(int r) const { return NULL;}
 | ||
| 
 | ||
|   // @member: restituisce il codice del magazzino della riga automatica accoppiata a <par r>
 | ||
|   virtual const char * codmag_rauto(int r)
 | ||
|   {return NULL;}
 | ||
|   // @member: restituisce il prezzo della riga automatica accoppiata a <par r>
 | ||
|   virtual const char * prezzo_rauto(int r)
 | ||
|   {return NULL;}
 | ||
| public:
 | ||
| // IO ad alto livello
 | ||
|   const char *get_next_key() ;
 | ||
|   virtual void synchronize_bodies();
 | ||
|   virtual int remove(TBaseisamfile& f) const ;
 | ||
|   void  add_automatiche();
 | ||
|   virtual void zero(char c = '\0');// azzeramento ;
 | ||
|   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(const 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;
 | ||
|   //sostituire con le funzioni di TLivelli_... :
 | ||
|   //TDecoder *_giacgrp,*_artgrp;
 | ||
|   bool setdettaglio(bool show, int fromlivart,int livart,int fromlivgiac,int livgiac,bool dettgiac);
 | ||
|   void add_giaclev(TString &levname);
 | ||
| 
 | ||
| public:
 | ||
|   TCodart_livelli  * _artlev;
 | ||
|   TCodgiac_livelli * _giaclev;
 | ||
| 
 | ||
| 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) ;
 | ||
|   virtual ~TForm_stampemg();
 | ||
| };
 | ||
| 
 | ||
| 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);    
 | ||
|   virtual ~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);}
 | ||
|   int lock();
 | ||
|   int unlock();
 | ||
|   
 | ||
|   TRegistro_std(const char* code = "", int year = 0);  
 | ||
|   virtual ~TRegistro_std() {}
 | ||
| };
 | ||
| 
 | ||
| #endif //__MGLIB_H
 |