diff --git a/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs b/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs
index e085326..1967bd3 100644
--- a/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs
+++ b/AdvertsingProfitControl/AdvertisingProfitControlTableHelper.cs
@@ -414,8 +414,7 @@ namespace AdvertsingProfitControl
Supplier = 2,
InvoiceNumber = 3,
InvoiceNetAmountAtCost = 4,
- InvoiceNetAmount = 5,
- InvoiceNote = 6,
- IsDirty = 7
+ InvoiceNote = 5,
+ IsDirty = 6
}
}
diff --git a/AdvertsingProfitControl/AdvertsingProfitControl.csproj b/AdvertsingProfitControl/AdvertsingProfitControl.csproj
index a01bed6..1943a35 100644
--- a/AdvertsingProfitControl/AdvertsingProfitControl.csproj
+++ b/AdvertsingProfitControl/AdvertsingProfitControl.csproj
@@ -102,6 +102,7 @@
+
diff --git a/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs b/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs
index 5ccc135..b28c4f5 100644
--- a/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs
+++ b/AdvertsingProfitControl/DebugDatabaseConverter.Designer.cs
@@ -33,31 +33,33 @@
this.moveOverButton = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.convertButton = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// existingDatesListBox
//
this.existingDatesListBox.FormattingEnabled = true;
this.existingDatesListBox.ItemHeight = 24;
- this.existingDatesListBox.Location = new System.Drawing.Point(59, 84);
+ this.existingDatesListBox.Location = new System.Drawing.Point(23, 12);
this.existingDatesListBox.Name = "existingDatesListBox";
this.existingDatesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
- this.existingDatesListBox.Size = new System.Drawing.Size(254, 316);
+ this.existingDatesListBox.Size = new System.Drawing.Size(353, 364);
this.existingDatesListBox.TabIndex = 0;
//
// datesToConvertListBox
//
this.datesToConvertListBox.FormattingEnabled = true;
this.datesToConvertListBox.ItemHeight = 24;
- this.datesToConvertListBox.Location = new System.Drawing.Point(373, 84);
+ this.datesToConvertListBox.Location = new System.Drawing.Point(556, 29);
this.datesToConvertListBox.Name = "datesToConvertListBox";
- this.datesToConvertListBox.Size = new System.Drawing.Size(254, 316);
+ this.datesToConvertListBox.Size = new System.Drawing.Size(97, 52);
this.datesToConvertListBox.TabIndex = 1;
//
// moveOverButton
//
this.moveOverButton.Enabled = false;
- this.moveOverButton.Location = new System.Drawing.Point(59, 446);
+ this.moveOverButton.Location = new System.Drawing.Point(381, 417);
this.moveOverButton.Name = "moveOverButton";
this.moveOverButton.Size = new System.Drawing.Size(160, 56);
this.moveOverButton.TabIndex = 2;
@@ -71,7 +73,7 @@
//
// convertButton
//
- this.convertButton.Location = new System.Drawing.Point(373, 452);
+ this.convertButton.Location = new System.Drawing.Point(556, 530);
this.convertButton.Name = "convertButton";
this.convertButton.Size = new System.Drawing.Size(133, 50);
this.convertButton.TabIndex = 3;
@@ -79,11 +81,32 @@
this.convertButton.UseVisualStyleBackColor = true;
this.convertButton.Click += new System.EventHandler(this.convertButton_Click);
//
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 515);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(64, 25);
+ this.label1.TabIndex = 4;
+ this.label1.Text = "label1";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(400, 530);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(141, 58);
+ this.button1.TabIndex = 5;
+ this.button1.Text = "button1";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
// DebugDatabaseConverter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(701, 592);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.label1);
this.Controls.Add(this.convertButton);
this.Controls.Add(this.moveOverButton);
this.Controls.Add(this.datesToConvertListBox);
@@ -92,6 +115,7 @@
this.Text = "DebugDatabaseConverter";
this.Load += new System.EventHandler(this.DebugDatabaseConverter_Load);
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -102,5 +126,7 @@
private System.Windows.Forms.Button moveOverButton;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button convertButton;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Button button1;
}
}
\ No newline at end of file
diff --git a/AdvertsingProfitControl/DebugDatabaseConverter.cs b/AdvertsingProfitControl/DebugDatabaseConverter.cs
index 9ef96b0..5db0756 100644
--- a/AdvertsingProfitControl/DebugDatabaseConverter.cs
+++ b/AdvertsingProfitControl/DebugDatabaseConverter.cs
@@ -69,6 +69,7 @@ namespace AdvertsingProfitControl
}
}
}
+
}
private void MoveOverButton_Click(object sender, EventArgs e)
@@ -776,5 +777,23 @@ namespace AdvertsingProfitControl
return dataTable;
}
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ var db = new AdvertisingProfitControlModel();
+ using (var scope = new TransactionScope())
+ {
+ var invoices = db.Invoices.Select(x => x);
+ foreach (var invoice in invoices)
+ {
+ invoice.InvoiceNetAmountAtCost = invoice.InvoiceNetAmount;
+ invoice.InvoiceNetAmount = null;
+
+ }
+ db.SaveChanges();
+ scope.Complete();
+ }
+
+ }
}
}
diff --git a/AdvertsingProfitControl/FrmMain.cs b/AdvertsingProfitControl/FrmMain.cs
index f5a135d..43afc58 100644
--- a/AdvertsingProfitControl/FrmMain.cs
+++ b/AdvertsingProfitControl/FrmMain.cs
@@ -49,8 +49,8 @@ namespace AdvertsingProfitControl
if (actualSalesDataGridView.Rows.Count == 0)
{
salesProducedLabel.Text = @"Sales Produced By Ad Items (A): No Data";
- totalProfitFromAdItemsLabel.Text = @"Total Profit Return " + Environment.NewLine + @" From Ad Items (B): No Data";
- if (Math.Abs(_departmentSales) < 1)
+ totalProfitFromAdItemsLabel.Text = @"Total Profit Return " + Environment.NewLine + @"From Ad Items (B): No Data";
+ if (_departmentSales == 0)
{
departmentSalesLabel.Text = @"Department Sales: No Data";
}
@@ -71,17 +71,17 @@ namespace AdvertsingProfitControl
}
}
- if (Math.Abs(_salesProducedByAdItems) < 1)
+ if (_salesProducedByAdItems == 0)
{
salesProducedLabel.Text = @"Sales Produced By Ad Items (A): No Data";
incompleteData = true;
}
- if (Math.Abs(_totalProfitReturnFromAdItems) < 1)
+ if (_totalProfitReturnFromAdItems == 0)
{
totalProfitFromAdItemsLabel.Text = @"Total Profit Return " + Environment.NewLine + @"From Ad Items (B): No Data";
incompleteData = true;
}
- if (Math.Abs(_departmentSales) < 1)
+ if (_departmentSales == 0)
{
departmentSalesLabel.Text = @"Department Sales: No Data";
incompleteData = true;
@@ -107,16 +107,21 @@ namespace AdvertsingProfitControl
private void CalculateGrossProfit()
{
- if (Math.Abs(_totalInvoicePurchases) < 1)
+ if (_totalInvoicePurchases == 0)
{
- //IF Cost of Sales hasn't been calculated, then clear labels and return.
- if (Math.Abs(_departmentSales) < 1)
- {
- grossProfitTotalSales.Text = @"Total Sales: No Data";
- }
+ grossProfitTotalSales.Text = _departmentSales == 0
+ ? @"Total Sales: No Data"
+ : @"Total Sales: " + _departmentSales.ToString("C");
grossProfitLessCostOfSales.Text = @"Less Cost of Sales: No Data";
return;
}
+ //IF Cost of Sales hasn't been calculated, then clear labels and return.
+ if (_departmentSales == 0)
+ {
+ grossProfitTotalSales.Text = @"Total Sales: No Data";
+ grossProfitLessCostOfSales.Text = @"Less Cost of Sales: " + _totalInvoicePurchases.ToString("C");
+ return;
+ }
grossProfitTotalSales.Text = @"Total Sales: " + _departmentSales.ToString("C");
grossProfitLessCostOfSales.Text = @"Less Cost of Sales: " + _totalInvoicePurchases.ToString("C");
var dollarGrossProfit = _departmentSales - _totalInvoicePurchases;
@@ -432,8 +437,7 @@ namespace AdvertsingProfitControl
{
string[] invoicesColumnNames =
{
- "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost",
- "InvoiceNetAmountExtendedRetail", "InvoiceNote"
+ "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNote"
};
foreach (var name in invoicesColumnNames)
@@ -444,7 +448,6 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
- MaxInputLength = 20
};
invoicesDataGridView.Columns.Add(column);
}
@@ -651,9 +654,8 @@ namespace AdvertsingProfitControl
invoicesDataGridView.Rows[index].Cells[2].Value = invoice.InvoiceNumber;
invoicesDataGridView.Rows[index].Cells[3].Value = $@"{invoice.InvoiceNetAmountAtCost:N2}";
//Net Amount Extended Retail is not the required field.
- if (invoice.InvoiceNetAmountAtCost != null) _totalInvoicePurchases += (decimal)invoice.InvoiceNetAmountAtCost;
- invoicesDataGridView.Rows[index].Cells[4].Value = $@"{invoice.InvoiceNetAmount:N2}";
- invoicesDataGridView.Rows[index].Cells[5].Value = invoice.InvoiceNote;
+ if (invoice.InvoiceNetAmountAtCost != null) _totalInvoicePurchases += (decimal)invoice.InvoiceNetAmountAtCost;
+ invoicesDataGridView.Rows[index].Cells[4].Value = invoice.InvoiceNote;
}
//Add the total purchases row to the invoice table.
if(invoicesDataGridView.RowCount == 0) return;
@@ -662,7 +664,7 @@ namespace AdvertsingProfitControl
invoicesDataGridView.Rows[invoicesDataGridView.Rows.Count - 1].Cells[0].Value = @"Total Purchases";
if (Math.Abs(_totalInvoicePurchases) > 0)
{
- invoicesDataGridView.Rows[invoicesDataGridView.Rows.Count - 1].Cells[4].Value = _totalInvoicePurchases.ToString("N2");
+ invoicesDataGridView.Rows[invoicesDataGridView.Rows.Count - 1].Cells[3].Value = _totalInvoicePurchases.ToString("N2");
}
}
diff --git a/AdvertsingProfitControl/NewModifyRecord.cs b/AdvertsingProfitControl/NewModifyRecord.cs
index ef31508..c8324bd 100644
--- a/AdvertsingProfitControl/NewModifyRecord.cs
+++ b/AdvertsingProfitControl/NewModifyRecord.cs
@@ -2153,7 +2153,7 @@ namespace AdvertsingProfitControl
///
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
diff --git a/AdvertsingProfitControl/Properties/AssemblyInfo.cs b/AdvertsingProfitControl/Properties/AssemblyInfo.cs
index 22ecc79..97acb1c 100644
--- a/AdvertsingProfitControl/Properties/AssemblyInfo.cs
+++ b/AdvertsingProfitControl/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.1.16")]
-[assembly: AssemblyFileVersion("2.0.1.16")]
+[assembly: AssemblyVersion("2.0.2.16")]
+[assembly: AssemblyFileVersion("2.0.2.16")]
diff --git a/SetupProject/Product.wxs b/SetupProject/Product.wxs
index 54edb20..1b28c88 100644
--- a/SetupProject/Product.wxs
+++ b/SetupProject/Product.wxs
@@ -1,6 +1,6 @@
-
+