This commit is contained in:
2022-07-12 21:23:19 +00:00
parent b501b9dc83
commit 42c0555923

View File

@@ -293,9 +293,6 @@ namespace AyaNovaQBI
/// </summary> /// </summary>
private async Task InvoiceSelected(bool bOneWoPerInvoice) private async Task InvoiceSelected(bool bOneWoPerInvoice)
{ {
if (grid.SelectedRows.Count < 1) if (grid.SelectedRows.Count < 1)
{ {
MessageBox.Show("There are no Work order rows selected\r\nSelect one or more rows to invoice"); MessageBox.Show("There are no Work order rows selected\r\nSelect one or more rows to invoice");
@@ -320,6 +317,10 @@ namespace AyaNovaQBI
return; return;
} }
if (MessageBox.Show("Invoice the selected AyaNova Work orders into QuickBooks.\r\n\r\nAre you sure?", "Invoice AyaNova Work orders", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
//We now have a list of work orders from grid selections ready to be invoiced and ordered by customer for grouping purposes //We now have a list of work orders from grid selections ready to be invoiced and ordered by customer for grouping purposes
//An array list to hold the guid's of workorders being invoiced //An array list to hold the guid's of workorders being invoiced
@@ -356,70 +357,6 @@ namespace AyaNovaQBI
al.Clear(); al.Clear();
} }
} }
//long currentCustomerId = -1;
//int CountOfInvoiceableWorkOrders = InvoiceableWorkOrdersList.Count;
//for (int i = 0; i < CountOfInvoiceableWorkOrders; i++)
//{
// bool finalRecord = CountOfInvoiceableWorkOrders - 1 == i;
// WorkOrderAccountingListItem invwo = InvoiceableWorkOrdersList[i];
// if (bOneWoPerInvoice)
// {
// al.Add(invwo.Id);
// w.Step = "Invoicing single workorder ";
// await util.Invoice(al, alErrors);
// //and clear al workorders list
// al.Clear();
// }
// else
// {
// //change of customer or last one in loop?
// if ((finalRecord || invwo.CustomerId != currentCustomerId) && al.Count > 0)
// {
// //invoice out this batch
// w.Step = "Batch invoicing " + al.Count.ToString() + ((al.Count > 1) ? " Work Orders" : " Work Order");
// await util.Invoice(al, alErrors);
// al.Clear();
// }
// currentCustomerId = invwo.CustomerId;
// al.Add(invwo.Id);
// }
//}
////work through selected items top to bottom
//foreach (DataGridViewRow r in grid.SelectedRows)
//{
// //clear the workorder list
// al.Clear();
// if ((bool)r.Cells["Linked"].Value == true)
// {
// al.Add((long)r.Cells["id"].Value);
// //case 1604
// if (bOneWoPerInvoice)
// {
// //then invoice it out now
// w.Step = "Invoicing single workorder ";
// await util.Invoice(al, alErrors);
// //and clear al workorders list
// al.Clear();
// }
// }
//}//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
@@ -432,20 +369,13 @@ namespace AyaNovaQBI
{ {
sb.Append((string)o); sb.Append((string)o);
sb.Append("\r\n************\r\n"); sb.Append("\r\n************\r\n");
} }
CopyableMessageBox cb = new CopyableMessageBox(sb.ToString()); CopyableMessageBox cb = new CopyableMessageBox(sb.ToString());
cb.ShowDialog(); cb.ShowDialog();
} }
//refresh display //refresh display
await InitInvoices(); await InitInvoices();
} }
#endregion workorders / invoicing #endregion workorders / invoicing