Fixed a bug in the row parsing engine related to ad special rows. Move all data from the old format to the new format. Updated the main form's UI.

This commit is contained in:
2017-01-23 00:26:46 -06:00
parent 9f045175ed
commit 739c4c179d
11 changed files with 228 additions and 158 deletions
Binary file not shown.
@@ -32,12 +32,6 @@ namespace AdvertsingProfitControl
isMemberColumn = (int)InventoryTableColumns.IsMemberRow;
isDirtyColumn = (int) InventoryTableColumns.IsDirty;
}
//If the current row is an Ad Special Row, the color code it and return as nothing further needs to be done.
if (parser.CheckForGroupKeyWord(dataGridView.Rows[startingIndex].Cells[(int) SalesTableColumns.AdItem].EditedFormattedValue.ToString()) != "NoGroupFound")
{
dataGridView.Rows[startingIndex].DefaultCellStyle.BackColor = Color.Silver;
return;
}
//Spin through the dataGridView rows starting at the row that fired the event.
for (var i = startingIndex; i < (dataGridView.RowCount - 1); i++)
{
@@ -261,12 +255,13 @@ namespace AdvertsingProfitControl
else if (rowStatus == RowAttribute.AdSpecialRow)
{
if(i == 0) return;
dataGridView.Rows[startingIndex].DefaultCellStyle.BackColor = Color.Silver;
//Get the previous row's attribute.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i - 1]);
if (rowStatus == RowAttribute.HeaderRow)
{
//Check to see if the previous row sees itself as a header row, if so mark it dirty.
if (!(bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].EditedFormattedValue)
if ((bool)dataGridView.Rows[i - 1].Cells[isHeaderColumn].EditedFormattedValue)
{
dataGridView.Rows[i - 1].Cells[isDirtyColumn].Value = true;
dataGridView.Rows[i - 1].HeaderCell.Style.BackColor = ApplicationColors.PendingEdit;
+3 -3
View File
@@ -168,7 +168,7 @@ namespace AdvertsingProfitControl
var dates = new List<DateTime>();
var oleDbCommand = new OleDbCommand
{
CommandText = "SELECT EndOfWeekDate FROM WeekEnding"
CommandText = "SELECT WeekEnding.EndOfWeekDate FROM WeekEnding"
};
var connection = new OleDbConnection(connectionString);
oleDbCommand.Connection = connection;
@@ -414,9 +414,9 @@ namespace AdvertsingProfitControl
}
}
}
catch (OleDbException e)
finally
{
connection.Close();
}
}
}
+22 -14
View File
@@ -477,27 +477,35 @@ namespace AdvertsingProfitControl
oleDbCommand.Parameters.AddWithValue("ID", int.Parse(table.Rows[i].Cells[(int)InvoiceTableColumns.Id].EditedFormattedValue.ToString()));
oleDbCommand.ExecuteNonQuery();
oleDbCommand.Parameters.Clear();
rowsAdded.Add(i);
}
//Row index is only used to keep track of what row failed to update.
lastRowProcessed = i + 1;
}
oleDbTransaction.Commit();
foreach (DataGridViewRow row in table.Rows)
//Spin through the collection and update the affected rows.
foreach (var rowIndex in rowsAdded)
{
if(row.IsNewRow) continue;
if (!rowsAdded.Contains(row.Index)) continue;
var supplierId = RetrieveSupplierId(row.Cells[(int)InvoiceTableColumns.Supplier].EditedFormattedValue.ToString());
var invoiceIdNumber =
RetrieveInvoiceId(
row.Cells[(int)InvoiceTableColumns.InvoiceDate].EditedFormattedValue
.ToString(),
long.Parse(
row.Cells[(int)InvoiceTableColumns.InvoiceNumber].EditedFormattedValue
.ToString()), supplierId, dateId);
row.Cells[(int)InvoiceTableColumns.Id].Value = invoiceIdNumber;
row.Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
row.HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
//Only reset the IsDirty value to false since the updates when through.
table.Rows[rowIndex].Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
table.Rows[rowIndex].HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
}
//foreach (DataGridViewRow row in table.Rows)
//{
// if(row.IsNewRow) continue;
// if (!rowsAdded.Contains(row.Index)) continue;
// var supplierId = RetrieveSupplierId(row.Cells[(int)InvoiceTableColumns.Supplier].EditedFormattedValue.ToString());
// var invoiceIdNumber =
// RetrieveInvoiceId(
// row.Cells[(int)InvoiceTableColumns.InvoiceDate].EditedFormattedValue
// .ToString(),
// long.Parse(
// row.Cells[(int)InvoiceTableColumns.InvoiceNumber].EditedFormattedValue
// .ToString()), supplierId, dateId);
// row.Cells[(int)InvoiceTableColumns.Id].Value = invoiceIdNumber;
// row.Cells[(int)InvoiceTableColumns.IsDirty].Value = false;
// row.HeaderCell.Style.BackColor = ApplicationColors.EditingSaved;
//}
table.RefreshEdit();
//Set the status.
status.SetStatus(WritingOperationStatus.InsertionSuccessful);
@@ -64,6 +64,7 @@ namespace AdvertsingProfitControl
}
}
}
connection.Close();
}
foreach (var date in dates)
@@ -99,15 +100,14 @@ namespace AdvertsingProfitControl
var actualSales = ReturnActualSales(oldDateId);
var invoices = ReturnInvoiceTable(oldDateId);
var weeklySales = ReturnWeeklySalesFromDateId(oldDateId);
MassiveWriteFunction(date.ToString(), projectionsTable, inventoryTable, actualSales, invoices, weeklySales);
var comment = GetComments(oldDateId);
MassiveWriteFunction(date.ToString(), projectionsTable, inventoryTable, actualSales, invoices, weeklySales, comment);
}
}
private void MassiveWriteFunction(string dateString, DataTable projections, DataTable inventory, DataTable actualSales, DataTable invoice, DataTable weeklySales)
private void MassiveWriteFunction(string dateString, DataTable projections, DataTable inventory, DataTable actualSales, DataTable invoice, DataTable weeklySales, string comments)
{
var dbT = new DatabaseTracker();
var dbR = new DatabaseReader();
//Get a new ID number for the date supplied.
var oleDbConnection = new OleDbConnection(dbT.DatabaseConnectionString);
var oleDbCommand = new OleDbCommand
@@ -149,7 +149,7 @@ namespace AdvertsingProfitControl
//Get the group name of the ad special its in.
adspecialId = GetAdSpecialId(int.Parse(projections.Rows[rowIndex][8].ToString()));
oleDbCommand.CommandText =
"INSERT INTO Projections (Sold, SalePrice, TotalSales, Cost, ProfitReturn, TotalProfitReturn, FK_AdItemID, RowAttribute, FK_AdSpecialGroupName, RowPosition, FK_DateID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
"INSERT INTO Projections (Sold, SalePrice, TotalSales, Cost, ProfitReturn, TotalProfitReturn, FK_AdItemID, RowAttribute, FK_AdSpecialGroupName, RowPosition, FK_DateID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
//SELECT AdItem.AdItem, APC.ProjectionSold, APC.ProjectionSalePrice, APC.ProjectionTotalSales, APC.ProjectionCost, APC.ProjectionProfitReturn, APC.ProjectionTotalProfitReturn, APC.RowAttribute, APC.FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = ? ORDER BY RowPosition ASC
oleDbCommand.Parameters.AddWithValue("Sold", projections.Rows[rowIndex][1]);
oleDbCommand.Parameters.AddWithValue("SalesPrice", projections.Rows[rowIndex][2]);
@@ -158,7 +158,8 @@ namespace AdvertsingProfitControl
oleDbCommand.Parameters.AddWithValue("ProfitReturn", projections.Rows[rowIndex][5]);
oleDbCommand.Parameters.AddWithValue("TotalProfitReturn", projections.Rows[rowIndex][6]);
oleDbCommand.Parameters.AddWithValue("adItemID", adItemId);
oleDbCommand.Parameters.AddWithValue("RowAttribute", int.Parse(projections.Rows[rowIndex][7].ToString()));
oleDbCommand.Parameters.AddWithValue("RowAttribute",
int.Parse(projections.Rows[rowIndex][7].ToString()));
oleDbCommand.Parameters.AddWithValue("adSpecialID", adspecialId);
oleDbCommand.Parameters.AddWithValue("RowPosition", (rowIndex + 1));
oleDbCommand.Parameters.AddWithValue("dateID", dateId);
@@ -173,10 +174,10 @@ namespace AdvertsingProfitControl
oleDbCommand.CommandText =
"INSERT INTO Inventory (BeginningInventory, Received, TotalInventory, EndingInventory, FK_AdItemID, RowAttribute, FK_AdSpecialGroupName, RowPosition, FK_DateID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
//"SELECT AdItem.AdItem, APC.BeginingInventory, APC.Received, APC.TotalInventory, APC.EndingInventory, APC.RowAttribute, APC.FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = ? ORDER BY RowPosition ASC"
oleDbCommand.Parameters.AddWithValue("BegnningInventory", inventory.Rows[i][1]);
oleDbCommand.Parameters.AddWithValue("Received", inventory.Rows[i][2]);
oleDbCommand.Parameters.AddWithValue("TotalInventory", inventory.Rows[i][3]);
oleDbCommand.Parameters.AddWithValue("EndingInventory", inventory.Rows[i][4]);
oleDbCommand.Parameters.AddWithValue("BeginningInventory", inventory.Rows[i][1].ToString());
oleDbCommand.Parameters.AddWithValue("Received", inventory.Rows[i][2].ToString());
oleDbCommand.Parameters.AddWithValue("TotalInventory", inventory.Rows[i][3].ToString());
oleDbCommand.Parameters.AddWithValue("EndingInventory", inventory.Rows[i][4].ToString());
oleDbCommand.Parameters.AddWithValue("AdItemID", adItemId);
oleDbCommand.Parameters.AddWithValue("RowAttribute", int.Parse(inventory.Rows[i][5].ToString()));
oleDbCommand.Parameters.AddWithValue("FK_AdSpecialGroup", adspecialId);
@@ -193,7 +194,7 @@ namespace AdvertsingProfitControl
var adItemId = int.Parse(RetrieveAdItemId(actualSales.Rows[rowIndex][0].ToString()));
adspecialId = GetAdSpecialId(int.Parse(actualSales.Rows[rowIndex][8].ToString()));
oleDbCommand.CommandText =
"INSERT INTO ActualSales (Sold, SalePrice, TotalSales, Cost, ProfitReturn, TotalProfitReturn, FK_AdItemID, RowAttribute, FK_AdSpecialGroupName, RowPosition, FK_DateID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
"INSERT INTO ActualSales (Sold, SalePrice, TotalSales, Cost, ProfitReturn, TotalProfitReturn, FK_AdItemID, RowAttribute, FK_AdSpecialGroupName, RowPosition, FK_DateID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
//SELECT AdItem.AdItem, APC.ProjectionSold, APC.ProjectionSalePrice, APC.ProjectionTotalSales, APC.ProjectionCost, APC.ProjectionProfitReturn, APC.ProjectionTotalProfitReturn, APC.RowAttribute, APC.FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = ? ORDER BY RowPosition ASC
oleDbCommand.Parameters.AddWithValue("Sold", actualSales.Rows[rowIndex][1]);
oleDbCommand.Parameters.AddWithValue("SalesPrice", actualSales.Rows[rowIndex][2]);
@@ -202,7 +203,8 @@ namespace AdvertsingProfitControl
oleDbCommand.Parameters.AddWithValue("ProfitReturn", actualSales.Rows[rowIndex][5]);
oleDbCommand.Parameters.AddWithValue("TotalProfitReturn", actualSales.Rows[rowIndex][6]);
oleDbCommand.Parameters.AddWithValue("adItemID", adItemId);
oleDbCommand.Parameters.AddWithValue("RowAttribute", int.Parse(projections.Rows[rowIndex][7].ToString()));
oleDbCommand.Parameters.AddWithValue("RowAttribute",
int.Parse(projections.Rows[rowIndex][7].ToString()));
oleDbCommand.Parameters.AddWithValue("adSpecialID", adspecialId);
oleDbCommand.Parameters.AddWithValue("RowPosition", (rowIndex + 1));
oleDbCommand.Parameters.AddWithValue("dateID", dateId);
@@ -215,11 +217,13 @@ namespace AdvertsingProfitControl
var supplierId = GetSupplierId(invoice.Rows[i][1].ToString());
//SELECT Invoice.InvoiceDate, Supplier.SupplierName, Invoice.InvoiceNumber, Invoice.InvoiceNetAmountAtCost, Invoice.InvoiceNetAmount, Invoice.InvoiceNote FROM (Supplier INNER JOIN Invoice ON Supplier.ID = Invoice.FK_Supplier) WHERE FK_DateID = ?
oleDbCommand.CommandText =
"INSERT INTO Invoice (InvoiceDate, InvoiceNumber, InvoiceNetAmountAtCost, InvoiceNetAmount, InvoiceNote, FK_Supplier, FK_DateID) VALUES(?,?,?,?,?,?,?)";
"INSERT INTO Invoice (InvoiceDate, InvoiceNumber, InvoiceNetAmountAtCost, InvoiceNetAmount, InvoiceNote, FK_Supplier, FK_DateID) VALUES(?,?,?,?,?,?,?)";
oleDbCommand.Parameters.AddWithValue("InvoiceDate", invoice.Rows[i][0].ToString());
oleDbCommand.Parameters.AddWithValue("InvoiceNumber", invoice.Rows[i][2].ToString());
oleDbCommand.Parameters.AddWithValue("InvoiceNetAmountAtCost", invoice.Rows[i][3].ToString() == "" ? 0 : double.Parse(invoice.Rows[i][3].ToString()));
oleDbCommand.Parameters.AddWithValue("InvoiceNetAmount", invoice.Rows[i][4].ToString() == "" ? 0 : double.Parse(invoice.Rows[i][4].ToString()));
oleDbCommand.Parameters.AddWithValue("InvoiceNetAmountAtCost",
invoice.Rows[i][3].ToString() == "" ? 0 : double.Parse(invoice.Rows[i][3].ToString()));
oleDbCommand.Parameters.AddWithValue("InvoiceNetAmount",
invoice.Rows[i][4].ToString() == "" ? 0 : double.Parse(invoice.Rows[i][4].ToString()));
oleDbCommand.Parameters.AddWithValue("InvoiceNote", invoice.Rows[i][5].ToString());
oleDbCommand.Parameters.AddWithValue("FK_Supplier", supplierId);
oleDbCommand.Parameters.AddWithValue("FK_DateID", dateId);
@@ -227,7 +231,8 @@ namespace AdvertsingProfitControl
oleDbCommand.Parameters.Clear();
}
//"SELECT WeeklySales.Sunday, WeeklySales.Monday, WeeklySales.Tuesday, WeeklySales.Wednesday, WeeklySales.Thursday, WeeklySales.Friday, WeeklySales.Saturday, WeeklySales.TotalSales FROM WeeklySales WHERE FK_DateID = ?"
oleDbCommand.CommandText = "INSERT INTO WeeklySales (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, TotalSales, FK_DateID) VALUES (?,?,?,?,?,?,?,?,?)";
oleDbCommand.CommandText =
"INSERT INTO WeeklySales (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, TotalSales, FK_DateID) VALUES (?,?,?,?,?,?,?,?,?)";
oleDbCommand.Parameters.AddWithValue("Sunday", weeklySales.Rows[0][0]);
oleDbCommand.Parameters.AddWithValue("Monday", weeklySales.Rows[0][1]);
oleDbCommand.Parameters.AddWithValue("Tuesday", weeklySales.Rows[0][2]);
@@ -239,6 +244,11 @@ namespace AdvertsingProfitControl
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
oleDbCommand.ExecuteNonQuery();
oleDbCommand.Parameters.Clear();
oleDbCommand.CommandText = "INSERT INTO Comment (Comment, FK_DateID) VALUES (?, ?)";
oleDbCommand.Parameters.AddWithValue("Com", comments);
oleDbCommand.Parameters.AddWithValue("FK", dateId);
oleDbCommand.ExecuteNonQuery();
oleDbTransaction.Commit();
}
catch (OleDbException e)
@@ -246,6 +256,10 @@ namespace AdvertsingProfitControl
MessageBox.Show(e.Message);
oleDbTransaction?.Rollback();
}
finally
{
oleDbConnection.Close();
}
}
public int GetSupplierId(string supplierName)
@@ -273,7 +287,10 @@ namespace AdvertsingProfitControl
{
MessageBox.Show(e.Message);
}
finally
{
oleDbConnection.Close();
}
return supplierId;
}
@@ -318,15 +335,46 @@ namespace AdvertsingProfitControl
id = int.Parse(reader[0].ToString());
}
reader?.Close();
spam.Close();
}
catch (OleDbException e)
{
MessageBox.Show(e.Message);
throw;
}
finally
{
oleDbConnection.Close();
}
return id;
}
private string GetComments(int dateId)
{
var comments = "";
var oleDbCommand = new OleDbCommand
{
CommandText = "SELECT Comment.Comment FROM Comment WHERE Comment.FK_DateID = ?"
};
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
var connection = new OleDbConnection(_connectionString);
oleDbCommand.Connection = connection;
using (connection)
{
using (oleDbCommand)
{
connection.Open();
var reader = oleDbCommand.ExecuteReader();
while (reader != null && reader.Read())
{
comments = reader[0].ToString();
}
}
}
return comments;
}
public string RetrieveAdItemId(string adItemName)
{
var dbT = new DatabaseTracker();
@@ -359,6 +407,7 @@ namespace AdvertsingProfitControl
}
}
}
connection.Close();
}
return dateId;
@@ -385,6 +434,7 @@ namespace AdvertsingProfitControl
dataAdapter.Fill(dataTable);
}
}
connection.Close();
}
return dataTable;
}
@@ -410,6 +460,7 @@ namespace AdvertsingProfitControl
dataAdapter.Fill(dataTable);
}
}
connection.Close();
}
return dataTable;
}
@@ -435,6 +486,7 @@ namespace AdvertsingProfitControl
dataAdapter.Fill(dataTable);
}
}
connection.Close();
}
return dataTable;
}
@@ -459,6 +511,7 @@ namespace AdvertsingProfitControl
adapter.Fill(dataTable);
}
}
connection.Close();
}
return dataTable;
@@ -484,6 +537,7 @@ namespace AdvertsingProfitControl
dataAdapter.Fill(dataTable);
}
}
connection.Close();
}
return dataTable;
+63 -63
View File
@@ -43,6 +43,8 @@
this.helpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.showHideConsoleHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.dbVersionHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.commentMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.profitAnalysisMainGroupBox = new System.Windows.Forms.GroupBox();
@@ -100,8 +102,6 @@
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label();
this.perfectGrossProfitLabel = new System.Windows.Forms.Label();
this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.mainMenu.SuspendLayout();
this.mainTableLayoutPanel.SuspendLayout();
this.commentMainTableLayoutPanel.SuspendLayout();
@@ -127,7 +127,7 @@
//
// printPreviewButton
//
this.printPreviewButton.Location = new System.Drawing.Point(313, 277);
this.printPreviewButton.Location = new System.Drawing.Point(171, 273);
this.printPreviewButton.Name = "printPreviewButton";
this.printPreviewButton.Size = new System.Drawing.Size(138, 49);
this.printPreviewButton.TabIndex = 4;
@@ -248,11 +248,27 @@
this.dbVersionHelpMainMenu.Text = "Get &Database Version";
this.dbVersionHelpMainMenu.Click += new System.EventHandler(this.dbVersionHelpMainMenu_Click);
//
// debugToolStripMenuItem
//
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.debugToolStripMenuItem1});
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
this.debugToolStripMenuItem.Size = new System.Drawing.Size(87, 34);
this.debugToolStripMenuItem.Text = "Debug";
this.debugToolStripMenuItem.Visible = false;
//
// debugToolStripMenuItem1
//
this.debugToolStripMenuItem1.Name = "debugToolStripMenuItem1";
this.debugToolStripMenuItem1.Size = new System.Drawing.Size(240, 34);
this.debugToolStripMenuItem1.Text = "Debug";
this.debugToolStripMenuItem1.Click += new System.EventHandler(this.debugToolStripMenuItem1_Click);
//
// mainTableLayoutPanel
//
this.mainTableLayoutPanel.ColumnCount = 2;
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75F));
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.mainTableLayoutPanel.Controls.Add(this.commentMainTableLayoutPanel, 0, 2);
this.mainTableLayoutPanel.Controls.Add(this.mainMenu, 0, 0);
this.mainTableLayoutPanel.Controls.Add(this.mainViewTabControl, 0, 1);
@@ -272,10 +288,10 @@
// commentMainTableLayoutPanel
//
this.commentMainTableLayoutPanel.ColumnCount = 4;
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 355F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.5F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.5F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 365F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40F));
this.commentMainTableLayoutPanel.Controls.Add(this.profitAnalysisMainGroupBox, 3, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.weeklySalesGroupBox, 1, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.taxableGroupBox, 2, 0);
@@ -286,7 +302,7 @@
this.commentMainTableLayoutPanel.Name = "commentMainTableLayoutPanel";
this.commentMainTableLayoutPanel.RowCount = 1;
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1375, 329);
this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1467, 329);
this.commentMainTableLayoutPanel.TabIndex = 5;
//
// profitAnalysisMainGroupBox
@@ -300,9 +316,9 @@
this.profitAnalysisMainGroupBox.Controls.Add(this.remainingSalesLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitFromAdItemsLabel);
this.profitAnalysisMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(918, 3);
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(1028, 3);
this.profitAnalysisMainGroupBox.Name = "profitAnalysisMainGroupBox";
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(454, 323);
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(436, 323);
this.profitAnalysisMainGroupBox.TabIndex = 2;
this.profitAnalysisMainGroupBox.TabStop = false;
this.profitAnalysisMainGroupBox.Text = "Profit Analysis";
@@ -332,7 +348,7 @@
// departmentSalesLabel
//
this.departmentSalesLabel.AutoSize = true;
this.departmentSalesLabel.Location = new System.Drawing.Point(11, 61);
this.departmentSalesLabel.Location = new System.Drawing.Point(11, 64);
this.departmentSalesLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.departmentSalesLabel.Name = "departmentSalesLabel";
this.departmentSalesLabel.Size = new System.Drawing.Size(179, 25);
@@ -342,7 +358,7 @@
// totalProfitReturnLabel
//
this.totalProfitReturnLabel.AutoSize = true;
this.totalProfitReturnLabel.Location = new System.Drawing.Point(11, 221);
this.totalProfitReturnLabel.Location = new System.Drawing.Point(11, 279);
this.totalProfitReturnLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.totalProfitReturnLabel.Name = "totalProfitReturnLabel";
this.totalProfitReturnLabel.Size = new System.Drawing.Size(178, 25);
@@ -352,7 +368,7 @@
// salesProducedLabel
//
this.salesProducedLabel.AutoSize = true;
this.salesProducedLabel.Location = new System.Drawing.Point(11, 93);
this.salesProducedLabel.Location = new System.Drawing.Point(11, 97);
this.salesProducedLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.salesProducedLabel.Name = "salesProducedLabel";
this.salesProducedLabel.Size = new System.Drawing.Size(300, 25);
@@ -362,17 +378,17 @@
// totalProfitReturnFromRemaingLabel
//
this.totalProfitReturnFromRemaingLabel.AutoSize = true;
this.totalProfitReturnFromRemaingLabel.Location = new System.Drawing.Point(11, 189);
this.totalProfitReturnFromRemaingLabel.Location = new System.Drawing.Point(11, 221);
this.totalProfitReturnFromRemaingLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.totalProfitReturnFromRemaingLabel.Name = "totalProfitReturnFromRemaingLabel";
this.totalProfitReturnFromRemaingLabel.Size = new System.Drawing.Size(380, 25);
this.totalProfitReturnFromRemaingLabel.Size = new System.Drawing.Size(220, 50);
this.totalProfitReturnFromRemaingLabel.TabIndex = 4;
this.totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: ";
this.totalProfitReturnFromRemaingLabel.Text = "Total Profit Return \r\nFrom Remaining Sales: ";
//
// remainingSalesLabel
//
this.remainingSalesLabel.AutoSize = true;
this.remainingSalesLabel.Location = new System.Drawing.Point(11, 125);
this.remainingSalesLabel.Location = new System.Drawing.Point(11, 130);
this.remainingSalesLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.remainingSalesLabel.Name = "remainingSalesLabel";
this.remainingSalesLabel.Size = new System.Drawing.Size(170, 25);
@@ -382,12 +398,12 @@
// totalProfitFromAdItemsLabel
//
this.totalProfitFromAdItemsLabel.AutoSize = true;
this.totalProfitFromAdItemsLabel.Location = new System.Drawing.Point(11, 157);
this.totalProfitFromAdItemsLabel.Location = new System.Drawing.Point(11, 163);
this.totalProfitFromAdItemsLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0);
this.totalProfitFromAdItemsLabel.Name = "totalProfitFromAdItemsLabel";
this.totalProfitFromAdItemsLabel.Size = new System.Drawing.Size(342, 25);
this.totalProfitFromAdItemsLabel.Size = new System.Drawing.Size(182, 50);
this.totalProfitFromAdItemsLabel.TabIndex = 3;
this.totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): ";
this.totalProfitFromAdItemsLabel.Text = "Total Profit Return \r\nFrom Ad Items (B): ";
//
// weeklySalesGroupBox
//
@@ -400,9 +416,9 @@
this.weeklySalesGroupBox.Controls.Add(this.wednesdayWeeklySalesLabel);
this.weeklySalesGroupBox.Controls.Add(this.sundayWeeklySalesLabel);
this.weeklySalesGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklySalesGroupBox.Location = new System.Drawing.Point(358, 3);
this.weeklySalesGroupBox.Location = new System.Drawing.Point(368, 3);
this.weeklySalesGroupBox.Name = "weeklySalesGroupBox";
this.weeklySalesGroupBox.Size = new System.Drawing.Size(274, 323);
this.weeklySalesGroupBox.Size = new System.Drawing.Size(324, 323);
this.weeklySalesGroupBox.TabIndex = 3;
this.weeklySalesGroupBox.TabStop = false;
this.weeklySalesGroupBox.Text = "Weekly Sales";
@@ -490,9 +506,9 @@
this.taxableGroupBox.Controls.Add(this.wednesdayTaxableLabel);
this.taxableGroupBox.Controls.Add(this.sundayTaxableLabel);
this.taxableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.taxableGroupBox.Location = new System.Drawing.Point(638, 3);
this.taxableGroupBox.Location = new System.Drawing.Point(698, 3);
this.taxableGroupBox.Name = "taxableGroupBox";
this.taxableGroupBox.Size = new System.Drawing.Size(274, 323);
this.taxableGroupBox.Size = new System.Drawing.Size(324, 323);
this.taxableGroupBox.TabIndex = 4;
this.taxableGroupBox.TabStop = false;
this.taxableGroupBox.Text = "Taxable";
@@ -575,7 +591,7 @@
this.dateTimeGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.dateTimeGroupBox.Location = new System.Drawing.Point(3, 3);
this.dateTimeGroupBox.Name = "dateTimeGroupBox";
this.dateTimeGroupBox.Size = new System.Drawing.Size(349, 323);
this.dateTimeGroupBox.Size = new System.Drawing.Size(359, 323);
this.dateTimeGroupBox.TabIndex = 5;
this.dateTimeGroupBox.TabStop = false;
//
@@ -598,7 +614,7 @@
this.mainViewTabControl.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.mainViewTabControl.Name = "mainViewTabControl";
this.mainViewTabControl.SelectedIndex = 0;
this.mainViewTabControl.Size = new System.Drawing.Size(1375, 499);
this.mainViewTabControl.Size = new System.Drawing.Size(1467, 499);
this.mainViewTabControl.TabIndex = 3;
//
// projectionTab
@@ -608,7 +624,7 @@
this.projectionTab.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.projectionTab.Name = "projectionTab";
this.projectionTab.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.projectionTab.Size = new System.Drawing.Size(1367, 462);
this.projectionTab.Size = new System.Drawing.Size(1459, 462);
this.projectionTab.TabIndex = 0;
this.projectionTab.Text = "Projections";
this.projectionTab.UseVisualStyleBackColor = true;
@@ -630,7 +646,7 @@
this.projectionsDataGridView.RowHeadersVisible = false;
this.projectionsDataGridView.ShowCellErrors = false;
this.projectionsDataGridView.ShowRowErrors = false;
this.projectionsDataGridView.Size = new System.Drawing.Size(1357, 450);
this.projectionsDataGridView.Size = new System.Drawing.Size(1449, 450);
this.projectionsDataGridView.TabIndex = 0;
//
// inventoryTabPage
@@ -639,7 +655,7 @@
this.inventoryTabPage.Location = new System.Drawing.Point(4, 33);
this.inventoryTabPage.Name = "inventoryTabPage";
this.inventoryTabPage.Padding = new System.Windows.Forms.Padding(3);
this.inventoryTabPage.Size = new System.Drawing.Size(1367, 462);
this.inventoryTabPage.Size = new System.Drawing.Size(1521, 462);
this.inventoryTabPage.TabIndex = 4;
this.inventoryTabPage.Text = "Inventory";
this.inventoryTabPage.UseVisualStyleBackColor = true;
@@ -658,7 +674,7 @@
this.inventoryDataGridView.RowHeadersVisible = false;
this.inventoryDataGridView.RowTemplate.Height = 28;
this.inventoryDataGridView.ShowRowErrors = false;
this.inventoryDataGridView.Size = new System.Drawing.Size(1361, 456);
this.inventoryDataGridView.Size = new System.Drawing.Size(1515, 456);
this.inventoryDataGridView.TabIndex = 0;
//
// actualSalesTab
@@ -667,7 +683,7 @@
this.actualSalesTab.Location = new System.Drawing.Point(4, 33);
this.actualSalesTab.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.actualSalesTab.Name = "actualSalesTab";
this.actualSalesTab.Size = new System.Drawing.Size(1367, 462);
this.actualSalesTab.Size = new System.Drawing.Size(1521, 462);
this.actualSalesTab.TabIndex = 2;
this.actualSalesTab.Text = "Actual Sales";
this.actualSalesTab.UseVisualStyleBackColor = true;
@@ -684,7 +700,7 @@
this.actualSalesMainLayoutPanel.RowCount = 1;
this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 462F));
this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1367, 462);
this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1521, 462);
this.actualSalesMainLayoutPanel.TabIndex = 0;
//
// actualSalesDataGridView
@@ -704,7 +720,7 @@
this.actualSalesDataGridView.RowHeadersVisible = false;
this.actualSalesDataGridView.ShowCellErrors = false;
this.actualSalesDataGridView.ShowRowErrors = false;
this.actualSalesDataGridView.Size = new System.Drawing.Size(1357, 450);
this.actualSalesDataGridView.Size = new System.Drawing.Size(1511, 450);
this.actualSalesDataGridView.TabIndex = 1;
//
// suppliersTabPage
@@ -714,7 +730,7 @@
this.suppliersTabPage.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.suppliersTabPage.Name = "suppliersTabPage";
this.suppliersTabPage.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.suppliersTabPage.Size = new System.Drawing.Size(1367, 462);
this.suppliersTabPage.Size = new System.Drawing.Size(1521, 462);
this.suppliersTabPage.TabIndex = 1;
this.suppliersTabPage.Text = "Invoices";
this.suppliersTabPage.UseVisualStyleBackColor = true;
@@ -734,7 +750,7 @@
this.invoicesDataGridView.Name = "invoicesDataGridView";
this.invoicesDataGridView.ReadOnly = true;
this.invoicesDataGridView.RowHeadersVisible = false;
this.invoicesDataGridView.Size = new System.Drawing.Size(1357, 450);
this.invoicesDataGridView.Size = new System.Drawing.Size(1511, 450);
this.invoicesDataGridView.TabIndex = 0;
//
// commentsAndAnalysisLayoutPanel
@@ -745,12 +761,12 @@
this.commentsAndAnalysisLayoutPanel.Controls.Add(this.costAnalysisGroupBox, 0, 1);
this.commentsAndAnalysisLayoutPanel.Controls.Add(this.commentMainGroupBox, 0, 0);
this.commentsAndAnalysisLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentsAndAnalysisLayoutPanel.Location = new System.Drawing.Point(1388, 43);
this.commentsAndAnalysisLayoutPanel.Location = new System.Drawing.Point(1480, 43);
this.commentsAndAnalysisLayoutPanel.Name = "commentsAndAnalysisLayoutPanel";
this.commentsAndAnalysisLayoutPanel.RowCount = 2;
this.commentsAndAnalysisLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.commentsAndAnalysisLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.commentsAndAnalysisLayoutPanel.Size = new System.Drawing.Size(456, 505);
this.commentsAndAnalysisLayoutPanel.Size = new System.Drawing.Size(364, 505);
this.commentsAndAnalysisLayoutPanel.TabIndex = 6;
//
// costAnalysisGroupBox
@@ -763,7 +779,7 @@
this.costAnalysisGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.costAnalysisGroupBox.Location = new System.Drawing.Point(3, 255);
this.costAnalysisGroupBox.Name = "costAnalysisGroupBox";
this.costAnalysisGroupBox.Size = new System.Drawing.Size(450, 247);
this.costAnalysisGroupBox.Size = new System.Drawing.Size(358, 247);
this.costAnalysisGroupBox.TabIndex = 4;
this.costAnalysisGroupBox.TabStop = false;
this.costAnalysisGroupBox.Text = "Cost Analysis";
@@ -822,7 +838,7 @@
this.commentMainGroupBox.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.commentMainGroupBox.Name = "commentMainGroupBox";
this.commentMainGroupBox.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6);
this.commentMainGroupBox.Size = new System.Drawing.Size(446, 240);
this.commentMainGroupBox.Size = new System.Drawing.Size(354, 240);
this.commentMainGroupBox.TabIndex = 1;
this.commentMainGroupBox.TabStop = false;
this.commentMainGroupBox.Text = "Comments";
@@ -836,7 +852,7 @@
this.commentsTextBox.Name = "commentsTextBox";
this.commentsTextBox.ReadOnly = true;
this.commentsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.commentsTextBox.Size = new System.Drawing.Size(436, 206);
this.commentsTextBox.Size = new System.Drawing.Size(344, 206);
this.commentsTextBox.TabIndex = 0;
//
// grossProfitGroupBox
@@ -849,9 +865,9 @@
this.grossProfitGroupBox.Controls.Add(this.perfectGrossProfitLabel);
this.grossProfitGroupBox.Controls.Add(this.grossProfitDollarGrossProfitLabel);
this.grossProfitGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.grossProfitGroupBox.Location = new System.Drawing.Point(1388, 554);
this.grossProfitGroupBox.Location = new System.Drawing.Point(1480, 554);
this.grossProfitGroupBox.Name = "grossProfitGroupBox";
this.grossProfitGroupBox.Size = new System.Drawing.Size(456, 335);
this.grossProfitGroupBox.Size = new System.Drawing.Size(364, 335);
this.grossProfitGroupBox.TabIndex = 7;
this.grossProfitGroupBox.TabStop = false;
this.grossProfitGroupBox.Text = "Gross Profit";
@@ -859,13 +875,12 @@
// usePreRenderedFilesCheckbox
//
this.usePreRenderedFilesCheckbox.AutoSize = true;
this.usePreRenderedFilesCheckbox.Location = new System.Drawing.Point(40, 288);
this.usePreRenderedFilesCheckbox.Location = new System.Drawing.Point(16, 288);
this.usePreRenderedFilesCheckbox.Name = "usePreRenderedFilesCheckbox";
this.usePreRenderedFilesCheckbox.Size = new System.Drawing.Size(239, 29);
this.usePreRenderedFilesCheckbox.TabIndex = 5;
this.usePreRenderedFilesCheckbox.Text = "Use Pre-rendered Files";
this.usePreRenderedFilesCheckbox.UseVisualStyleBackColor = true;
this.usePreRenderedFilesCheckbox.Visible = false;
//
// grossProfitLessCostOfSales
//
@@ -890,9 +905,9 @@
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.AutoSize = true;
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Location = new System.Drawing.Point(6, 163);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Name = "grossProfitEstimatedWeeklyDeptmartmentExpenseLabel";
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Size = new System.Drawing.Size(368, 25);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Size = new System.Drawing.Size(206, 50);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.TabIndex = 4;
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = "Estimated Weekly Department Expense: ";
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = "Estimated Weekly \r\nDepartment Expense: ";
//
// perfectGrossProfitLabel
//
@@ -912,21 +927,6 @@
this.grossProfitDollarGrossProfitLabel.TabIndex = 2;
this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: ";
//
// debugToolStripMenuItem
//
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.debugToolStripMenuItem1});
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
this.debugToolStripMenuItem.Size = new System.Drawing.Size(87, 34);
this.debugToolStripMenuItem.Text = "Debug";
//
// debugToolStripMenuItem1
//
this.debugToolStripMenuItem1.Name = "debugToolStripMenuItem1";
this.debugToolStripMenuItem1.Size = new System.Drawing.Size(240, 34);
this.debugToolStripMenuItem1.Text = "Debug";
this.debugToolStripMenuItem1.Click += new System.EventHandler(this.debugToolStripMenuItem1_Click);
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
+41 -36
View File
@@ -16,7 +16,7 @@ namespace AdvertsingProfitControl
private double _totalInvoicePurchases; //Total Purchases
private double _departmentSales; //weekly sales total
private DateTime _currentActiveDate;
readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
private readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
private int _LazyPageCounter;
public FrmMain()
@@ -33,7 +33,6 @@ namespace AdvertsingProfitControl
ConstructInvoicesDataGridView();
RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString);
monthCalendar.SelectionStart = date;
_currentActiveDate = date;
LoadDate(date);
monthCalendar.DateChanged += ValidateDateChanged;
@@ -47,7 +46,7 @@ namespace AdvertsingProfitControl
if (actualSalesDataGridView.Rows.Count == 0)
{
salesProducedLabel.Text = @"Sales Produced By Ad Items (A): No Data";
totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): No Data";
totalProfitFromAdItemsLabel.Text = @"Total Profit Return " + Environment.NewLine + @" From Ad Items (B): No Data";
if (Math.Abs(_departmentSales) < 1)
{
departmentSalesLabel.Text = @"Department Sales: No Data";
@@ -76,7 +75,7 @@ namespace AdvertsingProfitControl
}
if (Math.Abs(_totalProfitReturnFromAdItems) < 1)
{
totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): No Data";
totalProfitFromAdItemsLabel.Text = @"Total Profit Return " + Environment.NewLine + @"From Ad Items (B): No Data";
incompleteData = true;
}
if (Math.Abs(_departmentSales) < 1)
@@ -94,11 +93,11 @@ namespace AdvertsingProfitControl
var remainingSales = _departmentSales - _salesProducedByAdItems;
remainingSalesLabel.Text = @"Remaining Sales: " + remainingSales.ToString("C");
//Again assume the total profit return is larger then zero (0).
totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): " + _totalProfitReturnFromAdItems.ToString("C");
totalProfitFromAdItemsLabel.Text = @"Total Profit Return" + Environment.NewLine + @" From Ad Items (B): " + _totalProfitReturnFromAdItems.ToString("C");
//Shrink is being used as a place holder for Cross Profit % which is obtained by dividing the total profit return from the department weekly retail sales.
var totalProfitReturnFromRemainingSales = shrink*remainingSales;
//
totalProfitReturnFromRemaingLabel.Text = @"Total Profit Return From Remaining Sales: " + totalProfitReturnFromRemainingSales.ToString("C");
totalProfitReturnFromRemaingLabel.Text = @"Total Profit Return" + Environment.NewLine + @" From Remaining Sales: " + totalProfitReturnFromRemainingSales.ToString("C");
var totalProfitReturn = _totalProfitReturnFromAdItems + totalProfitReturnFromRemainingSales;
totalProfitReturnLabel.Text = @"Total Profit Return: " + totalProfitReturn.ToString("C");
}
@@ -125,8 +124,15 @@ namespace AdvertsingProfitControl
private void addRecordToolStripMenuItem_Click(object sender, EventArgs e)
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var form = new NewAddRecord();
form.ShowDialog();
//One the user has closed the add record form, check to see if there is a newer date
//available. If so, reload the form.
var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString);
if (date == _currentActiveDate) return;
LoadDate(date);
}
private void showHideConsoleHelpMainMenu_Click(object sender, EventArgs e)
@@ -153,6 +159,8 @@ namespace AdvertsingProfitControl
{
var form = new NewModifyRecord(monthCalendar.SelectionStart);
form.ShowDialog();
//On return reload the date that was just modified by the modify record form.
LoadDate(monthCalendar.SelectionStart);
}
private void manageItemsToolsMainMenu_Click(object sender, EventArgs e)
@@ -253,20 +261,6 @@ namespace AdvertsingProfitControl
printDialog.Document = new PrintDocument();
}
private void newFormTestToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = new NewAddRecord();
form.ShowDialog();
}
private void newModifyRecordToolStripMenuItem_Click(object sender, EventArgs e)
{
var date = monthCalendar.SelectionStart;
var form = new NewModifyRecord(date);
form.ShowDialog();
}
public enum FormRoll
{
AddRecords = 0,
@@ -339,7 +333,7 @@ namespace AdvertsingProfitControl
string[] invoicesColumnNames =
{
"InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost",
"InvoiceNetAmount", "InvoiceNote"
"InvoiceNetAmountExtendedRetail", "InvoiceNote"
};
foreach (var name in invoicesColumnNames)
@@ -428,6 +422,8 @@ namespace AdvertsingProfitControl
}
CalculateProfitAnalysis();
CalculateGrossProfit();
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
monthCalendar.SelectionStart = date;
dateTimeGroupBox.Text = @"Loaded " + date.ToString("d");
}
@@ -440,7 +436,7 @@ namespace AdvertsingProfitControl
for (var rowIndex = 0; rowIndex < projections.Rows.Count; rowIndex++)
{
var newRow = new DataGridViewRow();
for (var cellIndex = 0; cellIndex < projections.Rows[rowIndex].ItemArray.Length; cellIndex++)
for (var cellIndex = 1; cellIndex < projections.Rows[rowIndex].ItemArray.Length; cellIndex++)
{
//ID and Ad Item.
if (cellIndex == 1)
@@ -671,7 +667,7 @@ namespace AdvertsingProfitControl
for (var rowIndex = 0; rowIndex < actualSales.Rows.Count; rowIndex++)
{
var newRow = new DataGridViewRow();
for (var cellIndex = 0; cellIndex < actualSales.Rows[rowIndex].ItemArray.Length; cellIndex++)
for (var cellIndex = 1; cellIndex < actualSales.Rows[rowIndex].ItemArray.Length; cellIndex++)
{
//ID and Ad Item.
if (cellIndex == 1)
@@ -849,8 +845,7 @@ namespace AdvertsingProfitControl
var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
if (netAmountAtCost.ToString("N2") != "0.00")
{
_totalInvoicePurchases += netAmountAtCost;
cell.Value = netAmountAtCost;
cell.Value = netAmountAtCost.ToString("N2");
}
row.Cells.Add(cell);
break;
@@ -858,6 +853,7 @@ namespace AdvertsingProfitControl
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);
@@ -897,7 +893,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
sundayWeeklySalesLabel.Text = @"Sunday: $" + dollarAmount;
sundayWeeklySalesLabel.Text = @"Sunday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -909,7 +905,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
mondayWeeklySalesLabel.Text = @"Monday: $" + dollarAmount;
mondayWeeklySalesLabel.Text = @"Monday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -921,7 +917,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
tuesadayWeeklySalesLabel.Text = @"Tuesday: $" + dollarAmount;
tuesadayWeeklySalesLabel.Text = @"Tuesday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -933,7 +929,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
wednesdayWeeklySalesLabel.Text = @"Wednesday: $" + dollarAmount;
wednesdayWeeklySalesLabel.Text = @"Wednesday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -945,7 +941,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
thursdayWeeklySalesLabel.Text = @"Thursday: $" + dollarAmount;
thursdayWeeklySalesLabel.Text = @"Thursday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -957,7 +953,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
fridayWeeklySalesLabel.Text = @"Friday: $" + dollarAmount;
fridayWeeklySalesLabel.Text = @"Friday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -969,7 +965,7 @@ namespace AdvertsingProfitControl
if (dollarAmount.ToString("N2") != "0.00")
{
_departmentSales += dollarAmount;
saturdayWeeklySalesLabel.Text = @"Saturday: $" + dollarAmount;
saturdayWeeklySalesLabel.Text = @"Saturday: $" + dollarAmount.ToString("N2");
}
else
{
@@ -980,7 +976,7 @@ namespace AdvertsingProfitControl
dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
if (dollarAmount.ToString("N2") != "0.00")
{
totalWeeklySalesLabel.Text = @"Total Sales: $" + dollarAmount;
totalWeeklySalesLabel.Text = @"Total Sales: $" + dollarAmount.ToString("N2");
}
else
{
@@ -1166,6 +1162,7 @@ namespace AdvertsingProfitControl
{
case Holidays.Thanksgiving:
case Holidays.Christmas:
case Holidays.NewYearsDay:
holidayText = @"Closed for " + TextFormat.AddSpacesToSentence(holiday.ToString(), false);
break;
}
@@ -1215,20 +1212,28 @@ namespace AdvertsingProfitControl
departmentSalesLabel.Text = @"Department Sales: ";
salesProducedLabel.Text = @"Sales Produced By Ad Items (A):";
remainingSalesLabel.Text = @"Remaining Sales:";
totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): ";
totalProfitReturnFromRemaingLabel.Text = @"Total Profit Return From Remaining Sales: ";
totalProfitFromAdItemsLabel.Text = @"Total Profit Return" + Environment.NewLine + @" From Ad Items (B): ";
totalProfitReturnFromRemaingLabel.Text = @"Total Profit Return" + Environment.NewLine + @" From Remaining Sales: ";
totalProfitReturnLabel.Text = @"Total Profit Return: ";
grossProfitTotalSales.Text = @"Total Sales:";
grossProfitLessCostOfSales.Text = @"Less Cost of Sales: ";
grossProfitDollarGrossProfitLabel.Text = @"Dollar Gross Profit: ";
perfectGrossProfitLabel.Text = @"Percent Gross Profit: ";
grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = @"Estimated Weekly Department Expense: ";
grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = @"Estimated Weekly" + Environment.NewLine + @" Department Expense: ";
}
private void debugToolStripMenuItem1_Click(object sender, EventArgs e)
{
var form = new DebugDatabaseConverter();
form.ShowDialog();
RefreshDateListing();
}
private void RefreshDateListing()
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
}
}
}
+9 -5
View File
@@ -32,6 +32,7 @@ namespace AdvertsingProfitControl
//Flag showing whether or not the AdSpecialRow has been made in this session.
private int _adSpecialIndex = -1;
private readonly AdvertisingProfitControlTableHelper _tableHelperFunctions = new AdvertisingProfitControlTableHelper();
private TabPage _debugTabPage;
public NewAddRecord()
{
@@ -145,6 +146,9 @@ namespace AdvertsingProfitControl
salaryDollarsTextBox.Validating += ValidateCostAnalysisValues;
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
suppliesTextBox.Validating += ValidateCostAnalysisValues;
//
_debugTabPage = mainTabControl.TabPages[4];
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
}
#region Invoice Table Events
@@ -1741,7 +1745,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -1777,7 +1781,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -1813,7 +1817,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -1845,7 +1849,7 @@ namespace AdvertsingProfitControl
/// </summary>
private void ConstructInvoicesDataGridView()
{
string[] invoicesColumnNames = { "ID", "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNetAmount", "InvoiceNote", "IsDirty"};
string[] invoicesColumnNames = { "ID", "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNetAmountExtendedRetail", "InvoiceNote", "IsDirty"};
foreach (var name in invoicesColumnNames)
{
@@ -1857,7 +1861,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
+9 -5
View File
@@ -37,6 +37,7 @@ namespace AdvertsingProfitControl
private DateTime _currentActiveDate;
//
private bool _isFormDirty;
private TabPage _debugTabPage;
public NewModifyRecord(DateTime date)
{
@@ -155,6 +156,9 @@ namespace AdvertsingProfitControl
salaryDollarsTextBox.Validating += ValidateCostAnalysisValues;
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
suppliesTextBox.Validating += ValidateCostAnalysisValues;
//
_debugTabPage = mainTabControl.TabPages[4];
mainTabControl.TabPages.Remove(mainTabControl.TabPages[4]);
LoadDate(date);
}
@@ -1772,7 +1776,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -1808,7 +1812,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -1844,7 +1848,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -1876,7 +1880,7 @@ namespace AdvertsingProfitControl
/// </summary>
private void ConstructInvoicesDataGridView()
{
string[] invoicesColumnNames = { "ID", "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNetAmount", "InvoiceNote", "IsDirty" };
string[] invoicesColumnNames = { "ID", "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", "InvoiceNetAmountExtendedRetail", "InvoiceNote", "IsDirty" };
foreach (var name in invoicesColumnNames)
{
@@ -1888,7 +1892,7 @@ namespace AdvertsingProfitControl
HeaderText = TextFormat.AddSpacesToSentence(name, false),
ValueType = typeof(string),
SortMode = DataGridViewColumnSortMode.NotSortable,
MaxInputLength = 20
MaxInputLength = 32
};
if (name.Contains("ID"))
{
@@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>ZmIrPQhvIF7GlBAJN0yBg3h1MuQtzkOJb1/UsrzEMy4=</dsig:DigestValue>
<dsig:DigestValue>nyOAXUjfnUbIVrYC0oB0cu8gLrSavJvwTjvTea8xOas=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
@@ -43,14 +43,14 @@
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3640832">
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3641856">
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>SWhDdqr4Cdz7+qIONWqHGBLDH1kQ6iFOt1ruAj6rHJo=</dsig:DigestValue>
<dsig:DigestValue>ls/iyC2eDGY0BQ9Li7lpS1H7GbQd5K5JGHSlWNDaCgA=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
@@ -87,13 +87,13 @@
<dsig:DigestValue>e48EkTyChGHXYJETENSLw7RKQ1LZ5ZDUghEtiv5DmqY=</dsig:DigestValue>
</hash>
</file>
<file name="APCDatabase.accdb" size="851968">
<file name="APCDatabase.accdb" size="864256">
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>nhqBAxGBZPH2N33Fm5tbmCgDtejNQUBm/H3EHe0p9bg=</dsig:DigestValue>
<dsig:DigestValue>eoYVACg6mHeh3mJvCxuTkhCu87etUvZtA+DNmRHH5Vo=</dsig:DigestValue>
</hash>
</file>
<file name="APCTemplate.accdb" size="819200">