diff --git a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.Designer.cs b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.Designer.cs
index c567701..15aa33f 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 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";
//
diff --git a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs
index adf331e..3ebcba6 100644
--- a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs
+++ b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.cs
@@ -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;
diff --git a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx
index a95487a..51a38f9 100644
--- a/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx
+++ b/BealeEngineering/BealeEngineering.Accounts/frmClientPurchaseOrder.resx
@@ -144,18 +144,6 @@
253, 29
-
- True
-
-
- True
-
-
- 253, 29
-
-
- 37, 27
-
37, 27
diff --git a/BealeEngineering/BealeEngineering.Accounts/frmMain.cs b/BealeEngineering/BealeEngineering.Accounts/frmMain.cs
index e440de6..1f26733 100644
--- a/BealeEngineering/BealeEngineering.Accounts/frmMain.cs
+++ b/BealeEngineering/BealeEngineering.Accounts/frmMain.cs
@@ -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
diff --git a/BealeEngineering/BealeEngineering.Core/Logic/Sale/SaleInvoiceAssign.cs b/BealeEngineering/BealeEngineering.Core/Logic/Sale/SaleInvoiceAssign.cs
index f57afbe..36b3bbc 100644
--- a/BealeEngineering/BealeEngineering.Core/Logic/Sale/SaleInvoiceAssign.cs
+++ b/BealeEngineering/BealeEngineering.Core/Logic/Sale/SaleInvoiceAssign.cs
@@ -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())