Patch level : 10.0
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
This commit is contained in:
		
							parent
							
								
									529f13f82e
								
							
						
					
					
						commit
						e9611c895d
					
				@ -1,15 +1,7 @@
 | 
				
			|||||||
#include <applicat.h>
 | 
					#include <applicat.h>
 | 
				
			||||||
#include <printer.h>
 | 
					#include <printer.h>
 | 
				
			||||||
#include <recarray.h>
 | 
					 | 
				
			||||||
#include <tabutil.h>
 | 
					#include <tabutil.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "anamag.h"
 | 
					 | 
				
			||||||
#include "mag.h"
 | 
					 | 
				
			||||||
#include "stomag.h"
 | 
					 | 
				
			||||||
#include "umart.h"
 | 
					 | 
				
			||||||
#include "movmag.h"
 | 
					 | 
				
			||||||
#include "rmovmag.h"
 | 
					 | 
				
			||||||
           
 | 
					 | 
				
			||||||
#include "../cg/cglib01.h"
 | 
					#include "../cg/cglib01.h"
 | 
				
			||||||
#include "../ve/veconf.h"
 | 
					#include "../ve/veconf.h"
 | 
				
			||||||
#include "mglib.h"
 | 
					#include "mglib.h"
 | 
				
			||||||
@ -132,23 +124,31 @@ bool TGiornalemag::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
      cf.set(valore);
 | 
					      cf.set(valore);
 | 
				
			||||||
      return true;
 | 
					      return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else if (subcode== "NUMREGST")  {
 | 
					    }
 | 
				
			||||||
      valore << _last_num_reg;
 | 
					    else if (subcode== "INFO_CRONO") {
 | 
				
			||||||
      cf.set(valore);
 | 
					      TRectype& movr = cursor()->curr(LF_MOVMAG);
 | 
				
			||||||
      return true;
 | 
					      _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;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
    } else if (subcode=="INCNUMREGST")    {
 | 
					 | 
				
			||||||
      _last_num_reg = max(_last_num_reg,_reg_giorn->last_numreg()) + 1;
 | 
					 | 
				
			||||||
      return true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    } else if (subcode== "REGISTRASTAMPA") {
 | 
					 | 
				
			||||||
      if (stampa_def)
 | 
					      if (stampa_def)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        TRectype& movr = cursor()->curr(LF_MOVMAG);
 | 
					 | 
				
			||||||
        if (movr.get_long(MOVMAG_NUMREGST) != _last_num_reg)
 | 
					        if (movr.get_long(MOVMAG_NUMREGST) != _last_num_reg)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          // movimento ancora da registrare
 | 
					          // movimento ancora da registrare
 | 
				
			||||||
          movr.put(MOVMAG_NUMREGST, _last_num_reg);  // was _last_num_reg + 1
 | 
					          movr.put(MOVMAG_NUMREGST, _last_num_reg);
 | 
				
			||||||
          cursor()->relation()->lfile(LF_MOVMAG).rewrite();
 | 
					          cursor()->relation()->lfile(LF_MOVMAG).rewrite();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (_last_num_reg > _reg_giorn->last_numreg())
 | 
					        if (_last_num_reg > _reg_giorn->last_numreg())
 | 
				
			||||||
@ -159,22 +159,7 @@ bool TGiornalemag::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
          _reg_giorn->rewrite();
 | 
					          _reg_giorn->rewrite();
 | 
				
			||||||
        } 
 | 
					        } 
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    } else if (subcode== "INFO_CRONO") {
 | 
					
 | 
				
			||||||
      TRectype& movr = cursor()->curr(LF_MOVMAG);
 | 
					 | 
				
			||||||
      const TDate datamov = movr.get_date(MOVMAG_DATAREG);
 | 
					 | 
				
			||||||
      switch (freq_stampa )
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
      case 0:
 | 
					 | 
				
			||||||
        valore.format(FR("%7ld Movimento del %s "),  _last_num_reg+1, (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+1, 
 | 
					 | 
				
			||||||
          (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;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      cf.set(valore);
 | 
					      cf.set(valore);
 | 
				
			||||||
      return true;
 | 
					      return true;
 | 
				
			||||||
    } else if (subcode== "DATA_STAMPA") {
 | 
					    } else if (subcode== "DATA_STAMPA") {
 | 
				
			||||||
@ -185,7 +170,7 @@ bool TGiornalemag::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
      valore.cut(0);
 | 
					      valore.cut(0);
 | 
				
			||||||
      if (!ragg_mag)
 | 
					      if (!ragg_mag)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        vv=cursor()->curr(LF_RMOVMAG).get("CODMAG");
 | 
					        vv=cursor()->curr(LF_RMOVMAG).get(RMOVMAG_CODMAG);
 | 
				
			||||||
        valore << TR("Mag.") << vv.mid(0,3);
 | 
					        valore << TR("Mag.") << vv.mid(0,3);
 | 
				
			||||||
        vv=vv.mid(3,2);
 | 
					        vv=vv.mid(3,2);
 | 
				
			||||||
        if (vv.not_empty())
 | 
					        if (vv.not_empty())
 | 
				
			||||||
@ -196,12 +181,12 @@ bool TGiornalemag::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
        vv = "";
 | 
					        vv = "";
 | 
				
			||||||
      } 
 | 
					      } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const TRectype& anamag = cursor()->curr(LF_ANAMAG);
 | 
					 | 
				
			||||||
      if (ragg_articoli)
 | 
					      if (ragg_articoli)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
 | 
					        const TRectype& anamag = cursor()->curr(LF_ANAMAG);
 | 
				
			||||||
        valore << TR("Art.") << anamag.get(ANAMAG_CODART) << ' ';
 | 
					        valore << TR("Art.") << anamag.get(ANAMAG_CODART) << ' ';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        TString livello(cursor()->relation()->curr(LF_RMOVMAG).get("LIVGIAC"));
 | 
					        TString livello(cursor()->relation()->curr(LF_RMOVMAG).get(RMOVMAG_LIVGIAC));
 | 
				
			||||||
        if (livello.not_empty() && livello_giac != 0)
 | 
					        if (livello.not_empty() && livello_giac != 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          for (int lev=1; lev <= livello_giac; lev++)
 | 
					          for (int lev=1; lev <= livello_giac; lev++)
 | 
				
			||||||
@ -219,6 +204,7 @@ bool TGiornalemag::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
      } 
 | 
					      } 
 | 
				
			||||||
      else 
 | 
					      else 
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
 | 
					        const TRectype& anamag = cursor()->curr(LF_ANAMAG);
 | 
				
			||||||
        if (ragg_classi)
 | 
					        if (ragg_classi)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          valore << TR("Classe fiscale ") << anamag.get(ANAMAG_CLASSEFIS) << ' ';
 | 
					          valore << TR("Classe fiscale ") << anamag.get(ANAMAG_CLASSEFIS) << ' ';
 | 
				
			||||||
@ -269,8 +255,9 @@ const char * TGiornalemag::get_cronofield(TVariable_rectype & rmovmag)
 | 
				
			|||||||
  const TDate datamov = movmag.get_date(MOVMAG_DATAREG);
 | 
					  const TDate datamov = movmag.get_date(MOVMAG_DATAREG);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // gestione frequenza
 | 
					  // gestione frequenza
 | 
				
			||||||
  TString16 valore;
 | 
					  TString& valore = get_tmp_string();
 | 
				
			||||||
   switch (freq_stampa ) {
 | 
					   switch (freq_stampa ) 
 | 
				
			||||||
 | 
					   {
 | 
				
			||||||
   case 0:
 | 
					   case 0:
 | 
				
			||||||
      valore.format("%4d%2d%2d%7d",datamov.year(),
 | 
					      valore.format("%4d%2d%2d%7d",datamov.year(),
 | 
				
			||||||
        datamov.month(),
 | 
					        datamov.month(),
 | 
				
			||||||
@ -281,8 +268,9 @@ const char * TGiornalemag::get_cronofield(TVariable_rectype & rmovmag)
 | 
				
			|||||||
     valore.format("%4d%2d%2d",datamov.year(),
 | 
					     valore.format("%4d%2d%2d",datamov.year(),
 | 
				
			||||||
        datamov.month(),
 | 
					        datamov.month(),
 | 
				
			||||||
        (int)(datamov.day()/freq_stampa));
 | 
					        (int)(datamov.day()/freq_stampa));
 | 
				
			||||||
 | 
					     break;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return get_tmp_string() = valore;
 | 
					  return valore;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char * TGiornalemag::get_fiscfield(TVariable_rectype & rmovmag)
 | 
					const char * TGiornalemag::get_fiscfield(TVariable_rectype & rmovmag)
 | 
				
			||||||
@ -358,8 +346,7 @@ void TGiornalemag::calcola_range_movimenti(TRecnotype& primo, TRecnotype& ultimo
 | 
				
			|||||||
  TCursor cur(&rel, "", 3, &recfr, &recto);
 | 
					  TCursor cur(&rel, "", 3, &recfr, &recto);
 | 
				
			||||||
  const TRecnotype items = cur.items();
 | 
					  const TRecnotype items = cur.items();
 | 
				
			||||||
  cur.freeze();
 | 
					  cur.freeze();
 | 
				
			||||||
  primo = 0;
 | 
					  primo = ultimo = 0;
 | 
				
			||||||
  ultimo = 0;
 | 
					 | 
				
			||||||
  for (cur = 0L; cur.pos() < items; ++cur)
 | 
					  for (cur = 0L; cur.pos() < items; ++cur)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const long numreg = rel.curr().get_long(MOVMAG_NUMREG);
 | 
					    const long numreg = rel.curr().get_long(MOVMAG_NUMREG);
 | 
				
			||||||
@ -410,7 +397,7 @@ void TGiornalemag::set_parametri(TMask & m)
 | 
				
			|||||||
  int err;
 | 
					  int err;
 | 
				
			||||||
  for (err = mag.first(); err == NOERR; err = mag.next())
 | 
					  for (err = mag.first(); err == NOERR; err = mag.next())
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const TString4 codmag = mag.get("CODTAB").left(3);
 | 
					    const TString& codmag = mag.get("CODTAB").left(3);
 | 
				
			||||||
    if (codmag.len() == 3 && mag.get("S8")==m.get(F_CODREG))
 | 
					    if (codmag.len() == 3 && mag.get("S8")==m.get(F_CODREG))
 | 
				
			||||||
      _cod_magazzini.add(codmag);
 | 
					      _cod_magazzini.add(codmag);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -450,7 +437,7 @@ bool TGiornalemag::filter_func(const TRelation* r)
 | 
				
			|||||||
  if (!_adata.empty() && datareg > _adata) 
 | 
					  if (!_adata.empty() && datareg > _adata) 
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const TString4 codmag = rmovmag.get(RMOVMAG_CODMAG).left(3);
 | 
					  const TString& codmag = rmovmag.get(RMOVMAG_CODMAG).left(3);
 | 
				
			||||||
  if (!_cod_magazzini.is_key(codmag))
 | 
					  if (!_cod_magazzini.is_key(codmag))
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@ -483,16 +470,15 @@ bool TGiornalemag::can_be_printed() const
 | 
				
			|||||||
    mov.put(MOVMAG_DATAREG, dadata);
 | 
					    mov.put(MOVMAG_DATAREG, dadata);
 | 
				
			||||||
    if (mov.read(_isgteq) == NOERR && !mov.bof())
 | 
					    if (mov.read(_isgteq) == NOERR && !mov.bof())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      const long numreg = mov.get_long(MOVMAG_NUMREG); // Debugging purpose only
 | 
					      const long num_reg = mov.get_long(MOVMAG_NUMREG); // Debugging purpose only
 | 
				
			||||||
      const long mov_num = mov.get_long(MOVMAG_NUMREGST);
 | 
					      const long num_regst = mov.get_long(MOVMAG_NUMREGST);
 | 
				
			||||||
      const long reg_num = _reg_giorn->last_numreg();
 | 
					      const long last_numreg = _reg_giorn->last_numreg();
 | 
				
			||||||
      ok = mov_num == reg_num;
 | 
					      ok = num_regst == last_numreg;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ok;
 | 
					  return ok;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
TGiornalemag::TGiornalemag(const char *name,const char *code) :
 | 
					TGiornalemag::TGiornalemag(const char *name,const char *code) :
 | 
				
			||||||
  TForm_stampemg(name,code),_curr_art(NULL),
 | 
					  TForm_stampemg(name,code),_curr_art(NULL),
 | 
				
			||||||
  last_pag_stampata(0),_last_num_reg(0),_reg_giorn(NULL)
 | 
					  last_pag_stampata(0),_last_num_reg(0),_reg_giorn(NULL)
 | 
				
			||||||
@ -553,7 +539,6 @@ void TStampa_giornalemag::main_loop()
 | 
				
			|||||||
  return ;
 | 
					  return ;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
int mg4300(int argc, char* argv[])
 | 
					int mg4300(int argc, char* argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TStampa_giornalemag a;
 | 
					  TStampa_giornalemag a;
 | 
				
			||||||
 | 
				
			|||||||
@ -173,7 +173,6 @@ SECTION BODY ODD 2
 | 
				
			|||||||
        STRINGA FF_INFORAGGCRO 70
 | 
					        STRINGA FF_INFORAGGCRO 70
 | 
				
			||||||
        BEGIN
 | 
					        BEGIN
 | 
				
			||||||
          PROMPT 1 1 ""
 | 
					          PROMPT 1 1 ""
 | 
				
			||||||
          MESSAGE _USER,INCNUMREGST
 | 
					 | 
				
			||||||
        END
 | 
					        END
 | 
				
			||||||
        STRINGA FF_INFOCAUS 70
 | 
					        STRINGA FF_INFOCAUS 70
 | 
				
			||||||
        BEGIN
 | 
					        BEGIN
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,6 @@ BEGIN
 | 
				
			|||||||
  OUTPUT F_ANNOES CODTAB[1,4]
 | 
					  OUTPUT F_ANNOES CODTAB[1,4]
 | 
				
			||||||
  OUTPUT F_CODREG CODTAB[5,7]
 | 
					  OUTPUT F_CODREG CODTAB[5,7]
 | 
				
			||||||
  CHECKTYPE REQUIRED
 | 
					  CHECKTYPE REQUIRED
 | 
				
			||||||
  ADD NONE
 | 
					 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LISTBOX F_DEFINITIVA 10
 | 
					LISTBOX F_DEFINITIVA 10
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user