trackercustom

mail@pastecode.io avatar
unknown
csharp
2 years ago
4.8 kB
4
Indexable
Never
// **************************************************
// Custom code for VendorForm
// Created: 3/17/2022 3:39:43 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Ice.Adapters;
using Ice.BO;
using Ice.Lib.Broadcast;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	BAQDataView baqViewDateRange;
	Ice.Lib.Framework.EpiUltraGrid dateRangeGrid;
	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls
		this.btnAddDates.Click += new System.EventHandler(this.btnAddDates_Click);
		this.ugInvRange.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ugInvRange_InitializeLayout);
		this.txtVendorID.TextChanged += new System.EventHandler(this.txtVendorID_TextChanged);
		// End Wizard Added Custom Method Calls
		CreateDateRangeBAQView();
	}
	public void CreateDateRangeBAQView()
	{
		baqViewDateRange = new BAQDataView("JBIS-SupplierListQry"); 
		oTrans.Add("JBIS-SupplierListQry",baqViewDateRange);
		string pubBinding = "VendorDetail.VendorID";
		IPublisher pub = oTrans.GetPublisher(pubBinding);
		if(pub==null){ //check if the pub exists
			oTrans.PublishColumnChange(pubBinding, "vendorNumPub");
			pub = oTrans.GetPublisher(pubBinding);
		}
		if(pub != null){
			baqViewDateRange.SubscribeToPublisher(pub.PublishName, "Vendor_VendorID"); 
		}
	}
	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal
		this.btnAddDates.Click -= new System.EventHandler(this.btnAddDates_Click);
		this.ugInvRange.InitializeLayout -= new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ugInvRange_InitializeLayout);
		this.txtVendorID.TextChanged -= new System.EventHandler(this.txtVendorID_TextChanged);
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
	private void btnAddDates_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("JBIS-SupInvLkUp");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("ConfirmSupplier", txtVendorID.Text, "nvarchar",false, Guid.NewGuid(),"A");
		qeds.ExecutionParameter.AddExecutionParameterRow("FromDate", dtStartDate.Text, "date",false, Guid.NewGuid(),"d");
		qeds.ExecutionParameter.AddExecutionParameterRow("ToDate", dtEndDate.Text, "date",false, Guid.NewGuid(),"d");
		dqa.ExecuteByID("JBIS-SupInvLkUp",qeds);
		ugInvRange.DataSource = dqa.QueryResults.Tables["Results"];
	}
	private void ugInvRange_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs args)
	{
			// ** Place Event Handling Code Here **
				args.Layout.Bands[0].Columns[3].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[4].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[7].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[10].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[11].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[12].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[27].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[40].Format = "###,###,##0.00";
				args.Layout.Bands[0].Columns[41].Format = "###,###,##0.00";
				//ugInvRange.DisplayLayout.Bands[0].Columns[4].Header.Caption = "Balance.##";
				//ugInvRange.DisplayLayout.Bands[0].Columns[5].Header.Caption = "Ammount.##";
				//ugInvRange.DisplayLayout.Bands[0].Columns[5].Header.Caption = "";
				//ugInvRange.DisplayLayout.Bands[0].Columns[6].Header.Caption = "";
				//ugInvRange.DisplayLayout.Bands[0].Columns[7].Header.Caption = "";
			    //ugInvRange.DisplayLayout.Bands[0].Columns[8].Header.Caption = "";
	}

	private void txtVendorID_TextChanged(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		if (txtVendorID.Text == "") 
		{
			ugInvRange.DataSource = null;
			
		}
	}
}