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 PurchaseOrderReceiptInfoForm. /// public class PurchaseOrderReceiptInfoForm : 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 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 Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom; private Infragistics.Win.Misc.UltraLabel lblExpectedReceiveDate; private Infragistics.Win.UltraWinGrid.UltraGrid Grid; private GZTW.WinForm.Controls.GZDateTimePicker dtReceivedDate; private System.Windows.Forms.HelpProvider helpProvider1; private Infragistics.Win.UltraWinEditors.UltraTextEditor edText2; private Infragistics.Win.Misc.UltraLabel lblText2; private Infragistics.Win.UltraWinEditors.UltraTextEditor edText1; private Infragistics.Win.Misc.UltraLabel lblText1; private System.ComponentModel.IContainer components; public PurchaseOrderReceiptInfoForm(bool ViewOnlyMode) { mViewOnlyMode=ViewOnlyMode; // // 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.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("PurchaseOrderReceiptEntryMenuBar"); 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 buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = 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.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 appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ListTool listTool2 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST"); this.ckIsDirty = new System.Windows.Forms.CheckBox(); this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this.panelLeft = new System.Windows.Forms.Panel(); this.dtReceivedDate = new GZTW.WinForm.Controls.GZDateTimePicker(); this.lblExpectedReceiveDate = new Infragistics.Win.Misc.UltraLabel(); this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); this.panelRight = new System.Windows.Forms.Panel(); this.edText2 = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblText2 = new Infragistics.Win.Misc.UltraLabel(); this.edText1 = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblText1 = new Infragistics.Win.Misc.UltraLabel(); this.panelBottom = new System.Windows.Forms.Panel(); this.Grid = new Infragistics.Win.UltraWinGrid.UltraGrid(); this.splitter1 = new System.Windows.Forms.Splitter(); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.helpProvider1 = new System.Windows.Forms.HelpProvider(); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit(); this.panelLeft.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dtReceivedDate)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit(); this.panelRight.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edText2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edText1)).BeginInit(); this.panelBottom.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Grid)).BeginInit(); this.SuspendLayout(); // // ckIsDirty // this.ckIsDirty.Location = new System.Drawing.Point(-336, 28); this.ckIsDirty.Name = "ckIsDirty"; this.ckIsDirty.Size = new System.Drawing.Size(205, 27); this.ckIsDirty.TabIndex = 5; // // 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; ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { popupMenuTool1, buttonTool1, buttonTool2, buttonTool3, buttonTool4}); ultraToolbar1.Text = "PurchaseOrderReceiptEntryMenuBar"; 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; buttonTool5.SharedPropsInternal.AccessibleDescription = "recorddd"; appearance1.Image = global::AyaNova.Resource1.SaveExit32; buttonTool5.SharedPropsInternal.AppearancesLarge.Appearance = appearance1; appearance2.Image = global::AyaNova.Resource1.SaveExit16; buttonTool5.SharedPropsInternal.AppearancesSmall.Appearance = appearance2; buttonTool5.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose"; appearance3.Image = global::AyaNova.Resource1.RecordHistory32; buttonTool6.SharedPropsInternal.AppearancesLarge.Appearance = appearance3; appearance4.Image = global::AyaNova.Resource1.RecordHistory16; buttonTool6.SharedPropsInternal.AppearancesSmall.Appearance = appearance4; buttonTool6.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory"; buttonTool7.SharedPropsInternal.Caption = "LT:UI.Command.Save"; buttonTool7.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; buttonTool9.SharedPropsInternal.Caption = "LT:UI.Command.Close"; buttonTool9.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.Ordered"; buttonTool11.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; controlContainerTool1.SharedPropsInternal.Caption = "LT:UI.Command.Closed"; controlContainerTool1.SharedPropsInternal.Width = 150; listTool1.DisplayCheckmark = false; appearance5.Image = global::AyaNova.Resource1.Print32; popupMenuTool2.SharedPropsInternal.AppearancesLarge.Appearance = appearance5; appearance6.Image = global::AyaNova.Resource1.Print16; popupMenuTool2.SharedPropsInternal.AppearancesSmall.Appearance = appearance6; popupMenuTool2.SharedPropsInternal.Caption = "LT:UI.Toolbar.Print"; popupMenuTool2.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars; popupMenuTool2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { listTool2}); this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool5, buttonTool6, buttonTool7, buttonTool9, buttonTool11, controlContainerTool1, listTool1, popupMenuTool2}); this.tbManager.UseLargeImagesOnToolbar = true; this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick); // // panelLeft // this.panelLeft.Controls.Add(this.dtReceivedDate); this.panelLeft.Controls.Add(this.lblExpectedReceiveDate); this.panelLeft.Dock = System.Windows.Forms.DockStyle.Left; this.panelLeft.Location = new System.Drawing.Point(0, 43); this.panelLeft.Name = "panelLeft"; this.panelLeft.Size = new System.Drawing.Size(300, 38); this.panelLeft.TabIndex = 96; // // dtReceivedDate // this.dtReceivedDate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dtReceivedDate.GZEnabled = true; this.dtReceivedDate.GZReadOnly = false; this.dtReceivedDate.Location = new System.Drawing.Point(10, 28); this.dtReceivedDate.Name = "dtReceivedDate"; this.dtReceivedDate.Size = new System.Drawing.Size(201, 24); this.dtReceivedDate.TabIndex = 164; // // lblExpectedReceiveDate // this.lblExpectedReceiveDate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblExpectedReceiveDate.Location = new System.Drawing.Point(10, 9); this.lblExpectedReceiveDate.Name = "lblExpectedReceiveDate"; this.lblExpectedReceiveDate.Size = new System.Drawing.Size(259, 19); this.lblExpectedReceiveDate.TabIndex = 163; this.lblExpectedReceiveDate.Tag = ""; this.lblExpectedReceiveDate.Text = "LT:PurchaseOrderReceipt.Label.ReceivedDate"; // // ErrorProvider // this.ErrorProvider.ContainerControl = this; // // panelRight // this.panelRight.Controls.Add(this.edText2); this.panelRight.Controls.Add(this.lblText2); this.panelRight.Controls.Add(this.edText1); this.panelRight.Controls.Add(this.lblText1); this.panelRight.Dock = System.Windows.Forms.DockStyle.Left; this.panelRight.Location = new System.Drawing.Point(300, 43); this.panelRight.Name = "panelRight"; this.panelRight.Size = new System.Drawing.Size(300, 38); this.panelRight.TabIndex = 101; // // edText2 // this.edText2.Location = new System.Drawing.Point(188, 44); this.edText2.MaxLength = 255; this.edText2.Name = "edText2"; this.edText2.Size = new System.Drawing.Size(106, 24); this.edText2.TabIndex = 141; // // lblText2 // this.lblText2.Location = new System.Drawing.Point(7, 48); this.lblText2.Name = "lblText2"; this.lblText2.Size = new System.Drawing.Size(106, 19); this.lblText2.TabIndex = 142; this.lblText2.Tag = ""; this.lblText2.Text = "LT:PurchaseOrderReceipt.Label.Text2"; this.lblText2.WrapText = false; // // edText1 // this.edText1.Location = new System.Drawing.Point(188, 14); this.edText1.MaxLength = 255; this.edText1.Name = "edText1"; this.edText1.Size = new System.Drawing.Size(106, 24); this.edText1.TabIndex = 139; // // lblText1 // this.lblText1.Location = new System.Drawing.Point(7, 18); this.lblText1.Name = "lblText1"; this.lblText1.Size = new System.Drawing.Size(106, 19); this.lblText1.TabIndex = 140; this.lblText1.Tag = ""; this.lblText1.Text = "LT:PurchaseOrderReceipt.Label.Text1"; this.lblText1.WrapText = false; // // panelBottom // this.panelBottom.Controls.Add(this.Grid); this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelBottom.Location = new System.Drawing.Point(0, 92); this.panelBottom.Name = "panelBottom"; this.panelBottom.Size = new System.Drawing.Size(602, 434); this.panelBottom.TabIndex = 102; // // Grid // this.Grid.Cursor = System.Windows.Forms.Cursors.Default; 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(602, 434); this.Grid.TabIndex = 116; this.Grid.Tag = ""; this.Grid.Text = "LT:O.PurchaseOrderReceiptItem"; this.Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.Grid_InitializeRow); this.Grid.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.Grid_ClickCellButton); this.Grid.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(this.Grid_BeforeCellUpdate); this.Grid.MouseEnterElement += new Infragistics.Win.UIElementEventHandler(this.Grid_MouseEnterElement); this.Grid.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Grid_KeyUp); // // 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, 81); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(602, 11); this.splitter1.TabIndex = 103; this.splitter1.TabStop = false; // // _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left // this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.Name = "_PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left"; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 483); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager; // // _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right // this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(602, 43); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.Name = "_PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right"; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 483); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager; // // _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top // this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.Name = "_PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top"; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(602, 43); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager; // // _PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom // this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 526); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.Name = "_PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom"; this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(602, 0); this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager; // // PurchaseOrderReceiptInfoForm // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(602, 526); 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._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Left); this.Controls.Add(this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Right); this.Controls.Add(this._PurchaseOrderReceiptInfoForm_Toolbars_Dock_Area_Bottom); this.Controls.Add(this._PurchaseOrderReceiptInfoForm_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 = "PurchaseOrderReceiptInfoForm"; this.helpProvider1.SetShowHelp(this, true); this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.Closing += new System.ComponentModel.CancelEventHandler(this.PurchaseOrderReceiptInfoForm_Closing); this.Load += new System.EventHandler(this.PurchaseOrderReceiptInfoForm_Load); this.SizeChanged += new System.EventHandler(this.PurchaseOrderReceiptInfoForm_SizeChanged); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit(); this.panelLeft.ResumeLayout(false); this.panelLeft.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dtReceivedDate)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit(); this.panelRight.ResumeLayout(false); this.panelRight.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.edText2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edText1)).EndInit(); this.panelBottom.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.Grid)).EndInit(); this.ResumeLayout(false); } #endregion // __ _ _ ___ ____ __ __ __ __ __ ___ ___ // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _) // ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _) // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___) // #region Form Load / Close //variable to hold user form settings //UIUserFormSetting mFormSetting; //Variable to hold part prices / cost / tax codes //used in calculating line totals etc PartPickList PartList; //Variable to hold whether form is read only or not //this is because purchase order receipts can not be edited once //they have been saved //this is set in constructor private bool mViewOnlyMode=false; //case 1873 read only warehouse fix temporary reversal for people who need to fix a previous change of warehouse fuckup private bool mAllowChangeOfWarehouse = false; /// /// Prepare the form /// /// /// private void PurchaseOrderReceiptInfoForm_Load(object sender, System.EventArgs e) { //case 1873 if(((Control.ModifierKeys & Keys.Shift) != 0) /*Shift key held down*/) mAllowChangeOfWarehouse = true; // // helpProvider1 // this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "purchase_order_receipts.htm"; //case 1039 //log.Debug("PurchaseOrderReceiptInfoForm_Load"); Cursor.Current = Cursors.WaitCursor; this.Visible=false; this.Icon = Resource1.PurchaseOrderReceipt16icon; //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.PurchaseOrderReceipt"))); this.Close(); return; } //Add serial number collections if editing if(!mViewOnlyMode) { foreach(PurchaseOrderReceiptItem ri in mPurchaseOrderReceipt.Items) { //see if this part is serialized Part p=Part.GetItem(ri.PartID); if(p.TrackSerialNumber) { //if it is, add MaxReceivable quantity of serial number items to this item for(int x=0;x0) r.Cells["Serialized"].Value=true; else r.Cells["Serialized"].Value=false; } //turn off pencil icon showing //that grid is in an edited state //caused by above unbound cell editing Grid.UpdateData(); } int Split1 = 0; Util.LoadFormCustomization("PurchaseOrderReceiptInfo", this, tbManager, false, ref Split1); splitter1.SplitPosition = Split1; Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.PurchaseOrderReceipt, mPurchaseOrderReceipt, 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"], PurchaseOrderReceiptList.ReportKey, PurchaseOrderReceiptDetailedReportData.ReportKey); } Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810 Util.Localize(this); Cursor.Current = Cursors.Default; Application.Idle+= new EventHandler(Application_Idle); Util.LocalizeGrid(Grid); //TODO: Restrict UI should be the last thing called //on form load, or at least it should be after loading grid menu and form defaults //from database //restrict UI based on security settings RestrictUI(); //Only show expansion indicators for items //that have children (default is to show for all because it's expensive to //check to see if each one has children, but we have a small collection so it //doesn't matter as much) Grid.DisplayLayout.Override.ExpansionIndicator=ShowExpansionIndicator.CheckOnDisplay; RefreshGridRows(); 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; /// /// Save form layout and grid layout for next time /// /// /// private void PurchaseOrderReceiptInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //case 1039 //log.Debug("PurchaseOrderReceiptInfoForm_Closing"); //TODO: if not mViewOnlyMode: //Remove zero quantity parts, ensure all serial numbers entered etc if(!mViewOnlyMode && !bClosingHandled) { //Save record if necessary //User may opt to not cancel exit if(!RecordUpdate(RecordActionType.PromptToSave) ) { e.Cancel=true; return; } } Application.Idle-= new EventHandler(Application_Idle); Util.SaveGridLayout("PurchaseOrderReceiptItems","","",Grid); Util.SaveFormCustomization("PurchaseOrderReceiptInfo", this, tbManager, false, splitter1.SplitPosition); } #endregion #region Form Sizing /// /// Adjust the layout proportionately as it's sized by user /// /// /// private void PurchaseOrderReceiptInfoForm_SizeChanged(object sender, System.EventArgs e) { //case 1039 //log.Debug("PurchaseOrderReceiptInfoForm_SizeChanged"); int nWidth=0; int nHeight=(this.DisplayRectangle.Height/3)*2; nWidth=this.DisplayRectangle.Width/2; this.panelLeft.Width=nWidth; this.panelRight.Width=nWidth; this.panelLeft.Height=(this.DisplayRectangle.Height/3)-40; this.panelRight.Height=(this.DisplayRectangle.Height/3)-40; this.panelBottom.Height=nHeight; //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; lblText1.Width = nLeftWidth; edText1.Left = nLeftWidth + 8; edText1.Width = nRightWidth; lblText2.Width = nLeftWidth; edText2.Left = nLeftWidth + 8; edText2.Width = nRightWidth; } #endregion #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(mPurchaseOrderReceipt.Creator,mPurchaseOrderReceipt.Modifier,mPurchaseOrderReceipt.Created,mPurchaseOrderReceipt.Modified); RH.ShowDialog(); RH.Dispose(); break; case "LT:UI.Command.Save": // ButtonTool RecordUpdate(RecordActionType.SaveOnly); break; case "LT:UI.Command.Close": // ButtonTool this.Close(); break; case "REPORTLIST": { //case 3736 RecordUpdate(RecordActionType.PromptToSave); if(Util.ReportHandleToolClickIsSummary(e.Tool)) Util.ReportHandleToolClick(e.Tool,PurchaseOrderReceiptList.ReportKey, PurchaseOrderReceiptList.GetListForSingleItem(this.mPurchaseOrderReceipt.ID)); else { Util.ReportHandleToolClick(e.Tool,PurchaseOrderReceiptDetailedReportData.ReportKey, PurchaseOrderReceiptDetailedReportData.GetItem(this.mPurchaseOrderReceipt.ID)); } Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], PurchaseOrderReceiptList.ReportKey, PurchaseOrderReceiptDetailedReportData.ReportKey); break; } } } #endregion Toolbar menu items #region Form UI / Business object synchronization /// /// used on load of form and when adding parts from lists /// to force a recalc of all taxes etc /// private void RefreshGridRows() { //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() { //TODO: Don't allow record history on new (unsaved) record //Problem is that even after a save the record history is not retrieved //so the call to Created.ToString (for example) is null reference exception //tbManager.Tools["LT:UI.Command.RecordHistory"].SharedProps.Enabled=!mPurchaseOrderReceipt.IsNew; //so for now... tbManager.Tools["LT:UI.Command.RecordHistory"].SharedProps.Enabled=mViewOnlyMode; } /// /// 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) { SyncUI(); } #endregion #region Access rights /// /// 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()); bool bDelete=AyaBizUtils.Right("Object.PurchaseOrder")== (int)SecurityLevelTypes.ReadWriteDelete; bool bReadOnly=AyaBizUtils.Right("Object.PurchaseOrder") < (int)SecurityLevelTypes.ReadWrite; //Changed: 06-July-2006 if (mViewOnlyMode) { bReadOnly = true; bDelete = false; } //tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=bDelete; if(bDelete) { Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.True; } else { Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; } //Grids if(bReadOnly) { Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.No; Grid.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.False; } else { Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom; Grid.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.True; } tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible=!bReadOnly; //tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Visible=!bReadOnly; tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible=!bReadOnly; //Case 181 tbManager.Tools["LT:UI.Command.Close"].SharedProps.Visible=false; //DISABLE EDITABLE CONTROLS dtReceivedDate.Enabled=!bReadOnly; edText1.Enabled = !bReadOnly; edText2.Enabled = !bReadOnly; } #endregion #region Form DataBinding and BrokenRules handling /// /// Bind controls to business objects /// private void DataBind() { //case 1039 //log.Debug("DataBind"); //Subscribe to broken rules changed event OnBrokenRulesChanged //mPurchaseOrderReceipt.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged); //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); //=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-= //edit boxes Util.BindField(edText1, "Text", mPurchaseOrderReceipt, "Text1"); Util.BindField(edText2, "Text", mPurchaseOrderReceipt, "Text2"); //Grids Util.BindField(Grid,"DataSource",mPurchaseOrderReceipt,"Items"); //Dates Util.BindField(dtReceivedDate,"Value", mPurchaseOrderReceipt, "ReceivedDate"); //Bind IsDirty property to hidden checkbox to //ensure isdirtychanged event is available //to data binding infrastructure Util.BindField(ckIsDirty,"Checked",mPurchaseOrderReceipt,"IsDirty"); //Setup initial link to broken rules //OnBrokenRulesChanged(null,null); //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,mPurchaseOrderReceipt,ErrorProvider); // // } #endregion #region GridBrokenRuleFeedBack // /// // /// Show error icons if rules broken // /// // /// // /// // private void Grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) // { // Util.GridShowBrokenRulesErrorIcons(e); // // } //Tool tip to use for displaying broken rules private System.Windows.Forms.ToolTip tipError = new System.Windows.Forms.ToolTip(); /// /// Display broken rules in tool tip if hovering over /// error icon /// /// /// private void Grid_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e) { Util.GridShowBrokenRulesToolTip(e,tipError); } #endregion #region Business object editing / adding / deletion related code private PurchaseOrderReceipt mPurchaseOrderReceipt; /// /// PurchaseOrderReceipt record to display /// set by caller /// public PurchaseOrderReceipt PurchaseOrderReceiptToEdit { get { return mPurchaseOrderReceipt; } set { mPurchaseOrderReceipt=value; //Get a part list of costs and prices for later calcs //case 1145 (due to order any part for any vendor change need all parts now) PartList = PartPickList.GetAllParts(); //PartList=PartPickList.GetAllPartsForVendor(mPurchaseOrderReceipt.VendorID); } } //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 lblExpectedReceiveDate.Focus(); //Added by John Dec 2 2004 (catches change in grid when above is non focusable) Grid.UpdateData(); switch(SaveType) { // case RecordActionType.SaveAndExit: //warn user save is permanent, no going back... if(Util.PromptYesNoCancelFromLocaleKey("PurchaseOrderItem.Label.UI.SaveWarning")!=DialogResult.Yes) return false; //Save if necessary and exit if(mPurchaseOrderReceipt.IsSavable) { mPurchaseOrderReceipt.ApplyEdit(); mPurchaseOrderReceipt.Save(); bClosingHandled=true; mbChangesMade=true; this.Close(); return true; } if(mPurchaseOrderReceipt.IsDirty)//dirty and unsaveable due to broken rules { //expand all serial number rows //to point user in direction of broken rule //because that's the only possible broken rule //on a receipt Grid.Rows.ExpandAll(false); 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.SaveOnly: if(mPurchaseOrderReceipt.IsSavable) { //warn user save is permanent, no going back... if(Util.PromptYesNoCancelFromLocaleKey("PurchaseOrderItem.Label.UI.SaveWarning")!=DialogResult.Yes) return false; mPurchaseOrderReceipt.ApplyEdit(); mPurchaseOrderReceipt=(PurchaseOrderReceipt)mPurchaseOrderReceipt.Save(); DataBind(); mbChangesMade=true; mViewOnlyMode=true; RestrictUI(); return true; } return true; case RecordActionType.PromptToSave: //Prompt to save and save if //required if(mPurchaseOrderReceipt.IsDirty) { DialogResult dr=Util.PromptForSave(); if(dr==DialogResult.Cancel) { //Cancel return false; } if(dr==DialogResult.Yes) { //Save before exit //warn user save is permanent, no going back... if(Util.PromptYesNoCancelFromLocaleKey("PurchaseOrderItem.Label.UI.SaveWarning")!=DialogResult.Yes) return false; if(mPurchaseOrderReceipt.IsSavable) { mPurchaseOrderReceipt.ApplyEdit(); mPurchaseOrderReceipt.Save(); mbChangesMade=true; return true; } if(mPurchaseOrderReceipt.IsDirty)//dirty and unsaveable due to broken rules { //expand all serial number rows //to point user in direction of broken rule //because that's the only possible broken rule //on a receipt Grid.Rows.ExpandAll(false); if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { return true; } else return false; } } } return true; } return false; } /// /// ///Creates a new PurchaseOrderReceipt record and opens it for editing /// private void AddNewPurchaseOrderReceipt() { //case 1039 //log.Debug("AddNewPurchaseOrderReceipt"); try { mPurchaseOrderReceipt=PurchaseOrderReceipt.NewItem(); //mPurchaseOrderReceipt.BeginEdit(); DataBind(); } catch(Exception ex) { //log.Error("AddNewPurchaseOrderReceipt",ex); MessageBox.Show(ex.Message+"\r\n"+ex.Source); } } #endregion #region Grid Events /// /// Display workorder button if item from workorder /// Calculate taxes and line totals ..etc /// /// /// private void Grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if(e.Row.Band.Index==0) { if((decimal)e.Row.Cells["ReceiptCost"].Value<1) { e.Row.Cells["ReceiptCost"].Appearance.ForeColor=System.Drawing.SystemColors.HighlightText; e.Row.Cells["ReceiptCost"].Appearance.BackColor=System.Drawing.SystemColors.Highlight; } else { e.Row.Cells["ReceiptCost"].Appearance.ForeColor=System.Drawing.SystemColors.WindowText; e.Row.Cells["ReceiptCost"].Appearance.BackColor=System.Drawing.SystemColors.Window; } if(e.Row.Cells["ClickablePart"].Value==null) { Guid PartID=(Guid)e.Row.Cells["PartID"].Value; PartPickList.PartPickListInfo ppi=PartList[PartID]; string strPart=ppi.DisplayName(Util.GlobalSettings.DefaultPartDisplayFormat); e.Row.Cells["ClickablePart"].Value=new GridNameValueCellItem((Guid)e.Row.Cells["PartID"].Value,strPart,RootObjectTypes.Part); } // //Don't display 0 for workorder number when there is no workorder number // if(e.Row.Cells["WorkorderNumber"].Value !=null && (int)e.Row.Cells["WorkorderNumber"].Value==0) // { // e.Row.Cells["WorkorderNumber"].Hidden=true; // } } Util.GridShowBrokenRulesErrorIcons(e); } private void Grid_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { //Don't allow entry of values greater than maximum on po //and don't allow entry of negative values if("QuantityReceived"==e.Cell.Column.Key) { //negative? if((decimal)e.NewValue<0) { e.Cancel=true; } else { //More than is outstanding on po? if((decimal)e.NewValue>(decimal)e.Cell.Row.Cells["MaxReceivable"].Value) { e.Cancel=true; } } if(e.Cancel==true) { MessageBox.Show(Util.LocaleText.GetLocalizedText("PurchaseOrderReceiptItem.Label.QuantityReceived.ErrorInvalid")); return; } //Ok, a valid quantity change was made, so see if the number //of serial number items needs to be adjusted //Is it serialized? if((bool)e.Cell.Row.Cells["Serialized"].Value==false) return; //Get the receipt item... PurchaseOrderReceiptItem ri = mPurchaseOrderReceipt.Items[((Guid)e.Cell.Row.Cells["ID"].Value).ToString()]; //Is it unchanged? if(ri.SerialNumbers.Count==(decimal)e.NewValue) return; //Is the new value received more than the original //number of serialnumber items added to the receipt item? //If so more serialnumber items need to be added to the receipt item if(ri.SerialNumbers.Count<(decimal)e.NewValue) { //add more decimal dAdd=(decimal)e.NewValue-ri.SerialNumbers.Count; for(int x=0;x(decimal)e.NewValue) { //remove decimal dRemove=ri.SerialNumbers.Count-(decimal)e.NewValue; for(int x=0;x /// 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+"}"; } private void Grid_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { EditRecord((GridNameValueCellItem)e.Cell.Value,e.Cell.Row.Index); } /// /// Handle a key down in addition to a mouse click /// this allows user to hit enter to select from the grid /// /// /// private void Grid_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if(e.KeyCode==Keys.Space || e.KeyCode==Keys.Enter) { UltraGridCell c = Grid.ActiveCell; if(c!=null) { if(c.Value.GetType().ToString()=="GZTW.AyaNova.BLL.GridNameValueCellItem") { e.Handled=true; EditRecord((GridNameValueCellItem)c.Value,c.Row.Index); } } } } /// /// Open record for editing then update grid afterwards /// /// /// private void EditRecord(GridNameValueCellItem i, int nRowToScrollTo) { //Make sure there is something to edit if(i==null || i.Value==Guid.Empty) return; // bool bRefreshGrid= Util.EditRecord(i.RootObjectType,i.Value); // if(bRefreshGrid) // { // Grid.BeginUpdate(); // BindGrid(false); // if(nRowToScrollTo /// Get grid ready /// private void InitializeGrid() { //case 1039 //log.Debug("InitializeGrid"); //prevent initialize 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.No; Util.GridPreLocalize("PurchaseOrderReceiptItem",Grid.DisplayLayout.Bands[0]); Util.GridPreLocalize("PurchaseOrderReceiptItem",Grid.DisplayLayout.Bands[1]); Util.FetchGridLayout("PurchaseOrderReceiptItems","",Grid); Util.GridHideEditableBizObjectInternalFields(Grid); //hide band 0 items Grid.DisplayLayout.Bands[0].Columns["PurchaseOrderID"].Hidden=true; Grid.DisplayLayout.Bands[0].Columns["PurchaseOrderReceiptID"].Hidden=true; Grid.DisplayLayout.Bands[0].Columns["PurchaseOrderItemID"].Hidden=true; //Hide band 1 (all but serial number) items //This is bombing, not sure why it's there as there is no //"workorderID field, but there is a workordernumber...??? //Grid.DisplayLayout.Bands[1].Columns["WorkorderID"].Hidden=true; Grid.DisplayLayout.Bands[1].Columns["DateConsumed"].Hidden=true; Grid.DisplayLayout.Bands[1].Columns["AdjustmentID"].Hidden=true; Grid.DisplayLayout.Bands[1].Columns["PurchaseOrderReceiptItemID"].Hidden=true; Grid.DisplayLayout.Bands[1].Columns["PartWarehouseID"].Hidden=true;//.CellActivation=Activation.ActivateOnly; Grid.DisplayLayout.Bands[1].Columns["DateReceived"].Hidden=true; Grid.DisplayLayout.Bands[1].Columns["PartID"].Hidden=true; Grid.DisplayLayout.Bands[0].Columns["QuantityReceived"].Format = "g29"; Grid.DisplayLayout.Bands[0].Columns["PartWarehouseID"].Header.Caption=Util.LocaleText.GetLocalizedText("O.PartWarehouse"); Grid.DisplayLayout.Bands[1].Columns["WorkorderItemPartID"].Hidden=true;//.Header.Caption=Util.LocaleText.GetLocalizedText("O.Part"); Grid.DisplayLayout.Bands[1].Columns["Available"].Hidden=true;//.Header.Caption=Util.LocaleText.GetLocalizedText("PartSerial.Label.Available"); //------------------------------------------------------------------------------------------------- //PartID - clickable cell button //re-set locale text if present because user may have changed locale if(Grid.DisplayLayout.Bands[0].Columns.Exists("ClickablePart")) { Grid.DisplayLayout.Bands[0].Columns["ClickablePart"].Header.Caption=Util.LocaleText.GetLocalizedText("O.Part"); } else { Grid.DisplayLayout.Bands[0].Columns.Add("ClickablePart",Util.LocaleText.GetLocalizedText("O.Part")); } Grid.DisplayLayout.Bands[0].Columns["ClickablePart"].DataType=typeof(GridNameValueCellItem); Grid.DisplayLayout.Bands[0].Columns["ClickablePart"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Button; //------------------------------------------------------------------------------------------------- //Activation Grid.DisplayLayout.Bands[0].Columns["PartID"].Hidden=true; //COST Grid.DisplayLayout.Bands[0].Columns["ReceiptCost"].Format="c"; Grid.DisplayLayout.Bands[0].Columns["ReceiptCost"].CellAppearance.TextHAlign=HAlign.Right; //------------------------------------------------------------------------------------------------- //MaxReceivable hidden column if(!Grid.DisplayLayout.Bands[0].Columns.Exists("MaxReceivable")) Grid.DisplayLayout.Bands[0].Columns.Add("MaxReceivable"); Grid.DisplayLayout.Bands[0].Columns["MaxReceivable"].DataType=typeof(decimal); Grid.DisplayLayout.Bands[0].Columns["MaxReceivable"].Hidden=true; //------------------------------------------------------------------------------------------------- //Serialized hidden column - used to ensure that serialized items get serial numbers entered //re-set locale text if present because user may have changed locale if(!Grid.DisplayLayout.Bands[0].Columns.Exists("Serialized")) Grid.DisplayLayout.Bands[0].Columns.Add("Serialized"); Grid.DisplayLayout.Bands[0].Columns["Serialized"].DataType=typeof(bool); Grid.DisplayLayout.Bands[0].Columns["Serialized"].Hidden=true; //------------------------------------------------------------------------------------------------- PopulateGridValueLists(); //Allow empty string entry on grid Util.SetTextColumnsNullable(Grid); //case 1873 - lock warehouse column (if shift key not held down on open), it should not be editable at this point if(!mAllowChangeOfWarehouse) Grid.DisplayLayout.Bands[0].Columns["PartWarehouseID"].CellActivation = Activation.ActivateOnly; //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(); //WAREHOUSELIST //Grid.DisplayLayout.Bands[1].Columns["PartWarehouseID"].CellActivation=Activation.ActivateOnly; #region ======= Warehouses value list ======= //------------------------------------------------------------------------------------------------- //Warehouses ValueList vlWH=Grid.DisplayLayout.ValueLists.Add("Warehouses"); //NVCHANGED //GenericNVList l=GenericNVList.GetList("aPartWarehouse","aID","aName",true,false); //Add initial empty guid value //so that records with no value yet entered in the //field will be shown as an empty string vlWH.ValueListItems.Add(Guid.Empty, Util.NoSelectionString);//Case 318 //case 640 PartWarehousePickList warehouselist = PartWarehousePickList.GetActiveOnlyListWithExceptions(mPurchaseOrderReceipt.ListOfPartWarehousesSelected()); foreach (PartWarehousePickList.PartWarehousePickListInfo ui in warehouselist) { if (ui.Active == true) { vlWH.ValueListItems.Add(ui.ID, ui.Name); } else { ValueListItem vi = vlWH.ValueListItems.Add(ui.ID, ui.Name); vi.Appearance.ForeColor = System.Drawing.SystemColors.GrayText; } } ////Loop through the items in the list and put them ////into the valuelist //for(int x=0;x /// 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 } }