using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using GZTW.AyaNova.BLL; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using Infragistics.Win.UltraWinToolbars; using System.Text; using log4net; namespace AyaNova { /// /// Summary description for PurchaseOrderInfoForm. /// public class PurchaseOrderInfoForm : System.Windows.Forms.Form { // Create a logger for use in this class //case 1039 private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private System.Windows.Forms.CheckBox ckIsDirty; private System.Windows.Forms.ErrorProvider ErrorProvider; private Infragistics.Win.UltraWinEditors.UltraTextEditor edNotes; private System.Windows.Forms.Panel panelLeft; private System.Windows.Forms.Panel panelRight; private System.Windows.Forms.Panel panelBottom; private System.Windows.Forms.Splitter splitter1; private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager; private System.Windows.Forms.Panel panelCustom; private Infragistics.Win.UltraWinGrid.UltraGrid gridCustom; private Infragistics.Win.Misc.UltraLabel lblNotes; private Infragistics.Win.Misc.UltraLabel lblVendorMemo; private GZTW.WinForm.Controls.GZUltraComboEditor cbVendorID; private Infragistics.Win.Misc.UltraButton btnVendorID; private Infragistics.Win.UltraWinEditors.UltraTextEditor edVendorInfo; private Infragistics.Win.UltraWinEditors.UltraTextEditor edClientInfo; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderInfoForm_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderInfoForm_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderInfoForm_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom; private Infragistics.Win.Misc.UltraLabel lblOrderedDate; private GZTW.WinForm.Controls.GZDateTimePicker dtOrderedDate; private GZTW.WinForm.Controls.GZDateTimePicker dtExpectedReceiveDate; private Infragistics.Win.Misc.UltraLabel lblExpectedReceiveDate; private Infragistics.Win.UltraWinGrid.UltraGrid Grid; private Infragistics.Win.Misc.UltraButton btnClientID; private GZTW.WinForm.Controls.GZUltraComboEditor cbClientID; private Infragistics.Win.UltraWinEditors.UltraTextEditor edVendorMemo; private Infragistics.Win.Misc.UltraLabel lblStatus; private System.Windows.Forms.CheckBox ckClosed; private Infragistics.Win.Misc.UltraLabel lblReferenceNumber; private Infragistics.Win.UltraWinEditors.UltraTextEditor edReferenceNumber; private System.Windows.Forms.HelpProvider helpProvider1; private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckAllVendors; private Infragistics.Win.Misc.UltraLabel lblProjectID; private GZTW.WinForm.Controls.GZUltraComboEditor cbProjectID; private System.ComponentModel.IContainer components; public PurchaseOrderInfoForm() { // // Required for Windows Form Designer support // InitializeComponent(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("PurchaseOrderEntryMenuBar"); Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool1 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("LT:UI.Toolbar.Print"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool19 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:O.WikiPage"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Ordered"); Infragistics.Win.UltraWinToolbars.ControlContainerTool controlContainerTool1 = new Infragistics.Win.UltraWinToolbars.ControlContainerTool("LT:UI.Command.Closed"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:WorkorderItemPartRequest.Label.List"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:PurchaseOrder.Label.UI.RestockList"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew"); Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool14 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool15 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete"); Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool16 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Ordered"); Infragistics.Win.UltraWinToolbars.ControlContainerTool controlContainerTool2 = new Infragistics.Win.UltraWinToolbars.ControlContainerTool("LT:UI.Command.Closed"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool17 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:WorkorderItemPartRequest.Label.List"); Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool18 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:PurchaseOrder.Label.UI.RestockList"); Infragistics.Win.Appearance appearance13 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance14 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ListTool listTool1 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST"); Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool2 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("LT:UI.Toolbar.Print"); Infragistics.Win.Appearance appearance15 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance16 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ListTool listTool2 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool20 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:O.WikiPage"); Infragistics.Win.Appearance appearance17 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance18 = new Infragistics.Win.Appearance(); this.ckClosed = new System.Windows.Forms.CheckBox(); this.ckIsDirty = new System.Windows.Forms.CheckBox(); this.panelLeft = new System.Windows.Forms.Panel(); this.lblProjectID = new Infragistics.Win.Misc.UltraLabel(); this.cbProjectID = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.ckAllVendors = new Infragistics.Win.UltraWinEditors.UltraCheckEditor(); this.lblStatus = new Infragistics.Win.Misc.UltraLabel(); this.edVendorInfo = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.btnVendorID = new Infragistics.Win.Misc.UltraButton(); this.cbVendorID = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.cbClientID = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.edClientInfo = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.btnClientID = new Infragistics.Win.Misc.UltraButton(); this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); this.panelRight = new System.Windows.Forms.Panel(); this.edReferenceNumber = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblReferenceNumber = new Infragistics.Win.Misc.UltraLabel(); this.dtExpectedReceiveDate = new GZTW.WinForm.Controls.GZDateTimePicker(); this.lblOrderedDate = new Infragistics.Win.Misc.UltraLabel(); this.dtOrderedDate = new GZTW.WinForm.Controls.GZDateTimePicker(); this.lblExpectedReceiveDate = new Infragistics.Win.Misc.UltraLabel(); this.lblVendorMemo = new Infragistics.Win.Misc.UltraLabel(); this.edVendorMemo = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblNotes = new Infragistics.Win.Misc.UltraLabel(); this.edNotes = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.panelBottom = new System.Windows.Forms.Panel(); this.Grid = new Infragistics.Win.UltraWinGrid.UltraGrid(); this.splitter1 = new System.Windows.Forms.Splitter(); this.panelCustom = new System.Windows.Forms.Panel(); this.gridCustom = new Infragistics.Win.UltraWinGrid.UltraGrid(); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.helpProvider1 = new System.Windows.Forms.HelpProvider(); this.panelLeft.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbProjectID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ckAllVendors)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edVendorInfo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cbVendorID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cbClientID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edClientInfo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit(); this.panelRight.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edReferenceNumber)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dtExpectedReceiveDate)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dtOrderedDate)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edVendorMemo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edNotes)).BeginInit(); this.panelBottom.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Grid)).BeginInit(); this.panelCustom.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridCustom)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit(); this.SuspendLayout(); // // ckClosed // this.ckClosed.Location = new System.Drawing.Point(-12000, -11538); this.ckClosed.Name = "ckClosed"; this.ckClosed.Size = new System.Drawing.Size(212, 54); this.ckClosed.TabIndex = 4; this.ckClosed.Tag = ""; this.ckClosed.Text = "LT:UI.Command.Closed"; this.ckClosed.CheckedChanged += new System.EventHandler(this.ckClosed_CheckedChanged); // // ckIsDirty // this.ckIsDirty.Location = new System.Drawing.Point(-336, 28); this.ckIsDirty.Name = "ckIsDirty"; this.ckIsDirty.Size = new System.Drawing.Size(232, 27); this.ckIsDirty.TabIndex = 5; // // panelLeft // this.panelLeft.Controls.Add(this.lblProjectID); this.panelLeft.Controls.Add(this.cbProjectID); this.panelLeft.Controls.Add(this.ckAllVendors); this.panelLeft.Controls.Add(this.lblStatus); this.panelLeft.Controls.Add(this.edVendorInfo); this.panelLeft.Controls.Add(this.btnVendorID); this.panelLeft.Controls.Add(this.cbVendorID); this.panelLeft.Controls.Add(this.cbClientID); this.panelLeft.Controls.Add(this.edClientInfo); this.panelLeft.Controls.Add(this.btnClientID); this.panelLeft.Dock = System.Windows.Forms.DockStyle.Left; this.panelLeft.Location = new System.Drawing.Point(0, 55); this.panelLeft.Name = "panelLeft"; this.panelLeft.Size = new System.Drawing.Size(300, 307); this.panelLeft.TabIndex = 0; // // lblProjectID // this.lblProjectID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblProjectID.Location = new System.Drawing.Point(10, 314); this.lblProjectID.Name = "lblProjectID"; this.lblProjectID.Size = new System.Drawing.Size(283, 18); this.lblProjectID.TabIndex = 167; this.lblProjectID.Tag = ""; this.lblProjectID.Text = "LT:O.Project"; this.lblProjectID.WrapText = false; // // cbProjectID // this.cbProjectID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.cbProjectID.Location = new System.Drawing.Point(10, 339); this.cbProjectID.MaxDropDownItems = 25; this.cbProjectID.Name = "cbProjectID"; this.cbProjectID.Size = new System.Drawing.Size(283, 24); this.cbProjectID.TabIndex = 166; this.cbProjectID.NeedMoreData += new GZTW.WinForm.Controls.NeedMoreDataHandler(this.cbProjectID_NeedMoreData); // // ckAllVendors // this.ckAllVendors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ckAllVendors.Location = new System.Drawing.Point(10, 88); this.ckAllVendors.Name = "ckAllVendors"; this.ckAllVendors.Size = new System.Drawing.Size(283, 18); this.ckAllVendors.TabIndex = 165; this.ckAllVendors.Tag = ""; this.ckAllVendors.Text = "LT:PurchaseOrder.Label.ShowPartsAllVendors"; this.ckAllVendors.BeforeCheckStateChanged += new Infragistics.Win.CheckEditor.BeforeCheckStateChangedHandler(this.ckAllVendors_BeforeCheckStateChanged); // // lblStatus // this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblStatus.Location = new System.Drawing.Point(10, 7); this.lblStatus.Name = "lblStatus"; this.lblStatus.Size = new System.Drawing.Size(283, 21); this.lblStatus.TabIndex = 3; this.lblStatus.Tag = ""; // // edVendorInfo // this.edVendorInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edVendorInfo.Location = new System.Drawing.Point(10, 113); this.edVendorInfo.Multiline = true; this.edVendorInfo.Name = "edVendorInfo"; this.edVendorInfo.ReadOnly = true; this.edVendorInfo.Scrollbars = System.Windows.Forms.ScrollBars.Vertical; this.edVendorInfo.Size = new System.Drawing.Size(283, 65); this.edVendorInfo.TabIndex = 155; // // btnVendorID // this.btnVendorID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); appearance1.TextHAlignAsString = "Left"; this.btnVendorID.Appearance = appearance1; this.btnVendorID.ButtonStyle = Infragistics.Win.UIElementButtonStyle.PopupBorderless; this.btnVendorID.Location = new System.Drawing.Point(10, 34); this.btnVendorID.Name = "btnVendorID"; this.btnVendorID.Size = new System.Drawing.Size(283, 27); this.btnVendorID.TabIndex = 1; this.btnVendorID.Tag = ""; this.btnVendorID.Text = "LT:O.Vendor"; this.btnVendorID.UseHotTracking = Infragistics.Win.DefaultableBoolean.True; this.btnVendorID.Click += new System.EventHandler(this.btnVendorID_Click); // // cbVendorID // this.cbVendorID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.cbVendorID.Location = new System.Drawing.Point(10, 62); this.cbVendorID.Name = "cbVendorID"; this.cbVendorID.Size = new System.Drawing.Size(283, 24); this.cbVendorID.TabIndex = 0; this.cbVendorID.NeedMoreData += new GZTW.WinForm.Controls.NeedMoreDataHandler(this.cbVendorID_NeedMoreData); this.cbVendorID.SelectionChanged += new System.EventHandler(this.cbVendorID_SelectionChanged); // // cbClientID // this.cbClientID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.cbClientID.Location = new System.Drawing.Point(10, 212); this.cbClientID.Name = "cbClientID"; this.cbClientID.Size = new System.Drawing.Size(283, 24); this.cbClientID.TabIndex = 2; this.cbClientID.NeedMoreData += new GZTW.WinForm.Controls.NeedMoreDataHandler(this.cbClientID_NeedMoreData); this.cbClientID.SelectionChanged += new System.EventHandler(this.cbClientID_SelectionChanged); // // edClientInfo // this.edClientInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edClientInfo.Location = new System.Drawing.Point(10, 240); this.edClientInfo.Multiline = true; this.edClientInfo.Name = "edClientInfo"; this.edClientInfo.ReadOnly = true; this.edClientInfo.Scrollbars = System.Windows.Forms.ScrollBars.Vertical; this.edClientInfo.Size = new System.Drawing.Size(283, 63); this.edClientInfo.TabIndex = 158; // // btnClientID // this.btnClientID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); appearance2.TextHAlignAsString = "Left"; this.btnClientID.Appearance = appearance2; this.btnClientID.ButtonStyle = Infragistics.Win.UIElementButtonStyle.PopupBorderless; this.btnClientID.Location = new System.Drawing.Point(10, 185); this.btnClientID.Name = "btnClientID"; this.btnClientID.Size = new System.Drawing.Size(283, 27); this.btnClientID.TabIndex = 3; this.btnClientID.Tag = ""; this.btnClientID.Text = "LT:PurchaseOrder.Label.DropShipToClientID"; this.btnClientID.UseHotTracking = Infragistics.Win.DefaultableBoolean.True; this.btnClientID.Click += new System.EventHandler(this.btnClientID_Click); // // ErrorProvider // this.ErrorProvider.ContainerControl = this; // // panelRight // this.panelRight.Controls.Add(this.edReferenceNumber); this.panelRight.Controls.Add(this.lblReferenceNumber); this.panelRight.Controls.Add(this.dtExpectedReceiveDate); this.panelRight.Controls.Add(this.lblOrderedDate); this.panelRight.Controls.Add(this.dtOrderedDate); this.panelRight.Controls.Add(this.lblExpectedReceiveDate); this.panelRight.Controls.Add(this.lblVendorMemo); this.panelRight.Controls.Add(this.edVendorMemo); this.panelRight.Controls.Add(this.lblNotes); this.panelRight.Controls.Add(this.edNotes); this.panelRight.Controls.Add(this.ckClosed); this.panelRight.Dock = System.Windows.Forms.DockStyle.Left; this.panelRight.Location = new System.Drawing.Point(300, 55); this.panelRight.Name = "panelRight"; this.panelRight.Size = new System.Drawing.Size(308, 307); this.panelRight.TabIndex = 101; // // edReferenceNumber // this.edReferenceNumber.Location = new System.Drawing.Point(182, 96); this.edReferenceNumber.Name = "edReferenceNumber"; this.edReferenceNumber.Size = new System.Drawing.Size(116, 24); this.edReferenceNumber.TabIndex = 2; // // lblReferenceNumber // this.lblReferenceNumber.Location = new System.Drawing.Point(10, 96); this.lblReferenceNumber.Name = "lblReferenceNumber"; this.lblReferenceNumber.Size = new System.Drawing.Size(105, 18); this.lblReferenceNumber.TabIndex = 164; this.lblReferenceNumber.Tag = ""; this.lblReferenceNumber.Text = "LT:PurchaseOrder.Label.ReferenceNumber"; this.lblReferenceNumber.WrapText = false; // // dtExpectedReceiveDate // this.dtExpectedReceiveDate.GZEnabled = true; this.dtExpectedReceiveDate.GZReadOnly = false; this.dtExpectedReceiveDate.Location = new System.Drawing.Point(192, 65); this.dtExpectedReceiveDate.Name = "dtExpectedReceiveDate"; this.dtExpectedReceiveDate.Size = new System.Drawing.Size(106, 24); this.dtExpectedReceiveDate.TabIndex = 1; // // lblOrderedDate // this.lblOrderedDate.Location = new System.Drawing.Point(10, 31); this.lblOrderedDate.Name = "lblOrderedDate"; this.lblOrderedDate.Size = new System.Drawing.Size(105, 19); this.lblOrderedDate.TabIndex = 159; this.lblOrderedDate.Tag = ""; this.lblOrderedDate.Text = "LT:PurchaseOrder.Label.OrderedDate"; this.lblOrderedDate.WrapText = false; // // dtOrderedDate // this.dtOrderedDate.GZEnabled = true; this.dtOrderedDate.GZReadOnly = false; this.dtOrderedDate.Location = new System.Drawing.Point(192, 31); this.dtOrderedDate.Name = "dtOrderedDate"; this.dtOrderedDate.Size = new System.Drawing.Size(106, 24); this.dtOrderedDate.TabIndex = 0; this.dtOrderedDate.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.dtOrderedDate_EditorButtonClick); // // lblExpectedReceiveDate // this.lblExpectedReceiveDate.Location = new System.Drawing.Point(10, 65); this.lblExpectedReceiveDate.Name = "lblExpectedReceiveDate"; this.lblExpectedReceiveDate.Size = new System.Drawing.Size(105, 18); this.lblExpectedReceiveDate.TabIndex = 163; this.lblExpectedReceiveDate.Tag = ""; this.lblExpectedReceiveDate.Text = "LT:PurchaseOrder.Label.ExpectedReceiveDate"; this.lblExpectedReceiveDate.WrapText = false; // // lblVendorMemo // this.lblVendorMemo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblVendorMemo.Location = new System.Drawing.Point(10, 129); this.lblVendorMemo.Name = "lblVendorMemo"; this.lblVendorMemo.Size = new System.Drawing.Size(288, 19); this.lblVendorMemo.TabIndex = 133; this.lblVendorMemo.Tag = ""; this.lblVendorMemo.Text = "LT:PurchaseOrder.Label.VendorMemo"; // // edVendorMemo // this.edVendorMemo.AcceptsReturn = true; this.edVendorMemo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edVendorMemo.Location = new System.Drawing.Point(10, 148); this.edVendorMemo.Multiline = true; this.edVendorMemo.Name = "edVendorMemo"; this.edVendorMemo.Size = new System.Drawing.Size(288, 64); this.edVendorMemo.TabIndex = 3; // // lblNotes // this.lblNotes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblNotes.Location = new System.Drawing.Point(10, 222); this.lblNotes.Name = "lblNotes"; this.lblNotes.Size = new System.Drawing.Size(288, 18); this.lblNotes.TabIndex = 131; this.lblNotes.Tag = ""; this.lblNotes.Text = "LT:PurchaseOrder.Label.Notes"; // // edNotes // this.edNotes.AcceptsReturn = true; this.edNotes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edNotes.Location = new System.Drawing.Point(10, 240); this.edNotes.Multiline = true; this.edNotes.Name = "edNotes"; this.edNotes.Size = new System.Drawing.Size(288, 65); this.edNotes.TabIndex = 4; // // panelBottom // this.panelBottom.Controls.Add(this.Grid); this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelBottom.Location = new System.Drawing.Point(0, 372); this.panelBottom.Name = "panelBottom"; this.panelBottom.Size = new System.Drawing.Size(874, 203); this.panelBottom.TabIndex = 102; // // Grid // this.Grid.Cursor = System.Windows.Forms.Cursors.Hand; this.Grid.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TemplateOnBottom; this.Grid.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.True; this.Grid.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.True; this.Grid.Dock = System.Windows.Forms.DockStyle.Fill; this.Grid.Location = new System.Drawing.Point(0, 0); this.Grid.Name = "Grid"; this.Grid.Size = new System.Drawing.Size(874, 203); this.Grid.TabIndex = 0; this.Grid.Tag = ""; this.Grid.Text = "LT:O.PurchaseOrderItem"; this.Grid.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.Grid_AfterCellUpdate); this.Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.Grid_InitializeRow); this.Grid.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.Grid_ClickCellButton); this.Grid.BeforeRowInsert += new Infragistics.Win.UltraWinGrid.BeforeRowInsertEventHandler(this.Grid_BeforeRowInsert); this.Grid.SummaryValueChanged += new Infragistics.Win.UltraWinGrid.SummaryValueChangedEventHandler(this.Grid_SummaryValueChanged); this.Grid.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Grid_MouseDown); // // splitter1 // this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitter1.Location = new System.Drawing.Point(0, 362); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(874, 10); this.splitter1.TabIndex = 0; this.splitter1.TabStop = false; // // panelCustom // this.panelCustom.Controls.Add(this.gridCustom); this.panelCustom.Dock = System.Windows.Forms.DockStyle.Right; this.panelCustom.Location = new System.Drawing.Point(606, 55); this.panelCustom.Name = "panelCustom"; this.panelCustom.Size = new System.Drawing.Size(268, 307); this.panelCustom.TabIndex = 108; // // gridCustom // this.gridCustom.Cursor = System.Windows.Forms.Cursors.Default; this.gridCustom.Dock = System.Windows.Forms.DockStyle.Fill; this.gridCustom.Location = new System.Drawing.Point(0, 0); this.gridCustom.Name = "gridCustom"; this.gridCustom.Size = new System.Drawing.Size(268, 307); this.gridCustom.TabIndex = 0; this.gridCustom.Tag = ""; this.gridCustom.Text = "LT:ObjectCustomField.Label.CustomGrid"; this.gridCustom.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridCustom_AfterCellUpdate); // // _PurchaseOrderInfoForm_Toolbars_Dock_Area_Left // this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 55); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.Name = "_PurchaseOrderInfoForm_Toolbars_Dock_Area_Left"; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 520); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager; // // tbManager // this.tbManager.DesignerFlags = 1; this.tbManager.DockWithinContainer = this; this.tbManager.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form); this.tbManager.ShowFullMenusDelay = 500; ultraToolbar1.DockedColumn = 0; ultraToolbar1.DockedRow = 0; controlContainerTool1.ControlName = "ckClosed"; controlContainerTool1.InstanceProps.Width = 212; ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { popupMenuTool1, buttonTool1, buttonTool19, buttonTool2, buttonTool3, buttonTool4, buttonTool5, buttonTool6, controlContainerTool1, buttonTool7, buttonTool8, buttonTool9}); ultraToolbar1.Text = "PurchaseOrderEntryMenuBar"; this.tbManager.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] { ultraToolbar1}); this.tbManager.ToolbarSettings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False; this.tbManager.ToolbarSettings.AllowFloating = Infragistics.Win.DefaultableBoolean.False; this.tbManager.ToolbarSettings.AllowHiding = Infragistics.Win.DefaultableBoolean.False; buttonTool10.SharedPropsInternal.AccessibleDescription = "recorddd"; appearance3.Image = global::AyaNova.Resource1.SaveExit32; buttonTool10.SharedPropsInternal.AppearancesLarge.Appearance = appearance3; appearance4.Image = global::AyaNova.Resource1.SaveExit16; buttonTool10.SharedPropsInternal.AppearancesSmall.Appearance = appearance4; buttonTool10.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose"; appearance5.Image = global::AyaNova.Resource1.RecordHistory32; buttonTool11.SharedPropsInternal.AppearancesLarge.Appearance = appearance5; appearance6.Image = global::AyaNova.Resource1.RecordHistory16; buttonTool11.SharedPropsInternal.AppearancesSmall.Appearance = appearance6; buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory"; buttonTool12.SharedPropsInternal.Caption = "LT:UI.Command.Save"; buttonTool12.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; appearance7.Image = global::AyaNova.Resource1.SaveNew32; buttonTool13.SharedPropsInternal.AppearancesLarge.Appearance = appearance7; appearance8.Image = global::AyaNova.Resource1.SaveNew16; buttonTool13.SharedPropsInternal.AppearancesSmall.Appearance = appearance8; buttonTool13.SharedPropsInternal.Caption = "LT:UI.Command.SaveNew"; buttonTool14.SharedPropsInternal.Caption = "LT:UI.Command.Close"; buttonTool14.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; appearance9.Image = global::AyaNova.Resource1.Delete32; buttonTool15.SharedPropsInternal.AppearancesLarge.Appearance = appearance9; appearance10.Image = global::AyaNova.Resource1.Delete16; buttonTool15.SharedPropsInternal.AppearancesSmall.Appearance = appearance10; buttonTool15.SharedPropsInternal.Caption = "LT:UI.Command.Delete"; buttonTool16.SharedPropsInternal.Caption = "LT:UI.Command.Ordered"; buttonTool16.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; controlContainerTool2.ControlName = "ckClosed"; controlContainerTool2.SharedPropsInternal.Caption = "LT:UI.Command.Closed"; controlContainerTool2.SharedPropsInternal.Width = 212; appearance11.Image = global::AyaNova.Resource1.PartRequest32; buttonTool17.SharedPropsInternal.AppearancesLarge.Appearance = appearance11; appearance12.Image = global::AyaNova.Resource1.PartRequest16; buttonTool17.SharedPropsInternal.AppearancesSmall.Appearance = appearance12; buttonTool17.SharedPropsInternal.Caption = "LT:WorkorderItemPartRequest.Label.List"; appearance13.Image = global::AyaNova.Resource1.PartRestockList32; buttonTool18.SharedPropsInternal.AppearancesLarge.Appearance = appearance13; appearance14.Image = global::AyaNova.Resource1.PartRestockList16; buttonTool18.SharedPropsInternal.AppearancesSmall.Appearance = appearance14; buttonTool18.SharedPropsInternal.Caption = "LT:PurchaseOrder.Label.UI.RestockList"; listTool1.DisplayCheckmark = false; appearance15.Image = global::AyaNova.Resource1.Print32; popupMenuTool2.SharedPropsInternal.AppearancesLarge.Appearance = appearance15; appearance16.Image = global::AyaNova.Resource1.Print16; popupMenuTool2.SharedPropsInternal.AppearancesSmall.Appearance = appearance16; popupMenuTool2.SharedPropsInternal.Caption = "LT:UI.Toolbar.Print"; popupMenuTool2.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars; popupMenuTool2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { listTool2}); appearance17.Image = global::AyaNova.Resource1.Wiki32; buttonTool20.SharedPropsInternal.AppearancesLarge.Appearance = appearance17; appearance18.Image = global::AyaNova.Resource1.Wiki16; buttonTool20.SharedPropsInternal.AppearancesSmall.Appearance = appearance18; buttonTool20.SharedPropsInternal.Caption = "LT:O.WikiPage"; this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool10, buttonTool11, buttonTool12, buttonTool13, buttonTool14, buttonTool15, buttonTool16, controlContainerTool2, buttonTool17, buttonTool18, listTool1, popupMenuTool2, buttonTool20}); this.tbManager.UseLargeImagesOnToolbar = true; this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick); // // _PurchaseOrderInfoForm_Toolbars_Dock_Area_Right // this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(874, 55); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.Name = "_PurchaseOrderInfoForm_Toolbars_Dock_Area_Right"; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 520); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager; // // _PurchaseOrderInfoForm_Toolbars_Dock_Area_Top // this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.Name = "_PurchaseOrderInfoForm_Toolbars_Dock_Area_Top"; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(874, 55); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager; // // _PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom // this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 575); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.Name = "_PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom"; this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(874, 0); this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager; // // PurchaseOrderInfoForm // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(874, 575); this.Controls.Add(this.panelCustom); this.Controls.Add(this.panelRight); this.Controls.Add(this.panelLeft); this.Controls.Add(this.splitter1); this.Controls.Add(this.panelBottom); this.Controls.Add(this.ckIsDirty); this.Controls.Add(this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Left); this.Controls.Add(this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Right); this.Controls.Add(this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Bottom); this.Controls.Add(this._PurchaseOrderInfoForm_Toolbars_Dock_Area_Top); this.helpProvider1.SetHelpKeyword(this, ""); this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); this.MinimumSize = new System.Drawing.Size(614, 563); this.Name = "PurchaseOrderInfoForm"; this.helpProvider1.SetShowHelp(this, true); this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.Closing += new System.ComponentModel.CancelEventHandler(this.PurchaseOrderInfoForm_Closing); this.Load += new System.EventHandler(this.PurchaseOrderInfoForm_Load); this.SizeChanged += new System.EventHandler(this.PurchaseOrderInfoForm_SizeChanged); this.panelLeft.ResumeLayout(false); this.panelLeft.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbProjectID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ckAllVendors)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edVendorInfo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cbVendorID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cbClientID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edClientInfo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit(); this.panelRight.ResumeLayout(false); this.panelRight.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.edReferenceNumber)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dtExpectedReceiveDate)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dtOrderedDate)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edVendorMemo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edNotes)).EndInit(); this.panelBottom.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.Grid)).EndInit(); this.panelCustom.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gridCustom)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit(); this.ResumeLayout(false); } #endregion // __ _ _ ___ ____ __ __ __ __ __ ___ ___ // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _) // ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _) // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___) // #region Form Load / Close //variable to hold user form settings //UIUserFormSetting mFormSetting; //Variable to hold tax codes used in calculating line totals etc TaxCodeList TaxList; //Variable to hold part prices / cost / tax codes //used in calculating line totals etc PartPickList PartList; PartRestockRequiredByVendorList mRestockList=null; PartWorkorderItemRequestByVendorList mRequestList=null; /// /// Prepare the form /// /// /// private void PurchaseOrderInfoForm_Load(object sender, System.EventArgs e) { // // helpProvider1 // this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "purchase_order_entry_screen.htm"; //case 1039 //log.Debug("PurchaseOrderInfoForm_Load"); Cursor.Current = Cursors.WaitCursor; this.Visible=false; this.Icon = Resource1.PurchaseOrder16icon; //See if user has any rights to be here... //(this is done here to ensure that no matter what happens if a user has no rights they can't get here //useful in case we miss a way of getting to a client edit screen from elsewhere in the program) if(AyaBizUtils.Right("Object.PurchaseOrder")< (int)SecurityLevelTypes.ReadOnly)//Less than read only instead of NoAccess to catch records where it's zero instead of 1 { //Inform them of their wicked ways and boot them out of here... MessageBox.Show(string.Format( Util.LocaleText.GetLocalizedText("Error.Security.NotAuthorizedToRetrieve"), Util.LocaleText.GetLocalizedText("O.PurchaseOrder"))); this.Close(); return; } //Populate tax code list so we can //quickly calculate taxes on line items TaxList= TaxCodeList.GetList(); InitializeComboBoxes(); DataBind(); InitializeGrid(); int Split1 = 0; Util.LoadFormCustomization("PurchaseOrderInfo", this, tbManager, false, ref Split1); splitter1.SplitPosition = Split1; Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.PurchaseOrder, mPurchaseOrder, null));//case 941 if (AyaBizUtils.Right("Object.Report") < (int)SecurityLevelTypes.ReadOnly) { tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = false; } else { tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = true; Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], PurchaseOrderList.ReportKey, PurchaseOrderDetailedReportData.ReportKey); } Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810 Util.Localize(this); Cursor.Current = Cursors.Default; //Case 152 (new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); Application.Idle+= new EventHandler(Application_Idle); //get the totals re-calc'ed RefreshCalcs(); //Fill address info boxes DisplayFullerAddressForVendorSelected(); DisplayFullerAddressForClientSelected(); Util.LocalizeGrid(Grid); //show requests if any present RefreshRestockRequestToolBarButtons(); if ((SecurityLevelTypes)AyaBizUtils.Right(RootObjectTypes.PurchaseOrder) > SecurityLevelTypes.ReadWrite) Util.GridAddDeleteButton(Grid); else Util.GridRemoveDeleteButton(Grid); //restrict UI based on security settings RestrictUI(); this.Visible=true; } /// /// Used to track whether the close was done by the program /// or done by the user clicking on the upper left corner X control /// bool bClosingHandled=false; bool bSuspendAppIdleHandler=false; /// /// Save form layout and grid layout for next time /// /// /// private void PurchaseOrderInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //case 1039 //log.Debug("PurchaseOrderInfoForm_Closing"); bSuspendAppIdleHandler=true; if(!bClosingHandled) { //Save record if necessary //User may opt to not cancel exit if(!RecordUpdate(RecordActionType.PromptToSave) ) { e.Cancel=true; bSuspendAppIdleHandler=false; return; } } Application.Idle-= new EventHandler(Application_Idle); Util.SaveGridLayout("PurchaseOrderItems","","",Grid); Util.SaveFormCustomization("PurchaseOrderInfo", this, tbManager, false, splitter1.SplitPosition); } #endregion #region Form Sizing /// /// Adjust the layout proportionately as it's sized by user /// /// /// private void PurchaseOrderInfoForm_SizeChanged(object sender, System.EventArgs e) { //case 1039 //log.Debug("PurchaseOrderInfoForm_SizeChanged"); int nWidth=0; int nHeight=(this.DisplayRectangle.Height/3)*2; if(bShowCustomFields) //there are three panels nWidth=this.DisplayRectangle.Width/3; else//there are two panels nWidth=this.DisplayRectangle.Width/2; this.panelLeft.Width=nWidth; this.panelRight.Width=nWidth; if(bShowCustomFields) this.panelCustom.Width=nWidth; this.panelLeft.Height=nHeight; this.panelRight.Height=nHeight; this.panelCustom.Height=nHeight; this.panelBottom.Height=(this.DisplayRectangle.Height/3)-40; //Size of controls in panel //One third int nLeftWidth=(this.panelLeft.Width/3); //two thirds int nRightWidth=this.panelLeft.Width-nLeftWidth; //make room for error icons nRightWidth-=16; //case 3179 overlapping int nGap = 16; //Size and align controls in right panel nRightWidth=nRightWidth-8; lblOrderedDate.Width = nLeftWidth - nGap; dtOrderedDate.Left=nLeftWidth+8; dtOrderedDate.Width=nRightWidth; lblExpectedReceiveDate.Width = nLeftWidth - nGap; dtExpectedReceiveDate.Left=nLeftWidth+8; dtExpectedReceiveDate.Width=nRightWidth; lblReferenceNumber.Width = nLeftWidth - nGap; edReferenceNumber.Left=nLeftWidth+8; edReferenceNumber.Width=nRightWidth; } #endregion #region Form UI commands #region Toolbar menu items /// /// Respond to a click on a toolbar menu item /// /// /// private void tbManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("ToolClick: "+e.Tool.Key); switch (e.Tool.Key) { case "LT:UI.Command.SaveClose": // ButtonTool RecordUpdate(RecordActionType.SaveAndExit); break; case "LT:UI.Command.RecordHistory": // ButtonTool RecordHistoryForm RH=new RecordHistoryForm(mPurchaseOrder.Creator,mPurchaseOrder.Modifier,mPurchaseOrder.Created,mPurchaseOrder.Modified); RH.ShowDialog(); RH.Dispose(); break; case "LT:UI.Command.Save": // ButtonTool RecordUpdate(RecordActionType.SaveOnly); break; case "LT:UI.Command.SaveNew": // ButtonTool RecordUpdate(RecordActionType.SaveAndNew); break; case "LT:UI.Command.Close": // ButtonTool this.Close(); break; case "LT:UI.Command.Delete": // ButtonTool RecordUpdate(RecordActionType.DeleteAndExit); break; case "LT:UI.Command.Ordered": // ButtonTool //Are you sure you want to set this P.O. to Ordered status? DialogResult result=MessageBox.Show(Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.UI.OrderedWarning"),"Warning",MessageBoxButtons.YesNo, MessageBoxIcon.Warning,MessageBoxDefaultButton.Button2); if(result!=DialogResult.Yes) return; //commit any changes to grid before changing status Grid.UpdateData(); btnVendorID.Focus(); //set to open ordered status mPurchaseOrder.Status=PurchaseOrderStatus.OpenOrdered; break; case "LT:UI.Command.Closed": // ControlContainerTool //does nothing, is handled by the ckClosed Click event itself since //this item is just a control container and doesn't have a click event break; case "LT:O.WikiPage": { Util.OpenWikiPage(RootObjectTypes.PurchaseOrder, mPurchaseOrder.ID, false); break; } case "LT:PurchaseOrder.Label.UI.RestockList": // ButtonTool //without this things go wierd as if the vendorid combo is keeping focus //somehow and when you go to type in another edit box you don't get a cursor btnVendorID.Focus(); PartRestockRequiredByVendorForm f = new PartRestockRequiredByVendorForm(); f.PartInventoriesToEdit=this.mRestockList; f.VendorNameToDisplay=cbVendorID.Text; f.PurchaseOrderToEdit=this.mPurchaseOrder; if(f.ShowDialog()==DialogResult.OK) RefreshCalcs(); break; case "LT:WorkorderItemPartRequest.Label.List": // ButtonTool //without this things go wierd as if the vendorid combo is keeping focus //somehow and when you go to type in another edit box you don't get a cursor btnVendorID.Focus(); PartWorkorderItemRequestByVendorForm r = new PartWorkorderItemRequestByVendorForm(); r.PartWorkorderItemRequestToEdit=this.mRequestList; r.VendorNameToDisplay=cbVendorID.Text; r.PurchaseOrderToEdit=this.mPurchaseOrder; if(r.ShowDialog()==DialogResult.OK) RefreshCalcs(); break; // case "REPORTLIST": { //case 3736 RecordUpdate(RecordActionType.PromptToSave); if(Util.ReportHandleToolClickIsSummary(e.Tool)) Util.ReportHandleToolClick(e.Tool,PurchaseOrderList.ReportKey, PurchaseOrderList.GetListForSingleItem(this.mPurchaseOrder.ID)); else { Util.ReportHandleToolClick(e.Tool,PurchaseOrderDetailedReportData.ReportKey, PurchaseOrderDetailedReportData.GetItem(this.mPurchaseOrder.ID)); } Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], PurchaseOrderList.ReportKey, PurchaseOrderDetailedReportData.ReportKey); break; } } } #endregion Toolbar menu items #region hyperButtons private void btnVendorID_Click(object sender, System.EventArgs e) { //case 1039 //log.Debug("btnVendorID_Click"); VendorInfoForm cf=new VendorInfoForm(VendorTypes.All); if(cbVendorID.Value!=null && (Guid)cbVendorID.Value!=Guid.Empty) { cf.VendorToEdit=Vendor.GetItem((Guid)cbVendorID.Value); } else { if(AyaBizUtils.Right("Object.Vendor")< (int)SecurityLevelTypes.ReadWrite) { //case 1039 //log.Debug("No Vendor selected to view and user has no rights to create a new one."); return; } cf.VendorToEdit=Vendor.NewItem(); } cf.Visible=false; cf.ShowDialog(); if(this.cbVendorID.Enabled && !this.cbVendorID.ReadOnly && cf.ChangesMade) { mPurchaseOrder.VendorID=Guid.Empty; Util.FillGZComboBoxWithNameIDList("Vendor",cbVendorID,false,Guid.Empty,false); mPurchaseOrder.VendorID=cf.VendorToEdit.ID; } } private void btnClientID_Click(object sender, System.EventArgs e) { //case 1039 //log.Debug("btnClientID_Click"); ClientInfoForm cf=new ClientInfoForm(); if(cbClientID.Value!=null && (Guid)cbClientID.Value!=Guid.Empty) { cf.ClientToEdit=Client.GetItem((Guid)cbClientID.Value); } else { if(AyaBizUtils.Right("Object.Client")< (int)SecurityLevelTypes.ReadWrite) { //case 1039 //log.Debug("No Client selected to view and user has no rights to create a new one."); return; } cf.ClientToEdit=Client.NewItem(); } cf.Visible=false; cf.ShowDialog(); if(this.cbClientID.Enabled && !this.cbClientID.ReadOnly && cf.ChangesMade) { mPurchaseOrder.DropShipToClientID=Guid.Empty; Util.FillGZComboBoxWithNameIDList("Client",cbClientID,false,Guid.Empty,true); mPurchaseOrder.DropShipToClientID=cf.ClientToEdit.ID; } } #endregion hyperButtons //Click on closed checkbox (which is actually in the menu) //but handled here just like a regular form item private void ckClosed_CheckedChanged(object sender, System.EventArgs e) { //case 1039 //log.Debug("ckClosed_CheckedChanged"); //Flip the status depending upon what it currently is switch(mPurchaseOrder.Status) { //It's one of these which are the only statuses where //closed is even visible case PurchaseOrderStatus.ClosedNoneReceived: mPurchaseOrder.Status=PurchaseOrderStatus.OpenOrdered; break; case PurchaseOrderStatus.ClosedPartialReceived: mPurchaseOrder.Status=PurchaseOrderStatus.OpenPartialReceived; break; case PurchaseOrderStatus.OpenOrdered: mPurchaseOrder.Status=PurchaseOrderStatus.ClosedNoneReceived; break; case PurchaseOrderStatus.OpenPartialReceived: mPurchaseOrder.Status=PurchaseOrderStatus.ClosedPartialReceived; break; } } #endregion Form UI commands #region Form UI / Business object synchronization and Restrictions /// /// used on load of form and when adding parts from lists /// to force a recalc of all taxes etc /// private void RefreshCalcs() { //get the totals calced if(Grid.Rows.Count>0) { foreach(UltraGridRow r in Grid.Rows) { r.Refresh(RefreshRow.FireInitializeRow); } } } /// /// Synchronize the state of the UI to the BO's /// private void SyncUI() { // //adjust UI access on the fly //as po status changes switch(mPurchaseOrder.Status) { case PurchaseOrderStatus.ClosedFullReceived: lblStatus.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PurchaseOrderStatus.ClosedFullReceived"); SetAccess(true,false); tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=false; tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=false; tbManager.Tools["LT:UI.Command.Ordered"].SharedProps.Visible=false; tbManager.Tools["LT:UI.Command.Closed"].SharedProps.Visible=false; break; case PurchaseOrderStatus.ClosedNoneReceived: lblStatus.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PurchaseOrderStatus.ClosedNoneReceived"); SetAccess(true,false); tbManager.Tools["LT:UI.Command.Closed"].SharedProps.Visible=(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly); tbManager.Tools["LT:UI.Command.Ordered"].SharedProps.Visible=false; tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=false; tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=false; break; case PurchaseOrderStatus.ClosedPartialReceived: lblStatus.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PurchaseOrderStatus.ClosedPartialReceived"); SetAccess(true,false); tbManager.Tools["LT:UI.Command.Closed"].SharedProps.Visible=(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly); tbManager.Tools["LT:UI.Command.Ordered"].SharedProps.Visible=false; tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=false; tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=false; break; case PurchaseOrderStatus.OpenNotYetOrdered: lblStatus.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PurchaseOrderStatus.OpenNotYetOrdered"); tbManager.Tools["LT:UI.Command.Closed"].SharedProps.Visible=false; tbManager.Tools["LT:UI.Command.Ordered"].SharedProps.Visible=(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly); tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=!mPurchaseOrder.IsDropShip;//Case 447 tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=!mPurchaseOrder.IsDropShip;//Case 447 //Allowed to edit? if(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly) { SetAccess(false,false); } break; case PurchaseOrderStatus.OpenOrdered: lblStatus.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PurchaseOrderStatus.OpenOrdered"); //restrict all access... SetAccess(true,false); //case 412 special exceptions to read only setting above if (mPurchaseOrder.HasEditRights) { dtExpectedReceiveDate.ReadOnly = false; edReferenceNumber.ReadOnly = false; edNotes.ReadOnly = false; edVendorMemo.ReadOnly = false; gridCustom.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True; cbClientID.ReadOnly = false; cbProjectID.ReadOnly = false;//case 1926 tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible = true; tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible = true; } tbManager.Tools["LT:UI.Command.Closed"].SharedProps.Visible=(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly); tbManager.Tools["LT:UI.Command.Ordered"].SharedProps.Visible=false; //case 3198 //according to Joyce: //"should not be able to click on the CLosed checkbox. Field is supposed to be readonly and gets updated by ayanova itself only. " ////Not sure why I coded this override in that case but I can't think of a reason at the moment so commenting it out ////Allowed to edit? // if(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly) // { // //re-enable some items // Grid.DisplayLayout.Bands[0].Columns["Closed"].CellActivation=Activation.AllowEdit; // } tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=false; tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=false; break; case PurchaseOrderStatus.OpenPartialReceived: lblStatus.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PurchaseOrderStatus.OpenPartialReceived"); SetAccess(true,false); tbManager.Tools["LT:UI.Command.Closed"].SharedProps.Visible=(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly); tbManager.Tools["LT:UI.Command.Ordered"].SharedProps.Visible=false; //case 3198 //according to Joyce: //"should not be able to click on the CLosed checkbox. Field is supposed to be readonly and gets updated by ayanova itself only. " ////Not sure why I coded this override in that case but I can't think of a reason at the moment so commenting it out //Allowed to edit? //if(AyaBizUtils.Right("Object.PurchaseOrder")> (int)SecurityLevelTypes.ReadOnly) //{ // Grid.DisplayLayout.Bands[0].Columns["Closed"].CellActivation=Activation.AllowEdit; //} tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=false; tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=false; break; } //PurchaseOrder.Label.PONumber if(mPurchaseOrder.PONumber!=0) this.Text=Util.LocaleText.GetLocalizedText("PurchaseOrder.Label.PONumber")+" "+mPurchaseOrder.PONumber.ToString(); else this.Text=Util.LocaleText.GetLocalizedText("O.PurchaseOrder"); //lock vendor if there are items selected cbVendorID.Enabled=(mPurchaseOrder.OrderItems.Count==0); //Status sensitive items //within grid itself switch(mPurchaseOrder.Status) { case PurchaseOrderStatus.OpenNotYetOrdered: Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden=true; //tbManager.Tools["LT:UI.Command.Save"].SharedProps.Enabled=mPurchaseOrder.IsSavable; break; case PurchaseOrderStatus.OpenOrdered: Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden=true; break; case PurchaseOrderStatus.OpenPartialReceived: Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden=false; break; case PurchaseOrderStatus.ClosedPartialReceived: Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden=false; break; case PurchaseOrderStatus.ClosedFullReceived: Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden=false; break; case PurchaseOrderStatus.ClosedNoneReceived: Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden=false; break; } //Case 19 if (Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Hidden == false) { Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Header.VisiblePosition = 0; } //case 1926 if (mPurchaseOrder.HasEditRights) { gridCustom.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True; tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible = true; tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible = true; } } /// /// When the application enters an idle state /// update the UI to reflect changs in BO status /// (required because grids don't tell the UI to update when they are /// bound to a business object and are edited) /// /// /// private void Application_Idle(object sender, EventArgs e) { if(!bSuspendAppIdleHandler) SyncUI(); } /// /// Adapt UI to accomodate users security access level /// private void RestrictUI() { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("RestrictUI: " + ((SecurityLevelTypes)AyaBizUtils.Right("Object.PurchaseOrder")).ToString()); //PurchaseOrder - Read only if(AyaBizUtils.Right("Object.PurchaseOrder") == (int)SecurityLevelTypes.ReadOnly) SetAccess(true,true); else SetAccess(false,true); } //Flag to save time setting to read only if has been done already bool bCurrentStateIsReadOnly=false; /// /// Set everything to Read only or editable state /// used to set access rights and or /// if po is locked after entry /// safe to call repeatedly from anywhere, takes into account /// security rights /// /// Set access rights to read only if true /// Make settings regardless if already set that way, used to initialize first time private void SetAccess(bool ReadOnly, bool ForceSetting) { //case 1039 //log.Debug("SetAccess"); //Already set this way? if(!ForceSetting && bCurrentStateIsReadOnly==ReadOnly) return; //DISABLE or Enable TOOLS //tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Enabled=!ReadOnly; //tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Enabled=!ReadOnly; //tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Enabled=!ReadOnly; //tbManager.Tools["LT:UI.Command.Save"].SharedProps.Enabled=!ReadOnly; //Set tool visibility tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible=!ReadOnly; tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=!ReadOnly; tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Visible=!ReadOnly; tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible=!ReadOnly; //user needs a method to close the form if read only //because can't use usual save and close etc //so make sure that the close tool is there if(ReadOnly) { //Ensure that close tool won't appear twice when //it's added if it was there previously tbManager.Tools["LT:UI.Command.Close"].SharedProps.AllowMultipleInstances=false; //Ensure Close tool is visible so user has a method to close the form //besides the form control box (normally this is not visible) tbManager.Toolbars[0].Tools.AddTool("LT:UI.Command.Close"); } //DISABLE / ENABLE EDITABLE CONTROLS //Text editors edReferenceNumber.ReadOnly=ReadOnly; edNotes.ReadOnly=ReadOnly; edVendorMemo.ReadOnly=ReadOnly; //Date pickers //case 1926 - not really related but noticed these controls were not fully read only and were showing the buttons to the right //because it was settting ReadOnly and not GZReadOnly. dtOrderedDate.GZReadOnly=ReadOnly; dtExpectedReceiveDate.GZReadOnly=ReadOnly; //Combo boxes cbVendorID.ReadOnly=ReadOnly; cbClientID.ReadOnly=ReadOnly; //case 1926 - noticed this was missing cbProjectID.ReadOnly = ReadOnly; //CHECKBOX ckAllVendors.Enabled = !ReadOnly; //Buttons btnVendorID.Enabled=!ReadOnly; btnVendorID.Appearance.ForeColorDisabled=System.Drawing.SystemColors.ControlText; btnClientID.Enabled=!ReadOnly; btnClientID.Appearance.ForeColorDisabled=System.Drawing.SystemColors.ControlText; //Grids if(ReadOnly) { Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.No; Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; //disallow editing on all columns //Can't just turn off editing for grid as a whole //because there is a single field that needs to sometimes //be editable even when the rest is read only foreach(UltraGridColumn c in Grid.DisplayLayout.Bands[0].Columns) { c.CellActivation=Activation.ActivateOnly; } gridCustom.DisplayLayout.Override.AllowAddNew=AllowAddNew.No; gridCustom.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; gridCustom.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.False; } else { Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom; Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.True; //Allow editing on all columns foreach(UltraGridColumn c in Grid.DisplayLayout.Bands[0].Columns) { c.CellActivation=Activation.AllowEdit; } //this column should never be editable here Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].CellActivation=Activation.ActivateOnly; //case 3198 Grid.DisplayLayout.Bands[0].Columns["Closed"].CellActivation = Activation.ActivateOnly; //always no for custom fields since there is a fixed number //of rows, this is just insurance gridCustom.DisplayLayout.Override.AllowAddNew=AllowAddNew.No; gridCustom.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; //however we can allow updating of data... gridCustom.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.True; } //Fixup for additional restriction if full access... //PurchaseOrder - Full but no delete if(!ReadOnly) { if(AyaBizUtils.Right("Object.PurchaseOrder")== (int)SecurityLevelTypes.ReadWrite) { tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Enabled=false; //Remove tools that user is not allowed access to use tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=false; //Disable delete row in grid Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; return; } } bCurrentStateIsReadOnly=ReadOnly; } /// /// retrieve and display address /// and contact info for selected vendor /// private void DisplayFullerAddressForVendorSelected() { //case 1039 //log.Debug("DisplayFullerAddressForVendorSelected"); //Need a selected vendor to be able to do this //If there isn't one, then bail if(cbVendorID.Value==null || (Guid)cbVendorID.Value==Guid.Empty) return; //Retrieve the vendor record Vendor v = Vendor.GetItemNoMRU((Guid)cbVendorID.Value); StringBuilder b = new StringBuilder(); b.Append(v.MailToAddress.FullAddress); b.Append("\r\n"); b.Append(v.GetPrimaryContactDefaultContactInfo()); edVendorInfo.Text=b.ToString(); } /// /// retrieve and display address /// and contact info for selected Client /// private void DisplayFullerAddressForClientSelected() { //case 1039 //log.Debug("DisplayFullerAddressForClientSelected"); //Need a selected Client to be able to do this //If there isn't one, then bail if(cbClientID.Value==null || (Guid)cbClientID.Value==Guid.Empty) return; //retrieve the client record Client c = Client.GetItemNoMRU((Guid)cbClientID.Value); StringBuilder b = new StringBuilder(); b.Append(c.MailToAddress.FullAddress); b.Append("\r\n"); b.Append(c.GetPrimaryContactDefaultContactInfo()); edClientInfo.Text=b.ToString(); } #endregion #region Form DataBinding and BrokenRules handling bool bShowCustomFields=false; bool bBinding=false; /// /// Bind controls to business objects /// private void DataBind() { //case 1039 //log.Debug("DataBind"); bBinding=true; //prevent initialze row from firing and throwing errors when it finds there is no data //to calculate line totals on... Grid.EventManager.SetEnabled(GridEventIds.InitializeRow,false); //Custom fields are not databound, but must be initiated manually... FillCustomFieldGrid(); //Subscribe to broken rules changed event OnBrokenRulesChanged mPurchaseOrder.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged); //=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-= //Text editors Util.BindField(edNotes,"Text",mPurchaseOrder,"Notes"); Util.BindField(edReferenceNumber,"Text",mPurchaseOrder,"ReferenceNumber"); Util.BindField(edVendorMemo,"Text",mPurchaseOrder,"VendorMemo"); //Combo boxes Util.BindField(cbVendorID,"Value",mPurchaseOrder,"VendorID"); Util.BindField(cbClientID,"Value",mPurchaseOrder,"DropShipToClientID"); Util.BindField(cbProjectID, "Value", mPurchaseOrder, "ProjectID");//case 49 //Grids Util.BindField(Grid,"DataSource",mPurchaseOrder,"OrderItems"); //Dates Util.BindField(dtOrderedDate,"Value", mPurchaseOrder, "OrderedDate"); Util.BindField(dtExpectedReceiveDate,"Value", mPurchaseOrder, "ExpectedReceiveDate"); //Bind IsDirty property to hidden checkbox to //ensure isdirtychanged event is available //to data binding infrastructure Util.BindField(ckIsDirty,"Checked",mPurchaseOrder,"IsDirty"); //Setup initial link to broken rules OnBrokenRulesChanged(null,null); bBinding=false; //turn initialize row event back on Grid.EventManager.SetEnabled(GridEventIds.InitializeRow,true); } /// /// Handle a change in broken rules /// /// /// private void OnBrokenRulesChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { Util.BrokenRuleFeedback(this,mPurchaseOrder,ErrorProvider); } #endregion #region Business object editing / adding / deletion related code private PurchaseOrder mPurchaseOrder; /// /// PurchaseOrder record to display /// set by caller /// public PurchaseOrder PurchaseOrderToEdit { get { return mPurchaseOrder; } set { mPurchaseOrder=value; //mPurchaseOrder.BeginEdit(); } } //Used to signal to main form that there are changes //which could affect it if true private bool mbChangesMade=false; public bool ChangesMade { get { return mbChangesMade; } } /// /// Update record and quit if requested /// /// /// True if handled, false if not handled private bool RecordUpdate(RecordActionType SaveType) { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("SaveHandler(Action="+SaveType.ToString()+")"); //switch the focus to a non-editable control //so that any changes in the current editable control //will get updated before attempting to save lblStatus.Focus(); //Added by John Dec 2 2004 (catches change in grid when above is non focusable) Grid.UpdateData(); switch(SaveType) { case RecordActionType.DeleteAndExit: if(Util.PromptForDelete()==DialogResult.Yes) { //Delete, then exit try { PurchaseOrder.DeleteItem(mPurchaseOrder.ID); } catch(Exception ex) { Util.ReportSQLError(ex); return false; } bClosingHandled=true; this.Close(); mbChangesMade=true; return true; } else return false; case RecordActionType.SaveAndExit: //Save if necessary and exit if(mPurchaseOrder.IsSavable) { mPurchaseOrder.ApplyEdit(); mPurchaseOrder.Save(); bClosingHandled=true; mbChangesMade=true; this.Close(); return true; } if(mPurchaseOrder.IsDirty)//dirty and unsaveable due to broken rules { if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { bClosingHandled=true; this.Close(); return true; } else return false; } //not dirty so just exit bClosingHandled=true; this.Close(); return true; case RecordActionType.SaveAndNew: if(mPurchaseOrder.IsSavable) { mPurchaseOrder.ApplyEdit(); mPurchaseOrder.Save(); AddNewPurchaseOrder(); mbChangesMade=true; return true; } if(mPurchaseOrder.IsDirty)//dirty and unsaveable due to broken rules { //User says that's ok, continue on? if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { //Ok, add new PurchaseOrder and don't save old record AddNewPurchaseOrder(); return true; } else return false; } //Current record isn't dirty so just add a new PurchaseOrder AddNewPurchaseOrder(); return true; case RecordActionType.SaveOnly: if(mPurchaseOrder.IsSavable) { mPurchaseOrder.ApplyEdit(); mPurchaseOrder=(PurchaseOrder)mPurchaseOrder.Save(); DataBind(); mbChangesMade=true; return true; } return true; case RecordActionType.PromptToSave: //Prompt to save and save if //required if(mPurchaseOrder.IsDirty) { DialogResult dr=Util.PromptForSave(); if(dr==DialogResult.Cancel) { //Cancel return false; } if(dr==DialogResult.Yes) { //Save before exit if(mPurchaseOrder.IsSavable) { mPurchaseOrder.ApplyEdit(); mPurchaseOrder.Save(); mbChangesMade=true; return true; } if(mPurchaseOrder.IsDirty)//dirty and unsaveable due to broken rules { if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { return true; } else return false; } } } return true; } return false; } /// /// ///Creates a new PurchaseOrder record and opens it for editing /// private void AddNewPurchaseOrder() { //case 1039 //log.Debug("AddNewPurchaseOrder"); try { mPurchaseOrder=PurchaseOrder.NewItem(); //mPurchaseOrder.BeginEdit(); DataBind(); } catch(Exception ex) { //log.Error("AddNewPurchaseOrder",ex); MessageBox.Show(ex.Message+"\r\n"+ex.Source); } } #endregion #region Form ComboBoxes (Setup / Events) /// /// when selection changes for vendor, need to re-build parts list /// /// /// private void cbVendorID_SelectionChanged(object sender, System.EventArgs e) { if(!bBinding) { PopulateGridValueLists(); //Fill address info boxes DisplayFullerAddressForVendorSelected(); RefreshRestockRequestToolBarButtons(); } } private void cbClientID_SelectionChanged(object sender, System.EventArgs e) { if(!bBinding) { //Fill address info boxes DisplayFullerAddressForClientSelected(); //a drop ship precludes doing the regular vendor requests thing RefreshRestockRequestToolBarButtons(); //Case 447 redux - trigger an immediate update btnClientID.Focus(); } } private void InitializeComboBoxes() { //case 1039 //log.Debug("InitializeComboBoxes"); //Load combo boxes with initial values Util.FillGZComboBoxWithNameIDList("Vendor", cbVendorID, true, mPurchaseOrder.VendorID, false); Util.FillGZComboBoxWithNameIDList("Client",cbClientID,true,mPurchaseOrder.DropShipToClientID,true); Util.FillGZComboBoxWithNameIDList("Project", cbProjectID, true, mPurchaseOrder.ProjectID, true); //TODO: below gives error when uncommented - not sure why - joyce - //because there is no business object that corresponds // Util.FillGZComboBoxWithNameIDList("PurchaseOrderStatus",cbStatus,true,mPurchaseOrder.Status); } private void cbVendorID_NeedMoreData() { cbVendorID.ClearList(); VendorPickList v = VendorPickList.GetList(); //Added: 19-July-2006 Huge performance increase with large lists Util.ComboBeginUpdate(cbVendorID); foreach(VendorPickList.VendorPickListInfo i in v) { if(i.Active==true && i.VendorType!=VendorTypes.Shipper) { cbVendorID.Items.Add(i.ID,i.Name); } else { //is the current, inactive item the one selected in this record? if(i.ID==this.mPurchaseOrder.VendorID) { //yes, so add it manually and grayed out ValueListItem vi=cbVendorID.Items.Add(i.ID,i.Name); vi.Appearance.ForeColor=System.Drawing.SystemColors.GrayText; } } } //Added: 19-July-2006 see above Util.ComboEndUpdate(cbVendorID); } private void cbClientID_NeedMoreData() { Util.FillGZComboBoxWithNameIDList("Client",cbClientID,false,Guid.Empty,true); } //case 49 private void cbProjectID_NeedMoreData() { Util.FillGZComboBoxWithNameIDList("Project", cbProjectID, false, Guid.Empty, true); } #endregion #region Grid Events /// /// Handle right click column selection popup /// /// /// private void Grid_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if( e.Button == MouseButtons.Right) { UltraGridBand b=Util.BandRightClicked(Grid,e); if(b!=null) { UtilGridColumnSelector c = new UtilGridColumnSelector(); c.HideColumns.Add("IsLocked",0); c.HideColumns.Add("WorkorderItemPartRequestID",0); c.HideColumns.Add("PurchaseOrderID",0); c.BandToEdit=b; c.ShowDialog(this); } } } private void Grid_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e) { if(PartList.Count==0) Util.PromptWithIconOKOnlyFromLocaleKey("PurchaseOrder.Label.UI.NoPartsForVendorWarning",MessageBoxIcon.Exclamation); else mPurchaseOrder.OrderItems.Add(mPurchaseOrder); //Don't allow the default behaviour of the row insert because it doesn't work e.Cancel=true; } /// /// Display workorder button if item from workorder /// Calculate taxes and line totals ..etc /// /// /// private void Grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { object oWo=e.Row.Cells["WorkorderNumber"].Value; if(oWo==null || (int)oWo==0) { e.Row.Cells["WorkorderNumber"].Hidden=true; e.Row.Cells["PartRequestedByID"].Hidden=true; } else { //it's a workorder request line so show the wo number and requestor //and lock down the editable fields for this row e.Row.Cells["WorkorderNumber"].Hidden=false; e.Row.Cells["PartRequestedByID"].Hidden=false; e.Row.Cells["PartRequestedByID"].Activation=Activation.NoEdit; e.Row.Cells["WorkorderNumber"].Activation=Activation.NoEdit; e.Row.Cells["QuantityOrdered"].Activation=Activation.NoEdit; e.Row.Cells["PartWarehouseID"].Activation=Activation.NoEdit; e.Row.Cells["PartID"].Activation=Activation.NoEdit; } //Calculate taxes and line total if(e.Row.Cells["PartID"].Value!=null && (Guid)e.Row.Cells["PartID"].Value!=Guid.Empty) { //update alternative numbers PartPickList.PartPickListInfo p=PartList[(Guid)e.Row.Cells["PartID"].Value]; e.Row.Cells["ManufacturerNumber"].Value=p.PartManufacturerNumber; e.Row.Cells["WholesalerNumber"].Value=p.PartWholesalerNumber; e.Row.Cells["AlternativeWholesalerNumber"].Value=p.PartAlternativeWholesalerNumber; if(e.Row.Cells["QuantityOrdered"].Value!=null) { if(e.Row.Cells["PurchaseOrderCost"].Value!=null) { decimal dNet=(decimal)e.Row.Cells["QuantityOrdered"].Value*(decimal)e.Row.Cells["PurchaseOrderCost"].Value; decimal dTaxA=0M; decimal dTaxB=0M; //Calculate taxes if(e.Row.Cells["PurchaseTaxCodeID"].Value!=null && (Guid)e.Row.Cells["PurchaseTaxCodeID"].Value!=Guid.Empty) { //Get the percentages and other info for the current tax code... TaxCodeList.TaxCodeListInfo t = TaxList[(Guid)e.Row.Cells["PurchaseTaxCodeID"].Value]; //If tax A exempt then no further processing needs to be done //as both taxes already set at zero, otherwise... if(!t.TaxAExempt) { //Tax A is always just tax A percent times net... dTaxA=t.TaxA*dNet; //Tax B on the other hand could be simple or tax on tax... if(!t.TaxOnTax) { //simple dTaxB=t.TaxB*dNet; } else { //tax on tax dTaxB=(dNet+dTaxA)*t.TaxB; } } } //set line total and taxes display values e.Row.Cells["TaxA"].Value=dTaxA; e.Row.Cells["TaxB"].Value=dTaxB; e.Row.Cells["NetTotal"].Value=dNet; e.Row.Cells["LineTotal"].Value=dNet+dTaxA+dTaxB; } } } } private void Grid_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { //case 1979 - don't allow negative entries if ((string)e.Cell.Column.Key == "QuantityOrdered") { object o = e.Cell.Row.Cells["QuantityOrdered"].Value; if (o != null && o is System.Decimal) { decimal d = (Decimal)o; if(d<0) e.Cell.Row.Cells["QuantityOrdered"].Value=Math.Abs(d); } } //If part ID has changed then update the cost and tax code fields if((string)e.Cell.Column.Key=="PartID") { PartPickList.PartPickListInfo p=PartList[(Guid)e.Cell.Value]; e.Cell.Row.Cells["PurchaseOrderCost"].Value=p.Cost; e.Cell.Row.Cells["PurchaseTaxCodeID"].Value=Util.GlobalSettings.TaxPartPurchaseID; e.Cell.Row.Refresh(RefreshRow.FireInitializeRow); } } /// /// Ensure the summary box has the same display format as the column above it /// /// /// private void Grid_SummaryValueChanged(object sender, Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs e) { e.SummaryValue.SummarySettings.DisplayFormat="{0:" +e.SummaryValue.SummarySettings.SourceColumn.Format+"}"; } #endregion #region Grid Initialization /// /// Get grid ready /// private void InitializeGrid() { //case 1039 //log.Debug("InitializeGrid"); //prevent initialze row from firing and throwing errors when it finds there is no data //to calculate line totals on... Grid.EventManager.SetEnabled(GridEventIds.InitializeRow,false); Grid.DisplayLayout.Override.AllowRowSummaries=AllowRowSummaries.BasedOnDataType; Grid.DisplayLayout.Override.HeaderClickAction=HeaderClickAction.SortSingle; Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom; Util.GridPreLocalize("PurchaseOrderItem",Grid.DisplayLayout.Bands[0]); Util.FetchGridLayout("PurchaseOrderItems","",Grid); Util.GridHideEditableBizObjectInternalFields(Grid); Grid.DisplayLayout.Bands[0].Columns["IsLocked"].Hidden=true; Grid.DisplayLayout.Bands[0].Columns["WorkorderItemPartRequestID"].Hidden=true; Grid.DisplayLayout.Bands[0].Columns["PurchaseOrderID"].Hidden=true; Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].CellActivation=Activation.ActivateOnly; Grid.DisplayLayout.Bands[0].Columns["Closed"].CellActivation=Activation.ActivateOnly; Grid.DisplayLayout.Bands[0].Columns["WorkorderNumber"].AllowRowSummaries=AllowRowSummaries.False; //decimal number formatting Grid.DisplayLayout.Bands[0].Columns["QuantityOrdered"].Format="g29"; Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Format = "g29"; Grid.DisplayLayout.Bands[0].Columns["PartWarehouseID"].Header.Caption=Util.LocaleText.GetLocalizedText("O.PartWarehouse"); Grid.DisplayLayout.Bands[0].Columns["PartID"].Header.Caption=Util.LocaleText.GetLocalizedText("O.Part"); Grid.DisplayLayout.Bands[0].Columns["PurchaseTaxCodeID"].Header.Caption=Util.LocaleText.GetLocalizedText("O.TaxCode"); //COST Grid.DisplayLayout.Bands[0].Columns["PurchaseOrderCost"].Format="c"; Grid.DisplayLayout.Bands[0].Columns["PurchaseOrderCost"].CellAppearance.TextHAlign=HAlign.Right; //------------------------------------------------------------------------------------------------- //Manufacturer number if(Grid.DisplayLayout.Bands[0].Columns.Exists("ManufacturerNumber")) Grid.DisplayLayout.Bands[0].Columns["ManufacturerNumber"].Header.Caption=Util.LocaleText.GetLocalizedText("Part.Label.ManufacturerNumber"); else Grid.DisplayLayout.Bands[0].Columns.Add("ManufacturerNumber",Util.LocaleText.GetLocalizedText("Part.Label.ManufacturerNumber")); Grid.DisplayLayout.Bands[0].Columns["ManufacturerNumber"].DataType=typeof(string); Grid.DisplayLayout.Bands[0].Columns["ManufacturerNumber"].CellActivation=Activation.ActivateOnly; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- //Wholesaler number if(Grid.DisplayLayout.Bands[0].Columns.Exists("WholesalerNumber")) Grid.DisplayLayout.Bands[0].Columns["WholesalerNumber"].Header.Caption=Util.LocaleText.GetLocalizedText("Part.Label.WholesalerNumber"); else Grid.DisplayLayout.Bands[0].Columns.Add("WholesalerNumber",Util.LocaleText.GetLocalizedText("Part.Label.WholesalerNumber")); Grid.DisplayLayout.Bands[0].Columns["WholesalerNumber"].DataType=typeof(string); Grid.DisplayLayout.Bands[0].Columns["WholesalerNumber"].CellActivation=Activation.ActivateOnly; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- //AlternativeWholesaler number if(Grid.DisplayLayout.Bands[0].Columns.Exists("AlternativeWholesalerNumber")) Grid.DisplayLayout.Bands[0].Columns["AlternativeWholesalerNumber"].Header.Caption=Util.LocaleText.GetLocalizedText("Part.Label.AlternativeWholesalerNumber"); else Grid.DisplayLayout.Bands[0].Columns.Add("AlternativeWholesalerNumber",Util.LocaleText.GetLocalizedText("Part.Label.AlternativeWholesalerNumber")); Grid.DisplayLayout.Bands[0].Columns["AlternativeWholesalerNumber"].DataType=typeof(string); Grid.DisplayLayout.Bands[0].Columns["AlternativeWholesalerNumber"].CellActivation=Activation.ActivateOnly; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- //Manufacturer number if(Grid.DisplayLayout.Bands[0].Columns.Exists("ManufacturerNumber")) Grid.DisplayLayout.Bands[0].Columns["ManufacturerNumber"].Header.Caption=Util.LocaleText.GetLocalizedText("Part.Label.ManufacturerNumber"); else Grid.DisplayLayout.Bands[0].Columns.Add("ManufacturerNumber",Util.LocaleText.GetLocalizedText("Part.Label.ManufacturerNumber")); Grid.DisplayLayout.Bands[0].Columns["ManufacturerNumber"].DataType=typeof(string); Grid.DisplayLayout.Bands[0].Columns["ManufacturerNumber"].CellActivation=Activation.ActivateOnly; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- //TaxA, TaxB, Total columns //___TAX_A___ if(Grid.DisplayLayout.Bands[0].Columns.Exists("TaxA")) { Grid.DisplayLayout.Bands[0].Columns["TaxA"].Header.Caption=Util.LocaleText.GetLocalizedText("TaxCode.Label.TaxA"); } else { Grid.DisplayLayout.Bands[0].Columns.Add("TaxA",Util.LocaleText.GetLocalizedText("TaxCode.Label.TaxA")); } Grid.DisplayLayout.Bands[0].Columns["TaxA"].DataType=typeof(decimal); Grid.DisplayLayout.Bands[0].Columns["TaxA"].Format="c"; Grid.DisplayLayout.Bands[0].Columns["TaxA"].CellAppearance.TextHAlign=HAlign.Right; Grid.DisplayLayout.Bands[0].Columns["TaxA"].CellActivation=Activation.ActivateOnly; //___TAX_B___ if(Grid.DisplayLayout.Bands[0].Columns.Exists("TaxB")) { Grid.DisplayLayout.Bands[0].Columns["TaxB"].Header.Caption=Util.LocaleText.GetLocalizedText("TaxCode.Label.TaxB"); } else { Grid.DisplayLayout.Bands[0].Columns.Add("TaxB",Util.LocaleText.GetLocalizedText("TaxCode.Label.TaxB")); } Grid.DisplayLayout.Bands[0].Columns["TaxB"].DataType=typeof(decimal); Grid.DisplayLayout.Bands[0].Columns["TaxB"].Format="c"; Grid.DisplayLayout.Bands[0].Columns["TaxB"].CellAppearance.TextHAlign=HAlign.Right; Grid.DisplayLayout.Bands[0].Columns["TaxB"].CellActivation=Activation.ActivateOnly; //___LineTotal___ if(Grid.DisplayLayout.Bands[0].Columns.Exists("LineTotal")) { Grid.DisplayLayout.Bands[0].Columns["LineTotal"].Header.Caption=Util.LocaleText.GetLocalizedText("PurchaseOrderItem.Label.LineTotal"); } else { Grid.DisplayLayout.Bands[0].Columns.Add("LineTotal",Util.LocaleText.GetLocalizedText("PurchaseOrderItem.Label.LineTotal")); } Grid.DisplayLayout.Bands[0].Columns["LineTotal"].DataType=typeof(decimal); Grid.DisplayLayout.Bands[0].Columns["LineTotal"].Format="c"; Grid.DisplayLayout.Bands[0].Columns["LineTotal"].CellAppearance.TextHAlign=HAlign.Right; Grid.DisplayLayout.Bands[0].Columns["LineTotal"].CellActivation=Activation.ActivateOnly; //___NetTotal___ if(Grid.DisplayLayout.Bands[0].Columns.Exists("NetTotal")) { Grid.DisplayLayout.Bands[0].Columns["NetTotal"].Header.Caption=Util.LocaleText.GetLocalizedText("PurchaseOrderItem.Label.NetTotal"); } else { Grid.DisplayLayout.Bands[0].Columns.Add("NetTotal",Util.LocaleText.GetLocalizedText("PurchaseOrderItem.Label.NetTotal")); } Grid.DisplayLayout.Bands[0].Columns["NetTotal"].DataType=typeof(decimal); Grid.DisplayLayout.Bands[0].Columns["NetTotal"].Format="c"; Grid.DisplayLayout.Bands[0].Columns["NetTotal"].CellAppearance.TextHAlign=HAlign.Right; Grid.DisplayLayout.Bands[0].Columns["NetTotal"].CellActivation=Activation.ActivateOnly; //------------------------------------------------------------------------------------------------- PopulateGridValueLists(); //Allow empty string entry on grid Util.SetTextColumnsNullable(Grid); //turn initialize row event back on Grid.EventManager.SetEnabled(GridEventIds.InitializeRow,true); } /// /// Populate the drop down lists inside the grid /// so they display and can select the correct underlying /// value /// private void PopulateGridValueLists() { //case 1039 //log.Debug("PopulateGridValueLists"); //Empty the existing value lists if present Grid.DisplayLayout.ValueLists.Clear(); //Need a selected vendor to be able to do this //If there isn't one, then bail if(cbVendorID.Value==null || (Guid)cbVendorID.Value==Guid.Empty) return; //Populate value lists ValueList vl=Grid.DisplayLayout.ValueLists.Add("Parts"); //case 29 PartList = PartPickList.GetAllParts(); Guid SelectedVendorID=(Guid)cbVendorID.Value; //PartList=PartPickList.GetAllPartsForVendor((Guid)cbVendorID.Value); if(PartList.Count==0) Util.PromptWithIconOKOnlyFromLocaleKey("PurchaseOrder.Label.UI.NoPartsForVendorWarning",MessageBoxIcon.Exclamation); foreach(PartPickList.PartPickListInfo ppi in PartList) { //case 29 if (!bPartsForAllVendors && ppi.WholeSalerID != SelectedVendorID && ppi.AlternativeWholeSalerID != SelectedVendorID) { //was it preselected so should be shown anyway? if (mPurchaseOrder.ListOfPartsSelected().Contains(ppi.ID)) { ValueListItem vi = vl.ValueListItems.Add(ppi.ID, ppi.DisplayName(Util.GlobalSettings.DefaultPartDisplayFormat)); vi.Appearance.ForeColor = System.Drawing.SystemColors.GrayText; } } else { //case 1962 - should exclude inactive parts if (ppi.Active || mPurchaseOrder.ListOfPartsSelected().Contains(ppi.ID)) vl.ValueListItems.Add(ppi.ID, ppi.DisplayName(Util.GlobalSettings.DefaultPartDisplayFormat)); } } vl.SortStyle = ValueListSortStyle.Ascending; //Bind value lists to correct columns in grid Grid.DisplayLayout.Bands[0].Columns["PartID"].ValueList=Grid.DisplayLayout.ValueLists["Parts"]; //Set column to dropdownlist style so that user can not type an invalid value in a cell //but must select from the list only Grid.DisplayLayout.Bands[0].Columns["PartID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList) Grid.DisplayLayout.Bands[0].Columns["PartID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend; //------------------------------------------------------------------------------------------------- //Warehouses vl=Grid.DisplayLayout.ValueLists.Add("Warehouses"); //NVCHANGED GenericNVList l=GenericNVList.GetList("aPartWarehouse","aID","aName",true,false,true); //Add initial empty guid value //so that records with no value yet entered in the //field will be shown as an empty string vl.ValueListItems.Add(Guid.Empty, Util.NoSelectionString);//Case 318 //Loop through the items in the list and put them //into the valuelist for(int x=0;x /// put custom field data into custom grid and show it if applicable /// private void FillCustomFieldGrid() { //case 1039 //log.Debug("FillCustomFieldGrid"); bShowCustomFields=Util.PrepareCustomFieldsGrid("PurchaseOrder",gridCustom); if(bShowCustomFields) { this.panelCustom.Visible=true; Util.GridFromCustomFields(mPurchaseOrder,gridCustom); } else { this.panelCustom.Visible=false; } } private void gridCustom_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { Util.GridToCustomFields(mPurchaseOrder,gridCustom); } #endregion #region DatePickerEditorButton private void dtOrderedDate_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { //Set the date to null or unchosen dtOrderedDate.Value=DBNull.Value; } #endregion #region Update restock / request buttons on toolbar private void RefreshRestockRequestToolBarButtons() { //Need a selected vendor to be able to do this //If there isn't one, then bail if(mPurchaseOrder.Status!= PurchaseOrderStatus.OpenNotYetOrdered || cbVendorID.Value==null || (Guid)cbVendorID.Value==Guid.Empty || (cbClientID.Value!=null && (Guid)cbClientID.Value!=Guid.Empty)) { this.mRestockList=null; this.mRequestList=null; } else { this.mRestockList= PartRestockRequiredByVendorList.GetList((Guid)cbVendorID.Value); this.mRequestList= PartWorkorderItemRequestByVendorList.GetList((Guid)cbVendorID.Value); } bool bShowRestockButton=true; if(bShowRestockButton && AyaBizUtils.Right("Object.PurchaseOrder")< (int)SecurityLevelTypes.ReadWrite) bShowRestockButton=false; if(mRestockList==null || mRestockList.Count==0) bShowRestockButton=false; if(bShowRestockButton && mPurchaseOrder.Status > PurchaseOrderStatus.OpenNotYetOrdered) bShowRestockButton=false; //Show if not on order or farther, no drop ship client id, and a valid restock list with items present tbManager.Tools["LT:PurchaseOrder.Label.UI.RestockList"].SharedProps.Visible=bShowRestockButton; bool bShowRequestButton=true; if(bShowRequestButton && AyaBizUtils.Right("Object.PurchaseOrder")< (int)SecurityLevelTypes.ReadWrite) bShowRequestButton=false; if(mRequestList==null || mRequestList.Count==0) bShowRequestButton=false; if(bShowRequestButton && mPurchaseOrder.Status > PurchaseOrderStatus.OpenNotYetOrdered) bShowRequestButton=false; //Show workorder item part request list button tbManager.Tools["LT:WorkorderItemPartRequest.Label.List"].SharedProps.Visible=bShowRequestButton; } #endregion #region Accelerator keys /// /// Case 37 /// /// /// /// protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //Short circuit: //Only process modified keystrokes (i.e. when a modifier like ctrl-alt-or shift is also //being held down if (ModifierKeys == Keys.None) return base.ProcessCmdKey(ref msg, keyData); switch (Util.HotKeys(keyData)) { //Close form case HotKeyAction.CloseForm: this.Close(); return true; } return base.ProcessCmdKey(ref msg, keyData); } #endregion bool bPartsForAllVendors = false; private void ckAllVendors_BeforeCheckStateChanged(object sender, CancelEventArgs e) { bPartsForAllVendors = !ckAllVendors.Checked; PopulateGridValueLists(); } private void Grid_ClickCellButton(object sender, CellEventArgs e) { //case 1105 if (e.Cell.Column.Key == "REMOVE") { Grid.DisplayLayout.ActiveRow.Delete(); } } } }