Invoice form and allocation

Added form to view sales invoices.
Feature to match and split sales invoices to purchase orders
Other minor updates/improvements to UI and database functions
This commit is contained in:
2020-02-15 10:08:30 +00:00
committed by GitHub
parent a0c4349040
commit c5e0d8c6d8
29 changed files with 1944 additions and 170 deletions

View File

@@ -58,7 +58,7 @@
<GenerateManifests>true</GenerateManifests> <GenerateManifests>true</GenerateManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignManifests>true</SignManifests> <SignManifests>false</SignManifests>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@@ -86,19 +86,25 @@
<Compile Include="frmClientPurchaseOrder.Designer.cs"> <Compile Include="frmClientPurchaseOrder.Designer.cs">
<DependentUpon>frmClientPurchaseOrder.cs</DependentUpon> <DependentUpon>frmClientPurchaseOrder.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Form1.cs"> <Compile Include="frmMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="Form1.Designer.cs"> <Compile Include="frmMain.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>frmMain.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="frmSaleInvoice.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSaleInvoice.Designer.cs">
<DependentUpon>frmSaleInvoice.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="frmClientPurchaseOrder.resx"> <EmbeddedResource Include="frmClientPurchaseOrder.resx">
<DependentUpon>frmClientPurchaseOrder.cs</DependentUpon> <DependentUpon>frmClientPurchaseOrder.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Form1.resx"> <EmbeddedResource Include="frmMain.resx">
<DependentUpon>Form1.cs</DependentUpon> <DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
@@ -109,6 +115,9 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<EmbeddedResource Include="frmSaleInvoice.resx">
<DependentUpon>frmSaleInvoice.cs</DependentUpon>
</EmbeddedResource>
<None Include="BealeEngDataSet.xsc"> <None Include="BealeEngDataSet.xsc">
<DependentUpon>BealeEngDataSet.xsd</DependentUpon> <DependentUpon>BealeEngDataSet.xsd</DependentUpon>
</None> </None>
@@ -124,6 +133,8 @@
<None Include="Properties\DataSources\BealeEngineering.Core.Model.Client.PurchaseOrder+PurchaseOrderLine.datasource" /> <None Include="Properties\DataSources\BealeEngineering.Core.Model.Client.PurchaseOrder+PurchaseOrderLine.datasource" />
<None Include="Properties\DataSources\BealeEngineering.Core.Model.Client.PurchaseOrder.datasource" /> <None Include="Properties\DataSources\BealeEngineering.Core.Model.Client.PurchaseOrder.datasource" />
<None Include="Properties\DataSources\BealeEngineering.Core.Model.Client.PurchaseOrderAllocation.datasource" /> <None Include="Properties\DataSources\BealeEngineering.Core.Model.Client.PurchaseOrderAllocation.datasource" />
<None Include="Properties\DataSources\BealeEngineering.Core.Model.Sale.Invoice.datasource" />
<None Include="Properties\DataSources\BealeEngineering.Core.Model.Sale.InvoiceHeader.datasource" />
<None Include="Properties\DataSources\Form1.datasource" /> <None Include="Properties\DataSources\Form1.datasource" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

View File

@@ -16,7 +16,7 @@ namespace BealeEngineering.Accounts
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); Application.Run(new frmMain());
} }
} }
} }

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Invoice" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>BealeEngineering.Core.Model.Sale.Invoice, BealeEngineering.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="InvoiceHeader" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>BealeEngineering.Core.Model.Sale.InvoiceHeader, BealeEngineering.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -1,6 +1,6 @@
namespace BealeEngineering.Accounts namespace BealeEngineering.Accounts
{ {
partial class Form1 partial class frmMain
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -29,27 +29,26 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); 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.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.splitContainer3 = new System.Windows.Forms.SplitContainer(); 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.btnAutoMatch = new System.Windows.Forms.Button();
this.btnOpenPurchaseOrder = new System.Windows.Forms.Button(); this.btnOpenPurchaseOrder = new System.Windows.Forms.Button();
this.btnAddPurchaseOrder = new System.Windows.Forms.Button(); this.btnAddPurchaseOrder = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox(); this.txtInvoiceImportDt = new System.Windows.Forms.TextBox();
this.txtUnallocatedCount = new System.Windows.Forms.TextBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView(); 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.ContactName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ProjectTitle = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ProjectTitle = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.PurchaseOrderDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -60,28 +59,64 @@
this.InvoicedAmount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.InvoicedAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineFacility = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.PurchaseOrderLineFacility = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.JobNumber = 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.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.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit();
this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout();
this.splitContainer3.SuspendLayout(); this.splitContainer3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderAllocationBindingSource)).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(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// tabControl1 // tabControl1
// //
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabSaleInvoice);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 24); this.tabControl1.Location = new System.Drawing.Point(0, 24);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1151, 721); this.tabControl1.Size = new System.Drawing.Size(1151, 721);
this.tabControl1.TabIndex = 5; this.tabControl1.TabIndex = 5;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
// //
// tabPage1 // tabPage1
// //
@@ -103,14 +138,19 @@
// //
// splitContainer3.Panel1 // 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.btnAutoMatch);
this.splitContainer3.Panel1.Controls.Add(this.btnOpenPurchaseOrder); this.splitContainer3.Panel1.Controls.Add(this.btnOpenPurchaseOrder);
this.splitContainer3.Panel1.Controls.Add(this.btnAddPurchaseOrder); this.splitContainer3.Panel1.Controls.Add(this.btnAddPurchaseOrder);
this.splitContainer3.Panel1.Controls.Add(this.button1); this.splitContainer3.Panel1.Controls.Add(this.button1);
this.splitContainer3.Panel1.Controls.Add(this.label1); this.splitContainer3.Panel1.Controls.Add(this.label1);
this.splitContainer3.Panel1.Controls.Add(this.label2); this.splitContainer3.Panel1.Controls.Add(this.label2);
this.splitContainer3.Panel1.Controls.Add(this.textBox1); this.splitContainer3.Panel1.Controls.Add(this.txtInvoiceImportDt);
this.splitContainer3.Panel1.Controls.Add(this.txtUnallocatedCount);
// //
// splitContainer3.Panel2 // splitContainer3.Panel2
// //
@@ -120,9 +160,69 @@
this.splitContainer3.SplitterDistance = 93; this.splitContainer3.SplitterDistance = 93;
this.splitContainer3.TabIndex = 0; 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 // 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.Name = "btnAutoMatch";
this.btnAutoMatch.Size = new System.Drawing.Size(75, 20); this.btnAutoMatch.Size = new System.Drawing.Size(75, 20);
this.btnAutoMatch.TabIndex = 10; this.btnAutoMatch.TabIndex = 10;
@@ -133,7 +233,7 @@
// btnOpenPurchaseOrder // btnOpenPurchaseOrder
// //
this.btnOpenPurchaseOrder.Anchor = System.Windows.Forms.AnchorStyles.Right; 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.Name = "btnOpenPurchaseOrder";
this.btnOpenPurchaseOrder.Size = new System.Drawing.Size(160, 20); this.btnOpenPurchaseOrder.Size = new System.Drawing.Size(160, 20);
this.btnOpenPurchaseOrder.TabIndex = 11; this.btnOpenPurchaseOrder.TabIndex = 11;
@@ -144,7 +244,7 @@
// btnAddPurchaseOrder // btnAddPurchaseOrder
// //
this.btnAddPurchaseOrder.Anchor = System.Windows.Forms.AnchorStyles.Right; 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.Name = "btnAddPurchaseOrder";
this.btnAddPurchaseOrder.Size = new System.Drawing.Size(160, 20); this.btnAddPurchaseOrder.Size = new System.Drawing.Size(160, 20);
this.btnAddPurchaseOrder.TabIndex = 10; this.btnAddPurchaseOrder.TabIndex = 10;
@@ -166,7 +266,7 @@
// label1 // label1
// //
this.label1.AutoSize = true; 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.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 13); this.label1.Size = new System.Drawing.Size(84, 13);
this.label1.TabIndex = 6; this.label1.TabIndex = 6;
@@ -176,27 +276,19 @@
// label2 // label2
// //
this.label2.AutoSize = true; 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.Name = "label2";
this.label2.Size = new System.Drawing.Size(107, 13); this.label2.Size = new System.Drawing.Size(107, 13);
this.label2.TabIndex = 8; this.label2.TabIndex = 8;
this.label2.Text = "Unallocated Invoices"; this.label2.Text = "Unallocated Invoices";
// //
// textBox1 // txtInvoiceImportDt
// //
this.textBox1.Location = new System.Drawing.Point(138, 18); this.txtInvoiceImportDt.Location = new System.Drawing.Point(143, 55);
this.textBox1.Name = "textBox1"; this.txtInvoiceImportDt.Name = "txtInvoiceImportDt";
this.textBox1.Size = new System.Drawing.Size(135, 20); this.txtInvoiceImportDt.ReadOnly = true;
this.textBox1.TabIndex = 5; this.txtInvoiceImportDt.Size = new System.Drawing.Size(130, 20);
// this.txtInvoiceImportDt.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);
// //
// dataGridView1 // dataGridView1
// //
@@ -218,7 +310,6 @@
this.InvoicedAmount, this.InvoicedAmount,
this.PurchaseOrderLineFacility, this.PurchaseOrderLineFacility,
this.JobNumber, this.JobNumber,
this.PurchaseOrderIsClosed,
this.PurchaseOrderLineID}); this.PurchaseOrderLineID});
this.dataGridView1.DataSource = this.purchaseOrderAllocationBindingSource; this.dataGridView1.DataSource = this.purchaseOrderAllocationBindingSource;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -226,81 +317,12 @@
this.dataGridView1.MultiSelect = false; this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true; 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.Size = new System.Drawing.Size(1137, 592);
this.dataGridView1.TabIndex = 2; this.dataGridView1.TabIndex = 2;
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); 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 // ContactName
// //
this.ContactName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.ContactName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
@@ -401,17 +423,6 @@
this.JobNumber.Name = "JobNumber"; this.JobNumber.Name = "JobNumber";
this.JobNumber.ReadOnly = true; 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 // PurchaseOrderLineID
// //
this.PurchaseOrderLineID.DataPropertyName = "PurchaseOrderLineID"; this.PurchaseOrderLineID.DataPropertyName = "PurchaseOrderLineID";
@@ -420,7 +431,260 @@
this.PurchaseOrderLineID.ReadOnly = true; this.PurchaseOrderLineID.ReadOnly = true;
this.PurchaseOrderLineID.Visible = false; 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.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
@@ -428,7 +692,7 @@
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1"; this.Name = "frmMain";
this.Text = "Form1"; this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
@@ -438,10 +702,19 @@
this.splitContainer3.Panel2.ResumeLayout(false); this.splitContainer3.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).EndInit();
this.splitContainer3.ResumeLayout(false); this.splitContainer3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderAllocationBindingSource)).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.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -455,8 +728,7 @@
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox txtInvoiceImportDt;
private System.Windows.Forms.TextBox txtUnallocatedCount;
private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
@@ -469,6 +741,18 @@
private System.Windows.Forms.Button btnAutoMatch; private System.Windows.Forms.Button btnAutoMatch;
private System.Windows.Forms.Button btnAddPurchaseOrder; private System.Windows.Forms.Button btnAddPurchaseOrder;
private System.Windows.Forms.Button btnOpenPurchaseOrder; 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 ContactName;
private System.Windows.Forms.DataGridViewTextBoxColumn ProjectTitle; private System.Windows.Forms.DataGridViewTextBoxColumn ProjectTitle;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderDate; private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderDate;
@@ -479,8 +763,19 @@
private System.Windows.Forms.DataGridViewTextBoxColumn InvoicedAmount; private System.Windows.Forms.DataGridViewTextBoxColumn InvoicedAmount;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineFacility; private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineFacility;
private System.Windows.Forms.DataGridViewTextBoxColumn JobNumber; private System.Windows.Forms.DataGridViewTextBoxColumn JobNumber;
private System.Windows.Forms.DataGridViewCheckBoxColumn PurchaseOrderIsClosed;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineID; 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;
} }
} }

View File

@@ -12,34 +12,65 @@ using BealeEngineering.Core.Data;
namespace BealeEngineering.Accounts namespace BealeEngineering.Accounts
{ {
public partial class Form1 : Form public partial class frmMain : Form
{ {
private string sqlConnectionString; private string sqlConnectionString;
public Form1() Core.Logic.Sale.SaleInvoiceAssign assignInvoice;
public frmMain()
{ {
InitializeComponent(); InitializeComponent();
sqlConnectionString = ConfigurationManager.ConnectionStrings["BealeEngSQLDb"].ToString(); sqlConnectionString = ConfigurationManager.ConnectionStrings["BealeEngSQLDb"].ToString();
assignInvoice = new Core.Logic.Sale.SaleInvoiceAssign(sqlConnectionString);
UpdateInvoiceImportText();
} }
public List<string> TableData { get; set; } public List<string> TableData { get; set; }
private void Form1_Load(object sender, EventArgs e) 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) 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 readData = new Core.Data.Database.Client.ReadPurchaseOrderAllocation(sqlConnectionString);
var data = readData.Read(); var data = readData.Read();
@@ -163,6 +194,7 @@ namespace BealeEngineering.Accounts
MessageBox.Show(dialogText); MessageBox.Show(dialogText);
} }
UpdateInvoiceImportText();
} }
private void xeroInvoiceToolStripMenuItem1_Click(object sender, EventArgs e) private void xeroInvoiceToolStripMenuItem1_Click(object sender, EventArgs e)
@@ -204,7 +236,7 @@ namespace BealeEngineering.Accounts
MessageBox.Show(dialogText); MessageBox.Show(dialogText);
} }
UpdateTable(); button1_Click(null, null);
} }
private void purchaseOrderAllocationBindingSource_CurrentChanged(object sender, EventArgs e) private void purchaseOrderAllocationBindingSource_CurrentChanged(object sender, EventArgs e)
@@ -218,14 +250,142 @@ namespace BealeEngineering.Accounts
frmCLient.ShowDialog(); frmCLient.ShowDialog();
} }
private void btnOpenPurchaseOrder_Click(object sender, EventArgs e) private Core.Model.Client.PurchaseOrder GetSelectPurchaseOrder()
{ {
int idIndex = dataGridView1.Columns["PurchaseOrderLineID"].Index; int idIndex = dataGridView1.Columns["PurchaseOrderLineID"].Index;
int lineId = (int)dataGridView1[idIndex, dataGridView1.CurrentCell.RowIndex].Value; 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(); 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);
}
} }
} }

View File

@@ -117,8 +117,8 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="PurchaseOrderIsClosed.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="invoiceHeaderBindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>True</value> <value>834, 24</value>
</metadata> </metadata>
<metadata name="PurchaseOrderLineID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="PurchaseOrderLineID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
@@ -126,7 +126,25 @@
<metadata name="purchaseOrderAllocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="purchaseOrderAllocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>24, 20</value> <value>24, 20</value>
</metadata> </metadata>
<metadata name="invoiceHeaderBindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>834, 24</value>
</metadata>
<metadata name="TotalAndCurrency.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bindingSourceSaleInvoice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>435, 24</value>
</metadata>
<metadata name="TotalAndCurrency.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bindingSourceSaleInvoice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>435, 24</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>290, 20</value> <value>290, 20</value>
</metadata> </metadata>
<metadata name="invoiceHeaderBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>626, 24</value>
</metadata>
</root> </root>

View File

@@ -0,0 +1,442 @@
namespace BealeEngineering.Accounts
{
partial class frmSaleInvoice
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

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

View File

@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contactNameLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="currencyCodeLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="dueDateLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="invoiceDateLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="invoiceTotalLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="isCreditNoteLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="referenceLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="saleInvoiceNumberLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="statusLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="bsInvoice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>69, 24</value>
</metadata>
<metadata name="bsInvoice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>69, 24</value>
</metadata>
<metadata name="invoiceLineListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>186, 27</value>
</metadata>
<metadata name="taxTotalLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@@ -63,15 +63,22 @@
<Compile Include="Data\Database\Client\CreatePurchaseOrderAllocation.cs" /> <Compile Include="Data\Database\Client\CreatePurchaseOrderAllocation.cs" />
<Compile Include="Data\Database\Client\ReadPurchaseOrder.cs" /> <Compile Include="Data\Database\Client\ReadPurchaseOrder.cs" />
<Compile Include="Data\Database\Client\ReadPurchaseOrderAllocation.cs" /> <Compile Include="Data\Database\Client\ReadPurchaseOrderAllocation.cs" />
<Compile Include="Data\Database\Client\ReadPurchaseOrderLineFacility.cs" />
<Compile Include="Data\Database\Client\ReadSaleInvoiceAllocation.cs" /> <Compile Include="Data\Database\Client\ReadSaleInvoiceAllocation.cs" />
<Compile Include="Data\Database\Contact\UpdateContact.cs" /> <Compile Include="Data\Database\Contact\UpdateContact.cs" />
<Compile Include="Data\Database\Log\ReadDateTime.cs" />
<Compile Include="Data\Database\Log\UpdateDateTime.cs" />
<Compile Include="Data\Database\Sale\CreateInvoice.cs" /> <Compile Include="Data\Database\Sale\CreateInvoice.cs" />
<Compile Include="Data\Database\Sale\ReadNextInvoiceNumber.cs" />
<Compile Include="Data\Database\Sale\UpdateInvoice.cs" /> <Compile Include="Data\Database\Sale\UpdateInvoice.cs" />
<Compile Include="Data\SaleInvoiceNumberFormat.cs" />
<Compile Include="Logic\Adapter\Contact.cs" /> <Compile Include="Logic\Adapter\Contact.cs" />
<Compile Include="Logic\Adapter\SaleInvoice.cs" /> <Compile Include="Logic\Adapter\SaleInvoice.cs" />
<Compile Include="Logic\Adapter\XeroInvoiceFlatFile.cs" /> <Compile Include="Logic\Adapter\XeroInvoiceFlatFile.cs" />
<Compile Include="Logic\Adapter\XeroInvoiceFlatFileDTO.cs" /> <Compile Include="Logic\Adapter\XeroInvoiceFlatFileDTO.cs" />
<Compile Include="Logic\Export\XeroInvoiceFlatFile.cs" /> <Compile Include="Logic\Export\XeroInvoiceFlatFile.cs" />
<Compile Include="Logic\Prototype\ObjectExtensions.cs" />
<Compile Include="Logic\Sale\SaleInvoiceAssign.cs" />
<Compile Include="Model\Client\PurchaseOrderAllocation.cs" /> <Compile Include="Model\Client\PurchaseOrderAllocation.cs" />
<Compile Include="Model\Contact\Address.cs" /> <Compile Include="Model\Contact\Address.cs" />
<Compile Include="Data\Database\Contact\CreateContact.cs" /> <Compile Include="Data\Database\Contact\CreateContact.cs" />
@@ -104,7 +111,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Data\Xero\FlatFile\" /> <Folder Include="Data\Xero\FlatFile\" />
<Folder Include="Logic\Sale\" />
<Folder Include="Service\Contact\" /> <Folder Include="Service\Contact\" />
<Folder Include="UI\" /> <Folder Include="UI\" />
</ItemGroup> </ItemGroup>

View File

@@ -14,7 +14,9 @@ namespace BealeEngineering.Core.Data.Database.Client
{ {
} }
public bool IncludeClosed { get; set; } = false; public bool IncludeClosed { get; set; } = false;
public List<Model.Client.PurchaseOrderAllocation> Read() public List<Model.Client.PurchaseOrderAllocation> Read()
{ {
// build the sql string and dapper parameters // 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) WHERE (ClientPurchaseOrder.IsClosed = 0 OR ClientPurchaseOrder.IsClosed = @returnClosed)
ORDER BY ClientPurchaseOrder.PurchaseOrderDate ORDER BY ClientPurchaseOrder.PurchaseOrderDate
,ProjectJob.JobNumber"; ,ProjectJob.JobNumber";
// make the call // make the call
using (SqlConnection conn = new SqlConnection(sqlConnectionString)) using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{ {

View File

@@ -101,7 +101,13 @@ namespace BealeEngineering.Core.Data.Database.Client
else if (purchaseOrderLineId != null) else if (purchaseOrderLineId != null)
{ {
sqlString = sqlString + @" sqlString = sqlString + @"
AND ClientPurchaseOrderLine.ClientPurchaseOrderLineID = @lineId"; AND ClientPurchaseOrder.ClientPurchaseOrderID =
(
SELECT ClientPurchaseOrderID
FROM ClientPurchaseOrderLine
WHERE ClientPurchaseOrderLineID = @lineId
)
";
parameters.Add("@lineId", (int)purchaseOrderLineId); parameters.Add("@lineId", (int)purchaseOrderLineId);
} }

View File

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

View File

@@ -14,7 +14,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
{ {
} }
public List<Model.Sale.InvoiceHeader> SaleInvoiceHeader { get; set; } public List<Model.Sale.InvoiceHeader> SaleInvoiceHeader { get; set; }
public bool SaleInvoiceHeaderIsSet public bool SaleInvoiceHeaderIsSet
{ {
get get
@@ -23,7 +25,17 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; } else { return true; }
} }
} }
public new List<Model.Sale.Invoice> GetBySaleInvoiceId(List<int> invoiceIdList)
public new Model.Sale.Invoice BySaleInvoiceId(int invoiceId)
{
var invoiceList = new List<int> { invoiceId };
var resultList = BySaleInvoiceId(invoiceList);
if (resultList == null || !resultList.Any()) { return null; }
else { return resultList[0]; }
}
public new List<Model.Sale.Invoice> BySaleInvoiceId(List<int> invoiceIdList)
{ {
SalesInvoiceIdList = invoiceIdList; SalesInvoiceIdList = invoiceIdList;
try try
@@ -39,6 +51,33 @@ namespace BealeEngineering.Core.Data.Database.Sale
SalesInvoiceIdList = null; SalesInvoiceIdList = null;
} }
} }
public new Model.Sale.Invoice BySaleInvoiceNumber(string invoiceNumber)
{
var invoiceList = new List<string> { invoiceNumber };
var resultList = BySaleInvoiceNumber(invoiceList);
if (resultList == null || !resultList.Any()) { return null; }
else { return resultList[0]; }
}
public new List<Model.Sale.Invoice> BySaleInvoiceNumber(List<string> invoiceNumberList)
{
SalesInvoiceNumberList = invoiceNumberList;
try
{
return Read();
}
catch (Exception ex)
{
throw ex;
}
finally
{
SalesInvoiceNumberList = null;
}
}
public new List<Model.Sale.Invoice> Read() public new List<Model.Sale.Invoice> Read()
{ {
// build the sql string and dapper parameters // build the sql string and dapper parameters

View File

@@ -14,11 +14,10 @@ namespace BealeEngineering.Core.Data.Database.Sale
{ {
} }
/// <summary>
/// Setting this will override he other filters, within the sql statement.
/// </summary>
protected List<int> SalesInvoiceIdList { get; set; } protected List<int> SalesInvoiceIdList { get; set; }
private bool SalesInvoiceIdListListIsSet
protected bool SalesInvoiceIdListListIsSet
{ {
get get
{ {
@@ -26,7 +25,20 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; } else { return true; }
} }
} }
protected List<string> SalesInvoiceNumberList { get; set; }
protected bool SalesInvoiceNumberListIsSet
{
get
{
if (SalesInvoiceNumberList == null || !SalesInvoiceNumberList.Any()) { return false; }
else { return true; }
}
}
public DateTime DateFrom { get; set; } public DateTime DateFrom { get; set; }
public bool DateFromIsSet public bool DateFromIsSet
{ {
get get
@@ -35,7 +47,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; } else { return true; }
} }
} }
public DateTime DateTo { get; set; } public DateTime DateTo { get; set; }
public bool DateToIsSet public bool DateToIsSet
{ {
get get
@@ -44,7 +58,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; } else { return true; }
} }
} }
public List<string> InvoiceNumber { get; set; } public List<string> InvoiceNumber { get; set; }
public bool InvoiceNumberIsSet public bool InvoiceNumberIsSet
{ {
get get
@@ -53,7 +69,9 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; } else { return true; }
} }
} }
public List<string> Reference { get; set; } public List<string> Reference { get; set; }
public bool ReferenceIsSet public bool ReferenceIsSet
{ {
get get
@@ -62,12 +80,22 @@ namespace BealeEngineering.Core.Data.Database.Sale
else { return true; } else { return true; }
} }
} }
public List<Model.Sale.InvoiceHeader> GetBySaleInvoiceId(List<int> orderIdList)
public Model.Sale.InvoiceHeader BySaleInvoiceId(int invoiceId)
{ {
SalesInvoiceIdList = orderIdList; var invoiceList = new List<int> { invoiceId };
var resultList = BySaleInvoiceId(invoiceList);
if (resultList == null || !resultList.Any()) { return null; }
else { return resultList[0]; }
}
public List<Model.Sale.InvoiceHeader> BySaleInvoiceId(List<int> invoiceIdList)
{
SalesInvoiceIdList = invoiceIdList;
try try
{ {
return GetByFilters(); return Read();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -78,6 +106,33 @@ namespace BealeEngineering.Core.Data.Database.Sale
SalesInvoiceIdList = null; SalesInvoiceIdList = null;
} }
} }
public Model.Sale.InvoiceHeader BySaleInvoiceNumber(string invoiceNumber)
{
var invoiceList = new List<string> { invoiceNumber };
var resultList = BySaleInvoiceNumber(invoiceList);
if (resultList == null || !resultList.Any()) { return null; }
else { return resultList[0]; }
}
public List<Model.Sale.InvoiceHeader> BySaleInvoiceNumber(List<string> invoiceNumberList)
{
SalesInvoiceNumberList = invoiceNumberList;
try
{
return Read();
}
catch (Exception ex)
{
throw ex;
}
finally
{
SalesInvoiceNumberList = null;
}
}
protected void AddSqlWhereString(ref string sqlString, ref DynamicParameters parameters) protected void AddSqlWhereString(ref string sqlString, ref DynamicParameters parameters)
{ {
if (string.IsNullOrWhiteSpace(sqlString)) if (string.IsNullOrWhiteSpace(sqlString))
@@ -93,6 +148,13 @@ namespace BealeEngineering.Core.Data.Database.Sale
parameters.Add("@saleInvoiceId", SalesInvoiceIdList); parameters.Add("@saleInvoiceId", SalesInvoiceIdList);
} }
else if (SalesInvoiceNumberListIsSet)
{
sqlString = sqlString + @"
AND SaleInvoice.SaleInvoiceNumber IN @salesInvoiceNumberList";
parameters.Add("@salesInvoiceNumberList", SalesInvoiceNumberList);
}
else else
{ {
if (DateFromIsSet) if (DateFromIsSet)
@@ -125,7 +187,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
} }
} }
} }
public List<Model.Sale.InvoiceHeader> GetByFilters() public List<Model.Sale.InvoiceHeader> Read()
{ {
// build the sql string and dapper parameters // build the sql string and dapper parameters
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();

View File

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

View File

@@ -20,15 +20,21 @@ namespace BealeEngineering.Core.Data.Database.Sale
{ {
} }
public int RecordsCreated { get { return recordsCreated; } } public int RecordsCreated { get { return recordsCreated; } }
public int RecordsUpdated { get { return recordsUpdated; } } public int RecordsUpdated { get { return recordsUpdated; } }
public int InvoicesProcessed { get { return invoicesProcessed; } } public int InvoicesProcessed { get { return invoicesProcessed; } }
public int InvoicesSkipped { get { return invoicesSkipped; } } public int InvoicesSkipped { get { return invoicesSkipped; } }
public void ByInvoice(Model.Sale.Invoice invoice, bool insertNew = false) public void ByInvoice(Model.Sale.Invoice invoice, bool insertNew = false)
{ {
var invoiceList = new List<Model.Sale.Invoice> { invoice }; var invoiceList = new List<Model.Sale.Invoice> { invoice };
ByInvoiceList(invoiceList, insertNew); ByInvoiceList(invoiceList, insertNew);
} }
public void ByInvoiceList(List<Model.Sale.Invoice> invoiceList, bool insertNew = false) public void ByInvoiceList(List<Model.Sale.Invoice> invoiceList, bool insertNew = false)
{ {
recordsCreated = 0; recordsCreated = 0;
@@ -40,7 +46,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
if (invoiceList == null || !invoiceList.Any()) { return; } if (invoiceList == null || !invoiceList.Any()) { return; }
else { invoicesProcessed = invoiceList.Count(); } else { invoicesProcessed = invoiceList.Count(); }
CheckList(ref invoiceList); ValidateInvoices(ref invoiceList);
using (TransactionScope scope = new TransactionScope()) using (TransactionScope scope = new TransactionScope())
using (SqlConnection conn = new SqlConnection(sqlConnectionString)) 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); } if (string.IsNullOrWhiteSpace(line.TaxType)) { cmd.Parameters.AddWithValue("@taxType", DBNull.Value); }
else { cmd.Parameters.AddWithValue("@taxType", line.TaxType); } else { cmd.Parameters.AddWithValue("@taxType", line.TaxType); }
cmd.Parameters.AddWithValue("@taxAmount", line.TaxAmount); cmd.Parameters.AddWithValue("@taxAmount", line.TaxAmount);
cmd.Parameters.AddWithValue("@lineAmount", line.LineAmount); cmd.Parameters.AddWithValue("@lineAmount", line.LineNetAmount);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
@@ -217,7 +223,7 @@ namespace BealeEngineering.Core.Data.Database.Sale
} }
} }
} }
private void CheckList(ref List<Model.Sale.Invoice> invoiceList) private void ValidateInvoices(ref List<Model.Sale.Invoice> invoiceList)
{ {
var tempDic = new Dictionary<string, int>(); var tempDic = new Dictionary<string, int>();
foreach (var item in invoiceList) foreach (var item in invoiceList)

View File

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

View File

@@ -21,11 +21,19 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
+ @"\Downloads\MyNewTextFile.txt"; + @"\Downloads\MyNewTextFile.txt";
} }
private StringBuilder IntermediateCsv { get; set; } private StringBuilder IntermediateCsv { get; set; }
public DateTime FileInputCreatedDate { get; private set; }
public string FileInputPath { get; set; } public string FileInputPath { get; set; }
public string FileOutputPath { get; set; } public string FileOutputPath { get; set; }
private List<List<string>> MsVbTextParserResult { get; set; } private List<List<string>> MsVbTextParserResult { get; set; }
private StringBuilder CsvContent { get; set; } private StringBuilder CsvContent { get; set; }
/// <summary> /// <summary>
/// Imports Xero invoice flat-file into model class. /// Imports Xero invoice flat-file into model class.
/// </summary> /// </summary>
@@ -63,7 +71,7 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
dto = csv.GetRecords<Model.Import.XeroInvoiceFlatFileDTO>().ToList(); dto = csv.GetRecords<Model.Import.XeroInvoiceFlatFileDTO>().ToList();
} }
FileInputCreatedDate = File.GetCreationTime(FileInputPath);
return new Logic.Adapter.XeroInvoiceFlatFile().XeroInvoiceFlatFileDTO(dto); return new Logic.Adapter.XeroInvoiceFlatFile().XeroInvoiceFlatFileDTO(dto);
} }
} }

View File

@@ -12,7 +12,7 @@ namespace BealeEngineering.Core.Logic.Adapter
{ {
// ensure sale invoice hasn't changed // ensure sale invoice hasn't changed
int propertyCount = new Model.Sale.Invoice().GetType().GetProperties().Count(); 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."); 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; invoiceLine.UnitAmount = xeroInvoiceList[i].LineItemList[j].UnitAmount;
//check, as line amount is same as calculated in model //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."); throw new Exception("Imported line total does not equal caluclated.");
} }

View File

@@ -55,7 +55,7 @@ namespace BealeEngineering.Core.Logic.Adapter
line.Description = invoiceList[i].InvoiceLineList[j].Description; line.Description = invoiceList[i].InvoiceLineList[j].Description;
line.Discount = invoiceList[i].InvoiceLineList[j].Discount; line.Discount = invoiceList[i].InvoiceLineList[j].Discount;
line.InventoryItemCode = invoiceList[i].InvoiceLineList[j].InventoryItemCode; 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.Quantity = invoiceList[i].InvoiceLineList[j].Quantity;
line.TaxAmount = invoiceList[i].InvoiceLineList[j].TaxAmount; line.TaxAmount = invoiceList[i].InvoiceLineList[j].TaxAmount;
line.TaxType = invoiceList[i].InvoiceLineList[j].TaxType; line.TaxType = invoiceList[i].InvoiceLineList[j].TaxType;

View File

@@ -44,7 +44,7 @@ namespace BealeEngineering.Core.Logic.Client
// get invoice header info // get invoice header info
var readInvoice = new Data.Database.Sale.ReadInvoiceHeader(SqlConnectionString); var readInvoice = new Data.Database.Sale.ReadInvoiceHeader(SqlConnectionString);
readInvoice.InvoiceNumber = invoiceNumberList; readInvoice.InvoiceNumber = invoiceNumberList;
var invoiceList = readInvoice.GetByFilters(); var invoiceList = readInvoice.Read();
// create lookup list for matching // create lookup list for matching
var lookupList = new List<Tuple<Model.Sale.InvoiceHeader, string, int?>>(); var lookupList = new List<Tuple<Model.Sale.InvoiceHeader, string, int?>>();

View File

@@ -70,6 +70,10 @@ namespace BealeEngineering.Core.Logic.Import
if (InvoicesProcessed != (InvoicesCreated + InvoicesUpdated + InvoicesSkipped)) if (InvoicesProcessed != (InvoicesCreated + InvoicesUpdated + InvoicesSkipped))
{ throw new Exception("Error importing invoices"); } { throw new Exception("Error importing invoices"); }
} }
// update datetime log
new Data.Database.Log.UpdateDateTime(sqlConnectionString)
.ByMatchString("XeroSaleInvoiceFlatFileImport", flatfileData.FileInputCreatedDate);
} }
/// <summary> /// <summary>
/// Get a dictionary of contacts, referenced by unique 'Contact Name'. Any contacts not found in db are /// Get a dictionary of contacts, referenced by unique 'Contact Name'. Any contacts not found in db are

View File

@@ -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<Object, Object>(new ReferenceEqualityComparer()));
}
private static Object InternalCopy(Object originalObject, IDictionary<Object, Object> visited)
{
if (originalObject == null) return null;
var typeToReflect = originalObject.GetType();
if (IsPrimitive(typeToReflect)) return originalObject;
if (visited.ContainsKey(originalObject)) return visited[originalObject];
if (typeof(Delegate).IsAssignableFrom(typeToReflect)) return null;
var cloneObject = CloneMethod.Invoke(originalObject, null);
if (typeToReflect.IsArray)
{
var arrayType = typeToReflect.GetElementType();
if (IsPrimitive(arrayType) == false)
{
Array clonedArray = (Array)cloneObject;
clonedArray.ForEach((array, indices) => array.SetValue(InternalCopy(clonedArray.GetValue(indices), visited), indices));
}
}
visited.Add(originalObject, cloneObject);
CopyFields(originalObject, visited, cloneObject, typeToReflect);
RecursiveCopyBaseTypePrivateFields(originalObject, visited, cloneObject, typeToReflect);
return cloneObject;
}
private static void RecursiveCopyBaseTypePrivateFields(object originalObject, IDictionary<object, object> visited, object cloneObject, Type typeToReflect)
{
if (typeToReflect.BaseType != null)
{
RecursiveCopyBaseTypePrivateFields(originalObject, visited, cloneObject, typeToReflect.BaseType);
CopyFields(originalObject, visited, cloneObject, typeToReflect.BaseType, BindingFlags.Instance | BindingFlags.NonPublic, info => info.IsPrivate);
}
}
private static void CopyFields(object originalObject, IDictionary<object, object> visited, object cloneObject, Type typeToReflect, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.FlattenHierarchy, Func<FieldInfo, bool> filter = null)
{
foreach (FieldInfo fieldInfo in typeToReflect.GetFields(bindingFlags))
{
if (filter != null && filter(fieldInfo) == false) continue;
if (IsPrimitive(fieldInfo.FieldType)) continue;
var originalFieldValue = fieldInfo.GetValue(originalObject);
var clonedFieldValue = InternalCopy(originalFieldValue, visited);
fieldInfo.SetValue(cloneObject, clonedFieldValue);
}
}
public static T Copy<T>(this T original)
{
return (T)Copy((Object)original);
}
}
public class ReferenceEqualityComparer : EqualityComparer<Object>
{
public override bool Equals(object x, object y)
{
return ReferenceEquals(x, y);
}
public override int GetHashCode(object obj)
{
if (obj == null) return 0;
return obj.GetHashCode();
}
}
namespace ArrayExtensions
{
public static class ArrayExtensions
{
public static void ForEach(this Array array, Action<Array, int[]> action)
{
if (array.LongLength == 0) return;
ArrayTraverse walker = new ArrayTraverse(array);
do action(array, walker.Position);
while (walker.Step());
}
}
internal class ArrayTraverse
{
public int[] Position;
private int[] maxLengths;
public ArrayTraverse(Array array)
{
maxLengths = new int[array.Rank];
for (int i = 0; i < array.Rank; ++i)
{
maxLengths[i] = array.GetLength(i) - 1;
}
Position = new int[array.Rank];
}
public bool Step()
{
for (int i = 0; i < Position.Length; ++i)
{
if (Position[i] < maxLengths[i])
{
Position[i]++;
for (int j = 0; j < i; j++)
{
Position[j] = 0;
}
return true;
}
}
return false;
}
}
}
}

View File

@@ -0,0 +1,213 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Transactions;
namespace BealeEngineering.Core.Logic.Sale
{
public class SaleInvoiceAssign
{
string sqlConnectionString;
int timeCheckMinutes = 15;
DateTime timeCheckPostpone = new DateTime();
int timeCheckPostponeMinutes = 15;
public SaleInvoiceAssign(string sqlConnectionString)
{
this.sqlConnectionString = sqlConnectionString;
}
public bool SplitInvoice { get; set; } = false;
public DateTime LastImportDateTime { get; private set; } = default(DateTime);
public void ToPurchaseOrderLine(string saleInvoiceNumber, int purchaseOrderLineId)
{
using (var scope = new TransactionScope())
{
var readInvoice = new Data.Database.Sale.ReadInvoice(sqlConnectionString);
readInvoice.InvoiceNumber = new List<string> { saleInvoiceNumber };
Model.Sale.Invoice invoice = readInvoice.Read()[0];
decimal? facilityNet = new Data.Database.Client.ReadPurchaseOrderLineFacility(sqlConnectionString).Read(purchaseOrderLineId);
if (facilityNet == null)
{ throw new Exception("Supplied ClientPurchaseOrderLineID '" + purchaseOrderLineId + "' does not exist."); }
if (facilityNet < invoice.InvoiceNetTotal && SplitInvoice == false)
{
return;
}
// get purchase order header info
Model.Client.PurchaseOrderHeader poHeader
= new Data.Database.Client.ReadPurchaseOrder(sqlConnectionString).ByPurchaseOrderLineId(purchaseOrderLineId);
if (facilityNet >= invoice.InvoiceNetTotal && SplitInvoice)
{
invoice.Reference = poHeader.ClientReference;
invoice.Status = "Modified";
}
else if (facilityNet < invoice.InvoiceNetTotal && SplitInvoice == true)
{
// Import time check
if (!ImportTimeCheck())
{
if (timeCheckPostpone == new DateTime() || DateTime.Now > timeCheckPostpone.AddMinutes(1))
{
throw new Exception("Last invoice import too long ago. Override check or import invoices");
}
}
// save check values
decimal invTotal = invoice.InvoiceTotal;
decimal invTaxTotal = invoice.TaxTotal;
// prep second invoice
var newInvoice = invoice.Copy();
newInvoice.Status = "New";
// prep first invoice
invoice.Reference = poHeader.ClientReference;
invoice.Status = "Modified";
//loop though lines to find split location
int i = 0;
decimal lineSum = 0;
bool cleanSplit = true;
for (i = 0; i < invoice.InvoiceLineList.Count(); i++)
{
lineSum += invoice.InvoiceLineList[i].LineNetAmount;
if (lineSum == facilityNet)
{
cleanSplit = true;
break;
}
else if (lineSum > facilityNet)
{
cleanSplit = false;
break;
}
}
string splitText = null;
decimal splitAmount1 = 0;
decimal splitAmount2 = 0;
if (cleanSplit == false)
{
// record line details
//decimal lineNet = invoice.InvoiceLineList[i].LineNetAmount;
decimal lineTax = invoice.InvoiceLineList[i].TaxAmount;
//decimal lineUnitAmount = invoice.InvoiceLineList[i].UnitAmount;
decimal lineQtyByUnit = invoice.InvoiceLineList[i].UnitAmount * invoice.InvoiceLineList[i].Quantity;
//create split text
splitText = Environment.NewLine + Environment.NewLine
+ "Line split (" + invoice.InvoiceLineList[i].Quantity.ToString() + " x " + invoice.InvoiceLineList[i].UnitAmount.ToString("F")
+ " = " + (invoice.InvoiceLineList[i].Quantity * invoice.InvoiceLineList[i].UnitAmount).ToString("F") + " "
+ invoice.CurrencyCode + ")" + Environment.NewLine ;
newInvoice.InvoiceLineList[i].Quantity = 1;
splitAmount2 = lineSum - (decimal)facilityNet;
newInvoice.InvoiceLineList[i].UnitAmount = splitAmount2;
invoice.InvoiceLineList[i].Quantity = 1;
splitAmount1 = lineQtyByUnit - splitAmount2;
invoice.InvoiceLineList[i].UnitAmount = splitAmount1;
invoice.InvoiceLineList[i].TaxAmount =
decimal.Round((invoice.InvoiceLineList[i].TaxAmount * (splitAmount1 / lineQtyByUnit)), 2, MidpointRounding.AwayFromZero);
newInvoice.InvoiceLineList[i].TaxAmount = lineTax - invoice.InvoiceLineList[i].TaxAmount;
}
//delete lines
invoice.InvoiceLineList.RemoveRange(i + 1, (invoice.InvoiceLineList.Count - (i + 1)));
if (cleanSplit)
{ newInvoice.InvoiceLineList.RemoveRange(0, i + 1); }
else
{
if (i > 0)
{ newInvoice.InvoiceLineList.RemoveRange(0, i); }
}
// update invoice totals
invoice.TaxTotal = invoice.InvoiceLineList.Sum(x => x.TaxAmount);
invoice.InvoiceTotal = invoice.InvoiceLineList.Sum(x => x.LineNetAmount) + invoice.TaxTotal;
newInvoice.TaxTotal = newInvoice.InvoiceLineList.Sum(x => x.TaxAmount);
newInvoice.InvoiceTotal = newInvoice.InvoiceLineList.Sum(x => x.LineNetAmount) + newInvoice.TaxTotal;
//checks
if (invoice.InvoiceNetTotal != facilityNet)
{ throw new Exception("Invoice net total does not equal facility."); }
if (invoice.InvoiceTotal + newInvoice.InvoiceTotal != invTotal)
{ throw new Exception("Invoice totals does not match."); }
if (invoice.TaxTotal + newInvoice.TaxTotal != invTaxTotal)
{ throw new Exception("Invoice tax totals does not match."); }
// continue, and update
if (newInvoice.InvoiceTotal < 0)
{ newInvoice.IsCreditNote = true; }
if (cleanSplit == false)
{
newInvoice.SaleInvoiceNumber = new Data.Database.Sale.ReadNextInvoiceNumber(sqlConnectionString).Read(newInvoice.IsCreditNote);
splitText = splitText
+ invoice.SaleInvoiceNumber + " = " + splitAmount1.ToString("F") + " " + invoice.CurrencyCode
+ Environment.NewLine + newInvoice.SaleInvoiceNumber + " = " + splitAmount2.ToString("F") + " " + newInvoice.CurrencyCode;
invoice.InvoiceLineList[i].Description += splitText;
newInvoice.InvoiceLineList[0].Description += splitText;
}
// validate
if ( invoice.IsValid() == false)
{
throw new Exception("Invalid invoice: " + invoice.ValidationResults[0]);
}
if (newInvoice.IsValid() == false)
{
throw new Exception("Invalid invoice: " + newInvoice.ValidationResults[0]);
}
// update db
var updateInvoice = new Data.Database.Sale.UpdateInvoice(sqlConnectionString);
updateInvoice.ByInvoice(invoice);
updateInvoice.ByInvoice(newInvoice, true);
scope.Complete();
}
}
}
public bool ImportTimeCheck()
{
LastImportDateTime = new Data.Database.Log.ReadDateTime(sqlConnectionString)
.ByMatchString("XeroSaleInvoiceFlatFileImport");
var datesss = DateTime.UtcNow;
datesss = datesss.AddMinutes(timeCheckMinutes * -1);
if (LastImportDateTime < datesss)
{
if (timeCheckPostpone == new DateTime() || DateTime.Now > timeCheckPostpone)
{ return false; }
else { return true; }
}
else
{ return true; }
}
public void ImportTimeCheckPostpone()
{
timeCheckPostpone = DateTime.Now.AddMinutes(timeCheckPostponeMinutes);
}
}
}

View File

@@ -52,7 +52,7 @@ namespace BealeEngineering.Core.Model.Sale
/// <summary> /// <summary>
/// Line amount is Tax Exclusive /// Line amount is Tax Exclusive
/// </summary> /// </summary>
public decimal LineAmount public decimal LineNetAmount
{ {
get get
{ {
@@ -87,7 +87,7 @@ namespace BealeEngineering.Core.Model.Sale
ValidationResults.Add(result); ValidationResults.Add(result);
} }
lineTotal = lineTotal + line.LineAmount; lineTotal = lineTotal + line.LineNetAmount;
lineTaxTotal = lineTaxTotal + line.TaxAmount; lineTaxTotal = lineTaxTotal + line.TaxAmount;
} }
if (lineTotal + lineTaxTotal != InvoiceTotal) if (lineTotal + lineTaxTotal != InvoiceTotal)

View File

@@ -31,6 +31,11 @@ namespace BealeEngineering.Core.Model.Sale
[Required()] [Required()]
public decimal InvoiceTotal { get; set;} public decimal InvoiceTotal { get; set;}
public decimal InvoiceNetTotal
{
get { return InvoiceTotal - TaxTotal; }
}
[Required()] [Required()]
public decimal TaxTotal { get; set; } public decimal TaxTotal { get; set; }
@@ -54,6 +59,21 @@ namespace BealeEngineering.Core.Model.Sale
var result = new ValidationResult("Invoice total cannot be less than zero."); var result = new ValidationResult("Invoice total cannot be less than zero.");
ValidationResults.Add(result); ValidationResults.Add(result);
} }
var prefix = new Data.SaleInvoiceNumberFormat();
if (IsCreditNote && SaleInvoiceNumber.Substring(0, 3) != prefix.ReadCreditNotePrefix())
{
// if this format changes, check data get next invoice number
var result = new ValidationResult("Credit note number incorrect format");
ValidationResults.Add(result);
}
if (!IsCreditNote && SaleInvoiceNumber.Substring(0, 3) != prefix.ReadInvoicePrefix())
{
// if this format changes, check data get next invoice number
var result = new ValidationResult("Invoice number incorrect format");
ValidationResults.Add(result);
}
return ValidationResults; return ValidationResults;
} }
} }

View File

@@ -29,7 +29,7 @@ namespace BealeEngineering.Core.Test.Sales
public void GetInvoice() public void GetInvoice()
{ {
var InvInst = new Data.Database.Sale.ReadInvoice(SqlConnectionString); var InvInst = new Data.Database.Sale.ReadInvoice(SqlConnectionString);
var lkdjflsk = InvInst.GetBySaleInvoiceId(SaleInvoiceIdList); var lkdjflsk = InvInst.BySaleInvoiceId(SaleInvoiceIdList);
} }
public void ValidateInvoice() public void ValidateInvoice()
{ {
@@ -37,7 +37,7 @@ namespace BealeEngineering.Core.Test.Sales
var contact = readContact.ByContactId(1); var contact = readContact.ByContactId(1);
var readInvoice = new Data.Database.Sale.ReadInvoice(SqlConnectionString); var readInvoice = new Data.Database.Sale.ReadInvoice(SqlConnectionString);
var invoices = readInvoice.GetBySaleInvoiceId(new List<int> { 1 }); var invoices = readInvoice.BySaleInvoiceId(new List<int> { 1 });
invoices[0].CurrencyCode = "EURR"; invoices[0].CurrencyCode = "EURR";
bool isValid = invoices[0].IsValid(); bool isValid = invoices[0].IsValid();
var errorList = invoices[0].ValidationResults; var errorList = invoices[0].ValidationResults;