This commit is contained in:
2022-07-08 23:37:11 +00:00
parent cd1e43081f
commit 1cd70a5be8
6 changed files with 398 additions and 368 deletions

View File

@@ -225,6 +225,7 @@
</Compile> </Compile>
<Compile Include="WorkOrder.cs" /> <Compile Include="WorkOrder.cs" />
<Compile Include="WorkOrderAccountingListItem.cs" /> <Compile Include="WorkOrderAccountingListItem.cs" />
<Compile Include="WorkOrderGridListItem.cs" />
<Compile Include="WorkOrderItem.cs" /> <Compile Include="WorkOrderItem.cs" />
<Compile Include="WorkOrderItemExpense.cs" /> <Compile Include="WorkOrderItemExpense.cs" />
<Compile Include="WorkOrderItemLabor.cs" /> <Compile Include="WorkOrderItemLabor.cs" />

View File

@@ -31,12 +31,12 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 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.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.multipleWorkordersPerInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.multipleWorkordersPerInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.oneWorkOrderPerInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.oneWorkOrderPerInvoiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fixProblemsToolStripMenuItem = 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.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mapAndImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mapAndImportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -47,16 +47,15 @@
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.grid = new System.Windows.Forms.DataGridView(); this.grid = new System.Windows.Forms.DataGridView();
this.lblStatus = new System.Windows.Forms.Label();
this.customer = new System.Windows.Forms.DataGridViewTextBoxColumn(); 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.wonumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.servicedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.status = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.status = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.statuscolor = 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.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(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@@ -65,25 +64,25 @@
// //
this.menuStrip1.Enabled = false; this.menuStrip1.Enabled = false;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.invoicesToolStripMenuItem, this.WorkOrdersToolStripMenuItem,
this.toolsToolStripMenuItem, this.toolsToolStripMenuItem,
this.helpToolStripMenuItem, this.helpToolStripMenuItem,
this.exitToolStripMenuItem}); this.exitToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; 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.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1"; 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.toolStripMenuItem1,
this.fixProblemsToolStripMenuItem, this.fixProblemsToolStripMenuItem,
this.refreshInvoicesToolStripMenuItem}); this.refreshWorkOrdersToolStripMenuItem});
this.invoicesToolStripMenuItem.Name = "invoicesToolStripMenuItem"; this.WorkOrdersToolStripMenuItem.Name = "WorkOrdersToolStripMenuItem";
this.invoicesToolStripMenuItem.Size = new System.Drawing.Size(62, 20); this.WorkOrdersToolStripMenuItem.Size = new System.Drawing.Size(83, 20);
this.invoicesToolStripMenuItem.Text = "Invoices"; this.WorkOrdersToolStripMenuItem.Text = "&Work orders";
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
@@ -115,12 +114,12 @@
this.fixProblemsToolStripMenuItem.Text = "&Fix problems"; this.fixProblemsToolStripMenuItem.Text = "&Fix problems";
this.fixProblemsToolStripMenuItem.Click += new System.EventHandler(this.fixProblemsToolStripMenuItem_Click); this.fixProblemsToolStripMenuItem.Click += new System.EventHandler(this.fixProblemsToolStripMenuItem_Click);
// //
// refreshInvoicesToolStripMenuItem // refreshWorkOrdersToolStripMenuItem
// //
this.refreshInvoicesToolStripMenuItem.Name = "refreshInvoicesToolStripMenuItem"; this.refreshWorkOrdersToolStripMenuItem.Name = "refreshWorkOrdersToolStripMenuItem";
this.refreshInvoicesToolStripMenuItem.Size = new System.Drawing.Size(279, 22); this.refreshWorkOrdersToolStripMenuItem.Size = new System.Drawing.Size(279, 22);
this.refreshInvoicesToolStripMenuItem.Text = "&Refresh invoices"; this.refreshWorkOrdersToolStripMenuItem.Text = "&Refresh Work orders";
this.refreshInvoicesToolStripMenuItem.Click += new System.EventHandler(this.refreshInvoicesToolStripMenuItem_Click); this.refreshWorkOrdersToolStripMenuItem.Click += new System.EventHandler(this.refreshInvoicesToolStripMenuItem_Click);
// //
// toolsToolStripMenuItem // toolsToolStripMenuItem
// //
@@ -211,25 +210,35 @@
this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.customer, this.customer,
this.Column1,
this.ProjectName,
this.ServiceDate,
this.wonumber, this.wonumber,
this.servicedate,
this.status, this.status,
this.statuscolor, this.statuscolor,
this.workorderid, this.customerid});
this.customerid,
this.project,
this.linked});
this.grid.Dock = System.Windows.Forms.DockStyle.Fill; this.grid.Dock = System.Windows.Forms.DockStyle.Fill;
this.grid.EnableHeadersVisualStyles = false; this.grid.EnableHeadersVisualStyles = false;
this.grid.Location = new System.Drawing.Point(0, 24); this.grid.Location = new System.Drawing.Point(0, 24);
this.grid.Name = "grid"; this.grid.Name = "grid";
this.grid.ReadOnly = true; this.grid.ReadOnly = true;
this.grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; 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.TabIndex = 3;
this.grid.Visible = false; this.grid.Visible = false;
this.grid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.grid_CellFormatting); 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 // customer
// //
this.customer.DataPropertyName = "Customer"; this.customer.DataPropertyName = "Customer";
@@ -238,6 +247,24 @@
this.customer.ReadOnly = true; this.customer.ReadOnly = true;
this.customer.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; 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 // wonumber
// //
this.wonumber.DataPropertyName = "ServiceNumber"; this.wonumber.DataPropertyName = "ServiceNumber";
@@ -246,14 +273,6 @@
this.wonumber.ReadOnly = true; this.wonumber.ReadOnly = true;
this.wonumber.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; 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 // status
// //
this.status.DataPropertyName = "Status"; this.status.DataPropertyName = "Status";
@@ -271,15 +290,6 @@
this.statuscolor.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.statuscolor.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.statuscolor.Visible = false; 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 // customerid
// //
this.customerid.DataPropertyName = "CustomerId"; this.customerid.DataPropertyName = "CustomerId";
@@ -289,39 +299,11 @@
this.customerid.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.customerid.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.customerid.Visible = false; 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 // MainForm
// //
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;
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.grid);
this.Controls.Add(this.menuStrip1); this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.lblStatus); this.Controls.Add(this.lblStatus);
@@ -341,12 +323,12 @@
#endregion #endregion
private System.Windows.Forms.MenuStrip menuStrip1; 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 toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem multipleWorkordersPerInvoiceToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem multipleWorkordersPerInvoiceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem oneWorkOrderPerInvoiceToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem oneWorkOrderPerInvoiceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fixProblemsToolStripMenuItem; 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 toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mapAndImportToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem mapAndImportToolStripMenuItem;
@@ -357,16 +339,15 @@
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.DataGridView grid; private System.Windows.Forms.DataGridView grid;
private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.DataGridViewTextBoxColumn customer; 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 wonumber;
private System.Windows.Forms.DataGridViewTextBoxColumn servicedate;
private System.Windows.Forms.DataGridViewTextBoxColumn status; private System.Windows.Forms.DataGridViewTextBoxColumn status;
private System.Windows.Forms.DataGridViewTextBoxColumn statuscolor; private System.Windows.Forms.DataGridViewTextBoxColumn statuscolor;
private System.Windows.Forms.DataGridViewTextBoxColumn workorderid;
private System.Windows.Forms.DataGridViewTextBoxColumn customerid; private System.Windows.Forms.DataGridViewTextBoxColumn customerid;
private System.Windows.Forms.DataGridViewTextBoxColumn project;
private System.Windows.Forms.DataGridViewCheckBoxColumn linked;
private System.Windows.Forms.Label lblStatus;
} }
} }

View File

@@ -16,7 +16,7 @@ namespace AyaNovaQBI
public MainForm() public MainForm()
{ {
InitializeComponent(); InitializeComponent();
InitDataSet(); //InitDataSet();
Icon = AyaNovaQBI.Properties.Resources.logo; Icon = AyaNovaQBI.Properties.Resources.logo;
} }
@@ -45,7 +45,7 @@ namespace AyaNovaQBI
} }
Text = "AyaNova QBI - " + util.QCompanyName; 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 //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) if (util.QBIntegration.Items.Count == 0)
{ {
@@ -60,7 +60,7 @@ namespace AyaNovaQBI
} }
//Display billable workorders //Display billable workorders
InitInvoices(); await InitInvoices();
grid.Visible = true; grid.Visible = true;
menuStrip1.Enabled = true; menuStrip1.Enabled = true;
@@ -128,7 +128,7 @@ namespace AyaNovaQBI
await util.ValidateSettings(true); 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(); Map m = new Map();
if (m.ShowDialog() == DialogResult.Abort) if (m.ShowDialog() == DialogResult.Abort)
@@ -136,7 +136,7 @@ namespace AyaNovaQBI
else else
{ {
m.Dispose(); m.Dispose();
InitInvoices(); await InitInvoices();
} }
} }
@@ -175,159 +175,159 @@ namespace AyaNovaQBI
#region DataSet stuff #region DataSet stuff
private DataSet dsInvoices; //private DataSet dsInvoices;
private DataTable Invoices; //private DataTable Invoices;
private DataColumn Client; //private DataColumn Client;
private DataColumn WorkingID; //private DataColumn WorkingID;
private DataColumn Linked; //private DataColumn Linked;
private DataColumn ClientID; //private DataColumn ClientID;
private DataTable Workorders; //private DataTable Workorders;
private DataColumn InvoiceWorkingID; //private DataColumn InvoiceWorkingID;
private DataColumn WorkorderID; //private DataColumn WorkorderID;
private DataColumn wostatus; //private DataColumn wostatus;
private DataColumn ServiceNumber; //private DataColumn ServiceNumber;
private DataColumn ServiceDate; //private DataColumn ServiceDate;
private DataColumn Project; //private DataColumn Project;
private DataColumn StatusARGB; //private DataColumn StatusARGB;
private DataColumn dataColumn1; //private DataColumn dataColumn1;
private void InitDataSet() //private void InitDataSet()
{ //{
dsInvoices = new DataSet(); // dsInvoices = new DataSet();
Invoices = new DataTable(); // Invoices = new DataTable();
Client = new DataColumn(); // Client = new DataColumn();
WorkingID = new DataColumn(); // WorkingID = new DataColumn();
Linked = new DataColumn(); // Linked = new DataColumn();
ClientID = new DataColumn(); // ClientID = new DataColumn();
Workorders = new DataTable(); // Workorders = new DataTable();
InvoiceWorkingID = new DataColumn(); // InvoiceWorkingID = new DataColumn();
WorkorderID = new DataColumn(); // WorkorderID = new DataColumn();
wostatus = new DataColumn(); // wostatus = new DataColumn();
ServiceNumber = new DataColumn(); // ServiceNumber = new DataColumn();
ServiceDate = new DataColumn(); // ServiceDate = new DataColumn();
Project = new DataColumn(); // Project = new DataColumn();
StatusARGB = new DataColumn(); // StatusARGB = new DataColumn();
dataColumn1 = new DataColumn(); // dataColumn1 = new DataColumn();
// // //
// dsInvoices // // dsInvoices
// // //
dsInvoices.DataSetName = "Invoices"; // dsInvoices.DataSetName = "Invoices";
dsInvoices.Locale = new System.Globalization.CultureInfo("en-US"); // dsInvoices.Locale = new System.Globalization.CultureInfo("en-US");
dsInvoices.Relations.AddRange(new DataRelation[] { // dsInvoices.Relations.AddRange(new DataRelation[] {
new DataRelation("Relation1", "Invoices", "Workorders", new string[] { // new DataRelation("Relation1", "Invoices", "Workorders", new string[] {
"WorkingID"}, new string[] { // "WorkingID"}, new string[] {
"InvoiceWorkingID"}, false)}); // "InvoiceWorkingID"}, false)});
dsInvoices.Tables.AddRange(new DataTable[] { // dsInvoices.Tables.AddRange(new DataTable[] {
Invoices, // Invoices,
Workorders}); // Workorders});
// // //
// Invoices // // Invoices
// // //
Invoices.Columns.AddRange(new DataColumn[] { // Invoices.Columns.AddRange(new DataColumn[] {
Client, // Client,
WorkingID, // WorkingID,
Linked, // Linked,
ClientID}); // ClientID});
Invoices.Constraints.AddRange(new Constraint[] { // Invoices.Constraints.AddRange(new Constraint[] {
new UniqueConstraint("Constraint1", new string[] { // new UniqueConstraint("Constraint1", new string[] {
"WorkingID"}, true)}); // "WorkingID"}, true)});
Invoices.PrimaryKey = new DataColumn[] { // Invoices.PrimaryKey = new DataColumn[] {
WorkingID}; //WorkingID};
Invoices.TableName = "Invoices"; // Invoices.TableName = "Invoices";
// // //
// Client // // Client
// // //
Client.ColumnName = "Client"; // Client.ColumnName = "Client";
// // //
// WorkingID // // WorkingID
// // //
WorkingID.AllowDBNull = false; // WorkingID.AllowDBNull = false;
WorkingID.AutoIncrement = true; // WorkingID.AutoIncrement = true;
WorkingID.Caption = "WorkingID"; // WorkingID.Caption = "WorkingID";
WorkingID.ColumnName = "WorkingID"; // WorkingID.ColumnName = "WorkingID";
WorkingID.DataType = typeof(int); // WorkingID.DataType = typeof(int);
WorkingID.ReadOnly = true; // WorkingID.ReadOnly = true;
// // //
// Linked // // Linked
// // //
Linked.Caption = "Linked"; // Linked.Caption = "Linked";
Linked.ColumnName = "Linked"; // Linked.ColumnName = "Linked";
Linked.DataType = typeof(bool); // Linked.DataType = typeof(bool);
Linked.DefaultValue = false; // Linked.DefaultValue = false;
// // //
// ClientID // // ClientID
// // //
ClientID.Caption = "ClientID"; // ClientID.Caption = "ClientID";
ClientID.ColumnName = "ClientID"; // ClientID.ColumnName = "ClientID";
ClientID.DataType = typeof(System.Guid); // ClientID.DataType = typeof(System.Guid);
// // //
// Workorders // // Workorders
// // //
Workorders.Columns.AddRange(new DataColumn[] { // Workorders.Columns.AddRange(new DataColumn[] {
InvoiceWorkingID, // InvoiceWorkingID,
WorkorderID, // WorkorderID,
wostatus, // wostatus,
ServiceNumber, // ServiceNumber,
ServiceDate, // ServiceDate,
Project, // Project,
StatusARGB, // StatusARGB,
dataColumn1}); // dataColumn1});
Workorders.Constraints.AddRange(new Constraint[] { // Workorders.Constraints.AddRange(new Constraint[] {
new UniqueConstraint("Constraint1", new string[] { // new UniqueConstraint("Constraint1", new string[] {
"WorkorderID"}, true), // "WorkorderID"}, true),
new ForeignKeyConstraint("Relation1", "Invoices", new string[] { // new ForeignKeyConstraint("Relation1", "Invoices", new string[] {
"WorkingID"}, new string[] { // "WorkingID"}, new string[] {
"InvoiceWorkingID"}, AcceptRejectRule.None, Rule.None, Rule.None)}); // "InvoiceWorkingID"}, AcceptRejectRule.None, Rule.None, Rule.None)});
Workorders.PrimaryKey = new DataColumn[] { // Workorders.PrimaryKey = new DataColumn[] {
WorkorderID}; //WorkorderID};
Workorders.TableName = "Workorders"; // Workorders.TableName = "Workorders";
// // //
// InvoiceWorkingID // // InvoiceWorkingID
// // //
InvoiceWorkingID.Caption = "InvoiceWorkingID"; // InvoiceWorkingID.Caption = "InvoiceWorkingID";
InvoiceWorkingID.ColumnName = "InvoiceWorkingID"; // InvoiceWorkingID.ColumnName = "InvoiceWorkingID";
InvoiceWorkingID.DataType = typeof(int); // InvoiceWorkingID.DataType = typeof(int);
// // //
// WorkorderID // // WorkorderID
// // //
WorkorderID.AllowDBNull = false; // WorkorderID.AllowDBNull = false;
WorkorderID.Caption = "WorkorderID"; // WorkorderID.Caption = "WorkorderID";
WorkorderID.ColumnName = "WorkorderID"; // WorkorderID.ColumnName = "WorkorderID";
WorkorderID.DataType = typeof(System.Guid); // WorkorderID.DataType = typeof(System.Guid);
// // //
// wostatus // // wostatus
// // //
wostatus.Caption = "Status"; // wostatus.Caption = "Status";
wostatus.ColumnName = "Status"; // wostatus.ColumnName = "Status";
// // //
// ServiceNumber // // ServiceNumber
// // //
ServiceNumber.Caption = "ServiceNumber"; // ServiceNumber.Caption = "ServiceNumber";
ServiceNumber.ColumnName = "ServiceNumber"; // ServiceNumber.ColumnName = "ServiceNumber";
ServiceNumber.DataType = typeof(int); // ServiceNumber.DataType = typeof(int);
// // //
// ServiceDate // // ServiceDate
// // //
ServiceDate.Caption = "ServiceDate"; // ServiceDate.Caption = "ServiceDate";
ServiceDate.ColumnName = "ServiceDate"; // ServiceDate.ColumnName = "ServiceDate";
ServiceDate.DataType = typeof(object); // ServiceDate.DataType = typeof(object);
// // //
// Project // // Project
// // //
Project.Caption = "Project"; // Project.Caption = "Project";
Project.ColumnName = "Project"; // Project.ColumnName = "Project";
// // //
// StatusARGB // // StatusARGB
// // //
StatusARGB.Caption = "StatusARGB"; // StatusARGB.Caption = "StatusARGB";
StatusARGB.ColumnName = "StatusARGB"; // StatusARGB.ColumnName = "StatusARGB";
StatusARGB.DataType = typeof(int); // StatusARGB.DataType = typeof(int);
// // //
// dataColumn1 // // dataColumn1
// // //
dataColumn1.ColumnName = "Linked"; // dataColumn1.ColumnName = "Linked";
dataColumn1.DataType = typeof(bool); // dataColumn1.DataType = typeof(bool);
dataColumn1.DefaultValue = false; // dataColumn1.DefaultValue = false;
} //}
#endregion dataset stuff #endregion dataset stuff
@@ -390,7 +390,7 @@ namespace AyaNovaQBI
*/ */
private List<WorkOrderAccountingListItem> _wolist = null; private List<WorkOrderGridListItem> _WorkOrderGridListItems = new List<WorkOrderGridListItem>();
private List<util.MisMatch> _MisMatches = new List<util.MisMatch>(); private List<util.MisMatch> _MisMatches = new List<util.MisMatch>();
private List<long> _PartPriceOverrides = new List<long>(); private List<long> _PartPriceOverrides = new List<long>();
/// <summary> /// <summary>
@@ -407,151 +407,173 @@ namespace AyaNovaQBI
try try
{ {
_MisMatches.Clear(); _MisMatches.Clear();
dsInvoices.Clear();
//[HttpGet("accounting-list-billable/{workOrderStatusId}")] //[HttpGet("accounting-list-billable/{workOrderStatusId}")]
var r = await util.GetAsync($"accounting-list-billable/{util.QDat.PreWOStatus}"); var r = await util.GetAsync($"accounting-list-billable/{util.QDat.PreWOStatus}");
_wolist = r.ObjectResponse["data"].ToObject<List<WorkOrderAccountingListItem>>(); _WorkOrderGridListItems = r.ObjectResponse["data"]
.ToObject<List<WorkOrderAccountingListItem>>()
.Select(z => new WorkOrderGridListItem
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)
{ {
dri = dtInvoice.NewRow(); Color = z.Color,
dri["Client"] = i.Client; CustomerId = z.CustomerId,
dri["ClientID"] = i.ClientID; CustomerName = z.CustomerName,
dtInvoice.Rows.Add(dri); Id = z.Id,
} ProjectName = z.ProjectName,
Serial = z.Serial,
//If any one single workorder is linked ServiceDate = z.ServiceDate,
//then the invoice is flagged as linked because WorkorderStatusName = z.WorkorderStatusName
//you can invoice out anything under it that is linked and the })
//not linked items simply won't invoice .ToList();
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);
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); //If any one single workorder is linked
foreach (UltraGridRow r in grid.Rows) //then the invoice is flagged as linked because
{ //you can invoice out anything under it that is linked and the
foreach (UltraGridRow rr in r.ChildBands[0].Rows) //not linked items simply won't invoice
{ //if (bLinked)
if ((bool)rr.Cells["Linked"].Value == false) // dri["Linked"] = true;
r.Expanded = 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 finally
{ {
w.Close(); w.Close();
} }
SetState(); await SetState();
} }
/// <summary>
/// Helper for grouping workorders by client
/// </summary>
/// <param name="ClientID"></param>
/// <returns>null if not found else datarow containing invoice for client</returns>
private DataRow InvoiceRowForClientID(Guid ClientID)
{
foreach (DataRow r in dsInvoices.Tables["Invoices"].Rows)
{
if ((Guid)r["ClientID"] == ClientID)
{
return r;
} ///// <summary>
} ///// Helper for grouping workorders by client
return null; ///// </summary>
} ///// <param name="ClientID"></param>
///// <returns>null if not found else datarow containing invoice for client</returns>
//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() private void InitializeGrid()
{ {
grid.DataSource = dsInvoices; grid.DataSource = _WorkOrderGridListItems;
string currentAssemblyDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //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 //Load the grid layout from file
if (System.IO.File.Exists(currentAssemblyDirectoryName + "\\MainGrid.lyt")) //if (System.IO.File.Exists(currentAssemblyDirectoryName + "\\MainGrid.lyt"))
grid.DisplayLayout.Load(currentAssemblyDirectoryName + "\\MainGrid.lyt"); // grid.DisplayLayout.Load(currentAssemblyDirectoryName + "\\MainGrid.lyt");
grid.DisplayLayout.Bands[0].Columns["WorkingID"].Hidden = true; //grid.DisplayLayout.Bands[0].Columns["WorkingID"].Hidden = true;
grid.DisplayLayout.Bands[0].Columns["ClientID"].Hidden = true; //grid.DisplayLayout.Bands[0].Columns["ClientID"].Hidden = true;
grid.DisplayLayout.Bands[0].Columns["Linked"].Hidden = true; //grid.DisplayLayout.Bands[0].Columns["Linked"].Hidden = true;
grid.DisplayLayout.Bands[0].Columns["Client"].Header.Caption = "Invoice"; //grid.DisplayLayout.Bands[0].Columns["Client"].Header.Caption = "Invoice";
grid.DisplayLayout.Bands[1].Columns["InvoiceWorkingID"].Hidden = true; //grid.DisplayLayout.Bands[1].Columns["InvoiceWorkingID"].Hidden = true;
grid.DisplayLayout.Bands[1].Columns["WorkorderID"].Hidden = true; //grid.DisplayLayout.Bands[1].Columns["WorkorderID"].Hidden = true;
grid.DisplayLayout.Bands[1].Columns["StatusARGB"].Hidden = true; //grid.DisplayLayout.Bands[1].Columns["StatusARGB"].Hidden = true;
grid.DisplayLayout.Bands[1].Columns["Linked"].Hidden = true; //grid.DisplayLayout.Bands[1].Columns["Linked"].Hidden = true;
} }
private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) //private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{ //{
if (e.Row.Band.Index == 0) // if (e.Row.Band.Index == 0)
{ // {
//Prepare invoice row // //Prepare invoice row
if ((bool)e.Row.Cells["Linked"].Value == true) // if ((bool)e.Row.Cells["Linked"].Value == true)
{ // {
e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("OK16");//Util.Image("OK16.png"); // e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("OK16");//Util.Image("OK16.png");
} // }
else // else
{ // {
e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("Cancel16");//Util.Image("Cancel16.png"); // e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("Cancel16");//Util.Image("Cancel16.png");
} // }
} // }
else // else
{ // {
//prepare workorder row // //prepare workorder row
//if backcolor==0 that means no color was set // //if backcolor==0 that means no color was set
int nColor = (int)e.Row.Cells["StatusARGB"].Value; // int nColor = (int)e.Row.Cells["StatusARGB"].Value;
if (nColor != 0) // if (nColor != 0)
{ // {
e.Row.Cells["Status"].Appearance.BackColor = Color.FromArgb(nColor); // e.Row.Cells["Status"].Appearance.BackColor = Color.FromArgb(nColor);
e.Row.Cells["Status"].Appearance.ForeColor = Util.InvertColor(Color.FromArgb(nColor)); // e.Row.Cells["Status"].Appearance.ForeColor = Util.InvertColor(Color.FromArgb(nColor));
} // }
//flag whether billable (linked) or not // //flag whether billable (linked) or not
if ((bool)e.Row.Cells["Linked"].Value == true) // if ((bool)e.Row.Cells["Linked"].Value == true)
{ // {
e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("OK16"); // e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("OK16");
} // }
else // else
{ // {
e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("Cancel16"); // e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("Cancel16");
} // }
} // }
} //}
#endregion #endregion

View File

@@ -123,10 +123,16 @@
<metadata name="customer.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="customer.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="wonumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="servicedate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="ProjectName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ServiceDatex.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="wonumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -135,16 +141,7 @@
<metadata name="statuscolor.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="statuscolor.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="workorderid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="customerid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="customerid.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="project.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="linked.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>

View File

@@ -6,15 +6,19 @@ using System.Threading.Tasks;
namespace AyaNovaQBI namespace AyaNovaQBI
{ {
/// <summary>
/// DTO object to receive list from server of billable workorders
/// </summary>
internal class WorkOrderAccountingListItem internal class WorkOrderAccountingListItem
{ {
public long Id { get; set; } internal long Id { get; set; }
public long CustomerId { get; set; } internal long CustomerId { get; set; }
public string CustomerName { get; set; } internal string CustomerName { get; set; }
public string WorkorderStatusName { get; set; } internal string WorkorderStatusName { get; set; }
public long Serial { get; set; } internal long Serial { get; set; }
public DateTime? ServiceDate { get; set; } internal DateTime? ServiceDate { get; set; }
public string Color { get; set; } internal string Color { get; set; }
public string ProjectName { get; set; } internal string ProjectName { get; set; }
} }
} }

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{
/// <summary>
/// Working list for selection by user in grid
/// </summary>
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; }
}
}