Files correlati : mg4.exe mg4300.frm mg4300.msk Ricompilazione Demo : [ ] Commento : Corretto salvataggio numero stampato sul libro giornale di magazzino git-svn-id: svn://10.65.10.50/branches/R_10_00@21413 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			547 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			547 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <printer.h>
 | |
| #include <tabutil.h>
 | |
| 
 | |
| #include "../cg/cglib01.h"
 | |
| #include "../ve/veconf.h"
 | |
| #include "mglib.h"
 | |
| #include "mg4300.h"
 | |
| #include "mg4frm.h"
 | |
| 
 | |
| class TRegistro_giornalemag : public TRegistro_std
 | |
| {           
 | |
| public:
 | |
|   int freq_stampa() const  { return get_int("I3"); } 
 | |
|   bool raggruppato() const { return get_bool("B1"); }
 | |
|   bool ragg_mag() const    { return get_bool("B2"); }
 | |
|   bool ragg_giac() const   { return get_bool("B3"); }
 | |
|   bool ragg_clafis() const { return get_bool("B4"); }
 | |
|   bool ragg_grpfis() const { return get_bool("B5"); }
 | |
|   bool ragg_caus() const   { return get_bool("B6"); }
 | |
| 
 | |
|   long last_numreg() const { return get_long("I4"); }
 | |
|   void set_last_numreg(long n) { put("I4",n); }
 | |
|   // data ultima stampa esercizio precedente
 | |
|   TDate last_print_prec() const { return get_date("D4"); }
 | |
|   // pagina ultima stampa esercizio precedente
 | |
|   int pag_stampate_prec() const{ return get_int("I6"); }
 | |
| 
 | |
|   TRegistro_giornalemag(const char* code = "", int year = 0);  
 | |
|   virtual ~TRegistro_giornalemag() {}
 | |
| };
 | |
| 
 | |
| 
 | |
| // ************************************************
 | |
| // TEMP!!!!!!!!!!!!!!!!
 | |
| TRegistro_giornalemag::TRegistro_giornalemag(const char* cod, int year) 
 | |
|                      :TRegistro_std(cod,year)
 | |
| {
 | |
|   if (tipo()!=TIPOREG_GIOMAG)
 | |
|     fatal_box(TR("Il registro richiesto non è relativo ad un libro giornale di magazzino"));
 | |
| }
 | |
| 
 | |
| 
 | |
| class TGiornalemag : public TForm_stampemg
 | |
| {
 | |
|   static TDate _dadata;
 | |
|   static TDate _adata;
 | |
|   static int freq_stampa;
 | |
|   static bool stampa_def;
 | |
|   static bool ragg_mag;
 | |
|   static bool ragg_articoli;
 | |
|   static bool ragg_classi;
 | |
|   static bool ragg_raggart;
 | |
|   static bool ragg_caus;
 | |
|   static TCursor * cur;
 | |
|   static TGiornalemag* giofrm;
 | |
|   static TAssoc_array _cod_magazzini;
 | |
|   static TAssoc_array _cau_magazzino;
 | |
|   static int _annoes;
 | |
|   static int livello_giac;
 | |
| 
 | |
|   TConfig *conf_ditta;
 | |
|   TArticolo_giacenza * _curr_art;
 | |
|   TString8 _codlist,_catven;
 | |
|   word last_pag_stampata;
 | |
|   long _last_num_reg;
 | |
|   TRegistro_giornalemag* _reg_giorn;
 | |
| 
 | |
| private:
 | |
|   TArticolo_giacenza &curr_art();
 | |
| 
 | |
| static const char * get_fiscfield(TVariable_rectype & r);
 | |
| static const char * get_cronofield(TVariable_rectype & r);
 | |
| static bool filter_func(const TRelation* r);
 | |
| 
 | |
| protected:
 | |
| //  void add_mag(TRectype & magrec,const char * codreg);
 | |
|   void calcola_range_movimenti(TRecnotype& primo, TRecnotype& ultimo) const;
 | |
| 
 | |
| public:
 | |
|   void set_parametri(TMask & m);
 | |
|   bool can_be_printed() const;
 | |
| 
 | |
|   virtual bool validate(TForm_item &cf, TToken_string &s);
 | |
| 
 | |
|   TGiornalemag(const char* name, const char* code) ;
 | |
|   ~TGiornalemag();
 | |
| };
 | |
| 
 | |
| TArticolo_giacenza& TGiornalemag::curr_art()
 | |
| {
 | |
|   const TRectype& magrec=relation()->curr(LF_MAG);
 | |
|   const TString80 codart = magrec.get(MAG_CODART);
 | |
|   if (_curr_art==NULL || _curr_art->codice()!= codart) 
 | |
|   {
 | |
|     if (_curr_art) delete _curr_art;
 | |
|     _curr_art=new TArticolo_giacenza(codart);
 | |
|   }
 | |
|   return *_curr_art;
 | |
| }
 | |
| 
 | |
| bool TGiornalemag::validate(TForm_item &cf, TToken_string &s)
 | |
| { 
 | |
|   CHECK(_reg_giorn->num() == LF_TAB, "Giornale sputtanato: cacciare Feltri per continuare"); 
 | |
| 
 | |
|   const TString80 code(s.get(0)); // prende il primo parametro, il codice del messaggio
 | |
|   TString16 subcode;
 | |
|   TString valore,vv;
 | |
| 
 | |
|   if (code=="_USER") {
 | |
|     subcode=s.get();
 | |
| 
 | |
|     if (subcode== "INTEST_REG")   {
 | |
|       cf.set(_reg_giorn->intest());
 | |
|       return true;
 | |
|     
 | |
|     } else if (subcode== "INTEST_DITTA")  {
 | |
|       if (_reg_giorn->stampa_intditta())
 | |
|         s = "_DITTA,!RAGSOC";
 | |
|       else  
 | |
|         return true;
 | |
|     } else if (subcode== "PAGENO")  {
 | |
|       valore << (int)(last_pag_stampata+printer().getcurrentpage());
 | |
|       cf.set(valore);
 | |
|       return true;
 | |
| 
 | |
|     }
 | |
|     else if (subcode== "INFO_CRONO") {
 | |
|       TRectype& movr = cursor()->curr(LF_MOVMAG);
 | |
|       _last_num_reg++;
 | |
|       const TDate datamov = movr.get_date(MOVMAG_DATAREG);
 | |
|       switch (freq_stampa )
 | |
|       {
 | |
|       case 0:
 | |
|         valore.format(FR("%7ld Movimento del %s "),  _last_num_reg, (const char*)datamov.string());
 | |
|         valore << movr.get(MOVMAG_DESCR);
 | |
|         break;
 | |
|       default:
 | |
|         valore.format(FR("%7ld Movimenti di %s, dal %d al %d"), _last_num_reg, 
 | |
|           (const char*)itom(datamov.month()),
 | |
|           (int)((datamov.day()-1)/freq_stampa)*freq_stampa+1,
 | |
|           (int)min(((datamov.day()-1)/freq_stampa+1)*freq_stampa,TDate::last_day(datamov.month(),datamov.year()))  );
 | |
|         break;
 | |
|       }
 | |
|       
 | |
|       if (stampa_def)
 | |
|       {
 | |
|         if (movr.get_long(MOVMAG_NUMREGST) != _last_num_reg)
 | |
|         {
 | |
|           // movimento ancora da registrare
 | |
|           movr.put(MOVMAG_NUMREGST, _last_num_reg);
 | |
|           cursor()->relation()->lfile(LF_MOVMAG).rewrite();
 | |
|         }
 | |
|         if (_last_num_reg > _reg_giorn->last_numreg())
 | |
|         {
 | |
|           _reg_giorn->set_last_numreg(_last_num_reg);
 | |
|           _reg_giorn->set_pag_stampate(last_pag_stampata+printer().getcurrentpage());
 | |
|           _reg_giorn->set_last_print(TDate(TODAY));
 | |
|           _reg_giorn->rewrite();
 | |
|         } 
 | |
|       }
 | |
| 
 | |
|       cf.set(valore);
 | |
|       return true;
 | |
|     } else if (subcode== "DATA_STAMPA") {
 | |
|       valore = stampa_def ? "" : TDate(TODAY).string();
 | |
|       cf.set(valore);
 | |
|       return true;
 | |
|     } else if (subcode== "INFO_FISC") {
 | |
|       valore.cut(0);
 | |
|       if (!ragg_mag)
 | |
|       {
 | |
|         vv=cursor()->curr(LF_RMOVMAG).get(RMOVMAG_CODMAG);
 | |
|         valore << TR("Mag.") << vv.mid(0,3);
 | |
|         vv=vv.mid(3,2);
 | |
|         if (vv.not_empty())
 | |
|           valore << '-' << vv ;
 | |
|         else
 | |
|           valore << "   " ;
 | |
|         valore  << ' ';
 | |
|         vv = "";
 | |
|       } 
 | |
| 
 | |
|       if (ragg_articoli)
 | |
|       {
 | |
|         const TRectype& anamag = cursor()->curr(LF_ANAMAG);
 | |
|         valore << TR("Art.") << anamag.get(ANAMAG_CODART) << ' ';
 | |
| 
 | |
|         TString livello(cursor()->relation()->curr(LF_RMOVMAG).get(RMOVMAG_LIVGIAC));
 | |
|         if (livello.not_empty() && livello_giac != 0)
 | |
|         {
 | |
|           for (int lev=1; lev <= livello_giac; lev++)
 | |
|           {
 | |
|             if (!livelli_giacenza().enabled(lev))
 | |
|               continue;
 | |
|             const int starts = livelli_giacenza().code_start(lev) -1;
 | |
|             const int length   = livelli_giacenza().code_length(lev);
 | |
|             valore << livello.mid(starts,length);
 | |
|             valore << "/";
 | |
|           }
 | |
|           valore << livelli_giacenza().name(livello_giac);
 | |
|           valore << " " << livelli_giacenza().group_descr_packed(livello,livello_giac) << " ";
 | |
|         }
 | |
|       } 
 | |
|       else 
 | |
|       {
 | |
|         const TRectype& anamag = cursor()->curr(LF_ANAMAG);
 | |
|         if (ragg_classi)
 | |
|         {
 | |
|           valore << TR("Classe fiscale ") << anamag.get(ANAMAG_CLASSEFIS) << ' ';
 | |
| 
 | |
|           if (ragg_raggart)
 | |
|           {
 | |
|             valore << TR(" ragg. ") << anamag.get(ANAMAG_RAGGFIS) << ' ';
 | |
| 
 | |
|           }
 | |
|         } else {
 | |
|           vv.cut(0);
 | |
|           vv << TR("Art. ") << anamag.get(ANAMAG_CODART);
 | |
|         }
 | |
|       }
 | |
|       valore << vv;
 | |
|       cf.set(valore);
 | |
|       return true;
 | |
|     } 
 | |
|     else if (subcode== "INFO_CAUS") 
 | |
|     {
 | |
|       const TRectype& rec_caus = cache().get("%CAU", cf.get());
 | |
|       if (ragg_caus)
 | |
|       {
 | |
|         const TString16 raggcau  = rec_caus.get("S8");
 | |
|         if (raggcau.blank())
 | |
|           valore << TR("Causali varie");
 | |
|         else
 | |
|         {
 | |
|           const TRectype& rec_rag = cache().get("%RFC", raggcau);
 | |
|           valore << TR("Causali gruppo ") << raggcau << ' ' << rec_rag.get("S0");
 | |
|         }
 | |
|       }
 | |
|       else
 | |
|       {   
 | |
|         valore << TR("Causale ") << cf.get() << ' ' << rec_caus.get("S0");
 | |
|       }
 | |
|       cf.set(valore);
 | |
|       return true;
 | |
|     }
 | |
|   }
 | |
|   return TForm_stampemg::validate(cf, s);
 | |
| }
 | |
| 
 | |
| 
 | |
| const char * TGiornalemag::get_cronofield(TVariable_rectype& rmovmag)
 | |
| {                             
 | |
|   const TRectype& movmag = cache().get(LF_MOVMAG, rmovmag.get(RMOVMAG_NUMREG));
 | |
|   const TDate datamov = movmag.get_date(MOVMAG_DATAREG);
 | |
| 
 | |
|   // gestione frequenza
 | |
|   TString& valore = get_tmp_string();
 | |
|    switch (freq_stampa ) 
 | |
|    {
 | |
|    case 0:
 | |
|       valore.format("%4d%2d%2d%7d",datamov.year(),
 | |
|         datamov.month(),
 | |
|         datamov.day(),
 | |
|         movmag.get_long("NUMREG"));
 | |
|      break;
 | |
|    default:
 | |
|      valore.format("%4d%2d%2d",datamov.year(),
 | |
|         datamov.month(),
 | |
|         (int)(datamov.day()/freq_stampa));
 | |
|      break;
 | |
|   }
 | |
|   return valore;
 | |
| }
 | |
| 
 | |
| const char * TGiornalemag::get_fiscfield(TVariable_rectype & rmovmag)
 | |
| {
 | |
|   TString80 valore;
 | |
|   TString80 vv;
 | |
|   
 | |
|   const TString80 codart = rmovmag.get(RMOVMAG_CODART);
 | |
|   
 | |
|   // gestione ragruppamenti
 | |
|   if (!ragg_mag)
 | |
|   {
 | |
|     valore.format("%-15s",(const char *)rmovmag.get(RMOVMAG_CODMAG));
 | |
|   }
 | |
|   if (ragg_articoli)
 | |
|   {
 | |
|     valore << codart;
 | |
| 
 | |
|     if (livello_giac)
 | |
|     {
 | |
|       const TString80 c2 = rmovmag.get(RMOVMAG_LIVGIAC);
 | |
|       valore << livelli_giacenza().unpack_grpcode(c2, livello_giac);
 | |
|     }
 | |
|   } 
 | |
|   else 
 | |
|   {
 | |
|     if (ragg_classi)
 | |
|     {
 | |
|       const TRectype& anamag = cache().get(LF_ANAMAG, codart);
 | |
|       valore << anamag.get(ANAMAG_CLASSEFIS);
 | |
|       if (ragg_raggart)
 | |
|         valore << anamag.get(ANAMAG_RAGGFIS);
 | |
|     } 
 | |
|     else 
 | |
|     {
 | |
|       if (!ragg_caus && freq_stampa==0) 
 | |
|       {
 | |
|         vv.format("%4d",rmovmag.get_int(RMOVMAG_NRIG));
 | |
|       } 
 | |
|       else 
 | |
|       {
 | |
|         vv.format("%-20s", (const char *)codart);
 | |
|       }
 | |
|     }
 | |
|   }
 | |
|   
 | |
|   TString8 codcaus = rmovmag.get(RMOVMAG_CODCAUS);
 | |
|   if (codcaus.empty())                                                           
 | |
|   {
 | |
|     const TRectype& movmag = cache().get(LF_MOVMAG, rmovmag.get(RMOVMAG_NUMREG));
 | |
|     codcaus = movmag.get(MOVMAG_CODCAUS);
 | |
|   }
 | |
|   
 | |
|   if (ragg_caus) // raggruppo per "tipo" di causale
 | |
|   {
 | |
|     TCausale_magazzino* caus = (TCausale_magazzino*)_cau_magazzino.objptr(codcaus);
 | |
|     valore << caus->get("S8");
 | |
|   }
 | |
|   else
 | |
|     valore << codcaus;
 | |
|   valore << vv;
 | |
|   return get_tmp_string() = valore;
 | |
| }
 | |
| 
 | |
| void TGiornalemag::calcola_range_movimenti(TRecnotype& primo, TRecnotype& ultimo) const
 | |
| {           
 | |
|   TRelation rel(LF_MOVMAG);
 | |
|   TRectype recfr(LF_MOVMAG), recto(LF_MOVMAG);
 | |
|   if (_dadata.ok())
 | |
|     recfr.put(MOVMAG_DATAREG, _dadata);
 | |
|   if (_adata.ok())
 | |
|     recto.put(MOVMAG_DATAREG, _adata);   
 | |
|   TCursor cur(&rel, "", 3, &recfr, &recto);
 | |
|   const TRecnotype items = cur.items();
 | |
|   cur.freeze();
 | |
|   primo = ultimo = 0;
 | |
|   for (cur = 0L; cur.pos() < items; ++cur)
 | |
|   {
 | |
|     const long numreg = rel.curr().get_long(MOVMAG_NUMREG);
 | |
|     if (primo == 0 || numreg < primo)
 | |
|       primo = numreg;
 | |
|     if (numreg > ultimo)
 | |
|       ultimo = numreg;
 | |
|   }
 | |
| }
 | |
| 
 | |
| void TGiornalemag::set_parametri(TMask & m)
 | |
| {
 | |
|   // set static variables
 | |
|   _annoes=m.get_int(F_ANNOES);
 | |
|   _dadata=m.get_date(F_DATAIN);
 | |
|   _adata=m.get_date(F_DATAFIN);
 | |
|   freq_stampa = m.get_int(F_FREQ);
 | |
|   stampa_def = m.get(F_DEFINITIVA)[0] == 'D';
 | |
|   ragg_mag = m.get_bool(F_RAGGMAG);
 | |
|   ragg_articoli = m.get_bool(F_RAGGARTICOLI );
 | |
|   ragg_classi = m.get_bool(F_CLASSEFISART );
 | |
|   ragg_raggart = m.get_bool(F_RAGGFISART );
 | |
|   ragg_caus = m.get_bool(F_RAGGCAUS );
 | |
|   livello_giac = m.get_int(F_TOLIVELLOGIAC);
 | |
|   cur=cursor();
 | |
|   giofrm = this;
 | |
|   // load Tregistro
 | |
|   if (_reg_giorn) 
 | |
|     delete _reg_giorn;
 | |
|   _reg_giorn= new TRegistro_giornalemag(m.get(F_CODREG),_annoes);
 | |
|   last_pag_stampata=_reg_giorn->pag_stampate();
 | |
|   _last_num_reg=_reg_giorn->last_numreg();
 | |
| 
 | |
|   // show/hide sections
 | |
|   find_field('B',odd_page,"HEADER_RAGG_FISC").show(
 | |
|     ragg_articoli || ragg_classi || ragg_caus);
 | |
|   find_field('B',odd_page,"HEADER_MOV").show(freq_stampa==0);
 | |
| 
 | |
|   TVariable_rectype *vrec_rmov= new TVariable_rectype(LF_RMOVMAG);
 | |
|   vrec_rmov->add_field(new TVariable_field ("CRONO_FIELD",get_cronofield,32));
 | |
|   vrec_rmov->add_field(new TVariable_field ("FISC_FIELD",get_fiscfield,48));
 | |
|     
 | |
|   cursor()->relation()->lfile().set_curr(vrec_rmov);
 | |
| 
 | |
|   // inserisce tutti i magazzini collegati
 | |
|   _cod_magazzini.destroy();
 | |
|   TTable mag("MAG"); 
 | |
|   int err;
 | |
|   for (err = mag.first(); err == NOERR; err = mag.next())
 | |
|   {
 | |
|     const TString& codmag = mag.get("CODTAB").left(3);
 | |
|     if (codmag.len() == 3 && mag.get("S8")==m.get(F_CODREG))
 | |
|       _cod_magazzini.add(codmag);
 | |
|   }
 | |
|   
 | |
|   _cau_magazzino.destroy();
 | |
|   TTable cau("%CAU");
 | |
|   for (err = cau.first(); err == NOERR; err = cau.next())
 | |
|   {
 | |
|     TCausale_magazzino* cm = new TCausale_magazzino(cau.curr());
 | |
|     _cau_magazzino.add(cm->codice(), cm);
 | |
|   }
 | |
|  
 | |
|   TRecnotype primo, ultimo;
 | |
|   calcola_range_movimenti(primo, ultimo);
 | |
|   
 | |
|   TRectype recfr(LF_RMOVMAG), recto(LF_RMOVMAG);
 | |
|   if (primo > 0)
 | |
|     recfr.put(RMOVMAG_NUMREG, primo);
 | |
|   if (ultimo > 0)
 | |
|     recto.put(RMOVMAG_NUMREG, ultimo);
 | |
|   cursor()->setregion(recfr, recto);
 | |
| 
 | |
|   // setta il filtro sui magazzini di questo giornale
 | |
|   cursor()->set_filterfunction(filter_func,false);
 | |
| }
 | |
| 
 | |
| bool TGiornalemag::filter_func(const TRelation* r)
 | |
| {                       
 | |
|   const TRectype& rmovmag = r->curr(LF_RMOVMAG);
 | |
|   const TRectype& movmag = cache().get(LF_MOVMAG, rmovmag.get(RMOVMAG_NUMREG));
 | |
| 
 | |
|   const TDate datareg = movmag.get_date(MOVMAG_DATAREG);
 | |
|   if (datareg.year() != _annoes)
 | |
|     return false;
 | |
|   if (!_dadata.empty() && datareg < _dadata)
 | |
|     return false;
 | |
|   if (!_adata.empty() && datareg > _adata) 
 | |
|     return false;
 | |
| 
 | |
|   const TString& codmag = rmovmag.get(RMOVMAG_CODMAG).left(3);
 | |
|   if (!_cod_magazzini.is_key(codmag))
 | |
|     return false;
 | |
|   
 | |
|   // considera solo le causali "fiscali" o quelle che movimentano le rimanenze iniziali(movimenti d'apertura)
 | |
|   bool rval = false;               
 | |
| 
 | |
|   TString8 codcaus = rmovmag.get(RMOVMAG_CODCAUS);
 | |
|   if (codcaus.empty())
 | |
|     codcaus = movmag.get(MOVMAG_CODCAUS);
 | |
|   TCausale_magazzino* caus = (TCausale_magazzino*)_cau_magazzino.objptr(codcaus);
 | |
|   if (caus != NULL)
 | |
|     rval = caus->is_fiscale() || caus->sgn(s_rim);
 | |
|   
 | |
|   return rval;
 | |
| }
 | |
| 
 | |
| bool TGiornalemag::can_be_printed() const
 | |
| {
 | |
|   bool ok = true;
 | |
|   if (stampa_def) 
 | |
|   {
 | |
|     TDate dadata = _dadata, adata;
 | |
|     if (!dadata.ok())
 | |
|     {
 | |
|       TEsercizi_contabili esc;
 | |
|       esc.code2range(_annoes, dadata, adata);
 | |
|     }
 | |
|     TLocalisamfile mov(LF_MOVMAG);
 | |
|     mov.setkey(3);
 | |
|     mov.put(MOVMAG_DATAREG, dadata);
 | |
|     if (mov.read(_isgteq) == NOERR && !mov.bof())
 | |
|     {
 | |
|       const long num_reg = mov.get_long(MOVMAG_NUMREG); // Debugging purpose only
 | |
|       const long num_regst = mov.get_long(MOVMAG_NUMREGST);
 | |
|       const long last_numreg = _reg_giorn->last_numreg();
 | |
|       ok = num_regst == last_numreg;
 | |
|     }
 | |
|   }
 | |
|   return ok;
 | |
| }
 | |
| 
 | |
| TGiornalemag::TGiornalemag(const char *name,const char *code) :
 | |
|   TForm_stampemg(name,code),_curr_art(NULL),
 | |
|   last_pag_stampata(0),_last_num_reg(0),_reg_giorn(NULL)
 | |
| { }
 | |
| 
 | |
| TGiornalemag::~TGiornalemag()
 | |
| {
 | |
|   if (_curr_art) delete _curr_art;
 | |
|   if (_reg_giorn) delete _reg_giorn;
 | |
| }
 | |
| 
 | |
| // dichiarazioni degli static
 | |
| TDate TGiornalemag::_dadata;
 | |
| TDate TGiornalemag::_adata;
 | |
| int   TGiornalemag::freq_stampa;
 | |
| bool TGiornalemag::ragg_mag;
 | |
| bool TGiornalemag::stampa_def;
 | |
| bool TGiornalemag::ragg_articoli;
 | |
| bool TGiornalemag::ragg_classi;
 | |
| bool TGiornalemag::ragg_raggart;
 | |
| bool TGiornalemag::ragg_caus;
 | |
| int  TGiornalemag::livello_giac;
 | |
| TCursor * TGiornalemag::cur;
 | |
| TGiornalemag * TGiornalemag::giofrm;
 | |
| TAssoc_array TGiornalemag::_cod_magazzini;
 | |
| TAssoc_array TGiornalemag::_cau_magazzino;
 | |
| int TGiornalemag::_annoes;
 | |
| 
 | |
| // STAMPA giornale
 | |
| class TStampa_giornalemag : public TSkeleton_application
 | |
| {
 | |
| protected:
 | |
|   virtual void main_loop();
 | |
| };
 | |
| 
 | |
| void TStampa_giornalemag::main_loop()
 | |
| {
 | |
|   open_files(LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_TAB, LF_TABCOM, 0);
 | |
| 
 | |
|   TStampemg_mask mask("mg4300");
 | |
|   mask.show(F_TOLIVELLOGIAC, livelli_giacenza().enabled()); // Abilita la gestione del dettaglio livello giacenza
 | |
|   while (mask.run() == K_ENTER) 
 | |
|   {
 | |
|     if (mask.magazz_ini().gestmag(true)) 
 | |
|     {
 | |
|       TGiornalemag* giorn_mag = new TGiornalemag("mg4300", "");
 | |
|       giorn_mag->set_parametri(mask);
 | |
| 
 | |
|       bool can_print = giorn_mag->can_be_printed();
 | |
|       if (!can_print)
 | |
|         can_print = yesno_box(TR("Non risultano stampati i movimenti precedenti:\nContinuare ugualmente?"));
 | |
|       if (can_print)
 | |
|         giorn_mag->print();
 | |
| 
 | |
|       delete giorn_mag;
 | |
|     } 
 | |
|   } // while true  
 | |
|   return ;
 | |
| }
 | |
| 
 | |
| int mg4300(int argc, char* argv[])
 | |
| {
 | |
|   TStampa_giornalemag a;
 | |
|   a.run(argc, argv, TR("Stampa giornale di magazzino"));
 | |
|   return 0;
 | |
| } |