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;
|
||||||
@@ -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)
|
|
||||||
{
|
|
||||||
//it's a child so see if it's parent is selected and if so then ignore it
|
|
||||||
//as it will be invoiced with the parent or more likely already has been
|
|
||||||
if (r.ParentRow.Selected)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//It's a stand alone single workorder selected to be invoiced on it's own
|
if ((bool)r.Cells["Linked"].Value == true)
|
||||||
//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?
|
al.Add((long)r.Cells["id"].Value);
|
||||||
if (r.Band.Index == 0 && r.Selected)
|
|
||||||
{
|
|
||||||
foreach (UltraGridRow rchild in r.ChildBands[0].Rows)
|
|
||||||
{
|
|
||||||
if ((bool)rchild.Cells["Linked"].Value == true)
|
|
||||||
{
|
|
||||||
al.Add((Guid)rchild.Cells["WorkorderID"].Value);
|
|
||||||
//case 1604
|
//case 1604
|
||||||
if (bOneWoPerInvoice)
|
if (bOneWoPerInvoice)
|
||||||
{
|
{
|
||||||
//then invoice it out now
|
//then invoice it out now
|
||||||
w.Step = "Invoicing single workorder ";
|
w.Step = "Invoicing single workorder ";
|
||||||
Util.Invoice(al, alErrors);
|
await util.Invoice(al, alErrors);
|
||||||
//and clear al workorders list
|
//and clear al workorders list
|
||||||
al.Clear();
|
al.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if (al.Count > 0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}//end of foreach loop
|
||||||
{
|
{
|
||||||
w.Step = "Invoicing " + al.Count.ToString() + ((al.Count > 1) ? " Workorders" : " Workorder");
|
w.Step = "Invoicing " + al.Count.ToString() + ((al.Count > 1) ? " Workorders" : " Workorder");
|
||||||
Util.Invoice(al, alErrors);
|
await util.Invoice(al, alErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//end of foreach loop
|
|
||||||
|
|
||||||
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