Assign work number to purchase order. Bug fixes

This commit is contained in:
2020-02-21 15:22:01 +00:00
parent 4e2ad7727f
commit 29325398f3
15 changed files with 717 additions and 253 deletions

View File

@@ -95,6 +95,12 @@
</Compile>
<Compile Include="Helper\FormDirtyTracker.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProjectWorkSelect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ProjectWorkSelect.Designer.cs">
<DependentUpon>ProjectWorkSelect.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="frmSaleInvoice.cs">
<SubType>Form</SubType>
@@ -111,6 +117,9 @@
<EmbeddedResource Include="frmMain.resx">
<DependentUpon>frmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ProjectWorkSelect.resx">
<DependentUpon>ProjectWorkSelect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -0,0 +1,160 @@
namespace BealeEngineering.Accounts
{
partial class ProjectWorkSelect
{
/// <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();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOkay = new System.Windows.Forms.Button();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.projectWorkItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.workNumberDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.workItemClientDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.projectTitleDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.workItemTitleDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.workItemIsArchivedDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.projectWorkItemBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(725, 412);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(88, 26);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOkay
//
this.btnOkay.Location = new System.Drawing.Point(819, 412);
this.btnOkay.Name = "btnOkay";
this.btnOkay.Size = new System.Drawing.Size(88, 26);
this.btnOkay.TabIndex = 3;
this.btnOkay.Text = "OK";
this.btnOkay.UseVisualStyleBackColor = true;
this.btnOkay.Click += new System.EventHandler(this.btnOkay_Click);
//
// dataGridView1
//
this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.workNumberDataGridViewTextBoxColumn,
this.workItemClientDataGridViewTextBoxColumn,
this.projectTitleDataGridViewTextBoxColumn,
this.workItemTitleDataGridViewTextBoxColumn,
this.workItemIsArchivedDataGridViewTextBoxColumn});
this.dataGridView1.DataSource = this.projectWorkItemBindingSource;
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.Size = new System.Drawing.Size(895, 394);
this.dataGridView1.TabIndex = 5;
this.dataGridView1.DoubleClick += new System.EventHandler(this.dataGridView1_DoubleClick);
//
// projectWorkItemBindingSource
//
this.projectWorkItemBindingSource.DataSource = typeof(BealeEngineering.Core.Model.Project.ProjectWorkItem);
//
// workNumberDataGridViewTextBoxColumn
//
this.workNumberDataGridViewTextBoxColumn.DataPropertyName = "WorkNumber";
this.workNumberDataGridViewTextBoxColumn.HeaderText = "Work Number";
this.workNumberDataGridViewTextBoxColumn.MinimumWidth = 80;
this.workNumberDataGridViewTextBoxColumn.Name = "workNumberDataGridViewTextBoxColumn";
this.workNumberDataGridViewTextBoxColumn.Width = 80;
//
// workItemClientDataGridViewTextBoxColumn
//
this.workItemClientDataGridViewTextBoxColumn.DataPropertyName = "WorkItemClient";
this.workItemClientDataGridViewTextBoxColumn.FillWeight = 75F;
this.workItemClientDataGridViewTextBoxColumn.HeaderText = "Client";
this.workItemClientDataGridViewTextBoxColumn.MinimumWidth = 180;
this.workItemClientDataGridViewTextBoxColumn.Name = "workItemClientDataGridViewTextBoxColumn";
this.workItemClientDataGridViewTextBoxColumn.Width = 180;
//
// projectTitleDataGridViewTextBoxColumn
//
this.projectTitleDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.projectTitleDataGridViewTextBoxColumn.DataPropertyName = "ProjectTitle";
this.projectTitleDataGridViewTextBoxColumn.HeaderText = "Project";
this.projectTitleDataGridViewTextBoxColumn.MinimumWidth = 100;
this.projectTitleDataGridViewTextBoxColumn.Name = "projectTitleDataGridViewTextBoxColumn";
//
// workItemTitleDataGridViewTextBoxColumn
//
this.workItemTitleDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.workItemTitleDataGridViewTextBoxColumn.DataPropertyName = "WorkItemTitle";
this.workItemTitleDataGridViewTextBoxColumn.HeaderText = "Work Item";
this.workItemTitleDataGridViewTextBoxColumn.MinimumWidth = 100;
this.workItemTitleDataGridViewTextBoxColumn.Name = "workItemTitleDataGridViewTextBoxColumn";
//
// workItemIsArchivedDataGridViewTextBoxColumn
//
this.workItemIsArchivedDataGridViewTextBoxColumn.DataPropertyName = "WorkItemIsArchived";
this.workItemIsArchivedDataGridViewTextBoxColumn.HeaderText = "Archived";
this.workItemIsArchivedDataGridViewTextBoxColumn.MinimumWidth = 70;
this.workItemIsArchivedDataGridViewTextBoxColumn.Name = "workItemIsArchivedDataGridViewTextBoxColumn";
this.workItemIsArchivedDataGridViewTextBoxColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.workItemIsArchivedDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.workItemIsArchivedDataGridViewTextBoxColumn.Width = 70;
//
// ProjectWorkSelect
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(919, 450);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOkay);
this.Name = "ProjectWorkSelect";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Select Work Number";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.projectWorkItemBindingSource)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOkay;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.BindingSource projectWorkItemBindingSource;
private System.Windows.Forms.DataGridViewTextBoxColumn workNumberDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemClientDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn projectTitleDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemTitleDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn workItemIsArchivedDataGridViewTextBoxColumn;
}
}

View File

@@ -0,0 +1,59 @@
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 ProjectWorkSelect : Form
{
string sqlConnectionString;
public ProjectWorkSelect(string sqlConnectionString)
{
InitializeComponent();
this.sqlConnectionString = sqlConnectionString;
var data = new Core.Data.Database.Project.ReadProjectWorkItem(sqlConnectionString);
data.ReturnIsArchived = false;
dataGridView1.DataSource = data.Read();
}
public Core.Model.Project.ProjectWorkItem SelectedRowObject { get; set; }
private void btnOkay_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count > 0)
{
SelectedRowObject = (Core.Model.Project.ProjectWorkItem)dataGridView1.SelectedRows[0].DataBoundItem;
//int rowINdex = dataGridView1.CurrentCell.RowIndex;
//int clientIndex = dataGridView1.Columns["workItemClientDataGridViewTextBoxColumn"].Index;
//SelectedWorkNumber = dataGridView1.Rows[rowINdex].Cells[0].Value.ToString();
//SelectedWorkClient = dataGridView1.Rows[rowINdex].Cells[clientIndex].Value.ToString();
}
else
{
SelectedRowObject = null;
}
this.DialogResult = DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
SelectedRowObject = null;
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
btnOkay_Click(null, null);
}
}
}

View File

@@ -0,0 +1,123 @@
<?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="projectWorkItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -37,7 +37,14 @@
System.Windows.Forms.Label label1;
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.description = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineNetAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.facility = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ProjectWorkNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.orderLineListBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.purchaseOrderBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.linkStatus = new System.Windows.Forms.LinkLabel();
this.StatusTextBox = new System.Windows.Forms.TextBox();
@@ -49,12 +56,6 @@
this.txtRequestorEmail = new System.Windows.Forms.TextBox();
this.txtOrderTotal = new System.Windows.Forms.TextBox();
this.txtClientReference = new System.Windows.Forms.TextBox();
this.purchaseOrderBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.description = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lineNetAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.facility = new System.Windows.Forms.DataGridViewTextBoxColumn();
clientReferenceLabel = new System.Windows.Forms.Label();
orderTotalLabel = new System.Windows.Forms.Label();
requestorEmailLabel = new System.Windows.Forms.Label();
@@ -63,11 +64,11 @@
label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.orderLineListBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderBindingSource)).BeginInit();
this.SuspendLayout();
//
// clientReferenceLabel
@@ -136,7 +137,8 @@
this.lineNumber,
this.description,
this.lineNetAmount,
this.facility});
this.facility,
this.ProjectWorkNumber});
this.dataGridView1.DataSource = this.orderLineListBindingSource;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
@@ -144,12 +146,68 @@
this.dataGridView1.Size = new System.Drawing.Size(823, 525);
this.dataGridView1.TabIndex = 14;
this.dataGridView1.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dataGridView1_CellFormatting);
this.dataGridView1.DoubleClick += new System.EventHandler(this.dataGridView1_DoubleClick);
//
// clientPurchaseOrderLineIDDataGridViewTextBoxColumn
//
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.DataPropertyName = "ClientPurchaseOrderLineID";
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.HeaderText = "ClientPurchaseOrderLineID";
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.Name = "clientPurchaseOrderLineIDDataGridViewTextBoxColumn";
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.Visible = false;
//
// lineNumber
//
this.lineNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.lineNumber.DataPropertyName = "LineNumber";
this.lineNumber.HeaderText = "Line Number";
this.lineNumber.MinimumWidth = 60;
this.lineNumber.Name = "lineNumber";
this.lineNumber.Width = 60;
//
// description
//
this.description.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.description.DataPropertyName = "Description";
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.description.DefaultCellStyle = dataGridViewCellStyle1;
this.description.HeaderText = "Description";
this.description.Name = "description";
//
// lineNetAmount
//
this.lineNetAmount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.lineNetAmount.DataPropertyName = "LineNetAmount";
this.lineNetAmount.HeaderText = "Line Amount";
this.lineNetAmount.MinimumWidth = 80;
this.lineNetAmount.Name = "lineNetAmount";
this.lineNetAmount.Width = 80;
//
// facility
//
this.facility.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.facility.HeaderText = "Facility";
this.facility.MinimumWidth = 80;
this.facility.Name = "facility";
this.facility.Width = 80;
//
// ProjectWorkNumber
//
this.ProjectWorkNumber.DataPropertyName = "ProjectWorkNumber";
this.ProjectWorkNumber.HeaderText = "Work Number";
this.ProjectWorkNumber.MinimumWidth = 80;
this.ProjectWorkNumber.Name = "ProjectWorkNumber";
this.ProjectWorkNumber.ReadOnly = true;
this.ProjectWorkNumber.Width = 80;
//
// orderLineListBindingSource
//
this.orderLineListBindingSource.DataMember = "OrderLineList";
this.orderLineListBindingSource.DataSource = this.purchaseOrderBindingSource;
//
// purchaseOrderBindingSource
//
this.purchaseOrderBindingSource.DataSource = typeof(BealeEngineering.Core.Model.Client.PurchaseOrder);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -279,49 +337,6 @@
this.txtClientReference.Size = new System.Drawing.Size(200, 20);
this.txtClientReference.TabIndex = 13;
//
// purchaseOrderBindingSource
//
this.purchaseOrderBindingSource.DataSource = typeof(BealeEngineering.Core.Model.Client.PurchaseOrder);
//
// clientPurchaseOrderLineIDDataGridViewTextBoxColumn
//
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.DataPropertyName = "ClientPurchaseOrderLineID";
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.HeaderText = "ClientPurchaseOrderLineID";
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.Name = "clientPurchaseOrderLineIDDataGridViewTextBoxColumn";
this.clientPurchaseOrderLineIDDataGridViewTextBoxColumn.Visible = false;
//
// lineNumber
//
this.lineNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.lineNumber.DataPropertyName = "LineNumber";
this.lineNumber.HeaderText = "Line Number";
this.lineNumber.MinimumWidth = 100;
this.lineNumber.Name = "lineNumber";
//
// description
//
this.description.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.description.DataPropertyName = "Description";
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.description.DefaultCellStyle = dataGridViewCellStyle1;
this.description.HeaderText = "Description";
this.description.Name = "description";
//
// lineNetAmount
//
this.lineNetAmount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.lineNetAmount.DataPropertyName = "LineNetAmount";
this.lineNetAmount.HeaderText = "Line Amount";
this.lineNetAmount.MinimumWidth = 100;
this.lineNetAmount.Name = "lineNetAmount";
//
// facility
//
this.facility.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.facility.HeaderText = "Facility";
this.facility.MinimumWidth = 100;
this.facility.Name = "facility";
//
// frmClientPurchaseOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -335,12 +350,12 @@
this.Text = "ClientPurchaseOrder";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.orderLineListBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderBindingSource)).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);
((System.ComponentModel.ISupportInitialize)(this.purchaseOrderBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -367,5 +382,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn description;
private System.Windows.Forms.DataGridViewTextBoxColumn lineNetAmount;
private System.Windows.Forms.DataGridViewTextBoxColumn facility;
private System.Windows.Forms.DataGridViewTextBoxColumn ProjectWorkNumber;
}
}

View File

@@ -14,7 +14,8 @@ namespace BealeEngineering.Accounts
{
Core.Model.Client.PurchaseOrder purchaseOrder = null;
string sqlConnectionString;
bool isNew = false;
bool newForm = false;
bool editForm = false;
Core.Data.Database.Client.ReadPurchaseOrderLineFacility lineFacility;
public frmClientPurchaseOrder(string sqlConnectionString, Core.Model.Client.PurchaseOrder purchaseOrder)
@@ -25,16 +26,19 @@ namespace BealeEngineering.Accounts
if (purchaseOrder == null)
{
FormEditEnable();
PurchaseOrder = new Core.Model.Client.PurchaseOrder();
PurchaseOrder.IsClosed = false;
SetStatus(PurchaseOrder.IsClosed);
isNew = true;
updateStatusButton();
newForm = true;
editForm = true;
SetFormMode();
}
else
{
PurchaseOrder = purchaseOrder;
FormEditDisable();
newForm = false;
editForm = false;
SetFormMode();
}
}
@@ -49,11 +53,11 @@ namespace BealeEngineering.Accounts
purchaseOrder = value;
purchaseOrderBindingSource.DataSource = purchaseOrder;
orderLineListBindingSource.DataSource = purchaseOrder.OrderLineList;
SetStatus(PurchaseOrder.IsClosed);
updateStatusButton();
}
}
private void RefreshData()
private void DatabaseRequery()
{
if (PurchaseOrder.ClientPurchaseOrderIDIsSet)
{
@@ -62,7 +66,30 @@ namespace BealeEngineering.Accounts
}
}
private void FormEditDisable()
private void SetFormMode()
{
if (newForm)
{
editForm = true;
}
if (editForm)
{
if (newForm == false)
{
btnDelete.Visible = true;
}
txtClientReference.ReadOnly = false;
txtOrderTotal.ReadOnly = false;
pickerPurchaseOrderDateDate.Enabled = true;
txtRequestorEmail.ReadOnly = false;
dataGridView1.ReadOnly = false;
linkUpdate.Visible = true;
btnEdit.Text = "Save";
dataGridView1.Columns["ProjectWorkNumber"].ReadOnly = true;
}
else
{
txtClientReference.ReadOnly = true;
txtOrderTotal.ReadOnly = true;
@@ -73,32 +100,33 @@ namespace BealeEngineering.Accounts
btnEdit.Text = "Edit";
btnDelete.Visible = false;
}
private void FormEditEnable()
{
txtClientReference.ReadOnly = false;
txtOrderTotal.ReadOnly = false;
pickerPurchaseOrderDateDate.Enabled = true;
txtRequestorEmail.ReadOnly = false;
dataGridView1.ReadOnly = false;
linkUpdate.Visible = true;
btnEdit.Text = "Save";
if (isNew == false) { btnDelete.Visible = true; }
}
private void SetStatus (bool isClosed)
{
if (purchaseOrder.IsClosed)
{
StatusTextBox.Text = " CLOSED";
linkStatus.Text = "Reopen";
}
else
{
StatusTextBox.Text = " OPEN";
linkStatus.Text = "Close";
}
}
//private void FormEditDisable()
//{
// editMode = false;
// txtClientReference.ReadOnly = true;
// txtOrderTotal.ReadOnly = true;
// pickerPurchaseOrderDateDate.Enabled = false;
// txtRequestorEmail.ReadOnly = true;
// dataGridView1.ReadOnly = true;
// linkUpdate.Visible = false;
// btnEdit.Text = "Edit";
// btnDelete.Visible = false;
//}
//private void FormEditEnable()
//{
// editMode = true;
// txtClientReference.ReadOnly = false;
// txtOrderTotal.ReadOnly = false;
// pickerPurchaseOrderDateDate.Enabled = true;
// txtRequestorEmail.ReadOnly = false;
// dataGridView1.ReadOnly = false;
// linkUpdate.Visible = true;
// btnEdit.Text = "Save";
// if (isNew == false) { btnDelete.Visible = true; }
//}
private void orderTotalTextBox_TextChanged(object sender, EventArgs e)
{
@@ -107,9 +135,9 @@ namespace BealeEngineering.Accounts
private void btnEdit_Click(object sender, EventArgs e)
{
if (btnEdit.Text == "Save")
if (editForm || newForm)
{
if (isNew)
if (newForm)
{
new Core.Data.Database.Client.UpdatePurchaseOrder(sqlConnectionString).Create(purchaseOrder);
this.Close();
@@ -122,8 +150,9 @@ namespace BealeEngineering.Accounts
}
else
{
FormEditEnable();
editForm = true;
}
SetFormMode();
}
private void contactNameTextBox_DoubleClick(object sender, EventArgs e)
@@ -162,12 +191,35 @@ namespace BealeEngineering.Accounts
private void linkStatus_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
bool isClosed = !purchaseOrder.IsClosed;
bool newValue = !purchaseOrder.IsClosed;
if (editForm || newForm)
{
purchaseOrder.IsClosed = newValue;
}
else
{
new Core.Data.Database.Client.UpdatePurchaseOrder(sqlConnectionString)
.UpdateIsClosed(purchaseOrder.ClientPurchaseOrderID, isClosed);
.UpdateIsClosed(purchaseOrder.ClientPurchaseOrderID, newValue);
RefreshData();
DatabaseRequery();
}
updateStatusButton();
}
private void updateStatusButton()
{
if (purchaseOrder.IsClosed)
{
StatusTextBox.Text = " CLOSED";
linkStatus.Text = "Reopen";
}
else
{
StatusTextBox.Text = " OPEN";
linkStatus.Text = "Close";
}
}
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
@@ -181,5 +233,33 @@ namespace BealeEngineering.Accounts
}
}
}
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
if (editForm || newForm)
{
if (dataGridView1.CurrentCell.OwningColumn.Name == "ProjectWorkNumber")
{
var selectForm = new ProjectWorkSelect(sqlConnectionString);
selectForm.ShowDialog();
if (selectForm.SelectedRowObject != null)
{
if (purchaseOrder != null && selectForm.SelectedRowObject.WorkItemClient != purchaseOrder.ContactName)
{
var responce = MessageBox.Show("The work item client does not match to cantact on the purchase order, is this correct?"
, "Insurficent facility"
, MessageBoxButtons.OKCancel
, MessageBoxIcon.Question
, MessageBoxDefaultButton.Button2);
if (responce != DialogResult.OK)
{ return; }
}
dataGridView1.CurrentCell.Value = selectForm.SelectedRowObject.WorkNumber;
}
}
}
}
}
}

View File

@@ -138,6 +138,9 @@
<metadata name="facility.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ProjectWorkNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="orderLineListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>253, 29</value>
</metadata>

View File

@@ -29,8 +29,8 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
this.invoiceHeaderBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.bindingSourceSaleInvoice = new System.Windows.Forms.BindingSource(this.components);
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
@@ -84,17 +84,6 @@
this.label2 = new System.Windows.Forms.Label();
this.txtInvoiceImportDt = new System.Windows.Forms.TextBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.PurchaseOrderLineID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ContactName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderReference = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineDescription = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineNetAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.InvoicedAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineFacility = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ProjectTitle = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.purchaseOrderAllocationBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabProjectWork = new System.Windows.Forms.TabPage();
@@ -124,6 +113,17 @@
this.taxTotalDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.isCreditNoteDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.statusDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ContactName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderReference = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineDescription = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineNetAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.InvoicedAmount = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PurchaseOrderLineFacility = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.WorkTitle = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.invoiceHeaderBindingSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSourceSaleInvoice)).BeginInit();
this.menuStrip1.SuspendLayout();
@@ -541,8 +541,8 @@
// TotalAndCurrency
//
this.TotalAndCurrency.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.TotalAndCurrency.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.TotalAndCurrency.DefaultCellStyle = dataGridViewCellStyle7;
this.TotalAndCurrency.HeaderText = "InvoiceTotal";
this.TotalAndCurrency.MinimumWidth = 120;
this.TotalAndCurrency.Name = "TotalAndCurrency";
@@ -553,8 +553,8 @@
//
this.status.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.status.DataPropertyName = "Status";
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.status.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.status.DefaultCellStyle = dataGridViewCellStyle8;
this.status.HeaderText = "Status";
this.status.MinimumWidth = 100;
this.status.Name = "status";
@@ -713,7 +713,7 @@
this.InvoicedAmount,
this.PurchaseOrderLineFacility,
this.WorkNumber,
this.ProjectTitle});
this.WorkTitle});
this.dataGridView1.DataSource = this.purchaseOrderAllocationBindingSource;
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
@@ -726,112 +726,6 @@
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
//
// PurchaseOrderLineID
//
this.PurchaseOrderLineID.DataPropertyName = "PurchaseOrderLineID";
this.PurchaseOrderLineID.HeaderText = "PurchaseOrderLineID";
this.PurchaseOrderLineID.Name = "PurchaseOrderLineID";
this.PurchaseOrderLineID.ReadOnly = true;
this.PurchaseOrderLineID.Visible = false;
//
// ContactName
//
this.ContactName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ContactName.DataPropertyName = "ContactName";
this.ContactName.FillWeight = 150F;
this.ContactName.HeaderText = "Client";
this.ContactName.MinimumWidth = 90;
this.ContactName.Name = "ContactName";
this.ContactName.ReadOnly = true;
//
// PurchaseOrderDate
//
this.PurchaseOrderDate.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderDate.DataPropertyName = "PurchaseOrderDate";
this.PurchaseOrderDate.FillWeight = 30.59646F;
this.PurchaseOrderDate.HeaderText = "PO Date";
this.PurchaseOrderDate.MinimumWidth = 80;
this.PurchaseOrderDate.Name = "PurchaseOrderDate";
this.PurchaseOrderDate.ReadOnly = true;
//
// PurchaseOrderReference
//
this.PurchaseOrderReference.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderReference.DataPropertyName = "PurchaseOrderReference";
this.PurchaseOrderReference.FillWeight = 30.59646F;
this.PurchaseOrderReference.HeaderText = "PO Number";
this.PurchaseOrderReference.MinimumWidth = 100;
this.PurchaseOrderReference.Name = "PurchaseOrderReference";
this.PurchaseOrderReference.ReadOnly = true;
//
// PurchaseOrderLineNumber
//
this.PurchaseOrderLineNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderLineNumber.DataPropertyName = "PurchaseOrderLineNumber";
this.PurchaseOrderLineNumber.FillWeight = 30.59646F;
this.PurchaseOrderLineNumber.HeaderText = "Line No";
this.PurchaseOrderLineNumber.MinimumWidth = 50;
this.PurchaseOrderLineNumber.Name = "PurchaseOrderLineNumber";
this.PurchaseOrderLineNumber.ReadOnly = true;
//
// PurchaseOrderLineDescription
//
this.PurchaseOrderLineDescription.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderLineDescription.DataPropertyName = "PurchaseOrderLineDescription";
this.PurchaseOrderLineDescription.FillWeight = 300F;
this.PurchaseOrderLineDescription.HeaderText = "Description";
this.PurchaseOrderLineDescription.MinimumWidth = 242;
this.PurchaseOrderLineDescription.Name = "PurchaseOrderLineDescription";
this.PurchaseOrderLineDescription.ReadOnly = true;
//
// PurchaseOrderLineNetAmount
//
this.PurchaseOrderLineNetAmount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderLineNetAmount.DataPropertyName = "PurchaseOrderLineNetAmount";
this.PurchaseOrderLineNetAmount.FillWeight = 50F;
this.PurchaseOrderLineNetAmount.HeaderText = "Line Amount";
this.PurchaseOrderLineNetAmount.MinimumWidth = 80;
this.PurchaseOrderLineNetAmount.Name = "PurchaseOrderLineNetAmount";
this.PurchaseOrderLineNetAmount.ReadOnly = true;
//
// InvoicedAmount
//
this.InvoicedAmount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.InvoicedAmount.DataPropertyName = "InvoicedAmount";
this.InvoicedAmount.FillWeight = 50F;
this.InvoicedAmount.HeaderText = "Invoiced";
this.InvoicedAmount.MinimumWidth = 80;
this.InvoicedAmount.Name = "InvoicedAmount";
this.InvoicedAmount.ReadOnly = true;
//
// PurchaseOrderLineFacility
//
this.PurchaseOrderLineFacility.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderLineFacility.DataPropertyName = "PurchaseOrderLineFacility";
this.PurchaseOrderLineFacility.FillWeight = 50F;
this.PurchaseOrderLineFacility.HeaderText = "Facility";
this.PurchaseOrderLineFacility.MinimumWidth = 80;
this.PurchaseOrderLineFacility.Name = "PurchaseOrderLineFacility";
this.PurchaseOrderLineFacility.ReadOnly = true;
//
// WorkNumber
//
this.WorkNumber.DataPropertyName = "WorkNumber";
this.WorkNumber.HeaderText = "WorkNumber";
this.WorkNumber.MinimumWidth = 80;
this.WorkNumber.Name = "WorkNumber";
this.WorkNumber.ReadOnly = true;
//
// ProjectTitle
//
this.ProjectTitle.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ProjectTitle.DataPropertyName = "ProjectTitle";
this.ProjectTitle.FillWeight = 200F;
this.ProjectTitle.HeaderText = "Project";
this.ProjectTitle.MinimumWidth = 100;
this.ProjectTitle.Name = "ProjectTitle";
this.ProjectTitle.ReadOnly = true;
//
// purchaseOrderAllocationBindingSource
//
this.purchaseOrderAllocationBindingSource.AllowNew = false;
@@ -1098,6 +992,118 @@
this.statusDataGridViewTextBoxColumn.Name = "statusDataGridViewTextBoxColumn";
this.statusDataGridViewTextBoxColumn.ReadOnly = true;
//
// PurchaseOrderLineID
//
this.PurchaseOrderLineID.DataPropertyName = "PurchaseOrderLineID";
this.PurchaseOrderLineID.HeaderText = "PurchaseOrderLineID";
this.PurchaseOrderLineID.Name = "PurchaseOrderLineID";
this.PurchaseOrderLineID.ReadOnly = true;
this.PurchaseOrderLineID.Visible = false;
//
// ContactName
//
this.ContactName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ContactName.DataPropertyName = "ContactName";
this.ContactName.FillWeight = 150F;
this.ContactName.HeaderText = "Client";
this.ContactName.MinimumWidth = 90;
this.ContactName.Name = "ContactName";
this.ContactName.ReadOnly = true;
//
// PurchaseOrderDate
//
this.PurchaseOrderDate.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.PurchaseOrderDate.DataPropertyName = "PurchaseOrderDate";
this.PurchaseOrderDate.FillWeight = 30.59646F;
this.PurchaseOrderDate.HeaderText = "PO Date";
this.PurchaseOrderDate.MinimumWidth = 80;
this.PurchaseOrderDate.Name = "PurchaseOrderDate";
this.PurchaseOrderDate.ReadOnly = true;
this.PurchaseOrderDate.Width = 80;
//
// PurchaseOrderReference
//
this.PurchaseOrderReference.DataPropertyName = "PurchaseOrderReference";
this.PurchaseOrderReference.FillWeight = 30.59646F;
this.PurchaseOrderReference.HeaderText = "PO Number";
this.PurchaseOrderReference.MinimumWidth = 100;
this.PurchaseOrderReference.Name = "PurchaseOrderReference";
this.PurchaseOrderReference.ReadOnly = true;
//
// PurchaseOrderLineNumber
//
this.PurchaseOrderLineNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.PurchaseOrderLineNumber.DataPropertyName = "PurchaseOrderLineNumber";
this.PurchaseOrderLineNumber.FillWeight = 30.59646F;
this.PurchaseOrderLineNumber.HeaderText = "Line No";
this.PurchaseOrderLineNumber.MinimumWidth = 50;
this.PurchaseOrderLineNumber.Name = "PurchaseOrderLineNumber";
this.PurchaseOrderLineNumber.ReadOnly = true;
this.PurchaseOrderLineNumber.Width = 50;
//
// PurchaseOrderLineDescription
//
this.PurchaseOrderLineDescription.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.PurchaseOrderLineDescription.DataPropertyName = "PurchaseOrderLineDescription";
this.PurchaseOrderLineDescription.FillWeight = 300F;
this.PurchaseOrderLineDescription.HeaderText = "Description";
this.PurchaseOrderLineDescription.MinimumWidth = 242;
this.PurchaseOrderLineDescription.Name = "PurchaseOrderLineDescription";
this.PurchaseOrderLineDescription.ReadOnly = true;
//
// PurchaseOrderLineNetAmount
//
this.PurchaseOrderLineNetAmount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.PurchaseOrderLineNetAmount.DataPropertyName = "PurchaseOrderLineNetAmount";
this.PurchaseOrderLineNetAmount.FillWeight = 50F;
this.PurchaseOrderLineNetAmount.HeaderText = "Line Amount";
this.PurchaseOrderLineNetAmount.MinimumWidth = 80;
this.PurchaseOrderLineNetAmount.Name = "PurchaseOrderLineNetAmount";
this.PurchaseOrderLineNetAmount.ReadOnly = true;
this.PurchaseOrderLineNetAmount.Width = 80;
//
// InvoicedAmount
//
this.InvoicedAmount.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.InvoicedAmount.DataPropertyName = "InvoicedAmount";
this.InvoicedAmount.FillWeight = 50F;
this.InvoicedAmount.HeaderText = "Invoiced";
this.InvoicedAmount.MinimumWidth = 80;
this.InvoicedAmount.Name = "InvoicedAmount";
this.InvoicedAmount.ReadOnly = true;
this.InvoicedAmount.Width = 80;
//
// PurchaseOrderLineFacility
//
this.PurchaseOrderLineFacility.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.PurchaseOrderLineFacility.DataPropertyName = "PurchaseOrderLineFacility";
this.PurchaseOrderLineFacility.FillWeight = 50F;
this.PurchaseOrderLineFacility.HeaderText = "Facility";
this.PurchaseOrderLineFacility.MinimumWidth = 80;
this.PurchaseOrderLineFacility.Name = "PurchaseOrderLineFacility";
this.PurchaseOrderLineFacility.ReadOnly = true;
this.PurchaseOrderLineFacility.Width = 80;
//
// WorkNumber
//
this.WorkNumber.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.WorkNumber.DataPropertyName = "WorkNumber";
this.WorkNumber.HeaderText = "WorkNumber";
this.WorkNumber.MinimumWidth = 80;
this.WorkNumber.Name = "WorkNumber";
this.WorkNumber.ReadOnly = true;
this.WorkNumber.Width = 80;
//
// WorkTitle
//
this.WorkTitle.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.WorkTitle.DataPropertyName = "WorkTitle";
this.WorkTitle.FillWeight = 200F;
this.WorkTitle.HeaderText = "Work Item";
this.WorkTitle.MinimumWidth = 100;
this.WorkTitle.Name = "WorkTitle";
this.WorkTitle.ReadOnly = true;
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1231,6 +1237,15 @@
private System.Windows.Forms.DataGridViewTextBoxColumn dateEndDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn isArchivedDataGridViewTextBoxColumn;
private System.Windows.Forms.BindingSource projectWorkItemBindingSource;
private System.Windows.Forms.DataGridViewTextBoxColumn workNumberDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemClientDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemTitleDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemDateStartDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemDateEndDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemIsArchivedDataGridViewTextBoxColumn;
private System.Windows.Forms.ToolStripMenuItem xeroNewInvoiceToolStripMenuItem;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineID;
private System.Windows.Forms.DataGridViewTextBoxColumn ContactName;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderDate;
@@ -1241,16 +1256,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn InvoicedAmount;
private System.Windows.Forms.DataGridViewTextBoxColumn PurchaseOrderLineFacility;
private System.Windows.Forms.DataGridViewTextBoxColumn WorkNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn ProjectTitle;
private System.Windows.Forms.DataGridViewTextBoxColumn workNumberDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemClientDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemTitleDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemDateStartDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemDateEndDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn workItemIsArchivedDataGridViewTextBoxColumn;
private System.Windows.Forms.ToolStripMenuItem xeroNewInvoiceToolStripMenuItem;
private System.Windows.Forms.DataGridViewTextBoxColumn WorkTitle;
}
}

View File

@@ -229,7 +229,7 @@ namespace BealeEngineering.Accounts
MessageBox.Show(dialogText);
}
UpdateInvoiceImportText();
TabSetAllIsDirty();
}

View File

@@ -147,13 +147,7 @@
<metadata name="WorkNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="purchaseOrderAllocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>24, 20</value>
</metadata>
<metadata name="PurchaseOrderLineID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="WorkNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="WorkTitle.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="purchaseOrderAllocationBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -106,6 +106,7 @@ namespace BealeEngineering.Core.Data.Database.Client
,LineNumber
,Description
,LineNetAmount
,ProjectWorkID
)
OUTPUT INSERTED.ClientPurchaseOrderLineID
VALUES
@@ -114,6 +115,11 @@ namespace BealeEngineering.Core.Data.Database.Client
,@lineNumber
,@description
,@lineNetAmount
,(SELECT ProjectWorkID
FROM ProjectWork
WHERE WorkNumber = @workNumber
)
)
", conn))
{
@@ -122,6 +128,7 @@ namespace BealeEngineering.Core.Data.Database.Client
if (string.IsNullOrWhiteSpace(description)) { cmd.Parameters.AddWithValue("@description", DBNull.Value); }
else { cmd.Parameters.AddWithValue("@description", description); }
cmd.Parameters.AddWithValue("@lineNetAmount", lineNetAmount);
cmd.Parameters.AddWithValue("@workNumber", projectWorkNo);
return (int)cmd.ExecuteScalar();
}

View File

@@ -236,11 +236,17 @@ namespace BealeEngineering.Core.Data.Database.Client
SET LineNumber = @lineNumber
,Description = @description
,LineNetAmount = @lineNetAmount
,ProjectWorkID =
(
SELECT ProjectWorkID
FROM ProjectWork
WHERE WorkNumber = @workNumber
)
WHERE ClientPurchaseOrderLineID = @purchaseOrderLineId
", conn))
{
cmd.Parameters.AddWithValue("@lineNumber", lineNumber);
//cmd.Parameters.AddWithValue("@projectWorkNo", projectWorkNo);
cmd.Parameters.AddWithValue("@workNumber", projectWorkNo);
if (string.IsNullOrWhiteSpace(description)) { cmd.Parameters.AddWithValue("@description", DBNull.Value); }
else { cmd.Parameters.AddWithValue("@description", description); }
cmd.Parameters.AddWithValue("@lineNetAmount", lineNetAmount);

View File

@@ -14,12 +14,12 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
{
public ReadXeroInvoiceFlatFile()
{
FileInputPath =
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
+ @"\Dropbox\Beale Engineering Services Ltd\BE Accounts\Xero-Export-Invoices.csv";
FileOutputPath =
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
+ @"\Downloads\MyNewTextFile.txt";
//FileInputPath =
// Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
// + @"\Dropbox\Beale Engineering Services Ltd\BE Accounts\Xero-Export-Invoices.csv";
//FileOutputPath =
// Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
// + @"\Downloads\MyNewTextFile.txt";
}
private StringBuilder IntermediateCsv { get; set; }
@@ -41,6 +41,7 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
/// <returns>Dictionary, Invoice numbers against data.</returns>
public List<Model.Import.XeroInvoiceFlatFile> ByFilePath(string filePath)
{
FileInputPath = filePath;
/* So here's the rub. Any field in a CSV doc that has a double quote wihtin, must be enclosed by double quotes and
* the double quote within must be 'escaped' by a double quote.
* However, in that situation, Xero flat file doesn't enclose the field or escape the double quote.
@@ -58,7 +59,7 @@ namespace BealeEngineering.Core.Data.Xero.FlatFile
// first off, get a RFC4180 compliant csv string
var csvRFC = new Logic.Utilities.CSVGetRFC4180Compliant();
csvRFC.ByFilePath(filePath);
csvRFC.ByFilePath(FileInputPath);
if (!csvRFC.OutputStringIsSet)
{ throw new Exception("CSV Error."); }

View File

@@ -48,7 +48,7 @@ namespace BealeEngineering.Core.Logic.Export
var xeroInvoiceDtoList = new Logic.Adapter.ExportXeroInvoiceFlatFileDTO().BySaleInvoice(invoiceList);
// create flatfile from dto
using (var writer = new StreamWriter(FileOutputPath))
using (var writer = new StreamWriter(FileOutputPath, false, Encoding.UTF8))
using (var csv = new CsvWriter(writer, new Data.CurrencyFormat().ReadCulture("GBP")))
{
csv.WriteRecords(xeroInvoiceDtoList);

View File

@@ -50,7 +50,7 @@ namespace BealeEngineering.Core.Logic.Sale
= new Data.Database.Client.ReadPurchaseOrder(sqlConnectionString).ByPurchaseOrderLineId(purchaseOrderLineId);
var updateInvoice = new Data.Database.Sale.UpdateInvoice(sqlConnectionString);
if (facilityNet >= invoice.InvoiceNetTotal && SplitInvoice)
if (facilityNet >= invoice.InvoiceNetTotal)
{
invoice.Reference = poHeader.ClientReference;
invoice.Status = statusModified;
@@ -165,8 +165,8 @@ namespace BealeEngineering.Core.Logic.Sale
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.SaleInvoiceNumber + " = " + splitAmount1.ToString("C", culture)
+ Environment.NewLine + newInvoice.SaleInvoiceNumber + " = " + splitAmount2.ToString("C", culture);
invoice.InvoiceLineList[i].Description += splitText;
newInvoice.InvoiceLineList[0].Description += splitText;