Improvement, auto fill first line of client purchase order

This commit is contained in:
2020-06-25 14:36:54 +01:00
parent 2ff88f80d5
commit c8c0d1ec25
3 changed files with 54 additions and 14 deletions

View File

@@ -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
//

View File

@@ -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);
}
}
}
}
}
}

View File

@@ -144,6 +144,18 @@
<metadata name="orderLineListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>253, 29</value>
</metadata>
<metadata name="facility.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ProjectWorkNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="orderLineListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>253, 29</value>
</metadata>
<metadata name="purchaseOrderBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>37, 27</value>
</metadata>
<metadata name="purchaseOrderBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>37, 27</value>
</metadata>