diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj
index d53959b..a497c4b 100644
--- a/AyaNovaQBI/AyaNovaQBI.csproj
+++ b/AyaNovaQBI/AyaNovaQBI.csproj
@@ -225,6 +225,7 @@
+
diff --git a/AyaNovaQBI/MainForm.Designer.cs b/AyaNovaQBI/MainForm.Designer.cs
index c23f843..c37a7e0 100644
--- a/AyaNovaQBI/MainForm.Designer.cs
+++ b/AyaNovaQBI/MainForm.Designer.cs
@@ -31,12 +31,12 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
- this.invoicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.WorkOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.multipleWorkordersPerInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.oneWorkOrderPerInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fixProblemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.refreshInvoicesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.refreshWorkOrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mapAndImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -47,16 +47,15 @@
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.grid = new System.Windows.Forms.DataGridView();
+ this.lblStatus = new System.Windows.Forms.Label();
this.customer = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ProjectName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ServiceDate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.wonumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.servicedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.status = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.statuscolor = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.workorderid = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.customerid = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.project = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.linked = new System.Windows.Forms.DataGridViewCheckBoxColumn();
- this.lblStatus = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
this.SuspendLayout();
@@ -65,25 +64,25 @@
//
this.menuStrip1.Enabled = false;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.invoicesToolStripMenuItem,
+ this.WorkOrdersToolStripMenuItem,
this.toolsToolStripMenuItem,
this.helpToolStripMenuItem,
this.exitToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(790, 24);
+ this.menuStrip1.Size = new System.Drawing.Size(1283, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
- // invoicesToolStripMenuItem
+ // WorkOrdersToolStripMenuItem
//
- this.invoicesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.WorkOrdersToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1,
this.fixProblemsToolStripMenuItem,
- this.refreshInvoicesToolStripMenuItem});
- this.invoicesToolStripMenuItem.Name = "invoicesToolStripMenuItem";
- this.invoicesToolStripMenuItem.Size = new System.Drawing.Size(62, 20);
- this.invoicesToolStripMenuItem.Text = "Invoices";
+ this.refreshWorkOrdersToolStripMenuItem});
+ this.WorkOrdersToolStripMenuItem.Name = "WorkOrdersToolStripMenuItem";
+ this.WorkOrdersToolStripMenuItem.Size = new System.Drawing.Size(83, 20);
+ this.WorkOrdersToolStripMenuItem.Text = "&Work orders";
//
// toolStripMenuItem1
//
@@ -115,12 +114,12 @@
this.fixProblemsToolStripMenuItem.Text = "&Fix problems";
this.fixProblemsToolStripMenuItem.Click += new System.EventHandler(this.fixProblemsToolStripMenuItem_Click);
//
- // refreshInvoicesToolStripMenuItem
+ // refreshWorkOrdersToolStripMenuItem
//
- this.refreshInvoicesToolStripMenuItem.Name = "refreshInvoicesToolStripMenuItem";
- this.refreshInvoicesToolStripMenuItem.Size = new System.Drawing.Size(279, 22);
- this.refreshInvoicesToolStripMenuItem.Text = "&Refresh invoices";
- this.refreshInvoicesToolStripMenuItem.Click += new System.EventHandler(this.refreshInvoicesToolStripMenuItem_Click);
+ this.refreshWorkOrdersToolStripMenuItem.Name = "refreshWorkOrdersToolStripMenuItem";
+ this.refreshWorkOrdersToolStripMenuItem.Size = new System.Drawing.Size(279, 22);
+ this.refreshWorkOrdersToolStripMenuItem.Text = "&Refresh Work orders";
+ this.refreshWorkOrdersToolStripMenuItem.Click += new System.EventHandler(this.refreshInvoicesToolStripMenuItem_Click);
//
// toolsToolStripMenuItem
//
@@ -211,25 +210,35 @@
this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.customer,
+ this.Column1,
+ this.ProjectName,
+ this.ServiceDate,
this.wonumber,
- this.servicedate,
this.status,
this.statuscolor,
- this.workorderid,
- this.customerid,
- this.project,
- this.linked});
+ this.customerid});
this.grid.Dock = System.Windows.Forms.DockStyle.Fill;
this.grid.EnableHeadersVisualStyles = false;
this.grid.Location = new System.Drawing.Point(0, 24);
this.grid.Name = "grid";
this.grid.ReadOnly = true;
this.grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.grid.Size = new System.Drawing.Size(790, 450);
+ this.grid.Size = new System.Drawing.Size(1283, 450);
this.grid.TabIndex = 3;
this.grid.Visible = false;
this.grid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.grid_CellFormatting);
//
+ // lblStatus
+ //
+ this.lblStatus.BackColor = System.Drawing.SystemColors.Window;
+ this.lblStatus.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblStatus.ForeColor = System.Drawing.SystemColors.WindowText;
+ this.lblStatus.Location = new System.Drawing.Point(0, 0);
+ this.lblStatus.Name = "lblStatus";
+ this.lblStatus.Size = new System.Drawing.Size(1283, 474);
+ this.lblStatus.TabIndex = 4;
+ //
// customer
//
this.customer.DataPropertyName = "Customer";
@@ -238,6 +247,24 @@
this.customer.ReadOnly = true;
this.customer.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
+ // Column1
+ //
+ this.Column1.HeaderText = "Column1";
+ this.Column1.Name = "Column1";
+ this.Column1.ReadOnly = true;
+ //
+ // ProjectName
+ //
+ this.ProjectName.HeaderText = "Column2";
+ this.ProjectName.Name = "ProjectName";
+ this.ProjectName.ReadOnly = true;
+ //
+ // ServiceDate
+ //
+ this.ServiceDate.HeaderText = "Column2";
+ this.ServiceDate.Name = "ServiceDate";
+ this.ServiceDate.ReadOnly = true;
+ //
// wonumber
//
this.wonumber.DataPropertyName = "ServiceNumber";
@@ -246,14 +273,6 @@
this.wonumber.ReadOnly = true;
this.wonumber.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
- // servicedate
- //
- this.servicedate.DataPropertyName = "ServiceDate";
- this.servicedate.HeaderText = "Service date";
- this.servicedate.Name = "servicedate";
- this.servicedate.ReadOnly = true;
- this.servicedate.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
// status
//
this.status.DataPropertyName = "Status";
@@ -271,15 +290,6 @@
this.statuscolor.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.statuscolor.Visible = false;
//
- // workorderid
- //
- this.workorderid.DataPropertyName = "WorkorderId";
- this.workorderid.HeaderText = "workorderid";
- this.workorderid.Name = "workorderid";
- this.workorderid.ReadOnly = true;
- this.workorderid.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- this.workorderid.Visible = false;
- //
// customerid
//
this.customerid.DataPropertyName = "CustomerId";
@@ -289,39 +299,11 @@
this.customerid.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.customerid.Visible = false;
//
- // project
- //
- this.project.DataPropertyName = "Project";
- this.project.HeaderText = "Project";
- this.project.Name = "project";
- this.project.ReadOnly = true;
- this.project.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
- //
- // linked
- //
- this.linked.DataPropertyName = "Linked";
- this.linked.HeaderText = "Linked";
- this.linked.Name = "linked";
- this.linked.ReadOnly = true;
- this.linked.Resizable = System.Windows.Forms.DataGridViewTriState.True;
- this.linked.Visible = false;
- //
- // lblStatus
- //
- this.lblStatus.BackColor = System.Drawing.SystemColors.Window;
- this.lblStatus.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblStatus.ForeColor = System.Drawing.SystemColors.WindowText;
- this.lblStatus.Location = new System.Drawing.Point(0, 0);
- this.lblStatus.Name = "lblStatus";
- this.lblStatus.Size = new System.Drawing.Size(790, 474);
- this.lblStatus.TabIndex = 4;
- //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(790, 474);
+ this.ClientSize = new System.Drawing.Size(1283, 474);
this.Controls.Add(this.grid);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.lblStatus);
@@ -341,12 +323,12 @@
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
- private System.Windows.Forms.ToolStripMenuItem invoicesToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem WorkOrdersToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem multipleWorkordersPerInvoiceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem oneWorkOrderPerInvoiceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fixProblemsToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem refreshInvoicesToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem refreshWorkOrdersToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mapAndImportToolStripMenuItem;
@@ -357,16 +339,15 @@
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.DataGridView grid;
+ private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.DataGridViewTextBoxColumn customer;
+ private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
+ private System.Windows.Forms.DataGridViewTextBoxColumn ProjectName;
+ private System.Windows.Forms.DataGridViewTextBoxColumn ServiceDate;
private System.Windows.Forms.DataGridViewTextBoxColumn wonumber;
- private System.Windows.Forms.DataGridViewTextBoxColumn servicedate;
private System.Windows.Forms.DataGridViewTextBoxColumn status;
private System.Windows.Forms.DataGridViewTextBoxColumn statuscolor;
- private System.Windows.Forms.DataGridViewTextBoxColumn workorderid;
private System.Windows.Forms.DataGridViewTextBoxColumn customerid;
- private System.Windows.Forms.DataGridViewTextBoxColumn project;
- private System.Windows.Forms.DataGridViewCheckBoxColumn linked;
- private System.Windows.Forms.Label lblStatus;
}
}
diff --git a/AyaNovaQBI/MainForm.cs b/AyaNovaQBI/MainForm.cs
index fbe3607..980a51e 100644
--- a/AyaNovaQBI/MainForm.cs
+++ b/AyaNovaQBI/MainForm.cs
@@ -16,7 +16,7 @@ namespace AyaNovaQBI
public MainForm()
{
InitializeComponent();
- InitDataSet();
+ //InitDataSet();
Icon = AyaNovaQBI.Properties.Resources.logo;
}
@@ -45,7 +45,7 @@ namespace AyaNovaQBI
}
Text = "AyaNova QBI - " + util.QCompanyName;
-
+ InitializeGrid();
//See if there are *any* data mappings, if not then we will prompt the user to start that process
if (util.QBIntegration.Items.Count == 0)
{
@@ -60,7 +60,7 @@ namespace AyaNovaQBI
}
//Display billable workorders
- InitInvoices();
+ await InitInvoices();
grid.Visible = true;
menuStrip1.Enabled = true;
@@ -128,7 +128,7 @@ namespace AyaNovaQBI
await util.ValidateSettings(true);
}
- private void mapAndImportToolStripMenuItem_Click(object sender, EventArgs e)
+ private async Task mapAndImportToolStripMenuItem_Click(object sender, EventArgs e)
{
Map m = new Map();
if (m.ShowDialog() == DialogResult.Abort)
@@ -136,7 +136,7 @@ namespace AyaNovaQBI
else
{
m.Dispose();
- InitInvoices();
+ await InitInvoices();
}
}
@@ -175,159 +175,159 @@ namespace AyaNovaQBI
#region DataSet stuff
- private DataSet dsInvoices;
- private DataTable Invoices;
- private DataColumn Client;
- private DataColumn WorkingID;
- private DataColumn Linked;
- private DataColumn ClientID;
- private DataTable Workorders;
- private DataColumn InvoiceWorkingID;
- private DataColumn WorkorderID;
- private DataColumn wostatus;
- private DataColumn ServiceNumber;
- private DataColumn ServiceDate;
- private DataColumn Project;
- private DataColumn StatusARGB;
- private DataColumn dataColumn1;
- private void InitDataSet()
- {
- dsInvoices = new DataSet();
- Invoices = new DataTable();
- Client = new DataColumn();
- WorkingID = new DataColumn();
- Linked = new DataColumn();
- ClientID = new DataColumn();
- Workorders = new DataTable();
- InvoiceWorkingID = new DataColumn();
- WorkorderID = new DataColumn();
- wostatus = new DataColumn();
- ServiceNumber = new DataColumn();
- ServiceDate = new DataColumn();
- Project = new DataColumn();
- StatusARGB = new DataColumn();
- dataColumn1 = new DataColumn();
- //
- // dsInvoices
- //
- dsInvoices.DataSetName = "Invoices";
- dsInvoices.Locale = new System.Globalization.CultureInfo("en-US");
- dsInvoices.Relations.AddRange(new DataRelation[] {
- new DataRelation("Relation1", "Invoices", "Workorders", new string[] {
- "WorkingID"}, new string[] {
- "InvoiceWorkingID"}, false)});
- dsInvoices.Tables.AddRange(new DataTable[] {
- Invoices,
- Workorders});
- //
- // Invoices
- //
- Invoices.Columns.AddRange(new DataColumn[] {
- Client,
- WorkingID,
- Linked,
- ClientID});
- Invoices.Constraints.AddRange(new Constraint[] {
- new UniqueConstraint("Constraint1", new string[] {
- "WorkingID"}, true)});
- Invoices.PrimaryKey = new DataColumn[] {
- WorkingID};
- Invoices.TableName = "Invoices";
- //
- // Client
- //
- Client.ColumnName = "Client";
- //
- // WorkingID
- //
- WorkingID.AllowDBNull = false;
- WorkingID.AutoIncrement = true;
- WorkingID.Caption = "WorkingID";
- WorkingID.ColumnName = "WorkingID";
- WorkingID.DataType = typeof(int);
- WorkingID.ReadOnly = true;
- //
- // Linked
- //
- Linked.Caption = "Linked";
- Linked.ColumnName = "Linked";
- Linked.DataType = typeof(bool);
- Linked.DefaultValue = false;
- //
- // ClientID
- //
- ClientID.Caption = "ClientID";
- ClientID.ColumnName = "ClientID";
- ClientID.DataType = typeof(System.Guid);
- //
- // Workorders
- //
- Workorders.Columns.AddRange(new DataColumn[] {
- InvoiceWorkingID,
- WorkorderID,
- wostatus,
- ServiceNumber,
- ServiceDate,
- Project,
- StatusARGB,
- dataColumn1});
- Workorders.Constraints.AddRange(new Constraint[] {
- new UniqueConstraint("Constraint1", new string[] {
- "WorkorderID"}, true),
- new ForeignKeyConstraint("Relation1", "Invoices", new string[] {
- "WorkingID"}, new string[] {
- "InvoiceWorkingID"}, AcceptRejectRule.None, Rule.None, Rule.None)});
- Workorders.PrimaryKey = new DataColumn[] {
- WorkorderID};
- Workorders.TableName = "Workorders";
- //
- // InvoiceWorkingID
- //
- InvoiceWorkingID.Caption = "InvoiceWorkingID";
- InvoiceWorkingID.ColumnName = "InvoiceWorkingID";
- InvoiceWorkingID.DataType = typeof(int);
- //
- // WorkorderID
- //
- WorkorderID.AllowDBNull = false;
- WorkorderID.Caption = "WorkorderID";
- WorkorderID.ColumnName = "WorkorderID";
- WorkorderID.DataType = typeof(System.Guid);
- //
- // wostatus
- //
- wostatus.Caption = "Status";
- wostatus.ColumnName = "Status";
- //
- // ServiceNumber
- //
- ServiceNumber.Caption = "ServiceNumber";
- ServiceNumber.ColumnName = "ServiceNumber";
- ServiceNumber.DataType = typeof(int);
- //
- // ServiceDate
- //
- ServiceDate.Caption = "ServiceDate";
- ServiceDate.ColumnName = "ServiceDate";
- ServiceDate.DataType = typeof(object);
- //
- // Project
- //
- Project.Caption = "Project";
- Project.ColumnName = "Project";
- //
- // StatusARGB
- //
- StatusARGB.Caption = "StatusARGB";
- StatusARGB.ColumnName = "StatusARGB";
- StatusARGB.DataType = typeof(int);
- //
- // dataColumn1
- //
- dataColumn1.ColumnName = "Linked";
- dataColumn1.DataType = typeof(bool);
- dataColumn1.DefaultValue = false;
- }
+ //private DataSet dsInvoices;
+ //private DataTable Invoices;
+ //private DataColumn Client;
+ //private DataColumn WorkingID;
+ //private DataColumn Linked;
+ //private DataColumn ClientID;
+ //private DataTable Workorders;
+ //private DataColumn InvoiceWorkingID;
+ //private DataColumn WorkorderID;
+ //private DataColumn wostatus;
+ //private DataColumn ServiceNumber;
+ //private DataColumn ServiceDate;
+ //private DataColumn Project;
+ //private DataColumn StatusARGB;
+ //private DataColumn dataColumn1;
+ //private void InitDataSet()
+ //{
+ // dsInvoices = new DataSet();
+ // Invoices = new DataTable();
+ // Client = new DataColumn();
+ // WorkingID = new DataColumn();
+ // Linked = new DataColumn();
+ // ClientID = new DataColumn();
+ // Workorders = new DataTable();
+ // InvoiceWorkingID = new DataColumn();
+ // WorkorderID = new DataColumn();
+ // wostatus = new DataColumn();
+ // ServiceNumber = new DataColumn();
+ // ServiceDate = new DataColumn();
+ // Project = new DataColumn();
+ // StatusARGB = new DataColumn();
+ // dataColumn1 = new DataColumn();
+ // //
+ // // dsInvoices
+ // //
+ // dsInvoices.DataSetName = "Invoices";
+ // dsInvoices.Locale = new System.Globalization.CultureInfo("en-US");
+ // dsInvoices.Relations.AddRange(new DataRelation[] {
+ // new DataRelation("Relation1", "Invoices", "Workorders", new string[] {
+ // "WorkingID"}, new string[] {
+ // "InvoiceWorkingID"}, false)});
+ // dsInvoices.Tables.AddRange(new DataTable[] {
+ // Invoices,
+ // Workorders});
+ // //
+ // // Invoices
+ // //
+ // Invoices.Columns.AddRange(new DataColumn[] {
+ // Client,
+ // WorkingID,
+ // Linked,
+ // ClientID});
+ // Invoices.Constraints.AddRange(new Constraint[] {
+ // new UniqueConstraint("Constraint1", new string[] {
+ // "WorkingID"}, true)});
+ // Invoices.PrimaryKey = new DataColumn[] {
+ //WorkingID};
+ // Invoices.TableName = "Invoices";
+ // //
+ // // Client
+ // //
+ // Client.ColumnName = "Client";
+ // //
+ // // WorkingID
+ // //
+ // WorkingID.AllowDBNull = false;
+ // WorkingID.AutoIncrement = true;
+ // WorkingID.Caption = "WorkingID";
+ // WorkingID.ColumnName = "WorkingID";
+ // WorkingID.DataType = typeof(int);
+ // WorkingID.ReadOnly = true;
+ // //
+ // // Linked
+ // //
+ // Linked.Caption = "Linked";
+ // Linked.ColumnName = "Linked";
+ // Linked.DataType = typeof(bool);
+ // Linked.DefaultValue = false;
+ // //
+ // // ClientID
+ // //
+ // ClientID.Caption = "ClientID";
+ // ClientID.ColumnName = "ClientID";
+ // ClientID.DataType = typeof(System.Guid);
+ // //
+ // // Workorders
+ // //
+ // Workorders.Columns.AddRange(new DataColumn[] {
+ // InvoiceWorkingID,
+ // WorkorderID,
+ // wostatus,
+ // ServiceNumber,
+ // ServiceDate,
+ // Project,
+ // StatusARGB,
+ // dataColumn1});
+ // Workorders.Constraints.AddRange(new Constraint[] {
+ // new UniqueConstraint("Constraint1", new string[] {
+ // "WorkorderID"}, true),
+ // new ForeignKeyConstraint("Relation1", "Invoices", new string[] {
+ // "WorkingID"}, new string[] {
+ // "InvoiceWorkingID"}, AcceptRejectRule.None, Rule.None, Rule.None)});
+ // Workorders.PrimaryKey = new DataColumn[] {
+ //WorkorderID};
+ // Workorders.TableName = "Workorders";
+ // //
+ // // InvoiceWorkingID
+ // //
+ // InvoiceWorkingID.Caption = "InvoiceWorkingID";
+ // InvoiceWorkingID.ColumnName = "InvoiceWorkingID";
+ // InvoiceWorkingID.DataType = typeof(int);
+ // //
+ // // WorkorderID
+ // //
+ // WorkorderID.AllowDBNull = false;
+ // WorkorderID.Caption = "WorkorderID";
+ // WorkorderID.ColumnName = "WorkorderID";
+ // WorkorderID.DataType = typeof(System.Guid);
+ // //
+ // // wostatus
+ // //
+ // wostatus.Caption = "Status";
+ // wostatus.ColumnName = "Status";
+ // //
+ // // ServiceNumber
+ // //
+ // ServiceNumber.Caption = "ServiceNumber";
+ // ServiceNumber.ColumnName = "ServiceNumber";
+ // ServiceNumber.DataType = typeof(int);
+ // //
+ // // ServiceDate
+ // //
+ // ServiceDate.Caption = "ServiceDate";
+ // ServiceDate.ColumnName = "ServiceDate";
+ // ServiceDate.DataType = typeof(object);
+ // //
+ // // Project
+ // //
+ // Project.Caption = "Project";
+ // Project.ColumnName = "Project";
+ // //
+ // // StatusARGB
+ // //
+ // StatusARGB.Caption = "StatusARGB";
+ // StatusARGB.ColumnName = "StatusARGB";
+ // StatusARGB.DataType = typeof(int);
+ // //
+ // // dataColumn1
+ // //
+ // dataColumn1.ColumnName = "Linked";
+ // dataColumn1.DataType = typeof(bool);
+ // dataColumn1.DefaultValue = false;
+ //}
#endregion dataset stuff
@@ -390,7 +390,7 @@ namespace AyaNovaQBI
*/
- private List _wolist = null;
+ private List _WorkOrderGridListItems = new List();
private List _MisMatches = new List();
private List _PartPriceOverrides = new List();
///
@@ -407,151 +407,173 @@ namespace AyaNovaQBI
try
{
_MisMatches.Clear();
- dsInvoices.Clear();
+
//[HttpGet("accounting-list-billable/{workOrderStatusId}")]
var r = await util.GetAsync($"accounting-list-billable/{util.QDat.PreWOStatus}");
- _wolist = r.ObjectResponse["data"].ToObject>();
-
-
- DataTable dtInvoice = dsInvoices.Tables["Invoices"];
- DataTable dtWorkorder = dsInvoices.Tables["Workorders"];
- foreach (WorkorderServiceBillableList.WorkorderServiceBillableListInfo i in _wolist)
- {
- bool bLinked = Util.ScanLinksOK(i.ID, _MisMatches, _PartPriceOverrides);
-
- DataRow dri = InvoiceRowForClientID(i.ClientID);
- w.Step = "WO: " + i.ServiceNumber;
- if (dri == null)
+ _WorkOrderGridListItems = r.ObjectResponse["data"]
+ .ToObject>()
+ .Select(z => new WorkOrderGridListItem
{
- dri = dtInvoice.NewRow();
- dri["Client"] = i.Client;
- dri["ClientID"] = i.ClientID;
- dtInvoice.Rows.Add(dri);
- }
-
- //If any one single workorder is linked
- //then the invoice is flagged as linked because
- //you can invoice out anything under it that is linked and the
- //not linked items simply won't invoice
- if (bLinked)
- dri["Linked"] = true;
-
- DataRow drw = dtWorkorder.NewRow();
- drw["InvoiceWorkingID"] = (int)dri["WorkingID"];
- drw["WorkorderID"] = i.ID;
- drw["Status"] = i.Status;
- drw["ServiceNumber"] = i.ServiceNumber;
- drw["ServiceDate"] = i.ServiceDate;
- drw["Project"] = i.Project;
- drw["StatusARGB"] = i.StatusARGB;
-
- drw["Linked"] = bLinked;
- dtWorkorder.Rows.Add(drw);
+ Color = z.Color,
+ CustomerId = z.CustomerId,
+ CustomerName = z.CustomerName,
+ Id = z.Id,
+ ProjectName = z.ProjectName,
+ Serial = z.Serial,
+ ServiceDate = z.ServiceDate,
+ WorkorderStatusName = z.WorkorderStatusName
+ })
+ .ToList();
+ foreach (WorkOrderGridListItem i in _WorkOrderGridListItems)
+ {
+ w.Step = "WO: " + i.Serial;
+ i.Linked = util.ScanLinksOK(i.Id, _MisMatches, _PartPriceOverrides);
+ //DataRow dri = InvoiceRowForClientID(i.ClientID);
+
+ //if (dri == null)
+ //{
+ // dri = dtInvoice.NewRow();
+ // dri["Client"] = i.Client;
+ // dri["ClientID"] = i.ClientID;
+ // dtInvoice.Rows.Add(dri);
}
- grid.DisplayLayout.Rows.CollapseAll(false);
- foreach (UltraGridRow r in grid.Rows)
- {
- foreach (UltraGridRow rr in r.ChildBands[0].Rows)
- {
- if ((bool)rr.Cells["Linked"].Value == false)
- r.Expanded = true;
- }
+ //If any one single workorder is linked
+ //then the invoice is flagged as linked because
+ //you can invoice out anything under it that is linked and the
+ //not linked items simply won't invoice
+ //if (bLinked)
+ // dri["Linked"] = true;
+
+ //DataRow drw = dtWorkorder.NewRow();
+ //drw["InvoiceWorkingID"] = (int)dri["WorkingID"];
+ //drw["WorkorderID"] = i.ID;
+ //drw["Status"] = i.Status;
+ //drw["ServiceNumber"] = i.ServiceNumber;
+ //drw["ServiceDate"] = i.ServiceDate;
+ //drw["Project"] = i.Project;
+ //drw["StatusARGB"] = i.StatusARGB;
+
+ //drw["Linked"] = bLinked;
+ //dtWorkorder.Rows.Add(drw);
+
+
+
+
+
+ // grid.DisplayLayout.Rows.CollapseAll(false);
+ //foreach (UltraGridRow r in grid.Rows)
+ //{
+ // foreach (UltraGridRow rr in r.ChildBands[0].Rows)
+ // {
+ // if ((bool)rr.Cells["Linked"].Value == false)
+ // r.Expanded = true;
+ // }
+
+ //}
+ //grid.EndUpdate();
- }
- grid.EndUpdate();
}
finally
{
w.Close();
}
- SetState();
+ await SetState();
}
- ///
- /// Helper for grouping workorders by client
- ///
- ///
- /// null if not found else datarow containing invoice for client
- private DataRow InvoiceRowForClientID(Guid ClientID)
- {
- foreach (DataRow r in dsInvoices.Tables["Invoices"].Rows)
- {
- if ((Guid)r["ClientID"] == ClientID)
- {
- return r;
- }
- }
- return null;
- }
+ /////
+ ///// Helper for grouping workorders by client
+ /////
+ /////
+ ///// null if not found else datarow containing invoice for client
+ //private DataRow InvoiceRowForClientID(Guid ClientID)
+ //{
+ // foreach (DataRow r in dsInvoices.Tables["Invoices"].Rows)
+ // {
+ // if ((Guid)r["ClientID"] == ClientID)
+ // {
+ // return r;
+
+ // }
+ // }
+ // return null;
+ //}
private void InitializeGrid()
{
- grid.DataSource = dsInvoices;
- string currentAssemblyDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ grid.DataSource = _WorkOrderGridListItems;
+ //grid.Columns["WorkingID"].Visible = false;
+ //grid.Columns["ClientID"].Visible = false;
+ //grid.Columns["Linked"].Visible = false;
+ //grid.Columns["Client"].Visible = false;
+ //grid.Columns["InvoiceWorkingID"].Visible = false;
+ //grid.Columns["WorkorderID"].Visible = false;
+ //grid.Columns["StatusARGB"].Visible = false;
+ //grid.Columns["WorkingID"].Visible = false;
+ //string currentAssemblyDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
//Load the grid layout from file
- if (System.IO.File.Exists(currentAssemblyDirectoryName + "\\MainGrid.lyt"))
- grid.DisplayLayout.Load(currentAssemblyDirectoryName + "\\MainGrid.lyt");
- grid.DisplayLayout.Bands[0].Columns["WorkingID"].Hidden = true;
- grid.DisplayLayout.Bands[0].Columns["ClientID"].Hidden = true;
- grid.DisplayLayout.Bands[0].Columns["Linked"].Hidden = true;
- grid.DisplayLayout.Bands[0].Columns["Client"].Header.Caption = "Invoice";
+ //if (System.IO.File.Exists(currentAssemblyDirectoryName + "\\MainGrid.lyt"))
+ // grid.DisplayLayout.Load(currentAssemblyDirectoryName + "\\MainGrid.lyt");
+ //grid.DisplayLayout.Bands[0].Columns["WorkingID"].Hidden = true;
+ //grid.DisplayLayout.Bands[0].Columns["ClientID"].Hidden = true;
+ //grid.DisplayLayout.Bands[0].Columns["Linked"].Hidden = true;
+ //grid.DisplayLayout.Bands[0].Columns["Client"].Header.Caption = "Invoice";
- grid.DisplayLayout.Bands[1].Columns["InvoiceWorkingID"].Hidden = true;
- grid.DisplayLayout.Bands[1].Columns["WorkorderID"].Hidden = true;
- grid.DisplayLayout.Bands[1].Columns["StatusARGB"].Hidden = true;
- grid.DisplayLayout.Bands[1].Columns["Linked"].Hidden = true;
+ //grid.DisplayLayout.Bands[1].Columns["InvoiceWorkingID"].Hidden = true;
+ //grid.DisplayLayout.Bands[1].Columns["WorkorderID"].Hidden = true;
+ //grid.DisplayLayout.Bands[1].Columns["StatusARGB"].Hidden = true;
+ //grid.DisplayLayout.Bands[1].Columns["Linked"].Hidden = true;
}
- private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
- {
- if (e.Row.Band.Index == 0)
- {
- //Prepare invoice row
- if ((bool)e.Row.Cells["Linked"].Value == true)
- {
- e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("OK16");//Util.Image("OK16.png");
- }
- else
- {
- e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("Cancel16");//Util.Image("Cancel16.png");
- }
- }
- else
- {
- //prepare workorder row
+ //private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
+ //{
+ // if (e.Row.Band.Index == 0)
+ // {
+ // //Prepare invoice row
+ // if ((bool)e.Row.Cells["Linked"].Value == true)
+ // {
+ // e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("OK16");//Util.Image("OK16.png");
+ // }
+ // else
+ // {
+ // e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("Cancel16");//Util.Image("Cancel16.png");
+ // }
+ // }
+ // else
+ // {
+ // //prepare workorder row
- //if backcolor==0 that means no color was set
- int nColor = (int)e.Row.Cells["StatusARGB"].Value;
- if (nColor != 0)
- {
- e.Row.Cells["Status"].Appearance.BackColor = Color.FromArgb(nColor);
- e.Row.Cells["Status"].Appearance.ForeColor = Util.InvertColor(Color.FromArgb(nColor));
+ // //if backcolor==0 that means no color was set
+ // int nColor = (int)e.Row.Cells["StatusARGB"].Value;
+ // if (nColor != 0)
+ // {
+ // e.Row.Cells["Status"].Appearance.BackColor = Color.FromArgb(nColor);
+ // e.Row.Cells["Status"].Appearance.ForeColor = Util.InvertColor(Color.FromArgb(nColor));
- }
+ // }
- //flag whether billable (linked) or not
- if ((bool)e.Row.Cells["Linked"].Value == true)
- {
- e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("OK16");
- }
- else
- {
- e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("Cancel16");
- }
- }
+ // //flag whether billable (linked) or not
+ // if ((bool)e.Row.Cells["Linked"].Value == true)
+ // {
+ // e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("OK16");
+ // }
+ // else
+ // {
+ // e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("Cancel16");
+ // }
+ // }
- }
+ //}
#endregion
diff --git a/AyaNovaQBI/MainForm.resx b/AyaNovaQBI/MainForm.resx
index fdd4e0e..724b0b8 100644
--- a/AyaNovaQBI/MainForm.resx
+++ b/AyaNovaQBI/MainForm.resx
@@ -123,10 +123,16 @@
True
-
+
True
-
+
+ True
+
+
+ True
+
+
True
@@ -135,16 +141,7 @@
True
-
- True
-
True
-
- True
-
-
- True
-
\ No newline at end of file
diff --git a/AyaNovaQBI/WorkOrderAccountingListItem.cs b/AyaNovaQBI/WorkOrderAccountingListItem.cs
index f118bfc..aa4806f 100644
--- a/AyaNovaQBI/WorkOrderAccountingListItem.cs
+++ b/AyaNovaQBI/WorkOrderAccountingListItem.cs
@@ -6,15 +6,19 @@ using System.Threading.Tasks;
namespace AyaNovaQBI
{
+
+ ///
+ /// DTO object to receive list from server of billable workorders
+ ///
internal class WorkOrderAccountingListItem
{
- public long Id { get; set; }
- public long CustomerId { get; set; }
- public string CustomerName { get; set; }
- public string WorkorderStatusName { get; set; }
- public long Serial { get; set; }
- public DateTime? ServiceDate { get; set; }
- public string Color { get; set; }
- public string ProjectName { get; set; }
+ internal long Id { get; set; }
+ internal long CustomerId { get; set; }
+ internal string CustomerName { get; set; }
+ internal string WorkorderStatusName { get; set; }
+ internal long Serial { get; set; }
+ internal DateTime? ServiceDate { get; set; }
+ internal string Color { get; set; }
+ internal string ProjectName { get; set; }
}
}
diff --git a/AyaNovaQBI/WorkOrderGridListItem.cs b/AyaNovaQBI/WorkOrderGridListItem.cs
new file mode 100644
index 0000000..433d99c
--- /dev/null
+++ b/AyaNovaQBI/WorkOrderGridListItem.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AyaNovaQBI
+{
+ ///
+ /// Working list for selection by user in grid
+ ///
+ internal class WorkOrderGridListItem
+ {
+ internal long Id { get; set; }
+ internal long CustomerId { get; set; }
+ internal string CustomerName { get; set; }
+ internal string WorkorderStatusName { get; set; }
+ internal long Serial { get; set; }
+ internal DateTime? ServiceDate { get; set; }
+ internal string Color { get; set; }
+ internal string ProjectName { get; set; }
+
+ internal bool Linked { get; set; }
+ }
+}