diff --git a/BealeEngineering/BealeEngineering.Accounts/BealeEngineering.Accounts.csproj b/BealeEngineering/BealeEngineering.Accounts/BealeEngineering.Accounts.csproj
index de7cfe7..326790c 100644
--- a/BealeEngineering/BealeEngineering.Accounts/BealeEngineering.Accounts.csproj
+++ b/BealeEngineering/BealeEngineering.Accounts/BealeEngineering.Accounts.csproj
@@ -58,7 +58,7 @@
true
- true
+ false
@@ -86,19 +86,25 @@
frmClientPurchaseOrder.cs
-
+
Form
-
- Form1.cs
+
+ frmMain.cs
+
+ Form
+
+
+ frmSaleInvoice.cs
+
frmClientPurchaseOrder.cs
-
- Form1.cs
+
+ frmMain.cs
ResXFileCodeGenerator
@@ -109,6 +115,9 @@
True
Resources.resx
+
+ frmSaleInvoice.cs
+
BealeEngDataSet.xsd
@@ -124,6 +133,8 @@
+
+
SettingsSingleFileGenerator
diff --git a/BealeEngineering/BealeEngineering.Accounts/Program.cs b/BealeEngineering/BealeEngineering.Accounts/Program.cs
index f56d26e..49ec7c3 100644
--- a/BealeEngineering/BealeEngineering.Accounts/Program.cs
+++ b/BealeEngineering/BealeEngineering.Accounts/Program.cs
@@ -16,7 +16,7 @@ namespace BealeEngineering.Accounts
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
+ Application.Run(new frmMain());
}
}
}
diff --git a/BealeEngineering/BealeEngineering.Accounts/Properties/DataSources/BealeEngineering.Core.Model.Sale.Invoice.datasource b/BealeEngineering/BealeEngineering.Accounts/Properties/DataSources/BealeEngineering.Core.Model.Sale.Invoice.datasource
new file mode 100644
index 0000000..f6e6331
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Accounts/Properties/DataSources/BealeEngineering.Core.Model.Sale.Invoice.datasource
@@ -0,0 +1,10 @@
+
+
+
+ BealeEngineering.Core.Model.Sale.Invoice, BealeEngineering.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/BealeEngineering/BealeEngineering.Accounts/Properties/DataSources/BealeEngineering.Core.Model.Sale.InvoiceHeader.datasource b/BealeEngineering/BealeEngineering.Accounts/Properties/DataSources/BealeEngineering.Core.Model.Sale.InvoiceHeader.datasource
new file mode 100644
index 0000000..cdb4cc4
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Accounts/Properties/DataSources/BealeEngineering.Core.Model.Sale.InvoiceHeader.datasource
@@ -0,0 +1,10 @@
+
+
+
+ BealeEngineering.Core.Model.Sale.InvoiceHeader, BealeEngineering.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+
\ No newline at end of file
diff --git a/BealeEngineering/BealeEngineering.Accounts/Form1.Designer.cs b/BealeEngineering/BealeEngineering.Accounts/frmMain.Designer.cs
similarity index 55%
rename from BealeEngineering/BealeEngineering.Accounts/Form1.Designer.cs
rename to BealeEngineering/BealeEngineering.Accounts/frmMain.Designer.cs
index 42b2634..d44c391 100644
--- a/BealeEngineering/BealeEngineering.Accounts/Form1.Designer.cs
+++ b/BealeEngineering/BealeEngineering.Accounts/frmMain.Designer.cs
@@ -1,6 +1,6 @@
namespace BealeEngineering.Accounts
{
- partial class Form1
+ partial class frmMain
{
///
/// Required designer variable.
@@ -21,7 +21,7 @@
}
#region Windows Form Designer generated code
-
+
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
@@ -29,27 +29,26 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
+ this.btnAssign = new System.Windows.Forms.Button();
+ this.txtInvoiceStatus = new System.Windows.Forms.TextBox();
+ this.txtInvoiceNetAmount = new System.Windows.Forms.TextBox();
+ this.txtInvoiceContact = new System.Windows.Forms.TextBox();
+ this.btnOpenInvoice = new System.Windows.Forms.Button();
+ this.cmbInvoicePick = new System.Windows.Forms.ComboBox();
+ this.invoiceHeaderBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.btnAutoMatch = new System.Windows.Forms.Button();
this.btnOpenPurchaseOrder = new System.Windows.Forms.Button();
this.btnAddPurchaseOrder = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.txtUnallocatedCount = new System.Windows.Forms.TextBox();
+ this.txtInvoiceImportDt = new System.Windows.Forms.TextBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.purchaseOrderAllocationBindingSource = new System.Windows.Forms.BindingSource(this.components);
- this.menuStrip1 = new System.Windows.Forms.MenuStrip();
- this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.xeroInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.xeroInvoiceToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.testItToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ContactName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ProjectTitle = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -60,28 +59,64 @@
this.InvoicedAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineFacility = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.JobNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.PurchaseOrderIsClosed = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.PurchaseOrderLineID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.purchaseOrderAllocationBindingSource = new System.Windows.Forms.BindingSource(this.components);
+ this.tabSaleInvoice = new System.Windows.Forms.TabPage();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.btnOpenInv = new System.Windows.Forms.Button();
+ this.btnRefreshSaleInvoice = new System.Windows.Forms.Button();
+ this.dataGridView2 = new System.Windows.Forms.DataGridView();
+ this.saleInvoice = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.saleInvoiceNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.contactNameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.reference = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.invoiceDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dueDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.invoiceTotal = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.currencyCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.TotalAndCurrency = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.status = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.bindingSourceSaleInvoice = new System.Windows.Forms.BindingSource(this.components);
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.xeroInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.xeroInvoiceToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.testItToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.invoiceHeaderBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderAllocationBindingSource)).BeginInit();
+ this.tabSaleInvoice.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.bindingSourceSaleInvoice)).BeginInit();
this.menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
+ this.tabControl1.Controls.Add(this.tabSaleInvoice);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 24);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1151, 721);
this.tabControl1.TabIndex = 5;
+ this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
@@ -103,14 +138,19 @@
//
// splitContainer3.Panel1
//
+ this.splitContainer3.Panel1.Controls.Add(this.btnAssign);
+ this.splitContainer3.Panel1.Controls.Add(this.txtInvoiceStatus);
+ this.splitContainer3.Panel1.Controls.Add(this.txtInvoiceNetAmount);
+ this.splitContainer3.Panel1.Controls.Add(this.txtInvoiceContact);
+ this.splitContainer3.Panel1.Controls.Add(this.btnOpenInvoice);
+ this.splitContainer3.Panel1.Controls.Add(this.cmbInvoicePick);
this.splitContainer3.Panel1.Controls.Add(this.btnAutoMatch);
this.splitContainer3.Panel1.Controls.Add(this.btnOpenPurchaseOrder);
this.splitContainer3.Panel1.Controls.Add(this.btnAddPurchaseOrder);
this.splitContainer3.Panel1.Controls.Add(this.button1);
this.splitContainer3.Panel1.Controls.Add(this.label1);
this.splitContainer3.Panel1.Controls.Add(this.label2);
- this.splitContainer3.Panel1.Controls.Add(this.textBox1);
- this.splitContainer3.Panel1.Controls.Add(this.txtUnallocatedCount);
+ this.splitContainer3.Panel1.Controls.Add(this.txtInvoiceImportDt);
//
// splitContainer3.Panel2
//
@@ -120,9 +160,69 @@
this.splitContainer3.SplitterDistance = 93;
this.splitContainer3.TabIndex = 0;
//
+ // btnAssign
+ //
+ this.btnAssign.Location = new System.Drawing.Point(833, 21);
+ this.btnAssign.Name = "btnAssign";
+ this.btnAssign.Size = new System.Drawing.Size(92, 20);
+ this.btnAssign.TabIndex = 17;
+ this.btnAssign.Text = "Assign";
+ this.btnAssign.UseVisualStyleBackColor = true;
+ this.btnAssign.Click += new System.EventHandler(this.btnAssign_Click);
+ //
+ // txtInvoiceStatus
+ //
+ this.txtInvoiceStatus.Location = new System.Drawing.Point(599, 21);
+ this.txtInvoiceStatus.Name = "txtInvoiceStatus";
+ this.txtInvoiceStatus.ReadOnly = true;
+ this.txtInvoiceStatus.Size = new System.Drawing.Size(110, 20);
+ this.txtInvoiceStatus.TabIndex = 16;
+ //
+ // txtInvoiceNetAmount
+ //
+ this.txtInvoiceNetAmount.Location = new System.Drawing.Point(491, 21);
+ this.txtInvoiceNetAmount.Name = "txtInvoiceNetAmount";
+ this.txtInvoiceNetAmount.ReadOnly = true;
+ this.txtInvoiceNetAmount.Size = new System.Drawing.Size(86, 20);
+ this.txtInvoiceNetAmount.TabIndex = 15;
+ //
+ // txtInvoiceContact
+ //
+ this.txtInvoiceContact.Location = new System.Drawing.Point(296, 21);
+ this.txtInvoiceContact.Name = "txtInvoiceContact";
+ this.txtInvoiceContact.ReadOnly = true;
+ this.txtInvoiceContact.Size = new System.Drawing.Size(172, 20);
+ this.txtInvoiceContact.TabIndex = 14;
+ //
+ // btnOpenInvoice
+ //
+ this.btnOpenInvoice.Location = new System.Drawing.Point(725, 21);
+ this.btnOpenInvoice.Name = "btnOpenInvoice";
+ this.btnOpenInvoice.Size = new System.Drawing.Size(92, 20);
+ this.btnOpenInvoice.TabIndex = 13;
+ this.btnOpenInvoice.Text = "Open";
+ this.btnOpenInvoice.UseVisualStyleBackColor = true;
+ this.btnOpenInvoice.Click += new System.EventHandler(this.btnOpenInvoice_Click);
+ //
+ // cmbInvoicePick
+ //
+ this.cmbInvoicePick.DataSource = this.invoiceHeaderBindingSource1;
+ this.cmbInvoicePick.DisplayMember = "SaleInvoiceNumber";
+ this.cmbInvoicePick.FormattingEnabled = true;
+ this.cmbInvoicePick.Location = new System.Drawing.Point(145, 21);
+ this.cmbInvoicePick.Name = "cmbInvoicePick";
+ this.cmbInvoicePick.Size = new System.Drawing.Size(128, 21);
+ this.cmbInvoicePick.TabIndex = 12;
+ this.cmbInvoicePick.ValueMember = "SaleInvoiceID";
+ this.cmbInvoicePick.SelectedIndexChanged += new System.EventHandler(this.cmbInvoicePick_SelectedIndexChanged);
+ //
+ // invoiceHeaderBindingSource1
+ //
+ this.invoiceHeaderBindingSource1.DataSource = typeof(BealeEngineering.Core.Model.Sale.InvoiceHeader);
+ //
// btnAutoMatch
//
- this.btnAutoMatch.Location = new System.Drawing.Point(198, 56);
+ this.btnAutoMatch.Location = new System.Drawing.Point(943, 20);
this.btnAutoMatch.Name = "btnAutoMatch";
this.btnAutoMatch.Size = new System.Drawing.Size(75, 20);
this.btnAutoMatch.TabIndex = 10;
@@ -133,7 +233,7 @@
// btnOpenPurchaseOrder
//
this.btnOpenPurchaseOrder.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.btnOpenPurchaseOrder.Location = new System.Drawing.Point(521, 55);
+ this.btnOpenPurchaseOrder.Location = new System.Drawing.Point(882, 55);
this.btnOpenPurchaseOrder.Name = "btnOpenPurchaseOrder";
this.btnOpenPurchaseOrder.Size = new System.Drawing.Size(160, 20);
this.btnOpenPurchaseOrder.TabIndex = 11;
@@ -144,7 +244,7 @@
// btnAddPurchaseOrder
//
this.btnAddPurchaseOrder.Anchor = System.Windows.Forms.AnchorStyles.Right;
- this.btnAddPurchaseOrder.Location = new System.Drawing.Point(325, 56);
+ this.btnAddPurchaseOrder.Location = new System.Drawing.Point(716, 55);
this.btnAddPurchaseOrder.Name = "btnAddPurchaseOrder";
this.btnAddPurchaseOrder.Size = new System.Drawing.Size(160, 20);
this.btnAddPurchaseOrder.TabIndex = 10;
@@ -166,7 +266,7 @@
// label1
//
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(16, 18);
+ this.label1.Location = new System.Drawing.Point(21, 58);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 13);
this.label1.TabIndex = 6;
@@ -176,27 +276,19 @@
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(16, 56);
+ this.label2.Location = new System.Drawing.Point(21, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(107, 13);
this.label2.TabIndex = 8;
this.label2.Text = "Unallocated Invoices";
//
- // textBox1
+ // txtInvoiceImportDt
//
- this.textBox1.Location = new System.Drawing.Point(138, 18);
- this.textBox1.Name = "textBox1";
- this.textBox1.Size = new System.Drawing.Size(135, 20);
- this.textBox1.TabIndex = 5;
- //
- // txtUnallocatedCount
- //
- this.txtUnallocatedCount.Enabled = false;
- this.txtUnallocatedCount.Location = new System.Drawing.Point(138, 56);
- this.txtUnallocatedCount.Name = "txtUnallocatedCount";
- this.txtUnallocatedCount.Size = new System.Drawing.Size(53, 20);
- this.txtUnallocatedCount.TabIndex = 7;
- this.txtUnallocatedCount.TextChanged += new System.EventHandler(this.txtUnallocatedCount_TextChanged);
+ this.txtInvoiceImportDt.Location = new System.Drawing.Point(143, 55);
+ this.txtInvoiceImportDt.Name = "txtInvoiceImportDt";
+ this.txtInvoiceImportDt.ReadOnly = true;
+ this.txtInvoiceImportDt.Size = new System.Drawing.Size(130, 20);
+ this.txtInvoiceImportDt.TabIndex = 5;
//
// dataGridView1
//
@@ -218,7 +310,6 @@
this.InvoicedAmount,
this.PurchaseOrderLineFacility,
this.JobNumber,
- this.PurchaseOrderIsClosed,
this.PurchaseOrderLineID});
this.dataGridView1.DataSource = this.purchaseOrderAllocationBindingSource;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -226,81 +317,12 @@
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
- this.dataGridView1.RowHeadersVisible = false;
+ this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.Size = new System.Drawing.Size(1137, 592);
this.dataGridView1.TabIndex = 2;
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
//
- // purchaseOrderAllocationBindingSource
- //
- this.purchaseOrderAllocationBindingSource.AllowNew = false;
- this.purchaseOrderAllocationBindingSource.DataSource = typeof(BealeEngineering.Core.Model.Client.PurchaseOrderAllocation);
- //
- // menuStrip1
- //
- this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.fileToolStripMenuItem,
- this.importToolStripMenuItem,
- this.exportToolStripMenuItem,
- this.testToolStripMenuItem});
- this.menuStrip1.Location = new System.Drawing.Point(0, 0);
- this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(1151, 24);
- this.menuStrip1.TabIndex = 6;
- this.menuStrip1.Text = "menuStrip1";
- //
- // fileToolStripMenuItem
- //
- this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
- this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
- this.fileToolStripMenuItem.Text = "File";
- //
- // importToolStripMenuItem
- //
- this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.xeroInvoiceToolStripMenuItem});
- this.importToolStripMenuItem.Name = "importToolStripMenuItem";
- this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
- this.importToolStripMenuItem.Text = "Import";
- //
- // xeroInvoiceToolStripMenuItem
- //
- this.xeroInvoiceToolStripMenuItem.Name = "xeroInvoiceToolStripMenuItem";
- this.xeroInvoiceToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
- this.xeroInvoiceToolStripMenuItem.Text = "Xero Invoice";
- this.xeroInvoiceToolStripMenuItem.Click += new System.EventHandler(this.xeroInvoiceToolStripMenuItem_Click);
- //
- // exportToolStripMenuItem
- //
- this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.xeroInvoiceToolStripMenuItem1});
- this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
- this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
- this.exportToolStripMenuItem.Text = "Export";
- //
- // xeroInvoiceToolStripMenuItem1
- //
- this.xeroInvoiceToolStripMenuItem1.Name = "xeroInvoiceToolStripMenuItem1";
- this.xeroInvoiceToolStripMenuItem1.Size = new System.Drawing.Size(139, 22);
- this.xeroInvoiceToolStripMenuItem1.Text = "Xero Invoice";
- this.xeroInvoiceToolStripMenuItem1.Click += new System.EventHandler(this.xeroInvoiceToolStripMenuItem1_Click);
- //
- // testToolStripMenuItem
- //
- this.testToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.testItToolStripMenuItem});
- this.testToolStripMenuItem.Name = "testToolStripMenuItem";
- this.testToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
- this.testToolStripMenuItem.Text = "Test";
- //
- // testItToolStripMenuItem
- //
- this.testItToolStripMenuItem.Name = "testItToolStripMenuItem";
- this.testItToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
- this.testItToolStripMenuItem.Text = "Test it!";
- this.testItToolStripMenuItem.Click += new System.EventHandler(this.testItToolStripMenuItem_Click);
- //
// ContactName
//
this.ContactName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
@@ -401,17 +423,6 @@
this.JobNumber.Name = "JobNumber";
this.JobNumber.ReadOnly = true;
//
- // PurchaseOrderIsClosed
- //
- this.PurchaseOrderIsClosed.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
- this.PurchaseOrderIsClosed.DataPropertyName = "PurchaseOrderIsClosed";
- this.PurchaseOrderIsClosed.FillWeight = 30.59646F;
- this.PurchaseOrderIsClosed.HeaderText = "Archived";
- this.PurchaseOrderIsClosed.MinimumWidth = 50;
- this.PurchaseOrderIsClosed.Name = "PurchaseOrderIsClosed";
- this.PurchaseOrderIsClosed.ReadOnly = true;
- this.PurchaseOrderIsClosed.Width = 60;
- //
// PurchaseOrderLineID
//
this.PurchaseOrderLineID.DataPropertyName = "PurchaseOrderLineID";
@@ -420,7 +431,260 @@
this.PurchaseOrderLineID.ReadOnly = true;
this.PurchaseOrderLineID.Visible = false;
//
- // Form1
+ // purchaseOrderAllocationBindingSource
+ //
+ this.purchaseOrderAllocationBindingSource.AllowNew = false;
+ this.purchaseOrderAllocationBindingSource.DataSource = typeof(BealeEngineering.Core.Model.Client.PurchaseOrderAllocation);
+ //
+ // tabSaleInvoice
+ //
+ this.tabSaleInvoice.Controls.Add(this.splitContainer1);
+ this.tabSaleInvoice.Location = new System.Drawing.Point(4, 22);
+ this.tabSaleInvoice.Name = "tabSaleInvoice";
+ this.tabSaleInvoice.Padding = new System.Windows.Forms.Padding(3);
+ this.tabSaleInvoice.Size = new System.Drawing.Size(1143, 695);
+ this.tabSaleInvoice.TabIndex = 1;
+ this.tabSaleInvoice.Text = "Sales Invoices";
+ this.tabSaleInvoice.UseVisualStyleBackColor = true;
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(3, 3);
+ this.splitContainer1.Name = "splitContainer1";
+ this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.btnOpenInv);
+ this.splitContainer1.Panel1.Controls.Add(this.btnRefreshSaleInvoice);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.dataGridView2);
+ this.splitContainer1.Size = new System.Drawing.Size(1137, 689);
+ this.splitContainer1.SplitterDistance = 93;
+ this.splitContainer1.TabIndex = 0;
+ //
+ // btnOpenInv
+ //
+ this.btnOpenInv.Location = new System.Drawing.Point(25, 55);
+ this.btnOpenInv.Name = "btnOpenInv";
+ this.btnOpenInv.Size = new System.Drawing.Size(92, 20);
+ this.btnOpenInv.TabIndex = 14;
+ this.btnOpenInv.Text = "Open";
+ this.btnOpenInv.UseVisualStyleBackColor = true;
+ this.btnOpenInv.Click += new System.EventHandler(this.btnOpenInv_Click);
+ //
+ // btnRefreshSaleInvoice
+ //
+ this.btnRefreshSaleInvoice.Anchor = System.Windows.Forms.AnchorStyles.Right;
+ this.btnRefreshSaleInvoice.Location = new System.Drawing.Point(1035, 55);
+ this.btnRefreshSaleInvoice.Name = "btnRefreshSaleInvoice";
+ this.btnRefreshSaleInvoice.Size = new System.Drawing.Size(75, 20);
+ this.btnRefreshSaleInvoice.TabIndex = 5;
+ this.btnRefreshSaleInvoice.Text = "Refresh";
+ this.btnRefreshSaleInvoice.UseVisualStyleBackColor = true;
+ this.btnRefreshSaleInvoice.Click += new System.EventHandler(this.btnRefreshSaleInvoice_Click);
+ //
+ // dataGridView2
+ //
+ this.dataGridView2.AllowUserToAddRows = false;
+ this.dataGridView2.AllowUserToDeleteRows = false;
+ this.dataGridView2.AutoGenerateColumns = false;
+ this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.saleInvoice,
+ this.saleInvoiceNumber,
+ this.contactNameDataGridViewTextBoxColumn,
+ this.reference,
+ this.invoiceDate,
+ this.dueDate,
+ this.invoiceTotal,
+ this.currencyCode,
+ this.TotalAndCurrency,
+ this.status});
+ this.dataGridView2.DataSource = this.bindingSourceSaleInvoice;
+ this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView2.Location = new System.Drawing.Point(0, 0);
+ this.dataGridView2.Name = "dataGridView2";
+ this.dataGridView2.ReadOnly = true;
+ this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.dataGridView2.Size = new System.Drawing.Size(1137, 592);
+ this.dataGridView2.TabIndex = 0;
+ this.dataGridView2.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView2_CellContentClick);
+ this.dataGridView2.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dataGridView2_CellFormatting);
+ this.dataGridView2.DoubleClick += new System.EventHandler(this.dataGridView2_DoubleClick);
+ //
+ // saleInvoice
+ //
+ this.saleInvoice.DataPropertyName = "SaleInvoiceID";
+ this.saleInvoice.HeaderText = "SaleInvoiceID";
+ this.saleInvoice.Name = "saleInvoice";
+ this.saleInvoice.ReadOnly = true;
+ this.saleInvoice.Visible = false;
+ //
+ // saleInvoiceNumber
+ //
+ this.saleInvoiceNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+ this.saleInvoiceNumber.DataPropertyName = "SaleInvoiceNumber";
+ this.saleInvoiceNumber.HeaderText = "Invoice Number";
+ this.saleInvoiceNumber.MinimumWidth = 120;
+ this.saleInvoiceNumber.Name = "saleInvoiceNumber";
+ this.saleInvoiceNumber.ReadOnly = true;
+ this.saleInvoiceNumber.Width = 120;
+ //
+ // contactNameDataGridViewTextBoxColumn
+ //
+ this.contactNameDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.contactNameDataGridViewTextBoxColumn.DataPropertyName = "ContactName";
+ this.contactNameDataGridViewTextBoxColumn.HeaderText = "Contact";
+ this.contactNameDataGridViewTextBoxColumn.Name = "contactNameDataGridViewTextBoxColumn";
+ this.contactNameDataGridViewTextBoxColumn.ReadOnly = true;
+ //
+ // reference
+ //
+ this.reference.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.reference.DataPropertyName = "Reference";
+ this.reference.HeaderText = "Reference";
+ this.reference.Name = "reference";
+ this.reference.ReadOnly = true;
+ //
+ // invoiceDate
+ //
+ this.invoiceDate.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.invoiceDate.DataPropertyName = "InvoiceDate";
+ this.invoiceDate.HeaderText = "Invoice Date";
+ this.invoiceDate.MinimumWidth = 100;
+ this.invoiceDate.Name = "invoiceDate";
+ this.invoiceDate.ReadOnly = true;
+ //
+ // dueDate
+ //
+ this.dueDate.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.dueDate.DataPropertyName = "DueDate";
+ this.dueDate.HeaderText = "Due Date";
+ this.dueDate.MinimumWidth = 100;
+ this.dueDate.Name = "dueDate";
+ this.dueDate.ReadOnly = true;
+ //
+ // invoiceTotal
+ //
+ this.invoiceTotal.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+ this.invoiceTotal.DataPropertyName = "InvoiceTotal";
+ this.invoiceTotal.HeaderText = "Invoice Total";
+ this.invoiceTotal.MinimumWidth = 80;
+ this.invoiceTotal.Name = "invoiceTotal";
+ this.invoiceTotal.ReadOnly = true;
+ this.invoiceTotal.Visible = false;
+ this.invoiceTotal.Width = 80;
+ //
+ // currencyCode
+ //
+ this.currencyCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+ this.currencyCode.DataPropertyName = "CurrencyCode";
+ this.currencyCode.HeaderText = "Currency";
+ this.currencyCode.MinimumWidth = 50;
+ this.currencyCode.Name = "currencyCode";
+ this.currencyCode.ReadOnly = true;
+ this.currencyCode.Visible = false;
+ this.currencyCode.Width = 50;
+ //
+ // TotalAndCurrency
+ //
+ this.TotalAndCurrency.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
+ dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
+ this.TotalAndCurrency.DefaultCellStyle = dataGridViewCellStyle9;
+ this.TotalAndCurrency.HeaderText = "InvoiceTotal";
+ this.TotalAndCurrency.MinimumWidth = 120;
+ this.TotalAndCurrency.Name = "TotalAndCurrency";
+ this.TotalAndCurrency.ReadOnly = true;
+ this.TotalAndCurrency.Width = 120;
+ //
+ // status
+ //
+ this.status.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.status.DataPropertyName = "Status";
+ dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ this.status.DefaultCellStyle = dataGridViewCellStyle10;
+ this.status.HeaderText = "Status";
+ this.status.MinimumWidth = 100;
+ this.status.Name = "status";
+ this.status.ReadOnly = true;
+ //
+ // bindingSourceSaleInvoice
+ //
+ this.bindingSourceSaleInvoice.DataSource = typeof(BealeEngineering.Core.Model.Sale.Invoice);
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem,
+ this.importToolStripMenuItem,
+ this.exportToolStripMenuItem,
+ this.testToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1151, 24);
+ this.menuStrip1.TabIndex = 6;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem.Text = "File";
+ //
+ // importToolStripMenuItem
+ //
+ this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.xeroInvoiceToolStripMenuItem});
+ this.importToolStripMenuItem.Name = "importToolStripMenuItem";
+ this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
+ this.importToolStripMenuItem.Text = "Import";
+ //
+ // xeroInvoiceToolStripMenuItem
+ //
+ this.xeroInvoiceToolStripMenuItem.Name = "xeroInvoiceToolStripMenuItem";
+ this.xeroInvoiceToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
+ this.xeroInvoiceToolStripMenuItem.Text = "Xero Invoice";
+ this.xeroInvoiceToolStripMenuItem.Click += new System.EventHandler(this.xeroInvoiceToolStripMenuItem_Click);
+ //
+ // exportToolStripMenuItem
+ //
+ this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.xeroInvoiceToolStripMenuItem1});
+ this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
+ this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
+ this.exportToolStripMenuItem.Text = "Export";
+ //
+ // xeroInvoiceToolStripMenuItem1
+ //
+ this.xeroInvoiceToolStripMenuItem1.Name = "xeroInvoiceToolStripMenuItem1";
+ this.xeroInvoiceToolStripMenuItem1.Size = new System.Drawing.Size(139, 22);
+ this.xeroInvoiceToolStripMenuItem1.Text = "Xero Invoice";
+ this.xeroInvoiceToolStripMenuItem1.Click += new System.EventHandler(this.xeroInvoiceToolStripMenuItem1_Click);
+ //
+ // testToolStripMenuItem
+ //
+ this.testToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.testItToolStripMenuItem});
+ this.testToolStripMenuItem.Name = "testToolStripMenuItem";
+ this.testToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
+ this.testToolStripMenuItem.Text = "Test";
+ //
+ // testItToolStripMenuItem
+ //
+ this.testItToolStripMenuItem.Name = "testItToolStripMenuItem";
+ this.testItToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
+ this.testItToolStripMenuItem.Text = "Test it!";
+ this.testItToolStripMenuItem.Click += new System.EventHandler(this.testItToolStripMenuItem_Click);
+ //
+ // invoiceHeaderBindingSource
+ //
+ this.invoiceHeaderBindingSource.DataSource = typeof(BealeEngineering.Core.Model.Sale.InvoiceHeader);
+ //
+ // frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -428,7 +692,7 @@
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
- this.Name = "Form1";
+ this.Name = "frmMain";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl1.ResumeLayout(false);
@@ -438,10 +702,19 @@
this.splitContainer3.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderAllocationBindingSource)).EndInit();
+ this.tabSaleInvoice.ResumeLayout(false);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.bindingSourceSaleInvoice)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -455,8 +728,7 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.TextBox txtUnallocatedCount;
+ private System.Windows.Forms.TextBox txtInvoiceImportDt;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
@@ -469,6 +741,18 @@
private System.Windows.Forms.Button btnAutoMatch;
private System.Windows.Forms.Button btnAddPurchaseOrder;
private System.Windows.Forms.Button btnOpenPurchaseOrder;
+ private System.Windows.Forms.TabPage tabSaleInvoice;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.DataGridView dataGridView2;
+ private System.Windows.Forms.BindingSource bindingSourceSaleInvoice;
+ private System.Windows.Forms.Button btnRefreshSaleInvoice;
+ private System.Windows.Forms.ComboBox cmbInvoicePick;
+ private System.Windows.Forms.BindingSource invoiceHeaderBindingSource;
+ private System.Windows.Forms.BindingSource invoiceHeaderBindingSource1;
+ private System.Windows.Forms.Button btnOpenInvoice;
+ private System.Windows.Forms.TextBox txtInvoiceStatus;
+ private System.Windows.Forms.TextBox txtInvoiceNetAmount;
+ private System.Windows.Forms.TextBox txtInvoiceContact;
private System.Windows.Forms.DataGridViewTextBoxColumn ContactName;
private System.Windows.Forms.DataGridViewTextBoxColumn ProjectTitle;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderDate;
@@ -479,8 +763,19 @@
private System.Windows.Forms.DataGridViewTextBoxColumn InvoicedAmount;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineFacility;
private System.Windows.Forms.DataGridViewTextBoxColumn JobNumber;
- private System.Windows.Forms.DataGridViewCheckBoxColumn PurchaseOrderIsClosed;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineID;
+ private System.Windows.Forms.Button btnAssign;
+ private System.Windows.Forms.Button btnOpenInv;
+ private System.Windows.Forms.DataGridViewTextBoxColumn saleInvoice;
+ private System.Windows.Forms.DataGridViewTextBoxColumn saleInvoiceNumber;
+ private System.Windows.Forms.DataGridViewTextBoxColumn contactNameDataGridViewTextBoxColumn;
+ private System.Windows.Forms.DataGridViewTextBoxColumn reference;
+ private System.Windows.Forms.DataGridViewTextBoxColumn invoiceDate;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dueDate;
+ private System.Windows.Forms.DataGridViewTextBoxColumn invoiceTotal;
+ private System.Windows.Forms.DataGridViewTextBoxColumn currencyCode;
+ private System.Windows.Forms.DataGridViewTextBoxColumn TotalAndCurrency;
+ private System.Windows.Forms.DataGridViewTextBoxColumn status;
}
}
diff --git a/BealeEngineering/BealeEngineering.Accounts/Form1.cs b/BealeEngineering/BealeEngineering.Accounts/frmMain.cs
similarity index 53%
rename from BealeEngineering/BealeEngineering.Accounts/Form1.cs
rename to BealeEngineering/BealeEngineering.Accounts/frmMain.cs
index b2b2437..486626f 100644
--- a/BealeEngineering/BealeEngineering.Accounts/Form1.cs
+++ b/BealeEngineering/BealeEngineering.Accounts/frmMain.cs
@@ -12,34 +12,65 @@ using BealeEngineering.Core.Data;
namespace BealeEngineering.Accounts
{
- public partial class Form1 : Form
+ public partial class frmMain : Form
{
private string sqlConnectionString;
- public Form1()
+ Core.Logic.Sale.SaleInvoiceAssign assignInvoice;
+
+ public frmMain()
{
InitializeComponent();
sqlConnectionString = ConfigurationManager.ConnectionStrings["BealeEngSQLDb"].ToString();
+ assignInvoice = new Core.Logic.Sale.SaleInvoiceAssign(sqlConnectionString);
+ UpdateInvoiceImportText();
}
public List TableData { get; set; }
private void Form1_Load(object sender, EventArgs e)
{
- UpdateTable();
+ button1_Click(null, null);
+ UpdateInvoiceCombo();
+ }
+
+ private void cmbInvoicePick_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ var invoiceHeader = (Core.Model.Sale.InvoiceHeader)cmbInvoicePick.SelectedItem;
+ txtInvoiceContact.Text = invoiceHeader.ContactName;
+ txtInvoiceNetAmount.Text = (invoiceHeader.InvoiceTotal - invoiceHeader.TaxTotal).ToString("F") + " " + invoiceHeader.CurrencyCode;
+ txtInvoiceStatus.Text = invoiceHeader.Status;
+ }
+
+ private void UpdateInvoiceCombo()
+ {
+ var idList = new Core.Data.Database.Client.ReadSaleInvoiceAllocation(sqlConnectionString).GetUnallocatedInvoice();
+ var readInvoice = new Core.Data.Database.Sale.ReadInvoiceHeader(sqlConnectionString);
+ readInvoice.InvoiceNumber = idList;
+
+ var invoiceHeaderList = readInvoice.Read();
+ cmbInvoicePick.DataSource =
+ invoiceHeaderList.Where(x => x.Status != "Paid")
+ .OrderBy(x => x.SaleInvoiceNumber
+ .Substring(x.SaleInvoiceNumber.IndexOf("#") + 1, x.SaleInvoiceNumber.Length - x.SaleInvoiceNumber.IndexOf("#") - 1))
+ .ToList();
+
+ cmbInvoicePick_SelectedIndexChanged(null, null);
+ }
+
+ private void btnOpenInvoice_Click(object sender, EventArgs e)
+ {
+ int invoiceId = (int)cmbInvoicePick.SelectedValue;
+
+ var currentSaleInvoice = new Core.Data.Database.Sale.ReadInvoice(sqlConnectionString).BySaleInvoiceId(invoiceId);
+
+
+ var frmInvoice = new frmSaleInvoice(currentSaleInvoice);
+ frmInvoice.ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
- UpdateTable();
- }
-
- private void UpdateTable()
- {
- // update text box
- var dataRead = new Core.Data.Database.Client.ReadSaleInvoiceAllocation(sqlConnectionString);
- txtUnallocatedCount.Text = dataRead.GetUnallocatedInvoiceCount().ToString();
-
var readData = new Core.Data.Database.Client.ReadPurchaseOrderAllocation(sqlConnectionString);
var data = readData.Read();
@@ -163,6 +194,7 @@ namespace BealeEngineering.Accounts
MessageBox.Show(dialogText);
}
+ UpdateInvoiceImportText();
}
private void xeroInvoiceToolStripMenuItem1_Click(object sender, EventArgs e)
@@ -204,7 +236,7 @@ namespace BealeEngineering.Accounts
MessageBox.Show(dialogText);
}
- UpdateTable();
+ button1_Click(null, null);
}
private void purchaseOrderAllocationBindingSource_CurrentChanged(object sender, EventArgs e)
@@ -218,14 +250,142 @@ namespace BealeEngineering.Accounts
frmCLient.ShowDialog();
}
- private void btnOpenPurchaseOrder_Click(object sender, EventArgs e)
+ private Core.Model.Client.PurchaseOrder GetSelectPurchaseOrder()
{
int idIndex = dataGridView1.Columns["PurchaseOrderLineID"].Index;
int lineId = (int)dataGridView1[idIndex, dataGridView1.CurrentCell.RowIndex].Value;
- var po = new Core.Data.Database.Client.ReadPurchaseOrder(sqlConnectionString).ByPurchaseOrderLineId(lineId);
+ return new Core.Data.Database.Client.ReadPurchaseOrder(sqlConnectionString).ByPurchaseOrderLineId(lineId);
+ }
- var frmPo = new frmClientPurchaseOrder(po);
+ private void btnOpenPurchaseOrder_Click(object sender, EventArgs e)
+ {
+ var frmPo = new frmClientPurchaseOrder(GetSelectPurchaseOrder());
frmPo.ShowDialog();
}
+
+ private void dataGridView2_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
+ {
+ int inx1 = dataGridView2.Columns["invoiceTotal"].Index;
+ int inx2 = dataGridView2.Columns["currencyCode"].Index;
+
+ if (e.ColumnIndex == dataGridView2.Columns["TotalAndCurrency"].Index)
+ {
+ decimal sssss = (decimal)dataGridView2[inx1, e.RowIndex].Value;
+ e.Value = sssss.ToString("F") + " " + dataGridView2[inx2, e.RowIndex].Value;
+ }
+ }
+
+ private void btnRefreshSaleInvoice_Click(object sender, EventArgs e)
+ {
+ // update text box
+ var invoiceRead = new Core.Data.Database.Sale.ReadInvoiceHeader(sqlConnectionString);
+ var invoiceData = invoiceRead.Read();
+
+ //bindingSourceSaleInvoice.DataSource = invoiceData.OrderByDescending(x => x.SaleInvoiceNumber);
+
+ bindingSourceSaleInvoice.DataSource =
+ invoiceData.OrderByDescending(x => x.SaleInvoiceNumber
+ .Substring(x.SaleInvoiceNumber.IndexOf("#") + 1, x.SaleInvoiceNumber.Length - x.SaleInvoiceNumber.IndexOf("#") - 1));
+ }
+
+ private void btnAssign_Click(object sender, EventArgs e)
+ {
+ // invoice import time check
+ if (!assignInvoice.ImportTimeCheck())
+ {
+ var responce = MessageBox.Show("Last Xero invoice import was " + assignInvoice.LastImportDateTime
+ + Environment.NewLine + Environment.NewLine + "Continue?"
+ , "Caution"
+ , MessageBoxButtons.OKCancel
+ , MessageBoxIcon.Exclamation
+ , MessageBoxDefaultButton.Button2);
+
+ if (responce == DialogResult.OK)
+ {
+ assignInvoice.ImportTimeCheckPostpone();
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ var invoiceHeader = (Core.Model.Sale.InvoiceHeader)cmbInvoicePick.SelectedItem;
+ var purchaseOrder = GetSelectPurchaseOrder();
+
+ if (invoiceHeader.ContactName != purchaseOrder.ContactName)
+ {
+ var responce = MessageBox.Show("Client on invoice '" + invoiceHeader.ContactName
+ + "' does not match client on purchase order '" + purchaseOrder.ContactName + "'."
+ + Environment.NewLine + Environment.NewLine + "Continue?"
+ , "Warning"
+ , MessageBoxButtons.OKCancel
+ , MessageBoxIcon.Warning
+ , MessageBoxDefaultButton.Button2);
+ if (responce != DialogResult.OK)
+ { return; }
+ }
+
+ int idIndex = dataGridView1.Columns["PurchaseOrderLineFacility"].Index;
+ decimal facility = (decimal)dataGridView1[idIndex, dataGridView1.CurrentCell.RowIndex].Value;
+ decimal invoiceNet = invoiceHeader.InvoiceTotal - invoiceHeader.TaxTotal;
+ if (facility < invoiceNet)
+ {
+ var responce = MessageBox.Show("The facility on the select purchase order line (" + facility.ToString("F") + ") is less than the "
+ + "invoice amount (" + invoiceNet.ToString("F") + "). "
+ + Environment.NewLine + Environment.NewLine + "Continue and split the invoice?"
+ , "Insurficent facility"
+ , MessageBoxButtons.OKCancel
+ , MessageBoxIcon.Question
+ , MessageBoxDefaultButton.Button2);
+
+ if (responce != DialogResult.OK)
+ { return; }
+
+ assignInvoice.SplitInvoice = true;
+ }
+
+ int lineIdIndex = dataGridView1.Columns["PurchaseOrderLineID"].Index;
+ int lineId = (int)dataGridView1[lineIdIndex, dataGridView1.CurrentCell.RowIndex].Value;
+
+ assignInvoice.ToPurchaseOrderLine(invoiceHeader.SaleInvoiceNumber, lineId);
+ }
+
+ private void UpdateInvoiceImportText()
+ {
+ txtInvoiceImportDt.Text = new Core.Data.Database.Log.ReadDateTime(sqlConnectionString)
+ .ByMatchString("XeroSaleInvoiceFlatFileImport").ToString();
+ }
+
+ private void btnOpenInv_Click(object sender, EventArgs e)
+ {
+ if (dataGridView2.Rows.Count > 0)
+ {
+ int invoiceId = (int)dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value;
+
+ var currentSaleInvoice = new Core.Data.Database.Sale.ReadInvoice(sqlConnectionString).BySaleInvoiceId(invoiceId);
+
+ var frmInvoice = new frmSaleInvoice(currentSaleInvoice);
+ frmInvoice.ShowDialog();
+ }
+ }
+
+ private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
+ {
+
+ }
+
+ private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (tabControl1.SelectedTab == tabControl1.TabPages["tabSaleInvoice"] && dataGridView2.Rows.Count == 0)
+ {
+ btnRefreshSaleInvoice_Click(null, null);
+ }
+ }
+
+ private void dataGridView2_DoubleClick(object sender, EventArgs e)
+ {
+ btnOpenInv_Click(null, null);
+ }
}
}
diff --git a/BealeEngineering/BealeEngineering.Accounts/Form1.resx b/BealeEngineering/BealeEngineering.Accounts/frmMain.resx
similarity index 81%
rename from BealeEngineering/BealeEngineering.Accounts/Form1.resx
rename to BealeEngineering/BealeEngineering.Accounts/frmMain.resx
index a363f7b..dce7018 100644
--- a/BealeEngineering/BealeEngineering.Accounts/Form1.resx
+++ b/BealeEngineering/BealeEngineering.Accounts/frmMain.resx
@@ -117,8 +117,8 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- True
+
+ 834, 24
True
@@ -126,7 +126,25 @@
24, 20
+
+ 834, 24
+
+
+ True
+
+
+ 435, 24
+
+
+ True
+
+
+ 435, 24
+
290, 20
+
+ 626, 24
+
\ No newline at end of file
diff --git a/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.Designer.cs b/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.Designer.cs
new file mode 100644
index 0000000..a61f6a2
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.Designer.cs
@@ -0,0 +1,442 @@
+namespace BealeEngineering.Accounts
+{
+ partial class frmSaleInvoice
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.Windows.Forms.Label contactNameLabel;
+ System.Windows.Forms.Label currencyCodeLabel;
+ System.Windows.Forms.Label dueDateLabel;
+ System.Windows.Forms.Label invoiceDateLabel;
+ System.Windows.Forms.Label invoiceTotalLabel;
+ System.Windows.Forms.Label isCreditNoteLabel;
+ System.Windows.Forms.Label referenceLabel;
+ System.Windows.Forms.Label saleInvoiceNumberLabel;
+ System.Windows.Forms.Label statusLabel;
+ System.Windows.Forms.Label taxTotalLabel;
+ 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();
+ this.invoiceTotalTextBox = new System.Windows.Forms.TextBox();
+ this.isCreditNoteCheckBox = new System.Windows.Forms.CheckBox();
+ this.referenceTextBox = new System.Windows.Forms.TextBox();
+ this.saleInvoiceNumberTextBox = new System.Windows.Forms.TextBox();
+ this.statusTextBox = new System.Windows.Forms.TextBox();
+ this.invoiceLineListBindingSource = new System.Windows.Forms.BindingSource(this.components);
+ this.invoiceLineListDataGridView = new System.Windows.Forms.DataGridView();
+ this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.dataGridViewTextBoxColumn10 = 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();
+ invoiceDateLabel = new System.Windows.Forms.Label();
+ invoiceTotalLabel = new System.Windows.Forms.Label();
+ isCreditNoteLabel = new System.Windows.Forms.Label();
+ referenceLabel = new System.Windows.Forms.Label();
+ 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();
+ this.SuspendLayout();
+ //
+ // contactNameLabel
+ //
+ contactNameLabel.AutoSize = true;
+ contactNameLabel.Location = new System.Drawing.Point(65, 27);
+ contactNameLabel.Name = "contactNameLabel";
+ contactNameLabel.Size = new System.Drawing.Size(78, 13);
+ contactNameLabel.TabIndex = 0;
+ contactNameLabel.Text = "Contact Name:";
+ //
+ // currencyCodeLabel
+ //
+ currencyCodeLabel.AutoSize = true;
+ currencyCodeLabel.Location = new System.Drawing.Point(492, 27);
+ currencyCodeLabel.Name = "currencyCodeLabel";
+ currencyCodeLabel.Size = new System.Drawing.Size(80, 13);
+ currencyCodeLabel.TabIndex = 2;
+ currencyCodeLabel.Text = "Currency Code:";
+ //
+ // dueDateLabel
+ //
+ dueDateLabel.AutoSize = true;
+ dueDateLabel.Location = new System.Drawing.Point(87, 106);
+ dueDateLabel.Name = "dueDateLabel";
+ dueDateLabel.Size = new System.Drawing.Size(56, 13);
+ dueDateLabel.TabIndex = 4;
+ dueDateLabel.Text = "Due Date:";
+ //
+ // invoiceDateLabel
+ //
+ invoiceDateLabel.AutoSize = true;
+ invoiceDateLabel.Location = new System.Drawing.Point(72, 80);
+ invoiceDateLabel.Name = "invoiceDateLabel";
+ invoiceDateLabel.Size = new System.Drawing.Size(71, 13);
+ invoiceDateLabel.TabIndex = 6;
+ invoiceDateLabel.Text = "Invoice Date:";
+ //
+ // invoiceTotalLabel
+ //
+ invoiceTotalLabel.AutoSize = true;
+ invoiceTotalLabel.Location = new System.Drawing.Point(500, 79);
+ invoiceTotalLabel.Name = "invoiceTotalLabel";
+ invoiceTotalLabel.Size = new System.Drawing.Size(72, 13);
+ invoiceTotalLabel.TabIndex = 8;
+ invoiceTotalLabel.Text = "Invoice Total:";
+ //
+ // isCreditNoteLabel
+ //
+ isCreditNoteLabel.AutoSize = true;
+ isCreditNoteLabel.Location = new System.Drawing.Point(498, 107);
+ isCreditNoteLabel.Name = "isCreditNoteLabel";
+ isCreditNoteLabel.Size = new System.Drawing.Size(74, 13);
+ isCreditNoteLabel.TabIndex = 10;
+ isCreditNoteLabel.Text = "Is Credit Note:";
+ //
+ // referenceLabel
+ //
+ referenceLabel.AutoSize = true;
+ referenceLabel.Location = new System.Drawing.Point(83, 131);
+ referenceLabel.Name = "referenceLabel";
+ referenceLabel.Size = new System.Drawing.Size(60, 13);
+ referenceLabel.TabIndex = 12;
+ referenceLabel.Text = "Reference:";
+ //
+ // saleInvoiceNumberLabel
+ //
+ saleInvoiceNumberLabel.AutoSize = true;
+ saleInvoiceNumberLabel.Location = new System.Drawing.Point(34, 53);
+ saleInvoiceNumberLabel.Name = "saleInvoiceNumberLabel";
+ saleInvoiceNumberLabel.Size = new System.Drawing.Size(109, 13);
+ saleInvoiceNumberLabel.TabIndex = 14;
+ saleInvoiceNumberLabel.Text = "Sale Invoice Number:";
+ //
+ // statusLabel
+ //
+ statusLabel.AutoSize = true;
+ statusLabel.Location = new System.Drawing.Point(532, 135);
+ statusLabel.Name = "statusLabel";
+ statusLabel.Size = new System.Drawing.Size(40, 13);
+ statusLabel.TabIndex = 16;
+ statusLabel.Text = "Status:";
+ //
+ // contactNameTextBox
+ //
+ this.contactNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "ContactName", true));
+ this.contactNameTextBox.Location = new System.Drawing.Point(149, 24);
+ this.contactNameTextBox.Name = "contactNameTextBox";
+ 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));
+ this.currencyCodeTextBox.Location = new System.Drawing.Point(578, 24);
+ this.currencyCodeTextBox.Name = "currencyCodeTextBox";
+ this.currencyCodeTextBox.Size = new System.Drawing.Size(100, 20);
+ this.currencyCodeTextBox.TabIndex = 3;
+ //
+ // dueDateDateTimePicker
+ //
+ this.dueDateDateTimePicker.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bsInvoice, "DueDate", true));
+ this.dueDateDateTimePicker.Location = new System.Drawing.Point(149, 102);
+ this.dueDateDateTimePicker.Name = "dueDateDateTimePicker";
+ this.dueDateDateTimePicker.Size = new System.Drawing.Size(200, 20);
+ this.dueDateDateTimePicker.TabIndex = 5;
+ //
+ // invoiceDateDateTimePicker
+ //
+ this.invoiceDateDateTimePicker.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bsInvoice, "InvoiceDate", true));
+ this.invoiceDateDateTimePicker.Location = new System.Drawing.Point(149, 76);
+ this.invoiceDateDateTimePicker.Name = "invoiceDateDateTimePicker";
+ this.invoiceDateDateTimePicker.Size = new System.Drawing.Size(200, 20);
+ this.invoiceDateDateTimePicker.TabIndex = 7;
+ //
+ // invoiceTotalTextBox
+ //
+ this.invoiceTotalTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "InvoiceTotal", true));
+ this.invoiceTotalTextBox.Location = new System.Drawing.Point(578, 76);
+ this.invoiceTotalTextBox.Name = "invoiceTotalTextBox";
+ this.invoiceTotalTextBox.Size = new System.Drawing.Size(100, 20);
+ this.invoiceTotalTextBox.TabIndex = 9;
+ //
+ // isCreditNoteCheckBox
+ //
+ this.isCreditNoteCheckBox.DataBindings.Add(new System.Windows.Forms.Binding("CheckState", this.bsInvoice, "IsCreditNote", true));
+ this.isCreditNoteCheckBox.Location = new System.Drawing.Point(578, 102);
+ this.isCreditNoteCheckBox.Name = "isCreditNoteCheckBox";
+ this.isCreditNoteCheckBox.Size = new System.Drawing.Size(104, 24);
+ this.isCreditNoteCheckBox.TabIndex = 11;
+ this.isCreditNoteCheckBox.Text = "checkBox1";
+ this.isCreditNoteCheckBox.UseVisualStyleBackColor = true;
+ //
+ // referenceTextBox
+ //
+ this.referenceTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "Reference", true));
+ this.referenceTextBox.Location = new System.Drawing.Point(149, 128);
+ this.referenceTextBox.Name = "referenceTextBox";
+ this.referenceTextBox.Size = new System.Drawing.Size(200, 20);
+ this.referenceTextBox.TabIndex = 13;
+ //
+ // saleInvoiceNumberTextBox
+ //
+ this.saleInvoiceNumberTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "SaleInvoiceNumber", true));
+ this.saleInvoiceNumberTextBox.Location = new System.Drawing.Point(149, 50);
+ this.saleInvoiceNumberTextBox.Name = "saleInvoiceNumberTextBox";
+ this.saleInvoiceNumberTextBox.Size = new System.Drawing.Size(100, 20);
+ this.saleInvoiceNumberTextBox.TabIndex = 15;
+ //
+ // statusTextBox
+ //
+ this.statusTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsInvoice, "Status", true));
+ this.statusTextBox.Location = new System.Drawing.Point(578, 132);
+ this.statusTextBox.Name = "statusTextBox";
+ this.statusTextBox.Size = new System.Drawing.Size(100, 20);
+ this.statusTextBox.TabIndex = 17;
+ //
+ // invoiceLineListBindingSource
+ //
+ this.invoiceLineListBindingSource.DataMember = "InvoiceLineList";
+ this.invoiceLineListBindingSource.DataSource = this.bsInvoice;
+ //
+ // invoiceLineListDataGridView
+ //
+ this.invoiceLineListDataGridView.AllowUserToAddRows = false;
+ this.invoiceLineListDataGridView.AllowUserToDeleteRows = false;
+ this.invoiceLineListDataGridView.AutoGenerateColumns = false;
+ this.invoiceLineListDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.invoiceLineListDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.dataGridViewTextBoxColumn1,
+ this.dataGridViewTextBoxColumn3,
+ this.dataGridViewTextBoxColumn4,
+ this.dataGridViewTextBoxColumn5,
+ this.dataGridViewTextBoxColumn7,
+ this.dataGridViewTextBoxColumn8,
+ this.dataGridViewTextBoxColumn9,
+ this.dataGridViewTextBoxColumn10});
+ this.invoiceLineListDataGridView.DataSource = this.invoiceLineListBindingSource;
+ this.invoiceLineListDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.invoiceLineListDataGridView.Location = new System.Drawing.Point(0, 0);
+ this.invoiceLineListDataGridView.Name = "invoiceLineListDataGridView";
+ this.invoiceLineListDataGridView.ReadOnly = true;
+ this.invoiceLineListDataGridView.Size = new System.Drawing.Size(800, 296);
+ this.invoiceLineListDataGridView.TabIndex = 18;
+ //
+ // dataGridViewTextBoxColumn1
+ //
+ this.dataGridViewTextBoxColumn1.DataPropertyName = "LineNumber";
+ this.dataGridViewTextBoxColumn1.HeaderText = "Line";
+ this.dataGridViewTextBoxColumn1.MinimumWidth = 30;
+ this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
+ this.dataGridViewTextBoxColumn1.ReadOnly = true;
+ this.dataGridViewTextBoxColumn1.Width = 30;
+ //
+ // dataGridViewTextBoxColumn3
+ //
+ this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.dataGridViewTextBoxColumn3.DataPropertyName = "Description";
+ this.dataGridViewTextBoxColumn3.HeaderText = "Description";
+ this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
+ this.dataGridViewTextBoxColumn3.ReadOnly = true;
+ //
+ // dataGridViewTextBoxColumn4
+ //
+ this.dataGridViewTextBoxColumn4.DataPropertyName = "Quantity";
+ this.dataGridViewTextBoxColumn4.HeaderText = "Quantity";
+ this.dataGridViewTextBoxColumn4.MinimumWidth = 30;
+ this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
+ this.dataGridViewTextBoxColumn4.ReadOnly = true;
+ this.dataGridViewTextBoxColumn4.Width = 30;
+ //
+ // dataGridViewTextBoxColumn5
+ //
+ this.dataGridViewTextBoxColumn5.DataPropertyName = "UnitAmount";
+ this.dataGridViewTextBoxColumn5.HeaderText = "Unit Amount";
+ this.dataGridViewTextBoxColumn5.MinimumWidth = 40;
+ this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
+ this.dataGridViewTextBoxColumn5.ReadOnly = true;
+ this.dataGridViewTextBoxColumn5.Width = 40;
+ //
+ // dataGridViewTextBoxColumn7
+ //
+ this.dataGridViewTextBoxColumn7.DataPropertyName = "AccountCode";
+ this.dataGridViewTextBoxColumn7.HeaderText = "Account Code";
+ this.dataGridViewTextBoxColumn7.MinimumWidth = 50;
+ this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
+ this.dataGridViewTextBoxColumn7.ReadOnly = true;
+ this.dataGridViewTextBoxColumn7.Width = 50;
+ //
+ // dataGridViewTextBoxColumn8
+ //
+ this.dataGridViewTextBoxColumn8.DataPropertyName = "TaxType";
+ this.dataGridViewTextBoxColumn8.HeaderText = "Tax Type";
+ this.dataGridViewTextBoxColumn8.MinimumWidth = 50;
+ this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
+ this.dataGridViewTextBoxColumn8.ReadOnly = true;
+ this.dataGridViewTextBoxColumn8.Width = 50;
+ //
+ // dataGridViewTextBoxColumn9
+ //
+ this.dataGridViewTextBoxColumn9.DataPropertyName = "TaxAmount";
+ this.dataGridViewTextBoxColumn9.HeaderText = "Tax Amount";
+ this.dataGridViewTextBoxColumn9.MinimumWidth = 50;
+ this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
+ this.dataGridViewTextBoxColumn9.ReadOnly = true;
+ this.dataGridViewTextBoxColumn9.Width = 50;
+ //
+ // dataGridViewTextBoxColumn10
+ //
+ this.dataGridViewTextBoxColumn10.DataPropertyName = "LineAmount";
+ this.dataGridViewTextBoxColumn10.HeaderText = "Line Amount";
+ this.dataGridViewTextBoxColumn10.MinimumWidth = 50;
+ this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
+ this.dataGridViewTextBoxColumn10.ReadOnly = true;
+ this.dataGridViewTextBoxColumn10.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;
+ //
+ // taxTotalLabel
+ //
+ taxTotalLabel.AutoSize = true;
+ taxTotalLabel.Location = new System.Drawing.Point(517, 53);
+ taxTotalLabel.Name = "taxTotalLabel";
+ taxTotalLabel.Size = new System.Drawing.Size(55, 13);
+ taxTotalLabel.TabIndex = 18;
+ taxTotalLabel.Text = "Tax Total:";
+ //
+ // 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);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 475);
+ this.Controls.Add(this.splitContainer1);
+ this.Name = "frmSaleInvoice";
+ 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);
+ this.splitContainer1.Panel1.PerformLayout();
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.BindingSource bsInvoice;
+ private System.Windows.Forms.TextBox contactNameTextBox;
+ private System.Windows.Forms.TextBox currencyCodeTextBox;
+ private System.Windows.Forms.DateTimePicker dueDateDateTimePicker;
+ private System.Windows.Forms.DateTimePicker invoiceDateDateTimePicker;
+ private System.Windows.Forms.TextBox invoiceTotalTextBox;
+ private System.Windows.Forms.CheckBox isCreditNoteCheckBox;
+ private System.Windows.Forms.TextBox referenceTextBox;
+ private System.Windows.Forms.TextBox saleInvoiceNumberTextBox;
+ private System.Windows.Forms.TextBox statusTextBox;
+ private System.Windows.Forms.BindingSource invoiceLineListBindingSource;
+ private System.Windows.Forms.DataGridView invoiceLineListDataGridView;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
+ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.TextBox taxTotalTextBox;
+ }
+}
\ No newline at end of file
diff --git a/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.cs b/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.cs
new file mode 100644
index 0000000..19fd255
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace BealeEngineering.Accounts
+{
+ public partial class frmSaleInvoice : Form
+ {
+ public frmSaleInvoice(Core.Model.Sale.Invoice invoice = null)
+ {
+ InitializeComponent();
+
+ bsInvoice.DataSource = invoice;
+ invoiceLineListBindingSource.DataSource = invoice.InvoiceLineList;
+ }
+ }
+}
diff --git a/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.resx b/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.resx
new file mode 100644
index 0000000..8d4f78e
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Accounts/frmSaleInvoice.resx
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+ 69, 24
+
+
+ 69, 24
+
+
+ 186, 27
+
+
+ False
+
+
\ No newline at end of file
diff --git a/BealeEngineering/BealeEngineering.Core/BealeEngineering.Core.csproj b/BealeEngineering/BealeEngineering.Core/BealeEngineering.Core.csproj
index 8f1c218..022cbb0 100644
--- a/BealeEngineering/BealeEngineering.Core/BealeEngineering.Core.csproj
+++ b/BealeEngineering/BealeEngineering.Core/BealeEngineering.Core.csproj
@@ -63,15 +63,22 @@
+
+
+
+
+
+
+
@@ -104,7 +111,6 @@
-
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderAllocation.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderAllocation.cs
index 1495e4b..8a9c5e6 100644
--- a/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderAllocation.cs
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderAllocation.cs
@@ -14,7 +14,9 @@ namespace BealeEngineering.Core.Data.Database.Client
{
}
+
public bool IncludeClosed { get; set; } = false;
+
public List Read()
{
// build the sql string and dapper parameters
@@ -46,6 +48,7 @@ namespace BealeEngineering.Core.Data.Database.Client
WHERE (ClientPurchaseOrder.IsClosed = 0 OR ClientPurchaseOrder.IsClosed = @returnClosed)
ORDER BY ClientPurchaseOrder.PurchaseOrderDate
,ProjectJob.JobNumber";
+
// make the call
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderHeader.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderHeader.cs
index 9427092..4acfc57 100644
--- a/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderHeader.cs
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderHeader.cs
@@ -101,7 +101,13 @@ namespace BealeEngineering.Core.Data.Database.Client
else if (purchaseOrderLineId != null)
{
sqlString = sqlString + @"
- AND ClientPurchaseOrderLine.ClientPurchaseOrderLineID = @lineId";
+ AND ClientPurchaseOrder.ClientPurchaseOrderID =
+ (
+ SELECT ClientPurchaseOrderID
+ FROM ClientPurchaseOrderLine
+ WHERE ClientPurchaseOrderLineID = @lineId
+ )
+ ";
parameters.Add("@lineId", (int)purchaseOrderLineId);
}
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderLineFacility.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderLineFacility.cs
new file mode 100644
index 0000000..86a0dda
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Client/ReadPurchaseOrderLineFacility.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BealeEngineering.Core.Data.Database.Client
+{
+ public class ReadPurchaseOrderLineFacility : Connection
+ {
+ public ReadPurchaseOrderLineFacility(string sqlConnectionString) : base(sqlConnectionString)
+ {
+
+ }
+
+ public decimal? Read(int purcasheOrderLineId)
+ {
+ // make the call
+ using (SqlConnection conn = new SqlConnection(sqlConnectionString))
+ {
+ conn.Open();
+
+ //get remaining facility on purchase order line
+ decimal facilityNet = 0;
+ using (var cmd = new SqlCommand(@"
+ SELECT LineNetAmount - ISNULL((
+ SELECT SUM(SaleInvoice.InvoiceTotal - SaleInvoice.TaxTotal) AS SumNetTotal
+ FROM ClientPurchaseOrderLine
+ INNER JOIN ClientPurchaseOrderLineSalesInvoice ON ClientPurchaseOrderLine.ClientPurchaseOrderLineID = ClientPurchaseOrderLineSalesInvoice.ClientPurchaseOrderLineID
+ INNER JOIN SaleInvoice ON ClientPurchaseOrderLineSalesInvoice.SaleInvoiceID = SaleInvoice.SaleInvoiceID
+ GROUP BY ClientPurchaseOrderLine.ClientPurchaseOrderLineID
+ HAVING (ClientPurchaseOrderLine.ClientPurchaseOrderLineID = @purcasheOrderLineId)
+ ), 0) AS LineFacility
+ FROM ClientPurchaseOrderLine
+ WHERE (ClientPurchaseOrderLineID = @purcasheOrderLineId)
+ " , conn))
+ {
+ cmd.Parameters.AddWithValue("purcasheOrderLineId", purcasheOrderLineId);
+
+ object obj = cmd.ExecuteScalar();
+
+ if (obj == null || obj == DBNull.Value)
+ {
+ return null;
+ }
+
+ facilityNet = (decimal)obj;
+ }
+
+ return facilityNet;
+ }
+ }
+ }
+}
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoice.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoice.cs
index cd81668..0939381 100644
--- a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoice.cs
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoice.cs
@@ -14,7 +14,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
{
}
+
public List SaleInvoiceHeader { get; set; }
+
public bool SaleInvoiceHeaderIsSet
{
get
@@ -23,7 +25,17 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; }
}
}
- public new List GetBySaleInvoiceId(List invoiceIdList)
+
+ public new Model.Sale.Invoice BySaleInvoiceId(int invoiceId)
+ {
+ var invoiceList = new List { invoiceId };
+ var resultList = BySaleInvoiceId(invoiceList);
+
+ if (resultList == null || !resultList.Any()) { return null; }
+ else { return resultList[0]; }
+ }
+
+ public new List BySaleInvoiceId(List invoiceIdList)
{
SalesInvoiceIdList = invoiceIdList;
try
@@ -39,6 +51,33 @@ namespace BealeEngineering.Core.Data.Database.Sale
SalesInvoiceIdList = null;
}
}
+
+ public new Model.Sale.Invoice BySaleInvoiceNumber(string invoiceNumber)
+ {
+ var invoiceList = new List { invoiceNumber };
+ var resultList = BySaleInvoiceNumber(invoiceList);
+
+ if (resultList == null || !resultList.Any()) { return null; }
+ else { return resultList[0]; }
+ }
+
+ public new List BySaleInvoiceNumber(List invoiceNumberList)
+ {
+ SalesInvoiceNumberList = invoiceNumberList;
+ try
+ {
+ return Read();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ SalesInvoiceNumberList = null;
+ }
+ }
+
public new List Read()
{
// build the sql string and dapper parameters
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoiceHeader.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoiceHeader.cs
index c6cb273..758b17d 100644
--- a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoiceHeader.cs
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadInvoiceHeader.cs
@@ -14,11 +14,10 @@ namespace BealeEngineering.Core.Data.Database.Sale
{
}
- ///
- /// Setting this will override he other filters, within the sql statement.
- ///
+
protected List SalesInvoiceIdList { get; set; }
- private bool SalesInvoiceIdListListIsSet
+
+ protected bool SalesInvoiceIdListListIsSet
{
get
{
@@ -26,7 +25,20 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; }
}
}
+
+ protected List SalesInvoiceNumberList { get; set; }
+
+ protected bool SalesInvoiceNumberListIsSet
+ {
+ get
+ {
+ if (SalesInvoiceNumberList == null || !SalesInvoiceNumberList.Any()) { return false; }
+ else { return true; }
+ }
+ }
+
public DateTime DateFrom { get; set; }
+
public bool DateFromIsSet
{
get
@@ -35,7 +47,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; }
}
}
+
public DateTime DateTo { get; set; }
+
public bool DateToIsSet
{
get
@@ -44,7 +58,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; }
}
}
+
public List InvoiceNumber { get; set; }
+
public bool InvoiceNumberIsSet
{
get
@@ -53,7 +69,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; }
}
}
+
public List Reference { get; set; }
+
public bool ReferenceIsSet
{
get
@@ -62,12 +80,22 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; }
}
}
- public List GetBySaleInvoiceId(List orderIdList)
+
+ public Model.Sale.InvoiceHeader BySaleInvoiceId(int invoiceId)
{
- SalesInvoiceIdList = orderIdList;
+ var invoiceList = new List { invoiceId };
+ var resultList = BySaleInvoiceId(invoiceList);
+
+ if (resultList == null || !resultList.Any()) { return null; }
+ else { return resultList[0]; }
+ }
+
+ public List BySaleInvoiceId(List invoiceIdList)
+ {
+ SalesInvoiceIdList = invoiceIdList;
try
{
- return GetByFilters();
+ return Read();
}
catch (Exception ex)
{
@@ -78,6 +106,33 @@ namespace BealeEngineering.Core.Data.Database.Sale
SalesInvoiceIdList = null;
}
}
+
+ public Model.Sale.InvoiceHeader BySaleInvoiceNumber(string invoiceNumber)
+ {
+ var invoiceList = new List { invoiceNumber };
+ var resultList = BySaleInvoiceNumber(invoiceList);
+
+ if (resultList == null || !resultList.Any()) { return null; }
+ else { return resultList[0]; }
+ }
+
+ public List BySaleInvoiceNumber(List invoiceNumberList)
+ {
+ SalesInvoiceNumberList = invoiceNumberList;
+ try
+ {
+ return Read();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ SalesInvoiceNumberList = null;
+ }
+ }
+
protected void AddSqlWhereString(ref string sqlString, ref DynamicParameters parameters)
{
if (string.IsNullOrWhiteSpace(sqlString))
@@ -93,6 +148,13 @@ namespace BealeEngineering.Core.Data.Database.Sale
parameters.Add("@saleInvoiceId", SalesInvoiceIdList);
}
+ else if (SalesInvoiceNumberListIsSet)
+ {
+ sqlString = sqlString + @"
+ AND SaleInvoice.SaleInvoiceNumber IN @salesInvoiceNumberList";
+
+ parameters.Add("@salesInvoiceNumberList", SalesInvoiceNumberList);
+ }
else
{
if (DateFromIsSet)
@@ -125,7 +187,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
}
}
}
- public List GetByFilters()
+ public List Read()
{
// build the sql string and dapper parameters
var parameters = new DynamicParameters();
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadNextInvoiceNumber.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadNextInvoiceNumber.cs
new file mode 100644
index 0000000..8650ed0
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/ReadNextInvoiceNumber.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BealeEngineering.Core.Data.Database.Sale
+{
+ public class ReadNextInvoiceNumber : Connection
+ {
+ Data.SaleInvoiceNumberFormat numberFormat = new Data.SaleInvoiceNumberFormat();
+
+ public ReadNextInvoiceNumber(string sqlConnectionString) : base(sqlConnectionString)
+ {
+
+ }
+
+ public string Read(bool IsCreditNote = false)
+ {
+ string prefix;
+ if (IsCreditNote) { prefix = numberFormat.ReadCreditNotePrefix(); }
+ else { prefix = numberFormat.ReadInvoicePrefix(); }
+
+ return prefix + ReadNextCount().ToString("D" + numberFormat.ReadNumberLength());
+ }
+
+ protected int ReadNextCount()
+ {
+ // make the call
+ using (SqlConnection conn = new SqlConnection(sqlConnectionString))
+ {
+ conn.Open();
+
+ int prefixLength = new Data.SaleInvoiceNumberFormat().ReadNumberPrefixLength();
+
+ //get remaining facility on purchase order line
+ using (var cmd = new SqlCommand(@"
+ SELECT TOP 1 RIGHT(SaleInvoiceNumber, (LEN(SaleInvoiceNumber) - " + prefixLength + @")) AS MyTrimmedColumn
+ FROM SaleInvoice
+ ORDER BY MyTrimmedColumn DESC
+ ", conn))
+ {
+ object obj = cmd.ExecuteScalar();
+
+ if (obj == null || obj == DBNull.Value)
+ {
+ throw new NullReferenceException("Unable to find next invoice number.");
+ }
+
+ return int.Parse(obj.ToString()) + 1;
+ }
+ }
+ }
+
+ }
+}
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/UpdateInvoice.cs b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/UpdateInvoice.cs
index fe3543a..9bc7111 100644
--- a/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/UpdateInvoice.cs
+++ b/BealeEngineering/BealeEngineering.Core/Data/Database/Sale/UpdateInvoice.cs
@@ -20,15 +20,21 @@ namespace BealeEngineering.Core.Data.Database.Sale
{
}
+
public int RecordsCreated { get { return recordsCreated; } }
+
public int RecordsUpdated { get { return recordsUpdated; } }
+
public int InvoicesProcessed { get { return invoicesProcessed; } }
+
public int InvoicesSkipped { get { return invoicesSkipped; } }
+
public void ByInvoice(Model.Sale.Invoice invoice, bool insertNew = false)
{
var invoiceList = new List { invoice };
ByInvoiceList(invoiceList, insertNew);
}
+
public void ByInvoiceList(List invoiceList, bool insertNew = false)
{
recordsCreated = 0;
@@ -40,7 +46,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
if (invoiceList == null || !invoiceList.Any()) { return; }
else { invoicesProcessed = invoiceList.Count(); }
- CheckList(ref invoiceList);
+ ValidateInvoices(ref invoiceList);
using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
@@ -200,7 +206,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
if (string.IsNullOrWhiteSpace(line.TaxType)) { cmd.Parameters.AddWithValue("@taxType", DBNull.Value); }
else { cmd.Parameters.AddWithValue("@taxType", line.TaxType); }
cmd.Parameters.AddWithValue("@taxAmount", line.TaxAmount);
- cmd.Parameters.AddWithValue("@lineAmount", line.LineAmount);
+ cmd.Parameters.AddWithValue("@lineAmount", line.LineNetAmount);
cmd.ExecuteNonQuery();
}
@@ -217,7 +223,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
}
}
}
- private void CheckList(ref List invoiceList)
+ private void ValidateInvoices(ref List invoiceList)
{
var tempDic = new Dictionary();
foreach (var item in invoiceList)
diff --git a/BealeEngineering/BealeEngineering.Core/Data/SaleInvoiceNumberFormat.cs b/BealeEngineering/BealeEngineering.Core/Data/SaleInvoiceNumberFormat.cs
new file mode 100644
index 0000000..bf650bf
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Core/Data/SaleInvoiceNumberFormat.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BealeEngineering.Core.Data
+{
+ public class SaleInvoiceNumberFormat
+ {
+ public string ReadInvoicePrefix()
+ {
+ return "BI#";
+ }
+
+ public string ReadCreditNotePrefix()
+ {
+ return "CN#";
+ }
+
+ public int ReadNumberLength()
+ {
+ return 6;
+ }
+
+ public int ReadNumberPrefixLength()
+ {
+ return 3;
+ }
+ }
+}
diff --git a/BealeEngineering/BealeEngineering.Core/Data/Xero/ReadXeroInvoiceFlatFile.cs b/BealeEngineering/BealeEngineering.Core/Data/Xero/ReadXeroInvoiceFlatFile.cs
index 2dbbf3f..a4e11b3 100644
--- a/BealeEngineering/BealeEngineering.Core/Data/Xero/ReadXeroInvoiceFlatFile.cs
+++ b/BealeEngineering/BealeEngineering.Core/Data/Xero/ReadXeroInvoiceFlatFile.cs
@@ -21,11 +21,19 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
+ @"\Downloads\MyNewTextFile.txt";
}
+
private StringBuilder IntermediateCsv { get; set; }
+
+ public DateTime FileInputCreatedDate { get; private set; }
+
public string FileInputPath { get; set; }
+
public string FileOutputPath { get; set; }
+
private List> MsVbTextParserResult { get; set; }
+
private StringBuilder CsvContent { get; set; }
+
///
/// Imports Xero invoice flat-file into model class.
///
@@ -63,7 +71,7 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
dto = csv.GetRecords().ToList();
}
-
+ FileInputCreatedDate = File.GetCreationTime(FileInputPath);
return new Logic.Adapter.XeroInvoiceFlatFile().XeroInvoiceFlatFileDTO(dto);
}
}
diff --git a/BealeEngineering/BealeEngineering.Core/Logic/Adapter/SaleInvoice.cs b/BealeEngineering/BealeEngineering.Core/Logic/Adapter/SaleInvoice.cs
index 2664182..d098178 100644
--- a/BealeEngineering/BealeEngineering.Core/Logic/Adapter/SaleInvoice.cs
+++ b/BealeEngineering/BealeEngineering.Core/Logic/Adapter/SaleInvoice.cs
@@ -12,7 +12,7 @@ namespace BealeEngineering.Core.Logic.Adapter
{
// ensure sale invoice hasn't changed
int propertyCount = new Model.Sale.Invoice().GetType().GetProperties().Count();
- if (propertyCount != 14)
+ if (propertyCount != 15)
{
throw new Exception("Model.Import.XeroInvoiceFlatFile has changed, it's adapter class may need updating.");
}
@@ -68,7 +68,7 @@ namespace BealeEngineering.Core.Logic.Adapter
invoiceLine.UnitAmount = xeroInvoiceList[i].LineItemList[j].UnitAmount;
//check, as line amount is same as calculated in model
- if (invoiceLine.LineAmount != xeroInvoiceList[i].LineItemList[j].LineAmount)
+ if (invoiceLine.LineNetAmount != xeroInvoiceList[i].LineItemList[j].LineAmount)
{
throw new Exception("Imported line total does not equal caluclated.");
}
diff --git a/BealeEngineering/BealeEngineering.Core/Logic/Adapter/XeroInvoiceFlatFile.cs b/BealeEngineering/BealeEngineering.Core/Logic/Adapter/XeroInvoiceFlatFile.cs
index 00cedf0..ac9b072 100644
--- a/BealeEngineering/BealeEngineering.Core/Logic/Adapter/XeroInvoiceFlatFile.cs
+++ b/BealeEngineering/BealeEngineering.Core/Logic/Adapter/XeroInvoiceFlatFile.cs
@@ -55,7 +55,7 @@ namespace BealeEngineering.Core.Logic.Adapter
line.Description = invoiceList[i].InvoiceLineList[j].Description;
line.Discount = invoiceList[i].InvoiceLineList[j].Discount;
line.InventoryItemCode = invoiceList[i].InvoiceLineList[j].InventoryItemCode;
- line.LineAmount = invoiceList[i].InvoiceLineList[j].LineAmount;
+ line.LineAmount = invoiceList[i].InvoiceLineList[j].LineNetAmount;
line.Quantity = invoiceList[i].InvoiceLineList[j].Quantity;
line.TaxAmount = invoiceList[i].InvoiceLineList[j].TaxAmount;
line.TaxType = invoiceList[i].InvoiceLineList[j].TaxType;
diff --git a/BealeEngineering/BealeEngineering.Core/Logic/Client/PurchaseOrderAutoAllocate.cs b/BealeEngineering/BealeEngineering.Core/Logic/Client/PurchaseOrderAutoAllocate.cs
index 3f109c8..f0e188c 100644
--- a/BealeEngineering/BealeEngineering.Core/Logic/Client/PurchaseOrderAutoAllocate.cs
+++ b/BealeEngineering/BealeEngineering.Core/Logic/Client/PurchaseOrderAutoAllocate.cs
@@ -44,7 +44,7 @@ namespace BealeEngineering.Core.Logic.Client
// get invoice header info
var readInvoice = new Data.Database.Sale.ReadInvoiceHeader(SqlConnectionString);
readInvoice.InvoiceNumber = invoiceNumberList;
- var invoiceList = readInvoice.GetByFilters();
+ var invoiceList = readInvoice.Read();
// create lookup list for matching
var lookupList = new List>();
diff --git a/BealeEngineering/BealeEngineering.Core/Logic/Import/XeroInvoiceFlatFile.cs b/BealeEngineering/BealeEngineering.Core/Logic/Import/XeroInvoiceFlatFile.cs
index 90408f9..659111e 100644
--- a/BealeEngineering/BealeEngineering.Core/Logic/Import/XeroInvoiceFlatFile.cs
+++ b/BealeEngineering/BealeEngineering.Core/Logic/Import/XeroInvoiceFlatFile.cs
@@ -70,6 +70,10 @@ namespace BealeEngineering.Core.Logic.Import
if (InvoicesProcessed != (InvoicesCreated + InvoicesUpdated + InvoicesSkipped))
{ throw new Exception("Error importing invoices"); }
}
+
+ // update datetime log
+ new Data.Database.Log.UpdateDateTime(sqlConnectionString)
+ .ByMatchString("XeroSaleInvoiceFlatFileImport", flatfileData.FileInputCreatedDate);
}
///
/// Get a dictionary of contacts, referenced by unique 'Contact Name'. Any contacts not found in db are
diff --git a/BealeEngineering/BealeEngineering.Core/Logic/Prototype/ObjectExtensions.cs b/BealeEngineering/BealeEngineering.Core/Logic/Prototype/ObjectExtensions.cs
new file mode 100644
index 0000000..0e7a451
--- /dev/null
+++ b/BealeEngineering/BealeEngineering.Core/Logic/Prototype/ObjectExtensions.cs
@@ -0,0 +1,136 @@
+//using BealeEngineering.Core.Logic.Prototype.ArrayExtensions;
+using System;
+using System.ArrayExtensions;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+//namespace BealeEngineering.Core.Logic.Prototype
+namespace System
+{
+ public static class ObjectExtensions
+ {
+ private static readonly MethodInfo CloneMethod = typeof(Object).GetMethod("MemberwiseClone", BindingFlags.NonPublic | BindingFlags.Instance);
+
+ public static bool IsPrimitive(this Type type)
+ {
+ if (type == typeof(String)) return true;
+ return (type.IsValueType & type.IsPrimitive);
+ }
+
+ public static Object Copy(this Object originalObject)
+ {
+ return InternalCopy(originalObject, new Dictionary