Patch level : 12.00 1326
Files correlati : ca0.exe cg0.exe ve0.exe Inivo a CRM Chiusura commesse fino all'anno
This commit is contained in:
		
							parent
							
								
									b7f75c2be7
								
							
						
					
					
						commit
						33124b2cdb
					
				@ -15,14 +15,64 @@
 | 
				
			|||||||
////////////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
class TCms_anal_msk : public TSimple_anal_msk
 | 
					class TCms_anal_msk : public TSimple_anal_msk
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  virtual int get_logicnum() const { return LF_COMMESSE; } 
 | 
					  virtual int get_logicnum() const { return LF_COMMESSE; } 
 | 
				
			||||||
	virtual bool create_tree() const { return ca_config().get_bool("CmsTree");}
 | 
						virtual bool create_tree() const { return ca_config().get_bool("CmsTree");}
 | 
				
			||||||
 | 
						virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  TCms_anal_msk();
 | 
					  TCms_anal_msk();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TCms_anal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						switch (o.dlg())
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
						case DLG_SELECT:
 | 
				
			||||||
 | 
							if (e == fe_button)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								TMask select("Selezione anno", 1, 60, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								select.add_number(101, 0, "Fino all'anno ", 2, 1, 4, "R");
 | 
				
			||||||
 | 
								select.add_button(DLG_OK, 0, "", -12, -1, 12, 2, "", 0);
 | 
				
			||||||
 | 
								select.add_button(DLG_QUIT, 0, "", -22, -1, 12, 2, "", 0);
 | 
				
			||||||
 | 
								if (select.run() == K_ENTER)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									TString filter = "(" COMMESSE_CHIUSA "!=\"X\")&&(" COMMESSE_ANNO "<=";
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
									filter << select.get(101) << ")";
 | 
				
			||||||
 | 
									TCursor c(new TRelation(LF_COMMESSE), filter);
 | 
				
			||||||
 | 
									TRectype & curr = c.curr();
 | 
				
			||||||
 | 
									const long items = c.items();
 | 
				
			||||||
 | 
									const int fino_all_anno = select.get_int(101);
 | 
				
			||||||
 | 
									long chiuse = 0L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									for (c = 0L; c.pos() < items; ++c)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										const int anno = curr.get_int(COMMESSE_ANNO);
 | 
				
			||||||
 | 
										TDate data_chiusura = curr.get_date(COMMESSE_DATAPROR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										if (!data_chiusura.ok())
 | 
				
			||||||
 | 
											data_chiusura = curr.get_date(COMMESSE_DATAFINE);
 | 
				
			||||||
 | 
										if (data_chiusura.ok() && anno <= fino_all_anno && data_chiusura <= today)
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											curr.put(COMMESSE_CHIUSA, true);
 | 
				
			||||||
 | 
											curr.rewrite();
 | 
				
			||||||
 | 
											chiuse++;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									message_box(FR("Chiuse %ld commesse"), chiuse);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
							break;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return TSimple_anal_msk::on_field_event(o, e, jolly);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TCms_anal_msk::TCms_anal_msk()
 | 
					TCms_anal_msk::TCms_anal_msk()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  read("ca0600a");
 | 
					  read("ca0600a");
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,11 @@ TOOLBAR "topbar" 0 0 0 2
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <relapbar.h>
 | 
					#include <relapbar.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BUTTON DLG_SELECT 2 2
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  PROMPT 2 1 "~Chiudi"
 | 
				
			||||||
 | 
					  PICTURE TOOL_IMPORT
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
ENDPAGE
 | 
					ENDPAGE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PAGE "Commessa" 0 0 0 2
 | 
					PAGE "Commessa" 0 0 0 2
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user