diff --git a/AyaNovaQBI/FixInvoiceProblems.cs b/AyaNovaQBI/FixInvoiceProblems.cs index 7f19cee..5272b8e 100644 --- a/AyaNovaQBI/FixInvoiceProblems.cs +++ b/AyaNovaQBI/FixInvoiceProblems.cs @@ -39,7 +39,7 @@ namespace AyaNovaQBI Close(); } - TODO: Test each possible route through this below before moving on to invoice testing + private async void grid_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; diff --git a/AyaNovaQBI/MainForm.Designer.cs b/AyaNovaQBI/MainForm.Designer.cs index 579f145..49ed402 100644 --- a/AyaNovaQBI/MainForm.Designer.cs +++ b/AyaNovaQBI/MainForm.Designer.cs @@ -292,6 +292,7 @@ this.Linked.ReadOnly = true; this.Linked.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.Linked.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.Linked.Visible = false; // // statuscolor // diff --git a/AyaNovaQBI/MainForm.cs b/AyaNovaQBI/MainForm.cs index 976d288..25f9f89 100644 --- a/AyaNovaQBI/MainForm.cs +++ b/AyaNovaQBI/MainForm.cs @@ -89,38 +89,9 @@ namespace AyaNovaQBI Close(); } - private void multipleWorkordersPerInvoiceToolStripMenuItem_Click(object sender, EventArgs e) - { - if (grid.SelectedRows.Count < 1) - { - MessageBox.Show("There are no rows selected, select one or more rows to invoice"); - return; - } - MessageBox.Show($"STUB: MULTIPLEwoperinvoice {grid.SelectedRows.Count} rows selected"); - } - private void oneWorkOrderPerInvoiceToolStripMenuItem_Click(object sender, EventArgs e) - { - if (grid.SelectedRows.Count < 1) - { - MessageBox.Show("There are no rows selected, select one or more rows to invoice"); - return; - } - MessageBox.Show($"STUB: onwoperinvoice {grid.SelectedRows.Count} rows selected"); - - } - - private async void fixProblemsToolStripMenuItem_Click(object sender, EventArgs e) - { - FixInvoiceProblems d = new FixInvoiceProblems(); - d.MisMatches = _MisMatches; - d.PartPriceOverrides = _PartPriceOverrides; - d.ShowDialog(); - if (d.ChangesMade) - await InitInvoices(); - d.Dispose(); - } + private async void refreshInvoicesToolStripMenuItem_Click(object sender, EventArgs e) { @@ -177,7 +148,48 @@ namespace AyaNovaQBI b.Dispose(); } - #region Main workorder grid + + + + + + + #region WORKORDERS / INVOICING + + + + private void multipleWorkordersPerInvoiceToolStripMenuItem_Click(object sender, EventArgs e) + { + if (grid.SelectedRows.Count < 1) + { + MessageBox.Show("There are no rows selected, select one or more rows to invoice"); + return; + } + MessageBox.Show($"STUB: MULTIPLEwoperinvoice {grid.SelectedRows.Count} rows selected"); + } + + private void oneWorkOrderPerInvoiceToolStripMenuItem_Click(object sender, EventArgs e) + { + if (grid.SelectedRows.Count < 1) + { + MessageBox.Show("There are no rows selected, select one or more rows to invoice"); + return; + } + + MessageBox.Show($"STUB: onwoperinvoice {grid.SelectedRows.Count} rows selected"); + + } + + private async void fixProblemsToolStripMenuItem_Click(object sender, EventArgs e) + { + FixInvoiceProblems d = new FixInvoiceProblems(); + d.MisMatches = _MisMatches; + d.PartPriceOverrides = _PartPriceOverrides; + d.ShowDialog(); + if (d.ChangesMade) + await InitInvoices(); + d.Dispose(); + } /// /// Adjusts main form display to either show a list of billable workorders @@ -278,6 +290,11 @@ namespace AyaNovaQBI row["Linked"]= await util.ScanLinksOK(z.Id, _MisMatches, _PartPriceOverrides); _GridTable.Rows.Add(row); } + + + //var bindingList = new BindingList(_GridTable); + //var source = new BindingSource(bindingList, null); + //grid.DataSource = source; grid.DataSource = _GridTable; grid.ClearSelection(); } @@ -290,67 +307,8 @@ namespace AyaNovaQBI - ///// - ///// Helper for grouping workorders by client - ///// - ///// - ///// null if not found else datarow containing invoice for client - //private DataRow InvoiceRowForClientID(Guid ClientID) - //{ - // foreach (DataRow r in dsInvoices.Tables["Invoices"].Rows) - // { - // if ((Guid)r["ClientID"] == ClientID) - // { - // return r; - - // } - // } - // return null; - //} - - - - - //private void grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) - //{ - // if (e.Row.Band.Index == 0) - // { - // //Prepare invoice row - // if ((bool)e.Row.Cells["Linked"].Value == true) - // { - // e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("OK16");//Util.Image("OK16.png"); - // } - // else - // { - // e.Row.Cells["Client"].Appearance.Image = Util.AyaImage("Cancel16");//Util.Image("Cancel16.png"); - // } - // } - // else - // { - // //prepare workorder row - - // //if backcolor==0 that means no color was set - // int nColor = (int)e.Row.Cells["StatusARGB"].Value; - // if (nColor != 0) - // { - // e.Row.Cells["Status"].Appearance.BackColor = Color.FromArgb(nColor); - // e.Row.Cells["Status"].Appearance.ForeColor = Util.InvertColor(Color.FromArgb(nColor)); - - // } - - // //flag whether billable (linked) or not - // if ((bool)e.Row.Cells["Linked"].Value == true) - // { - // e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("OK16"); - // } - // else - // { - // e.Row.Cells["ServiceNumber"].Appearance.Image = Util.AyaImage("Cancel16"); - // } - // } - - //} - #endregion + + #endregion workorders / invoicing