This commit is contained in:
2022-06-18 02:16:35 +00:00
parent 4a27b638c2
commit 1891a6dab7
3 changed files with 26 additions and 3 deletions

View File

@@ -56,7 +56,7 @@
this.wonumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.wonumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.servicedate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.servicedate = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.project = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.project = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.linked = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.linked = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@@ -228,6 +228,7 @@
this.grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.grid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.grid.Size = new System.Drawing.Size(765, 359); this.grid.Size = new System.Drawing.Size(765, 359);
this.grid.TabIndex = 3; this.grid.TabIndex = 3;
this.grid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.grid_CellFormatting);
// //
// status // status
// //
@@ -291,6 +292,8 @@
this.linked.HeaderText = "Linked"; this.linked.HeaderText = "Linked";
this.linked.Name = "linked"; this.linked.Name = "linked";
this.linked.ReadOnly = true; this.linked.ReadOnly = true;
this.linked.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.linked.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.linked.Visible = false; this.linked.Visible = false;
this.linked.Width = 64; this.linked.Width = 64;
// //
@@ -345,7 +348,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn wonumber; private System.Windows.Forms.DataGridViewTextBoxColumn wonumber;
private System.Windows.Forms.DataGridViewTextBoxColumn servicedate; private System.Windows.Forms.DataGridViewTextBoxColumn servicedate;
private System.Windows.Forms.DataGridViewTextBoxColumn project; private System.Windows.Forms.DataGridViewTextBoxColumn project;
private System.Windows.Forms.DataGridViewTextBoxColumn linked; private System.Windows.Forms.DataGridViewCheckBoxColumn linked;
} }
} }

View File

@@ -23,5 +23,24 @@ namespace AyaNovaQBI
cbCustomersWithInvoiceableWorkorders.DisplayMember = "Name"; cbCustomersWithInvoiceableWorkorders.DisplayMember = "Name";
grid.DataSource = util.GetInvoiceableItems(); grid.DataSource = util.GetInvoiceableItems();
} }
private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == grid.Columns["Status"].Index
&& e.Value != null)
{
var isLinked = (bool)grid.Rows[e.RowIndex].Cells["linked"].Value;
if (!isLinked)
{
grid.Rows[e.RowIndex].Cells["wonumber"].ErrorText = "Not invoiceable: use \"Invoice\" -> \"Fix problems\" to resolve";
}else
{
grid.Rows[e.RowIndex].Cells["wonumber"].ErrorText = null;
}
}
}
} }
} }

View File

@@ -11,9 +11,10 @@ namespace AyaNovaQBI
public static List<InvoiceableItem> GetInvoiceableItems() public static List<InvoiceableItem> GetInvoiceableItems()
{ {
var random = new Random();
var l = new List<InvoiceableItem>(); var l = new List<InvoiceableItem>();
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
l.Add(new InvoiceableItem { CustomerId = 1, Linked = true, Project = "project blah", ServiceDate = DateTime.Now.ToString("s"), ServiceNumber = "44", Status = "Waiting to be invoiced and just sitting there otherwise", StatusColor = "FF00FFAA", WorkorderId = 4 }); l.Add(new InvoiceableItem { CustomerId = 1, Linked = random.Next(2) == 1, Project = "project blah", ServiceDate = DateTime.Now.ToString("s"), ServiceNumber = (40+i).ToString(), Status = "Waiting to be invoiced and just sitting there otherwise", StatusColor = "FF00FFAA", WorkorderId = 4 });
return l; return l;
} }