diff --git a/AdvertsingProfitControl/APCDatabase.accdb b/AdvertsingProfitControl/APCDatabase.accdb
index 8d3b5bf..3a240f4 100644
Binary files a/AdvertsingProfitControl/APCDatabase.accdb and b/AdvertsingProfitControl/APCDatabase.accdb differ
diff --git a/AdvertsingProfitControl/APCTemplate.accdb b/AdvertsingProfitControl/APCTemplate.accdb
index 46342c1..68c4dc9 100644
Binary files a/AdvertsingProfitControl/APCTemplate.accdb and b/AdvertsingProfitControl/APCTemplate.accdb differ
diff --git a/AdvertsingProfitControl/AdvertsingProfitControl.csproj b/AdvertsingProfitControl/AdvertsingProfitControl.csproj
index bb4729c..9097f4a 100644
--- a/AdvertsingProfitControl/AdvertsingProfitControl.csproj
+++ b/AdvertsingProfitControl/AdvertsingProfitControl.csproj
@@ -214,7 +214,6 @@
True
-
diff --git a/AdvertsingProfitControl/DatabaseWriter.cs b/AdvertsingProfitControl/DatabaseWriter.cs
index ce22b0e..513c661 100644
--- a/AdvertsingProfitControl/DatabaseWriter.cs
+++ b/AdvertsingProfitControl/DatabaseWriter.cs
@@ -153,10 +153,10 @@ namespace AdvertsingProfitControl
//11:FK_DateID
oleDbCommand.Parameters.AddWithValue("Sold", salesTable.Rows[i][1]);
oleDbCommand.Parameters.AddWithValue("SalesPrice", salesTable.Rows[i][2]);
- oleDbCommand.Parameters.AddWithValue("TotalSales", int.Parse(salesTable.Rows[i][3].ToString()));
- oleDbCommand.Parameters.AddWithValue("Cost", int.Parse(salesTable.Rows[i][4].ToString()));
- oleDbCommand.Parameters.AddWithValue("ProfitReturn", int.Parse(salesTable.Rows[i][5].ToString()));
- oleDbCommand.Parameters.AddWithValue("TotalProfitReturn", int.Parse(salesTable.Rows[i][6].ToString()));
+ oleDbCommand.Parameters.AddWithValue("TotalSales", double.Parse(salesTable.Rows[i][3].ToString()));
+ oleDbCommand.Parameters.AddWithValue("Cost", double.Parse(salesTable.Rows[i][4].ToString()));
+ oleDbCommand.Parameters.AddWithValue("ProfitReturn", double.Parse(salesTable.Rows[i][5].ToString()));
+ oleDbCommand.Parameters.AddWithValue("TotalProfitReturn", double.Parse(salesTable.Rows[i][6].ToString()));
oleDbCommand.Parameters.AddWithValue("FK_AdItemID", int.Parse(salesTable.Rows[i][7].ToString()));
oleDbCommand.Parameters.AddWithValue("RowAttribute", int.Parse(salesTable.Rows[i][8].ToString()));
oleDbCommand.Parameters.AddWithValue("adSpecialID", int.Parse(salesTable.Rows[i][9].ToString()));
diff --git a/AdvertsingProfitControl/FrmMain.cs b/AdvertsingProfitControl/FrmMain.cs
index b6d7952..69f7afd 100644
--- a/AdvertsingProfitControl/FrmMain.cs
+++ b/AdvertsingProfitControl/FrmMain.cs
@@ -29,9 +29,9 @@ namespace AdvertsingProfitControl
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
- RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
ConstructApcDataGridViews();
ConstructInvoicesDataGridView();
+ RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString);
monthCalendar.SelectionStart = date;
_currentActiveDate = date;
@@ -360,6 +360,16 @@ namespace AdvertsingProfitControl
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
+ if (monthCalendar.BoldedDates.Length == 0)
+ {
+ //The database is most likely empty so halt everything.
+ dateTimeGroupBox.Text = @"The database appears to be empty.";
+ modifyRecordMainMenu.Enabled = false;
+ modifyRecordMainMenu.ToolTipText = @"There are no records to modify.";
+ return;
+ }
+ modifyRecordMainMenu.Enabled = true;
+ modifyRecordMainMenu.ToolTipText = @"";
var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"),
databaseTracker.DatabaseConnectionString);
if (dateId == 0)
@@ -836,9 +846,10 @@ namespace AdvertsingProfitControl
continue;
//Apply formatting to the only cells that will have currency values in them.
case 4:
- var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()).ToString("N2");
- if (netAmountAtCost != "0.00")
+ var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
+ if (netAmountAtCost.ToString("N2") != "0.00")
{
+ _totalInvoicePurchases += netAmountAtCost;
cell.Value = netAmountAtCost;
}
row.Cells.Add(cell);
@@ -846,8 +857,7 @@ namespace AdvertsingProfitControl
case 5:
var netAmoundExtendedRetail = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
if (netAmoundExtendedRetail.ToString("N2") != "0.00")
- {
- _totalInvoicePurchases += netAmoundExtendedRetail;
+ {
cell.Value = netAmoundExtendedRetail.ToString("N2");
}
row.Cells.Add(cell);
diff --git a/AdvertsingProfitControl/NewAddRecord.cs b/AdvertsingProfitControl/NewAddRecord.cs
index 45f389c..2a776e9 100644
--- a/AdvertsingProfitControl/NewAddRecord.cs
+++ b/AdvertsingProfitControl/NewAddRecord.cs
@@ -1048,6 +1048,18 @@ namespace AdvertsingProfitControl
rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
}
break;
+ case (int)SalesTableColumns.ProfitReturn:
+ //IF the Cost cell is empty then place 0.00 into the array as a place holder value (assuming this row is a HeaderRow).
+ if (projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString() == "")
+ {
+ rowContents[i] = "";
+ }
+ //ELSE place the value from the Projections table into the array, since Cost can be determined before actual data is used.
+ else
+ {
+ rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
+ }
+ break;
case (int)SalesTableColumns.IsDirty:
rowContents[i] = true;
break;
@@ -1576,6 +1588,9 @@ namespace AdvertsingProfitControl
case (int)SalesTableColumns.Cost:
rowContents[i] = actualSalesDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
break;
+ case (int)SalesTableColumns.ProfitReturn:
+ rowContents[i] = projectionsDataGridView.Rows[e.RowIndex].Cells[i].EditedFormattedValue.ToString();
+ break;
case (int)SalesTableColumns.IsDirty:
rowContents[i] = true;
break;
@@ -1731,7 +1746,7 @@ namespace AdvertsingProfitControl
};
if (name.Contains("ID"))
{
- //column.Visible = false;
+ column.Visible = false;
}
projectionsDataGridView.Columns.Add(column);
}
@@ -1742,7 +1757,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
projectionsDataGridView.Columns.Add(column);
@@ -1761,6 +1776,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
+ if (name.Contains("ID"))
+ {
+ column.Visible = false;
+ }
inventoryDataGridView.Columns.Add(column);
}
else
@@ -1770,7 +1789,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
inventoryDataGridView.Columns.Add(column);
@@ -1789,6 +1808,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
+ if (name.Contains("ID"))
+ {
+ column.Visible = false;
+ }
actualSalesDataGridView.Columns.Add(column);
}
else
@@ -1798,7 +1821,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
actualSalesDataGridView.Columns.Add(column);
@@ -1827,7 +1850,7 @@ namespace AdvertsingProfitControl
};
if (name.Contains("ID"))
{
- //column.Visible = false;
+ column.Visible = false;
}
invoicesDataGridView.Columns.Add(column);
}
@@ -1837,7 +1860,7 @@ namespace AdvertsingProfitControl
{
Name = name,
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
invoicesDataGridView.Columns.Add(column);
@@ -2450,7 +2473,7 @@ namespace AdvertsingProfitControl
continue;
}
//Check to see if the row is dirty.
- if (!(bool)row.Cells[(int)SalesTableColumns.IsDirty].Value)
+ if (!(bool)row.Cells[(int)SalesTableColumns.IsDirty].EditedFormattedValue)
{
//If it is not then continue on to the next row.
continue;
@@ -2476,11 +2499,11 @@ namespace AdvertsingProfitControl
}
//Determine the row's attribute.
var rowAttribute = 0; //Zero (0) means no grouping, its not a header nor a member.
- if ((bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].Value && !(bool)row.Cells[(int)SalesTableColumns.IsMemberRow].Value)
+ if ((bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].EditedFormattedValue && !(bool)row.Cells[(int)SalesTableColumns.IsMemberRow].EditedFormattedValue)
{
rowAttribute = 1;
}
- else if ((bool)row.Cells[(int)SalesTableColumns.IsMemberRow].Value && !(bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].Value)
+ else if ((bool)row.Cells[(int)SalesTableColumns.IsMemberRow].EditedFormattedValue && !(bool)row.Cells[(int)SalesTableColumns.IsHeaderRow].EditedFormattedValue)
{
rowAttribute = 2;
}
@@ -2607,7 +2630,7 @@ namespace AdvertsingProfitControl
continue;
}
//Check to see if the row is dirty.
- if (!(bool)row.Cells[(int)InventoryTableColumns.IsDirty].Value)
+ if (!(bool)row.Cells[(int)InventoryTableColumns.IsDirty].EditedFormattedValue)
{
//If it is not then continue on to the next row.
continue;
@@ -2632,11 +2655,11 @@ namespace AdvertsingProfitControl
}
//Determine the row's attribute.
var rowAttribute = 0; //Zero (0) means no grouping, its not a header nor a member.
- if ((bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].Value && !(bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].Value)
+ if ((bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].EditedFormattedValue && !(bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].EditedFormattedValue)
{
rowAttribute = 1;
}
- else if ((bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].Value && !(bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].Value)
+ else if ((bool)row.Cells[(int)InventoryTableColumns.IsMemberRow].EditedFormattedValue && !(bool)row.Cells[(int)InventoryTableColumns.IsHeaderRow].EditedFormattedValue)
{
rowAttribute = 2;
}
diff --git a/AdvertsingProfitControl/NewModifyRecord.cs b/AdvertsingProfitControl/NewModifyRecord.cs
index 30e914b..dbbab17 100644
--- a/AdvertsingProfitControl/NewModifyRecord.cs
+++ b/AdvertsingProfitControl/NewModifyRecord.cs
@@ -1779,7 +1779,7 @@ namespace AdvertsingProfitControl
};
if (name.Contains("ID"))
{
- //column.Visible = false;
+ column.Visible = false;
}
projectionsDataGridView.Columns.Add(column);
}
@@ -1790,7 +1790,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
projectionsDataGridView.Columns.Add(column);
@@ -1809,6 +1809,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
+ if (name.Contains("ID"))
+ {
+ column.Visible = false;
+ }
inventoryDataGridView.Columns.Add(column);
}
else
@@ -1818,7 +1822,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
inventoryDataGridView.Columns.Add(column);
@@ -1837,6 +1841,10 @@ namespace AdvertsingProfitControl
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
};
+ if (name.Contains("ID"))
+ {
+ column.Visible = false;
+ }
actualSalesDataGridView.Columns.Add(column);
}
else
@@ -1846,7 +1854,7 @@ namespace AdvertsingProfitControl
Name = name,
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(bool),
- //Visible = false,
+ Visible = false,
SortMode = DataGridViewColumnSortMode.NotSortable
};
actualSalesDataGridView.Columns.Add(column);
@@ -3245,7 +3253,7 @@ namespace AdvertsingProfitControl
}
if (displayInformation) informationLabel.Text += @"Successfully saved inventory." + Environment.NewLine;
}
- else if (projectionsTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
+ else if (inventoryTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
{
if (displayInformation) informationLabel.Text += @"No changes to inventory detected." + Environment.NewLine;
}
@@ -3298,7 +3306,7 @@ namespace AdvertsingProfitControl
}
if (displayInformation) informationLabel.Text += @"Successfully saved actual sales." + Environment.NewLine;
}
- else if (projectionsTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
+ else if (actualSalesTrimmingStatus == TrimmingOperationResult.NoChangesRequired)
{
if (displayInformation) informationLabel.Text += @"No changes to actual sales detected." + Environment.NewLine;
}
diff --git a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application
index 4fae155..9ca45df 100644
--- a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application
+++ b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application
@@ -7,14 +7,14 @@
-
+
- KVKYbzq19q7ADJ+LPTGDgJAvr64l2Kmoa+3avj6GEKs=
+ 4D9q8qCwiqDGT3of5bXJu3aFzAW8154WMEsO9/5DONI=
diff --git a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest
index 1280fcb..90eb453 100644
--- a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest
+++ b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest
@@ -43,14 +43,14 @@
-
+
- 4RF9KpTz/tkh9aGV9uAdFH9h8OP+W7p1PkgSLnYAU7o=
+ IDxVw5Mjas8mXXn3h6ET9uRIbyaYf3MJ7XGeYh9OL1Y=
@@ -87,13 +87,22 @@
e48EkTyChGHXYJETENSLw7RKQ1LZ5ZDUghEtiv5DmqY=
-
+
- BhxzzAVktfxM46PKaURg6/dVO+AoTuOm4bm2CLmjz1A=
+ nsG4CuZailUF1ECpDsxZlFsXSEJmyBXTAvuId+rQuQ8=
+
+
+
+
+
+
+
+
+ HWMXjUaEQtZd0vBm2k4ValXtZwmVzcqV0rERViSzOOc=