primanota eccola qua pero' quel sorgente la' io non so cosa ci fa (risulta che ho modificato TUTTI i cg6* che io non ho neppure mai visto) git-svn-id: svn://10.65.10.50/trunk@2245 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			968 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			968 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include "cglib04.h"
 | 
						|
#include "cg6901.h"
 | 
						|
 | 
						|
HIDDEN inline TLista_archivi& app() { return (TLista_archivi&)main_app();}
 | 
						|
 | 
						|
bool TLista_archivi::create()
 | 
						|
{
 | 
						|
  _ditte   = new TLocalisamfile (LF_NDITTE);
 | 
						|
  _caus    = new TLocalisamfile (LF_CAUSALI);
 | 
						|
  _rcaus   = new TLocalisamfile (LF_RCAUSALI);
 | 
						|
  _clifo   = new TLocalisamfile (LF_CLIFO);
 | 
						|
  _pcon    = new TLocalisamfile (LF_PCON);
 | 
						|
  _mov     = new TLocalisamfile (LF_MOV);
 | 
						|
  _rmov    = new TLocalisamfile (LF_RMOV);
 | 
						|
  _rmoviva = new TLocalisamfile (LF_RMOVIVA);      
 | 
						|
  
 | 
						|
  _errore_grave = FALSE;
 | 
						|
  _risposta     = 0;
 | 
						|
 | 
						|
  TMailbox m;
 | 
						|
  TMessage* msg = m.next_s("");
 | 
						|
  TString subj;
 | 
						|
     
 | 
						|
  if (msg != NULL)
 | 
						|
  {
 | 
						|
    subj = msg->body();
 | 
						|
    _datalimite = subj;
 | 
						|
  }
 | 
						|
  
 | 
						|
  dispatch_e_menu (BAR_ITEM(1));
 | 
						|
    
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TLista_archivi::destroy()
 | 
						|
{            
 | 
						|
  printer().close();
 | 
						|
  
 | 
						|
  if (_risposta == 1)                  
 | 
						|
    message_box("Rilevati errori gravi durante il controllo archivi: \n trasferimento interrotto");
 | 
						|
                    
 | 
						|
  TString appname = "cg6 -8 S";
 | 
						|
  TString body    = "";
 | 
						|
  
 | 
						|
  body << _risposta;
 | 
						|
  
 | 
						|
  TMessage msg (appname,"",(const char*)body);
 | 
						|
  TMailbox mb;
 | 
						|
  mb.send(msg);
 | 
						|
  
 | 
						|
  delete _ditte; 
 | 
						|
  delete _caus;
 | 
						|
  delete _rcaus;
 | 
						|
  delete _clifo; 
 | 
						|
  delete _pcon;    
 | 
						|
  delete _mov;
 | 
						|
  delete _rmov;
 | 
						|
  delete _rmoviva;
 | 
						|
  
 | 
						|
  return TApplication::destroy();  
 | 
						|
}                                
 | 
						|
 | 
						|
bool TLista_archivi::tabella_ditta()
 | 
						|
{
 | 
						|
  TTable ind ("%IND");
 | 
						|
  TString dep;
 | 
						|
  
 | 
						|
  dep.format("%05d", _ditta);
 | 
						|
  
 | 
						|
  ind.zero();
 | 
						|
  ind.put("CODTAB", dep);
 | 
						|
  if (ind.read() == NOERR) 
 | 
						|
  {
 | 
						|
    _files = "";
 | 
						|
    if (ind.get_bool("B0"))
 | 
						|
      _files << "W";
 | 
						|
    
 | 
						|
    if (ind.get_bool("B1"))
 | 
						|
      _files << "A";
 | 
						|
    
 | 
						|
    if (ind.get_bool("B2"))
 | 
						|
      _files << "P";        
 | 
						|
    
 | 
						|
    if (ind.get_bool("B3"))
 | 
						|
      _files << "Z";
 | 
						|
    
 | 
						|
    if (ind.get_bool("B4"))
 | 
						|
      _files << "U";
 | 
						|
    
 | 
						|
    if (ind.get_bool("B5"))
 | 
						|
      _files << "B";
 | 
						|
    
 | 
						|
    return TRUE;
 | 
						|
  }  
 | 
						|
  
 | 
						|
  return FALSE;  
 | 
						|
}
 | 
						|
                   
 | 
						|
bool TLista_archivi::set()
 | 
						|
{
 | 
						|
//****************************************
 | 
						|
//****** Apro la finestra di stampa ******
 | 
						|
//****************************************
 | 
						|
 | 
						|
  printer().set_printtype(winprinter);
 | 
						|
  
 | 
						|
  if (!(printer().isopen ()))
 | 
						|
    if (!printer().open ())
 | 
						|
      return FALSE;
 | 
						|
 | 
						|
//****************************************
 | 
						|
 | 
						|
  _ditta = get_firm();
 | 
						|
  
 | 
						|
  _ditte->zero();
 | 
						|
  _ditte->put(NDT_CODDITTA, _ditta);   
 | 
						|
  if (_ditte->read() == NOERR) 
 | 
						|
    _ragsoc = _ditte->get(NDT_RAGSOC);
 | 
						|
  
 | 
						|
  if (!tabella_ditta()) return FALSE;
 | 
						|
  
 | 
						|
  if (_files.find('W') != -1)
 | 
						|
    controlla_causali('W');
 | 
						|
 | 
						|
  if (_files.find('A') != -1)
 | 
						|
    controlla_clifo('A');
 | 
						|
 | 
						|
  if (_files.find('P') != -1)
 | 
						|
    controlla_pcon('P');
 | 
						|
 | 
						|
  if (_files.find('Z') != -1)
 | 
						|
    controlla_PNIVA('Z');
 | 
						|
 | 
						|
  if (_files.find('B') != -1)
 | 
						|
    controlla_fatture('B');
 | 
						|
    
 | 
						|
  return FALSE;
 | 
						|
}
 | 
						|
     
 | 
						|
bool TLista_archivi::controlla_valore(const TString& val,int lim)
 | 
						|
{
 | 
						|
  if (real::is_natural(val))
 | 
						|
  {
 | 
						|
    int app = atoi(val);
 | 
						|
    if (app > lim)
 | 
						|
      return FALSE;
 | 
						|
  }
 | 
						|
  else
 | 
						|
    if (val.len() > 1)
 | 
						|
      return FALSE;
 | 
						|
  
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
     
 | 
						|
void TLista_archivi::controlla_causali(char file)
 | 
						|
{   
 | 
						|
  TPrintrow row;
 | 
						|
  TString   str;
 | 
						|
  bool      errore  = FALSE;
 | 
						|
  bool      salto   = FALSE;
 | 
						|
  bool      intesta = TRUE;
 | 
						|
  TString_array stampa(50); 
 | 
						|
  int       num;
 | 
						|
  
 | 
						|
  _caus->setkey(1);
 | 
						|
  _caus->zero();
 | 
						|
  
 | 
						|
  for (_caus->first(); !_caus->eof(); _caus->next())
 | 
						|
  {
 | 
						|
    const char* codcau = _caus->get(CAU_CODCAUS);
 | 
						|
    TString codcaus = codcau;
 | 
						|
    if (codcau && *codcau && !real::is_natural(codcau) )
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato codice causale alfanumerico"); 
 | 
						|
    }
 | 
						|
    
 | 
						|
    TString reg = _caus->get(CAU_REG);
 | 
						|
    if (!controlla_valore(reg,9))
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato registro IVA con lunghezza superiore a 1");
 | 
						|
    }
 | 
						|
    
 | 
						|
    const char* codcausim = _caus->get(CAU_CODCAUSIM);
 | 
						|
    if (codcausim && *codcausim && !real::is_natural(codcausim) )
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato codice causale per incasso immediato alfanumerico");
 | 
						|
    }
 | 
						|
 | 
						|
    num = 0;
 | 
						|
    
 | 
						|
    _rcaus->setkey(1);
 | 
						|
    _rcaus->zero();
 | 
						|
    _rcaus->put(RCA_CODCAUS, codcaus);
 | 
						|
    
 | 
						|
    TRectype rcau (_rcaus->curr());
 | 
						|
    
 | 
						|
    for (_rcaus->read(); !_rcaus->eof(); _rcaus->next())
 | 
						|
    {                
 | 
						|
      bool tit_riga = FALSE;
 | 
						|
      
 | 
						|
      if (_rcaus->curr() > rcau) break;
 | 
						|
      
 | 
						|
      num++;
 | 
						|
     
 | 
						|
      if (num > 15)
 | 
						|
      {
 | 
						|
        errore = TRUE;
 | 
						|
        stampa.add("  - Rilevata causale con numero righe superiore a 15");
 | 
						|
      }
 | 
						|
 
 | 
						|
      int     g   = _rcaus->get_int (RCA_GRUPPO);
 | 
						|
      int     c   = _rcaus->get_int (RCA_CONTO);  
 | 
						|
      int     nr  = _rcaus->get_int (RCA_NRIGA);
 | 
						|
        
 | 
						|
      if (g > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;
 | 
						|
        app.format("%9s%03d", (const char*)"@b  - Riga ", nr);
 | 
						|
        app << " " << "@rRilevato un gruppo composto da 3 cifre";
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      if (c > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;     
 | 
						|
        if (tit_riga)
 | 
						|
          app << "             Rilevato un conto  composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {  
 | 
						|
          app.format("%9s%03d", (const char*)"@b  - Riga ", nr);
 | 
						|
          app << " " << "@rRilevato un conto  composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
      }
 | 
						|
    }
 | 
						|
      
 | 
						|
    if (errore)
 | 
						|
    {                      
 | 
						|
      if (intesta)
 | 
						|
      {
 | 
						|
        setta_intestazione(file);
 | 
						|
        intesta = FALSE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      TString app;
 | 
						|
      app << "@b- Codice causale  " << codcaus;
 | 
						|
      row.put(app,0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      
 | 
						|
      long items = stampa.items();
 | 
						|
    
 | 
						|
      for (int i = 0; i < items; i++)
 | 
						|
      {
 | 
						|
        str = stampa.row(i);
 | 
						|
        row.put(str,0);
 | 
						|
        printer().print(row);
 | 
						|
        row.reset();
 | 
						|
      }
 | 
						|
 | 
						|
      row.put(" ",0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      
 | 
						|
      errore = FALSE;      
 | 
						|
      salto  = TRUE;           
 | 
						|
      _risposta = 1;
 | 
						|
    }
 | 
						|
    stampa.destroy();
 | 
						|
  } 
 | 
						|
  if (salto)
 | 
						|
    printer().formfeed();
 | 
						|
}
 | 
						|
 | 
						|
void TLista_archivi::controlla_clifo(char file)
 | 
						|
{
 | 
						|
  TPrintrow row;
 | 
						|
  TString   str;
 | 
						|
  bool      errore  = FALSE;
 | 
						|
  bool      salto   = FALSE;
 | 
						|
  bool      intesta = TRUE;
 | 
						|
  TString_array stampa(10);
 | 
						|
  
 | 
						|
  _clifo->setkey(1);
 | 
						|
  _clifo->zero();
 | 
						|
  
 | 
						|
  for (_clifo->first(); !_clifo->eof(); _clifo->next())
 | 
						|
  { 
 | 
						|
    str = "";
 | 
						|
       
 | 
						|
    char tipo   = _clifo->get_char(CLI_TIPOCF);
 | 
						|
    long codice = _clifo->get_long(CLI_CODCF);
 | 
						|
    
 | 
						|
    TString paiv = _clifo->get(CLI_PAIV);
 | 
						|
    if (paiv.len() > 11)   
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevata partita IVA con piu' di 11 caratteri");
 | 
						|
    }
 | 
						|
    
 | 
						|
/*    TString ptel = _clifo->get(CLI_PTEL);
 | 
						|
    TString tel  = _clifo->get(CLI_TEL);
 | 
						|
    TString appoggio;
 | 
						|
    appoggio << ptel << " " << tel;   
 | 
						|
    if (appoggio.len() > 12)
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato numero telefonico troppo lungo");
 | 
						|
    }
 | 
						|
*/    
 | 
						|
    int gruppo = _clifo->get_int(CLI_GRUPPORIC);
 | 
						|
    int conto  = _clifo->get_int(CLI_CONTORIC);
 | 
						|
    
 | 
						|
    if (gruppo > 99)
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato gruppo costo/ricavo composto da 3 cifre");
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (conto > 99)
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato conto costo/ricavo composto da 3 cifre");
 | 
						|
    }
 | 
						|
    
 | 
						|
    TString codpag = _clifo->get(CLI_CODPAG);
 | 
						|
    if (!controlla_valore(codpag,99))
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato un codice di pagamento composto da 3 o piu' cifre");
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (errore)
 | 
						|
    {          
 | 
						|
      TString app;
 | 
						|
      
 | 
						|
      if (intesta)
 | 
						|
      {
 | 
						|
        setta_intestazione(file);
 | 
						|
        intesta = FALSE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      str << "@b- Codice  ";
 | 
						|
      app.format("%c %06ld", tipo, codice);
 | 
						|
      str << app;
 | 
						|
        
 | 
						|
      row.put(str,0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      str = "";
 | 
						|
      
 | 
						|
      long items = stampa.items();
 | 
						|
    
 | 
						|
      for (int i = 0; i < items; i++)
 | 
						|
      {
 | 
						|
        str = stampa.row(i);
 | 
						|
        row.put(str,0);
 | 
						|
        printer().print(row);
 | 
						|
        row.reset();
 | 
						|
      }
 | 
						|
 | 
						|
      row.put(" ",0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      
 | 
						|
      errore = FALSE;
 | 
						|
      salto  = TRUE;
 | 
						|
      _risposta = 1;
 | 
						|
    }
 | 
						|
    stampa.destroy();
 | 
						|
  } 
 | 
						|
  if (salto)                   
 | 
						|
    printer().formfeed();
 | 
						|
}
 | 
						|
 | 
						|
void TLista_archivi::controlla_pcon(char file)
 | 
						|
{
 | 
						|
  TPrintrow row;
 | 
						|
  TString   str;
 | 
						|
  bool      errore  = FALSE;
 | 
						|
  bool      salto   = FALSE;
 | 
						|
  bool      intesta = TRUE;
 | 
						|
  TString_array stampa(10);
 | 
						|
  
 | 
						|
  _pcon->setkey(1);
 | 
						|
  _pcon->zero();
 | 
						|
  
 | 
						|
  for (_pcon->first(); !_pcon->eof(); _pcon->next())
 | 
						|
  { 
 | 
						|
    str = "";
 | 
						|
       
 | 
						|
    int  gruppo = _pcon->get_int (PCN_GRUPPO);
 | 
						|
    int  conto  = _pcon->get_int (PCN_CONTO);
 | 
						|
    long sottoc = _pcon->get_long(PCN_SOTTOCONTO);
 | 
						|
    
 | 
						|
    if (gruppo > 99)   
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato un gruppo composto da 3 cifre");
 | 
						|
    }                                                    
 | 
						|
    
 | 
						|
    if (conto > 99)
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato un conto  composto da 3 cifre");
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (errore)
 | 
						|
    {          
 | 
						|
      TString app;
 | 
						|
                           
 | 
						|
      if (intesta)
 | 
						|
      {
 | 
						|
        setta_intestazione(file);
 | 
						|
        intesta = FALSE;
 | 
						|
      }
 | 
						|
                           
 | 
						|
      str << "@b- Conto  ";
 | 
						|
      app.format("%3d %3d %6ld", gruppo, conto, sottoc);
 | 
						|
      str << app;
 | 
						|
        
 | 
						|
      row.put(str,0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      str = "";
 | 
						|
      
 | 
						|
      long items = stampa.items();
 | 
						|
    
 | 
						|
      for (int i = 0; i < items; i++)
 | 
						|
      {
 | 
						|
        str = stampa.row(i);
 | 
						|
        row.put(str,0);
 | 
						|
        printer().print(row);
 | 
						|
        row.reset();
 | 
						|
      }
 | 
						|
 | 
						|
      row.put(" ",0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      
 | 
						|
      errore = FALSE;
 | 
						|
      salto  = TRUE;
 | 
						|
      _risposta = 1;
 | 
						|
    }              
 | 
						|
    stampa.destroy();
 | 
						|
  }           
 | 
						|
  if (salto)
 | 
						|
    printer().formfeed();
 | 
						|
}
 | 
						|
                                   
 | 
						|
void TLista_archivi::controlla_PNIVA(char file)
 | 
						|
{
 | 
						|
  TPrintrow row;
 | 
						|
  TString   str;
 | 
						|
  bool      errore   = FALSE;
 | 
						|
  bool      salto    = FALSE;
 | 
						|
  bool      intesta  = TRUE; 
 | 
						|
  bool      tit_riga = FALSE;
 | 
						|
  TString_array stampa(50); 
 | 
						|
  int       num;
 | 
						|
  long      nreg_p = 0;
 | 
						|
  
 | 
						|
  _mov->setkey(1);
 | 
						|
  _mov->zero();
 | 
						|
  
 | 
						|
  for (_mov->first(); !_mov->eof(); _mov->next())
 | 
						|
  {
 | 
						|
    bool soliva = TRUE;
 | 
						|
    
 | 
						|
    long  nreg    = _mov->get_long(MOV_NUMREG);
 | 
						|
    TDate datareg = _mov->get_date(MOV_DATAREG);
 | 
						|
    bool  inviato = _mov->get_bool(MOV_INVIATO);
 | 
						|
    bool  inviva  = _mov->get_bool(MOV_INVIVA);
 | 
						|
 | 
						|
    if (inviato && inviva) continue; //Se il movimento e' gia' stato inviato non lo posso piu' inviare
 | 
						|
                                     //cosi' come le sue righe di primanota e iva
 | 
						|
                                     
 | 
						|
    if (datareg > _datalimite) continue;
 | 
						|
    
 | 
						|
    if (nreg > 999999)
 | 
						|
    { 
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato un numero di registrazione composto da 7");
 | 
						|
    }
 | 
						|
 | 
						|
    TString reg = _mov->get(MOV_REG);
 | 
						|
    if (!controlla_valore(reg,9))
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato un codice registro IVA composto da 2 o piu' cifre");
 | 
						|
    }
 | 
						|
    
 | 
						|
    const char* codcaus = _mov->get(MOV_CODCAUS);
 | 
						|
    if (codcaus && *codcaus)
 | 
						|
      if (!real::is_natural(codcaus))
 | 
						|
      {
 | 
						|
        errore = TRUE;
 | 
						|
        stampa.add("  - Rilevato un codice causale alfanumerico");
 | 
						|
      }
 | 
						|
    
 | 
						|
    TString codpag = _mov->get(MOV_CODPAG);
 | 
						|
    if (!controlla_valore(codpag,99))
 | 
						|
    {
 | 
						|
      errore = TRUE;
 | 
						|
      stampa.add("  - Rilevato un codice di pagamento composto da 3 o piu' cifre");
 | 
						|
    }    
 | 
						|
 | 
						|
    num = 0;
 | 
						|
 | 
						|
    bool prima = TRUE;
 | 
						|
    
 | 
						|
    _rmov->setkey(1);
 | 
						|
    _rmov->zero();
 | 
						|
    _rmov->put(RMV_NUMREG, nreg);
 | 
						|
    
 | 
						|
    TRectype rmov (_rmov->curr());
 | 
						|
    
 | 
						|
    for (_rmov->read(); !_rmov->eof(); _rmov->next())
 | 
						|
    {
 | 
						|
      
 | 
						|
      if (_rmov->curr() > rmov) break;
 | 
						|
      
 | 
						|
      tit_riga = FALSE;      
 | 
						|
        
 | 
						|
      soliva = FALSE;
 | 
						|
      
 | 
						|
      num++;
 | 
						|
     
 | 
						|
      if (num > 99)
 | 
						|
      {
 | 
						|
        errore = TRUE;
 | 
						|
        stampa.add("  - Rilevato movimento di Primanota con numero righe superiore a 99");
 | 
						|
      }
 | 
						|
 | 
						|
      int     nr  = _rmov->get_int (RMV_NUMRIG);
 | 
						|
      int     g   = _rmov->get_int (RMV_GRUPPO);
 | 
						|
      int     c   = _rmov->get_int (RMV_CONTO);  
 | 
						|
      int     gc  = _rmov->get_int (RMV_GRUPPOC);
 | 
						|
      int     cc  = _rmov->get_int (RMV_CONTOC);
 | 
						|
 | 
						|
      if (nr > 99)
 | 
						|
      { 
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;                  
 | 
						|
        app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
        app << " " << "@rRilevato numero di riga con piu' di due cifre";
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
      
 | 
						|
      if (g > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;    
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un gruppo di partita composto da 3 cifre";
 | 
						|
        else
 | 
						|
        { 
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un gruppo di partita composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      if (c > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;     
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un conto  di partita composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {  
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un conto  di partita composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
      }
 | 
						|
      
 | 
						|
      if (gc > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;    
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un gruppo di contropartita composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {            
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un gruppo di contropartita composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      if (cc > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;     
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un conto  di contropartita composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {                  
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un conto  di contropartita composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
      }      
 | 
						|
    }
 | 
						|
 | 
						|
    if (soliva)
 | 
						|
    {  
 | 
						|
      TLocalisamfile rcaus (LF_RCAUSALI);
 | 
						|
      int g = 0;
 | 
						|
      int c = 0;
 | 
						|
      bool tit_riga = FALSE;  
 | 
						|
      bool prima    = TRUE;           
 | 
						|
      int nr = 1;
 | 
						|
      
 | 
						|
      rcaus.setkey(1);
 | 
						|
      rcaus.zero();
 | 
						|
      rcaus.put(RCA_CODCAUS, codcaus);
 | 
						|
      rcaus.read();
 | 
						|
      TString codcau = rcaus.get(RCA_CODCAUS);
 | 
						|
      if (codcau == codcaus)
 | 
						|
      {
 | 
						|
        g = rcaus.get_int (RCA_GRUPPO);
 | 
						|
        c = rcaus.get_int (RCA_CONTO);
 | 
						|
      }            
 | 
						|
 | 
						|
  
 | 
						|
      if (g > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;    
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un gruppo di partita composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {                                           
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un gruppo di partita composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      if (c > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;     
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe primanota"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un conto  di partita composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {           
 | 
						|
          app.format("5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un conto  di partita composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
      }    
 | 
						|
    }
 | 
						|
          
 | 
						|
    num = 0;
 | 
						|
    
 | 
						|
    if (_files.find('U') != -1)
 | 
						|
    { 
 | 
						|
    nreg_p = 0;
 | 
						|
    _rmoviva->setkey(1);
 | 
						|
    _rmoviva->zero();
 | 
						|
    _rmoviva->put(RMI_NUMREG, nreg);
 | 
						|
    
 | 
						|
    TRectype rmoviva (_rmoviva->curr());
 | 
						|
    
 | 
						|
    prima = TRUE;
 | 
						|
    
 | 
						|
    for (_rmoviva->read(); !_rmoviva->eof(); _rmoviva->next())
 | 
						|
    {                
 | 
						|
      if (_rmoviva->curr() > rmoviva) break;
 | 
						|
 | 
						|
      num++;
 | 
						|
     
 | 
						|
      if (num > 9)
 | 
						|
      {
 | 
						|
        errore = TRUE;
 | 
						|
        stampa.add("  - Rilevato movimento Iva con numero righe superiore a 9");
 | 
						|
      }
 | 
						|
 | 
						|
      int     nr  = _rmoviva->get_int (RMI_NUMRIG);
 | 
						|
      int     g   = _rmoviva->get_int (RMI_GRUPPO);
 | 
						|
      int     c   = _rmoviva->get_int (RMI_CONTO);
 | 
						|
 | 
						|
      if (nr > 99)
 | 
						|
      {
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;   
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe iva"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
        app << " " << "@rRilevato numero di riga con piu' di due cifre";
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
      
 | 
						|
      if (g > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;    
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe iva"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un gruppo composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {            
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un gruppo composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
        
 | 
						|
      if (c > 99)
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;     
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe iva"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un conto  composto da 3 cifre";
 | 
						|
        else
 | 
						|
        {                                           
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un conto  composto da 3 cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
      }
 | 
						|
      const char* ci  = _rmoviva->get     (RMI_CODIVA);
 | 
						|
      if ( ci && *ci && !real::is_natural(ci) )
 | 
						|
      {   
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;    
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe iva"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un codice IVA alfanumerico";
 | 
						|
        else
 | 
						|
        {           
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un codice IVA alfanumerico";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }                          
 | 
						|
      
 | 
						|
      if (!controlla_valore(ci,99))
 | 
						|
      {
 | 
						|
        errore = TRUE;
 | 
						|
        TString app;    
 | 
						|
        if (prima)
 | 
						|
        {
 | 
						|
          stampa.add(" ");             
 | 
						|
          stampa.add("Righe iva"); 
 | 
						|
          stampa.add(" ");
 | 
						|
          prima = FALSE;
 | 
						|
        }
 | 
						|
        if (tit_riga)
 | 
						|
          app << "@r        Rilevato un codice IVA composto da 3 o piu' cifre";
 | 
						|
        else
 | 
						|
        {                                           
 | 
						|
          app.format("%5s%03d", (const char*)"@b  - ", nr);
 | 
						|
          app << " " << "@rRilevato un codice IVA composto da 3 o piu' cifre";
 | 
						|
        }
 | 
						|
        stampa.add(app);
 | 
						|
        tit_riga = TRUE;
 | 
						|
      }
 | 
						|
    }
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (errore)
 | 
						|
    {          
 | 
						|
      TString app; 
 | 
						|
 | 
						|
      if (intesta)
 | 
						|
      {
 | 
						|
        setta_intestazione(file);
 | 
						|
        intesta = FALSE;
 | 
						|
      }
 | 
						|
      
 | 
						|
      app << "@b- Registrazione numero  " << nreg;
 | 
						|
      row.put(app,0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      
 | 
						|
      long items = stampa.items();
 | 
						|
    
 | 
						|
      for (int i = 0; i < items; i++)
 | 
						|
      {
 | 
						|
        str = stampa.row(i);
 | 
						|
        row.put(str,0);
 | 
						|
        printer().print(row);
 | 
						|
        row.reset();
 | 
						|
      }
 | 
						|
 | 
						|
      row.put(" ",0);
 | 
						|
      printer().print(row);
 | 
						|
      row.reset();
 | 
						|
      
 | 
						|
      errore = FALSE;
 | 
						|
      salto  = TRUE;
 | 
						|
      _risposta = 1;
 | 
						|
    }
 | 
						|
    stampa.destroy();
 | 
						|
  } 
 | 
						|
  if (salto)
 | 
						|
    printer().formfeed(); 
 | 
						|
}                                
 | 
						|
 | 
						|
void TLista_archivi::controlla_fatture(char file)
 | 
						|
{
 | 
						|
 | 
						|
}
 | 
						|
                                   
 | 
						|
void TLista_archivi::setta_intestazione(char sigla)
 | 
						|
{ 
 | 
						|
  TPrintrow row;
 | 
						|
  TString sep(132);
 | 
						|
  TString titolo;
 | 
						|
 | 
						|
  switch (sigla)
 | 
						|
  {
 | 
						|
    case 'W':
 | 
						|
    titolo = "Tabella Causali";
 | 
						|
    break;
 | 
						|
    
 | 
						|
    case 'A':
 | 
						|
    titolo = "Anagrafica Clienti/Fornitori";
 | 
						|
    break;
 | 
						|
    
 | 
						|
    case 'P':
 | 
						|
    titolo = "Anagrafica Piano dei Conti";
 | 
						|
    break;
 | 
						|
    
 | 
						|
    case 'Z':
 | 
						|
    titolo = "Movimenti";
 | 
						|
    break;
 | 
						|
    
 | 
						|
    default:
 | 
						|
    break;
 | 
						|
  }       
 | 
						|
  
 | 
						|
  printer().resetheader();
 | 
						|
  
 | 
						|
  sep << "Ditta  " << _ditta;
 | 
						|
  sep << " " << _ragsoc;
 | 
						|
  sep.left_just(132);
 | 
						|
  
 | 
						|
  row.put(sep,0);
 | 
						|
  printer().setheaderline(1,row);
 | 
						|
  row.reset();
 | 
						|
  
 | 
						|
  sep = "";
 | 
						|
  sep << "Data @< Pag. @#";
 | 
						|
  sep.right_just(127);
 | 
						|
  sep.overwrite ("LISTA DI CONTROLLO ARCHIVI IN TRASFERIMENTO");
 | 
						|
  row.put(sep,0);
 | 
						|
  printer().setheaderline(2,row);
 | 
						|
  row.reset();
 | 
						|
 | 
						|
  sep = "";
 | 
						|
  sep.fill('-');
 | 
						|
  row.put(sep,0);      
 | 
						|
  printer().setheaderline(3,row);
 | 
						|
  row.reset();
 | 
						|
  
 | 
						|
  row.put(titolo,0);   
 | 
						|
  printer().setheaderline(4,row);
 | 
						|
  row.reset();
 | 
						|
  
 | 
						|
  sep = "";
 | 
						|
  sep.fill('-');
 | 
						|
  row.put(sep,0);      
 | 
						|
  printer().setheaderline(5,row);
 | 
						|
  row.reset();
 | 
						|
  
 | 
						|
  row.put(" ",0);      
 | 
						|
  printer().setheaderline(6,row);
 | 
						|
  row.reset();
 | 
						|
}
 | 
						|
                   
 | 
						|
bool TLista_archivi::menu(MENU_TAG m)
 | 
						|
{
 | 
						|
  if (m == BAR_ITEM(1))
 | 
						|
    return set(); 
 | 
						|
  return FALSE;
 | 
						|
}
 |