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
 | 
			
		||||
 | 
			
		||||
 #ifndef _DEMO_
 | 
			
		||||
  if (!check_user()) 
 | 
			
		||||
    return FALSE;
 | 
			
		||||
 #endif
 | 
			
		||||
  
 | 
			
		||||
  set_perms();
 | 
			
		||||
  test_temp();
 | 
			
		||||
 | 
			
		||||
@ -1294,6 +1294,14 @@ bool TFascicolator_mask::zip_module(const TString& main_module, bool agg, int pa
 | 
			
		||||
      ok = move_file(src, path);
 | 
			
		||||
    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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										207
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							
							
						
						
									
										207
									
								
								ba/ba1700.cpp
									
									
									
									
									
								
							@ -13,7 +13,16 @@
 | 
			
		||||
#include "ba1500.h"
 | 
			
		||||
#include "ba1600.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)
 | 
			
		||||
{
 | 
			
		||||
@ -68,7 +77,7 @@ protected:
 | 
			
		||||
  static bool sheet_notify(TSheet_field& s, int r, KEY k);
 | 
			
		||||
  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);
 | 
			
		||||
  int sort_modules();
 | 
			
		||||
  void update_version();
 | 
			
		||||
@ -95,7 +104,7 @@ public:
 | 
			
		||||
TInstaller_mask* TInstaller_mask::_curr_mask = NULL;
 | 
			
		||||
 | 
			
		||||
// 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();
 | 
			
		||||
  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("Data"));
 | 
			
		||||
    row.add(patch ? "X" : " ", 9);
 | 
			
		||||
    add(row);
 | 
			
		||||
    if (pos==-1)
 | 
			
		||||
      add(row);
 | 
			
		||||
    else
 | 
			
		||||
      insert(row,pos);
 | 
			
		||||
  }
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
@ -147,23 +159,32 @@ static int compare_modules(const TObject** o1, const TObject** o2)
 | 
			
		||||
 | 
			
		||||
int TInstaller_mask::sort_modules()
 | 
			
		||||
{
 | 
			
		||||
  //rows_array().TArray::sort(compare_modules);
 | 
			
		||||
  
 | 
			
		||||
  TString16 dis;
 | 
			
		||||
  // sort
 | 
			
		||||
  const int tot = int(items());
 | 
			
		||||
  return tot;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // vecchio codice per bubblare
 | 
			
		||||
  for (int r = 0; r < tot; r++)
 | 
			
		||||
  {                                  
 | 
			
		||||
    const bool patch = row(r).get_char(9) > ' ';
 | 
			
		||||
    const char* mod = row(r).get(2);
 | 
			
		||||
    if (*mod != ' ') // is not an header...
 | 
			
		||||
    {
 | 
			
		||||
      if (patch)
 | 
			
		||||
      {   
 | 
			
		||||
        if (dis == mod)
 | 
			
		||||
          disable_row(r);
 | 
			
		||||
    const bool patch = row(r).get_char(C_ISPATCH) > ' ';
 | 
			
		||||
    const char* mod = row(r).get(C_CODE);
 | 
			
		||||
    if (patch)
 | 
			
		||||
    {   
 | 
			
		||||
      TString16 dis=mod;
 | 
			
		||||
      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;
 | 
			
		||||
@ -176,16 +197,16 @@ void TInstaller_mask::update_version()
 | 
			
		||||
  TString_array& array = rows_array();
 | 
			
		||||
  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);
 | 
			
		||||
        
 | 
			
		||||
      const TString16 newver = row->get(3);
 | 
			
		||||
      const TString16 newver = row->get(C_RELEASE);
 | 
			
		||||
      const TString16 oldver = ini.get("Versione");
 | 
			
		||||
      row->add(oldver, 6);       
 | 
			
		||||
      row->add(ini.get("Patch"), 7);
 | 
			
		||||
      row->add(ini.get("Data"), 8);
 | 
			
		||||
      row->add(oldver, C_CURRRELEASE);
 | 
			
		||||
      row->add(ini.get("Patch"), C_CURRPATCH);
 | 
			
		||||
      row->add(ini.get("Data"), C_CURRDATAREL);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  force_update();
 | 
			
		||||
@ -195,6 +216,7 @@ void TInstaller_mask::update_version()
 | 
			
		||||
// utilizzabili per un'installazione e li inserisce nello spreadsheet
 | 
			
		||||
bool TInstaller_mask::autoload()
 | 
			
		||||
{                
 | 
			
		||||
  TString_array& mask_rows = rows_array();
 | 
			
		||||
  const TString& path = get(F_PATH);
 | 
			
		||||
  if (!fexist(path))
 | 
			
		||||
    return error_box("Specificare un percorso valido");
 | 
			
		||||
@ -242,20 +264,33 @@ bool TInstaller_mask::autoload()
 | 
			
		||||
      add_module(ini, module, FALSE);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    ininame = path;  
 | 
			
		||||
    ininame.add("??0???a.ini");
 | 
			
		||||
    modules.destroy();
 | 
			
		||||
    list_files(ininame, modules);
 | 
			
		||||
    FOR_EACH_ARRAY_ROW(modules, am, arow)
 | 
			
		||||
    {               
 | 
			
		||||
      TString& ininame = *arow;
 | 
			
		||||
      ininame.lower();
 | 
			
		||||
      const int pos = ininame.find("a.ini");
 | 
			
		||||
      CHECKS(pos >= 6, "Invalid installation configuration: ", (const char*)ininame);
 | 
			
		||||
      const TString16 module = ininame.mid(pos-6, 2);
 | 
			
		||||
      TConfig ini(ininame, module);
 | 
			
		||||
  }
 | 
			
		||||
  // add patches
 | 
			
		||||
  ininame = path;  
 | 
			
		||||
  ininame.add("??0???a.ini");
 | 
			
		||||
  modules.destroy();
 | 
			
		||||
  list_files(ininame, modules);
 | 
			
		||||
  modules.sort();  // sort to have patches in patchlevel order
 | 
			
		||||
  FOR_EACH_ARRAY_ROW(modules, am, arow)
 | 
			
		||||
  {               
 | 
			
		||||
    TString& ininame = *arow;
 | 
			
		||||
    ininame.lower();
 | 
			
		||||
    const int pos = ininame.find("a.ini");
 | 
			
		||||
    CHECKS(pos >= 6, "Invalid installation configuration: ", (const char*)ininame);
 | 
			
		||||
    const TString16 module = ininame.mid(pos-6, 2);
 | 
			
		||||
    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);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  const bool ok = sort_modules() > 0;
 | 
			
		||||
@ -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
 | 
			
		||||
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);
 | 
			
		||||
  
 | 
			
		||||
@ -460,7 +512,7 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
    ok = dischi > 0;
 | 
			
		||||
    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
 | 
			
		||||
    {
 | 
			
		||||
@ -468,8 +520,10 @@ bool TInstaller_mask::install(const TString& module, int patchlevel)
 | 
			
		||||
      if (!ok) return FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    TString msg;
 | 
			
		||||
    msg << "Decompressione del modulo '" << module << "' in corso...";
 | 
			
		||||
    TString msg("Decompressione");
 | 
			
		||||
    if (patchlevel > 0 )
 | 
			
		||||
      msg << " della patch " << patchlevel ;
 | 
			
		||||
    msg  << " del modulo '" << module << "' in corso...";
 | 
			
		||||
    TProgind pi(dischi, msg, FALSE, TRUE);
 | 
			
		||||
    TFilename tempdir; tempdir.tempdir();
 | 
			
		||||
    
 | 
			
		||||
@ -639,7 +693,8 @@ void TInstaller_mask::install_selection()
 | 
			
		||||
  TString_array& arr = rows_array();
 | 
			
		||||
  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())
 | 
			
		||||
    {
 | 
			
		||||
@ -647,10 +702,10 @@ void TInstaller_mask::install_selection()
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const TString modulo = row->get(2);
 | 
			
		||||
    const int newpatch = row->get_int(4);
 | 
			
		||||
    const TString oldver = row->get(6);
 | 
			
		||||
    const int oldpatch = row->get_int(7);
 | 
			
		||||
    const TString modulo = row->get(C_CODE);
 | 
			
		||||
    const int newpatch = row->get_int(C_PATCH);
 | 
			
		||||
    const TString oldver = row->get(C_CURRRELEASE);
 | 
			
		||||
    const int oldpatch = row->get_int(C_CURRPATCH);
 | 
			
		||||
    
 | 
			
		||||
    if (version2year(newver) < 1997)
 | 
			
		||||
    {
 | 
			
		||||
@ -670,31 +725,49 @@ void TInstaller_mask::install_selection()
 | 
			
		||||
                     "funzionamento di tutti i programmi!", (const char*)newver, newpatch, (const char*)modulo);
 | 
			
		||||
      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)
 | 
			
		||||
    {                         
 | 
			
		||||
      const bool is_patch = row->get_char(9) > ' ';
 | 
			
		||||
      ok = install(modulo, is_patch ? newpatch : 0);
 | 
			
		||||
      if (ok)
 | 
			
		||||
        _installed = TRUE; // Setta il flag di almeno un modulo installato
 | 
			
		||||
      if (!is_patch)          // Se installo un modulo pricipale ...
 | 
			
		||||
      {
 | 
			
		||||
        // ... allora installo tutte le patches
 | 
			
		||||
        for (int p = r+1; ok; p++)
 | 
			
		||||
        {
 | 
			
		||||
          if (row_disabled(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)
 | 
			
		||||
        {               
 | 
			
		||||
          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);
 | 
			
		||||
            ok = install(modulo, patchlevel);
 | 
			
		||||
          }       
 | 
			
		||||
          else
 | 
			
		||||
            break;
 | 
			
		||||
            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);
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (ok)
 | 
			
		||||
        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--)
 | 
			
		||||
        {                 
 | 
			
		||||
          TToken_string r = s.row(i);
 | 
			
		||||
          const TString16 newver = r.get(3);
 | 
			
		||||
          const int newpatch = r.get_int(4);
 | 
			
		||||
          const TString16 curver = r.get(6);
 | 
			
		||||
          const int curpatch = r.get_int(7);
 | 
			
		||||
          const TString16 newver = r.get(C_RELEASE);
 | 
			
		||||
          const int newpatch = r.get_int(C_PATCH);
 | 
			
		||||
          const TString16 curver = r.get(C_CURRRELEASE);
 | 
			
		||||
          const int curpatch = r.get_int(C_CURRPATCH);
 | 
			
		||||
          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--)
 | 
			
		||||
      {                 
 | 
			
		||||
        TToken_string r = row(i);
 | 
			
		||||
        const TString16 newver = r.get(3);
 | 
			
		||||
        const int newpatch = r.get_int(4);
 | 
			
		||||
        const TString16 curver = r.get(6);
 | 
			
		||||
        const int curpatch = r.get_int(7);
 | 
			
		||||
        const TString16 newver = r.get(C_RELEASE);
 | 
			
		||||
        const int newpatch = r.get_int(C_PATCH);
 | 
			
		||||
        const TString16 curver = r.get(C_CURRRELEASE);
 | 
			
		||||
        const int curpatch = r.get_int(C_CURRPATCH);
 | 
			
		||||
        check(i, compare_version(newver, newpatch, curver, curpatch > 0));
 | 
			
		||||
      }
 | 
			
		||||
      
 | 
			
		||||
@ -764,7 +837,7 @@ bool TInstaller_mask::on_key(KEY key)
 | 
			
		||||
 | 
			
		||||
TInstaller_mask::TInstaller_mask()
 | 
			
		||||
               : 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)
 | 
			
		||||
{               
 | 
			
		||||
  _curr_mask = this;
 | 
			
		||||
 | 
			
		||||
@ -7,12 +7,16 @@
 | 
			
		||||
 | 
			
		||||
#include <io.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <direct.h>
 | 
			
		||||
 | 
			
		||||
#define WINAPI _far _pascal                
 | 
			
		||||
#define LPSTR char*
 | 
			
		||||
#define LPCSTR const LPSTR
 | 
			
		||||
int WINAPI GetPrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPSTR, int, LPCSTR);
 | 
			
		||||
int WINAPI WritePrivateProfileString(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
 | 
			
		||||
#define DRIVE_REMOVABLE 2
 | 
			
		||||
#define DRIVE_FIXED     3
 | 
			
		||||
#define DRIVE_REMOTE    4
 | 
			
		||||
UINT WINAPI GetDriveType(int);
 | 
			
		||||
 | 
			
		||||
#endif  // DOS
 | 
			
		||||
@ -424,7 +428,10 @@ const char* CGetPrawinName(void)
 | 
			
		||||
      fclose(pw);
 | 
			
		||||
    }
 | 
			
		||||
    prawin = malloc(_MAX_PATH);
 | 
			
		||||
    _searchenv(tmp, NULL, prawin);
 | 
			
		||||
    if (*path)
 | 
			
		||||
      strcpy(prawin,tmp); 
 | 
			
		||||
    else
 | 
			
		||||
      _searchenv(tmp, NULL, prawin);
 | 
			
		||||
  }
 | 
			
		||||
  return prawin;
 | 
			
		||||
}
 | 
			
		||||
@ -463,13 +470,12 @@ BOOLEAN CPutPrawin(const char* pref)
 | 
			
		||||
  const char* prawin = CGetPrawinName();
 | 
			
		||||
  BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin);
 | 
			
		||||
  int disk = toupper(*prawin) - 'A';
 | 
			
		||||
  if (GetDriveType(disk) == 3)  // Aggiorna lo studio solo sui dischi locali
 | 
			
		||||
  WritePrivateProfileString("Main", "Study", __ptprf, prawin);
 | 
			
		||||
  if (GetDriveType(_getdrive() -1 ) == DRIVE_FIXED)  
 | 
			
		||||
  { 
 | 
			
		||||
    // 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
 | 
			
		||||
      
 | 
			
		||||
    WritePrivateProfileString("Main", "Study", __ptprf, prawin);
 | 
			
		||||
      
 | 
			
		||||
    // Aggiorna anche il vecchio pathpref.ini
 | 
			
		||||
    pppi = fopen("pathpref.ini", "w");
 | 
			
		||||
    fprintf(pppi, "%s\n", __ptprf);
 | 
			
		||||
    fclose(pppi);
 | 
			
		||||
 | 
			
		||||
@ -1229,13 +1229,13 @@ long TArray_sheet::add(TToken_string* s)
 | 
			
		||||
long TArray_sheet::insert(const TToken_string& s, long n)
 | 
			
		||||
{
 | 
			
		||||
  _data.insert(s, (int)n);
 | 
			
		||||
   const int maxrows=int(items());
 | 
			
		||||
   for (int r = maxrows-1; r >n ; r--)
 | 
			
		||||
   {
 | 
			
		||||
     const bool enab= row_enabled(r);
 | 
			
		||||
     enable_row(r,row_enabled(r+1));
 | 
			
		||||
     enable_row(r+1,enab);
 | 
			
		||||
   }
 | 
			
		||||
  const int maxrows=int(items());
 | 
			
		||||
  for (int r = maxrows-1; r >n ; r--)
 | 
			
		||||
  {
 | 
			
		||||
    const bool enab= row_enabled(r);
 | 
			
		||||
    enable_row(r,row_enabled(r+1));
 | 
			
		||||
    enable_row(r+1,enab);
 | 
			
		||||
  }
 | 
			
		||||
  return n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -286,7 +286,7 @@ SECTION BODY ODD 1
 | 
			
		||||
        KEY "prezzo"
 | 
			
		||||
        PROMPT  99 1 ""
 | 
			
		||||
        FIELD LF_RMOVMAG->PREZZO
 | 
			
		||||
        PICTURE "###.####.##@"
 | 
			
		||||
        PICTURE "###.###.##@"
 | 
			
		||||
      END
 | 
			
		||||
 | 
			
		||||
      NUMERO 108
 | 
			
		||||
@ -294,7 +294,7 @@ SECTION BODY ODD 1
 | 
			
		||||
        KEY "valore"
 | 
			
		||||
        PROMPT  112 1 ""
 | 
			
		||||
        MESSAGE _NUMEXPR,LF_RMOVMAG->PREZZO*LF_RMOVMAG->QUANT*349@->FC|ADD,10
 | 
			
		||||
        PICTURE "##.###.####.##@"
 | 
			
		||||
        PICTURE "##.###.###.##@"
 | 
			
		||||
      END
 | 
			
		||||
 | 
			
		||||
    END // RIGHE MOVIMENTO
 | 
			
		||||
@ -303,7 +303,7 @@ SECTION BODY ODD 1
 | 
			
		||||
    BEGIN
 | 
			
		||||
      KEY "totale mov"
 | 
			
		||||
      PROMPT  83 3 "Totale valore movimentato: £ "
 | 
			
		||||
      PICTURE "##.###.####.##@"
 | 
			
		||||
      PICTURE "##.###.###.##@"
 | 
			
		||||
    END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										197
									
								
								mg/mglib01.cpp
									
									
									
									
									
								
							
							
						
						
									
										197
									
								
								mg/mglib01.cpp
									
									
									
									
									
								
							@ -11,7 +11,8 @@
 | 
			
		||||
// *******************************
 | 
			
		||||
#define MAXSIMBOLS 256
 | 
			
		||||
#define MAXSTATES 25
 | 
			
		||||
class TStateset {
 | 
			
		||||
class TStateset
 | 
			
		||||
{
 | 
			
		||||
  unsigned char _container[MAXSTATES];
 | 
			
		||||
  int _current;
 | 
			
		||||
public:
 | 
			
		||||
@ -27,7 +28,8 @@ public:
 | 
			
		||||
  ~TStateset() {};  
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct TAutoma_state  {
 | 
			
		||||
struct TAutoma_state
 | 
			
		||||
{
 | 
			
		||||
  short _transaction[MAXSIMBOLS];
 | 
			
		||||
  TString16 * _label;
 | 
			
		||||
  bool _final;
 | 
			
		||||
@ -43,7 +45,8 @@ struct TAutoma_state  {
 | 
			
		||||
// *******************************
 | 
			
		||||
// *******************************
 | 
			
		||||
// automa per il riconoscimento di metacaratteri
 | 
			
		||||
class TR_automa {
 | 
			
		||||
class TR_automa
 | 
			
		||||
{
 | 
			
		||||
  TAutoma_state st[MAXSTATES];
 | 
			
		||||
  short _maxstate;
 | 
			
		||||
protected:  
 | 
			
		||||
@ -86,19 +89,22 @@ TStateset::TStateset()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TStateset & TStateset::empty()
 | 
			
		||||
{ _current=0;
 | 
			
		||||
{
 | 
			
		||||
  _current=0;
 | 
			
		||||
  for (int i= 0; i< MAXSTATES; _container[i++]=0);
 | 
			
		||||
  return *this;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TStateset & TStateset::enclose(int el)
 | 
			
		||||
{ if (el< MAXSTATES && el>=0)
 | 
			
		||||
{
 | 
			
		||||
  if (el< MAXSTATES && el>=0)
 | 
			
		||||
    _container[el]=1;
 | 
			
		||||
  return *this;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TStateset & TStateset::singleton(int el)
 | 
			
		||||
{ empty();
 | 
			
		||||
{
 | 
			
		||||
  empty();
 | 
			
		||||
  _container[el]=1;
 | 
			
		||||
  return *this;
 | 
			
		||||
}
 | 
			
		||||
@ -112,9 +118,9 @@ TStateset & TStateset::cap(TStateset & s)
 | 
			
		||||
  
 | 
			
		||||
bool TStateset::is_empty() const
 | 
			
		||||
{ 
 | 
			
		||||
  for (int i= 0; i< MAXSTATES; i++) {
 | 
			
		||||
    if (_container[i]) return FALSE;
 | 
			
		||||
  }
 | 
			
		||||
  for (int i= 0; i< MAXSTATES; i++)
 | 
			
		||||
    if (_container[i])
 | 
			
		||||
      return FALSE;
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -131,10 +137,9 @@ int TStateset::get_first()
 | 
			
		||||
 | 
			
		||||
int TStateset::get_next()
 | 
			
		||||
{
 | 
			
		||||
  while (_current+1 < MAXSTATES)  {
 | 
			
		||||
  while (_current+1 < MAXSTATES)
 | 
			
		||||
    if (_container[++_current])
 | 
			
		||||
      return _current;
 | 
			
		||||
  } 
 | 
			
		||||
  return (-1);  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -147,10 +152,9 @@ bool TR_automa::is_state(int statenum)
 | 
			
		||||
// restituisce il numero dello stato con quella etichetta
 | 
			
		||||
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)
 | 
			
		||||
      return(s+1);
 | 
			
		||||
  }
 | 
			
		||||
  return(0);  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -159,24 +163,25 @@ int TR_automa::label2state(const char *label)
 | 
			
		||||
TR_automa & TR_automa::reset_state(int statenum)
 | 
			
		||||
{
 | 
			
		||||
  int _from,_to;
 | 
			
		||||
  if (statenum>0 && statenum<=_maxstate) {
 | 
			
		||||
  if (statenum>0 && statenum<=_maxstate)
 | 
			
		||||
  {
 | 
			
		||||
    _from=statenum;
 | 
			
		||||
    _to=statenum;
 | 
			
		||||
  } else {
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    _maxstate=0;
 | 
			
		||||
    _isdeterministic=TRUE;
 | 
			
		||||
    _from=1;
 | 
			
		||||
    _to=MAXSTATES;
 | 
			
		||||
  } 
 | 
			
		||||
  for (int i=_from; i<=_to;i++)
 | 
			
		||||
  {
 | 
			
		||||
    for (int i=_from; i<=_to;i++) {
 | 
			
		||||
      set_label(i,"");
 | 
			
		||||
      set_final(i,FALSE);
 | 
			
		||||
      for (int j=0; j<MAXSIMBOLS;j++) {
 | 
			
		||||
        del_trans(i,j); 
 | 
			
		||||
      }
 | 
			
		||||
    }     
 | 
			
		||||
  }
 | 
			
		||||
    set_label(i,"");
 | 
			
		||||
    set_final(i,FALSE);
 | 
			
		||||
    for (int j=0; j<MAXSIMBOLS;j++)
 | 
			
		||||
      del_trans(i,j); 
 | 
			
		||||
  }     
 | 
			
		||||
  return *this;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -209,7 +214,8 @@ bool TR_automa::is_final(TStateset ss ) const
 | 
			
		||||
{ 
 | 
			
		||||
  bool retv=FALSE;
 | 
			
		||||
  int statenum=ss.get_first();
 | 
			
		||||
  do {
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    retv=retv || is_final(statenum);
 | 
			
		||||
  } while ((statenum=ss.get_next())>0);
 | 
			
		||||
    
 | 
			
		||||
@ -251,43 +257,47 @@ TR_automa::TR_automa(TR_automa * aa,bool makedet)
 | 
			
		||||
  TString16  tmplabel;
 | 
			
		||||
  int curr_new_state;
 | 
			
		||||
 | 
			
		||||
  for (int i=0; i<MAXSTATES;i++) {
 | 
			
		||||
  for (int i=0; i<MAXSTATES;i++)
 | 
			
		||||
    st[i]._label = new TString16;
 | 
			
		||||
  }     
 | 
			
		||||
  if (aa==NULL) {
 | 
			
		||||
  if (aa==NULL)
 | 
			
		||||
  {
 | 
			
		||||
    reset_state();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (makedet) {
 | 
			
		||||
  if (makedet)
 | 
			
		||||
  {
 | 
			
		||||
    reset_state();
 | 
			
		||||
    // crea il primo stato nell'automa deterministico
 | 
			
		||||
    set2label(aa->union_of_closures(newstateset.singleton(FIRST_STATE)),tmplabel);
 | 
			
		||||
    add_state(tmplabel);
 | 
			
		||||
    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
 | 
			
		||||
      // che corrispondono a questo stato dell'automa deterministico
 | 
			
		||||
      label2set(label(curr_new_state),newstateset);
 | 
			
		||||
      // lo stato è finale se include stati finali dell'automa non det.
 | 
			
		||||
      set_final(curr_new_state,aa->is_final(newstateset));
 | 
			
		||||
      // 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.:
 | 
			
		||||
        // 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.
 | 
			
		||||
        arrival.empty();
 | 
			
		||||
        int new_next,old_next;
 | 
			
		||||
        int old_state=newstateset.get_first() ;
 | 
			
		||||
        do {
 | 
			
		||||
        do
 | 
			
		||||
        {
 | 
			
		||||
          if (old_next=aa->trans_to(old_state,(unsigned char)symbol))
 | 
			
		||||
            arrival.enclose(old_next);
 | 
			
		||||
        } while ((old_state=newstateset.get_next())>0);
 | 
			
		||||
        if (!arrival.is_empty()) {
 | 
			
		||||
        if (!arrival.is_empty())
 | 
			
		||||
        {
 | 
			
		||||
            // crea il nuovo arco nell'automa deterministico
 | 
			
		||||
          set2label(aa->union_of_closures(arrival),tmplabel);
 | 
			
		||||
          if (!(new_next=label2state(tmplabel))) {
 | 
			
		||||
          new_next=add_state(tmplabel);
 | 
			
		||||
          } 
 | 
			
		||||
          if (!(new_next=label2state(tmplabel)))
 | 
			
		||||
            new_next=add_state(tmplabel);
 | 
			
		||||
          add_tran(curr_new_state,(unsigned char)symbol,new_next);
 | 
			
		||||
        }
 | 
			
		||||
      } // loop symbol
 | 
			
		||||
@ -298,18 +308,16 @@ TR_automa::TR_automa(TR_automa * aa,bool makedet)
 | 
			
		||||
  else 
 | 
			
		||||
  {
 | 
			
		||||
    *this=*aa;
 | 
			
		||||
    for (int i=0; i<MAXSTATES;i++) {
 | 
			
		||||
    for (int i=0; i<MAXSTATES;i++)
 | 
			
		||||
      st[i]._label= aa->st[i]._label;
 | 
			
		||||
    }     
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TR_automa::~TR_automa()
 | 
			
		||||
{ 
 | 
			
		||||
  for (int i=0; i<MAXSTATES;i++) {
 | 
			
		||||
  for (int i=0; i<MAXSTATES;i++)
 | 
			
		||||
    delete (st[i]._label);
 | 
			
		||||
  }     
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -317,10 +325,9 @@ void TR_automa::set2label(const TStateset ss,TString16 & label)
 | 
			
		||||
{
 | 
			
		||||
  char coded[MAXSTATES];
 | 
			
		||||
  char c=0;
 | 
			
		||||
  for (int i= 0; i< MAXSTATES; i++) {
 | 
			
		||||
  for (int i= 0; i< MAXSTATES; i++)
 | 
			
		||||
    if (ss.is_member(i)) 
 | 
			
		||||
      coded[c++]=(char)(i+'0');
 | 
			
		||||
  }
 | 
			
		||||
  coded[c]='\0';
 | 
			
		||||
  label=coded;    
 | 
			
		||||
}
 | 
			
		||||
@ -343,12 +350,15 @@ TStateset TR_automa::union_of_closures(TStateset &start_set)
 | 
			
		||||
  
 | 
			
		||||
  u_of_clo.empty();
 | 
			
		||||
  _state=start_set.get_first() ;
 | 
			
		||||
  do {
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    // la chiusura è composta dallo stato e tutte le sue transazioni epsilon
 | 
			
		||||
    clo.singleton(_state);
 | 
			
		||||
    do {
 | 
			
		||||
    do
 | 
			
		||||
    {
 | 
			
		||||
      int _state2=clo.get_first();
 | 
			
		||||
      do {
 | 
			
		||||
      do
 | 
			
		||||
      {
 | 
			
		||||
        toadd=((_next=trans_to(_state2,EPSILON)) && (!clo.is_member(_next)));
 | 
			
		||||
        if (toadd)
 | 
			
		||||
          clo.enclose(_next);
 | 
			
		||||
@ -362,20 +372,18 @@ TStateset TR_automa::union_of_closures(TStateset &start_set)
 | 
			
		||||
// tenta di riconoscere la stringa passata
 | 
			
		||||
bool TR_automa::recognized(const char * t_str) 
 | 
			
		||||
{
 | 
			
		||||
  if (_isdeterministic) {
 | 
			
		||||
  if (_isdeterministic)
 | 
			
		||||
  {
 | 
			
		||||
    // ricoNosce la stringa di token
 | 
			
		||||
    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])))
 | 
			
		||||
        // fine per mancanza di trasizioni
 | 
			
		||||
        return FALSE; 
 | 
			
		||||
    }
 | 
			
		||||
        return FALSE; // fine per mancanza di trasizioni
 | 
			
		||||
    // fine per mancanza di caratteri di input della stringa
 | 
			
		||||
    return (is_final(curr_state));
 | 
			
		||||
  } else {
 | 
			
		||||
    //    
 | 
			
		||||
    return FALSE;
 | 
			
		||||
  }
 | 
			
		||||
   else
 | 
			
		||||
    return FALSE; //  ??
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// *******************************
 | 
			
		||||
@ -400,32 +408,33 @@ bool TMetachar::recognized(const char * s)
 | 
			
		||||
        
 | 
			
		||||
void TMetachar::add_tran(int s,unsigned char metasymbol, int nextstate)
 | 
			
		||||
{
 | 
			
		||||
    unsigned char c;
 | 
			
		||||
    switch (metasymbol) {
 | 
			
		||||
      case EPSILON:// blank
 | 
			
		||||
        _au->add_tran(s,EPSILON,nextstate);
 | 
			
		||||
      break;
 | 
			
		||||
      case S_BLANK:// blank
 | 
			
		||||
        _au->add_tran(s,' ',nextstate);
 | 
			
		||||
      break;
 | 
			
		||||
      case S_DIGIT:// cifra 
 | 
			
		||||
        for (c='0';c<='9';c++)
 | 
			
		||||
          _au->add_tran(s,c,nextstate);
 | 
			
		||||
      break;
 | 
			
		||||
      case S_LETTER: // lettera 
 | 
			
		||||
        for (c='a';c<='z';c++)
 | 
			
		||||
          _au->add_tran(s,c,nextstate);
 | 
			
		||||
        for (c='A';c<='Z';c++)
 | 
			
		||||
          _au->add_tran(s,c,nextstate);
 | 
			
		||||
      break;
 | 
			
		||||
      case S_ANY: // qualsiasi carattere 
 | 
			
		||||
        for (c=MAXSIMBOLS-1;c>=FIRST_NEMPTY_SYMBOL;c--)
 | 
			
		||||
          _au->add_tran(s,c,nextstate);
 | 
			
		||||
      break;
 | 
			
		||||
      default:
 | 
			
		||||
          _au->add_tran(s,metasymbol,nextstate);
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  unsigned char c;
 | 
			
		||||
  switch (metasymbol)
 | 
			
		||||
  {
 | 
			
		||||
    case EPSILON:// blank
 | 
			
		||||
      _au->add_tran(s,EPSILON,nextstate);
 | 
			
		||||
    break;
 | 
			
		||||
    case S_BLANK:// blank
 | 
			
		||||
      _au->add_tran(s,' ',nextstate);
 | 
			
		||||
    break;
 | 
			
		||||
    case S_DIGIT:// cifra 
 | 
			
		||||
      for (c='0';c<='9';c++)
 | 
			
		||||
        _au->add_tran(s,c,nextstate);
 | 
			
		||||
    break;
 | 
			
		||||
    case S_LETTER: // lettera 
 | 
			
		||||
      for (c='a';c<='z';c++)
 | 
			
		||||
        _au->add_tran(s,c,nextstate);
 | 
			
		||||
      for (c='A';c<='Z';c++)
 | 
			
		||||
        _au->add_tran(s,c,nextstate);
 | 
			
		||||
    break;
 | 
			
		||||
    case S_ANY: // qualsiasi carattere 
 | 
			
		||||
      for (c=MAXSIMBOLS-1;c>=FIRST_NEMPTY_SYMBOL;c--)
 | 
			
		||||
        _au->add_tran(s,c,nextstate);
 | 
			
		||||
    break;
 | 
			
		||||
    default:
 | 
			
		||||
        _au->add_tran(s,metasymbol,nextstate);
 | 
			
		||||
    break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -449,15 +458,18 @@ void TMetachar::set_language(const char * language)
 | 
			
		||||
  _language=language;
 | 
			
		||||
  // crea l'automa 
 | 
			
		||||
  _au->reset_state();
 | 
			
		||||
  for (int i=0; language[i]; i++) {
 | 
			
		||||
  for (int i=0; language[i]; i++)
 | 
			
		||||
  {
 | 
			
		||||
    label[0]='a'+i;
 | 
			
		||||
    nextlabel[0]='a'+i+1;
 | 
			
		||||
    if (language[i]!=C_ESCAPEMETA) {
 | 
			
		||||
    if (language[i]!=C_ESCAPEMETA)
 | 
			
		||||
    {
 | 
			
		||||
      if (!escaped_char)
 | 
			
		||||
      {
 | 
			
		||||
      // meta-caratteri e literal fuori set
 | 
			
		||||
        s=_au->add_state(label);
 | 
			
		||||
        switch (language[i]) {
 | 
			
		||||
        switch (language[i])
 | 
			
		||||
        {
 | 
			
		||||
          case '#':// cifra o blank opzionale
 | 
			
		||||
            add_tran(s,S_BLANK,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);
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
      // escaped char
 | 
			
		||||
          s=_au->add_state(label);
 | 
			
		||||
        _au->add_tran(s,language[i],s+1);
 | 
			
		||||
@ -507,7 +521,8 @@ bool TMetachar::has_opzchars(const char * pattern)
 | 
			
		||||
  int i=0; 
 | 
			
		||||
  bool next_literal=FALSE;
 | 
			
		||||
  
 | 
			
		||||
  while (pattern[i]) {           
 | 
			
		||||
  while (pattern[i])
 | 
			
		||||
  {           
 | 
			
		||||
    if (!next_literal && strchr(_metach_opz,pattern[i]))
 | 
			
		||||
      return(TRUE);
 | 
			
		||||
    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
			
		||||
@ -522,7 +537,8 @@ bool TMetachar::has_mandchars(const char * pattern)
 | 
			
		||||
  int i=0; 
 | 
			
		||||
  bool next_literal=FALSE;
 | 
			
		||||
  
 | 
			
		||||
  while (pattern[i]) {
 | 
			
		||||
  while (pattern[i])
 | 
			
		||||
  {
 | 
			
		||||
    if (next_literal || strchr(_metach_mand,pattern[i]))
 | 
			
		||||
      return(TRUE);
 | 
			
		||||
    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
			
		||||
@ -537,7 +553,8 @@ int TMetachar::maxstrlen(const char * pattern)
 | 
			
		||||
  int i=0,l=0; 
 | 
			
		||||
  bool next_literal=FALSE;
 | 
			
		||||
  
 | 
			
		||||
  while (pattern[i]) {
 | 
			
		||||
  while (pattern[i])
 | 
			
		||||
  {
 | 
			
		||||
    if (!next_literal)
 | 
			
		||||
      l++;
 | 
			
		||||
    next_literal=(!next_literal && pattern[i]==C_ESCAPEMETA);
 | 
			
		||||
@ -560,7 +577,8 @@ TMetachar::TMetachar (const char * metastr)
 | 
			
		||||
//  set_language(&auxau,metastr);
 | 
			
		||||
  _au=new TR_automa;
 | 
			
		||||
  set_language(metastr);
 | 
			
		||||
  if (!_au->is_deterministic()) {
 | 
			
		||||
  if (!_au->is_deterministic())
 | 
			
		||||
  {
 | 
			
		||||
    TR_automa * auxau = new TR_automa(_au,TRUE);       
 | 
			
		||||
    delete _au;
 | 
			
		||||
    _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 
 | 
			
		||||
{
 | 
			
		||||
  CHECK(enabled(), "iu chent get de code format if levels ar disebold");
 | 
			
		||||
  if (levnum<0) {
 | 
			
		||||
  if (levnum<0)
 | 
			
		||||
  {
 | 
			
		||||
    levnum=max(last_level(),1);
 | 
			
		||||
  } 
 | 
			
		||||
  ((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 
 | 
			
		||||
{
 | 
			
		||||
  CHECK(enabled(), "iu chent cec ueter de format fits if levels ar disebold");
 | 
			
		||||
  if (levnum<0) {
 | 
			
		||||
  if (levnum<0)
 | 
			
		||||
    levnum=max(last_level(),1);
 | 
			
		||||
  } 
 | 
			
		||||
  ((TCodice_livelli *)this)->add_metachar(levnum);
 | 
			
		||||
  return ((TMetachar*)_metachars.objptr(levnum-1))->recognized(codepart);
 | 
			
		||||
}
 | 
			
		||||
@ -819,4 +837,3 @@ TMagazzini::TMagazzini() :
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										299
									
								
								mg/mglib02.cpp
									
									
									
									
									
								
							
							
						
						
									
										299
									
								
								mg/mglib02.cpp
									
									
									
									
									
								
							@ -28,7 +28,8 @@
 | 
			
		||||
 | 
			
		||||
// libreria per i movimenti
 | 
			
		||||
 | 
			
		||||
char * Nome_valorizz[]= {
 | 
			
		||||
char * Nome_valorizz[]=
 | 
			
		||||
{
 | 
			
		||||
  "Ultimo costo", "Media ultimi costi", "Prezzo di listino",
 | 
			
		||||
  "Costo standard", "Costo medio" , 
 | 
			
		||||
  "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,
 | 
			
		||||
                                              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,
 | 
			
		||||
                                              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
 | 
			
		||||
@ -758,8 +759,6 @@ TArticolo_giacenza::TArticolo_giacenza(const TRectype& rec)
 | 
			
		||||
 | 
			
		||||
const real CENTO=real(100.0);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool TCondizione_vendita::  ricerca(const char * codice, const real & qta) 
 | 
			
		||||
{
 | 
			
		||||
  int tiporic;
 | 
			
		||||
@ -931,49 +930,50 @@ int TCausale_magazzino::sgn(TTipo_saldomag tiposaldo)
 | 
			
		||||
{
 | 
			
		||||
  static TString80 segni;
 | 
			
		||||
  segni=get("S2");
 | 
			
		||||
  switch (tiposaldo) {
 | 
			
		||||
  case s_giac:
 | 
			
		||||
    return atoi(segni.mid(0,2));
 | 
			
		||||
  case s_acq:
 | 
			
		||||
    return atoi(segni.mid(2,2));
 | 
			
		||||
  case s_ent:
 | 
			
		||||
    return atoi(segni.mid(4,2));
 | 
			
		||||
  case s_ven:
 | 
			
		||||
    return atoi(segni.mid(6,2));
 | 
			
		||||
  case s_usc:
 | 
			
		||||
    return atoi(segni.mid(8,2));
 | 
			
		||||
  case s_ordc:
 | 
			
		||||
    return atoi(segni.mid(10,2));
 | 
			
		||||
  case s_ordf:
 | 
			
		||||
    return atoi(segni.mid(12,2));
 | 
			
		||||
  case s_incl:
 | 
			
		||||
    return atoi(segni.mid(14,2));
 | 
			
		||||
  case s_acl:
 | 
			
		||||
    return atoi(segni.mid(16,2));
 | 
			
		||||
  case s_prodc:
 | 
			
		||||
    return atoi(segni.mid(18,2));
 | 
			
		||||
  case s_prodf:
 | 
			
		||||
    return atoi(segni.mid(20,2));
 | 
			
		||||
  case s_rim:
 | 
			
		||||
    return atoi(segni.mid(22,2));
 | 
			
		||||
  case s_scart:
 | 
			
		||||
    return atoi(segni.mid(24,2));
 | 
			
		||||
  case s_label:
 | 
			
		||||
    return atoi(segni.mid(26,2));
 | 
			
		||||
  case s_user1:
 | 
			
		||||
    return atoi(segni.mid(28,2));
 | 
			
		||||
  case s_user2:
 | 
			
		||||
    return atoi(segni.mid(30,2));
 | 
			
		||||
  case s_user3:
 | 
			
		||||
    return atoi(segni.mid(32,2));
 | 
			
		||||
  case s_user4:
 | 
			
		||||
    return atoi(segni.mid(34,2));
 | 
			
		||||
  case s_user5:
 | 
			
		||||
    return atoi(segni.mid(36,2));
 | 
			
		||||
  case s_user6:
 | 
			
		||||
    return atoi(segni.mid(38,2));
 | 
			
		||||
  default:
 | 
			
		||||
  return 0;
 | 
			
		||||
  switch (tiposaldo)
 | 
			
		||||
  {
 | 
			
		||||
    case s_giac:
 | 
			
		||||
      return atoi(segni.mid(0,2));
 | 
			
		||||
    case s_acq:
 | 
			
		||||
      return atoi(segni.mid(2,2));
 | 
			
		||||
    case s_ent:
 | 
			
		||||
      return atoi(segni.mid(4,2));
 | 
			
		||||
    case s_ven:
 | 
			
		||||
      return atoi(segni.mid(6,2));
 | 
			
		||||
    case s_usc:
 | 
			
		||||
      return atoi(segni.mid(8,2));
 | 
			
		||||
    case s_ordc:
 | 
			
		||||
      return atoi(segni.mid(10,2));
 | 
			
		||||
    case s_ordf:
 | 
			
		||||
      return atoi(segni.mid(12,2));
 | 
			
		||||
    case s_incl:
 | 
			
		||||
      return atoi(segni.mid(14,2));
 | 
			
		||||
    case s_acl:
 | 
			
		||||
      return atoi(segni.mid(16,2));
 | 
			
		||||
    case s_prodc:
 | 
			
		||||
      return atoi(segni.mid(18,2));
 | 
			
		||||
    case s_prodf:
 | 
			
		||||
      return atoi(segni.mid(20,2));
 | 
			
		||||
    case s_rim:
 | 
			
		||||
      return atoi(segni.mid(22,2));
 | 
			
		||||
    case s_scart:
 | 
			
		||||
      return atoi(segni.mid(24,2));
 | 
			
		||||
    case s_label:
 | 
			
		||||
      return atoi(segni.mid(26,2));
 | 
			
		||||
    case s_user1:
 | 
			
		||||
      return atoi(segni.mid(28,2));
 | 
			
		||||
    case s_user2:
 | 
			
		||||
      return atoi(segni.mid(30,2));
 | 
			
		||||
    case s_user3:
 | 
			
		||||
      return atoi(segni.mid(32,2));
 | 
			
		||||
    case s_user4:
 | 
			
		||||
      return atoi(segni.mid(34,2));
 | 
			
		||||
    case s_user5:
 | 
			
		||||
      return atoi(segni.mid(36,2));
 | 
			
		||||
    case s_user6:
 | 
			
		||||
      return atoi(segni.mid(38,2));
 | 
			
		||||
    default:
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1044,7 +1044,6 @@ int TLine_movmag::operator==(TLine_movmag &l)
 | 
			
		||||
 | 
			
		||||
TRecord_cache TMov_mag::cache_causali("%CAU");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TMov_mag::TMov_mag() : 
 | 
			
		||||
  TMultiple_rectype(LF_MOVMAG),
 | 
			
		||||
  lines_to_add(), lines_to_subtract()
 | 
			
		||||
@ -1204,51 +1203,50 @@ int TMov_mag::force_update_bal()
 | 
			
		||||
// restituisce il valore dei dati
 | 
			
		||||
TLine_movmag & TMov_mag::line2data(int nrig) const
 | 
			
		||||
{
 | 
			
		||||
    static TLine_movmag line; 
 | 
			
		||||
    TRecord_array & b = body();             
 | 
			
		||||
  static TLine_movmag line; 
 | 
			
		||||
  TRecord_array & b = body();             
 | 
			
		||||
 | 
			
		||||
    line.set(
 | 
			
		||||
      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_real(RMOVMAG_QUANT),
 | 
			
		||||
      b.row(nrig).get_real(RMOVMAG_PREZZO));
 | 
			
		||||
    return line;
 | 
			
		||||
  line.set(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_real(RMOVMAG_QUANT),
 | 
			
		||||
           b.row(nrig).get_real(RMOVMAG_PREZZO));
 | 
			
		||||
  return line;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TToken_string & TMov_mag::line2key(int numriga) const
 | 
			
		||||
{
 | 
			
		||||
    static TToken_string _key;
 | 
			
		||||
    TRecord_array & b = body();             
 | 
			
		||||
    TString16 nr;
 | 
			
		||||
  static TToken_string _key;
 | 
			
		||||
  TRecord_array & b = body();             
 | 
			
		||||
  TString16 nr;
 | 
			
		||||
 | 
			
		||||
    nr << numriga;           
 | 
			
		||||
    _key.cut(0);
 | 
			
		||||
    _key.add(b.row(numriga).get(RMOVMAG_CODART));
 | 
			
		||||
    _key.add(b.row(numriga).get(RMOVMAG_CODMAG));
 | 
			
		||||
    _key.add(b.row(numriga).get(RMOVMAG_LIVGIAC));
 | 
			
		||||
    _key.add(nr);
 | 
			
		||||
    return _key;
 | 
			
		||||
  nr << numriga;           
 | 
			
		||||
  _key.cut(0);
 | 
			
		||||
  _key.add(b.row(numriga).get(RMOVMAG_CODART));
 | 
			
		||||
  _key.add(b.row(numriga).get(RMOVMAG_CODMAG));
 | 
			
		||||
  _key.add(b.row(numriga).get(RMOVMAG_LIVGIAC));
 | 
			
		||||
  _key.add(nr);
 | 
			
		||||
  return _key;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TString TMov_mag::key2field(TToken_string &key,const char *fieldname) 
 | 
			
		||||
{
 | 
			
		||||
    if (strcmp(fieldname,"CODART")==0)
 | 
			
		||||
      return key.get(0);
 | 
			
		||||
    if (strcmp(fieldname,"CODMAG")==0)
 | 
			
		||||
      return key.get(1);
 | 
			
		||||
    if (strcmp(fieldname,"LIVGIAC")==0)
 | 
			
		||||
      return key.get(2);
 | 
			
		||||
    CHECKS(FALSE, "Nome di campo non appartenente al file righe mov ", fieldname);
 | 
			
		||||
  if (strcmp(fieldname,"CODART")==0)
 | 
			
		||||
    return key.get(0);
 | 
			
		||||
  if (strcmp(fieldname,"CODMAG")==0)
 | 
			
		||||
    return key.get(1);
 | 
			
		||||
  if (strcmp(fieldname,"LIVGIAC")==0)
 | 
			
		||||
    return key.get(2);
 | 
			
		||||
  CHECKS(FALSE, "Nome di campo non appartenente al file righe mov ", fieldname);
 | 
			
		||||
  return "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
  } else {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    if (lines_to_subtract.is_key(k)&& (TLine_movmag &)lines_to_subtract[k]==r)
 | 
			
		||||
      // modifica annullata
 | 
			
		||||
      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)
 | 
			
		||||
{
 | 
			
		||||
  if (_annoes != get("ANNOES")) {
 | 
			
		||||
  if (_annoes != get("ANNOES"))
 | 
			
		||||
    lines_to_subtract.add(k,r);
 | 
			
		||||
  } else {
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    if (lines_to_add.is_key(k)&& r==(TLine_movmag &)lines_to_add[k] )
 | 
			
		||||
      // modifica annullata
 | 
			
		||||
      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) 
 | 
			
		||||
{
 | 
			
		||||
  TLocalisamfile anamag(LF_ANAMAG);
 | 
			
		||||
  
 | 
			
		||||
  anamag.put("CODART",codart);
 | 
			
		||||
  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) 
 | 
			
		||||
{
 | 
			
		||||
  TLocalisamfile anamag(LF_ANAMAG);
 | 
			
		||||
  
 | 
			
		||||
  anamag.put("CODART",codart);
 | 
			
		||||
  
 | 
			
		||||
  bool insert_new=TRUE;
 | 
			
		||||
  TString mess;
 | 
			
		||||
  
 | 
			
		||||
  mess << "Il record di anagrafica dell'articolo ''"<< codart << "'' risulta essere già in uso.\n Interrompo ?";
 | 
			
		||||
  
 | 
			
		||||
  TTimed_breakbox bbox((const char *)mess,10);
 | 
			
		||||
  do {
 | 
			
		||||
  
 | 
			
		||||
  do
 | 
			
		||||
  {
 | 
			
		||||
    if (anamag.read(_isequal,_testandlock)==NOERR) 
 | 
			
		||||
      return TRUE;
 | 
			
		||||
  } while (bbox.run()!=K_ESC);
 | 
			
		||||
@ -1314,20 +1320,24 @@ int TMov_mag::update_balances()
 | 
			
		||||
{
 | 
			
		||||
  bool updated_bal=TRUE;
 | 
			
		||||
  TLocalisamfile mag(LF_MAG);
 | 
			
		||||
 | 
			
		||||
  mag.setkey(2);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  TString_array keys_to_add,keys_to_remove;
 | 
			
		||||
 | 
			
		||||
  ((TMov_mag *)this)->lines_to_add.get_keys(keys_to_add);
 | 
			
		||||
  ((TMov_mag *)this)->lines_to_subtract.get_keys(keys_to_remove);
 | 
			
		||||
 | 
			
		||||
  // aggiunge i saldi nuovi
 | 
			
		||||
  keys_to_add.sort();
 | 
			
		||||
 | 
			
		||||
  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"));
 | 
			
		||||
    if (curr_art.lock_and_prompt()) {
 | 
			
		||||
    if (curr_art.lock_and_prompt())
 | 
			
		||||
    {
 | 
			
		||||
      // lock gained
 | 
			
		||||
      TLine_movmag & line_mov=(TLine_movmag &)lines_to_add[*curr_key];
 | 
			
		||||
      TCausale_magazzino & causmag=(TCausale_magazzino &)cache_causali.get(line_mov.codcaus());
 | 
			
		||||
@ -1338,7 +1348,8 @@ int TMov_mag::update_balances()
 | 
			
		||||
        curr_art.rewrite();
 | 
			
		||||
      }
 | 
			
		||||
      giac_putkey(mag,get("ANNOES"),*curr_key);
 | 
			
		||||
      if (mag.read()!=NOERR) {
 | 
			
		||||
      if (mag.read()!=NOERR)
 | 
			
		||||
      {
 | 
			
		||||
        // non trovato: aggiungo
 | 
			
		||||
        giac_putkey(mag,get("ANNOES"),*curr_key);
 | 
			
		||||
        mag.put("NRIGA",1+curr_art.mag(get("ANNOES")).rows());
 | 
			
		||||
@ -1357,10 +1368,12 @@ int TMov_mag::update_balances()
 | 
			
		||||
      mag.rewrite();
 | 
			
		||||
      // conclude la TRANSAZIONE prima di sbloccare il record dell'articolo
 | 
			
		||||
      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")) {
 | 
			
		||||
          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);
 | 
			
		||||
            mag.rewrite();
 | 
			
		||||
          } 
 | 
			
		||||
@ -1369,30 +1382,34 @@ int TMov_mag::update_balances()
 | 
			
		||||
        rem_key=(TToken_string *)keys_to_remove.succ_item();
 | 
			
		||||
      } 
 | 
			
		||||
      curr_art.unlock();
 | 
			
		||||
    } else {
 | 
			
		||||
      updated_bal=FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
      updated_bal=FALSE;
 | 
			
		||||
    curr_key=(TToken_string *)keys_to_add.succ_item();
 | 
			
		||||
  } 
 | 
			
		||||
  // togli i saldi vecchi
 | 
			
		||||
  curr_key=(TToken_string *)keys_to_remove.first_item();
 | 
			
		||||
 | 
			
		||||
  while (curr_key) {
 | 
			
		||||
  while (curr_key)
 | 
			
		||||
  {
 | 
			
		||||
    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);
 | 
			
		||||
      // 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);
 | 
			
		||||
        mag.rewrite();
 | 
			
		||||
      } 
 | 
			
		||||
      curr_art.unlock();
 | 
			
		||||
    } else {
 | 
			
		||||
      updated_bal=FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
      updated_bal=FALSE;
 | 
			
		||||
    curr_key=(TToken_string *)keys_to_remove.succ_item();
 | 
			
		||||
  }
 | 
			
		||||
  if (!updated_bal) {
 | 
			
		||||
  if (!updated_bal)
 | 
			
		||||
  {
 | 
			
		||||
    // saldi non aggiornati
 | 
			
		||||
    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());
 | 
			
		||||
  TLocalisamfile umart(LF_UMART);              
 | 
			
		||||
  real diff,diff_val;
 | 
			
		||||
 | 
			
		||||
  umart.setkey(2);
 | 
			
		||||
  umart.put(UMART_CODART,magrec.get(MAG_CODART));
 | 
			
		||||
  umart.put(UMART_UM , l.um());
 | 
			
		||||
  umart.read();
 | 
			
		||||
  real fc=umart.get_real("FC");
 | 
			
		||||
 | 
			
		||||
  diff=fc*rett_sign*l.quant();
 | 
			
		||||
  diff_val=rett_sign*l.quant()*l.prezzo();
 | 
			
		||||
  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,"ENT",diff*caus.sgn(s_ent));
 | 
			
		||||
    update_balance(magrec,"VEN",diff*caus.sgn(s_ven));
 | 
			
		||||
    update_balance(magrec,"USC",diff*caus.sgn(s_usc));
 | 
			
		||||
    update_balance(magrec,"ORDC",diff*caus.sgn(s_ordc));
 | 
			
		||||
    update_balance(magrec,"ORDF",diff*caus.sgn(s_ordf));
 | 
			
		||||
    update_balance(magrec,"RIM",diff*caus.sgn(s_rim));
 | 
			
		||||
    update_balance(magrec,"SCARTI",diff*caus.sgn(s_scart));
 | 
			
		||||
    update_balance(magrec,"INCL",diff*caus.sgn(s_incl));
 | 
			
		||||
    update_balance(magrec,"ACL",diff*caus.sgn(s_acl));
 | 
			
		||||
    update_balance(magrec,"PRODCOMP",diff*caus.sgn(s_prodc));
 | 
			
		||||
    update_balance(magrec,"PRODFIN",diff*caus.sgn(s_prodf));
 | 
			
		||||
    update_balance(magrec,"NLABEL",diff*caus.sgn(s_label));
 | 
			
		||||
    update_balance(magrec,"USER1",diff*caus.sgn(s_user1));
 | 
			
		||||
    update_balance(magrec,"USER2",diff*caus.sgn(s_user2));
 | 
			
		||||
    update_balance(magrec,"USER3",diff*caus.sgn(s_user3));
 | 
			
		||||
    update_balance(magrec,"USER4",diff*caus.sgn(s_user4));
 | 
			
		||||
    update_balance(magrec,"USER5",diff*caus.sgn(s_user5));
 | 
			
		||||
    update_balance(magrec,"USER6",diff*caus.sgn(s_user6));
 | 
			
		||||
  diff=((real)rett_sign) * l.quant() * fc;
 | 
			
		||||
  diff_val= ((real)rett_sign) * l.quant() * l.prezzo();
 | 
			
		||||
  if (caus.update_qta())
 | 
			
		||||
  {
 | 
			
		||||
    update_balance(magrec,"GIAC",diff* (real)caus.sgn(s_giac)); // update ..
 | 
			
		||||
    update_balance(magrec,"ACQ",diff* (real)caus.sgn(s_acq)); // update ..
 | 
			
		||||
    update_balance(magrec,"ENT",diff* (real)caus.sgn(s_ent));
 | 
			
		||||
    update_balance(magrec,"VEN",diff* (real)caus.sgn(s_ven));
 | 
			
		||||
    update_balance(magrec,"USC",diff* (real)caus.sgn(s_usc));
 | 
			
		||||
    update_balance(magrec,"ORDC",diff* (real)caus.sgn(s_ordc));
 | 
			
		||||
    update_balance(magrec,"ORDF",diff* (real)caus.sgn(s_ordf));
 | 
			
		||||
    update_balance(magrec,"RIM",diff* (real)caus.sgn(s_rim));
 | 
			
		||||
    update_balance(magrec,"SCARTI",diff* (real)caus.sgn(s_scart));
 | 
			
		||||
    update_balance(magrec,"INCL",diff* (real)caus.sgn(s_incl));
 | 
			
		||||
    update_balance(magrec,"ACL",diff* (real)caus.sgn(s_acl));
 | 
			
		||||
    update_balance(magrec,"PRODCOMP",diff* (real)caus.sgn(s_prodc));
 | 
			
		||||
    update_balance(magrec,"PRODFIN",diff* (real)caus.sgn(s_prodf));
 | 
			
		||||
    update_balance(magrec,"NLABEL",diff* (real)caus.sgn(s_label));
 | 
			
		||||
    update_balance(magrec,"USER1",diff* (real)caus.sgn(s_user1));
 | 
			
		||||
    update_balance(magrec,"USER2",diff* (real)caus.sgn(s_user2));
 | 
			
		||||
    update_balance(magrec,"USER3",diff* (real)caus.sgn(s_user3));
 | 
			
		||||
    update_balance(magrec,"USER4",diff* (real)caus.sgn(s_user4));
 | 
			
		||||
    update_balance(magrec,"USER5",diff* (real)caus.sgn(s_user5));
 | 
			
		||||
    update_balance(magrec,"USER6",diff* (real)caus.sgn(s_user6));
 | 
			
		||||
  }
 | 
			
		||||
  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,"VALVEN",diff_val*caus.sgn(s_ven));
 | 
			
		||||
    update_balance(magrec,"VALUSC",diff_val*caus.sgn(s_usc));
 | 
			
		||||
    update_balance(magrec,"VALORDC",diff_val*caus.sgn(s_ordc));
 | 
			
		||||
    update_balance(magrec,"VALORDF",diff_val*caus.sgn(s_ordf));
 | 
			
		||||
    update_balance(magrec,"VALRIM",diff_val*caus.sgn(s_rim));
 | 
			
		||||
    update_balance(magrec,"VALSCARTI",diff_val*caus.sgn(s_scart));
 | 
			
		||||
    update_balance(magrec,"USERVAL1",diff*caus.sgn(s_user1));
 | 
			
		||||
    update_balance(magrec,"USERVAL2",diff*caus.sgn(s_user2));
 | 
			
		||||
    update_balance(magrec,"USERVAL3",diff*caus.sgn(s_user3));
 | 
			
		||||
    update_balance(magrec,"USERVAL4",diff*caus.sgn(s_user4));
 | 
			
		||||
    update_balance(magrec,"USERVAL5",diff*caus.sgn(s_user5));
 | 
			
		||||
    update_balance(magrec,"USERVAL6",diff*caus.sgn(s_user6));
 | 
			
		||||
  if (caus.update_val())
 | 
			
		||||
  {
 | 
			
		||||
    update_balance(magrec,"VALACQ",diff_val* (real)caus.sgn(s_acq)); // update ..
 | 
			
		||||
    update_balance(magrec,"VALENT",diff_val* (real)caus.sgn(s_ent));
 | 
			
		||||
    update_balance(magrec,"VALVEN",diff_val* (real)caus.sgn(s_ven));
 | 
			
		||||
    update_balance(magrec,"VALUSC",diff_val* (real)caus.sgn(s_usc));
 | 
			
		||||
    update_balance(magrec,"VALORDC",diff_val* (real)caus.sgn(s_ordc));
 | 
			
		||||
    update_balance(magrec,"VALORDF",diff_val* (real)caus.sgn(s_ordf));
 | 
			
		||||
    update_balance(magrec,"VALRIM",diff_val* (real)caus.sgn(s_rim));
 | 
			
		||||
    update_balance(magrec,"VALSCARTI",diff_val* (real)caus.sgn(s_scart));
 | 
			
		||||
    update_balance(magrec,"USERVAL1",diff* (real)caus.sgn(s_user1));
 | 
			
		||||
    update_balance(magrec,"USERVAL2",diff* (real)caus.sgn(s_user2));
 | 
			
		||||
    update_balance(magrec,"USERVAL3",diff* (real)caus.sgn(s_user3));
 | 
			
		||||
    update_balance(magrec,"USERVAL4",diff* (real)caus.sgn(s_user4));
 | 
			
		||||
    update_balance(magrec,"USERVAL5",diff* (real)caus.sgn(s_user5));
 | 
			
		||||
    update_balance(magrec,"USERVAL6",diff* (real)caus.sgn(s_user6));
 | 
			
		||||
  }
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
@ -1472,23 +1492,30 @@ int TMov_mag::codice_esercizio(TDate &d)
 | 
			
		||||
bool rebuild_balances(const TString16 annoes/*, bool reset_giac*/)
 | 
			
		||||
{
 | 
			
		||||
  TArray used_files;
 | 
			
		||||
 | 
			
		||||
  used_files.add(new TLocalisamfile(LF_RMOVMAG),LF_RMOVMAG);
 | 
			
		||||
  used_files.add(new TLocalisamfile(LF_MOVMAG),LF_MOVMAG);
 | 
			
		||||
  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
 | 
			
		||||
  TRelation rel(LF_MOVMAG);
 | 
			
		||||
 | 
			
		||||
  rel.lfile().set_curr(m_m);
 | 
			
		||||
 | 
			
		||||
  int ok=TRUE;
 | 
			
		||||
  TLocalisamfile mag(LF_MAG);
 | 
			
		||||
 | 
			
		||||
  // Il flag di reset delle giacenze viene impostato in base alla chiusura dell'esercizio
 | 
			
		||||
  // precedente
 | 
			
		||||
  // Aggiorna il cazzillo per caricare eventuali date di chiusura e altre amenita' simili
 | 
			
		||||
  _esercizi.update();
 | 
			
		||||
 | 
			
		||||
  const int pred_es = _esercizi.pred(atoi(annoes));
 | 
			
		||||
  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)
 | 
			
		||||
    mag.put("ANNOES",annoes);
 | 
			
		||||
    mag.read(_isgteq);
 | 
			
		||||
@ -1525,7 +1552,9 @@ bool rebuild_balances(const TString16 annoes/*, bool reset_giac*/)
 | 
			
		||||
          mag.next();
 | 
			
		||||
        }
 | 
			
		||||
        articolo.unlock();
 | 
			
		||||
      } else {
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        ok=FALSE;
 | 
			
		||||
        mag.next();
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@ -51,14 +51,14 @@ STRING FLD_TABRFA_S7 2
 | 
			
		||||
    DISPLAY "U.M. "          CODTAB
 | 
			
		||||
    DISPLAY "Descrizione@50" S0
 | 
			
		||||
    OUTPUT FLD_TABRFA_S7 CODTAB
 | 
			
		||||
  	CHECKTYPE NORMAL
 | 
			
		||||
    CHECKTYPE NORMAL
 | 
			
		||||
    WARNING "Unita' di misura errata"
 | 
			
		||||
  END
 | 
			
		||||
 | 
			
		||||
STRING FLD_TABRFA_S8 2
 | 
			
		||||
  BEGIN
 | 
			
		||||
    PROMPT 2 9  "Classe fiscale   "
 | 
			
		||||
		FLAGS "U"
 | 
			
		||||
    FLAGS "U"
 | 
			
		||||
    FIELD S8
 | 
			
		||||
    USE ASF
 | 
			
		||||
    INPUT CODTAB FLD_TABRFA_S8
 | 
			
		||||
@ -76,7 +76,7 @@ STRING FLD_DESCFA 50
 | 
			
		||||
    INPUT S0 FLD_DESCFA
 | 
			
		||||
    DISPLAY "Descrizione@50" S0
 | 
			
		||||
    DISPLAY "Cl. Fisc." CODTAB
 | 
			
		||||
		COPY OUTPUT  FLD_TABRFA_S8
 | 
			
		||||
    COPY OUTPUT  FLD_TABRFA_S8
 | 
			
		||||
    CHECKTYPE NORMAL
 | 
			
		||||
  END
 | 
			
		||||
 | 
			
		||||
@ -148,7 +148,7 @@ NUMBER F_CONTOV 3
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT  25 14 ""
 | 
			
		||||
  FIELD I4
 | 
			
		||||
  USE LF_PCON SELECT INDBIL=="4"
 | 
			
		||||
  USE LF_PCON SELECT  (CONTO!="") && (SOTTOCONTO=="")
 | 
			
		||||
  INPUT GRUPPO      F_GRUPPOV
 | 
			
		||||
  INPUT CONTO       F_CONTOV
 | 
			
		||||
  DISPLAY "Gruppo" GRUPPO
 | 
			
		||||
@ -165,7 +165,7 @@ NUMBER F_SOTTOCV 6
 | 
			
		||||
BEGIN
 | 
			
		||||
   PROMPT  33 14 ""
 | 
			
		||||
   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
 | 
			
		||||
   INPUT GRUPPO F_GRUPPOV
 | 
			
		||||
   INPUT CONTO  F_CONTOV
 | 
			
		||||
@ -187,7 +187,7 @@ STRING F_DESCRV 50
 | 
			
		||||
BEGIN
 | 
			
		||||
   PROMPT  19 15 ""
 | 
			
		||||
   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
 | 
			
		||||
   INPUT DESCR F_DESCRV
 | 
			
		||||
   DISPLAY "Descrizione@50" DESCR
 | 
			
		||||
@ -210,7 +210,7 @@ NUMBER F_CONTOA 3
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT  25 16 ""
 | 
			
		||||
  FIELD I1
 | 
			
		||||
  USE LF_PCON SELECT INDBIL=="3"
 | 
			
		||||
  USE LF_PCON SELECT  (CONTO!="") && (SOTTOCONTO=="")
 | 
			
		||||
  INPUT GRUPPO      F_GRUPPOA
 | 
			
		||||
  INPUT CONTO       F_CONTOA
 | 
			
		||||
  DISPLAY "Gruppo" GRUPPO
 | 
			
		||||
@ -227,7 +227,7 @@ NUMBER F_SOTTOCA 6
 | 
			
		||||
BEGIN
 | 
			
		||||
   PROMPT  33 16 ""
 | 
			
		||||
   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
 | 
			
		||||
   INPUT GRUPPO F_GRUPPOA SELECT
 | 
			
		||||
   INPUT CONTO  F_CONTOA  SELECT
 | 
			
		||||
@ -249,7 +249,7 @@ STRING F_DESCRA 50
 | 
			
		||||
BEGIN
 | 
			
		||||
   PROMPT  19 17 ""
 | 
			
		||||
   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
 | 
			
		||||
   INPUT DESCR F_DESCRA
 | 
			
		||||
   DISPLAY "Descrizione@50" DESCR
 | 
			
		||||
 | 
			
		||||
@ -180,7 +180,7 @@ NUMBER F_CONTOV 3
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 22 15 ""
 | 
			
		||||
  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 CONTO       F_CONTOV
 | 
			
		||||
  DISPLAY "Gruppo" GRUPPO
 | 
			
		||||
@ -197,7 +197,7 @@ NUMBER F_SOTTOV 6
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 30 15 ""
 | 
			
		||||
  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
 | 
			
		||||
  INPUT GRUPPO      F_GRUPPOV
 | 
			
		||||
  INPUT CONTO       F_CONTOV
 | 
			
		||||
@ -219,7 +219,7 @@ STRING F_DESCRCONTOV 50
 | 
			
		||||
BEGIN
 | 
			
		||||
 PROMPT 17 16 ""
 | 
			
		||||
  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
 | 
			
		||||
  INPUT DESCR F_DESCRCONTOV
 | 
			
		||||
  DISPLAY "Descrizione@50" DESCR
 | 
			
		||||
@ -243,7 +243,7 @@ NUMBER F_CONTOA 3
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 22 17 ""
 | 
			
		||||
  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 CONTO       F_CONTOA
 | 
			
		||||
  DISPLAY "Gruppo" GRUPPO
 | 
			
		||||
@ -260,7 +260,7 @@ NUMBER F_SOTTOA 6
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 30 17 ""
 | 
			
		||||
  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
 | 
			
		||||
  INPUT GRUPPO      F_GRUPPOA
 | 
			
		||||
  INPUT CONTO       F_CONTOA
 | 
			
		||||
@ -282,7 +282,7 @@ STRING F_DESCRCONTOA 50
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 17 18 ""
 | 
			
		||||
  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
 | 
			
		||||
  INPUT DESCR F_DESCRCONTOA
 | 
			
		||||
  DISPLAY "Descrizione@50" DESCR
 | 
			
		||||
 | 
			
		||||
@ -1093,7 +1093,7 @@ FIELDNAME=CODVETT1
 | 
			
		||||
MSKID=F_CODVETT1
 | 
			
		||||
TYPE=T_STRINGA
 | 
			
		||||
PROMPT="Vettore 1' "
 | 
			
		||||
SIZE=5
 | 
			
		||||
SIZE=6
 | 
			
		||||
FLAG=ZU
 | 
			
		||||
USE=%VET
 | 
			
		||||
INPUT=CODTAB F_CODVETT1
 | 
			
		||||
@ -1125,7 +1125,7 @@ FIELDNAME=CODVETT2
 | 
			
		||||
MSKID=F_CODVETT2
 | 
			
		||||
TYPE=T_STRINGA
 | 
			
		||||
PROMPT="Vettore 2' "
 | 
			
		||||
SIZE=5
 | 
			
		||||
SIZE=6
 | 
			
		||||
FLAG=ZU
 | 
			
		||||
USE=%VET
 | 
			
		||||
INPUT=CODTAB F_CODVETT2
 | 
			
		||||
@ -1157,7 +1157,7 @@ FIELDNAME=CODVETT3
 | 
			
		||||
MSKID=F_CODVETT3
 | 
			
		||||
TYPE=T_STRINGA
 | 
			
		||||
PROMPT="Vettore 3' "
 | 
			
		||||
SIZE=5
 | 
			
		||||
SIZE=6
 | 
			
		||||
FLAG=ZU
 | 
			
		||||
USE=%VET
 | 
			
		||||
INPUT=CODTAB F_CODVETT3
 | 
			
		||||
 | 
			
		||||
@ -627,12 +627,16 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  // reperisce l'ultimo numero di registrazione disponibile
 | 
			
		||||
  mov.last();
 | 
			
		||||
  const long numreg = mov.get_int(MOV_NUMREG) + 1;
 | 
			
		||||
  if (mov.status() != NOERR || numreg < 1)
 | 
			
		||||
  long numreg = 1L;
 | 
			
		||||
  if (!mov.empty())
 | 
			
		||||
  {
 | 
			
		||||
    _error = nr_reg_error;
 | 
			
		||||
    return _error;
 | 
			
		||||
    mov.last();
 | 
			
		||||
    numreg = mov.get_long(MOV_NUMREG) + 1L;
 | 
			
		||||
    if (mov.status() != NOERR || numreg < 1)
 | 
			
		||||
    {
 | 
			
		||||
      _error = nr_reg_error;
 | 
			
		||||
      return _error;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  TCodice_numerazione cod_num(doc.numerazione());
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user