This commit is contained in:
2022-07-08 22:41:03 +00:00
parent 6f8c92484d
commit cd1e43081f
3 changed files with 188 additions and 10 deletions

View File

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

View File

@@ -16,6 +16,7 @@ namespace AyaNovaQBI
public MainForm()
{
InitializeComponent();
InitDataSet();
Icon = AyaNovaQBI.Properties.Resources.logo;
}
@@ -173,7 +174,162 @@ 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;
}
#endregion dataset stuff
#region Main workorder grid
@@ -233,7 +389,8 @@ namespace AyaNovaQBI
filter "[{\"column\":\"WorkOrderInvoiceNumber\",\"any\":false,\"items\":[{\"op\":\"=\",\"value\":\"*NULL*\"}]}]"
*/
private WorkorderServiceBillableList _wolist = null;
private List<WorkOrderAccountingListItem> _wolist = null;
private List<util.MisMatch> _MisMatches = new List<util.MisMatch>();
private List<long> _PartPriceOverrides = new List<long>();
/// <summary>
@@ -242,20 +399,20 @@ namespace AyaNovaQBI
/// initialize was done, wipe it and
/// repopulate from scratch
/// </summary>
private void InitInvoices()
private async Task InitInvoices()
{
Waiting w = new Waiting();
w.Show();
w.Ops = "Validating invoices...";
try
{
_MisMatches.Clear();
grid.BeginUpdate();
dsInvoices.Clear();
_wolist = WorkorderServiceBillableList.GetList(Util.QDat.PreWOStatus, true);
//[HttpGet("accounting-list-billable/{workOrderStatusId}")]
var r = await util.GetAsync($"accounting-list-billable/{util.QDat.PreWOStatus}");
_wolist = r.ObjectResponse["data"].ToObject<List<WorkOrderAccountingListItem>>();
DataTable dtInvoice = dsInvoices.Tables["Invoices"];
DataTable dtWorkorder = dsInvoices.Tables["Workorders"];
foreach (WorkorderServiceBillableList.WorkorderServiceBillableListInfo i in _wolist)

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AyaNovaQBI
{
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; }
}
}