Marked as 'AdvertsingProfitControl' but located in a 'projects' folder. Added a new 'Add Record' form with a completely neww interface. This is the start of the final look of the the form that'd allow the user to add, update and remove records.

This commit is contained in:
2021-01-28 20:00:16 -06:00
parent 75061c9d51
commit 21eaae4d67
21 changed files with 1613 additions and 9813 deletions
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -10,8 +9,5 @@ namespace AdvertsingProfitControl
internal class ApcDatabaseWriter
{
private readonly FrmLogConsole _logConsole = FrmLogConsole.GetStaticInstance;
private OleDbConnection oleDbConnection;
}
}
@@ -38,7 +38,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -81,20 +81,34 @@
<ApplicationIcon>Stretched Logo Collection.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="HtmlRenderer, Version=1.5.0.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.Core.1.5.0.5\lib\net45\HtmlRenderer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlRenderer.WinForms, Version=1.5.0.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.WinForms.1.5.0.6\lib\net45\HtmlRenderer.WinForms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="APCDatabaseWriter.cs" />
<Compile Include="BackPageGenerator.cs" />
<Compile Include="DatabaseReader.cs" />
<Compile Include="DatabaseTracker.cs" />
<Compile Include="DatabaseVersionControl.cs" />
<Compile Include="DatabaseWriter.cs" />
<Compile Include="ExecuteCommand.cs" />
<Compile Include="FrmAddRecord.cs">
<SubType>Form</SubType>
</Compile>
@@ -119,12 +133,19 @@
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="FrmManageAdItems.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmManageAdItems.Designer.cs">
<DependentUpon>FrmManageAdItems.cs</DependentUpon>
</Compile>
<Compile Include="FrmModifyRecord.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmModifyRecord.Designer.cs">
<DependentUpon>FrmModifyRecord.cs</DependentUpon>
</Compile>
<Compile Include="FrontPageGenerator.cs" />
<Compile Include="GlobalClasses.cs" />
<Compile Include="FrmLogConsole.cs">
<SubType>Form</SubType>
@@ -132,8 +153,13 @@
<Compile Include="FrmLogConsole.Designer.cs">
<DependentUpon>FrmLogConsole.cs</DependentUpon>
</Compile>
<Compile Include="NewAddRecord.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="NewAddRecord.Designer.cs">
<DependentUpon>NewAddRecord.cs</DependentUpon>
</Compile>
<Compile Include="RowParsing.cs" />
<Compile Include="HMergedCell.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmAddRecord.resx">
@@ -151,9 +177,15 @@
<EmbeddedResource Include="FrmLogConsole.resx">
<DependentUpon>FrmLogConsole.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmManageAdItems.resx">
<DependentUpon>FrmManageAdItems.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmModifyRecord.resx">
<DependentUpon>FrmModifyRecord.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NewAddRecord.resx">
<DependentUpon>NewAddRecord.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -166,6 +198,7 @@
</Compile>
<None Include="AdvertsingProfitControl_TemporaryKey.pfx" />
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<PublishUrlHistory>C:\Users\glmcc\Desktop\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
+6 -7
View File
@@ -50,7 +50,7 @@ namespace AdvertsingProfitControl
writer.RenderBeginTag(HtmlTextWriterTag.Head);
writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
writer.RenderBeginTag(HtmlTextWriterTag.Style);
writer.Write("td{margins:0px; padding:0; border:1px solid black; text-align:left} table{table-layout:fixed;} td{ width: 1px; white-space:nowrap; }");
writer.Write("td{margins:0px; padding:0; border:1px solid black; text-align:left}");
writer.RenderEndTag();//style
writer.RenderEndTag();//Head
writer.RenderBeginTag(HtmlTextWriterTag.Body);
@@ -63,16 +63,15 @@ namespace AdvertsingProfitControl
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("<center>Weekly Inventory Control</center>");
writer.RenderEndTag();//td
//New row for Name & Location
writer.RenderEndTag();//tr (header row)
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "5");
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; text-align:left"); //; width:560px
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; text-align:left; width:560px");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Name & Location");
writer.RenderEndTag();//td
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "3");
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none"); //; width:240px
writer.AddAttribute(HtmlTextWriterAttribute.Style, "border:none; width:240px");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Week Ending <u>" + CleanDate(databaseReader.RetrieveDateStringById(dateId, databaseTracker.DatabaseConnectionString)) + "</u>");
writer.RenderEndTag();//td
@@ -95,12 +94,12 @@ namespace AdvertsingProfitControl
//Begin rendering the description row and the Sunday row in the sales table.
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
//Date td
writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:center"); //; width:100px
writer.AddAttribute(HtmlTextWriterAttribute.Style, "text-align:center; width:100px"); //; width:100px
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Date");
writer.RenderEndTag();//td
//Supplier and invoices td
writer.AddAttribute(HtmlTextWriterAttribute.Style, "font-size:10px; text-align:center"); //width:250px;
writer.AddAttribute(HtmlTextWriterAttribute.Style, "font-size:10px; text-align:center; width:250px"); //width:250px;
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Suppliers and Invoice Number");
writer.RenderEndTag();//td
@@ -110,7 +109,7 @@ namespace AdvertsingProfitControl
writer.Write("Net Amount of Invoices At Cost");
writer.RenderEndTag();//td
//Net amount extended retail
writer.AddAttribute(HtmlTextWriterAttribute.Style, "font-size:10px; text-align:center"); //width:50px
writer.AddAttribute(HtmlTextWriterAttribute.Style, "font-size:10px; text-align:center; width:25px"); //width:50px
writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
writer.RenderBeginTag(HtmlTextWriterTag.Td);
writer.Write("Net Amount of <br>Invoices<br> Extended Retail");
+93 -4
View File
@@ -8,6 +8,34 @@ namespace AdvertsingProfitControl
{
internal class DatabaseReader
{
public string GetDatabaseVersion(string connectionString)
{
var versionNumber = "0.0.0.0";
var oleDbCommand = new OleDbCommand()
{
CommandText = "SELECT VersionNumber FROM Version"
};
var connection = new OleDbConnection(connectionString);
oleDbCommand.Connection = connection;
using (connection)
{
using (oleDbCommand)
{
connection.Open();
using (var reader = oleDbCommand.ExecuteReader())
{
while (reader != null && reader.Read())
{
versionNumber = reader[0].ToString();
}
}
}
}
return versionNumber;
}
#region Date Functions
/// <summary>
/// Retrieves the most recent date's ID from the database.
@@ -253,7 +281,7 @@ namespace AdvertsingProfitControl
public List<string> RetrieveUsedAdItemListByDateId(string dateId, string connectionString)
{
var adItemList = new List<string>();
var oleDbCommand = new OleDbCommand()
var oleDbCommand = new OleDbCommand
{
CommandText = "SELECT AdItem.AdItem, APC.RowAttribute, APC.FK_GroupID FROM (APC INNER JOIN AdItem ON APC.FK_AdItemID = AdItem.ID) WHERE FK_DateID = ? ORDER BY RowPosition ASC"
};
@@ -269,7 +297,7 @@ namespace AdvertsingProfitControl
{
while (reader != null && reader.Read())
{
if (reader["FK_GroupID"].ToString() != "" && (int) reader["FK_GroupID"] >= 3)
if (reader["FK_GroupID"].ToString() != "" && int.Parse(reader["FK_GroupID"].ToString()) >= 3)
{
adItemList.Add(reader[0] + ":2");
}
@@ -285,6 +313,41 @@ namespace AdvertsingProfitControl
return adItemList;
}
public List<string> RetrieveAdItemListByLetter(string connectionString, string letterFilter = "All")
{
var adItemsList = new List<string>();
var oleDbCommand = new OleDbCommand();
if(letterFilter == "All")
{
oleDbCommand.CommandText = "SELECT AdItem FROM AdItem ORDER BY AdItem ASC";
}
else
{
oleDbCommand.CommandText = "SELECT AdItem FROM AdItem WHERE LEFT(AdItem, 1) = ? ORDER BY AdItem ASC";
oleDbCommand.Parameters.AddWithValue("Filter", letterFilter);
}
var connection = new OleDbConnection(connectionString);
oleDbCommand.Connection = connection;
using (connection)
{
using (oleDbCommand)
{
connection.Open();
using (var reader = oleDbCommand.ExecuteReader())
{
while (reader != null && reader.Read())
{
adItemsList.Add((reader[0].ToString()));
}
}
}
}
return adItemsList;
}
#endregion
#region Comment Functions
@@ -320,7 +383,7 @@ namespace AdvertsingProfitControl
#endregion
#region Group ID Functions
#region Ad Special Functions
public string RetrieveGroupIdByString(string groupName, string connectionString)
{
@@ -524,6 +587,32 @@ namespace AdvertsingProfitControl
#region Table Return Functions
public DataTable ReturnApcTableForReport(string dateId, string connectionString)
{
var dataTable = new DataTable();
var oleDbCommand = new OleDbCommand()
{
CommandText = "SELECT AdItem.AdItem, APC.ProjectionSold, APC.ProjectionSalePrice, APC.ProjectionTotalSales, APC.ProjectionCost, APC.ProjectionProfitReturn, APC.ProjectionTotalProfitReturn, APC.BeginingInventory, APC.Received, APC.TotalInventory, APC.EndingInventory, APC.ActualSold, APC.ActualSalePrice, APC.ActualTotalSales, APC.ActualCost, APC.ActualProfitReturn, APC.ActualTotalProfitReturn, RowAttribute, FK_GroupID FROM (AdItem INNER JOIN APC ON AdItem.ID = APC.FK_AdItemID) WHERE FK_DateID = ? ORDER BY RowPosition ASC"
};
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
var connection = new OleDbConnection(connectionString);
oleDbCommand.Connection = connection;
using (connection)
{
using (oleDbCommand)
{
connection.Open();
using (var dataAdapter = new OleDbDataAdapter(oleDbCommand))
{
dataAdapter.Fill(dataTable);
}
}
}
return dataTable;
}
public DataTable ReturnProjectionsTable(string dateId, string connectionString)
{
var dataTable = new DataTable();
@@ -605,7 +694,7 @@ namespace AdvertsingProfitControl
var dataTable = new DataTable();
var oleDbCommand = new OleDbCommand()
{
CommandText = "SELECT Supplier.SupplierName, InvoiceNumber, Invoice.InvoiceDate, Invoice.InvoiceNetAmountAtCost, Invoice.InvoiceNetAmount, Invoice.InvoiceNote FROM (Supplier INNER JOIN Invoice ON Supplier.ID = Invoice.FK_Supplier) WHERE FK_DateID = ?"
CommandText = "SELECT Supplier.SupplierName, Invoice.InvoiceNumber, Invoice.InvoiceDate, Invoice.InvoiceNetAmountAtCost, Invoice.InvoiceNetAmount, Invoice.InvoiceNote FROM (Supplier INNER JOIN Invoice ON Supplier.ID = Invoice.FK_Supplier) WHERE FK_DateID = ?"
};
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
var connection = new OleDbConnection(connectionString);
+100
View File
@@ -1185,5 +1185,105 @@ namespace AdvertsingProfitControl
return wasSuccessful;
}
public bool RemoveAdItem(string adItemName)
{
var success = false;
var oleDbCommand = new OleDbCommand
{
CommandText = "DELETE FROM AdItem WHERE AdItem = ?"
};
oleDbCommand.Parameters.AddWithValue("AdItemName", adItemName);
oleDbCommand.Connection = _connectionobject;
try
{
_connectionobject.Open();
var rowsEffected = oleDbCommand.ExecuteNonQuery();
if(rowsEffected == 1)
{
success = true;
}
else if(rowsEffected > 1)
{
_logConsole.WriteToLog(FrmLogConsole.Level.Info, "Removed redundant entry " + adItemName + " from the database successfully.");
success = true;
}
else
{
}
}
catch (OleDbException e)
{
_logConsole.WriteToLog(FrmLogConsole.Level.Error, "Failed to delete the ad item " + adItemName + " from the database.");
_logConsole.WriteToLog(FrmLogConsole.Level.Error, e.Message);
}
finally
{
_connectionobject.Close();
}
return success;
}
public bool AddNewItem(string adItemName)
{
var success = false;
var oleDbCommand = new OleDbCommand
{
CommandText = "INSERT INTO AdItem (AdItem) VALUES (?)"
};
oleDbCommand.Parameters.AddWithValue("AdItemName", adItemName);
oleDbCommand.Connection = _connectionobject;
var redundantancyCheck = new OleDbCommand
{
CommandText = "SELECT AdItem FROM AdItem WHERE AdItem = ?"
};
redundantancyCheck.Parameters.AddWithValue("AdItemName", adItemName);
redundantancyCheck.Connection = _connectionobject;
try
{
_connectionobject.Open();
using(var reader = redundantancyCheck.ExecuteReader())
{
var rows = 0;
while(reader != null && reader.Read())
{
rows++;
}
if(rows == 0)
{
var rowsEffected = oleDbCommand.ExecuteNonQuery();
if (rowsEffected == 1)
{
success = true;
}
else
{
_logConsole.WriteToLog(FrmLogConsole.Level.Error, "Failed to insert new ad item " + adItemName + ".");
}
}
else
{
success = true;
_logConsole.WriteToLog(FrmLogConsole.Level.Debug, "Ad Item " + adItemName + " found with " + rows + " row(s).");
}
}
}
catch (OleDbException e)
{
_logConsole.WriteToLog(FrmLogConsole.Level.Error, "Failed to add the new ad item " + adItemName + " to the database.");
_logConsole.WriteToLog(FrmLogConsole.Level.Error, e.Message);
}
finally
{
_connectionobject.Close();
}
return success;
}
}
}
@@ -47,6 +47,7 @@ namespace AdvertsingProfitControl
if (rowsEffected == 1)
{
RowParsing._adSpecialGroups.Add(enterNewKeyWordTextBox.Text);
var groupNameCollection = databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString);
adSpecialKeyWordsListBox.Items.Clear();
foreach (var groupName in groupNameCollection)
+3 -14
View File
@@ -51,7 +51,6 @@
this.commentsTextBox = new System.Windows.Forms.TextBox();
this.errorReportingLabel = new System.Windows.Forms.Label();
this.addRecordsButton = new System.Windows.Forms.Button();
this.inventoryTabPage = new System.Windows.Forms.TabPage();
this.mainLayoutPanel.SuspendLayout();
this.addRecordTabControl.SuspendLayout();
this.projectionsTabPage.SuspendLayout();
@@ -90,7 +89,6 @@
// addRecordTabControl
//
this.addRecordTabControl.Controls.Add(this.projectionsTabPage);
this.addRecordTabControl.Controls.Add(this.inventoryTabPage);
this.addRecordTabControl.Controls.Add(this.actualSalesTabPage);
this.addRecordTabControl.Controls.Add(this.suppliersTabPage);
this.addRecordTabControl.Controls.Add(this.weeklySalesTabPage);
@@ -210,6 +208,7 @@
//
// mainMenu
//
this.mainMenu.ImageScalingSize = new System.Drawing.Size(24, 24);
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMainMenu});
this.mainMenu.Location = new System.Drawing.Point(0, 0);
@@ -231,14 +230,14 @@
// clearFormFileMainMenu
//
this.clearFormFileMainMenu.Name = "clearFormFileMainMenu";
this.clearFormFileMainMenu.Size = new System.Drawing.Size(174, 30);
this.clearFormFileMainMenu.Size = new System.Drawing.Size(187, 30);
this.clearFormFileMainMenu.Text = "C&lear Form";
this.clearFormFileMainMenu.Click += new System.EventHandler(this.clearFormFileMainMenu_Click);
//
// closeFormFileMainMenu
//
this.closeFormFileMainMenu.Name = "closeFormFileMainMenu";
this.closeFormFileMainMenu.Size = new System.Drawing.Size(174, 30);
this.closeFormFileMainMenu.Size = new System.Drawing.Size(187, 30);
this.closeFormFileMainMenu.Text = "&Close Form";
this.closeFormFileMainMenu.Click += new System.EventHandler(this.closeFileMainMenu_Click);
//
@@ -342,15 +341,6 @@
this.addRecordsButton.UseVisualStyleBackColor = true;
this.addRecordsButton.Click += new System.EventHandler(this.addRecordsButton_Click);
//
// inventoryTabPage
//
this.inventoryTabPage.Location = new System.Drawing.Point(4, 29);
this.inventoryTabPage.Name = "inventoryTabPage";
this.inventoryTabPage.Size = new System.Drawing.Size(1262, 522);
this.inventoryTabPage.TabIndex = 4;
this.inventoryTabPage.Text = "Inventory";
this.inventoryTabPage.UseVisualStyleBackColor = true;
//
// FrmAddRecord
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
@@ -413,7 +403,6 @@
private System.Windows.Forms.Button addRecordsButton;
private System.Windows.Forms.ToolStripMenuItem clearFormFileMainMenu;
private System.Windows.Forms.Label dateFormatLabel;
private System.Windows.Forms.TabPage inventoryTabPage;
}
}
+37 -31
View File
@@ -35,6 +35,9 @@ namespace AdvertsingProfitControl
public FrmAddRecord()
{
InitializeComponent();
//Set the maximum and minimum sizes for the form.
MaximumSize = new Size(1200, 650);
MinimumSize = new Size(1000, 550);
}
private void frmAddRecord_Load(object sender, EventArgs e)
@@ -82,14 +85,15 @@ namespace AdvertsingProfitControl
//Begin DataGridView event handlers
/// <summary>
/// Event Used: Leave
///
/// Attempts to parse the date entered when the user leaves the DateMaskedTextbox.
/// Clears the date if it is invalid, otherwise formats it and places it in the textbox.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnWeekEndingDateMaskedTextBoxLeave(object sender, EventArgs e)
{
string input = weekEndingDateMaskedTextBox.Text;
input = input.Replace(" ", "");
input = input.Replace(" ", ""); //The forwardslashes "/" in the masked textbox are sent programmically as spaces.
DateTime processedDate;
if (!DateTime.TryParse(input, out processedDate))
{
@@ -104,7 +108,7 @@ namespace AdvertsingProfitControl
/// <summary>
/// Event Used: CellValidating
///
/// Performs formatting and validation based on what column the cell is in.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@@ -148,7 +152,7 @@ namespace AdvertsingProfitControl
}
}
//Make an ugly check for the Inventory / Actual Sales table, and perform logic on the inventory columns to allow 'Bin(s) [0-9]'.
if (dataGridView.Name == "inventoryActualSalesDataGridView" && e.ColumnIndex > 0 && e.ColumnIndex < 6)
if (dataGridView.Name == "inventoryActualSalesDataGridView" && e.ColumnIndex > 0 && e.ColumnIndex < 6 || dataGridView.Name == "projectionsDataGridView" && e.ColumnIndex == 1)
{
var invenotryStringCheck = new Regex(@"^[0-9] \bbin(s){0,1}\b", RegexOptions.IgnoreCase);
@@ -165,7 +169,7 @@ namespace AdvertsingProfitControl
}
//Check to see if whether or not the current cell is not in the first column and not empty.
if (e.ColumnIndex != 0 && !String.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()))
if (e.ColumnIndex != 0 && !string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].EditedFormattedValue.ToString()))
{
//IF so, try to parse the contents to a Double and apply number formatting to the contents.
//Check for the cost column to see if there are any strings formatted like such:
@@ -639,7 +643,7 @@ namespace AdvertsingProfitControl
}
_gLastAdItemEntered = projectionsDataGridView.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString();
//IF the current row is either a MemberRow OR an AdSpecialRow then only add the item in the first cell, place holder values are not needed.
if (parser.GetRowAttribute(projectionsDataGridView.Rows[e.RowIndex]) == "MemberRow" || parser.GetRowAttribute(projectionsDataGridView.Rows[e.RowIndex]) == "AdSpecialRow")
if (parser.GetRowAttribute(projectionsDataGridView.Rows[e.RowIndex]) == RowAttribute.MemberRow || parser.GetRowAttribute(projectionsDataGridView.Rows[e.RowIndex]) == RowAttribute.AdSpecialRow)
{
rowContents[0] = projectionsDataGridView.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString();
actualSalesDataGridView.Rows.Add(rowContents);
@@ -742,7 +746,7 @@ namespace AdvertsingProfitControl
}
_gLastAdItemEntered = actualSalesDataGridView.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString();
//IF the current row is either a MemberRow OR an AdSpecialRow then only ad the item in the first cell, place holder values are not needed.
if (parser.GetRowAttribute(actualSalesDataGridView.Rows[e.RowIndex]) == "MemberRow" || parser.GetRowAttribute(actualSalesDataGridView.Rows[e.RowIndex]) == "AdSpecialRow")
if (parser.GetRowAttribute(actualSalesDataGridView.Rows[e.RowIndex]) == RowAttribute.MemberRow || parser.GetRowAttribute(actualSalesDataGridView.Rows[e.RowIndex]) == RowAttribute.AdSpecialRow)
{
rowContents[0] = actualSalesDataGridView.Rows[e.RowIndex].Cells[0].EditedFormattedValue.ToString();
projectionsDataGridView.Rows.Add(rowContents);
@@ -923,13 +927,13 @@ namespace AdvertsingProfitControl
//Get the status of the current row.
var rowStatus = parser.GetRowAttribute(dataGridView.Rows[i]);
//IF the current row is a header row...
if (rowStatus == "HeaderRow")
if (rowStatus == RowAttribute.HeaderRow)
{
_gLastRowHeaderIndex = i;
//Then check to see if the next row is a row header.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i + 1]);
//IF so, color code this row as White, since it is not a true group header.
if (rowStatus != "HeaderRow")
if (rowStatus != RowAttribute.HeaderRow)
{
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
}
@@ -939,53 +943,53 @@ namespace AdvertsingProfitControl
//The start by checking the previous row's status.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i - 1]);
//IF the previous row is a header row OR if the previous row is index zero AND a member row, clear its coloring.
if (rowStatus == "HeaderRow" || rowStatus == "MemberRow" && (i - 1) == 0)
if (rowStatus == RowAttribute.HeaderRow || rowStatus == RowAttribute.MemberRow && (i - 1) == 0)
{
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
}
//IF the previous row is a header row AND has color coding saying it is a group header, then clear its color and apply it to this row (i).
else if (rowStatus == "HeaderRow" && dataGridView.Rows[i - 1].DefaultCellStyle.BackColor == Color.LightGray)
else if (rowStatus == RowAttribute.HeaderRow && dataGridView.Rows[i - 1].DefaultCellStyle.BackColor == Color.LightGray)
{
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
//IF previous row is Incomplete, then call the stable PaintRowGroups function.
else if (rowStatus == "IncompleteRow")
else if (rowStatus == RowAttribute.IncompleteRow)
{
PaintRowGroups(dataGridView);
}
}
}
else if (rowStatus == "MemberRow")
else if (rowStatus == RowAttribute.MemberRow)
{
if (i > 0)
{
//Check the previous row.
rowStatus = parser.GetRowAttribute(dataGridView.Rows[i - 1]);
//IF the previous row is a member row AND is the first row in the data grid, then remove the coloring for it and the current row (i).
if (rowStatus == "MemberRow" && (i - 1) == 0)
if (rowStatus == RowAttribute.MemberRow && (i - 1) == 0)
{
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.White;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
}
//IF the previous row is a member row AND it also has color coding suggesting that it is a member of a group, then add the current row (i) as well.
else if (rowStatus == "MemberRow" && dataGridView.Rows[i - 1].DefaultCellStyle.BackColor == Color.LightBlue)
else if (rowStatus == RowAttribute.MemberRow && dataGridView.Rows[i - 1].DefaultCellStyle.BackColor == Color.LightBlue)
{
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
//IF the previous row is simply a member row with no coloring at all, then remove the coloring from the current row (i).
else if (rowStatus == "MemberRow" || rowStatus == "AdSpecialRow")
else if (rowStatus == RowAttribute.MemberRow || rowStatus == RowAttribute.AdSpecialRow)
{
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
}
//IF the previous row is a header row, then color it as a group header and color the current row as a member of said group.
else if (rowStatus == "HeaderRow")
else if (rowStatus == RowAttribute.HeaderRow)
{
dataGridView.Rows[i - 1].DefaultCellStyle.BackColor = Color.LightGray;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
//IF the previous row is incomplete, then call the stable PaintRowGroups function.
else if (rowStatus == "IncompleteRow")
else if (rowStatus == RowAttribute.IncompleteRow)
{
PaintRowGroups(dataGridView);
}
@@ -1013,7 +1017,7 @@ namespace AdvertsingProfitControl
//Get the current row's status.
var rowType = parser.GetRowAttribute(row);
//If the current row is not a group header, the first row in the grid, or a new row and in fact a member row...
if (i != 0 && rowType == "MemberRow" && !row.IsNewRow && rowType != "IncompleteRow")
if (i != 0 && rowType == RowAttribute.MemberRow && !row.IsNewRow && rowType != RowAttribute.IncompleteRow)
{
//Remove all coloring on the current row.
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
@@ -1023,13 +1027,14 @@ namespace AdvertsingProfitControl
{
//Check to see if the previous row is a header row by subtracting the number of rows that are (incomplete + 1) from the total number of rows (i).
//Adding one (1) to the incomplete count allows for checking the row right before the first incomplete row found so far to see if it's a header row.
if (parser.GetRowAttribute(dataGridView.Rows[i - (1 + incompleteRowsFound)]) == "HeaderRow")
if (parser.GetRowAttribute(dataGridView.Rows[i - (1 + incompleteRowsFound)]) == RowAttribute.HeaderRow)
{
row.DefaultCellStyle.BackColor = Color.LightBlue; //Group member
dataGridView.Rows[lastHeaderIndex].DefaultCellStyle.BackColor = Color.LightGray; //Group header
groupCount++;
statusReport += string.Format("\nGroup {0} created with the header row {1} and the following row members: {2} ", groupCount, (i - incompleteRowsFound).ToString(), (i + 1).ToString());
statusReport +=
$"\nGroup {groupCount} created with the header row {(i - incompleteRowsFound)} and the following row members: {(i + 1)} ";
}
//Else if a header row was not found from the previous operation but a header row is set, then its safe to assume that this row can be a member.
else if (lastHeaderIndex >= 0)
@@ -1045,21 +1050,22 @@ namespace AdvertsingProfitControl
}
}
//If the current row is a potential group header AND the next row is as well remove the coloring from the current row, no need for checks.
else if (rowType == "HeaderRow" && parser.GetRowAttribute(dataGridView.Rows[i + 1]) == "HeaderRow")
else if (rowType == RowAttribute.HeaderRow && parser.GetRowAttribute(dataGridView.Rows[i + 1]) == RowAttribute.HeaderRow)
{
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
}
//Check to see if this row is the first row, a header index row, AND the next row is a MemberRow.
else if (rowType == "HeaderRow" && parser.GetRowAttribute(dataGridView.Rows[i + 1]) == "MemberRow" && i == 0)
else if (rowType == RowAttribute.HeaderRow && parser.GetRowAttribute(dataGridView.Rows[i + 1]) == RowAttribute.MemberRow && i == 0)
{
//IF so, set the last header index, and color code of this row along with the next row which is a MemberRow.
lastHeaderIndex = 0;
dataGridView.Rows[0].DefaultCellStyle.BackColor = Color.LightGray;
dataGridView.Rows[i + 1].DefaultCellStyle.BackColor = Color.LightBlue;
statusReport += string.Format("Group {0} created with the header row 1 and the following row member(s): {1}", groupCount, (i + 2).ToString());
statusReport +=
$"Group {groupCount} created with the header row 1 and the following row member(s): {(i + 2)}";
}
//Check to see if this row is a group header.
else if (rowType == "HeaderRow")
else if (rowType == RowAttribute.HeaderRow)
{
//If so, reset the incomplete rows found count, set the lastHeaderIndex to this row's index (i) and change it's color to white.
incompleteRowsFound = 0;
@@ -1067,12 +1073,12 @@ namespace AdvertsingProfitControl
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
}
//If the current row is the first row in the grid AND is not a group header then remove all color from it, since its not allowed to be a header or a member.
else if (i == 0 && rowType == "MemberRow")
else if (i == 0 && rowType == RowAttribute.MemberRow)
{
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
}
//Mark an incomplete row to determine whether or not we found one and remove any coloring it may have, incomplete rows are not allowed to be members or headers.
if (rowType == "IncompleteRow")
if (rowType == RowAttribute.IncompleteRow)
{
incompleteRowsFound++;
dataGridView.Rows[i].DefaultCellStyle.BackColor = Color.White;
@@ -1266,7 +1272,7 @@ namespace AdvertsingProfitControl
//Get the current row's attribute.
var currentRowAttribute = parser.GetRowAttribute(row);
//IF the current row is invalid then skip it.
if (currentRowAttribute == "IncompleteRow" || currentRowAttribute == "MemberRow" && rowIndexNumber == 0)
if (currentRowAttribute == RowAttribute.IncompleteRow || currentRowAttribute == RowAttribute.MemberRow && rowIndexNumber == 0)
{
continue;
}
@@ -1286,12 +1292,12 @@ namespace AdvertsingProfitControl
//BEGIN row attribute check.
//Do an in-depth check to determine if the row should be marked with a "Header Row" group tag.
//Only rows that have members will be explicitly marked as such.
if (currentRowAttribute == "HeaderRow")
if (currentRowAttribute == RowAttribute.HeaderRow)
{
if ((rowIndexNumber + 1) <= projectionsDataGridView.Rows.Count)
{
//Check to see if the next row is a Member Row.
if ((parser.GetRowAttribute(projectionsDataGridView.Rows[rowIndexNumber + 1])) == "MemberRow")
if ((parser.GetRowAttribute(projectionsDataGridView.Rows[rowIndexNumber + 1])) == RowAttribute.MemberRow)
{
//Set the current row's attribute to HeaderRow in the database.
parameters[16] = "1";
@@ -1306,7 +1312,7 @@ namespace AdvertsingProfitControl
}
}
}
else if (currentRowAttribute == "MemberRow" && lastHeaderRowNumber != -1)
else if (currentRowAttribute == RowAttribute.MemberRow && lastHeaderRowNumber != -1)
{
//ELSE IF this row is a member, then mark it as such.
parameters[16] = "2";
+146 -149
View File
@@ -39,8 +39,10 @@
this.deleteRecordsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.adSpecialKeyWordsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.manageItemsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.helpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.showHideConsoleHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.dbVersionHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem();
this.commentMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.commentMainGroupBox = new System.Windows.Forms.GroupBox();
this.commentsTextBox = new System.Windows.Forms.TextBox();
@@ -53,19 +55,16 @@
this.remainingSalesLabel = new System.Windows.Forms.Label();
this.salesProducedLabel = new System.Windows.Forms.Label();
this.departmentSalesLabel = new System.Windows.Forms.Label();
this.costOfSalesMainGroupBox = new System.Windows.Forms.GroupBox();
this.costOfSalesLabel = new System.Windows.Forms.Label();
this.lessInventoryEndOfWeekAtCostLabel = new System.Windows.Forms.Label();
this.totalLabel = new System.Windows.Forms.Label();
this.plusTotalPurchases = new System.Windows.Forms.Label();
this.inventoryBeginingOfWeekAtCostLabel = new System.Windows.Forms.Label();
this.grossProfitGroupBox = new System.Windows.Forms.GroupBox();
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label();
this.perfectGrossProfitLabel = new System.Windows.Forms.Label();
this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label();
this.grossProfitLessCostOfSales = new System.Windows.Forms.Label();
this.perfectGrossProfitLabel = new System.Windows.Forms.Label();
this.grossProfitTotalSales = new System.Windows.Forms.Label();
this.grossProfitLessCostOfSales = new System.Windows.Forms.Label();
this.taxableGroupBox = new System.Windows.Forms.GroupBox();
this.usePreRenderedFilesCheckbox = new System.Windows.Forms.CheckBox();
this.dateSelectorPanel = new System.Windows.Forms.Panel();
this.printPreviewButton = new System.Windows.Forms.Button();
this.yearComboBox = new System.Windows.Forms.ComboBox();
this.dayComboBox = new System.Windows.Forms.ComboBox();
this.monthComboBox = new System.Windows.Forms.ComboBox();
@@ -82,13 +81,14 @@
this.suppliersDataGridView = new System.Windows.Forms.DataGridView();
this.WeeklySalesTabPage = new System.Windows.Forms.TabPage();
this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView();
this.newFormTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mainTableLayoutPanel.SuspendLayout();
this.mainMenu.SuspendLayout();
this.commentMainTableLayoutPanel.SuspendLayout();
this.commentMainGroupBox.SuspendLayout();
this.profitAnalysisMainGroupBox.SuspendLayout();
this.costOfSalesMainGroupBox.SuspendLayout();
this.grossProfitGroupBox.SuspendLayout();
this.taxableGroupBox.SuspendLayout();
this.dateSelectorPanel.SuspendLayout();
this.mainViewTabControl.SuspendLayout();
this.projectionTab.SuspendLayout();
@@ -119,12 +119,13 @@
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65F));
this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.mainTableLayoutPanel.Size = new System.Drawing.Size(1478, 794);
this.mainTableLayoutPanel.Size = new System.Drawing.Size(1486, 765);
this.mainTableLayoutPanel.TabIndex = 0;
//
// mainMenu
//
this.mainMenu.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainMenu.ImageScalingSize = new System.Drawing.Size(24, 24);
this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMainMenu,
this.recordsToolStripMenuItem,
@@ -133,7 +134,7 @@
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.Name = "mainMenu";
this.mainMenu.Padding = new System.Windows.Forms.Padding(9, 3, 0, 3);
this.mainMenu.Size = new System.Drawing.Size(1478, 35);
this.mainMenu.Size = new System.Drawing.Size(1486, 35);
this.mainMenu.TabIndex = 1;
this.mainMenu.Text = "menuStrip1";
//
@@ -148,7 +149,7 @@
// exitFileMainMenu
//
this.exitFileMainMenu.Name = "exitFileMainMenu";
this.exitFileMainMenu.Size = new System.Drawing.Size(111, 30);
this.exitFileMainMenu.Size = new System.Drawing.Size(124, 30);
this.exitFileMainMenu.Text = "E&xit";
//
// recordsToolStripMenuItem
@@ -156,7 +157,8 @@
this.recordsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addRecordsToolStripMenuItem,
this.modifyRecordMainMenu,
this.deleteRecordsMainMenu});
this.deleteRecordsMainMenu,
this.newFormTestToolStripMenuItem});
this.recordsToolStripMenuItem.Name = "recordsToolStripMenuItem";
this.recordsToolStripMenuItem.Size = new System.Drawing.Size(87, 29);
this.recordsToolStripMenuItem.Text = "&Records";
@@ -164,28 +166,29 @@
// addRecordsToolStripMenuItem
//
this.addRecordsToolStripMenuItem.Name = "addRecordsToolStripMenuItem";
this.addRecordsToolStripMenuItem.Size = new System.Drawing.Size(271, 30);
this.addRecordsToolStripMenuItem.Size = new System.Drawing.Size(284, 30);
this.addRecordsToolStripMenuItem.Text = "&Add New Record";
this.addRecordsToolStripMenuItem.Click += new System.EventHandler(this.addRecordToolStripMenuItem_Click);
//
// modifyRecordMainMenu
//
this.modifyRecordMainMenu.Name = "modifyRecordMainMenu";
this.modifyRecordMainMenu.Size = new System.Drawing.Size(271, 30);
this.modifyRecordMainMenu.Size = new System.Drawing.Size(284, 30);
this.modifyRecordMainMenu.Text = "&Modify Existing Record ";
this.modifyRecordMainMenu.Click += new System.EventHandler(this.modifyRecordMainMenu_Click);
//
// deleteRecordsMainMenu
//
this.deleteRecordsMainMenu.Name = "deleteRecordsMainMenu";
this.deleteRecordsMainMenu.Size = new System.Drawing.Size(271, 30);
this.deleteRecordsMainMenu.Size = new System.Drawing.Size(284, 30);
this.deleteRecordsMainMenu.Text = "&Delete Existing record";
this.deleteRecordsMainMenu.Click += new System.EventHandler(this.deleteRecordsMainMenu_Click);
//
// toolsMainMenu
//
this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.adSpecialKeyWordsToolsMainMenu});
this.adSpecialKeyWordsToolsMainMenu,
this.manageItemsToolsMainMenu});
this.toolsMainMenu.Name = "toolsMainMenu";
this.toolsMainMenu.Size = new System.Drawing.Size(65, 29);
this.toolsMainMenu.Text = "&Tools";
@@ -193,14 +196,22 @@
// adSpecialKeyWordsToolsMainMenu
//
this.adSpecialKeyWordsToolsMainMenu.Name = "adSpecialKeyWordsToolsMainMenu";
this.adSpecialKeyWordsToolsMainMenu.Size = new System.Drawing.Size(235, 30);
this.adSpecialKeyWordsToolsMainMenu.Size = new System.Drawing.Size(248, 30);
this.adSpecialKeyWordsToolsMainMenu.Text = "&Register Ad Special";
this.adSpecialKeyWordsToolsMainMenu.Click += new System.EventHandler(this.adSpecialKeyWordsToolsMainMenu_Click);
//
// manageItemsToolsMainMenu
//
this.manageItemsToolsMainMenu.Name = "manageItemsToolsMainMenu";
this.manageItemsToolsMainMenu.Size = new System.Drawing.Size(248, 30);
this.manageItemsToolsMainMenu.Text = "&Manage Ad Items";
this.manageItemsToolsMainMenu.Click += new System.EventHandler(this.manageItemsToolsMainMenu_Click);
//
// helpMainMenu
//
this.helpMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showHideConsoleHelpMainMenu});
this.showHideConsoleHelpMainMenu,
this.dbVersionHelpMainMenu});
this.helpMainMenu.Name = "helpMainMenu";
this.helpMainMenu.Size = new System.Drawing.Size(61, 29);
this.helpMainMenu.Text = "&Help";
@@ -208,10 +219,17 @@
// showHideConsoleHelpMainMenu
//
this.showHideConsoleHelpMainMenu.Name = "showHideConsoleHelpMainMenu";
this.showHideConsoleHelpMainMenu.Size = new System.Drawing.Size(241, 30);
this.showHideConsoleHelpMainMenu.Size = new System.Drawing.Size(266, 30);
this.showHideConsoleHelpMainMenu.Text = "&Show/Hide Console";
this.showHideConsoleHelpMainMenu.Click += new System.EventHandler(this.showHideConsoleHelpMainMenu_Click);
//
// dbVersionHelpMainMenu
//
this.dbVersionHelpMainMenu.Name = "dbVersionHelpMainMenu";
this.dbVersionHelpMainMenu.Size = new System.Drawing.Size(266, 30);
this.dbVersionHelpMainMenu.Text = "Get &Database Version";
this.dbVersionHelpMainMenu.Click += new System.EventHandler(this.dbVersionHelpMainMenu_Click);
//
// commentMainTableLayoutPanel
//
this.commentMainTableLayoutPanel.ColumnCount = 4;
@@ -221,18 +239,18 @@
this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26F));
this.commentMainTableLayoutPanel.Controls.Add(this.commentMainGroupBox, 0, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.profitAnalysisMainGroupBox, 1, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.costOfSalesMainGroupBox, 2, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.grossProfitGroupBox, 3, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.grossProfitGroupBox, 2, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.taxableGroupBox, 3, 0);
this.commentMainTableLayoutPanel.Controls.Add(this.dateSelectorPanel, 2, 1);
this.commentMainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(4, 533);
this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(4, 514);
this.commentMainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainTableLayoutPanel.Name = "commentMainTableLayoutPanel";
this.commentMainTableLayoutPanel.RowCount = 2;
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1470, 256);
this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1478, 246);
this.commentMainTableLayoutPanel.TabIndex = 2;
//
// commentMainGroupBox
@@ -244,7 +262,7 @@
this.commentMainGroupBox.Name = "commentMainGroupBox";
this.commentMainGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainTableLayoutPanel.SetRowSpan(this.commentMainGroupBox, 2);
this.commentMainGroupBox.Size = new System.Drawing.Size(286, 246);
this.commentMainGroupBox.Size = new System.Drawing.Size(287, 236);
this.commentMainGroupBox.TabIndex = 0;
this.commentMainGroupBox.TabStop = false;
this.commentMainGroupBox.Text = "Comments";
@@ -257,7 +275,7 @@
this.commentsTextBox.Multiline = true;
this.commentsTextBox.Name = "commentsTextBox";
this.commentsTextBox.ReadOnly = true;
this.commentsTextBox.Size = new System.Drawing.Size(278, 217);
this.commentsTextBox.Size = new System.Drawing.Size(279, 207);
this.commentsTextBox.TabIndex = 0;
//
// profitAnalysisMainGroupBox
@@ -271,12 +289,12 @@
this.profitAnalysisMainGroupBox.Controls.Add(this.salesProducedLabel);
this.profitAnalysisMainGroupBox.Controls.Add(this.departmentSalesLabel);
this.profitAnalysisMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(298, 5);
this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(299, 5);
this.profitAnalysisMainGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.profitAnalysisMainGroupBox.Name = "profitAnalysisMainGroupBox";
this.profitAnalysisMainGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commentMainTableLayoutPanel.SetRowSpan(this.profitAnalysisMainGroupBox, 2);
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(403, 246);
this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(405, 236);
this.profitAnalysisMainGroupBox.TabIndex = 1;
this.profitAnalysisMainGroupBox.TabStop = false;
this.profitAnalysisMainGroupBox.Text = "Profit Analysis";
@@ -340,9 +358,9 @@
this.remainingSalesLabel.Location = new System.Drawing.Point(9, 123);
this.remainingSalesLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.remainingSalesLabel.Name = "remainingSalesLabel";
this.remainingSalesLabel.Size = new System.Drawing.Size(125, 20);
this.remainingSalesLabel.Size = new System.Drawing.Size(137, 20);
this.remainingSalesLabel.TabIndex = 2;
this.remainingSalesLabel.Text = "Remaing Sales: ";
this.remainingSalesLabel.Text = "Remaining Sales: ";
//
// salesProducedLabel
//
@@ -364,145 +382,117 @@
this.departmentSalesLabel.TabIndex = 0;
this.departmentSalesLabel.Text = "Department Sales: ";
//
// costOfSalesMainGroupBox
//
this.costOfSalesMainGroupBox.Controls.Add(this.costOfSalesLabel);
this.costOfSalesMainGroupBox.Controls.Add(this.lessInventoryEndOfWeekAtCostLabel);
this.costOfSalesMainGroupBox.Controls.Add(this.totalLabel);
this.costOfSalesMainGroupBox.Controls.Add(this.plusTotalPurchases);
this.costOfSalesMainGroupBox.Controls.Add(this.inventoryBeginingOfWeekAtCostLabel);
this.costOfSalesMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.costOfSalesMainGroupBox.Location = new System.Drawing.Point(709, 5);
this.costOfSalesMainGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.costOfSalesMainGroupBox.Name = "costOfSalesMainGroupBox";
this.costOfSalesMainGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.costOfSalesMainGroupBox.Size = new System.Drawing.Size(374, 194);
this.costOfSalesMainGroupBox.TabIndex = 2;
this.costOfSalesMainGroupBox.TabStop = false;
this.costOfSalesMainGroupBox.Text = "Cost of Sales";
//
// costOfSalesLabel
//
this.costOfSalesLabel.AutoSize = true;
this.costOfSalesLabel.Location = new System.Drawing.Point(8, 154);
this.costOfSalesLabel.Name = "costOfSalesLabel";
this.costOfSalesLabel.Size = new System.Drawing.Size(112, 20);
this.costOfSalesLabel.TabIndex = 4;
this.costOfSalesLabel.Text = "Cost of Sales: ";
//
// lessInventoryEndOfWeekAtCostLabel
//
this.lessInventoryEndOfWeekAtCostLabel.AutoSize = true;
this.lessInventoryEndOfWeekAtCostLabel.Location = new System.Drawing.Point(8, 123);
this.lessInventoryEndOfWeekAtCostLabel.Name = "lessInventoryEndOfWeekAtCostLabel";
this.lessInventoryEndOfWeekAtCostLabel.Size = new System.Drawing.Size(267, 20);
this.lessInventoryEndOfWeekAtCostLabel.TabIndex = 3;
this.lessInventoryEndOfWeekAtCostLabel.Text = "Less Inventory End of Week at Cost:";
//
// totalLabel
//
this.totalLabel.AutoSize = true;
this.totalLabel.Location = new System.Drawing.Point(8, 92);
this.totalLabel.Name = "totalLabel";
this.totalLabel.Size = new System.Drawing.Size(52, 20);
this.totalLabel.TabIndex = 2;
this.totalLabel.Text = "Total: ";
//
// plusTotalPurchases
//
this.plusTotalPurchases.AutoSize = true;
this.plusTotalPurchases.Location = new System.Drawing.Point(8, 62);
this.plusTotalPurchases.Name = "plusTotalPurchases";
this.plusTotalPurchases.Size = new System.Drawing.Size(165, 20);
this.plusTotalPurchases.TabIndex = 1;
this.plusTotalPurchases.Text = "Plus Total Purchases: ";
//
// inventoryBeginingOfWeekAtCostLabel
//
this.inventoryBeginingOfWeekAtCostLabel.AutoSize = true;
this.inventoryBeginingOfWeekAtCostLabel.Location = new System.Drawing.Point(8, 29);
this.inventoryBeginingOfWeekAtCostLabel.Name = "inventoryBeginingOfWeekAtCostLabel";
this.inventoryBeginingOfWeekAtCostLabel.Size = new System.Drawing.Size(266, 20);
this.inventoryBeginingOfWeekAtCostLabel.TabIndex = 0;
this.inventoryBeginingOfWeekAtCostLabel.Text = "Inventory Begining of Week at Cost: ";
//
// grossProfitGroupBox
//
this.grossProfitGroupBox.Controls.Add(this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel);
this.grossProfitGroupBox.Controls.Add(this.perfectGrossProfitLabel);
this.grossProfitGroupBox.Controls.Add(this.grossProfitDollarGrossProfitLabel);
this.grossProfitGroupBox.Controls.Add(this.grossProfitLessCostOfSales);
this.grossProfitGroupBox.Controls.Add(this.perfectGrossProfitLabel);
this.grossProfitGroupBox.Controls.Add(this.grossProfitTotalSales);
this.grossProfitGroupBox.Controls.Add(this.grossProfitLessCostOfSales);
this.grossProfitGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.grossProfitGroupBox.Location = new System.Drawing.Point(1090, 3);
this.grossProfitGroupBox.Location = new System.Drawing.Point(712, 5);
this.grossProfitGroupBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grossProfitGroupBox.Name = "grossProfitGroupBox";
this.grossProfitGroupBox.Size = new System.Drawing.Size(377, 198);
this.grossProfitGroupBox.TabIndex = 3;
this.grossProfitGroupBox.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.grossProfitGroupBox.Size = new System.Drawing.Size(376, 186);
this.grossProfitGroupBox.TabIndex = 2;
this.grossProfitGroupBox.TabStop = false;
this.grossProfitGroupBox.Text = "Gross Profit";
//
// grossProfitEstimatedWeeklyDeptmartmentExpenseLabel
//
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.AutoSize = true;
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Location = new System.Drawing.Point(10, 152);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Location = new System.Drawing.Point(7, 152);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Name = "grossProfitEstimatedWeeklyDeptmartmentExpenseLabel";
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Size = new System.Drawing.Size(299, 20);
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.TabIndex = 4;
this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = "Estimated Weekly Department Expense: ";
//
// perfectGrossProfitLabel
//
this.perfectGrossProfitLabel.AutoSize = true;
this.perfectGrossProfitLabel.Location = new System.Drawing.Point(10, 122);
this.perfectGrossProfitLabel.Name = "perfectGrossProfitLabel";
this.perfectGrossProfitLabel.Size = new System.Drawing.Size(160, 20);
this.perfectGrossProfitLabel.TabIndex = 3;
this.perfectGrossProfitLabel.Text = "Percent Gross Profit: ";
//
// grossProfitDollarGrossProfitLabel
//
this.grossProfitDollarGrossProfitLabel.AutoSize = true;
this.grossProfitDollarGrossProfitLabel.Location = new System.Drawing.Point(10, 92);
this.grossProfitDollarGrossProfitLabel.Location = new System.Drawing.Point(7, 92);
this.grossProfitDollarGrossProfitLabel.Name = "grossProfitDollarGrossProfitLabel";
this.grossProfitDollarGrossProfitLabel.Size = new System.Drawing.Size(146, 20);
this.grossProfitDollarGrossProfitLabel.TabIndex = 2;
this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: ";
//
// grossProfitLessCostOfSales
// perfectGrossProfitLabel
//
this.grossProfitLessCostOfSales.AutoSize = true;
this.grossProfitLessCostOfSales.Location = new System.Drawing.Point(10, 62);
this.grossProfitLessCostOfSales.Name = "grossProfitLessCostOfSales";
this.grossProfitLessCostOfSales.Size = new System.Drawing.Size(150, 20);
this.grossProfitLessCostOfSales.TabIndex = 1;
this.grossProfitLessCostOfSales.Text = "Less Cost of Sales: ";
this.perfectGrossProfitLabel.AutoSize = true;
this.perfectGrossProfitLabel.Location = new System.Drawing.Point(7, 122);
this.perfectGrossProfitLabel.Name = "perfectGrossProfitLabel";
this.perfectGrossProfitLabel.Size = new System.Drawing.Size(160, 20);
this.perfectGrossProfitLabel.TabIndex = 3;
this.perfectGrossProfitLabel.Text = "Percent Gross Profit: ";
//
// grossProfitTotalSales
//
this.grossProfitTotalSales.AutoSize = true;
this.grossProfitTotalSales.Location = new System.Drawing.Point(10, 32);
this.grossProfitTotalSales.Location = new System.Drawing.Point(7, 32);
this.grossProfitTotalSales.Name = "grossProfitTotalSales";
this.grossProfitTotalSales.Size = new System.Drawing.Size(96, 20);
this.grossProfitTotalSales.TabIndex = 0;
this.grossProfitTotalSales.Text = "Total Sales: ";
//
// grossProfitLessCostOfSales
//
this.grossProfitLessCostOfSales.AutoSize = true;
this.grossProfitLessCostOfSales.Location = new System.Drawing.Point(7, 62);
this.grossProfitLessCostOfSales.Name = "grossProfitLessCostOfSales";
this.grossProfitLessCostOfSales.Size = new System.Drawing.Size(150, 20);
this.grossProfitLessCostOfSales.TabIndex = 1;
this.grossProfitLessCostOfSales.Text = "Less Cost of Sales: ";
//
// taxableGroupBox
//
this.taxableGroupBox.Controls.Add(this.usePreRenderedFilesCheckbox);
this.taxableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.taxableGroupBox.Location = new System.Drawing.Point(1095, 3);
this.taxableGroupBox.Name = "taxableGroupBox";
this.taxableGroupBox.Size = new System.Drawing.Size(380, 190);
this.taxableGroupBox.TabIndex = 3;
this.taxableGroupBox.TabStop = false;
this.taxableGroupBox.Text = "Taxable";
//
// usePreRenderedFilesCheckbox
//
this.usePreRenderedFilesCheckbox.AutoSize = true;
this.usePreRenderedFilesCheckbox.Location = new System.Drawing.Point(177, 164);
this.usePreRenderedFilesCheckbox.Name = "usePreRenderedFilesCheckbox";
this.usePreRenderedFilesCheckbox.Size = new System.Drawing.Size(198, 24);
this.usePreRenderedFilesCheckbox.TabIndex = 5;
this.usePreRenderedFilesCheckbox.Text = "Use Pre-rendered Files";
this.usePreRenderedFilesCheckbox.UseVisualStyleBackColor = true;
//
// dateSelectorPanel
//
this.commentMainTableLayoutPanel.SetColumnSpan(this.dateSelectorPanel, 2);
this.dateSelectorPanel.Controls.Add(this.printPreviewButton);
this.dateSelectorPanel.Controls.Add(this.yearComboBox);
this.dateSelectorPanel.Controls.Add(this.dayComboBox);
this.dateSelectorPanel.Controls.Add(this.monthComboBox);
this.dateSelectorPanel.Controls.Add(this.dateSelectLabel);
this.dateSelectorPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.dateSelectorPanel.Location = new System.Drawing.Point(708, 207);
this.dateSelectorPanel.Location = new System.Drawing.Point(711, 199);
this.dateSelectorPanel.Name = "dateSelectorPanel";
this.dateSelectorPanel.Size = new System.Drawing.Size(759, 46);
this.dateSelectorPanel.Size = new System.Drawing.Size(764, 44);
this.dateSelectorPanel.TabIndex = 4;
//
// printPreviewButton
//
this.printPreviewButton.Location = new System.Drawing.Point(638, 0);
this.printPreviewButton.Name = "printPreviewButton";
this.printPreviewButton.Size = new System.Drawing.Size(118, 42);
this.printPreviewButton.TabIndex = 4;
this.printPreviewButton.Text = "Print Preview";
this.printPreviewButton.UseVisualStyleBackColor = true;
this.printPreviewButton.Click += new System.EventHandler(this.DisplayPrintPreview);
//
// yearComboBox
//
this.yearComboBox.FormattingEnabled = true;
this.yearComboBox.Location = new System.Drawing.Point(532, 12);
this.yearComboBox.Location = new System.Drawing.Point(382, 11);
this.yearComboBox.Name = "yearComboBox";
this.yearComboBox.Size = new System.Drawing.Size(96, 28);
this.yearComboBox.Sorted = true;
@@ -511,7 +501,7 @@
// dayComboBox
//
this.dayComboBox.FormattingEnabled = true;
this.dayComboBox.Location = new System.Drawing.Point(430, 12);
this.dayComboBox.Location = new System.Drawing.Point(280, 11);
this.dayComboBox.Name = "dayComboBox";
this.dayComboBox.Size = new System.Drawing.Size(96, 28);
this.dayComboBox.Sorted = true;
@@ -520,7 +510,7 @@
// monthComboBox
//
this.monthComboBox.FormattingEnabled = true;
this.monthComboBox.Location = new System.Drawing.Point(328, 12);
this.monthComboBox.Location = new System.Drawing.Point(178, 11);
this.monthComboBox.Name = "monthComboBox";
this.monthComboBox.Size = new System.Drawing.Size(96, 28);
this.monthComboBox.Sorted = true;
@@ -529,7 +519,7 @@
// dateSelectLabel
//
this.dateSelectLabel.AutoSize = true;
this.dateSelectLabel.Location = new System.Drawing.Point(156, 14);
this.dateSelectLabel.Location = new System.Drawing.Point(6, 12);
this.dateSelectLabel.Name = "dateSelectLabel";
this.dateSelectLabel.Size = new System.Drawing.Size(166, 20);
this.dateSelectLabel.TabIndex = 0;
@@ -547,7 +537,7 @@
this.mainViewTabControl.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.mainViewTabControl.Name = "mainViewTabControl";
this.mainViewTabControl.SelectedIndex = 0;
this.mainViewTabControl.Size = new System.Drawing.Size(1470, 483);
this.mainViewTabControl.Size = new System.Drawing.Size(1478, 464);
this.mainViewTabControl.TabIndex = 3;
//
// projectionTab
@@ -557,7 +547,7 @@
this.projectionTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionTab.Name = "projectionTab";
this.projectionTab.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.projectionTab.Size = new System.Drawing.Size(1462, 450);
this.projectionTab.Size = new System.Drawing.Size(1470, 431);
this.projectionTab.TabIndex = 0;
this.projectionTab.Text = "Projections";
this.projectionTab.UseVisualStyleBackColor = true;
@@ -579,7 +569,7 @@
this.projectedSalesMainDataGrid.RowHeadersVisible = false;
this.projectedSalesMainDataGrid.ShowCellErrors = false;
this.projectedSalesMainDataGrid.ShowRowErrors = false;
this.projectedSalesMainDataGrid.Size = new System.Drawing.Size(1454, 440);
this.projectedSalesMainDataGrid.Size = new System.Drawing.Size(1462, 421);
this.projectedSalesMainDataGrid.TabIndex = 0;
//
// inventoryTabPage
@@ -588,7 +578,7 @@
this.inventoryTabPage.Location = new System.Drawing.Point(4, 29);
this.inventoryTabPage.Name = "inventoryTabPage";
this.inventoryTabPage.Padding = new System.Windows.Forms.Padding(3);
this.inventoryTabPage.Size = new System.Drawing.Size(1462, 450);
this.inventoryTabPage.Size = new System.Drawing.Size(1470, 431);
this.inventoryTabPage.TabIndex = 4;
this.inventoryTabPage.Text = "Inventory";
this.inventoryTabPage.UseVisualStyleBackColor = true;
@@ -607,7 +597,7 @@
this.inventoryDataGridView.RowHeadersVisible = false;
this.inventoryDataGridView.RowTemplate.Height = 28;
this.inventoryDataGridView.ShowRowErrors = false;
this.inventoryDataGridView.Size = new System.Drawing.Size(1456, 444);
this.inventoryDataGridView.Size = new System.Drawing.Size(1464, 425);
this.inventoryDataGridView.TabIndex = 0;
//
// actualSalesTab
@@ -616,7 +606,7 @@
this.actualSalesTab.Location = new System.Drawing.Point(4, 29);
this.actualSalesTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.actualSalesTab.Name = "actualSalesTab";
this.actualSalesTab.Size = new System.Drawing.Size(1462, 450);
this.actualSalesTab.Size = new System.Drawing.Size(1470, 431);
this.actualSalesTab.TabIndex = 2;
this.actualSalesTab.Text = "Actual Sales";
this.actualSalesTab.UseVisualStyleBackColor = true;
@@ -632,8 +622,8 @@
this.actualSalesMainLayoutPanel.Name = "actualSalesMainLayoutPanel";
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, 450F));
this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1462, 450);
this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 431F));
this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1470, 431);
this.actualSalesMainLayoutPanel.TabIndex = 0;
//
// actualSalesMainDataGidView
@@ -653,7 +643,7 @@
this.actualSalesMainDataGidView.RowHeadersVisible = false;
this.actualSalesMainDataGidView.ShowCellErrors = false;
this.actualSalesMainDataGidView.ShowRowErrors = false;
this.actualSalesMainDataGidView.Size = new System.Drawing.Size(1454, 440);
this.actualSalesMainDataGidView.Size = new System.Drawing.Size(1462, 421);
this.actualSalesMainDataGidView.TabIndex = 1;
//
// suppliersTabPage
@@ -663,7 +653,7 @@
this.suppliersTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersTabPage.Name = "suppliersTabPage";
this.suppliersTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.suppliersTabPage.Size = new System.Drawing.Size(1462, 450);
this.suppliersTabPage.Size = new System.Drawing.Size(1470, 431);
this.suppliersTabPage.TabIndex = 1;
this.suppliersTabPage.Text = "Suppliers";
this.suppliersTabPage.UseVisualStyleBackColor = true;
@@ -683,7 +673,7 @@
this.suppliersDataGridView.Name = "suppliersDataGridView";
this.suppliersDataGridView.ReadOnly = true;
this.suppliersDataGridView.RowHeadersVisible = false;
this.suppliersDataGridView.Size = new System.Drawing.Size(1454, 440);
this.suppliersDataGridView.Size = new System.Drawing.Size(1462, 421);
this.suppliersDataGridView.TabIndex = 0;
//
// WeeklySalesTabPage
@@ -693,7 +683,7 @@
this.WeeklySalesTabPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.WeeklySalesTabPage.Name = "WeeklySalesTabPage";
this.WeeklySalesTabPage.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.WeeklySalesTabPage.Size = new System.Drawing.Size(1462, 450);
this.WeeklySalesTabPage.Size = new System.Drawing.Size(1470, 431);
this.WeeklySalesTabPage.TabIndex = 3;
this.WeeklySalesTabPage.Text = "Weekly Sales";
this.WeeklySalesTabPage.UseVisualStyleBackColor = true;
@@ -712,19 +702,26 @@
this.weeklySalesDataGridView.Name = "weeklySalesDataGridView";
this.weeklySalesDataGridView.ReadOnly = true;
this.weeklySalesDataGridView.RowHeadersVisible = false;
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1454, 440);
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1462, 421);
this.weeklySalesDataGridView.TabIndex = 0;
//
// frmMain
// newFormTestToolStripMenuItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1478, 794);
this.newFormTestToolStripMenuItem.Name = "newFormTestToolStripMenuItem";
this.newFormTestToolStripMenuItem.Size = new System.Drawing.Size(284, 30);
this.newFormTestToolStripMenuItem.Text = "&New Form Test";
this.newFormTestToolStripMenuItem.Click += new System.EventHandler(this.newFormTestToolStripMenuItem_Click);
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1486, 765);
this.Controls.Add(this.mainTableLayoutPanel);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.MaximizeBox = false;
this.Name = "frmMain";
this.Name = "FrmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Advertising Profit Control";
this.Load += new System.EventHandler(this.frmMain_Load);
@@ -737,10 +734,10 @@
this.commentMainGroupBox.PerformLayout();
this.profitAnalysisMainGroupBox.ResumeLayout(false);
this.profitAnalysisMainGroupBox.PerformLayout();
this.costOfSalesMainGroupBox.ResumeLayout(false);
this.costOfSalesMainGroupBox.PerformLayout();
this.grossProfitGroupBox.ResumeLayout(false);
this.grossProfitGroupBox.PerformLayout();
this.taxableGroupBox.ResumeLayout(false);
this.taxableGroupBox.PerformLayout();
this.dateSelectorPanel.ResumeLayout(false);
this.dateSelectorPanel.PerformLayout();
this.mainViewTabControl.ResumeLayout(false);
@@ -767,7 +764,7 @@
private System.Windows.Forms.TableLayoutPanel commentMainTableLayoutPanel;
private System.Windows.Forms.GroupBox commentMainGroupBox;
private System.Windows.Forms.GroupBox profitAnalysisMainGroupBox;
private System.Windows.Forms.GroupBox costOfSalesMainGroupBox;
private System.Windows.Forms.GroupBox grossProfitGroupBox;
private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu;
private System.Windows.Forms.TabControl mainViewTabControl;
private System.Windows.Forms.TabPage projectionTab;
@@ -791,12 +788,7 @@
private System.Windows.Forms.Label shrinkLabel;
private System.Windows.Forms.ToolStripMenuItem helpMainMenu;
private System.Windows.Forms.ToolStripMenuItem showHideConsoleHelpMainMenu;
private System.Windows.Forms.Label costOfSalesLabel;
private System.Windows.Forms.Label lessInventoryEndOfWeekAtCostLabel;
private System.Windows.Forms.Label totalLabel;
private System.Windows.Forms.Label plusTotalPurchases;
private System.Windows.Forms.Label inventoryBeginingOfWeekAtCostLabel;
private System.Windows.Forms.GroupBox grossProfitGroupBox;
private System.Windows.Forms.GroupBox taxableGroupBox;
private System.Windows.Forms.Label grossProfitEstimatedWeeklyDeptmartmentExpenseLabel;
private System.Windows.Forms.Label perfectGrossProfitLabel;
private System.Windows.Forms.Label grossProfitDollarGrossProfitLabel;
@@ -814,6 +806,11 @@
private System.Windows.Forms.ToolStripMenuItem deleteRecordsMainMenu;
private System.Windows.Forms.TextBox commentsTextBox;
private System.Windows.Forms.ToolStripMenuItem modifyRecordMainMenu;
private System.Windows.Forms.ToolStripMenuItem manageItemsToolsMainMenu;
private System.Windows.Forms.ToolStripMenuItem dbVersionHelpMainMenu;
private System.Windows.Forms.Button printPreviewButton;
private System.Windows.Forms.CheckBox usePreRenderedFilesCheckbox;
private System.Windows.Forms.ToolStripMenuItem newFormTestToolStripMenuItem;
}
}
+339 -210
View File
@@ -2,8 +2,11 @@
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
@@ -11,11 +14,13 @@ namespace AdvertsingProfitControl
{
public partial class FrmMain : Form
{
private double _gActualTotaSalesCalculatedTotal = 0;
private double _gActualTotalProfitReturnCalculatedTotal = 0;
private double _SalesProducedByAdItems = 0;
private double _TotalProfitReturnFromAdItems = 0;
private double _gCostOfSalesCalculatedTotal = 0;
private double _departmentSales = 0;
private List<string> _gDateStringCollection = new List<string>();
readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
private int _LazyPageCounter = 0;
public FrmMain()
{
@@ -28,10 +33,26 @@ namespace AdvertsingProfitControl
private void frmMain_Load(object sender, EventArgs e)
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var versionControl = new DatabaseVersionControl();
var version = versionControl.GetDatabaseVerionNumber(databaseTracker.DatabaseConnectionString);
if(version == "0.3.0.0")
{
MessageBox.Show("An older version of the APC database has been detected.\nAdvertising Profit Control " + Application.ProductVersion + " will now attempt to update it.", "Outdated Database Detected");
string versionNumber = "";
if (versionControl.UpdateVersionPointFive(databaseTracker.DatabaseConnectionString, out versionNumber))
{
MessageBox.Show("The database has been successfully upgraded to version " + versionNumber + ".\nA back up of the old database has been made called APCDatabase.bak in the same location as the current database.", "Half Baked Code For The Win");
}
}
RowParsing._adSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
FillDateSuggestionComboBoxes();
BuildAndFillDataGridTables();
CalculateProfitAnalysis();
CalculateGrossProfit();
//var margin = new Margins(50, 50, 0, 0);
//_printDoc.DefaultPageSettings.Margins = margin;
}
private void UpdateDataGridViewInformation(object sender, EventArgs e)
@@ -75,155 +96,37 @@ namespace AdvertsingProfitControl
//Now check to make sure there were no errors grabbing the ID, IF there were return.
if (dateId == "0") return;
//Clear the class global variables to prevents calculation mishaps.
_gActualTotaSalesCalculatedTotal = 0;
_gActualTotalProfitReturnCalculatedTotal = 0;
_SalesProducedByAdItems = 0;
_TotalProfitReturnFromAdItems = 0;
_gCostOfSalesCalculatedTotal = 0;
//Clear all DataGridViews since the date supplied is valid and in the database.
projectedSalesMainDataGrid.DataSource = null;
projectedSalesMainDataGrid.Columns.Clear();
inventoryDataGridView.DataSource = null;
inventoryDataGridView.Columns.Clear();
actualSalesMainDataGidView.DataSource = null;
actualSalesMainDataGidView.Columns.Clear();
suppliersDataGridView.DataSource = null;
weeklySalesDataGridView.DataSource = null;
var indexOfAdSpecialRow = -1;
var regexGroupCategoryparser = new Regex(@"^(\d)?\|\d");
//Begin by grabbing the Projections table
var tempTable = dataBaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString);
if (tempTable.Rows.Count > 0)
{
projectedSalesMainDataGrid.DataSource = SumSalesTable(tempTable);
var adCategory = "";
for (var i = 0; i < projectedSalesMainDataGrid.Rows.Count; i++)
{
if ((string)projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue == "1")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}else if ((string) projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue == "2")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (
regexGroupCategoryparser.IsMatch(
(string) projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue))
{
string[] spam = new string[2];
spam = ParseAdSpecialRows(projectedSalesMainDataGrid.Rows[i].Cells[7].EditedFormattedValue.ToString());
if (spam.Length > 1)
{
adCategory = spam[1];
}
else
{
adCategory = spam[0];
}
if (indexOfAdSpecialRow == -1)
{
indexOfAdSpecialRow = i;
}
if (spam[0] == "1")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}else if (spam[0] == "2")
{
projectedSalesMainDataGrid.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
}
var dataGridViewColumn = projectedSalesMainDataGrid.Columns["FK_GroupID"];
if (dataGridViewColumn != null)
dataGridViewColumn.Visible = false;
BuildSalesDataGridViews(projectedSalesMainDataGrid, tempTable);
}
//Grabbing the Inventory table
tempTable = dataBaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString);
if (tempTable.Rows.Count > 0)
{
inventoryDataGridView.DataSource = tempTable;
string adCategory = "";
for (var i = 0; i < inventoryDataGridView.Rows.Count; i++)
{
if ((string)inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue == "1")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if ((string)inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue == "2")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (
regexGroupCategoryparser.IsMatch(
(string)inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue))
{
string[] spam = new string[2];
spam = ParseAdSpecialRows(inventoryDataGridView.Rows[i].Cells[5].EditedFormattedValue.ToString());
if (spam.Length > 1)
{
adCategory = spam[1];
}
else
{
adCategory = spam[0];
}
if (spam[0] == "1")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if (spam[0] == "2")
{
inventoryDataGridView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
}
var dataGridViewColumn = inventoryDataGridView.Columns["FK_GroupID"];
if (dataGridViewColumn != null)
dataGridViewColumn.Visible = false;
BuildInventoryDataGridView(inventoryDataGridView, tempTable);
}
//And the Actual Sales table
tempTable = dataBaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString);
if (tempTable.Rows.Count > 0)
{
actualSalesMainDataGidView.DataSource = SumSalesTable(tempTable);
var adCategory = "";
for (var i = 0; i < actualSalesMainDataGidView.Rows.Count; i++)
{
if ((string)actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue == "1")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if ((string)actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue == "2")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
else if (
regexGroupCategoryparser.IsMatch(
(string)actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue))
{
string[] spam = new string[2];
spam = ParseAdSpecialRows(actualSalesMainDataGidView.Rows[i].Cells[7].EditedFormattedValue.ToString());
if (spam.Length > 1)
{
adCategory = spam[1];
}
else
{
adCategory = spam[0];
}
if (spam[0] == "1")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightGray;
}
else if (spam[0] == "2")
{
actualSalesMainDataGidView.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
}
}
var year = actualSalesMainDataGidView.Columns["FK_GroupID"];
if (year != null)
year.Visible = false;
BuildSalesDataGridViews(actualSalesMainDataGidView, tempTable);
}
//Next the Invoices table
@@ -245,7 +148,7 @@ namespace AdvertsingProfitControl
private void CalculateProfitAnalysis(double shrink = 0.30)
{
if (Math.Abs(_gActualTotaSalesCalculatedTotal) < 1 || Math.Abs(_gActualTotalProfitReturnCalculatedTotal) < 1)
if (Math.Abs(_SalesProducedByAdItems) < 1 || Math.Abs(_TotalProfitReturnFromAdItems) < 1)
{
//Clear the labels...
if (weeklySalesDataGridView.Rows.Count == 0 || weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString() == "0.0000")
@@ -254,14 +157,14 @@ namespace AdvertsingProfitControl
departmentSalesLabel.ForeColor = Color.Red;
}
if (_gActualTotaSalesCalculatedTotal == 0)
if (_SalesProducedByAdItems == 0)
{
salesProducedLabel.Text = "Sales Produced By Ad Items (A): No Values to Total.";
salesProducedLabel.ForeColor = Color.Red;
}
remainingSalesLabel.Text = "Remaining Sales: ";
if (_gActualTotalProfitReturnCalculatedTotal == 0)
if (_TotalProfitReturnFromAdItems == 0)
{
totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): No Values to Total.";
totalProfitFromAdItemsLabel.ForeColor = Color.Red;
@@ -271,31 +174,196 @@ namespace AdvertsingProfitControl
totalProfitReturnLabel.Text = "Total Profit Return: ";
return;
}
double departmentSales = 0;
Double.TryParse(weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString(), out departmentSales);
double.TryParse(weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString(), out _departmentSales);
//Since there are department sales, change the label's color to make sure it doesn't appear as an error.
departmentSalesLabel.ForeColor = Color.Black;
departmentSalesLabel.Text = "Department Sales: " + departmentSales.ToString("C");
departmentSalesLabel.Text = "Department Sales: " + _departmentSales.ToString("C");
//Assume that the sales produced is larger then zero (0).
salesProducedLabel.ForeColor = Color.Black;
salesProducedLabel.Text = "Sales Produced By Ad Items (A): " + _gActualTotaSalesCalculatedTotal.ToString("C");
salesProducedLabel.Text = "Sales Produced By Ad Items (A): " + _SalesProducedByAdItems.ToString("C");
double remainingSales = departmentSales - _gActualTotaSalesCalculatedTotal;
double remainingSales = _departmentSales - _SalesProducedByAdItems;
remainingSalesLabel.Text = "Remaining Sales: " + remainingSales.ToString("C");
//Again assume the total profit return is larger then zero (0).
totalProfitFromAdItemsLabel.ForeColor = Color.Black;
totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): " + _gActualTotalProfitReturnCalculatedTotal.ToString("C");
totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): " + _TotalProfitReturnFromAdItems.ToString("C");
//Shrink is being used as a place holder for Cross Profit % which is obtained by dividing gActualTotalProfitReturnCalculatedTotal by the department weekly retail sales.
double totalProfitReturnFromRemainingSales = shrink * remainingSales;
//
totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: " + totalProfitReturnFromRemainingSales.ToString("C");
double totalProfitReturn = _gActualTotalProfitReturnCalculatedTotal + totalProfitReturnFromRemainingSales;
double totalProfitReturn = _TotalProfitReturnFromAdItems + totalProfitReturnFromRemainingSales;
totalProfitReturnLabel.Text = "Total Profit Return: " + totalProfitReturn.ToString("C");
}
private void CalculateCostOfSales()
private void BuildSalesDataGridViews(DataGridView dataGridView, DataTable table)
{
//?
var adSpecialIndex = -1;
double totalSales = 0;
double totalProfitReturn = 0;
foreach (DataColumn column in table.Columns)
{
var dataGridViewColumn = new DataGridViewColumn()
{
HeaderText = column.ColumnName,
CellTemplate = new DataGridViewTextBoxCell()
};
if (dataGridViewColumn.HeaderText.Contains("Projection"))
{
dataGridViewColumn.HeaderText = dataGridViewColumn.HeaderText.Replace("Projection", "");
}
else if (dataGridViewColumn.HeaderText.Contains("Actual"))
{
dataGridViewColumn.HeaderText = dataGridViewColumn.HeaderText.Replace("Actual", "");
}
if (dataGridViewColumn.HeaderText == "FK_GroupID" || dataGridViewColumn.HeaderText == "RowAttribute")
{
dataGridViewColumn.Visible = false;
}
dataGridViewColumn.HeaderText = AddSpacesToSentence(dataGridViewColumn.HeaderText, false);
dataGridView.Columns.Add(dataGridViewColumn);
}
for (var i = 0; i < table.Rows.Count; i++)
{
var row = new DataGridViewRow();
//Checks for the group, if any, the row or rows is/are part of.
if (table.Rows[i][8].ToString() != "" &&
int.Parse(table.Rows[i][8].ToString()) != 0 && adSpecialIndex == -1)
{
adSpecialIndex = i;
var adSpecialRow = new DataGridViewRow();
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var groupName = databaseReader.ReturnGroupNameFromGroupId(table.Rows[i][8].ToString(), databaseTracker.DatabaseConnectionString);
adSpecialRow.DefaultCellStyle.BackColor = Color.DarkGray;
dataGridView.Rows.Add(adSpecialRow);
dataGridView.Rows[i].Cells[0].Value = groupName;
}
//Checks for row attribute
if (table.Rows[i][7].ToString() != "")
{
//The seventh column contains the row's attribute if any.
var rowAttribute = int.Parse(table.Rows[i][7].ToString());
if (rowAttribute == 1)
{
row.DefaultCellStyle.BackColor = Color.LightGray;
}
else if (rowAttribute == 2)
{
row.DefaultCellStyle.BackColor = Color.LightBlue;
}
foreach (var dataCell in table.Rows[i].ItemArray.Select(cell => new DataGridViewTextBoxCell { Value = cell }))
{
row.Cells.Add(dataCell);
}
dataGridView.Rows.Add(row);
}
else
{
dataGridView.Rows.Add(table.Rows[i].ItemArray);
}
//Check for values in the Total Sales and Total Profit Return columns
double tempOut = 0;
if (double.TryParse(table.Rows[i][3].ToString(), out tempOut))
{
if (tempOut >= 0)
{
totalSales += tempOut;
}
}
if (double.TryParse(table.Rows[i][6].ToString(), out tempOut))
{
if (tempOut >= 0)
{
totalProfitReturn += tempOut;
}
}
}
var totalsRow = new object[9];
totalsRow[0] = "Totals";
totalsRow[3] = totalSales;
totalsRow[6] = totalProfitReturn;
dataGridView.Rows.Add(totalsRow);
if (dataGridView.Name == "actualSalesMainDataGidView")
{
_SalesProducedByAdItems = totalSales;
_TotalProfitReturnFromAdItems = totalProfitReturn;
}
}
private void BuildInventoryDataGridView(DataGridView dataGridView, DataTable table)
{
var lastAdSpecialIndex = -1;
for (var columnIndex = 0; columnIndex < table.Columns.Count; columnIndex++)
{
var dataGridViewColumn = new DataGridViewColumn
{
Name = table.Columns[columnIndex].ColumnName,
CellTemplate = new DataGridViewTextBoxCell()
};
var columnHeaderText = table.Columns[columnIndex].ColumnName;
columnHeaderText = AddSpacesToSentence(columnHeaderText, false);
//Make the row attribute column invisible.
if (table.Columns[columnIndex].ColumnName == "RowAttribute")
{
dataGridViewColumn.Visible = false;
}
//Make any columns with a foreign key invisible.
if (table.Columns[columnIndex].ColumnName.Contains("FK"))
{
dataGridViewColumn.Visible = false;
}
dataGridViewColumn.HeaderText = columnHeaderText;
dataGridView.Columns.Add(dataGridViewColumn);
}
for (var rowIndex = 0; rowIndex < table.Rows.Count; rowIndex++)
{
var row = new DataGridViewRow();
if (table.Rows[rowIndex][6].ToString() != "" && int.Parse(table.Rows[rowIndex][6].ToString()) != 0 && lastAdSpecialIndex == -1)
{
lastAdSpecialIndex = rowIndex;
var adSpecialRow = new DataGridViewRow();
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var groupName = databaseReader.ReturnGroupNameFromGroupId(table.Rows[rowIndex][6].ToString(), databaseTracker.DatabaseConnectionString);
adSpecialRow.DefaultCellStyle.BackColor = Color.DarkGray;
dataGridView.Rows.Add(adSpecialRow);
dataGridView.Rows[rowIndex].Cells[0].Value = groupName;
}
if (table.Rows[rowIndex][5].ToString() != "")
{
//The fifth column contains the row's attribute if any.
var rowAttribute = int.Parse(table.Rows[rowIndex][5].ToString());
if (rowAttribute == 1)
{
row.DefaultCellStyle.BackColor = Color.LightGray;
}
else if (rowAttribute == 2)
{
row.DefaultCellStyle.BackColor = Color.LightBlue;
}
foreach (var dataCell in table.Rows[rowIndex].ItemArray.Select(cell => new DataGridViewTextBoxCell { Value = cell }))
{
row.Cells.Add(dataCell);
}
dataGridView.Rows.Add(row);
}
else
{
dataGridView.Rows.Add(table.Rows[rowIndex].ItemArray);
}
}
}
private void CalculateGrossProfit()
@@ -334,48 +402,6 @@ namespace AdvertsingProfitControl
CalculateGrossProfit();
}
/// <summary>
/// Appends a new "Totals" row to the end of the DataTable that is passed in
/// and sums up the Total Sales and Total Profit Return columns as well as
/// storing the Total Sales and Total Profit Return in their respective
/// class wide variables for use with other functions.
/// </summary>
/// <param name="table">The sales table to be summed up.</param>
/// <returns></returns>
private DataTable SumSalesTable(DataTable table)
{
//IF the table is null OR has an invalid column count then return.
if (table == null || table.Columns.Count < 7) return table;
//Both Projections and Actual tables have the Total Sales and Total Profit Return columns in the same position,
//indexes three (3) and six (6) respectively.
double totalSalesSum = 0;
double totalProfitReturnSum = 0;
for (var i = 0; i < table.Rows.Count; i++)
{
if (table.Rows[i][3].ToString() != "")
{
totalSalesSum += Convert.ToDouble(table.Rows[i][3]);
}
if (table.Rows[i][6].ToString() != "")
{
totalProfitReturnSum += Convert.ToDouble(table.Rows[i][6]);
}
}
//Once the totals have been calculated store them in the class wide variables so other methods can use them.
_gActualTotaSalesCalculatedTotal = totalSalesSum;
_gActualTotalProfitReturnCalculatedTotal = totalProfitReturnSum;
//Create an object array to store the summed values and add them at the end to the table before returning it.
object[] rowContents = new object[table.Columns.Count];
rowContents[0] = "Total";
rowContents[3] = totalSalesSum;
rowContents[6] = totalProfitReturnSum;
table.Rows.Add(rowContents);
return table;
}
/// <summary>
/// Appends a new "Totals" row to the end of the Invoice table that is passed in
/// and sums up the Net Cost of Invoices column as well as storing the total Costs of Sales
@@ -610,34 +636,6 @@ namespace AdvertsingProfitControl
CalculateGrossProfit();
}
private string[] ParseAdSpecialRows(string groupIdentifier)
{
var groupCategory = new string[2];
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var patternForOnlyPipeAndAdSpecial = new Regex(@"^\|\d{1}");
var patternForBothNumbersOnPipe = new Regex(@"^\d{1}\|\d{1}");
if (patternForOnlyPipeAndAdSpecial.IsMatch(groupIdentifier))
{
groupCategory[0] = groupIdentifier;
if (groupIdentifier[0].ToString() != "")
{
groupCategory[0] = groupCategory[0].Replace("|", "");
groupCategory[0] = databaseReader.ReturnGroupNameFromGroupId(groupCategory[0], databaseTracker.DatabaseConnectionString);
}
}else if (patternForBothNumbersOnPipe.IsMatch(groupIdentifier))
{
string[] temp = groupIdentifier.Split('|');
groupCategory[0] = temp[0];
groupCategory[1] = temp[1];
groupCategory[1] = databaseReader.ReturnGroupNameFromGroupId(groupCategory[1], databaseTracker.DatabaseConnectionString);
}
return groupCategory;
}
private void adSpecialKeyWordsToolsMainMenu_Click(object sender, EventArgs e)
{
var keyWordRegister = new FrmAdSpecialRegister();
@@ -662,6 +660,137 @@ namespace AdvertsingProfitControl
CalculateProfitAnalysis();
CalculateGrossProfit();
}
private void manageItemsToolsMainMenu_Click(object sender, EventArgs e)
{
var adItemManager = new FrmManageAdItems();
adItemManager.ShowDialog();
}
//http://stackoverflow.com/questions/272633/add-spaces-before-capital-letters
/// <summary>
/// Add spaces between all words that have capital letters
/// allowing for pretty looking column header text.
/// </summary>
/// <param name="text">The column header text to be made presentable.</param>
/// <param name="preserveAcronyms">Whether or not to do anything with text that's in all caps.</param>
/// <returns></returns>
private string AddSpacesToSentence(string text, bool preserveAcronyms)
{
if (string.IsNullOrWhiteSpace(text))
return string.Empty;
var newText = new StringBuilder(text.Length * 2);
newText.Append(text[0]);
for (var i = 1; i < text.Length; i++)
{
if (char.IsUpper(text[i]))
if ((text[i - 1] != ' ' && !char.IsUpper(text[i - 1])) ||
(preserveAcronyms && char.IsUpper(text[i - 1]) &&
i < text.Length - 1 && !char.IsUpper(text[i + 1])))
newText.Append(' ');
newText.Append(text[i]);
}
return newText.ToString();
}
private void dbVersionHelpMainMenu_Click(object sender, EventArgs e)
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var version = databaseReader.GetDatabaseVersion(databaseTracker.DatabaseConnectionString);
if (version != "0.0.0.0")
{
MessageBox.Show("The current database's version is " + version + ".", "Database Version Number");
}
}
private void PrintPage(object sender, PrintPageEventArgs e)
{
Bitmap bitMap;
if (_LazyPageCounter == 0)
{
bitMap = new Bitmap(Application.StartupPath + "\\FrontPage.png");
}
else
{
bitMap = new Bitmap(Application.StartupPath + "\\BackPage.png");
}
var rect = e.MarginBounds;
if ((double)bitMap.Width / (double)bitMap.Height > (double)rect.Width / (double)rect.Height) // image is wider
{
rect.Height = (int)((double)bitMap.Height / (double)bitMap.Width * (double)rect.Width);
}
else
{
rect.Width = (int)((double)bitMap.Width / (double)bitMap.Height * (double)rect.Height);
}
if (_LazyPageCounter == 0)
{
e.Graphics.DrawImage(bitMap, new Rectangle(0, 25, 850, 1050));
_LazyPageCounter++;
e.HasMorePages = true;
}
else
{
e.Graphics.DrawImage(bitMap, new Rectangle(0, 0, 850, 1100));
_LazyPageCounter = 0;
e.HasMorePages = false;
}
}
private void DisplayPrintPreview(object sender, EventArgs e)
{
//Build and render the front and back forms of the document.
var test = new FrontPageGenerator();
var backPageTest = new BackPageGenerator();
var printTestPage = new PrintDocument();
var printDialog = new PrintPreviewDialog();
if (!usePreRenderedFilesCheckbox.Checked)
{
var databaseTracker = new DatabaseTracker();
var databaseReader = new DatabaseReader();
var dateId =
databaseReader.RetrieveDateIdByDateString(
monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + yearComboBox.SelectedItem,
databaseTracker.DatabaseConnectionString);
double remaingingSales = _departmentSales - _SalesProducedByAdItems;
double totalProfitReturnFromReminaingSales = remaingingSales*.3;
double totalProfitReturn = _TotalProfitReturnFromAdItems + totalProfitReturnFromReminaingSales;
test.BuildFormFrontCompressedLayout(dateId, _departmentSales, _SalesProducedByAdItems, remaingingSales,
_TotalProfitReturnFromAdItems, totalProfitReturnFromReminaingSales, totalProfitReturn,
commentsTextBox.Text);
test.RenderHtmlToImage();
backPageTest.GenerateWeeklyInventoryControlPage(dateId);
backPageTest.RenderHtmlToImage();
}
else
{
if (File.Exists(Application.StartupPath + "\\" + "FrontPage.html") &&
File.Exists(Application.StartupPath + "\\" + "Backpage.html"))
{
test.RenderHtmlToImage();
backPageTest.RenderHtmlToImage();
}
}
//var margin = new Margins(50, 50, 0, 0);
//printDoc.DefaultPageSettings.Margins = margin;
printTestPage.PrintPage += PrintPage;
printDialog.Document = printTestPage;
printDialog.ShowDialog();
printDialog.Document = new PrintDocument();
}
private void newFormTestToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = new NewAddRecord();
form.ShowDialog();
}
}
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
+36 -32
View File
@@ -45,16 +45,16 @@
this.invoicesTabPage = new System.Windows.Forms.TabPage();
this.invoicesDataGridView = new System.Windows.Forms.DataGridView();
this.weeklySalesTabPage = new System.Windows.Forms.TabPage();
this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView();
this.secondaryTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.commentsGroupBox = new System.Windows.Forms.GroupBox();
this.commentsTextBox = new System.Windows.Forms.TextBox();
this.dateSelectorGroupBox = new System.Windows.Forms.GroupBox();
this.updateRecords = new System.Windows.Forms.Button();
this.notificationLabel = new System.Windows.Forms.Label();
this.yearComboBox = new System.Windows.Forms.ComboBox();
this.dayComboBox = new System.Windows.Forms.ComboBox();
this.monthComboBox = new System.Windows.Forms.ComboBox();
this.updateRecords = new System.Windows.Forms.Button();
this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView();
this.mainTableLayoutPanel.SuspendLayout();
this.mainMenu.SuspendLayout();
this.mainTabControl.SuspendLayout();
@@ -67,10 +67,10 @@
this.invoicesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.invoicesDataGridView)).BeginInit();
this.weeklySalesTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).BeginInit();
this.secondaryTableLayoutPanel.SuspendLayout();
this.commentsGroupBox.SuspendLayout();
this.dateSelectorGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).BeginInit();
this.SuspendLayout();
//
// mainTableLayoutPanel
@@ -129,7 +129,7 @@
// getAttributeToolStripMenuItem
//
this.getAttributeToolStripMenuItem.Name = "getAttributeToolStripMenuItem";
this.getAttributeToolStripMenuItem.Size = new System.Drawing.Size(199, 30);
this.getAttributeToolStripMenuItem.Size = new System.Drawing.Size(211, 30);
this.getAttributeToolStripMenuItem.Text = "Get Attribute";
this.getAttributeToolStripMenuItem.Click += new System.EventHandler(this.getAttributeToolStripMenuItem_Click);
//
@@ -189,6 +189,7 @@
//
// inventoryDataGridView
//
this.inventoryDataGridView.AllowDrop = true;
this.inventoryDataGridView.AllowUserToResizeRows = false;
this.inventoryDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.inventoryDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
@@ -214,6 +215,7 @@
//
// actualSalesDataGridView
//
this.actualSalesDataGridView.AllowDrop = true;
this.actualSalesDataGridView.AllowUserToResizeRows = false;
this.actualSalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.actualSalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
@@ -263,6 +265,19 @@
this.weeklySalesTabPage.Text = "Weekly Sales";
this.weeklySalesTabPage.UseVisualStyleBackColor = true;
//
// weeklySalesDataGridView
//
this.weeklySalesDataGridView.AllowUserToAddRows = false;
this.weeklySalesDataGridView.AllowUserToDeleteRows = false;
this.weeklySalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weeklySalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklySalesDataGridView.Location = new System.Drawing.Point(0, 0);
this.weeklySalesDataGridView.MultiSelect = false;
this.weeklySalesDataGridView.Name = "weeklySalesDataGridView";
this.weeklySalesDataGridView.RowTemplate.Height = 28;
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1164, 428);
this.weeklySalesDataGridView.TabIndex = 0;
//
// secondaryTableLayoutPanel
//
this.secondaryTableLayoutPanel.ColumnCount = 3;
@@ -274,13 +289,13 @@
this.secondaryTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.secondaryTableLayoutPanel.Controls.Add(this.commentsGroupBox, 0, 0);
this.secondaryTableLayoutPanel.Controls.Add(this.dateSelectorGroupBox, 1, 0);
this.secondaryTableLayoutPanel.Controls.Add(this.updateRecords, 2, 0);
this.secondaryTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.secondaryTableLayoutPanel.Location = new System.Drawing.Point(4, 514);
this.secondaryTableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.secondaryTableLayoutPanel.Name = "secondaryTableLayoutPanel";
this.secondaryTableLayoutPanel.RowCount = 1;
this.secondaryTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.secondaryTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.secondaryTableLayoutPanel.Size = new System.Drawing.Size(1172, 193);
this.secondaryTableLayoutPanel.TabIndex = 2;
//
@@ -306,6 +321,8 @@
//
// dateSelectorGroupBox
//
this.secondaryTableLayoutPanel.SetColumnSpan(this.dateSelectorGroupBox, 2);
this.dateSelectorGroupBox.Controls.Add(this.updateRecords);
this.dateSelectorGroupBox.Controls.Add(this.notificationLabel);
this.dateSelectorGroupBox.Controls.Add(this.yearComboBox);
this.dateSelectorGroupBox.Controls.Add(this.dayComboBox);
@@ -313,15 +330,26 @@
this.dateSelectorGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.dateSelectorGroupBox.Location = new System.Drawing.Point(393, 3);
this.dateSelectorGroupBox.Name = "dateSelectorGroupBox";
this.dateSelectorGroupBox.Size = new System.Drawing.Size(384, 187);
this.dateSelectorGroupBox.Size = new System.Drawing.Size(776, 187);
this.dateSelectorGroupBox.TabIndex = 1;
this.dateSelectorGroupBox.TabStop = false;
this.dateSelectorGroupBox.Text = "Select a date to modify:";
//
// updateRecords
//
this.updateRecords.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.updateRecords.Location = new System.Drawing.Point(598, 143);
this.updateRecords.Name = "updateRecords";
this.updateRecords.Size = new System.Drawing.Size(178, 40);
this.updateRecords.TabIndex = 2;
this.updateRecords.Text = "Update Records";
this.updateRecords.UseVisualStyleBackColor = true;
this.updateRecords.Click += new System.EventHandler(this.addRecords_Click);
//
// notificationLabel
//
this.notificationLabel.AutoSize = true;
this.notificationLabel.Location = new System.Drawing.Point(7, 122);
this.notificationLabel.Location = new System.Drawing.Point(6, 105);
this.notificationLabel.Name = "notificationLabel";
this.notificationLabel.Size = new System.Drawing.Size(0, 20);
this.notificationLabel.TabIndex = 3;
@@ -350,30 +378,6 @@
this.monthComboBox.Size = new System.Drawing.Size(121, 28);
this.monthComboBox.TabIndex = 0;
//
// updateRecords
//
this.updateRecords.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.updateRecords.Location = new System.Drawing.Point(991, 150);
this.updateRecords.Name = "updateRecords";
this.updateRecords.Size = new System.Drawing.Size(178, 40);
this.updateRecords.TabIndex = 2;
this.updateRecords.Text = "Update Records";
this.updateRecords.UseVisualStyleBackColor = true;
this.updateRecords.Click += new System.EventHandler(this.addRecords_Click);
//
// weeklySalesDataGridView
//
this.weeklySalesDataGridView.AllowUserToAddRows = false;
this.weeklySalesDataGridView.AllowUserToDeleteRows = false;
this.weeklySalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.weeklySalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.weeklySalesDataGridView.Location = new System.Drawing.Point(0, 0);
this.weeklySalesDataGridView.MultiSelect = false;
this.weeklySalesDataGridView.Name = "weeklySalesDataGridView";
this.weeklySalesDataGridView.RowTemplate.Height = 28;
this.weeklySalesDataGridView.Size = new System.Drawing.Size(1164, 428);
this.weeklySalesDataGridView.TabIndex = 0;
//
// FrmModifyRecord
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
@@ -402,12 +406,12 @@
this.invoicesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.invoicesDataGridView)).EndInit();
this.weeklySalesTabPage.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).EndInit();
this.secondaryTableLayoutPanel.ResumeLayout(false);
this.commentsGroupBox.ResumeLayout(false);
this.commentsGroupBox.PerformLayout();
this.dateSelectorGroupBox.ResumeLayout(false);
this.dateSelectorGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).EndInit();
this.ResumeLayout(false);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -10,7 +10,7 @@ namespace AdvertsingProfitControl
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
private static void Main()
{
Application.EnableVisualStyles();
@@ -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("0.8.5.0")]
[assembly: AssemblyFileVersion("0.8.5.0")]
[assembly: AssemblyVersion("0.9.5.2")]
[assembly: AssemblyFileVersion("0.9.5.2")]
+37 -20
View File
@@ -6,15 +6,15 @@ using System.Linq;
namespace AdvertsingProfitControl
{
class RowParsing
internal class RowParsing
{
public static List<string> _adSpecialGroups = new List<string>();
public string CheckForGroupKeyWord(string cellContents)
{
string[] weekendAdIdentifiers = {"Weekend Ad", "Valentines", "Affiliated Weekend Ad", "Daily Coupons", "New Years Ad", "Christmas", "Mother's Day"};
var keyWord = "NoGroupFound";
var query = from adI in weekendAdIdentifiers
var query = from adI in _adSpecialGroups
where adI.Equals(cellContents, StringComparison.InvariantCultureIgnoreCase)
select adI;
@@ -31,21 +31,21 @@ namespace AdvertsingProfitControl
/// </summary>
/// <param name="row">The row from a DataGridView object to be examined.</param>
/// <returns>The row's status, such as HeaderRow or NewRow.</returns>
public string GetRowAttribute(DataGridViewRow row)
public RowAttribute GetRowAttribute(DataGridViewRow row)
{
//IF the supplied row is null, then simply declare it an IncompleteRow.
if (row == null)
{
return "IncompleteRow";
return RowAttribute.IncompleteRow;
}
//IF the supplied row is a new row, by the definition of the DataGridViewRow class, then return NewRow.
if (row.IsNewRow)
{
return "NewRow";
return RowAttribute.NewRow;
}
var rowContents = new List<string>();
var rowAttribute = "MemberRow";
var rowAttribute = RowAttribute.MemberRow;
//Get the contents of the row that's being examined and add then to a List<string> array.
var i = 0;
foreach (DataGridViewCell cell in row.Cells)
@@ -59,10 +59,10 @@ namespace AdvertsingProfitControl
{
rowContents.Add(cell.EditedFormattedValue.ToString());
}
//If the first cell contains nothing, than return as IncompleteRow.
//If the first cell contains nothing, then return as IncompleteRow.
else if (cellContentsStripped == "" && i == 0)
{
return "IncompleteRow";
return RowAttribute.IncompleteRow;
}
i++;
}
@@ -71,7 +71,7 @@ namespace AdvertsingProfitControl
//cells with meaningful data in them. Which means that this row can be a header row with member rows under it.
if (rowContents.Count > 1)
{
rowAttribute = "HeaderRow";
rowAttribute = RowAttribute.HeaderRow;
}
else if (rowContents.Count == 1) //Check to see if this row is intended to be for a special ad.
{
@@ -79,21 +79,31 @@ namespace AdvertsingProfitControl
//IF a keyword is found then declare this row an AdSpecialRow.
if (keyWord != "NoGroupFound")
{
return "AdSpecialRow";
return RowAttribute.AdSpecialRow;
}
}
return rowAttribute;
}
public void PaintDataGridViewRowGroups(DataGridView dataGridView, int startIndex = 0,
public RowAttribute GetRowAttribute(object[] row)
{
var rowAttribute = RowAttribute.MemberRow;
return rowAttribute;
}
public void PaintDataGridViewRowGroups(DataGridView dataGridView, DataGridView companionDataGridView = null, int startIndex = 0,
bool stopOnFirstFullGroupFound = false)
{
}
/// <summary>
/// Checks for the presents of a repeat command using the Regex engine.
/// Checks for the presents of a repeat command using the Reg-ex engine.
/// If a repeat command is found it returns the line number the command
/// specifies to repeat.
/// </summary>
@@ -101,18 +111,25 @@ namespace AdvertsingProfitControl
/// <returns>Line number to be repeated, -1 if no command is found.</returns>
public int CheckForRepeatCommand(string rowCommandField)
{
var repeatCommandPattern = @"^repeat( line)?:? [0-9]"; //Reference sheet: https://msdn.microsoft.com/en-us/library/az24scfc.aspx
const string repeatCommandPattern = @"^repeat( line)?:? [0-9]"; //Reference sheet: https://msdn.microsoft.com/en-us/library/az24scfc.aspx
var rgx = new Regex(repeatCommandPattern, RegexOptions.IgnoreCase);
var lineNumber = -1;
if (rgx.IsMatch(rowCommandField))
{
//Parse the string and retrieve the line number
var numbers = Regex.Split(rowCommandField, @"\D+");
if (!rgx.IsMatch(rowCommandField)) return lineNumber;
//Parse the string and retrieve the line number
var numbers = Regex.Split(rowCommandField, @"\D+");
lineNumber = int.Parse(numbers[1]);
}
lineNumber = int.Parse(numbers[1]);
return lineNumber;
}
}
public enum RowAttribute
{
NewRow = 0,
MemberRow = 1,
HeaderRow = 2,
AdSpecialRow = 3,
IncompleteRow = 4
}
}