Organized the code a bit, and fixed a bug where selecting a new date wouldn't update the modify record form. Prettied up the formatting for the invoices table.
This commit is contained in:
+10
-8
@@ -38,6 +38,7 @@
|
|||||||
this.modifyRecordMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.modifyRecordMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.deleteRecordsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.deleteRecordsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.newFormTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.newFormTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.newModifyRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.toolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.adSpecialKeyWordsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.adSpecialKeyWordsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.manageItemsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.manageItemsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@@ -85,7 +86,6 @@
|
|||||||
this.taxableDataGridView = new System.Windows.Forms.DataGridView();
|
this.taxableDataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.debugTabPage = new System.Windows.Forms.TabPage();
|
this.debugTabPage = new System.Windows.Forms.TabPage();
|
||||||
this.monthCalendar = new System.Windows.Forms.MonthCalendar();
|
this.monthCalendar = new System.Windows.Forms.MonthCalendar();
|
||||||
this.newModifyRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.mainTableLayoutPanel.SuspendLayout();
|
this.mainTableLayoutPanel.SuspendLayout();
|
||||||
this.mainMenu.SuspendLayout();
|
this.mainMenu.SuspendLayout();
|
||||||
this.commentMainTableLayoutPanel.SuspendLayout();
|
this.commentMainTableLayoutPanel.SuspendLayout();
|
||||||
@@ -187,9 +187,11 @@
|
|||||||
//
|
//
|
||||||
// deleteRecordsMainMenu
|
// deleteRecordsMainMenu
|
||||||
//
|
//
|
||||||
|
this.deleteRecordsMainMenu.Enabled = false;
|
||||||
this.deleteRecordsMainMenu.Name = "deleteRecordsMainMenu";
|
this.deleteRecordsMainMenu.Name = "deleteRecordsMainMenu";
|
||||||
this.deleteRecordsMainMenu.Size = new System.Drawing.Size(323, 34);
|
this.deleteRecordsMainMenu.Size = new System.Drawing.Size(323, 34);
|
||||||
this.deleteRecordsMainMenu.Text = "&Delete Existing record";
|
this.deleteRecordsMainMenu.Text = "&Delete Existing record";
|
||||||
|
this.deleteRecordsMainMenu.ToolTipText = "Currently Unavailable in this Version.";
|
||||||
this.deleteRecordsMainMenu.Click += new System.EventHandler(this.deleteRecordsMainMenu_Click);
|
this.deleteRecordsMainMenu.Click += new System.EventHandler(this.deleteRecordsMainMenu_Click);
|
||||||
//
|
//
|
||||||
// newFormTestToolStripMenuItem
|
// newFormTestToolStripMenuItem
|
||||||
@@ -199,6 +201,13 @@
|
|||||||
this.newFormTestToolStripMenuItem.Text = "&New Form Test";
|
this.newFormTestToolStripMenuItem.Text = "&New Form Test";
|
||||||
this.newFormTestToolStripMenuItem.Click += new System.EventHandler(this.newFormTestToolStripMenuItem_Click);
|
this.newFormTestToolStripMenuItem.Click += new System.EventHandler(this.newFormTestToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
|
// newModifyRecordToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.newModifyRecordToolStripMenuItem.Name = "newModifyRecordToolStripMenuItem";
|
||||||
|
this.newModifyRecordToolStripMenuItem.Size = new System.Drawing.Size(323, 34);
|
||||||
|
this.newModifyRecordToolStripMenuItem.Text = "New Modify Record";
|
||||||
|
this.newModifyRecordToolStripMenuItem.Click += new System.EventHandler(this.newModifyRecordToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// toolsMainMenu
|
// toolsMainMenu
|
||||||
//
|
//
|
||||||
this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
@@ -762,13 +771,6 @@
|
|||||||
this.monthCalendar.TabIndex = 0;
|
this.monthCalendar.TabIndex = 0;
|
||||||
this.monthCalendar.TabStop = false;
|
this.monthCalendar.TabStop = false;
|
||||||
//
|
//
|
||||||
// newModifyRecordToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.newModifyRecordToolStripMenuItem.Name = "newModifyRecordToolStripMenuItem";
|
|
||||||
this.newModifyRecordToolStripMenuItem.Size = new System.Drawing.Size(323, 34);
|
|
||||||
this.newModifyRecordToolStripMenuItem.Text = "New Modify Record";
|
|
||||||
this.newModifyRecordToolStripMenuItem.Click += new System.EventHandler(this.newModifyRecordToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// FrmMain
|
// FrmMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F);
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace AdvertsingProfitControl
|
|||||||
set { base.Text = value; }
|
set { base.Text = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Global Event Handlers
|
#region Global Text Box Events
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the beginning value in a text box into the _beginningCellValue field.
|
/// Stores the beginning value in a text box into the _beginningCellValue field.
|
||||||
@@ -2110,6 +2110,8 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Date Time Events
|
||||||
|
|
||||||
private void ValidateDateChanged(object sender, DateRangeEventArgs e)
|
private void ValidateDateChanged(object sender, DateRangeEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Start == _currentActiveDate || !weekEndingCalendar.BoldedDates.Contains(e.Start)) return;
|
if (e.Start == _currentActiveDate || !weekEndingCalendar.BoldedDates.Contains(e.Start)) return;
|
||||||
@@ -2118,7 +2120,8 @@ namespace AdvertsingProfitControl
|
|||||||
var result = MessageBox.Show(@"Would you like to save the changes you have made to this record?", @"Changes Detected", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
var result = MessageBox.Show(@"Would you like to save the changes you have made to this record?", @"Changes Detected", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
_currentActiveDate = e.Start;
|
//_currentActiveDate = e.Start;
|
||||||
|
//Save the changes made to the database then clear and load the date picked by the user.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2126,6 +2129,7 @@ namespace AdvertsingProfitControl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_currentActiveDate = e.Start;
|
||||||
Text = @"Modify Record (Current Record: " + e.Start.ToString("d") + @")";
|
Text = @"Modify Record (Current Record: " + e.Start.ToString("d") + @")";
|
||||||
//Clear the form state.
|
//Clear the form state.
|
||||||
ClearFormState();
|
ClearFormState();
|
||||||
@@ -2133,60 +2137,7 @@ namespace AdvertsingProfitControl
|
|||||||
LoadDate(e.Start);
|
LoadDate(e.Start);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadDate(DateTime date)
|
#endregion
|
||||||
{
|
|
||||||
var databaseTracker = new DatabaseTracker();
|
|
||||||
var databaseReader = new DatabaseReader();
|
|
||||||
var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"), databaseTracker.DatabaseConnectionString);
|
|
||||||
var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString);
|
|
||||||
var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString);
|
|
||||||
var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString);
|
|
||||||
LoadProjectionsTable(projections);
|
|
||||||
LoadInventory(inventory);
|
|
||||||
LoadActualSales(actualSales);
|
|
||||||
var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString);
|
|
||||||
var comments = databaseReader.RetrieveComments(int.Parse(dateId), databaseTracker.DatabaseConnectionString);
|
|
||||||
if (comments.Count == 2)
|
|
||||||
{
|
|
||||||
LoadComments(int.Parse(comments[0]), comments[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LogConsole.WriteToLog(FrmLogConsole.Level.Info, "No comments to display for the date of " + _currentActiveDate.ToString("d") + ".");
|
|
||||||
informationLabel.Text += @"No comments to display." + Environment.NewLine;
|
|
||||||
}
|
|
||||||
var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId,
|
|
||||||
databaseTracker.DatabaseConnectionString);
|
|
||||||
if (weeklySales.Rows.Count == 1)
|
|
||||||
{
|
|
||||||
LoadWeeklySales(weeklySales);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
informationLabel.Text += @"No weekly sales to display." + Environment.NewLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
var taxable = databaseReader.ReturnTaxableFromDateId(dateId, databaseTracker.DatabaseConnectionString);
|
|
||||||
if (taxable.Rows.Count == 1)
|
|
||||||
{
|
|
||||||
LoadTaxable(taxable);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
informationLabel.Text += @"No taxable data to display." + Environment.NewLine;
|
|
||||||
}
|
|
||||||
LoadInvoices(invoices);
|
|
||||||
var costAnalysis = databaseReader.ReturnCostAnalysis(int.Parse(dateId),
|
|
||||||
databaseTracker.DatabaseConnectionString);
|
|
||||||
if (costAnalysis.Rows.Count == 1)
|
|
||||||
{
|
|
||||||
LoadCostAnalysis(costAnalysis);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
informationLabel.Text += @"No cost analysis data to display." + Environment.NewLine;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClearFormState()
|
private void ClearFormState()
|
||||||
{
|
{
|
||||||
@@ -2377,6 +2328,60 @@ namespace AdvertsingProfitControl
|
|||||||
|
|
||||||
#region Data Loading Methods
|
#region Data Loading Methods
|
||||||
|
|
||||||
|
private void LoadDate(DateTime date)
|
||||||
|
{
|
||||||
|
var databaseTracker = new DatabaseTracker();
|
||||||
|
var databaseReader = new DatabaseReader();
|
||||||
|
var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"), databaseTracker.DatabaseConnectionString);
|
||||||
|
var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
|
var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
|
var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
|
LoadProjectionsTable(projections);
|
||||||
|
LoadInventory(inventory);
|
||||||
|
LoadActualSales(actualSales);
|
||||||
|
var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
|
var comments = databaseReader.RetrieveComments(int.Parse(dateId), databaseTracker.DatabaseConnectionString);
|
||||||
|
if (comments.Count == 2)
|
||||||
|
{
|
||||||
|
LoadComments(int.Parse(comments[0]), comments[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
informationLabel.Text += @"No comments to display." + Environment.NewLine;
|
||||||
|
}
|
||||||
|
var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId,
|
||||||
|
databaseTracker.DatabaseConnectionString);
|
||||||
|
if (weeklySales.Rows.Count == 1)
|
||||||
|
{
|
||||||
|
LoadWeeklySales(weeklySales);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
informationLabel.Text += @"No sales to display." + Environment.NewLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
var taxable = databaseReader.ReturnTaxableFromDateId(dateId, databaseTracker.DatabaseConnectionString);
|
||||||
|
if (taxable.Rows.Count == 1)
|
||||||
|
{
|
||||||
|
LoadTaxable(taxable);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
informationLabel.Text += @"No taxable data to display." + Environment.NewLine;
|
||||||
|
}
|
||||||
|
LoadInvoices(invoices);
|
||||||
|
var costAnalysis = databaseReader.ReturnCostAnalysis(int.Parse(dateId),
|
||||||
|
databaseTracker.DatabaseConnectionString);
|
||||||
|
if (costAnalysis.Rows.Count == 1)
|
||||||
|
{
|
||||||
|
LoadCostAnalysis(costAnalysis);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
informationLabel.Text += @"No cost analysis data to display." + Environment.NewLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadProjectionsTable(DataTable projections)
|
private void LoadProjectionsTable(DataTable projections)
|
||||||
{
|
{
|
||||||
//Assuming all the tables are correctly aligned.
|
//Assuming all the tables are correctly aligned.
|
||||||
@@ -2658,34 +2663,29 @@ namespace AdvertsingProfitControl
|
|||||||
var row = new DataGridViewRow();
|
var row = new DataGridViewRow();
|
||||||
for (var cellIndex = 0; cellIndex < invoices.Rows[rowIndex].ItemArray.Length; cellIndex++)
|
for (var cellIndex = 0; cellIndex < invoices.Rows[rowIndex].ItemArray.Length; cellIndex++)
|
||||||
{
|
{
|
||||||
//Get the
|
var cell = new DataGridViewTextBoxCell();
|
||||||
//Format the invoice date.
|
//Format the invoice date.
|
||||||
if (cellIndex == 1)
|
if (cellIndex == 1)
|
||||||
{
|
{
|
||||||
var date = DateTime.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
var date = DateTime.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
||||||
var cell = new DataGridViewTextBoxCell
|
cell.Value = date.ToString("d");
|
||||||
{
|
|
||||||
Value = date.ToString("d")
|
|
||||||
};
|
|
||||||
row.Cells.Add(cell);
|
row.Cells.Add(cell);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (invoices.Rows[rowIndex].ItemArray[cellIndex].ToString() != "0")
|
//Apply formatting to the only cells that will have currency values in them.
|
||||||
|
if (cellIndex == 4 || cellIndex == 5)
|
||||||
{
|
{
|
||||||
var cell = new DataGridViewTextBoxCell
|
var formattedNumber = Math.Round(double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
||||||
|
if (formattedNumber != "0.00")
|
||||||
{
|
{
|
||||||
Value = invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()
|
cell.Value = formattedNumber;
|
||||||
};
|
}
|
||||||
row.Cells.Add(cell);
|
row.Cells.Add(cell);
|
||||||
}
|
continue;
|
||||||
else
|
}
|
||||||
{
|
//No special formatting rules here so just put the value in and move on.
|
||||||
var cell = new DataGridViewTextBoxCell
|
cell.Value = invoices.Rows[rowIndex].ItemArray[cellIndex].ToString();
|
||||||
{
|
row.Cells.Add(cell);
|
||||||
Value = ""
|
|
||||||
};
|
|
||||||
row.Cells.Add(cell);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
invoicesDataGridView.Rows.Add(row);
|
invoicesDataGridView.Rows.Add(row);
|
||||||
}
|
}
|
||||||
@@ -2995,11 +2995,17 @@ namespace AdvertsingProfitControl
|
|||||||
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Database Update/Insertion Methods
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//private void NormalizeApcTables(DataTable projections, DataTable inventory, DataTable actualSales, string dateId)
|
//private void NormalizeApcTables(DataTable projections, DataTable inventory, DataTable actualSales, string dateId)
|
||||||
//{
|
//{
|
||||||
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||||
</dsig:Transforms>
|
</dsig:Transforms>
|
||||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||||
<dsig:DigestValue>v/vV1JQ1KwJ475DzlF/9pMJ1BiE2M9/K5exyQW56JdA=</dsig:DigestValue>
|
<dsig:DigestValue>zpbkgJk14ECDIZQitxLLt8pDxjsgaGNLCsn6A15FHiw=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -43,14 +43,14 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3606016">
|
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3606528">
|
||||||
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
|
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
|
||||||
<hash>
|
<hash>
|
||||||
<dsig:Transforms>
|
<dsig:Transforms>
|
||||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||||
</dsig:Transforms>
|
</dsig:Transforms>
|
||||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||||
<dsig:DigestValue>X9LoHKI4Q8rmL073oAPMcfETygEZnYWzLirYaKYjcvQ=</dsig:DigestValue>
|
<dsig:DigestValue>RfwzuWZMEhfrUq7aBd3p9sX+V5RWL5yDo9XNd2Uj/JM=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
Reference in New Issue
Block a user