This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
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<long> _PartPriceOverrides = new List<long>();
|
||||
/// <summary>
|
||||
@@ -404,42 +406,78 @@ namespace AyaNovaQBI
|
||||
w.Ops = "Validating invoices...";
|
||||
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();
|
||||
|
||||
//[HttpGet("accounting-list-billable/{workOrderStatusId}")]
|
||||
var r = await util.GetAsync($"workorder/accounting-list-billable/{util.QDat.PreWOStatus}");
|
||||
var v = r.ObjectResponse["data"]
|
||||
.ToObject<List<WorkOrderAccountingListItem>>();
|
||||
_WorkOrderGridListItems = v
|
||||
.Select(z => 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
|
||||
})
|
||||
.ToList();
|
||||
var v = r.ObjectResponse["data"].ToObject<List<WorkOrderAccountingListItem>>();
|
||||
|
||||
|
||||
|
||||
foreach (WorkOrderGridListItem i in _WorkOrderGridListItems)
|
||||
foreach (WorkOrderAccountingListItem z in v)
|
||||
{
|
||||
w.Step = "WO: " + i.Serial;
|
||||
i.Linked = util.ScanLinksOK(i.Id, _MisMatches, _PartPriceOverrides);
|
||||
//DataRow dri = InvoiceRowForClientID(i.ClientID);
|
||||
w.Step = "WO: " + z.Serial;
|
||||
DataRow row = _GridTable.NewRow();
|
||||
row["CustomerName"] = z.CustomerName;
|
||||
row["Serial"] = z.Serial;
|
||||
row["ServiceDate"] = z.ServiceDate;
|
||||
row["WorkorderStatusName"] = z.WorkorderStatusName;
|
||||
row["ProjectName"] = z.ProjectName;
|
||||
row["Color"] = z.Color;
|
||||
row["CustomerId"] = z.CustomerId;
|
||||
row["Id"] = z.Id;
|
||||
row["Linked"]= util.ScanLinksOK(z.Id, _MisMatches, _PartPriceOverrides);
|
||||
|
||||
//if (dri == null)
|
||||
//{
|
||||
// dri = dtInvoice.NewRow();
|
||||
// dri["Client"] = i.Client;
|
||||
// dri["ClientID"] = i.ClientID;
|
||||
// dtInvoice.Rows.Add(dri);
|
||||
_GridTable.Rows.Add(row);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//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
|
||||
//then the invoice is flagged as linked because
|
||||
//you can invoice out anything under it that is linked and the
|
||||
@@ -509,7 +547,8 @@ namespace AyaNovaQBI
|
||||
|
||||
private void InitializeGrid()
|
||||
{
|
||||
grid.DataSource = _WorkOrderGridListItems;
|
||||
|
||||
grid.DataSource = _GridTable;
|
||||
//grid.Columns["WorkingID"].Visible = false;
|
||||
//grid.Columns["ClientID"].Visible = false;
|
||||
//grid.Columns["Linked"].Visible = false;
|
||||
|
||||
Reference in New Issue
Block a user