Invoice due date bug fix

This commit is contained in:
2020-02-21 17:21:18 +00:00
parent 29325398f3
commit 087950e141
8 changed files with 75 additions and 64 deletions

View File

@@ -51,7 +51,7 @@ namespace BealeEngineering.Accounts
{
if (tabControl1.SelectedTab == tabControl1.TabPages["tabClientPoAllocation"] && isDirtyInvoiceAllocation)
{
btnRefreshInvAllocation_Click(null, null);
RefreshTabInvoiceAllocation();
}
else if (tabControl1.SelectedTab == tabControl1.TabPages["tabSaleInvoice"] && isDirtySaleInvoice)
{

View File

@@ -42,7 +42,6 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.contactNameTextBox = new System.Windows.Forms.TextBox();
this.bsInvoice = new System.Windows.Forms.BindingSource(this.components);
this.currencyCodeTextBox = new System.Windows.Forms.TextBox();
this.dueDateDateTimePicker = new System.Windows.Forms.DateTimePicker();
this.invoiceDateDateTimePicker = new System.Windows.Forms.DateTimePicker();
@@ -53,6 +52,9 @@
this.statusTextBox = new System.Windows.Forms.TextBox();
this.invoiceLineListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.invoiceLineListDataGridView = new System.Windows.Forms.DataGridView();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.taxTotalTextBox = new System.Windows.Forms.TextBox();
this.bsInvoice = new System.Windows.Forms.BindingSource(this.components);
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -60,8 +62,6 @@
this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.taxTotalTextBox = new System.Windows.Forms.TextBox();
contactNameLabel = new System.Windows.Forms.Label();
currencyCodeLabel = new System.Windows.Forms.Label();
dueDateLabel = new System.Windows.Forms.Label();
@@ -72,13 +72,13 @@
saleInvoiceNumberLabel = new System.Windows.Forms.Label();
statusLabel = new System.Windows.Forms.Label();
taxTotalLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.bsInvoice)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.invoiceLineListBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.invoiceLineListDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bsInvoice)).BeginInit();
this.SuspendLayout();
//
// contactNameLabel
@@ -179,10 +179,6 @@
this.contactNameTextBox.Size = new System.Drawing.Size(200, 20);
this.contactNameTextBox.TabIndex = 1;
//
// bsInvoice
//
this.bsInvoice.DataSource = typeof(BealeEngineering.Core.Model.Sale.Invoice);
//
// currencyCodeTextBox
//
this.currencyCodeTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "CurrencyCode", true));
@@ -285,6 +281,57 @@
this.invoiceLineListDataGridView.Size = new System.Drawing.Size(800, 296);
this.invoiceLineListDataGridView.TabIndex = 18;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(taxTotalLabel);
this.splitContainer1.Panel1.Controls.Add(this.taxTotalTextBox);
this.splitContainer1.Panel1.Controls.Add(this.saleInvoiceNumberTextBox);
this.splitContainer1.Panel1.Controls.Add(this.contactNameTextBox);
this.splitContainer1.Panel1.Controls.Add(statusLabel);
this.splitContainer1.Panel1.Controls.Add(contactNameLabel);
this.splitContainer1.Panel1.Controls.Add(this.statusTextBox);
this.splitContainer1.Panel1.Controls.Add(this.currencyCodeTextBox);
this.splitContainer1.Panel1.Controls.Add(saleInvoiceNumberLabel);
this.splitContainer1.Panel1.Controls.Add(currencyCodeLabel);
this.splitContainer1.Panel1.Controls.Add(this.dueDateDateTimePicker);
this.splitContainer1.Panel1.Controls.Add(referenceLabel);
this.splitContainer1.Panel1.Controls.Add(dueDateLabel);
this.splitContainer1.Panel1.Controls.Add(this.referenceTextBox);
this.splitContainer1.Panel1.Controls.Add(this.invoiceDateDateTimePicker);
this.splitContainer1.Panel1.Controls.Add(isCreditNoteLabel);
this.splitContainer1.Panel1.Controls.Add(invoiceDateLabel);
this.splitContainer1.Panel1.Controls.Add(this.isCreditNoteCheckBox);
this.splitContainer1.Panel1.Controls.Add(this.invoiceTotalTextBox);
this.splitContainer1.Panel1.Controls.Add(invoiceTotalLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.invoiceLineListDataGridView);
this.splitContainer1.Size = new System.Drawing.Size(800, 475);
this.splitContainer1.SplitterDistance = 175;
this.splitContainer1.TabIndex = 19;
//
// taxTotalTextBox
//
this.taxTotalTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "TaxTotal", true));
this.taxTotalTextBox.Location = new System.Drawing.Point(578, 50);
this.taxTotalTextBox.Name = "taxTotalTextBox";
this.taxTotalTextBox.Size = new System.Drawing.Size(100, 20);
this.taxTotalTextBox.TabIndex = 19;
//
// bsInvoice
//
this.bsInvoice.DataSource = typeof(BealeEngineering.Core.Model.Sale.Invoice);
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.DataPropertyName = "LineNumber";
@@ -349,53 +396,6 @@
this.dataGridViewTextBoxColumn9.ReadOnly = true;
this.dataGridViewTextBoxColumn9.Width = 50;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(taxTotalLabel);
this.splitContainer1.Panel1.Controls.Add(this.taxTotalTextBox);
this.splitContainer1.Panel1.Controls.Add(this.saleInvoiceNumberTextBox);
this.splitContainer1.Panel1.Controls.Add(this.contactNameTextBox);
this.splitContainer1.Panel1.Controls.Add(statusLabel);
this.splitContainer1.Panel1.Controls.Add(contactNameLabel);
this.splitContainer1.Panel1.Controls.Add(this.statusTextBox);
this.splitContainer1.Panel1.Controls.Add(this.currencyCodeTextBox);
this.splitContainer1.Panel1.Controls.Add(saleInvoiceNumberLabel);
this.splitContainer1.Panel1.Controls.Add(currencyCodeLabel);
this.splitContainer1.Panel1.Controls.Add(this.dueDateDateTimePicker);
this.splitContainer1.Panel1.Controls.Add(referenceLabel);
this.splitContainer1.Panel1.Controls.Add(dueDateLabel);
this.splitContainer1.Panel1.Controls.Add(this.referenceTextBox);
this.splitContainer1.Panel1.Controls.Add(this.invoiceDateDateTimePicker);
this.splitContainer1.Panel1.Controls.Add(isCreditNoteLabel);
this.splitContainer1.Panel1.Controls.Add(invoiceDateLabel);
this.splitContainer1.Panel1.Controls.Add(this.isCreditNoteCheckBox);
this.splitContainer1.Panel1.Controls.Add(this.invoiceTotalTextBox);
this.splitContainer1.Panel1.Controls.Add(invoiceTotalLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.invoiceLineListDataGridView);
this.splitContainer1.Size = new System.Drawing.Size(800, 475);
this.splitContainer1.SplitterDistance = 175;
this.splitContainer1.TabIndex = 19;
//
// taxTotalTextBox
//
this.taxTotalTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "TaxTotal", true));
this.taxTotalTextBox.Location = new System.Drawing.Point(578, 50);
this.taxTotalTextBox.Name = "taxTotalTextBox";
this.taxTotalTextBox.Size = new System.Drawing.Size(100, 20);
this.taxTotalTextBox.TabIndex = 19;
//
// frmSaleInvoice
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -407,7 +407,6 @@
this.Name = "frmSaleInvoice";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SaleInvoice";
((System.ComponentModel.ISupportInitialize)(this.bsInvoice)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.invoiceLineListBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.invoiceLineListDataGridView)).EndInit();
this.splitContainer1.Panel1.ResumeLayout(false);
@@ -415,6 +414,7 @@
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.bsInvoice)).EndInit();
this.ResumeLayout(false);
}

View File

@@ -87,7 +87,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
,SaleInvoice.SaleInvoiceNumber
,SaleInvoice.InvoiceDate
,Contact.ContactName
,SaleInvoice.DateDue
,SaleInvoice.DateDue AS DueDate
,SaleInvoice.Reference
,SaleInvoice.CurrencyCode
,SaleInvoice.InvoiceTotal

View File

@@ -213,7 +213,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
SELECT SaleInvoice.SaleInvoiceID
,SaleInvoice.SaleInvoiceNumber
,SaleInvoice.InvoiceDate
,SaleInvoice.DateDue
,SaleInvoice.DateDue AS DueDate
,SaleInvoice.Reference
,SaleInvoice.CurrencyCode
,SaleInvoice.InvoiceTotal

View File

@@ -136,8 +136,8 @@ namespace BealeEngineering.Core.Data.Database.Sale
cmd.Parameters.AddWithValue("@contactName", invoice.ContactName);
cmd.Parameters.AddWithValue("@saleInvoiceNumber", invoice.SaleInvoiceNumber);
cmd.Parameters.AddWithValue("@invoiceDate", invoice.InvoiceDate);
if (invoice.DueDate == null) { cmd.Parameters.AddWithValue("@dateDue", DBNull.Value); }
else { cmd.Parameters.AddWithValue("@dateDue", invoice.DueDate); }
if (invoice.DueDateIsSet) { cmd.Parameters.AddWithValue("@dateDue", invoice.DueDate); }
else { cmd.Parameters.AddWithValue("@dateDue", DBNull.Value); }
cmd.Parameters.AddWithValue("@reference", invoice.Reference);
cmd.Parameters.AddWithValue("@currencyCode", invoice.CurrencyCode);
cmd.Parameters.AddWithValue("@invoiceTotal", invoice.InvoiceTotal);

View File

@@ -34,7 +34,7 @@ namespace BealeEngineering.Core.Logic.Adapter
xeroInvoice.ContactName = invoiceList[i].ContactName;
xeroInvoice.Currency = invoiceList[i].CurrencyCode;
xeroInvoice.DueDate = invoiceList[i].DueDate;
if (invoiceList[i].DueDateIsSet) { xeroInvoice.DueDate = invoiceList[i].DueDate; }
xeroInvoice.InvoiceDate = invoiceList[i].InvoiceDate;
xeroInvoice.InvoiceNumber = invoiceList[i].SaleInvoiceNumber;
xeroInvoice.Reference = invoiceList[i].Reference;

View File

@@ -40,7 +40,7 @@ namespace BealeEngineering.Core.Logic.Adapter
invoice.ContactName = xeroInvoiceList[i].ContactName;
invoice.CurrencyCode = xeroInvoiceList[i].Currency;
invoice.DueDate = xeroInvoiceList[i].DueDate;
if (xeroInvoiceList[i].DueDate != null) { invoice.DueDate = xeroInvoiceList[i].DueDate.GetValueOrDefault(); }
invoice.InvoiceDate = xeroInvoiceList[i].InvoiceDate;
invoice.InvoiceTotal = xeroInvoiceList[i].Total;
if (xeroInvoiceList[i].Type == "Sales invoice") { invoice.IsCreditNote = false; }

View File

@@ -9,6 +9,8 @@ namespace BealeEngineering.Core.Model.Sale
{
public class InvoiceHeader : ValidateModel
{
private DateTime? dueDate = null;
public int SaleInvoiceID { get; set; }
[Required()]
@@ -20,7 +22,16 @@ namespace BealeEngineering.Core.Model.Sale
[Required()]
public DateTime InvoiceDate { get; set; }
public DateTime? DueDate { get; set; }
public DateTime DueDate
{
get { return dueDate.GetValueOrDefault(); }
set { dueDate = value; }
}
public bool DueDateIsSet
{
get { return dueDate != null; }
}
[StringLength(50)]
public string Reference { get; set; }