Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 3.2 patch 1262 git-svn-id: svn://10.65.10.50/trunk@17639 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			117 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <doc.h>
 | |
| #include <mask.h>
 | |
| #include <postman.h>
 | |
| #include <progind.h>
 | |
| #include <relation.h>
 | |
| 
 | |
| #include "ve5200.h"
 | |
| #include "velib.h"
 | |
| 
 | |
| class TStatus_mask : public TMask
 | |
| {
 | |
| public:
 | |
|   TStatus_mask() : TMask("ve5200") { }
 | |
|   virtual ~TStatus_mask() { }
 | |
| };
 | |
| 
 | |
| 
 | |
| class TStatus_change : public TSkeleton_application
 | |
| {
 | |
| 
 | |
| 	virtual const char * extra_modules() const {return "dt";}
 | |
| 
 | |
| protected: // TSkeleton_application
 | |
|   virtual void main_loop();
 | |
|   virtual bool create();
 | |
| 
 | |
| public:
 | |
|   TStatus_change() { }
 | |
|   virtual ~TStatus_change() { }
 | |
| };
 | |
| 
 | |
| bool TStatus_change::create()
 | |
| {
 | |
|   open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN, LF_DOC, LF_RIGHEDOC, 
 | |
|              LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CESS, 
 | |
|              LF_CAUSALI, LF_RCAUSALI, 0);
 | |
|   return TSkeleton_application::create();
 | |
| }
 | |
| 
 | |
| void TStatus_change::main_loop()
 | |
| {
 | |
|   TStatus_mask m;
 | |
|   while (m.run() == K_ENTER)
 | |
|   {
 | |
|     TRelation rel(LF_DOC);
 | |
|     m.autosave(rel);
 | |
|     
 | |
|     TRectype recini(rel.curr());
 | |
|     TRectype recfin(rel.curr());
 | |
| 
 | |
|     recini.put(DOC_NDOC, m.get(F_DANUMERO));
 | |
|     recfin.put(DOC_NDOC, m.get(F_ANUMERO));
 | |
|     
 | |
|     TString filter; 
 | |
|     filter << DOC_STATO << "==\"" << m.get(F_INIZIALE) << "\"";
 | |
| 
 | |
|     TCursor cur(&rel, filter, 1, &recini, &recfin);
 | |
|     const long total = cur.items();
 | |
|     if (total > 0)
 | |
|     {
 | |
|       TString msg = "Confermare l'aggiornamento di ";
 | |
|       msg.add_plural(total, "documento");
 | |
|       if (yesno_box(msg))
 | |
|       {
 | |
|         TProgind pi(total, "Elaborazione in corso...", TRUE, TRUE, 60);
 | |
|         const TString& finale = m.get(F_FINALE);
 | |
|         TDocumento* doc = new TDocumento;
 | |
|         rel.lfile().set_curr(doc);
 | |
|         cur.freeze();
 | |
|         for (cur = 0; cur.pos() < total && !pi.iscancelled(); ++cur)
 | |
|         {      
 | |
|           pi.addstatus(1);
 | |
|           doc->put(DOC_STATO, finale);
 | |
|           doc->rewrite();
 | |
|           
 | |
|           // Invia anche la transazione se necessario
 | |
|           if (::can_dispatch_transaction(*doc))
 | |
|           {
 | |
|             TFilename tmpname; tmpname.temp();
 | |
|             { // Parentesi strategiche
 | |
|               TConfig ini(tmpname, "Transaction");
 | |
|               ini.set("Action", "MODIFY");
 | |
|               ini.set("Firm", get_firm());
 | |
|               ini.set("Mode", "A");            
 | |
|               TString8 paradoc; paradoc.format("%d", LF_DOC);
 | |
|               ini.set_paragraph(paradoc);
 | |
|               ini.set(DOC_PROVV, doc->get(DOC_PROVV));    
 | |
|               ini.set(DOC_ANNO, doc->get(DOC_ANNO));    
 | |
|               ini.set(DOC_CODNUM, doc->get(DOC_CODNUM));    
 | |
|               ini.set(DOC_NDOC, doc->get(DOC_NDOC));    
 | |
|               ini.set(DOC_STATO, finale);    
 | |
|             }
 | |
|             ::dispatch_transaction(*doc, tmpname); 
 | |
|             ::remove(tmpname);
 | |
|           }
 | |
|         }
 | |
| 
 | |
|         // Forza l'aggiornamento dell'indice del cursore
 | |
|         TEdit_field& ef = m.efield(F_DANUMERO);
 | |
|         TCursor* cur = ef.browse()->cursor();
 | |
|         filter = cur->filter();
 | |
|         cur->setfilter("");
 | |
|         cur->setfilter(filter);
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| }
 | |
| 
 | |
| int ve5200(int argc, char* argv[])
 | |
| {
 | |
|   TStatus_change a;
 | |
|   a.run(argc, argv, "Aggiornamento stato");
 | |
|   return 0;
 | |
| }
 | |
| 
 |