diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj
index a4920ee..d53959b 100644
--- a/AyaNovaQBI/AyaNovaQBI.csproj
+++ b/AyaNovaQBI/AyaNovaQBI.csproj
@@ -224,6 +224,7 @@
Waiting.cs
+
diff --git a/AyaNovaQBI/MainForm.cs b/AyaNovaQBI/MainForm.cs
index 7d680e1..fbe3607 100644
--- a/AyaNovaQBI/MainForm.cs
+++ b/AyaNovaQBI/MainForm.cs
@@ -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
@@ -197,7 +353,7 @@ namespace AyaNovaQBI
StringBuilder sb = new StringBuilder();
sb.Append("No invoiceable work orders found in AyaNova\r\n\r\n");
sb.Append("A work order is invoiceable and will be listed here if it has:\r\n");
-
+
sb.Append(" - \"Invoice number\" field empty\r\n");
if (util.QDat.PreWOStatus != 0)
{
@@ -212,9 +368,9 @@ namespace AyaNovaQBI
sb.Append("\r\n");
sb.Append(" (You can change this status under Tools->Preferences in the menu)");
}
- else
+ else
sb.Append(" - any \"Locked\" type of Work order status set\r\n");
-
+
lblStatus.Text = sb.ToString();
grid.Visible = false;
@@ -233,7 +389,8 @@ namespace AyaNovaQBI
filter "[{\"column\":\"WorkOrderInvoiceNumber\",\"any\":false,\"items\":[{\"op\":\"=\",\"value\":\"*NULL*\"}]}]"
*/
- private WorkorderServiceBillableList _wolist = null;
+
+ private List _wolist = null;
private List _MisMatches = new List();
private List _PartPriceOverrides = new List();
///
@@ -242,20 +399,20 @@ namespace AyaNovaQBI
/// initialize was done, wipe it and
/// repopulate from scratch
///
- 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>();
+
+
DataTable dtInvoice = dsInvoices.Tables["Invoices"];
DataTable dtWorkorder = dsInvoices.Tables["Workorders"];
foreach (WorkorderServiceBillableList.WorkorderServiceBillableListInfo i in _wolist)
diff --git a/AyaNovaQBI/WorkOrderAccountingListItem.cs b/AyaNovaQBI/WorkOrderAccountingListItem.cs
new file mode 100644
index 0000000..f118bfc
--- /dev/null
+++ b/AyaNovaQBI/WorkOrderAccountingListItem.cs
@@ -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; }
+ }
+}