Files correlati : nessuno Ricompilazione Demo : [ ] Commento : Riportata la versione aga 07.150 sul main trunk git-svn-id: svn://10.65.10.50/trunk@9871 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			165 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			165 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <automask.h>
 | |
| #include <execp.h>
 | |
| #include <progind.h>
 | |
| #include <relation.h>
 | |
| 
 | |
| #include "baeur.h"
 | |
| #include "../mg/mglib.h"
 | |
| #include "../cg/cglib01.h"
 | |
| 
 | |
| #include <doc.h>
 | |
| #include <rdoc.h>
 | |
| 
 | |
| ///////////////////////////////////////////////////////////
 | |
| // Main app
 | |
| ///////////////////////////////////////////////////////////
 | |
| 
 | |
| class TEuro05_app : public TEuro_app
 | |
| { 
 | |
| protected:
 | |
|   virtual void main_loop();
 | |
|   void convert_last_mag_eser(int eser);
 | |
|   void convert_last_sto_eser(int eser);
 | |
| 
 | |
| public:
 | |
| };
 | |
| 
 | |
| inline TEuro05_app& app() { return (TEuro05_app&)main_app(); }
 | |
| 
 | |
| ///////////////////////////////////////////////////////////
 | |
| // Main 
 | |
| ///////////////////////////////////////////////////////////
 | |
| 
 | |
| void TEuro05_app::convert_last_mag_eser(int eser)
 | |
| {  
 | |
|   // Cursore su file in lire
 | |
|   TRelation rel(LF_MAG);
 | |
|   TCursor cur(&rel);
 | |
|   TRectype& curr = rel.curr();
 | |
|   
 | |
|   curr.put("ANNOES", eser);
 | |
|   
 | |
|   cur.setregion(curr, curr);
 | |
|   
 | |
| //  zap_file(lf, TRUE); // Azzera file in euro
 | |
| 
 | |
|   // File destinazione in euro
 | |
|   TEuroisamfile fileur(LF_MAG, TRUE);
 | |
|   TRectype& receur = fileur.curr();
 | |
|   
 | |
|   receur.put("ANNOES", eser);
 | |
|   
 | |
|   for (fileur.read(_isgteq); fileur.good() && eser == fileur.get_int("ANNOES");  fileur.next())
 | |
|     fileur.remove();
 | |
| 
 | |
|   TString str;
 | |
|   str << "Conversione " << rel.lfile().description() << " anno " << eser << " ... ";
 | |
|   
 | |
|   
 | |
|   const long items = cur.items();
 | |
|   cur.freeze();
 | |
|   TProgind pi(items, str, FALSE, TRUE);
 | |
|   TString fields;
 | |
| 
 | |
|   fields << "VALRIM|VALACQ|VALENT|VALVEN|VALUSC|VALORDF|VALORDF|SCARTI|VALSCARTI|";
 | |
|   fields << "USERVAL1|USERVAL2|USERVAL3|USERVAL4|USERVAL5|USERVAL6";
 | |
| 
 | |
|   for (cur = 0L; cur.pos() < items; ++cur)
 | |
|   {     
 | |
|     pi.addstatus(1);
 | |
|     receur = curr;
 | |
|     convert_import(receur, fields);
 | |
|     zero_import(receur, "ORDC|VALORDC|ORDF|VALORDF");
 | |
|     fileur.write();
 | |
|   }
 | |
| }
 | |
| 
 | |
| void TEuro05_app::convert_last_sto_eser(int eser)
 | |
| {  
 | |
|   // Cursore su file in lire
 | |
|   TRelation rel(LF_STOMAG);
 | |
|   TCursor cur(&rel);
 | |
|   TRectype& curr = rel.curr();
 | |
|   
 | |
|   curr.put("ANNOESRIF", eser);
 | |
|   
 | |
|   cur.setregion(curr, curr);
 | |
|   
 | |
| //  zap_file(lf, TRUE); // Azzera file in euro
 | |
| 
 | |
|   // File destinazione in euro
 | |
|   TEuroisamfile fileur(LF_STOMAG, TRUE);
 | |
|   TRectype& receur = fileur.curr();
 | |
|   
 | |
|   receur.put("ANNOESRIF", eser);
 | |
|   
 | |
|   for (fileur.read(_isgteq); fileur.good() && eser == fileur.get_int("ANNOESRIF");  fileur.next())
 | |
|     fileur.remove();
 | |
| 
 | |
|   TString str;
 | |
|   str << "Conversione " << rel.lfile().description() << " anno " << eser << " ... ";
 | |
|   
 | |
|   
 | |
|   const long items = cur.items();
 | |
|   cur.freeze();
 | |
|   TProgind pi(items, str, FALSE, TRUE);
 | |
|   const char* prices = "VALORE|ULTCOS1|ULTCOS2|COSTSTD|COSTOMEDIO|PRZLIST";
 | |
| 
 | |
|   for (cur = 0L; cur.pos() < items; ++cur)
 | |
|   {     
 | |
|     pi.addstatus(1);
 | |
|     receur = curr;
 | |
|     convert_import(receur, prices, TRUE);
 | |
|     fileur.write();
 | |
|   }
 | |
| }
 | |
| 
 | |
| void TEuro05_app::main_loop()
 | |
| {                
 | |
|   goto_lire();
 | |
|   if (!set_firm())
 | |
|     return;
 | |
|   const long firm = get_firm();  
 | |
|   if (!dbf_exists(LF_MAG, TRUE))
 | |
|   {
 | |
|     error_box("Non esistono gli archivi della ditta %ld nell'area in Euro", firm);
 | |
|     return; 
 | |
|   }
 | |
| 
 | |
|   TDate apertura(1,1,2002);
 | |
|   TFilename dati, datie;
 | |
|   get_aree_dati(dati, datie);
 | |
|   
 | |
|   TString8 ditta; 
 | |
|   ditta.format("%05ldA", firm);
 | |
|   
 | |
|   TFilename inie = datie;
 | |
|   inie.add(ditta);
 | |
|   inie.add("prassid.ini");
 | |
|   
 | |
|   bool adotta = FALSE, inizio = FALSE;
 | |
|   if (inie.exist())
 | |
|     adotta = data_adozione_euro(firm, apertura, inizio);
 | |
|   TEsercizi_contabili esc;
 | |
|   
 | |
|   const int annoes = esc.date2prevesc(apertura);
 | |
|   
 | |
|   convert_last_mag_eser(annoes);
 | |
|   convert_last_sto_eser(annoes);
 | |
| 
 | |
|   {
 | |
|     TExternal_app app("baeur -6 A");
 | |
|     
 | |
|     app.run(FALSE, 3);
 | |
|   }
 | |
| }
 | |
| 
 | |
| int baeur05(int argc, char* argv[])
 | |
| {  
 | |
|   TEuro05_app ma;
 | |
|   ma.run(argc, argv, "Apertura magazzino");
 | |
|   
 | |
|   return 0;
 | |
| }
 |