diff --git a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.Designer.cs b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.Designer.cs index 662873e..c567701 100644 --- a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.Designer.cs +++ b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.Designer.cs @@ -35,7 +35,7 @@ System.Windows.Forms.Label purchaseOrderDateLabel; System.Windows.Forms.Label contactNameLabel; System.Windows.Forms.Label label1; - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lineNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -168,8 +168,8 @@ // this.description.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.description.DataPropertyName = "Description"; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.description.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.description.DefaultCellStyle = dataGridViewCellStyle6; this.description.HeaderText = "Description"; this.description.Name = "description"; // @@ -327,7 +327,8 @@ this.txtOrderTotal.Name = "txtOrderTotal"; this.txtOrderTotal.Size = new System.Drawing.Size(134, 20); this.txtOrderTotal.TabIndex = 15; - this.txtOrderTotal.TextChanged += new System.EventHandler(this.orderTotalTextBox_TextChanged); + this.txtOrderTotal.Enter += new System.EventHandler(this.txtOrderTotal_Enter); + this.txtOrderTotal.Leave += new System.EventHandler(this.txtOrderTotal_Leave); // // txtClientReference // diff --git a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs index 2ddd226..adf331e 100644 --- a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs +++ b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs @@ -17,6 +17,7 @@ namespace BealeEngineering.Accounts bool newForm = false; bool editForm = false; Core.Data.Database.Client.ReadPurchaseOrderLineFacility lineFacility; + string totalAmount; public frmClientPurchaseOrder(string sqlConnectionString, Core.Model.Client.PurchaseOrder purchaseOrder) { @@ -42,7 +43,7 @@ namespace BealeEngineering.Accounts } } - public Core.Model.Client.PurchaseOrder PurchaseOrder + public Core.Model.Client.PurchaseOrder PurchaseOrder { get { @@ -75,9 +76,9 @@ namespace BealeEngineering.Accounts if (editForm) { - if (newForm == false) - { - btnDelete.Visible = true; + if (newForm == false) + { + btnDelete.Visible = true; } txtClientReference.ReadOnly = false; @@ -128,11 +129,6 @@ namespace BealeEngineering.Accounts // if (isNew == false) { btnDelete.Visible = true; } //} - private void orderTotalTextBox_TextChanged(object sender, EventArgs e) - { - - } - private void btnEdit_Click(object sender, EventArgs e) { if (editForm || newForm) @@ -181,7 +177,7 @@ namespace BealeEngineering.Accounts , MessageBoxButtons.OK); if (result == DialogResult.OK) { - + } } @@ -262,5 +258,36 @@ namespace BealeEngineering.Accounts } } } + + private void txtOrderTotal_Enter(object sender, EventArgs e) + { + if (txtOrderTotal != null) + { + totalAmount = txtOrderTotal.Text; + } + else + { + totalAmount = ""; + } + } + + private void txtOrderTotal_Leave(object sender, EventArgs e) + { + if (totalAmount != txtOrderTotal.Text) + { + if (dataGridView1.Rows.Count == 1 && dataGridView1.NewRowIndex == 0) + { + decimal amount = 0; + if (decimal.TryParse(txtOrderTotal.Text, out amount) && amount !=0) + { + var line = new Core.Model.Client.PurchaseOrder.PurchaseOrderLine(); + line.LineNumber = 1; + line.LineNetAmount = amount; + + orderLineListBindingSource.Add(line); + } + } + } + } } } diff --git a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx index 51a38f9..a95487a 100644 --- a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx +++ b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx @@ -144,6 +144,18 @@ 253, 29 + + True + + + True + + + 253, 29 + + + 37, 27 + 37, 27