This commit is contained in:
2022-07-09 19:15:07 +00:00
parent f9baf2b3df
commit 38e52c9c6b
3 changed files with 76 additions and 40 deletions

View File

@@ -243,7 +243,6 @@
this.customer.HeaderText = "Customer"; this.customer.HeaderText = "Customer";
this.customer.Name = "customer"; this.customer.Name = "customer";
this.customer.ReadOnly = true; this.customer.ReadOnly = true;
this.customer.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
// //
// wonumber // wonumber
// //
@@ -251,7 +250,6 @@
this.wonumber.HeaderText = "Service number"; this.wonumber.HeaderText = "Service number";
this.wonumber.Name = "wonumber"; this.wonumber.Name = "wonumber";
this.wonumber.ReadOnly = true; this.wonumber.ReadOnly = true;
this.wonumber.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
// //
// ProjectName // ProjectName
// //
@@ -273,7 +271,6 @@
this.status.HeaderText = "Status"; this.status.HeaderText = "Status";
this.status.Name = "status"; this.status.Name = "status";
this.status.ReadOnly = true; this.status.ReadOnly = true;
this.status.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
// //
// statuscolor // statuscolor
// //

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
@@ -388,7 +389,8 @@ namespace AyaNovaQBI
*/ */
private List<WorkOrderGridListItem> _WorkOrderGridListItems = new List<WorkOrderGridListItem>(); //private BindingList<WorkOrderGridListItem> _WorkOrderGridListItems = new BindingList<WorkOrderGridListItem>();
private DataTable _GridTable = null;
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>
@@ -404,42 +406,78 @@ namespace AyaNovaQBI
w.Ops = "Validating invoices..."; w.Ops = "Validating invoices...";
try try
{ {
if (_GridTable == null)
{
//datatable is required to support sorting in dgv without writing a lot of extra code
_GridTable = new DataTable();
_GridTable.Columns.Add(new DataColumn("CustomerName"));
_GridTable.Columns.Add(new DataColumn("Serial"));
_GridTable.Columns.Add(new DataColumn("ServiceDate"));
_GridTable.Columns.Add(new DataColumn("WorkorderStatusName"));
_GridTable.Columns.Add(new DataColumn("ProjectName"));
_GridTable.Columns.Add(new DataColumn("Color"));
_GridTable.Columns.Add(new DataColumn("CustomerId"));
_GridTable.Columns.Add(new DataColumn("Id"));
_GridTable.Columns.Add(new DataColumn("Linked"));
}
_MisMatches.Clear(); _MisMatches.Clear();
//[HttpGet("accounting-list-billable/{workOrderStatusId}")] //[HttpGet("accounting-list-billable/{workOrderStatusId}")]
var r = await util.GetAsync($"workorder/accounting-list-billable/{util.QDat.PreWOStatus}"); var r = await util.GetAsync($"workorder/accounting-list-billable/{util.QDat.PreWOStatus}");
var v = r.ObjectResponse["data"] var v = r.ObjectResponse["data"].ToObject<List<WorkOrderAccountingListItem>>();
.ToObject<List<WorkOrderAccountingListItem>>();
_WorkOrderGridListItems = v foreach (WorkOrderAccountingListItem z in v)
.Select(z => new WorkOrderGridListItem
{ {
Color = z.color, w.Step = "WO: " + z.Serial;
CustomerId = z.customerId, DataRow row = _GridTable.NewRow();
CustomerName = z.customerName, row["CustomerName"] = z.CustomerName;
Id = z.id, row["Serial"] = z.Serial;
ProjectName = z.projectName, row["ServiceDate"] = z.ServiceDate;
Serial = z.serial, row["WorkorderStatusName"] = z.WorkorderStatusName;
ServiceDate = z.serviceDate, row["ProjectName"] = z.ProjectName;
WorkorderStatusName = z.workorderStatusName row["Color"] = z.Color;
}) row["CustomerId"] = z.CustomerId;
.ToList(); row["Id"] = z.Id;
row["Linked"]= util.ScanLinksOK(z.Id, _MisMatches, _PartPriceOverrides);
_GridTable.Rows.Add(row);
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);
} }
//foreach (WorkOrderAccountingListItem z in v)
//{
// _WorkOrderGridListItems.Add(new WorkOrderGridListItem
// {
// Color = z.Color,
// CustomerId = z.CustomerId,
// CustomerName = z.CustomerName,
// Id = z.Id,
// ProjectName = z.ProjectName,
// Serial = z.Serial,
// ServiceDate = z.ServiceDate,
// WorkorderStatusName = z.WorkorderStatusName
// });
//}
//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);
//}
//If any one single workorder is linked //If any one single workorder is linked
//then the invoice is flagged as linked because //then the invoice is flagged as linked because
//you can invoice out anything under it that is linked and the //you can invoice out anything under it that is linked and the
@@ -509,7 +547,8 @@ namespace AyaNovaQBI
private void InitializeGrid() private void InitializeGrid()
{ {
grid.DataSource = _WorkOrderGridListItems;
grid.DataSource = _GridTable;
//grid.Columns["WorkingID"].Visible = false; //grid.Columns["WorkingID"].Visible = false;
//grid.Columns["ClientID"].Visible = false; //grid.Columns["ClientID"].Visible = false;
//grid.Columns["Linked"].Visible = false; //grid.Columns["Linked"].Visible = false;

View File

@@ -8,13 +8,13 @@ namespace AyaNovaQBI
/// </summary> /// </summary>
public class WorkOrderAccountingListItem public class WorkOrderAccountingListItem
{ {
public long id { get; set; } public long Id { get; set; }
public long customerId { get; set; } public long CustomerId { get; set; }
public string customerName { get; set; } public string CustomerName { get; set; }
public string workorderStatusName { get; set; } public string WorkorderStatusName { get; set; }
public long serial { get; set; } public long Serial { get; set; }
public DateTime? serviceDate { get; set; } public DateTime? ServiceDate { get; set; }
public string color { get; set; } public string Color { get; set; }
public string projectName { get; set; } public string ProjectName { get; set; }
} }
} }