This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -252,13 +253,13 @@ namespace AyaNovaQBI
|
|||||||
var v = r.ObjectResponse["data"].ToObject<List<WorkOrderAccountingListItem>>();
|
var v = r.ObjectResponse["data"].ToObject<List<WorkOrderAccountingListItem>>();
|
||||||
|
|
||||||
foreach (WorkOrderAccountingListItem z in v)
|
foreach (WorkOrderAccountingListItem z in v)
|
||||||
{
|
{
|
||||||
w.Step = "WO: " + z.Serial;
|
w.Step = "WO: " + z.Serial;
|
||||||
DataRow row = _GridTable.NewRow();
|
DataRow row = _GridTable.NewRow();
|
||||||
row["CustomerName"] = z.CustomerName;
|
row["CustomerName"] = z.CustomerName;
|
||||||
row["Serial"] = z.Serial;
|
row["Serial"] = z.Serial;
|
||||||
if (z.ServiceDate != null)
|
if (z.ServiceDate != null)
|
||||||
row["ServiceDate"] = ((DateTime)z.ServiceDate).ToLocalTime();
|
row["ServiceDate"] = ((DateTime)z.ServiceDate).ToLocalTime();
|
||||||
row["WorkorderStatusName"] = z.WorkorderStatusName;
|
row["WorkorderStatusName"] = z.WorkorderStatusName;
|
||||||
row["ProjectName"] = z.ProjectName;
|
row["ProjectName"] = z.ProjectName;
|
||||||
row["Color"] = z.Color;
|
row["Color"] = z.Color;
|
||||||
@@ -297,7 +298,7 @@ namespace AyaNovaQBI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//An array list to hold the guid's of workorders being invoiced
|
//An array list to hold the guid's of workorders being invoiced
|
||||||
ArrayList al = new ArrayList();
|
List<long> al = new List<long>();
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
Cursor.Current = Cursors.WaitCursor;
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
ArrayList alErrors = new ArrayList();
|
ArrayList alErrors = new ArrayList();
|
||||||
@@ -306,66 +307,37 @@ namespace AyaNovaQBI
|
|||||||
w.Ops = "Invoicing to QuickBooks...";
|
w.Ops = "Invoicing to QuickBooks...";
|
||||||
|
|
||||||
//work through selected items top to bottom
|
//work through selected items top to bottom
|
||||||
foreach (UltraGridRow r in grid.Selected.Rows)
|
foreach (DataGridViewRow r in grid.SelectedRows)
|
||||||
{
|
{
|
||||||
//clear the workorder list
|
//clear the workorder list
|
||||||
al.Clear();
|
al.Clear();
|
||||||
|
|
||||||
//One lone workorder to be invoiced?
|
|
||||||
if (r.Band.Index == 1)
|
if ((bool)r.Cells["Linked"].Value == true)
|
||||||
{
|
{
|
||||||
//it's a child so see if it's parent is selected and if so then ignore it
|
al.Add((long)r.Cells["id"].Value);
|
||||||
//as it will be invoiced with the parent or more likely already has been
|
//case 1604
|
||||||
if (r.ParentRow.Selected)
|
if (bOneWoPerInvoice)
|
||||||
continue;
|
|
||||||
|
|
||||||
//It's a stand alone single workorder selected to be invoiced on it's own
|
|
||||||
//with no parent invoice row selected, so invoice it out now
|
|
||||||
|
|
||||||
// but check to see if it's all linked first:
|
|
||||||
if ((bool)r.Cells["Linked"].Value == false)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
al.Add((Guid)r.Cells["WorkorderID"].Value);
|
|
||||||
w.Step = "Invoicing single workorder ";
|
|
||||||
util.Invoice(al, alErrors);
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//A group of workorders to be invoiced?
|
|
||||||
if (r.Band.Index == 0 && r.Selected)
|
|
||||||
{
|
{
|
||||||
foreach (UltraGridRow rchild in r.ChildBands[0].Rows)
|
//then invoice it out now
|
||||||
{
|
w.Step = "Invoicing single workorder ";
|
||||||
if ((bool)rchild.Cells["Linked"].Value == true)
|
await util.Invoice(al, alErrors);
|
||||||
{
|
//and clear al workorders list
|
||||||
al.Add((Guid)rchild.Cells["WorkorderID"].Value);
|
al.Clear();
|
||||||
//case 1604
|
|
||||||
if (bOneWoPerInvoice)
|
|
||||||
{
|
|
||||||
//then invoice it out now
|
|
||||||
w.Step = "Invoicing single workorder ";
|
|
||||||
Util.Invoice(al, alErrors);
|
|
||||||
//and clear al workorders list
|
|
||||||
al.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (al.Count > 0)
|
|
||||||
{
|
|
||||||
w.Step = "Invoicing " + al.Count.ToString() + ((al.Count > 1) ? " Workorders" : " Workorder");
|
|
||||||
Util.Invoice(al, alErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}//end of foreach loop
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}//end of foreach loop
|
||||||
|
{
|
||||||
|
w.Step = "Invoicing " + al.Count.ToString() + ((al.Count > 1) ? " Workorders" : " Workorder");
|
||||||
|
await util.Invoice(al, alErrors);
|
||||||
|
}
|
||||||
w.Close();
|
w.Close();
|
||||||
|
|
||||||
//display errors if any
|
//display errors if any
|
||||||
@@ -388,7 +360,7 @@ namespace AyaNovaQBI
|
|||||||
}
|
}
|
||||||
|
|
||||||
//refresh display
|
//refresh display
|
||||||
InitInvoices();
|
await InitInvoices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user