Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 98.01.02pl000 sul main trunk git-svn-id: svn://10.65.10.50/trunk@6223 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									c2eaad0601
								
							
						
					
					
						commit
						df19c2fc5a
					
				@ -1419,8 +1419,10 @@ bool TMenu_application::create()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 #ifndef _DEMO_
 | 
				
			||||||
  if (!check_user()) 
 | 
					  if (!check_user()) 
 | 
				
			||||||
    return FALSE;
 | 
					    return FALSE;
 | 
				
			||||||
 | 
					 #endif
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  set_perms();
 | 
					  set_perms();
 | 
				
			||||||
  test_temp();
 | 
					  test_temp();
 | 
				
			||||||
 | 
				
			|||||||
@ -1294,6 +1294,14 @@ bool TFascicolator_mask::zip_module(const TString& main_module, bool agg, int pa
 | 
				
			|||||||
      ok = move_file(src, path);
 | 
					      ok = move_file(src, path);
 | 
				
			||||||
    aborted = !ok || pi.iscancelled();
 | 
					    aborted = !ok || pi.iscancelled();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  // scrive il sommario completo 
 | 
				
			||||||
 | 
					  if (!agg && size==0)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    archivio = path;
 | 
				
			||||||
 | 
					    archivio.add("install.ini");
 | 
				
			||||||
 | 
					    fcopy("install.ini",(const char *)archivio);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										169
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							
							
						
						
									
										169
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							@ -13,7 +13,16 @@
 | 
				
			|||||||
#include "ba1500.h"
 | 
					#include "ba1500.h"
 | 
				
			||||||
#include "ba1600.h"
 | 
					#include "ba1600.h"
 | 
				
			||||||
#include "ba1700a.h"
 | 
					#include "ba1700a.h"
 | 
				
			||||||
 | 
					// definizioni delle colonne dello sheet
 | 
				
			||||||
 | 
					#define C_MODULE 1
 | 
				
			||||||
 | 
					#define C_CODE 2
 | 
				
			||||||
 | 
					#define C_RELEASE 3
 | 
				
			||||||
 | 
					#define C_PATCH 4
 | 
				
			||||||
 | 
					#define C_DATAREL 5
 | 
				
			||||||
 | 
					#define C_CURRRELEASE 6
 | 
				
			||||||
 | 
					#define C_CURRPATCH 7
 | 
				
			||||||
 | 
					#define C_CURRDATAREL 8
 | 
				
			||||||
 | 
					#define C_ISPATCH 9
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HIDDEN int noyes_box(const char* msg)
 | 
					HIDDEN int noyes_box(const char* msg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -68,7 +77,7 @@ protected:
 | 
				
			|||||||
  static bool sheet_notify(TSheet_field& s, int r, KEY k);
 | 
					  static bool sheet_notify(TSheet_field& s, int r, KEY k);
 | 
				
			||||||
  static bool install_handler(TMask_field& fld, KEY key);
 | 
					  static bool install_handler(TMask_field& fld, KEY key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool add_module(TConfig& ini, const TString& module, bool patch);
 | 
					  bool add_module(TConfig& ini, const TString& module, bool patch, int pos=-1);
 | 
				
			||||||
  bool add_header(TConfig& ini, const TString& module, bool patch);
 | 
					  bool add_header(TConfig& ini, const TString& module, bool patch);
 | 
				
			||||||
  int sort_modules();
 | 
					  int sort_modules();
 | 
				
			||||||
  void update_version();
 | 
					  void update_version();
 | 
				
			||||||
@ -95,7 +104,7 @@ public:
 | 
				
			|||||||
TInstaller_mask* TInstaller_mask::_curr_mask = NULL;
 | 
					TInstaller_mask* TInstaller_mask::_curr_mask = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Copia nello sheet i dati di un modulo prendendoli da un .ini
 | 
					// Copia nello sheet i dati di un modulo prendendoli da un .ini
 | 
				
			||||||
bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch)
 | 
					bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch, int pos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  ini.write_protect();
 | 
					  ini.write_protect();
 | 
				
			||||||
  bool ok = ini.set_paragraph(module);
 | 
					  bool ok = ini.set_paragraph(module);
 | 
				
			||||||
@ -109,7 +118,10 @@ bool TInstaller_mask::add_module(TConfig& ini, const TString& module, bool patch
 | 
				
			|||||||
    row.add(ini.get("Patch"));
 | 
					    row.add(ini.get("Patch"));
 | 
				
			||||||
    row.add(ini.get("Data"));
 | 
					    row.add(ini.get("Data"));
 | 
				
			||||||
    row.add(patch ? "X" : " ", 9);
 | 
					    row.add(patch ? "X" : " ", 9);
 | 
				
			||||||
 | 
					    if (pos==-1)
 | 
				
			||||||
      add(row);
 | 
					      add(row);
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      insert(row,pos);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ok;
 | 
					  return ok;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -147,23 +159,32 @@ static int compare_modules(const TObject** o1, const TObject** o2)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int TInstaller_mask::sort_modules()
 | 
					int TInstaller_mask::sort_modules()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  //rows_array().TArray::sort(compare_modules);
 | 
					  // sort
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  TString16 dis;
 | 
					 | 
				
			||||||
  const int tot = int(items());
 | 
					  const int tot = int(items());
 | 
				
			||||||
 | 
					  return tot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // vecchio codice per bubblare
 | 
				
			||||||
  for (int r = 0; r < tot; r++)
 | 
					  for (int r = 0; r < tot; r++)
 | 
				
			||||||
  {                                  
 | 
					  {                                  
 | 
				
			||||||
    const bool patch = row(r).get_char(9) > ' ';
 | 
					    const bool patch = row(r).get_char(C_ISPATCH) > ' ';
 | 
				
			||||||
    const char* mod = row(r).get(2);
 | 
					    const char* mod = row(r).get(C_CODE);
 | 
				
			||||||
    if (*mod != ' ') // is not an header...
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    if (patch)
 | 
					    if (patch)
 | 
				
			||||||
    {   
 | 
					    {   
 | 
				
			||||||
        if (dis == mod)
 | 
					      TString16 dis=mod;
 | 
				
			||||||
          disable_row(r);
 | 
					      const int patchlevel = row(r).get_int(C_PATCH);
 | 
				
			||||||
 | 
					      // pop the patch line up to the module one
 | 
				
			||||||
 | 
					      int br=r-1;
 | 
				
			||||||
 | 
					      while (br && !(dis==row(br).get(C_CODE) && row(br).get_int(C_PATCH)<patchlevel))
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        // Swap rows
 | 
				
			||||||
 | 
					        rows_array().TArray::swap(br,br+1);
 | 
				
			||||||
 | 
					        const bool enab=row_enabled(br);
 | 
				
			||||||
 | 
					        const bool enab1=row_enabled(br+1);
 | 
				
			||||||
 | 
					        enable_row(br+1,enab);
 | 
				
			||||||
 | 
					        enable_row(br, enab1);
 | 
				
			||||||
 | 
					        br--;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      else             
 | 
					 | 
				
			||||||
        dis = mod;      
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return tot;
 | 
					  return tot;
 | 
				
			||||||
@ -176,16 +197,16 @@ void TInstaller_mask::update_version()
 | 
				
			|||||||
  TString_array& array = rows_array();
 | 
					  TString_array& array = rows_array();
 | 
				
			||||||
  FOR_EACH_ARRAY_ROW_BACK(array, m, row)
 | 
					  FOR_EACH_ARRAY_ROW_BACK(array, m, row)
 | 
				
			||||||
  {                               
 | 
					  {                               
 | 
				
			||||||
    if (*row->get(2) != ' ')
 | 
					    if (*row->get(C_CODE) != ' ')
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      const TString16 module = row->get(2);
 | 
					      const TString16 module = row->get(C_CODE);
 | 
				
			||||||
      ini.set_paragraph(module);
 | 
					      ini.set_paragraph(module);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
      const TString16 newver = row->get(3);
 | 
					      const TString16 newver = row->get(C_RELEASE);
 | 
				
			||||||
      const TString16 oldver = ini.get("Versione");
 | 
					      const TString16 oldver = ini.get("Versione");
 | 
				
			||||||
      row->add(oldver, 6);       
 | 
					      row->add(oldver, C_CURRRELEASE);
 | 
				
			||||||
      row->add(ini.get("Patch"), 7);
 | 
					      row->add(ini.get("Patch"), C_CURRPATCH);
 | 
				
			||||||
      row->add(ini.get("Data"), 8);
 | 
					      row->add(ini.get("Data"), C_CURRDATAREL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  force_update();
 | 
					  force_update();
 | 
				
			||||||
@ -195,6 +216,7 @@ void TInstaller_mask::update_version()
 | 
				
			|||||||
// utilizzabili per un'installazione e li inserisce nello spreadsheet
 | 
					// utilizzabili per un'installazione e li inserisce nello spreadsheet
 | 
				
			||||||
bool TInstaller_mask::autoload()
 | 
					bool TInstaller_mask::autoload()
 | 
				
			||||||
{                
 | 
					{                
 | 
				
			||||||
 | 
					  TString_array& mask_rows = rows_array();
 | 
				
			||||||
  const TString& path = get(F_PATH);
 | 
					  const TString& path = get(F_PATH);
 | 
				
			||||||
  if (!fexist(path))
 | 
					  if (!fexist(path))
 | 
				
			||||||
    return error_box("Specificare un percorso valido");
 | 
					    return error_box("Specificare un percorso valido");
 | 
				
			||||||
@ -242,10 +264,13 @@ bool TInstaller_mask::autoload()
 | 
				
			|||||||
      add_module(ini, module, FALSE);
 | 
					      add_module(ini, module, FALSE);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  // add patches
 | 
				
			||||||
  ininame = path;  
 | 
					  ininame = path;  
 | 
				
			||||||
  ininame.add("??0???a.ini");
 | 
					  ininame.add("??0???a.ini");
 | 
				
			||||||
  modules.destroy();
 | 
					  modules.destroy();
 | 
				
			||||||
  list_files(ininame, modules);
 | 
					  list_files(ininame, modules);
 | 
				
			||||||
 | 
					  modules.sort();  // sort to have patches in patchlevel order
 | 
				
			||||||
  FOR_EACH_ARRAY_ROW(modules, am, arow)
 | 
					  FOR_EACH_ARRAY_ROW(modules, am, arow)
 | 
				
			||||||
  {               
 | 
					  {               
 | 
				
			||||||
    TString& ininame = *arow;
 | 
					    TString& ininame = *arow;
 | 
				
			||||||
@ -254,9 +279,19 @@ bool TInstaller_mask::autoload()
 | 
				
			|||||||
    CHECKS(pos >= 6, "Invalid installation configuration: ", (const char*)ininame);
 | 
					    CHECKS(pos >= 6, "Invalid installation configuration: ", (const char*)ininame);
 | 
				
			||||||
    const TString16 module = ininame.mid(pos-6, 2);
 | 
					    const TString16 module = ininame.mid(pos-6, 2);
 | 
				
			||||||
    TConfig ini(ininame, module);
 | 
					    TConfig ini(ininame, module);
 | 
				
			||||||
 | 
					    const int patchlevel = ini.get_int("Patch");
 | 
				
			||||||
 | 
					    const int maxrows=int(items());
 | 
				
			||||||
 | 
					    bool found=FALSE;
 | 
				
			||||||
 | 
					    for (int r = maxrows-1; r >=0 && !found; r--)
 | 
				
			||||||
 | 
					      found=(module == row(r).get(C_CODE) );
 | 
				
			||||||
 | 
					    if (found)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      const char * patchversion = ini.get("Versione");
 | 
				
			||||||
 | 
					      if (mask_rows.row(r+1).get(C_RELEASE) == patchversion) 
 | 
				
			||||||
 | 
					        mask_rows.row(r+1).add(patchlevel, C_PATCH);
 | 
				
			||||||
 | 
					    } else
 | 
				
			||||||
      add_module(ini, module, TRUE);
 | 
					      add_module(ini, module, TRUE);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  const bool ok = sort_modules() > 0;
 | 
					  const bool ok = sort_modules() > 0;
 | 
				
			||||||
  if (ok)
 | 
					  if (ok)
 | 
				
			||||||
@ -351,10 +386,27 @@ bool TInstaller_mask::can_install(const char* module, TInstall_ini& ini)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// sposta il file dal direttorio temporaneo a quello passato come destinazione
 | 
					// sposta il file dal direttorio temporaneo a quello passato come destinazione
 | 
				
			||||||
bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, const char* dir) const
 | 
					// from: direttorio di partenza
 | 
				
			||||||
 | 
					// file: nome del file con path  completo da spostare (può includere sottodirettori)
 | 
				
			||||||
 | 
					// todir: direttorio destinazione (si assume che esista già)
 | 
				
			||||||
 | 
					bool TInstaller_mask::move_file(const TFilename& from, const TFilename& file, const char* todir) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TFilename dest(dir);
 | 
					  
 | 
				
			||||||
  dest.add(file.mid(from.len()));
 | 
					  TFilename dest(todir);
 | 
				
			||||||
 | 
					  dest.add(file.mid(from.len()+1));
 | 
				
			||||||
 | 
					  if (!fexist(dest.path()))
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    // file contains non existent subdir specification
 | 
				
			||||||
 | 
					    TToken_string dirs((const char * )(dest.path()),'\\');
 | 
				
			||||||
 | 
					    TFilename subdir;
 | 
				
			||||||
 | 
					    for (int c=0; c < dirs.items()-1; c++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      subdir.add(dirs.get(c));
 | 
				
			||||||
 | 
					      if (!fexist(subdir) )
 | 
				
			||||||
 | 
					        // build destination directory
 | 
				
			||||||
 | 
					        make_dir(subdir);
 | 
				
			||||||
 | 
					    }    
 | 
				
			||||||
 | 
					  }    
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  const long filesize = fsize(file);
 | 
					  const long filesize = fsize(file);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@ -460,7 +512,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
				
			|||||||
    ok = dischi > 0;
 | 
					    ok = dischi > 0;
 | 
				
			||||||
    if (!ok)
 | 
					    if (!ok)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      return error_box("Impossibile determinare il numero dei dischetti");
 | 
					      return error_box("Impossibile determinare il numero dei dischetti in %s",ininame.name());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -468,8 +520,10 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
				
			|||||||
      if (!ok) return FALSE;
 | 
					      if (!ok) return FALSE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    TString msg;
 | 
					    TString msg("Decompressione");
 | 
				
			||||||
    msg << "Decompressione del modulo '" << module << "' in corso...";
 | 
					    if (patchlevel > 0 )
 | 
				
			||||||
 | 
					      msg << " della patch " << patchlevel ;
 | 
				
			||||||
 | 
					    msg  << " del modulo '" << module << "' in corso...";
 | 
				
			||||||
    TProgind pi(dischi, msg, FALSE, TRUE);
 | 
					    TProgind pi(dischi, msg, FALSE, TRUE);
 | 
				
			||||||
    TFilename tempdir; tempdir.tempdir();
 | 
					    TFilename tempdir; tempdir.tempdir();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -639,7 +693,8 @@ void TInstaller_mask::install_selection()
 | 
				
			|||||||
  TString_array& arr = rows_array();
 | 
					  TString_array& arr = rows_array();
 | 
				
			||||||
  FOR_EACH_ARRAY_ROW(arr, r, row) if (checked(r))
 | 
					  FOR_EACH_ARRAY_ROW(arr, r, row) if (checked(r))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const TString newver = row->get(3);
 | 
					
 | 
				
			||||||
 | 
					    const TString newver = row->get(C_RELEASE);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (newver.blank())
 | 
					    if (newver.blank())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -647,10 +702,10 @@ void TInstaller_mask::install_selection()
 | 
				
			|||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const TString modulo = row->get(2);
 | 
					    const TString modulo = row->get(C_CODE);
 | 
				
			||||||
    const int newpatch = row->get_int(4);
 | 
					    const int newpatch = row->get_int(C_PATCH);
 | 
				
			||||||
    const TString oldver = row->get(6);
 | 
					    const TString oldver = row->get(C_CURRRELEASE);
 | 
				
			||||||
    const int oldpatch = row->get_int(7);
 | 
					    const int oldpatch = row->get_int(C_CURRPATCH);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (version2year(newver) < 1997)
 | 
					    if (version2year(newver) < 1997)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -670,30 +725,48 @@ void TInstaller_mask::install_selection()
 | 
				
			|||||||
                     "funzionamento di tutti i programmi!", (const char*)newver, newpatch, (const char*)modulo);
 | 
					                     "funzionamento di tutti i programmi!", (const char*)newver, newpatch, (const char*)modulo);
 | 
				
			||||||
      ok = noyes_box(msg);
 | 
					      ok = noyes_box(msg);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    const bool is_patch = row->get_char(C_ISPATCH) > ' ';
 | 
				
			||||||
 | 
					    if (is_patch)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      // installo le patch solo se esiste già un modulo installato della stessa versione
 | 
				
			||||||
 | 
					      if (!oldver.blank() )
 | 
				
			||||||
 | 
					        if (oldver != newver)
 | 
				
			||||||
 | 
					          ok =error_box("Impossibile installare le patch della versione %s \nperché il modulo '%s' installato ha versione %s ",(const char *)newver,(const char *)modulo,(const char *)oldver);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (ok)
 | 
					    if (ok)
 | 
				
			||||||
    {                         
 | 
					    {                         
 | 
				
			||||||
      const bool is_patch = row->get_char(9) > ' ';
 | 
					 | 
				
			||||||
      ok = install(modulo, is_patch ? newpatch : 0);
 | 
					      ok = install(modulo, is_patch ? newpatch : 0);
 | 
				
			||||||
      if (ok)
 | 
					      if (ok)
 | 
				
			||||||
        _installed = TRUE; // Setta il flag di almeno un modulo installato
 | 
					        _installed = TRUE; // Setta il flag di almeno un modulo installato
 | 
				
			||||||
      if (!is_patch)          // Se installo un modulo pricipale ...
 | 
					      if (!is_patch)          // Se installo un modulo pricipale ...
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        // ... allora installo tutte le patches
 | 
					        // ... allora installo tutte le patches
 | 
				
			||||||
        for (int p = r+1; ok; p++)
 | 
					        TString_array modules;
 | 
				
			||||||
 | 
					        TFilename ininame = get(F_PATH);  
 | 
				
			||||||
 | 
					        ininame.add("??0???a.ini");
 | 
				
			||||||
 | 
					        modules.destroy();
 | 
				
			||||||
 | 
					        list_files(ininame, modules);
 | 
				
			||||||
 | 
					        modules.sort(); // sort by patch number
 | 
				
			||||||
 | 
					        FOR_EACH_ARRAY_ROW(modules, am, arow)
 | 
				
			||||||
        {               
 | 
					        {               
 | 
				
			||||||
          if (row_disabled(p))
 | 
					          TString& ininame = *arow;
 | 
				
			||||||
 | 
					          ininame.lower();
 | 
				
			||||||
 | 
					          const int pos = ininame.find("a.ini");
 | 
				
			||||||
 | 
					          CHECKS(pos >= 6, "Invalid installation configuration: ", (const char*)ininame);
 | 
				
			||||||
 | 
					          const TString16 patchmodule = ininame.mid(pos-6, 2);
 | 
				
			||||||
 | 
					          if (patchmodule == modulo)
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            const int patchlevel = arr.row(p).get_int(4);
 | 
					            TConfig ini(ininame, patchmodule);
 | 
				
			||||||
 | 
					            const int patchlevel = ini.get_int("Patch");
 | 
				
			||||||
 | 
					            const char * patchversion = ini.get("Versione");
 | 
				
			||||||
 | 
					            if (patchversion == newver) // installa solo le patch della stessa ver
 | 
				
			||||||
              ok = install(modulo, patchlevel);
 | 
					              ok = install(modulo, patchlevel);
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          else
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (ok)
 | 
					      if (ok)
 | 
				
			||||||
        check(r, FALSE);       
 | 
					        check(r, FALSE);       
 | 
				
			||||||
    }  
 | 
					    }  
 | 
				
			||||||
    if (ok)
 | 
					 | 
				
			||||||
    check(r,FALSE); // uncheck 
 | 
					    check(r,FALSE); // uncheck 
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -726,10 +799,10 @@ bool TInstaller_mask::tutti_handler(TMask_field& f, KEY k)
 | 
				
			|||||||
        for (long i = s.items()-1; i >=0; i--)
 | 
					        for (long i = s.items()-1; i >=0; i--)
 | 
				
			||||||
        {                 
 | 
					        {                 
 | 
				
			||||||
          TToken_string r = s.row(i);
 | 
					          TToken_string r = s.row(i);
 | 
				
			||||||
          const TString16 newver = r.get(3);
 | 
					          const TString16 newver = r.get(C_RELEASE);
 | 
				
			||||||
          const int newpatch = r.get_int(4);
 | 
					          const int newpatch = r.get_int(C_PATCH);
 | 
				
			||||||
          const TString16 curver = r.get(6);
 | 
					          const TString16 curver = r.get(C_CURRRELEASE);
 | 
				
			||||||
          const int curpatch = r.get_int(7);
 | 
					          const int curpatch = r.get_int(C_CURRPATCH);
 | 
				
			||||||
          s.check(i, compare_version(newver, newpatch, curver, curpatch) > 0);
 | 
					          s.check(i, compare_version(newver, newpatch, curver, curpatch) > 0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -749,10 +822,10 @@ bool TInstaller_mask::on_key(KEY key)
 | 
				
			|||||||
      for (long i = items()-1; i >=0; i--)
 | 
					      for (long i = items()-1; i >=0; i--)
 | 
				
			||||||
      {                 
 | 
					      {                 
 | 
				
			||||||
        TToken_string r = row(i);
 | 
					        TToken_string r = row(i);
 | 
				
			||||||
        const TString16 newver = r.get(3);
 | 
					        const TString16 newver = r.get(C_RELEASE);
 | 
				
			||||||
        const int newpatch = r.get_int(4);
 | 
					        const int newpatch = r.get_int(C_PATCH);
 | 
				
			||||||
        const TString16 curver = r.get(6);
 | 
					        const TString16 curver = r.get(C_CURRRELEASE);
 | 
				
			||||||
        const int curpatch = r.get_int(7);
 | 
					        const int curpatch = r.get_int(C_CURRPATCH);
 | 
				
			||||||
        check(i, compare_version(newver, newpatch, curver, curpatch > 0));
 | 
					        check(i, compare_version(newver, newpatch, curver, curpatch > 0));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
@ -764,7 +837,7 @@ bool TInstaller_mask::on_key(KEY key)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TInstaller_mask::TInstaller_mask()
 | 
					TInstaller_mask::TInstaller_mask()
 | 
				
			||||||
               : TArray_sheet(0, 0, 0, 0, "Installazione", 
 | 
					               : TArray_sheet(0, 0, 0, 0, "Installazione", 
 | 
				
			||||||
                "@1|Modulo@30|Cod.|Versione\nda installare@13|Livello\nPatch|Data\nRilascio@10|Versione\nInstallata@10|Livello\nPatch|Data\nInstallazione@13|Aggiornamento",    
 | 
					                "@1|Modulo@30|Cod.|Versione da\ninstallare@11|Livello\nPatch@8|Data\nRilascio@10|Versione\nInstallata@10|Livello\nPatch@8|Data\nInstallazione@13|Aggiornamento",    
 | 
				
			||||||
                0x18, 3)
 | 
					                0x18, 3)
 | 
				
			||||||
{               
 | 
					{               
 | 
				
			||||||
  _curr_mask = this;
 | 
					  _curr_mask = this;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,12 +7,16 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <io.h>
 | 
					#include <io.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <direct.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define WINAPI _far _pascal                
 | 
					#define WINAPI _far _pascal                
 | 
				
			||||||
#define LPSTR char*
 | 
					#define LPSTR char*
 | 
				
			||||||
#define LPCSTR const LPSTR
 | 
					#define LPCSTR const LPSTR
 | 
				
			||||||
int WINAPI GetPrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPSTR, int, LPCSTR);
 | 
					int WINAPI GetPrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPSTR, int, LPCSTR);
 | 
				
			||||||
int WINAPI WritePrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
 | 
					int WINAPI WritePrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
 | 
				
			||||||
 | 
					#define DRIVE_REMOVABLE 2
 | 
				
			||||||
 | 
					#define DRIVE_FIXED     3
 | 
				
			||||||
 | 
					#define DRIVE_REMOTE    4
 | 
				
			||||||
UINT WINAPI GetDriveType(int);
 | 
					UINT WINAPI GetDriveType(int);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // DOS
 | 
					#endif  // DOS
 | 
				
			||||||
@ -424,6 +428,9 @@ const char* CGetPrawinName(void)
 | 
				
			|||||||
      fclose(pw);
 | 
					      fclose(pw);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    prawin = malloc(_MAX_PATH);
 | 
					    prawin = malloc(_MAX_PATH);
 | 
				
			||||||
 | 
					    if (*path)
 | 
				
			||||||
 | 
					      strcpy(prawin,tmp); 
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
      _searchenv(tmp, NULL, prawin);
 | 
					      _searchenv(tmp, NULL, prawin);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return prawin;
 | 
					  return prawin;
 | 
				
			||||||
@ -463,13 +470,12 @@ BOOLEAN CPutPrawin(const char* pref)
 | 
				
			|||||||
  const char* prawin = CGetPrawinName();
 | 
					  const char* prawin = CGetPrawinName();
 | 
				
			||||||
  BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin);
 | 
					  BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin);
 | 
				
			||||||
  int disk = toupper(*prawin) - 'A';
 | 
					  int disk = toupper(*prawin) - 'A';
 | 
				
			||||||
  if (GetDriveType(disk) == 3)  // Aggiorna lo studio solo sui dischi locali
 | 
					 | 
				
			||||||
  { 
 | 
					 | 
				
			||||||
    FILE* pppi;  // PathPrefPuntoIni
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
  WritePrivateProfileString("Main", "Study", __ptprf, prawin);
 | 
					  WritePrivateProfileString("Main", "Study", __ptprf, prawin);
 | 
				
			||||||
      
 | 
					  if (GetDriveType(_getdrive() -1 ) == DRIVE_FIXED)  
 | 
				
			||||||
    // Aggiorna anche il vecchio pathpref.ini
 | 
					  { 
 | 
				
			||||||
 | 
					    // Aggiorna anche il vecchio pathpref.ini, ma solo sui dischi locali: 
 | 
				
			||||||
 | 
					    // nei dischi remoti lo studio va cambiato modificando direttamente il file
 | 
				
			||||||
 | 
					    FILE* pppi;  // PathPrefPuntoIni
 | 
				
			||||||
    pppi = fopen("pathpref.ini", "w");
 | 
					    pppi = fopen("pathpref.ini", "w");
 | 
				
			||||||
    fprintf(pppi, "%s\n", __ptprf);
 | 
					    fprintf(pppi, "%s\n", __ptprf);
 | 
				
			||||||
    fclose(pppi);
 | 
					    fclose(pppi);
 | 
				
			||||||
 | 
				
			|||||||
@ -286,7 +286,7 @@ SECTION BODY ODD 1
 | 
				
			|||||||
        KEY "prezzo"
 | 
					        KEY "prezzo"
 | 
				
			||||||
        PROMPT  99 1 ""
 | 
					        PROMPT  99 1 ""
 | 
				
			||||||
        FIELD LF_RMOVMAG->PREZZO
 | 
					        FIELD LF_RMOVMAG->PREZZO
 | 
				
			||||||
        PICTURE "###.####.##@"
 | 
					        PICTURE "###.###.##@"
 | 
				
			||||||
      END
 | 
					      END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      NUMERO 108
 | 
					      NUMERO 108
 | 
				
			||||||
@ -294,7 +294,7 @@ SECTION BODY ODD 1
 | 
				
			|||||||
        KEY "valore"
 | 
					        KEY "valore"
 | 
				
			||||||
        PROMPT  112 1 ""
 | 
					        PROMPT  112 1 ""
 | 
				
			||||||
        MESSAGE _NUMEXPR,LF_RMOVMAG->PREZZO*LF_RMOVMAG->QUANT*349@->FC|ADD,10
 | 
					        MESSAGE _NUMEXPR,LF_RMOVMAG->PREZZO*LF_RMOVMAG->QUANT*349@->FC|ADD,10
 | 
				
			||||||
        PICTURE "##.###.####.##@"
 | 
					        PICTURE "##.###.###.##@"
 | 
				
			||||||
      END
 | 
					      END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    END // RIGHE MOVIMENTO
 | 
					    END // RIGHE MOVIMENTO
 | 
				
			||||||
@ -303,7 +303,7 @@ SECTION BODY ODD 1
 | 
				
			|||||||
    BEGIN
 | 
					    BEGIN
 | 
				
			||||||
      KEY "totale mov"
 | 
					      KEY "totale mov"
 | 
				
			||||||
      PROMPT  83 3 "Totale valore movimentato: £ "
 | 
					      PROMPT  83 3 "Totale valore movimentato: £ "
 | 
				
			||||||
      PICTURE "##.###.####.##@"
 | 
					      PICTURE "##.###.###.##@"
 | 
				
			||||||
    END
 | 
					    END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										137
									
								
								mg/mglib01.cpp
									
									
									
									
									
								
							
							
						
						
									
										137
									
								
								mg/mglib01.cpp
									
									
									
									
									
								
							@ -11,7 +11,8 @@
 | 
				
			|||||||
// *******************************
 | 
					// *******************************
 | 
				
			||||||
#define MAXSIMBOLS 256
 | 
					#define MAXSIMBOLS 256
 | 
				
			||||||
#define MAXSTATES 25
 | 
					#define MAXSTATES 25
 | 
				
			||||||
class TStateset {
 | 
					class TStateset
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  unsigned char _container[MAXSTATES];
 | 
					  unsigned char _container[MAXSTATES];
 | 
				
			||||||
  int _current;
 | 
					  int _current;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@ -27,7 +28,8 @@ public:
 | 
				
			|||||||
  ~TStateset() {};  
 | 
					  ~TStateset() {};  
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct TAutoma_state  {
 | 
					struct TAutoma_state
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  short _transaction[MAXSIMBOLS];
 | 
					  short _transaction[MAXSIMBOLS];
 | 
				
			||||||
  TString16 * _label;
 | 
					  TString16 * _label;
 | 
				
			||||||
  bool _final;
 | 
					  bool _final;
 | 
				
			||||||
@ -43,7 +45,8 @@ struct TAutoma_state  {
 | 
				
			|||||||
// *******************************
 | 
					// *******************************
 | 
				
			||||||
// *******************************
 | 
					// *******************************
 | 
				
			||||||
// automa per il riconoscimento di metacaratteri
 | 
					// automa per il riconoscimento di metacaratteri
 | 
				
			||||||
class TR_automa {
 | 
					class TR_automa
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  TAutoma_state st[MAXSTATES];
 | 
					  TAutoma_state st[MAXSTATES];
 | 
				
			||||||
  short _maxstate;
 | 
					  short _maxstate;
 | 
				
			||||||
protected:  
 | 
					protected:  
 | 
				
			||||||
@ -86,19 +89,22 @@ TStateset::TStateset()
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TStateset & TStateset::empty()
 | 
					TStateset & TStateset::empty()
 | 
				
			||||||
{ _current=0;
 | 
					{
 | 
				
			||||||
 | 
					  _current=0;
 | 
				
			||||||
  for (int i= 0; i< MAXSTATES; _container[i++]=0);
 | 
					  for (int i= 0; i< MAXSTATES; _container[i++]=0);
 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TStateset & TStateset::enclose(int el)
 | 
					TStateset & TStateset::enclose(int el)
 | 
				
			||||||
{ if (el< MAXSTATES && el>=0)
 | 
					{
 | 
				
			||||||
 | 
					  if (el< MAXSTATES && el>=0)
 | 
				
			||||||
    _container[el]=1;
 | 
					    _container[el]=1;
 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TStateset & TStateset::singleton(int el)
 | 
					TStateset & TStateset::singleton(int el)
 | 
				
			||||||
{ empty();
 | 
					{
 | 
				
			||||||
 | 
					  empty();
 | 
				
			||||||
  _container[el]=1;
 | 
					  _container[el]=1;
 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -112,9 +118,9 @@ TStateset & TStateset::cap(TStateset & s)
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
bool TStateset::is_empty() const
 | 
					bool TStateset::is_empty() const
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
  for (int i= 0; i< MAXSTATES; i++) {
 | 
					  for (int i= 0; i< MAXSTATES; i++)
 | 
				
			||||||
    if (_container[i]) return FALSE;
 | 
					    if (_container[i])
 | 
				
			||||||
  }
 | 
					      return FALSE;
 | 
				
			||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -131,10 +137,9 @@ int TStateset::get_first()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int TStateset::get_next()
 | 
					int TStateset::get_next()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  while (_current+1 < MAXSTATES)  {
 | 
					  while (_current+1 < MAXSTATES)
 | 
				
			||||||
    if (_container[++_current])
 | 
					    if (_container[++_current])
 | 
				
			||||||
      return _current;
 | 
					      return _current;
 | 
				
			||||||
  } 
 | 
					 | 
				
			||||||
  return (-1);  
 | 
					  return (-1);  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -147,10 +152,9 @@ bool TR_automa::is_state(int statenum)
 | 
				
			|||||||
// restituisce il numero dello stato con quella etichetta
 | 
					// restituisce il numero dello stato con quella etichetta
 | 
				
			||||||
int TR_automa::label2state(const char *label)
 | 
					int TR_automa::label2state(const char *label)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  for (int s=0; s<_maxstate;s++) {
 | 
					  for (int s=0; s<_maxstate;s++)
 | 
				
			||||||
    if (*(st[s]._label)==label)
 | 
					    if (*(st[s]._label)==label)
 | 
				
			||||||
      return(s+1);
 | 
					      return(s+1);
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return(0);  
 | 
					  return(0);  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -159,24 +163,25 @@ int TR_automa::label2state(const char *label)
 | 
				
			|||||||
TR_automa & TR_automa::reset_state(int statenum)
 | 
					TR_automa & TR_automa::reset_state(int statenum)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int _from,_to;
 | 
					  int _from,_to;
 | 
				
			||||||
  if (statenum>0 && statenum<=_maxstate) {
 | 
					  if (statenum>0 && statenum<=_maxstate)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    _from=statenum;
 | 
					    _from=statenum;
 | 
				
			||||||
    _to=statenum;
 | 
					    _to=statenum;
 | 
				
			||||||
  } else {
 | 
					  }
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    _maxstate=0;
 | 
					    _maxstate=0;
 | 
				
			||||||
    _isdeterministic=TRUE;
 | 
					    _isdeterministic=TRUE;
 | 
				
			||||||
    _from=1;
 | 
					    _from=1;
 | 
				
			||||||
    _to=MAXSTATES;
 | 
					    _to=MAXSTATES;
 | 
				
			||||||
  } 
 | 
					  } 
 | 
				
			||||||
 | 
					  for (int i=_from; i<=_to;i++)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    for (int i=_from; i<=_to;i++) {
 | 
					 | 
				
			||||||
    set_label(i,"");
 | 
					    set_label(i,"");
 | 
				
			||||||
    set_final(i,FALSE);
 | 
					    set_final(i,FALSE);
 | 
				
			||||||
      for (int j=0; j<MAXSIMBOLS;j++) {
 | 
					    for (int j=0; j<MAXSIMBOLS;j++)
 | 
				
			||||||
      del_trans(i,j); 
 | 
					      del_trans(i,j); 
 | 
				
			||||||
  }     
 | 
					  }     
 | 
				
			||||||
    }     
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -209,7 +214,8 @@ bool TR_automa::is_final(TStateset ss ) const
 | 
				
			|||||||
{ 
 | 
					{ 
 | 
				
			||||||
  bool retv=FALSE;
 | 
					  bool retv=FALSE;
 | 
				
			||||||
  int statenum=ss.get_first();
 | 
					  int statenum=ss.get_first();
 | 
				
			||||||
  do {
 | 
					  do
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    retv=retv || is_final(statenum);
 | 
					    retv=retv || is_final(statenum);
 | 
				
			||||||
  } while ((statenum=ss.get_next())>0);
 | 
					  } while ((statenum=ss.get_next())>0);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@ -251,43 +257,47 @@ TR_automa::TR_automa(TR_automa * aa,bool makedet)
 | 
				
			|||||||
  TString16  tmplabel;
 | 
					  TString16  tmplabel;
 | 
				
			||||||
  int curr_new_state;
 | 
					  int curr_new_state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (int i=0; i<MAXSTATES;i++) {
 | 
					  for (int i=0; i<MAXSTATES;i++)
 | 
				
			||||||
    st[i]._label = new TString16;
 | 
					    st[i]._label = new TString16;
 | 
				
			||||||
  }     
 | 
					  if (aa==NULL)
 | 
				
			||||||
  if (aa==NULL) {
 | 
					  {
 | 
				
			||||||
    reset_state();
 | 
					    reset_state();
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (makedet) {
 | 
					  if (makedet)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    reset_state();
 | 
					    reset_state();
 | 
				
			||||||
    // crea il primo stato nell'automa deterministico
 | 
					    // crea il primo stato nell'automa deterministico
 | 
				
			||||||
    set2label(aa->union_of_closures(newstateset.singleton(FIRST_STATE)),tmplabel);
 | 
					    set2label(aa->union_of_closures(newstateset.singleton(FIRST_STATE)),tmplabel);
 | 
				
			||||||
    add_state(tmplabel);
 | 
					    add_state(tmplabel);
 | 
				
			||||||
    curr_new_state=FIRST_STATE;
 | 
					    curr_new_state=FIRST_STATE;
 | 
				
			||||||
    while (is_state(curr_new_state)) {
 | 
					    while (is_state(curr_new_state))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      // determina l'insieme degli stati dell'automa non deterministico
 | 
					      // determina l'insieme degli stati dell'automa non deterministico
 | 
				
			||||||
      // che corrispondono a questo stato dell'automa deterministico
 | 
					      // che corrispondono a questo stato dell'automa deterministico
 | 
				
			||||||
      label2set(label(curr_new_state),newstateset);
 | 
					      label2set(label(curr_new_state),newstateset);
 | 
				
			||||||
      // lo stato è finale se include stati finali dell'automa non det.
 | 
					      // lo stato è finale se include stati finali dell'automa non det.
 | 
				
			||||||
      set_final(curr_new_state,aa->is_final(newstateset));
 | 
					      set_final(curr_new_state,aa->is_final(newstateset));
 | 
				
			||||||
      // determina tutte le transazioni 
 | 
					      // determina tutte le transazioni 
 | 
				
			||||||
      for (short symbol=FIRST_NEMPTY_SYMBOL; symbol<MAXSIMBOLS; symbol++) {
 | 
					      for (short symbol=FIRST_NEMPTY_SYMBOL; symbol<MAXSIMBOLS; symbol++)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
        // determina lo stato di arrivo nell'automa det.:
 | 
					        // determina lo stato di arrivo nell'automa det.:
 | 
				
			||||||
        // esso è pari all'insieme degli stati raggiunti col questo simbolo 
 | 
					        // esso è pari all'insieme degli stati raggiunti col questo simbolo 
 | 
				
			||||||
        // dal sottoinsieme degli stati dell'automa non det. che etichetta il nuovo stato nell'automa det.
 | 
					        // dal sottoinsieme degli stati dell'automa non det. che etichetta il nuovo stato nell'automa det.
 | 
				
			||||||
        arrival.empty();
 | 
					        arrival.empty();
 | 
				
			||||||
        int new_next,old_next;
 | 
					        int new_next,old_next;
 | 
				
			||||||
        int old_state=newstateset.get_first() ;
 | 
					        int old_state=newstateset.get_first() ;
 | 
				
			||||||
        do {
 | 
					        do
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
          if (old_next=aa->trans_to(old_state,(unsigned char)symbol))
 | 
					          if (old_next=aa->trans_to(old_state,(unsigned char)symbol))
 | 
				
			||||||
            arrival.enclose(old_next);
 | 
					            arrival.enclose(old_next);
 | 
				
			||||||
        } while ((old_state=newstateset.get_next())>0);
 | 
					        } while ((old_state=newstateset.get_next())>0);
 | 
				
			||||||
        if (!arrival.is_empty()) {
 | 
					        if (!arrival.is_empty())
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
            // crea il nuovo arco nell'automa deterministico
 | 
					            // crea il nuovo arco nell'automa deterministico
 | 
				
			||||||
          set2label(aa->union_of_closures(arrival),tmplabel);
 | 
					          set2label(aa->union_of_closures(arrival),tmplabel);
 | 
				
			||||||
          if (!(new_next=label2state(tmplabel))) {
 | 
					          if (!(new_next=label2state(tmplabel)))
 | 
				
			||||||
            new_next=add_state(tmplabel);
 | 
					            new_next=add_state(tmplabel);
 | 
				
			||||||
          } 
 | 
					 | 
				
			||||||
          add_tran(curr_new_state,(unsigned char)symbol,new_next);
 | 
					          add_tran(curr_new_state,(unsigned char)symbol,new_next);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } // loop symbol
 | 
					      } // loop symbol
 | 
				
			||||||
@ -298,18 +308,16 @@ TR_automa::TR_automa(TR_automa * aa,bool makedet)
 | 
				
			|||||||
  else 
 | 
					  else 
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    *this=*aa;
 | 
					    *this=*aa;
 | 
				
			||||||
    for (int i=0; i<MAXSTATES;i++) {
 | 
					    for (int i=0; i<MAXSTATES;i++)
 | 
				
			||||||
      st[i]._label= aa->st[i]._label;
 | 
					      st[i]._label= aa->st[i]._label;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TR_automa::~TR_automa()
 | 
					TR_automa::~TR_automa()
 | 
				
			||||||
{ 
 | 
					{ 
 | 
				
			||||||
  for (int i=0; i<MAXSTATES;i++) {
 | 
					  for (int i=0; i<MAXSTATES;i++)
 | 
				
			||||||
    delete (st[i]._label);
 | 
					    delete (st[i]._label);
 | 
				
			||||||
  }     
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -317,10 +325,9 @@ void TR_automa::set2label(const TStateset ss,TString16 & label)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  char coded[MAXSTATES];
 | 
					  char coded[MAXSTATES];
 | 
				
			||||||
  char c=0;
 | 
					  char c=0;
 | 
				
			||||||
  for (int i= 0; i< MAXSTATES; i++) {
 | 
					  for (int i= 0; i< MAXSTATES; i++)
 | 
				
			||||||
    if (ss.is_member(i)) 
 | 
					    if (ss.is_member(i)) 
 | 
				
			||||||
      coded[c++]=(char)(i+'0');
 | 
					      coded[c++]=(char)(i+'0');
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  coded[c]='\0';
 | 
					  coded[c]='\0';
 | 
				
			||||||
  label=coded;    
 | 
					  label=coded;    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -343,12 +350,15 @@ TStateset TR_automa::union_of_closures(TStateset &start_set)
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  u_of_clo.empty();
 | 
					  u_of_clo.empty();
 | 
				
			||||||
  _state=start_set.get_first() ;
 | 
					  _state=start_set.get_first() ;
 | 
				
			||||||
  do {
 | 
					  do
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    // la chiusura è composta dallo stato e tutte le sue transazioni epsilon
 | 
					    // la chiusura è composta dallo stato e tutte le sue transazioni epsilon
 | 
				
			||||||
    clo.singleton(_state);
 | 
					    clo.singleton(_state);
 | 
				
			||||||
    do {
 | 
					    do
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      int _state2=clo.get_first();
 | 
					      int _state2=clo.get_first();
 | 
				
			||||||
      do {
 | 
					      do
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
        toadd=((_next=trans_to(_state2,EPSILON)) && (!clo.is_member(_next)));
 | 
					        toadd=((_next=trans_to(_state2,EPSILON)) && (!clo.is_member(_next)));
 | 
				
			||||||
        if (toadd)
 | 
					        if (toadd)
 | 
				
			||||||
          clo.enclose(_next);
 | 
					          clo.enclose(_next);
 | 
				
			||||||
@ -362,20 +372,18 @@ TStateset TR_automa::union_of_closures(TStateset &start_set)
 | 
				
			|||||||
// tenta di riconoscere la stringa passata
 | 
					// tenta di riconoscere la stringa passata
 | 
				
			||||||
bool TR_automa::recognized(const char * t_str) 
 | 
					bool TR_automa::recognized(const char * t_str) 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (_isdeterministic) {
 | 
					  if (_isdeterministic)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    // ricoNosce la stringa di token
 | 
					    // ricoNosce la stringa di token
 | 
				
			||||||
    int curr_state=FIRST_STATE;
 | 
					    int curr_state=FIRST_STATE;
 | 
				
			||||||
    for (int i=0; t_str[i]; i++) {
 | 
					    for (int i=0; t_str[i]; i++)
 | 
				
			||||||
      if (!(curr_state=trans_to(curr_state,t_str[i])))
 | 
					      if (!(curr_state=trans_to(curr_state,t_str[i])))
 | 
				
			||||||
        // fine per mancanza di trasizioni
 | 
					        return FALSE; // fine per mancanza di trasizioni
 | 
				
			||||||
        return FALSE; 
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // fine per mancanza di caratteri di input della stringa
 | 
					    // fine per mancanza di caratteri di input della stringa
 | 
				
			||||||
    return (is_final(curr_state));
 | 
					    return (is_final(curr_state));
 | 
				
			||||||
  } else {
 | 
					 | 
				
			||||||
    //    
 | 
					 | 
				
			||||||
    return FALSE;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					   else
 | 
				
			||||||
 | 
					    return FALSE; //  ??
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// *******************************
 | 
					// *******************************
 | 
				
			||||||
@ -401,7 +409,8 @@ bool TMetachar::recognized(const char * s)
 | 
				
			|||||||
void TMetachar::add_tran(int s,unsigned char metasymbol, int nextstate)
 | 
					void TMetachar::add_tran(int s,unsigned char metasymbol, int nextstate)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  unsigned char c;
 | 
					  unsigned char c;
 | 
				
			||||||
    switch (metasymbol) {
 | 
					  switch (metasymbol)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    case EPSILON:// blank
 | 
					    case EPSILON:// blank
 | 
				
			||||||
      _au->add_tran(s,EPSILON,nextstate);
 | 
					      _au->add_tran(s,EPSILON,nextstate);
 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
@ -449,15 +458,18 @@ void TMetachar::set_language(const char * language)
 | 
				
			|||||||
  _language=language;
 | 
					  _language=language;
 | 
				
			||||||
  // crea l'automa 
 | 
					  // crea l'automa 
 | 
				
			||||||
  _au->reset_state();
 | 
					  _au->reset_state();
 | 
				
			||||||
  for (int i=0; language[i]; i++) {
 | 
					  for (int i=0; language[i]; i++)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    label[0]='a'+i;
 | 
					    label[0]='a'+i;
 | 
				
			||||||
    nextlabel[0]='a'+i+1;
 | 
					    nextlabel[0]='a'+i+1;
 | 
				
			||||||
    if (language[i]!=C_ESCAPEMETA) {
 | 
					    if (language[i]!=C_ESCAPEMETA)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      if (!escaped_char)
 | 
					      if (!escaped_char)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
      // meta-caratteri e literal fuori set
 | 
					      // meta-caratteri e literal fuori set
 | 
				
			||||||
        s=_au->add_state(label);
 | 
					        s=_au->add_state(label);
 | 
				
			||||||
        switch (language[i]) {
 | 
					        switch (language[i])
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
          case '#':// cifra o blank opzionale
 | 
					          case '#':// cifra o blank opzionale
 | 
				
			||||||
            add_tran(s,S_BLANK,s+1);
 | 
					            add_tran(s,S_BLANK,s+1);
 | 
				
			||||||
            add_tran(s,'-',s+1);
 | 
					            add_tran(s,'-',s+1);
 | 
				
			||||||
@ -487,7 +499,9 @@ void TMetachar::set_language(const char * language)
 | 
				
			|||||||
            _au->add_tran(s,language[i],s+1);
 | 
					            _au->add_tran(s,language[i],s+1);
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } else {
 | 
					      }
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
      // escaped char
 | 
					      // escaped char
 | 
				
			||||||
          s=_au->add_state(label);
 | 
					          s=_au->add_state(label);
 | 
				
			||||||
        _au->add_tran(s,language[i],s+1);
 | 
					        _au->add_tran(s,language[i],s+1);
 | 
				
			||||||
@ -507,7 +521,8 @@ bool TMetachar::has_opzchars(const char * pattern)
 | 
				
			|||||||
  int i=0; 
 | 
					  int i=0; 
 | 
				
			||||||
  bool next_literal=FALSE;
 | 
					  bool next_literal=FALSE;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  while (pattern[i]) {           
 | 
					  while (pattern[i])
 | 
				
			||||||
 | 
					  {           
 | 
				
			||||||
    if (!next_literal && strchr(_metach_opz,pattern[i]))
 | 
					    if (!next_literal && strchr(_metach_opz,pattern[i]))
 | 
				
			||||||
      return(TRUE);
 | 
					      return(TRUE);
 | 
				
			||||||
    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
					    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
				
			||||||
@ -522,7 +537,8 @@ bool TMetachar::has_mandchars(const char * pattern)
 | 
				
			|||||||
  int i=0; 
 | 
					  int i=0; 
 | 
				
			||||||
  bool next_literal=FALSE;
 | 
					  bool next_literal=FALSE;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  while (pattern[i]) {
 | 
					  while (pattern[i])
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    if (next_literal || strchr(_metach_mand,pattern[i]))
 | 
					    if (next_literal || strchr(_metach_mand,pattern[i]))
 | 
				
			||||||
      return(TRUE);
 | 
					      return(TRUE);
 | 
				
			||||||
    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
					    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
				
			||||||
@ -537,7 +553,8 @@ int TMetachar::maxstrlen(const char * pattern)
 | 
				
			|||||||
  int i=0,l=0; 
 | 
					  int i=0,l=0; 
 | 
				
			||||||
  bool next_literal=FALSE;
 | 
					  bool next_literal=FALSE;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  while (pattern[i]) {
 | 
					  while (pattern[i])
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    if (!next_literal)
 | 
					    if (!next_literal)
 | 
				
			||||||
      l++;
 | 
					      l++;
 | 
				
			||||||
    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
					    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
				
			||||||
@ -560,7 +577,8 @@ TMetachar::TMetachar (const char * metastr)
 | 
				
			|||||||
//  set_language(&auxau,metastr);
 | 
					//  set_language(&auxau,metastr);
 | 
				
			||||||
  _au=new TR_automa;
 | 
					  _au=new TR_automa;
 | 
				
			||||||
  set_language(metastr);
 | 
					  set_language(metastr);
 | 
				
			||||||
  if (!_au->is_deterministic()) {
 | 
					  if (!_au->is_deterministic())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    TR_automa * auxau = new TR_automa(_au,TRUE);       
 | 
					    TR_automa * auxau = new TR_automa(_au,TRUE);       
 | 
				
			||||||
    delete _au;
 | 
					    delete _au;
 | 
				
			||||||
    _au=auxau;
 | 
					    _au=auxau;
 | 
				
			||||||
@ -624,7 +642,8 @@ void TCodice_livelli::load(bool enabled, const char *tabname,const char *tabgrp)
 | 
				
			|||||||
const char *TCodice_livelli::code_format(int levnum) const 
 | 
					const char *TCodice_livelli::code_format(int levnum) const 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  CHECK(enabled(), "iu chent get de code format if levels ar disebold");
 | 
					  CHECK(enabled(), "iu chent get de code format if levels ar disebold");
 | 
				
			||||||
  if (levnum<0) {
 | 
					  if (levnum<0)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    levnum=max(last_level(),1);
 | 
					    levnum=max(last_level(),1);
 | 
				
			||||||
  } 
 | 
					  } 
 | 
				
			||||||
  ((TCodice_livelli *)this)->add_metachar(levnum);
 | 
					  ((TCodice_livelli *)this)->add_metachar(levnum);
 | 
				
			||||||
@ -635,9 +654,8 @@ const char *TCodice_livelli::code_format(int levnum) const
 | 
				
			|||||||
bool TCodice_livelli::fit_to_format(const char *codepart,int levnum) const 
 | 
					bool TCodice_livelli::fit_to_format(const char *codepart,int levnum) const 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  CHECK(enabled(), "iu chent cec ueter de format fits if levels ar disebold");
 | 
					  CHECK(enabled(), "iu chent cec ueter de format fits if levels ar disebold");
 | 
				
			||||||
  if (levnum<0) {
 | 
					  if (levnum<0)
 | 
				
			||||||
    levnum=max(last_level(),1);
 | 
					    levnum=max(last_level(),1);
 | 
				
			||||||
  } 
 | 
					 | 
				
			||||||
  ((TCodice_livelli *)this)->add_metachar(levnum);
 | 
					  ((TCodice_livelli *)this)->add_metachar(levnum);
 | 
				
			||||||
  return ((TMetachar*)_metachars.objptr(levnum-1))->recognized(codepart);
 | 
					  return ((TMetachar*)_metachars.objptr(levnum-1))->recognized(codepart);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -819,4 +837,3 @@ TMagazzini::TMagazzini() :
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										169
									
								
								mg/mglib02.cpp
									
									
									
									
									
								
							
							
						
						
									
										169
									
								
								mg/mglib02.cpp
									
									
									
									
									
								
							@ -28,7 +28,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// libreria per i movimenti
 | 
					// libreria per i movimenti
 | 
				
			||||||
 | 
					
 | 
				
			||||||
char * Nome_valorizz[]= {
 | 
					char * Nome_valorizz[]=
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  "Ultimo costo", "Media ultimi costi", "Prezzo di listino",
 | 
					  "Ultimo costo", "Media ultimi costi", "Prezzo di listino",
 | 
				
			||||||
  "Costo standard", "Costo medio" , 
 | 
					  "Costo standard", "Costo medio" , 
 | 
				
			||||||
  "FIFO annuale", "LIFO annuale",
 | 
					  "FIFO annuale", "LIFO annuale",
 | 
				
			||||||
@ -708,13 +709,13 @@ real TArticolo_giacenza::FIFO(const char * annoes, const char * codmag, const ch
 | 
				
			|||||||
real TArticolo_giacenza::FIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
 | 
					real TArticolo_giacenza::FIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
 | 
				
			||||||
                                              bool giacenza_effettiva, bool valorizza_componenti) const
 | 
					                                              bool giacenza_effettiva, bool valorizza_componenti) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return ZERO;
 | 
					  return ZERO; // da implementare
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
real TArticolo_giacenza::LIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
 | 
					real TArticolo_giacenza::LIFO_ragionieristico(const char * annoes, const char * codmag, const char * livello,
 | 
				
			||||||
                                              bool giacenza_effettiva, bool valorizza_componenti) const
 | 
					                                              bool giacenza_effettiva, bool valorizza_componenti) const
 | 
				
			||||||
{             
 | 
					{             
 | 
				
			||||||
  return ZERO;
 | 
					  return ZERO;  // da implementare
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
real TArticolo_giacenza::giacenza_corretta(const TRectype & rec ,bool giacenza_effettiva,bool valorizza_componenti) const
 | 
					real TArticolo_giacenza::giacenza_corretta(const TRectype & rec ,bool giacenza_effettiva,bool valorizza_componenti) const
 | 
				
			||||||
@ -758,8 +759,6 @@ TArticolo_giacenza::TArticolo_giacenza(const TRectype& rec)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const real CENTO=real(100.0);
 | 
					const real CENTO=real(100.0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool TCondizione_vendita::  ricerca(const char * codice, const real & qta) 
 | 
					bool TCondizione_vendita::  ricerca(const char * codice, const real & qta) 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int tiporic;
 | 
					  int tiporic;
 | 
				
			||||||
@ -931,7 +930,8 @@ int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  static TString80 segni;
 | 
					  static TString80 segni;
 | 
				
			||||||
  segni=get("S2");
 | 
					  segni=get("S2");
 | 
				
			||||||
  switch (tiposaldo) {
 | 
					  switch (tiposaldo)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    case s_giac:
 | 
					    case s_giac:
 | 
				
			||||||
      return atoi(segni.mid(0,2));
 | 
					      return atoi(segni.mid(0,2));
 | 
				
			||||||
    case s_acq:
 | 
					    case s_acq:
 | 
				
			||||||
@ -1044,7 +1044,6 @@ int TLine_movmag::operator==(TLine_movmag &l)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TRecord_cache TMov_mag::cache_causali("%CAU");
 | 
					TRecord_cache TMov_mag::cache_causali("%CAU");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
TMov_mag::TMov_mag() : 
 | 
					TMov_mag::TMov_mag() : 
 | 
				
			||||||
  TMultiple_rectype(LF_MOVMAG),
 | 
					  TMultiple_rectype(LF_MOVMAG),
 | 
				
			||||||
  lines_to_add(), lines_to_subtract()
 | 
					  lines_to_add(), lines_to_subtract()
 | 
				
			||||||
@ -1207,9 +1206,7 @@ TLine_movmag & TMov_mag::line2data(int nrig) const
 | 
				
			|||||||
  static TLine_movmag line; 
 | 
					  static TLine_movmag line; 
 | 
				
			||||||
  TRecord_array & b = body();             
 | 
					  TRecord_array & b = body();             
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    line.set(
 | 
					  line.set(b.row(nrig).get(RMOVMAG_CODCAUS).blank() ? get(MOVMAG_CODCAUS) : b.row(nrig).get(RMOVMAG_CODCAUS) ,
 | 
				
			||||||
      b.row(nrig).get(RMOVMAG_CODCAUS).blank() ? get(MOVMAG_CODCAUS)
 | 
					 | 
				
			||||||
        : b.row(nrig).get(RMOVMAG_CODCAUS) ,
 | 
					 | 
				
			||||||
           b.row(nrig).get(RMOVMAG_UM),
 | 
					           b.row(nrig).get(RMOVMAG_UM),
 | 
				
			||||||
           b.row(nrig).get_real(RMOVMAG_QUANT),
 | 
					           b.row(nrig).get_real(RMOVMAG_QUANT),
 | 
				
			||||||
           b.row(nrig).get_real(RMOVMAG_PREZZO));
 | 
					           b.row(nrig).get_real(RMOVMAG_PREZZO));
 | 
				
			||||||
@ -1246,9 +1243,10 @@ TString TMov_mag::key2field(TToken_string &key,const char *fieldname)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int TMov_mag::line_inserted(TToken_string &k,TLine_movmag &r)
 | 
					int TMov_mag::line_inserted(TToken_string &k,TLine_movmag &r)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (_annoes != get("ANNOES")) {
 | 
					  if (_annoes != get("ANNOES"))
 | 
				
			||||||
    lines_to_add.add(k,r);
 | 
					    lines_to_add.add(k,r);
 | 
				
			||||||
  } else {
 | 
					  else
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    if (lines_to_subtract.is_key(k)&& (TLine_movmag &)lines_to_subtract[k]==r)
 | 
					    if (lines_to_subtract.is_key(k)&& (TLine_movmag &)lines_to_subtract[k]==r)
 | 
				
			||||||
      // modifica annullata
 | 
					      // modifica annullata
 | 
				
			||||||
      lines_to_subtract.remove(k);
 | 
					      lines_to_subtract.remove(k);
 | 
				
			||||||
@ -1261,9 +1259,10 @@ int TMov_mag::line_inserted(TToken_string &k,TLine_movmag &r)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int TMov_mag::line_deleted(TToken_string &k,TLine_movmag &r)
 | 
					int TMov_mag::line_deleted(TToken_string &k,TLine_movmag &r)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (_annoes != get("ANNOES")) {
 | 
					  if (_annoes != get("ANNOES"))
 | 
				
			||||||
    lines_to_subtract.add(k,r);
 | 
					    lines_to_subtract.add(k,r);
 | 
				
			||||||
  } else {
 | 
					  else
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    if (lines_to_add.is_key(k)&& r==(TLine_movmag &)lines_to_add[k] )
 | 
					    if (lines_to_add.is_key(k)&& r==(TLine_movmag &)lines_to_add[k] )
 | 
				
			||||||
      // modifica annullata
 | 
					      // modifica annullata
 | 
				
			||||||
      lines_to_add.remove(k); 
 | 
					      lines_to_add.remove(k); 
 | 
				
			||||||
@ -1277,6 +1276,7 @@ int TMov_mag::line_deleted(TToken_string &k,TLine_movmag &r)
 | 
				
			|||||||
bool TMov_mag::unlock_anamag(const char *codart) 
 | 
					bool TMov_mag::unlock_anamag(const char *codart) 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TLocalisamfile anamag(LF_ANAMAG);
 | 
					  TLocalisamfile anamag(LF_ANAMAG);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  anamag.put("CODART",codart);
 | 
					  anamag.put("CODART",codart);
 | 
				
			||||||
  return (anamag.read(_isequal,_unlock)==NOERR);
 | 
					  return (anamag.read(_isequal,_unlock)==NOERR);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1284,12 +1284,18 @@ bool TMov_mag::unlock_anamag(const char *codart)
 | 
				
			|||||||
bool TMov_mag::lock_anamag(const char *codart) 
 | 
					bool TMov_mag::lock_anamag(const char *codart) 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TLocalisamfile anamag(LF_ANAMAG);
 | 
					  TLocalisamfile anamag(LF_ANAMAG);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  anamag.put("CODART",codart);
 | 
					  anamag.put("CODART",codart);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  bool insert_new=TRUE;
 | 
					  bool insert_new=TRUE;
 | 
				
			||||||
  TString mess;
 | 
					  TString mess;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  mess << "Il record di anagrafica dell'articolo ''"<< codart << "'' risulta essere già in uso.\n Interrompo ?";
 | 
					  mess << "Il record di anagrafica dell'articolo ''"<< codart << "'' risulta essere già in uso.\n Interrompo ?";
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  TTimed_breakbox bbox((const char *)mess,10);
 | 
					  TTimed_breakbox bbox((const char *)mess,10);
 | 
				
			||||||
  do {
 | 
					  
 | 
				
			||||||
 | 
					  do
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    if (anamag.read(_isequal,_testandlock)==NOERR) 
 | 
					    if (anamag.read(_isequal,_testandlock)==NOERR) 
 | 
				
			||||||
      return TRUE;
 | 
					      return TRUE;
 | 
				
			||||||
  } while (bbox.run()!=K_ESC);
 | 
					  } while (bbox.run()!=K_ESC);
 | 
				
			||||||
@ -1314,20 +1320,24 @@ int TMov_mag::update_balances()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  bool updated_bal=TRUE;
 | 
					  bool updated_bal=TRUE;
 | 
				
			||||||
  TLocalisamfile mag(LF_MAG);
 | 
					  TLocalisamfile mag(LF_MAG);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mag.setkey(2);
 | 
					  mag.setkey(2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
  TString_array keys_to_add,keys_to_remove;
 | 
					  TString_array keys_to_add,keys_to_remove;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ((TMov_mag *)this)->lines_to_add.get_keys(keys_to_add);
 | 
					  ((TMov_mag *)this)->lines_to_add.get_keys(keys_to_add);
 | 
				
			||||||
  ((TMov_mag *)this)->lines_to_subtract.get_keys(keys_to_remove);
 | 
					  ((TMov_mag *)this)->lines_to_subtract.get_keys(keys_to_remove);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // aggiunge i saldi nuovi
 | 
					  // aggiunge i saldi nuovi
 | 
				
			||||||
  keys_to_add.sort();
 | 
					  keys_to_add.sort();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TToken_string * curr_key=(TToken_string *)keys_to_add.first_item();
 | 
					  TToken_string * curr_key=(TToken_string *)keys_to_add.first_item();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while (curr_key) {
 | 
					  while (curr_key)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    curr_art.read((const char *)key2field(*curr_key,"CODART"));
 | 
					    curr_art.read((const char *)key2field(*curr_key,"CODART"));
 | 
				
			||||||
    if (curr_art.lock_and_prompt()) {
 | 
					    if (curr_art.lock_and_prompt())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      // lock gained
 | 
					      // lock gained
 | 
				
			||||||
      TLine_movmag & line_mov=(TLine_movmag &)lines_to_add[*curr_key];
 | 
					      TLine_movmag & line_mov=(TLine_movmag &)lines_to_add[*curr_key];
 | 
				
			||||||
      TCausale_magazzino & causmag=(TCausale_magazzino &)cache_causali.get(line_mov.codcaus());
 | 
					      TCausale_magazzino & causmag=(TCausale_magazzino &)cache_causali.get(line_mov.codcaus());
 | 
				
			||||||
@ -1338,7 +1348,8 @@ int TMov_mag::update_balances()
 | 
				
			|||||||
        curr_art.rewrite();
 | 
					        curr_art.rewrite();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      giac_putkey(mag,get("ANNOES"),*curr_key);
 | 
					      giac_putkey(mag,get("ANNOES"),*curr_key);
 | 
				
			||||||
      if (mag.read()!=NOERR) {
 | 
					      if (mag.read()!=NOERR)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
        // non trovato: aggiungo
 | 
					        // non trovato: aggiungo
 | 
				
			||||||
        giac_putkey(mag,get("ANNOES"),*curr_key);
 | 
					        giac_putkey(mag,get("ANNOES"),*curr_key);
 | 
				
			||||||
        mag.put("NRIGA",1+curr_art.mag(get("ANNOES")).rows());
 | 
					        mag.put("NRIGA",1+curr_art.mag(get("ANNOES")).rows());
 | 
				
			||||||
@ -1357,10 +1368,12 @@ int TMov_mag::update_balances()
 | 
				
			|||||||
      mag.rewrite();
 | 
					      mag.rewrite();
 | 
				
			||||||
      // conclude la TRANSAZIONE prima di sbloccare il record dell'articolo
 | 
					      // conclude la TRANSAZIONE prima di sbloccare il record dell'articolo
 | 
				
			||||||
      TToken_string *rem_key=(TToken_string *)keys_to_remove.first_item();
 | 
					      TToken_string *rem_key=(TToken_string *)keys_to_remove.first_item();
 | 
				
			||||||
      while ( rem_key) {
 | 
					      while ( rem_key)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
        if (key2field(*rem_key,"CODART")==key2field(*curr_key,"CODART")) {
 | 
					        if (key2field(*rem_key,"CODART")==key2field(*curr_key,"CODART")) {
 | 
				
			||||||
          giac_putkey(mag,_annoes,*rem_key);
 | 
					          giac_putkey(mag,_annoes,*rem_key);
 | 
				
			||||||
          if (mag.read()==NOERR) {
 | 
					          if (mag.read()==NOERR)
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
            update_balances(mag.curr(),(TLine_movmag &)lines_to_subtract[*rem_key],-1);
 | 
					            update_balances(mag.curr(),(TLine_movmag &)lines_to_subtract[*rem_key],-1);
 | 
				
			||||||
            mag.rewrite();
 | 
					            mag.rewrite();
 | 
				
			||||||
          } 
 | 
					          } 
 | 
				
			||||||
@ -1369,30 +1382,34 @@ int TMov_mag::update_balances()
 | 
				
			|||||||
        rem_key=(TToken_string *)keys_to_remove.succ_item();
 | 
					        rem_key=(TToken_string *)keys_to_remove.succ_item();
 | 
				
			||||||
      } 
 | 
					      } 
 | 
				
			||||||
      curr_art.unlock();
 | 
					      curr_art.unlock();
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      updated_bal=FALSE;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      updated_bal=FALSE;
 | 
				
			||||||
    curr_key=(TToken_string *)keys_to_add.succ_item();
 | 
					    curr_key=(TToken_string *)keys_to_add.succ_item();
 | 
				
			||||||
  } 
 | 
					  } 
 | 
				
			||||||
  // togli i saldi vecchi
 | 
					  // togli i saldi vecchi
 | 
				
			||||||
  curr_key=(TToken_string *)keys_to_remove.first_item();
 | 
					  curr_key=(TToken_string *)keys_to_remove.first_item();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while (curr_key) {
 | 
					  while (curr_key)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    curr_art.read((const char *)key2field(*curr_key,"CODART"));
 | 
					    curr_art.read((const char *)key2field(*curr_key,"CODART"));
 | 
				
			||||||
    if (curr_art.lock_and_prompt()) {
 | 
					    if (curr_art.lock_and_prompt())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      giac_putkey(mag,_annoes,*curr_key);
 | 
					      giac_putkey(mag,_annoes,*curr_key);
 | 
				
			||||||
      // modifica questo record (e lo sblocca)
 | 
					      // modifica questo record (e lo sblocca)
 | 
				
			||||||
      if (mag.read()==NOERR) {
 | 
					      if (mag.read()==NOERR)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
        update_balances(mag.curr(),(TLine_movmag &)lines_to_subtract[*curr_key],-1);
 | 
					        update_balances(mag.curr(),(TLine_movmag &)lines_to_subtract[*curr_key],-1);
 | 
				
			||||||
        mag.rewrite();
 | 
					        mag.rewrite();
 | 
				
			||||||
      } 
 | 
					      } 
 | 
				
			||||||
      curr_art.unlock();
 | 
					      curr_art.unlock();
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      updated_bal=FALSE;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      updated_bal=FALSE;
 | 
				
			||||||
    curr_key=(TToken_string *)keys_to_remove.succ_item();
 | 
					    curr_key=(TToken_string *)keys_to_remove.succ_item();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (!updated_bal) {
 | 
					  if (!updated_bal)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    // saldi non aggiornati
 | 
					    // saldi non aggiornati
 | 
				
			||||||
    warning_box("I saldi di magazzino non sono stati del tutto aggiornati. \nProcedere ad una operazione di ''Ricostruzione saldi''");
 | 
					    warning_box("I saldi di magazzino non sono stati del tutto aggiornati. \nProcedere ad una operazione di ''Ricostruzione saldi''");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -1406,51 +1423,54 @@ int TMov_mag::update_balances(TRectype & magrec, const TLine_movmag &l,int rett_
 | 
				
			|||||||
  TCausale_magazzino & caus=(TCausale_magazzino &)cache_causali.get(l.codcaus());
 | 
					  TCausale_magazzino & caus=(TCausale_magazzino &)cache_causali.get(l.codcaus());
 | 
				
			||||||
  TLocalisamfile umart(LF_UMART);              
 | 
					  TLocalisamfile umart(LF_UMART);              
 | 
				
			||||||
  real diff,diff_val;
 | 
					  real diff,diff_val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  umart.setkey(2);
 | 
					  umart.setkey(2);
 | 
				
			||||||
  umart.put(UMART_CODART,magrec.get(MAG_CODART));
 | 
					  umart.put(UMART_CODART,magrec.get(MAG_CODART));
 | 
				
			||||||
  umart.put(UMART_UM , l.um());
 | 
					  umart.put(UMART_UM , l.um());
 | 
				
			||||||
  umart.read();
 | 
					  umart.read();
 | 
				
			||||||
  real fc=umart.get_real("FC");
 | 
					  real fc=umart.get_real("FC");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  diff=fc*rett_sign*l.quant();
 | 
					  diff=((real)rett_sign) * l.quant() * fc;
 | 
				
			||||||
  diff_val=rett_sign*l.quant()*l.prezzo();
 | 
					  diff_val= ((real)rett_sign) * l.quant() * l.prezzo();
 | 
				
			||||||
  if (caus.update_qta()) {
 | 
					  if (caus.update_qta())
 | 
				
			||||||
    update_balance(magrec,"GIAC",diff*caus.sgn(s_giac)); // update ..
 | 
					  {
 | 
				
			||||||
    update_balance(magrec,"ACQ",diff*caus.sgn(s_acq)); // update ..
 | 
					    update_balance(magrec,"GIAC",diff* (real)caus.sgn(s_giac)); // update ..
 | 
				
			||||||
    update_balance(magrec,"ENT",diff*caus.sgn(s_ent));
 | 
					    update_balance(magrec,"ACQ",diff* (real)caus.sgn(s_acq)); // update ..
 | 
				
			||||||
    update_balance(magrec,"VEN",diff*caus.sgn(s_ven));
 | 
					    update_balance(magrec,"ENT",diff* (real)caus.sgn(s_ent));
 | 
				
			||||||
    update_balance(magrec,"USC",diff*caus.sgn(s_usc));
 | 
					    update_balance(magrec,"VEN",diff* (real)caus.sgn(s_ven));
 | 
				
			||||||
    update_balance(magrec,"ORDC",diff*caus.sgn(s_ordc));
 | 
					    update_balance(magrec,"USC",diff* (real)caus.sgn(s_usc));
 | 
				
			||||||
    update_balance(magrec,"ORDF",diff*caus.sgn(s_ordf));
 | 
					    update_balance(magrec,"ORDC",diff* (real)caus.sgn(s_ordc));
 | 
				
			||||||
    update_balance(magrec,"RIM",diff*caus.sgn(s_rim));
 | 
					    update_balance(magrec,"ORDF",diff* (real)caus.sgn(s_ordf));
 | 
				
			||||||
    update_balance(magrec,"SCARTI",diff*caus.sgn(s_scart));
 | 
					    update_balance(magrec,"RIM",diff* (real)caus.sgn(s_rim));
 | 
				
			||||||
    update_balance(magrec,"INCL",diff*caus.sgn(s_incl));
 | 
					    update_balance(magrec,"SCARTI",diff* (real)caus.sgn(s_scart));
 | 
				
			||||||
    update_balance(magrec,"ACL",diff*caus.sgn(s_acl));
 | 
					    update_balance(magrec,"INCL",diff* (real)caus.sgn(s_incl));
 | 
				
			||||||
    update_balance(magrec,"PRODCOMP",diff*caus.sgn(s_prodc));
 | 
					    update_balance(magrec,"ACL",diff* (real)caus.sgn(s_acl));
 | 
				
			||||||
    update_balance(magrec,"PRODFIN",diff*caus.sgn(s_prodf));
 | 
					    update_balance(magrec,"PRODCOMP",diff* (real)caus.sgn(s_prodc));
 | 
				
			||||||
    update_balance(magrec,"NLABEL",diff*caus.sgn(s_label));
 | 
					    update_balance(magrec,"PRODFIN",diff* (real)caus.sgn(s_prodf));
 | 
				
			||||||
    update_balance(magrec,"USER1",diff*caus.sgn(s_user1));
 | 
					    update_balance(magrec,"NLABEL",diff* (real)caus.sgn(s_label));
 | 
				
			||||||
    update_balance(magrec,"USER2",diff*caus.sgn(s_user2));
 | 
					    update_balance(magrec,"USER1",diff* (real)caus.sgn(s_user1));
 | 
				
			||||||
    update_balance(magrec,"USER3",diff*caus.sgn(s_user3));
 | 
					    update_balance(magrec,"USER2",diff* (real)caus.sgn(s_user2));
 | 
				
			||||||
    update_balance(magrec,"USER4",diff*caus.sgn(s_user4));
 | 
					    update_balance(magrec,"USER3",diff* (real)caus.sgn(s_user3));
 | 
				
			||||||
    update_balance(magrec,"USER5",diff*caus.sgn(s_user5));
 | 
					    update_balance(magrec,"USER4",diff* (real)caus.sgn(s_user4));
 | 
				
			||||||
    update_balance(magrec,"USER6",diff*caus.sgn(s_user6));
 | 
					    update_balance(magrec,"USER5",diff* (real)caus.sgn(s_user5));
 | 
				
			||||||
 | 
					    update_balance(magrec,"USER6",diff* (real)caus.sgn(s_user6));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (caus.update_val()) {
 | 
					  if (caus.update_val())
 | 
				
			||||||
    update_balance(magrec,"VALACQ",diff_val*caus.sgn(s_acq)); // update ..
 | 
					  {
 | 
				
			||||||
    update_balance(magrec,"VALENT",diff_val*caus.sgn(s_ent));
 | 
					    update_balance(magrec,"VALACQ",diff_val* (real)caus.sgn(s_acq)); // update ..
 | 
				
			||||||
    update_balance(magrec,"VALVEN",diff_val*caus.sgn(s_ven));
 | 
					    update_balance(magrec,"VALENT",diff_val* (real)caus.sgn(s_ent));
 | 
				
			||||||
    update_balance(magrec,"VALUSC",diff_val*caus.sgn(s_usc));
 | 
					    update_balance(magrec,"VALVEN",diff_val* (real)caus.sgn(s_ven));
 | 
				
			||||||
    update_balance(magrec,"VALORDC",diff_val*caus.sgn(s_ordc));
 | 
					    update_balance(magrec,"VALUSC",diff_val* (real)caus.sgn(s_usc));
 | 
				
			||||||
    update_balance(magrec,"VALORDF",diff_val*caus.sgn(s_ordf));
 | 
					    update_balance(magrec,"VALORDC",diff_val* (real)caus.sgn(s_ordc));
 | 
				
			||||||
    update_balance(magrec,"VALRIM",diff_val*caus.sgn(s_rim));
 | 
					    update_balance(magrec,"VALORDF",diff_val* (real)caus.sgn(s_ordf));
 | 
				
			||||||
    update_balance(magrec,"VALSCARTI",diff_val*caus.sgn(s_scart));
 | 
					    update_balance(magrec,"VALRIM",diff_val* (real)caus.sgn(s_rim));
 | 
				
			||||||
    update_balance(magrec,"USERVAL1",diff*caus.sgn(s_user1));
 | 
					    update_balance(magrec,"VALSCARTI",diff_val* (real)caus.sgn(s_scart));
 | 
				
			||||||
    update_balance(magrec,"USERVAL2",diff*caus.sgn(s_user2));
 | 
					    update_balance(magrec,"USERVAL1",diff* (real)caus.sgn(s_user1));
 | 
				
			||||||
    update_balance(magrec,"USERVAL3",diff*caus.sgn(s_user3));
 | 
					    update_balance(magrec,"USERVAL2",diff* (real)caus.sgn(s_user2));
 | 
				
			||||||
    update_balance(magrec,"USERVAL4",diff*caus.sgn(s_user4));
 | 
					    update_balance(magrec,"USERVAL3",diff* (real)caus.sgn(s_user3));
 | 
				
			||||||
    update_balance(magrec,"USERVAL5",diff*caus.sgn(s_user5));
 | 
					    update_balance(magrec,"USERVAL4",diff* (real)caus.sgn(s_user4));
 | 
				
			||||||
    update_balance(magrec,"USERVAL6",diff*caus.sgn(s_user6));
 | 
					    update_balance(magrec,"USERVAL5",diff* (real)caus.sgn(s_user5));
 | 
				
			||||||
 | 
					    update_balance(magrec,"USERVAL6",diff* (real)caus.sgn(s_user6));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1472,23 +1492,30 @@ int TMov_mag::codice_esercizio(TDate &d)
 | 
				
			|||||||
bool rebuild_balances(const TString16 annoes/*, bool reset_giac*/)
 | 
					bool rebuild_balances(const TString16 annoes/*, bool reset_giac*/)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TArray used_files;
 | 
					  TArray used_files;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  used_files.add(new TLocalisamfile(LF_RMOVMAG),LF_RMOVMAG);
 | 
					  used_files.add(new TLocalisamfile(LF_RMOVMAG),LF_RMOVMAG);
 | 
				
			||||||
  used_files.add(new TLocalisamfile(LF_MOVMAG),LF_MOVMAG);
 | 
					  used_files.add(new TLocalisamfile(LF_MOVMAG),LF_MOVMAG);
 | 
				
			||||||
  used_files.add(new TTable("%CAU"),5);
 | 
					  used_files.add(new TTable("%CAU"),5);
 | 
				
			||||||
  TMov_mag * m_m= new TMov_mag; // record del movimento di magazzino
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  TMov_mag * m_m= new TMov_mag; // record del movimento di magazzino
 | 
				
			||||||
  // relazione con un solo file (LF_MOVMAG) ma col record Head_Body
 | 
					  // relazione con un solo file (LF_MOVMAG) ma col record Head_Body
 | 
				
			||||||
  TRelation rel(LF_MOVMAG);
 | 
					  TRelation rel(LF_MOVMAG);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  rel.lfile().set_curr(m_m);
 | 
					  rel.lfile().set_curr(m_m);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int ok=TRUE;
 | 
					  int ok=TRUE;
 | 
				
			||||||
  TLocalisamfile mag(LF_MAG);
 | 
					  TLocalisamfile mag(LF_MAG);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Il flag di reset delle giacenze viene impostato in base alla chiusura dell'esercizio
 | 
					  // Il flag di reset delle giacenze viene impostato in base alla chiusura dell'esercizio
 | 
				
			||||||
  // precedente
 | 
					  // precedente
 | 
				
			||||||
  // Aggiorna il cazzillo per caricare eventuali date di chiusura e altre amenita' simili
 | 
					  // Aggiorna il cazzillo per caricare eventuali date di chiusura e altre amenita' simili
 | 
				
			||||||
  _esercizi.update();
 | 
					  _esercizi.update();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const int pred_es = _esercizi.pred(atoi(annoes));
 | 
					  const int pred_es = _esercizi.pred(atoi(annoes));
 | 
				
			||||||
  const bool reset_giac = pred_es != 0 ? _esercizi.esercizio(pred_es).chiusura_mag() != TDate(NULLDATE) : TRUE;
 | 
					  const bool reset_giac = pred_es != 0 ? _esercizi.esercizio(pred_es).chiusura_mag() != TDate(NULLDATE) : TRUE;
 | 
				
			||||||
  if (reset_giac) {
 | 
					
 | 
				
			||||||
 | 
					  if (reset_giac)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    // azzera tutte giacenze (ciclo sulle giacenze)
 | 
					    // azzera tutte giacenze (ciclo sulle giacenze)
 | 
				
			||||||
    mag.put("ANNOES",annoes);
 | 
					    mag.put("ANNOES",annoes);
 | 
				
			||||||
    mag.read(_isgteq);
 | 
					    mag.read(_isgteq);
 | 
				
			||||||
@ -1525,7 +1552,9 @@ bool rebuild_balances(const TString16 annoes/*, bool reset_giac*/)
 | 
				
			|||||||
          mag.next();
 | 
					          mag.next();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        articolo.unlock();
 | 
					        articolo.unlock();
 | 
				
			||||||
      } else {
 | 
					      }
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
        ok=FALSE;
 | 
					        ok=FALSE;
 | 
				
			||||||
        mag.next();
 | 
					        mag.next();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -148,7 +148,7 @@ NUMBER F_CONTOV 3
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT  25 14 ""
 | 
					  PROMPT  25 14 ""
 | 
				
			||||||
  FIELD I4
 | 
					  FIELD I4
 | 
				
			||||||
  USE LF_PCON SELECT INDBIL=="4"
 | 
					  USE LF_PCON SELECT  (CONTO!="") && (SOTTOCONTO=="")
 | 
				
			||||||
  INPUT GRUPPO      F_GRUPPOV
 | 
					  INPUT GRUPPO      F_GRUPPOV
 | 
				
			||||||
  INPUT CONTO       F_CONTOV
 | 
					  INPUT CONTO       F_CONTOV
 | 
				
			||||||
  DISPLAY "Gruppo" GRUPPO
 | 
					  DISPLAY "Gruppo" GRUPPO
 | 
				
			||||||
@ -165,7 +165,7 @@ NUMBER F_SOTTOCV 6
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
   PROMPT  33 14 ""
 | 
					   PROMPT  33 14 ""
 | 
				
			||||||
   FIELD I5
 | 
					   FIELD I5
 | 
				
			||||||
   USE LF_PCON SELECT (SOTTOCONTO!="") && (500@->INDBIL=="4")
 | 
					   USE LF_PCON SELECT SOTTOCONTO!=""
 | 
				
			||||||
   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
   INPUT GRUPPO F_GRUPPOV
 | 
					   INPUT GRUPPO F_GRUPPOV
 | 
				
			||||||
   INPUT CONTO  F_CONTOV
 | 
					   INPUT CONTO  F_CONTOV
 | 
				
			||||||
@ -187,7 +187,7 @@ STRING F_DESCRV 50
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
   PROMPT  19 15 ""
 | 
					   PROMPT  19 15 ""
 | 
				
			||||||
   FLAG "U"
 | 
					   FLAG "U"
 | 
				
			||||||
   USE LF_PCON KEY 2 SELECT (SOTTOCONTO!="") && (500@->INDBIL=="4")
 | 
					   USE LF_PCON KEY 2 SELECT SOTTOCONTO!=""
 | 
				
			||||||
   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
   INPUT DESCR F_DESCRV
 | 
					   INPUT DESCR F_DESCRV
 | 
				
			||||||
   DISPLAY "Descrizione@50" DESCR
 | 
					   DISPLAY "Descrizione@50" DESCR
 | 
				
			||||||
@ -210,7 +210,7 @@ NUMBER F_CONTOA 3
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT  25 16 ""
 | 
					  PROMPT  25 16 ""
 | 
				
			||||||
  FIELD I1
 | 
					  FIELD I1
 | 
				
			||||||
  USE LF_PCON SELECT INDBIL=="3"
 | 
					  USE LF_PCON SELECT  (CONTO!="") && (SOTTOCONTO=="")
 | 
				
			||||||
  INPUT GRUPPO      F_GRUPPOA
 | 
					  INPUT GRUPPO      F_GRUPPOA
 | 
				
			||||||
  INPUT CONTO       F_CONTOA
 | 
					  INPUT CONTO       F_CONTOA
 | 
				
			||||||
  DISPLAY "Gruppo" GRUPPO
 | 
					  DISPLAY "Gruppo" GRUPPO
 | 
				
			||||||
@ -227,7 +227,7 @@ NUMBER F_SOTTOCA 6
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
   PROMPT  33 16 ""
 | 
					   PROMPT  33 16 ""
 | 
				
			||||||
   FIELD I2
 | 
					   FIELD I2
 | 
				
			||||||
   USE LF_PCON SELECT (SOTTOCONTO!="") && (500@->INDBIL=="3")
 | 
					   USE LF_PCON SELECT SOTTOCONTO!=""
 | 
				
			||||||
   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
   INPUT GRUPPO F_GRUPPOA SELECT
 | 
					   INPUT GRUPPO F_GRUPPOA SELECT
 | 
				
			||||||
   INPUT CONTO  F_CONTOA  SELECT
 | 
					   INPUT CONTO  F_CONTOA  SELECT
 | 
				
			||||||
@ -249,7 +249,7 @@ STRING F_DESCRA 50
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
   PROMPT  19 17 ""
 | 
					   PROMPT  19 17 ""
 | 
				
			||||||
   FLAG "U"
 | 
					   FLAG "U"
 | 
				
			||||||
   USE LF_PCON KEY 2 SELECT (SOTTOCONTO!="") && (500@->INDBIL=="3")
 | 
					   USE LF_PCON KEY 2 SELECT SOTTOCONTO!=""
 | 
				
			||||||
   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					   JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
   INPUT DESCR F_DESCRA
 | 
					   INPUT DESCR F_DESCRA
 | 
				
			||||||
   DISPLAY "Descrizione@50" DESCR
 | 
					   DISPLAY "Descrizione@50" DESCR
 | 
				
			||||||
 | 
				
			|||||||
@ -180,7 +180,7 @@ NUMBER F_CONTOV 3
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 22 15 ""
 | 
					  PROMPT 22 15 ""
 | 
				
			||||||
  FIELD I1
 | 
					  FIELD I1
 | 
				
			||||||
  USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO=="") && ((INDBIL=="4") || (INDBIL=="1") || (INDBIL=="2"))
 | 
					  USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO=="")
 | 
				
			||||||
  INPUT GRUPPO      F_GRUPPOV
 | 
					  INPUT GRUPPO      F_GRUPPOV
 | 
				
			||||||
  INPUT CONTO       F_CONTOV
 | 
					  INPUT CONTO       F_CONTOV
 | 
				
			||||||
  DISPLAY "Gruppo" GRUPPO
 | 
					  DISPLAY "Gruppo" GRUPPO
 | 
				
			||||||
@ -197,7 +197,7 @@ NUMBER F_SOTTOV 6
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 30 15 ""
 | 
					  PROMPT 30 15 ""
 | 
				
			||||||
  FIELD I2
 | 
					  FIELD I2
 | 
				
			||||||
  USE LF_PCON SELECT (SOTTOCONTO!="") && ((500@->INDBIL=="4") || (500@->INDBIL=="1") || (500@->INDBIL=="2"))
 | 
					  USE LF_PCON SELECT SOTTOCONTO!=""
 | 
				
			||||||
  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
  INPUT GRUPPO      F_GRUPPOV
 | 
					  INPUT GRUPPO      F_GRUPPOV
 | 
				
			||||||
  INPUT CONTO       F_CONTOV
 | 
					  INPUT CONTO       F_CONTOV
 | 
				
			||||||
@ -219,7 +219,7 @@ STRING F_DESCRCONTOV 50
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
 PROMPT 17 16 ""
 | 
					 PROMPT 17 16 ""
 | 
				
			||||||
  FLAG "U"
 | 
					  FLAG "U"
 | 
				
			||||||
  USE LF_PCON KEY 2 SELECT (SOTTOCONTO!="") && ((500@->INDBIL=="4") || (500@->INDBIL=="1") || (500@->INDBIL=="2"))
 | 
					  USE LF_PCON KEY 2 SELECT SOTTOCONTO!=""
 | 
				
			||||||
  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
  INPUT DESCR F_DESCRCONTOV
 | 
					  INPUT DESCR F_DESCRCONTOV
 | 
				
			||||||
  DISPLAY "Descrizione@50" DESCR
 | 
					  DISPLAY "Descrizione@50" DESCR
 | 
				
			||||||
@ -243,7 +243,7 @@ NUMBER F_CONTOA 3
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 22 17 ""
 | 
					  PROMPT 22 17 ""
 | 
				
			||||||
  FIELD I4
 | 
					  FIELD I4
 | 
				
			||||||
  USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO=="") && ((INDBIL=="3") || (INDBIL=="1") || (INDBIL=="2"))
 | 
					  USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO=="")
 | 
				
			||||||
  INPUT GRUPPO      F_GRUPPOA
 | 
					  INPUT GRUPPO      F_GRUPPOA
 | 
				
			||||||
  INPUT CONTO       F_CONTOA
 | 
					  INPUT CONTO       F_CONTOA
 | 
				
			||||||
  DISPLAY "Gruppo" GRUPPO
 | 
					  DISPLAY "Gruppo" GRUPPO
 | 
				
			||||||
@ -260,7 +260,7 @@ NUMBER F_SOTTOA 6
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 30 17 ""
 | 
					  PROMPT 30 17 ""
 | 
				
			||||||
  FIELD I5
 | 
					  FIELD I5
 | 
				
			||||||
  USE LF_PCON SELECT (SOTTOCONTO!="") && ((500@->INDBIL=="3") || (500@->INDBIL=="1") || (500@->INDBIL=="2"))
 | 
					  USE LF_PCON SELECT SOTTOCONTO!=""
 | 
				
			||||||
  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
  INPUT GRUPPO      F_GRUPPOA
 | 
					  INPUT GRUPPO      F_GRUPPOA
 | 
				
			||||||
  INPUT CONTO       F_CONTOA
 | 
					  INPUT CONTO       F_CONTOA
 | 
				
			||||||
@ -282,7 +282,7 @@ STRING F_DESCRCONTOA 50
 | 
				
			|||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 17 18 ""
 | 
					  PROMPT 17 18 ""
 | 
				
			||||||
  FLAG "U"
 | 
					  FLAG "U"
 | 
				
			||||||
  USE LF_PCON KEY 2 SELECT (SOTTOCONTO!="") && ((500@->INDBIL=="3") || (500@->INDBIL=="1") || (500@->INDBIL=="2"))
 | 
					  USE LF_PCON KEY 2 SELECT SOTTOCONTO!=""
 | 
				
			||||||
  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
					  JOIN LF_PCON ALIAS 500 INTO GRUPPO==GRUPPO CONTO==CONTO
 | 
				
			||||||
  INPUT DESCR F_DESCRCONTOA
 | 
					  INPUT DESCR F_DESCRCONTOA
 | 
				
			||||||
  DISPLAY "Descrizione@50" DESCR
 | 
					  DISPLAY "Descrizione@50" DESCR
 | 
				
			||||||
 | 
				
			|||||||
@ -1093,7 +1093,7 @@ FIELDNAME=CODVETT1
 | 
				
			|||||||
MSKID=F_CODVETT1
 | 
					MSKID=F_CODVETT1
 | 
				
			||||||
TYPE=T_STRINGA
 | 
					TYPE=T_STRINGA
 | 
				
			||||||
PROMPT="Vettore 1' "
 | 
					PROMPT="Vettore 1' "
 | 
				
			||||||
SIZE=5
 | 
					SIZE=6
 | 
				
			||||||
FLAG=ZU
 | 
					FLAG=ZU
 | 
				
			||||||
USE=%VET
 | 
					USE=%VET
 | 
				
			||||||
INPUT=CODTAB F_CODVETT1
 | 
					INPUT=CODTAB F_CODVETT1
 | 
				
			||||||
@ -1125,7 +1125,7 @@ FIELDNAME=CODVETT2
 | 
				
			|||||||
MSKID=F_CODVETT2
 | 
					MSKID=F_CODVETT2
 | 
				
			||||||
TYPE=T_STRINGA
 | 
					TYPE=T_STRINGA
 | 
				
			||||||
PROMPT="Vettore 2' "
 | 
					PROMPT="Vettore 2' "
 | 
				
			||||||
SIZE=5
 | 
					SIZE=6
 | 
				
			||||||
FLAG=ZU
 | 
					FLAG=ZU
 | 
				
			||||||
USE=%VET
 | 
					USE=%VET
 | 
				
			||||||
INPUT=CODTAB F_CODVETT2
 | 
					INPUT=CODTAB F_CODVETT2
 | 
				
			||||||
@ -1157,7 +1157,7 @@ FIELDNAME=CODVETT3
 | 
				
			|||||||
MSKID=F_CODVETT3
 | 
					MSKID=F_CODVETT3
 | 
				
			||||||
TYPE=T_STRINGA
 | 
					TYPE=T_STRINGA
 | 
				
			||||||
PROMPT="Vettore 3' "
 | 
					PROMPT="Vettore 3' "
 | 
				
			||||||
SIZE=5
 | 
					SIZE=6
 | 
				
			||||||
FLAG=ZU
 | 
					FLAG=ZU
 | 
				
			||||||
USE=%VET
 | 
					USE=%VET
 | 
				
			||||||
INPUT=CODTAB F_CODVETT3
 | 
					INPUT=CODTAB F_CODVETT3
 | 
				
			||||||
 | 
				
			|||||||
@ -627,13 +627,17 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // reperisce l'ultimo numero di registrazione disponibile
 | 
					  // reperisce l'ultimo numero di registrazione disponibile
 | 
				
			||||||
 | 
					  long numreg = 1L;
 | 
				
			||||||
 | 
					  if (!mov.empty())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    mov.last();
 | 
					    mov.last();
 | 
				
			||||||
  const long numreg = mov.get_int(MOV_NUMREG) + 1;
 | 
					    numreg = mov.get_long(MOV_NUMREG) + 1L;
 | 
				
			||||||
    if (mov.status() != NOERR || numreg < 1)
 | 
					    if (mov.status() != NOERR || numreg < 1)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      _error = nr_reg_error;
 | 
					      _error = nr_reg_error;
 | 
				
			||||||
      return _error;
 | 
					      return _error;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  TCodice_numerazione cod_num(doc.numerazione());
 | 
					  TCodice_numerazione cod_num(doc.numerazione());
 | 
				
			||||||
  // calcola il numero documento aggiungendo l'eventuale prefisso/postfisso.
 | 
					  // calcola il numero documento aggiungendo l'eventuale prefisso/postfisso.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user