169 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			169 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//********************************
 | 
						|
//* Aggiornamento Tipo Attivita' *
 | 
						|
//********************************
 | 
						|
#include <applicat.h> 
 | 
						|
#include <mask.h>
 | 
						|
#include <relation.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include <progind.h>
 | 
						|
 | 
						|
#include <mov.h>  
 | 
						|
#include <rmoviva.h>
 | 
						|
 | 
						|
#include "cg1.h"  
 | 
						|
#include "cg1301.h"
 | 
						|
#include "cg1302.h" 
 | 
						|
#include "cg1303.h" 
 | 
						|
#include "cg1304.h"
 | 
						|
#include "cg1305.h"
 | 
						|
#include "cg1306.h"
 | 
						|
#include "cg1307.h"
 | 
						|
#include "cg1308.h"
 | 
						|
#include "cglib01.h"
 | 
						|
 | 
						|
class TAgg_attiv : public TSkeleton_application
 | 
						|
{
 | 
						|
  TLocalisamfile*  _pcon,* _attiv;
 | 
						|
  TTable*          _reg;
 | 
						|
  
 | 
						|
protected:        
 | 
						|
  virtual bool create();
 | 
						|
  virtual bool destroy();
 | 
						|
  virtual void main_loop();
 | 
						|
  
 | 
						|
public:        
 | 
						|
  void elabora_mov();
 | 
						|
};                                      
 | 
						|
 | 
						|
// HIDDEN TAgg_attiv& app() { return (TAgg_attiv&)main_app(); }
 | 
						|
 | 
						|
bool TAgg_attiv::create()
 | 
						|
{
 | 
						|
  _pcon    = new TLocalisamfile(LF_PCON);
 | 
						|
  _attiv   = new TLocalisamfile(LF_ATTIV);
 | 
						|
  _reg     = new TTable("REG");
 | 
						|
  
 | 
						|
  return TSkeleton_application::create();
 | 
						|
}
 | 
						|
 | 
						|
bool TAgg_attiv::destroy()
 | 
						|
{ 
 | 
						|
  delete _pcon;
 | 
						|
  delete _attiv;  
 | 
						|
  delete _reg;
 | 
						|
  
 | 
						|
  return TSkeleton_application::destroy();
 | 
						|
}                                
 | 
						|
 | 
						|
void TAgg_attiv::main_loop()
 | 
						|
{
 | 
						|
  TMask msk("cg1300a");
 | 
						|
  while (msk.run() == K_ENTER) 
 | 
						|
  {
 | 
						|
    elabora_mov();
 | 
						|
    message_box(TR("Aggiornamento completato"));
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
void TAgg_attiv::elabora_mov()
 | 
						|
{
 | 
						|
  TRelation rel (LF_MOV);
 | 
						|
  rel.add(LF_RMOVIVA, "NUMREG=NUMREG",1);
 | 
						|
  TCursor cursor(&rel,"",1);
 | 
						|
  
 | 
						|
  TLocalisamfile& mov = rel.lfile();
 | 
						|
  TLocalisamfile& rmoviva = rel.lfile(LF_RMOVIVA);
 | 
						|
  
 | 
						|
//-  long ditta = get_firm();
 | 
						|
  cursor = 0L;
 | 
						|
  const long nitems = cursor.items();
 | 
						|
  
 | 
						|
  TProgind p(nitems ? nitems : 1, TR("Aggiornamento in corso...") , TRUE, TRUE, 70);
 | 
						|
 | 
						|
  for (; cursor.pos() < cursor.items(); ++cursor)
 | 
						|
  {
 | 
						|
    p.addstatus(1);
 | 
						|
    const TString16 reg(mov.get(MOV_REG));
 | 
						|
    if (reg.empty()) continue;
 | 
						|
    
 | 
						|
    const int annoiva = mov.get_int(MOV_ANNOIVA);
 | 
						|
    TRegistro registro(reg, annoiva);
 | 
						|
    const bool att_mista = registro.attivita_mista();
 | 
						|
    
 | 
						|
    if (att_mista)
 | 
						|
    {   
 | 
						|
      bool ok = rel.is_first_match(LF_RMOVIVA);
 | 
						|
      while (ok)
 | 
						|
      {
 | 
						|
        const char tipo = rmoviva.get_char("TIPOC");
 | 
						|
        if (tipo <= ' ')               
 | 
						|
        {
 | 
						|
          TBill c(rmoviva.get_int("GRUPPO"), rmoviva.get_int("CONTO"), rmoviva.get_long("SOTTOCONTO"));
 | 
						|
          int tipoatt = c.tipo_att();
 | 
						|
          rmoviva.put("TIPOATT", tipoatt); 
 | 
						|
          rmoviva.rewrite();      
 | 
						|
        }
 | 
						|
        ok = rel.next_match(LF_RMOVIVA);  
 | 
						|
      }
 | 
						|
    }  
 | 
						|
  } 
 | 
						|
}
 | 
						|
 | 
						|
int cg1300(int argc, char* argv[])
 | 
						|
{                                
 | 
						|
  switch (toupper(*argv[2]))
 | 
						|
  {
 | 
						|
  case 'A':
 | 
						|
  {
 | 
						|
    TAgg_attiv a;      
 | 
						|
    a.run(argc, argv, TR("Aggiornamento tipo attivita' su movimenti iva"));
 | 
						|
  }
 | 
						|
  break;
 | 
						|
  case 'C':
 | 
						|
  {   
 | 
						|
    TAgg_codatt a;       
 | 
						|
    a.run(argc, argv,TR("Aggiornamento codice attivita'"));
 | 
						|
  } 
 | 
						|
  break;
 | 
						|
  case 'D':
 | 
						|
  {   
 | 
						|
    TAgg_datacomp a;       
 | 
						|
    a.run(argc, argv,TR("Aggiornamento data competenza"));
 | 
						|
  } 
 | 
						|
  break;
 | 
						|
  case 'E':
 | 
						|
  {   
 | 
						|
    TAgg_codes a;       
 | 
						|
    a.run(argc, argv,TR("Aggiornamento codice esercizio"));
 | 
						|
  } 
 | 
						|
  break;
 | 
						|
  case 'I':
 | 
						|
  {
 | 
						|
    TAgg_opintra a;
 | 
						|
    a.run(argc, argv, TR("Aggiornamento flag op. intracomunitarie"));       
 | 
						|
  }
 | 
						|
  break;
 | 
						|
  case 'P':
 | 
						|
  {   
 | 
						|
    TAgg_nprot a;       
 | 
						|
    a.run(argc, argv,TR("Rinumerazione numero di protocollo"));
 | 
						|
  } 
 | 
						|
  break;
 | 
						|
  case 'T':
 | 
						|
  {
 | 
						|
    TAgg_tconto a;                      
 | 
						|
    a.run(argc, argv, TR("Aggiornamento tipo conto"));    // cg1302   
 | 
						|
  }
 | 
						|
  break;
 | 
						|
  case 'Z':
 | 
						|
    elimina_zoppi(argc, argv);
 | 
						|
  break;
 | 
						|
  case 'M':
 | 
						|
    setta_meseliq(argc, argv);
 | 
						|
  break;
 | 
						|
  default:
 | 
						|
  break;
 | 
						|
  }
 | 
						|
  return 0;
 | 
						|
}
 |