Removed the Invoice Net Amount Extended Retail column from the Invoice table DataGridViews. Fixed a crash bug on the main form caused by an empty department sales variable. Small refactoring on the main form's calculation methods.
This commit is contained in:
@@ -2153,7 +2153,7 @@ namespace AdvertsingProfitControl
|
||||
/// </summary>
|
||||
private void ConstructInvoicesDataGridView()
|
||||
{
|
||||
string[] invoicesColumnNames = { "ID", "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNetAmountExtendedRetail", "InvoiceNote", "IsDirty" };
|
||||
string[] invoicesColumnNames = { "ID", "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNote", "IsDirty" };
|
||||
|
||||
foreach (var name in invoicesColumnNames)
|
||||
{
|
||||
@@ -2960,8 +2960,7 @@ namespace AdvertsingProfitControl
|
||||
invoicesDataGridView.Rows[index].Cells[1].Value = invoice.InvoiceDate.ToString("d");
|
||||
invoicesDataGridView.Rows[index].Cells[3].Value = invoice.InvoiceNumber;
|
||||
invoicesDataGridView.Rows[index].Cells[4].Value = invoice.InvoiceNetAmountAtCost == 0 ? "" : invoice.InvoiceNetAmountAtCost.ToString();
|
||||
invoicesDataGridView.Rows[index].Cells[5].Value = invoice.InvoiceNetAmount == 0 ? "" : invoice.InvoiceNetAmount.ToString();
|
||||
invoicesDataGridView.Rows[index].Cells[6].Value = invoice.InvoiceNote;
|
||||
invoicesDataGridView.Rows[index].Cells[5].Value = invoice.InvoiceNote;
|
||||
invoicesDataGridView.Rows[index].Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
|
||||
index++;
|
||||
}
|
||||
@@ -3829,12 +3828,6 @@ namespace AdvertsingProfitControl
|
||||
? 0
|
||||
: decimal.Parse(
|
||||
row.Cells[(int)InvoiceTableColumns.InvoiceNetAmountAtCost].EditedFormattedValue.ToString());
|
||||
invoice.InvoiceNetAmount =
|
||||
string.IsNullOrWhiteSpace(
|
||||
row.Cells[(int)InvoiceTableColumns.InvoiceNetAmount].EditedFormattedValue.ToString())
|
||||
? 0
|
||||
: decimal.Parse(
|
||||
row.Cells[(int)InvoiceTableColumns.InvoiceNetAmount].EditedFormattedValue.ToString());
|
||||
invoice.InvoiceNote = row.Cells[(int)InvoiceTableColumns.InvoiceNote].EditedFormattedValue.ToString();
|
||||
invoice.FkSupplierId = supplier.Id;
|
||||
invoice.FkDateId = date.Id;
|
||||
@@ -3859,17 +3852,10 @@ namespace AdvertsingProfitControl
|
||||
: decimal.Parse(
|
||||
row.Cells[(int) InvoiceTableColumns.InvoiceNetAmountAtCost]
|
||||
.EditedFormattedValue.ToString());
|
||||
invoice.InvoiceNetAmount =
|
||||
string.IsNullOrWhiteSpace(
|
||||
row.Cells[(int) InvoiceTableColumns.InvoiceNetAmount].EditedFormattedValue
|
||||
.ToString())
|
||||
? 0
|
||||
: decimal.Parse(
|
||||
row.Cells[(int) InvoiceTableColumns.InvoiceNetAmount].EditedFormattedValue
|
||||
.ToString());
|
||||
invoice.InvoiceNote =
|
||||
row.Cells[(int) InvoiceTableColumns.InvoiceNote].EditedFormattedValue.ToString();
|
||||
invoice.FkSupplierId = supplier.Id;
|
||||
idNumbers.Add(row.Index, invoice);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3889,6 +3875,7 @@ namespace AdvertsingProfitControl
|
||||
invoicesDataGridView.Rows[index.Key].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
|
||||
invoicesDataGridView.Rows[index.Key].Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
|
||||
}
|
||||
|
||||
informationLabel.Text += @"Updated the Invoices table." + Environment.NewLine;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user