Minor improvements

This commit is contained in:
2020-07-02 14:31:45 +01:00
parent c8c0d1ec25
commit 4084b88873
5 changed files with 61 additions and 42 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 dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = 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";
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.description.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.description.DefaultCellStyle = dataGridViewCellStyle1;
this.description.HeaderText = "Description";
this.description.Name = "description";
//

View File

@@ -103,32 +103,6 @@ namespace BealeEngineering.Accounts
}
}
//private void FormEditDisable()
//{
// editMode = false;
// txtClientReference.ReadOnly = true;
// txtOrderTotal.ReadOnly = true;
// pickerPurchaseOrderDateDate.Enabled = false;
// txtRequestorEmail.ReadOnly = true;
// dataGridView1.ReadOnly = true;
// linkUpdate.Visible = false;
// btnEdit.Text = "Edit";
// btnDelete.Visible = false;
//}
//private void FormEditEnable()
//{
// editMode = true;
// txtClientReference.ReadOnly = false;
// txtOrderTotal.ReadOnly = false;
// pickerPurchaseOrderDateDate.Enabled = true;
// txtRequestorEmail.ReadOnly = false;
// dataGridView1.ReadOnly = false;
// linkUpdate.Visible = true;
// btnEdit.Text = "Save";
// if (isNew == false) { btnDelete.Visible = true; }
//}
private void btnEdit_Click(object sender, EventArgs e)
{
if (editForm || newForm)
@@ -190,6 +164,32 @@ namespace BealeEngineering.Accounts
{
bool newValue = !purchaseOrder.IsClosed;
// facility check and challenge
if (newValue == true)
{
bool isFacility = false;
foreach (var line in purchaseOrder.OrderLineList)
{
if (lineFacility.Read(line.ClientPurchaseOrderLineID).GetValueOrDefault() != 0)
{
isFacility = true;
break;
}
}
if (isFacility)
{
var result = MessageBox.Show("There is currently facility remaining on this purchase order, are you sure you wish to close it?"
, "Close Purchase Order?"
, MessageBoxButtons.OKCancel);
if (result != DialogResult.OK)
{
return;
}
}
}
if (editForm || newForm)
{
purchaseOrder.IsClosed = newValue;

View File

@@ -144,18 +144,6 @@
<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>

View File

@@ -340,7 +340,7 @@ namespace BealeEngineering.Accounts
// invoice import time check
if (!assignInvoice.ImportTimeCheck())
{
var responce = MessageBox.Show("Last Xero invoice import was " + assignInvoice.LastImportDateTime
var responce = MessageBox.Show("Last Xero invoice import was " + assignInvoice.LastImportPeriod + "."
+ Environment.NewLine + Environment.NewLine + "Continue?"
, "Caution"
, MessageBoxButtons.OKCancel

View File

@@ -26,6 +26,37 @@ namespace BealeEngineering.Core.Logic.Sale
public DateTime LastImportDateTime { get; private set; } = default(DateTime);
public string LastImportPeriod
{
get
{
DateTime nowUtc = DateTime.UtcNow;
if (LastImportDateTime == default(DateTime) || nowUtc < LastImportDateTime)
{
return null;
}
TimeSpan diff = nowUtc - LastImportDateTime;
if (diff.Days >= 1)
{
return diff.Days + " day(s) ago";
}
else if (diff.Hours >= 1)
{
return diff.Hours + " hour(s) ago";
}
else if (diff.Minutes >= 1)
{
return diff.Minutes + " minute(s) ago";
}
else
{
return "less than 1 minute ago";
}
}
}
public void ToPurchaseOrderLine(string saleInvoiceNumber, int purchaseOrderLineId)
{
using (var scope = new TransactionScope())