Files correlati : ve6.exe Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 979 git-svn-id: svn://10.65.10.50/trunk@15623 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			117 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| // Applicazione generica di stampa riepiloghi SC|SF|SG|SH|SP|SQ|SL/SK
 | |
| // Invocazione astrale:
 | |
| 
 | |
| // 772mod -5 [SC|SF|SG|SH|SP|SQ|SL/SK]
 | |
| 
 | |
| #include <applicat.h>
 | |
| #include <form.h>
 | |
| #include <printer.h>
 | |
| 
 | |
| #include "77lib.h"
 | |
| #include "77sr.h"
 | |
| 
 | |
| class TStampa_riepilogo : public TSkeleton_application
 | |
| { 
 | |
|   TForm   *_frm;
 | |
|   TMask   *_msk;
 | |
|   TString _titolo;
 | |
|   TString16
 | |
|           _riepilogo; 
 | |
|   long    _currfirm; // Ditta corrente
 | |
|   int     _curryear; // Anno corrente
 | |
| 
 | |
| protected:
 | |
|   virtual bool create();
 | |
|   virtual bool destroy();
 | |
|   virtual void main_loop();
 | |
| public:
 | |
|   const TString& titolo() const { return _titolo; }
 | |
|   TStampa_riepilogo(const char* riepilogo);
 | |
|   virtual ~TStampa_riepilogo() {};
 | |
| };
 | |
| 
 | |
| TStampa_riepilogo::TStampa_riepilogo(const char * riepilogo)
 | |
| {
 | |
|   _titolo = "Stampa riepilogo ";
 | |
|   _riepilogo = riepilogo;
 | |
|   _titolo << _riepilogo;
 | |
| }
 | |
| 
 | |
| bool TStampa_riepilogo::create()
 | |
| {
 | |
|   TString form_name;
 | |
|   form_name << "77sr" << _riepilogo;
 | |
|   form_name.lower();
 | |
| 
 | |
|   _frm = new TForm(form_name); // fatal_box automaGico se il form non esiste...
 | |
|   _msk = new TMask("77sr");    // La maschera est unica.
 | |
|   _msk->set_caption(titolo());
 | |
| 
 | |
|   {
 | |
|     TConfig conf(CONFIG_USER, "77");
 | |
|     _currfirm  = conf.get_long(DITTA_770);
 | |
|   }
 | |
|   {
 | |
|     TConfig conf(CONFIG_STUDIO, "77");
 | |
|     _curryear  = conf.get_int(ANNO_SEL);
 | |
|   }
 | |
|   _msk->set(F_CODICE,_currfirm);
 | |
|   _msk->set(F_ANNO,_curryear);
 | |
|   TLocalisamfile& ditte = _frm->cursor()->file(LF_NDITTE);
 | |
|   ditte.put("CODDITTA",_currfirm);
 | |
|   _msk->set(F_RAGIONE,ditte.read() == NOERR ? ditte.get("RAGSOC") : "Ditta inesistente");
 | |
|   return TSkeleton_application::create();
 | |
| }
 | |
| 
 | |
| bool TStampa_riepilogo::destroy()
 | |
| {
 | |
|   delete _msk;
 | |
|   delete _frm;
 | |
|   return TApplication::destroy();
 | |
| }
 | |
| 
 | |
| void TStampa_riepilogo::main_loop()
 | |
| {
 | |
|   while (_msk->run() != K_QUIT) // Visualizza la maschera ebbasta
 | |
|   {
 | |
|     // Setta il filtro del cursore sulla ditta
 | |
|     //                       
 | |
|     TCursor *cur = _frm->cursor();
 | |
|     TRectype from(cur->curr());
 | |
|     from.zero();
 | |
|     from.put("CODDITTA",_currfirm);
 | |
|     if (_riepilogo == "SL/SK")
 | |
|       from.put("QLAP", _curryear); // E' necessario filtrare anche l'anno !?
 | |
|     cur->setregion(from, from);
 | |
|     
 | |
|     if (cur->items() > 0)
 | |
|     {
 | |
|       const int hh = 6;
 | |
|       const int fl = printer().formlen();
 | |
|       int rows[4];
 | |
|       rows[0] = hh-3;
 | |
|       rows[1] = hh;
 | |
|       rows[2] = fl-1;
 | |
|       rows[3] = 0;
 | |
|       _frm->genera_intestazioni(odd_page, hh-2);
 | |
|       _frm->genera_fincatura(odd_page, hh-3, fl-1, rows);
 | |
| 
 | |
|       _frm->print();
 | |
|     }
 | |
|   }
 | |
| }
 | |
| 
 | |
| int stampa_riepilogo(int argc, char* argv[])
 | |
| { 
 | |
|   // Bzz:
 | |
|   // Di default sulla linea di comando passa il riepilogo SC
 | |
|   // anche se non viene passato niun parametro.
 | |
|   
 | |
|   TStampa_riepilogo*  app = new TStampa_riepilogo(argc > 2 ? argv[2] : "SC");
 | |
|   
 | |
|   app->run(argc, argv, app->titolo());
 | |
|   delete app;
 | |
|   return 0;
 | |
| }
 | |
| 
 |