Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 848 git-svn-id: svn://10.65.10.50/trunk@14993 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			141 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			141 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <automask.h>
 | |
| #include <confapp.h>
 | |
| #include <defmask.h>
 | |
| #include <reprint.h>
 | |
| 
 | |
| #include "vd1.h"
 | |
| #include "vd1100.h"
 | |
| 
 | |
| 
 | |
| ////////////////
 | |
| //	MASCHERA
 | |
| ////////////////
 | |
| class TPrint_today_cashflow_mask : public TAutomask
 | |
| {
 | |
| 
 | |
| protected:
 | |
|   virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | |
| 
 | |
| public:
 | |
|   TPrint_today_cashflow_mask();
 | |
|   virtual ~TPrint_today_cashflow_mask();
 | |
| };
 | |
| 
 | |
| TPrint_today_cashflow_mask::TPrint_today_cashflow_mask()
 | |
|             : TAutomask("vd1100")	//NON si puo' chiamare vd1100a perche' in tal caso la...
 | |
| 																	//..maschera scatta 2 volte (scatta anche quella omonima del report)
 | |
| {
 | |
| }
 | |
| 
 | |
| TPrint_today_cashflow_mask::~TPrint_today_cashflow_mask() {}             
 | |
| 
 | |
| bool TPrint_today_cashflow_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | |
| {
 | |
| 	const int id = o.dlg();
 | |
| 	switch (id)
 | |
| 	{
 | |
| 		case F_CODCASSA:
 | |
| 			if (e == fe_init)
 | |
| 			{
 | |
| 				TConfig conf(CONFIG_WST);
 | |
| 				TString cassa = conf.get("NCASSA");
 | |
| 				o.set(cassa);
 | |
| 				o.check(STARTING_CHECK);
 | |
| 			}
 | |
| 			break;
 | |
| 		default:
 | |
| 			break;
 | |
| 	}
 | |
|   return true;
 | |
| }
 | |
| 
 | |
| 
 | |
| ////////////////////////////////////////////////////////
 | |
| //	REPORT
 | |
| ////////////////////////////////////////////////////////
 | |
| class TPrint_today_cashflow_rep : public TReport
 | |
| {
 | |
| 	TString_array _tipincasso;
 | |
| 
 | |
| protected:
 | |
| 	virtual bool get_usr_val(const TString& name, TVariant& var) const;
 | |
| 	virtual bool use_mask() {return false;}
 | |
| 
 | |
| public:
 | |
| 	TPrint_today_cashflow_rep::TPrint_today_cashflow_rep();
 | |
| };
 | |
| 
 | |
| 
 | |
| TPrint_today_cashflow_rep::TPrint_today_cashflow_rep()
 | |
| {
 | |
| 	TConfig conf(CONFIG_DITTA, "vd");
 | |
| 	for (int i = 1;; i++)
 | |
| 	{
 | |
| 		const TString& lab = conf.get("LABPAG", NULL, i);
 | |
| 		if (lab.empty())
 | |
| 			break;
 | |
| 		_tipincasso.add(lab, i);
 | |
| 	}
 | |
| }
 | |
| 
 | |
| 
 | |
| bool TPrint_today_cashflow_rep::get_usr_val(const TString& name, TVariant& var) const
 | |
| {
 | |
| 	if (name.starts_with("#LABINC0"))
 | |
| 	{
 | |
| 		const int i = name[8] - '0';	//indicatore del tipo di incasso
 | |
| 		//cerca il corrispondente label di incasso nell'array con le labels	
 | |
| 		const TString* label = (const TString*)_tipincasso.objptr(i);
 | |
| 		if (label != NULL)			
 | |
| 			var = *label;
 | |
| 		return true;
 | |
| 	}
 | |
| 	return TReport::get_usr_val(name, var);
 | |
| }
 | |
| 
 | |
| 
 | |
| ///////////////////////////////
 | |
| //	APPLICAZIONE
 | |
| ///////////////////////////////
 | |
| 
 | |
| class TPrint_today_cashflow : public TSkeleton_application  
 | |
| {
 | |
| 
 | |
| protected:
 | |
|   virtual void main_loop();
 | |
|   virtual bool create();
 | |
| 
 | |
| };
 | |
| 
 | |
| void TPrint_today_cashflow::main_loop()
 | |
| {
 | |
| 	TPrint_today_cashflow_mask mask;
 | |
|   while (mask.run() == K_ENTER)
 | |
|   {
 | |
| 	  TReport_book book;
 | |
| 		TString path = mask.get(F_REPORT);
 | |
| 		if (path.empty())
 | |
| 			path = "vd1100a";
 | |
| 		TPrint_today_cashflow_rep rep;
 | |
| 		rep.load(path);
 | |
| 
 | |
| 		rep.mask2report(mask);
 | |
| 		book.add(rep);
 | |
| 		book.print_or_preview();
 | |
| 	}
 | |
| }
 | |
| 
 | |
| bool TPrint_today_cashflow::create()
 | |
| {
 | |
| 	return TSkeleton_application:: create();
 | |
| }
 | |
| 
 | |
| 
 | |
| int vd1100(int argc, char* argv[])
 | |
| {
 | |
|   TPrint_today_cashflow a;
 | |
|   a.run(argc, argv, "Lettura cassa giornaliera");
 | |
|   return 0;
 | |
| }
 |