Updated the main form to allow the user to be able to select dates from the database. Updated information displaying on the main form.
This commit is contained in:
+9
-23
@@ -86,7 +86,6 @@
|
||||
this.invoicesDataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.commentsAndAnalysisLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.costAnalysisGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.informationLabel = new System.Windows.Forms.Label();
|
||||
this.suppliesLabel = new System.Windows.Forms.Label();
|
||||
this.salaryDollarsLabel = new System.Windows.Forms.Label();
|
||||
this.salaryPercentageLabel = new System.Windows.Forms.Label();
|
||||
@@ -309,9 +308,8 @@
|
||||
this.errorLabel.AutoSize = true;
|
||||
this.errorLabel.Location = new System.Drawing.Point(11, 246);
|
||||
this.errorLabel.Name = "errorLabel";
|
||||
this.errorLabel.Size = new System.Drawing.Size(62, 25);
|
||||
this.errorLabel.Size = new System.Drawing.Size(0, 25);
|
||||
this.errorLabel.TabIndex = 8;
|
||||
this.errorLabel.Text = "errors";
|
||||
//
|
||||
// shrinkLinkLabel
|
||||
//
|
||||
@@ -498,7 +496,7 @@
|
||||
// mondayTaxableLabel
|
||||
//
|
||||
this.mondayTaxableLabel.AutoSize = true;
|
||||
this.mondayTaxableLabel.Location = new System.Drawing.Point(6, 61);
|
||||
this.mondayTaxableLabel.Location = new System.Drawing.Point(6, 67);
|
||||
this.mondayTaxableLabel.Name = "mondayTaxableLabel";
|
||||
this.mondayTaxableLabel.Size = new System.Drawing.Size(89, 25);
|
||||
this.mondayTaxableLabel.TabIndex = 7;
|
||||
@@ -507,7 +505,7 @@
|
||||
// tuesdayTaxableLabel
|
||||
//
|
||||
this.tuesdayTaxableLabel.AutoSize = true;
|
||||
this.tuesdayTaxableLabel.Location = new System.Drawing.Point(6, 93);
|
||||
this.tuesdayTaxableLabel.Location = new System.Drawing.Point(6, 100);
|
||||
this.tuesdayTaxableLabel.Name = "tuesdayTaxableLabel";
|
||||
this.tuesdayTaxableLabel.Size = new System.Drawing.Size(95, 25);
|
||||
this.tuesdayTaxableLabel.TabIndex = 6;
|
||||
@@ -516,7 +514,7 @@
|
||||
// saturdayTaxableLabel
|
||||
//
|
||||
this.saturdayTaxableLabel.AutoSize = true;
|
||||
this.saturdayTaxableLabel.Location = new System.Drawing.Point(6, 221);
|
||||
this.saturdayTaxableLabel.Location = new System.Drawing.Point(6, 232);
|
||||
this.saturdayTaxableLabel.Name = "saturdayTaxableLabel";
|
||||
this.saturdayTaxableLabel.Size = new System.Drawing.Size(97, 25);
|
||||
this.saturdayTaxableLabel.TabIndex = 5;
|
||||
@@ -525,7 +523,7 @@
|
||||
// totalTaxableLabel
|
||||
//
|
||||
this.totalTaxableLabel.AutoSize = true;
|
||||
this.totalTaxableLabel.Location = new System.Drawing.Point(6, 253);
|
||||
this.totalTaxableLabel.Location = new System.Drawing.Point(6, 265);
|
||||
this.totalTaxableLabel.Name = "totalTaxableLabel";
|
||||
this.totalTaxableLabel.Size = new System.Drawing.Size(62, 25);
|
||||
this.totalTaxableLabel.TabIndex = 4;
|
||||
@@ -534,7 +532,7 @@
|
||||
// fridayTaxableLabel
|
||||
//
|
||||
this.fridayTaxableLabel.AutoSize = true;
|
||||
this.fridayTaxableLabel.Location = new System.Drawing.Point(6, 189);
|
||||
this.fridayTaxableLabel.Location = new System.Drawing.Point(6, 199);
|
||||
this.fridayTaxableLabel.Name = "fridayTaxableLabel";
|
||||
this.fridayTaxableLabel.Size = new System.Drawing.Size(72, 25);
|
||||
this.fridayTaxableLabel.TabIndex = 3;
|
||||
@@ -543,7 +541,7 @@
|
||||
// thursdayTaxableLabel
|
||||
//
|
||||
this.thursdayTaxableLabel.AutoSize = true;
|
||||
this.thursdayTaxableLabel.Location = new System.Drawing.Point(6, 157);
|
||||
this.thursdayTaxableLabel.Location = new System.Drawing.Point(6, 166);
|
||||
this.thursdayTaxableLabel.Name = "thursdayTaxableLabel";
|
||||
this.thursdayTaxableLabel.Size = new System.Drawing.Size(101, 25);
|
||||
this.thursdayTaxableLabel.TabIndex = 2;
|
||||
@@ -552,7 +550,7 @@
|
||||
// wednesdayTaxableLabel
|
||||
//
|
||||
this.wednesdayTaxableLabel.AutoSize = true;
|
||||
this.wednesdayTaxableLabel.Location = new System.Drawing.Point(6, 125);
|
||||
this.wednesdayTaxableLabel.Location = new System.Drawing.Point(6, 133);
|
||||
this.wednesdayTaxableLabel.Name = "wednesdayTaxableLabel";
|
||||
this.wednesdayTaxableLabel.Size = new System.Drawing.Size(124, 25);
|
||||
this.wednesdayTaxableLabel.TabIndex = 1;
|
||||
@@ -561,7 +559,7 @@
|
||||
// sundayTaxableLabel
|
||||
//
|
||||
this.sundayTaxableLabel.AutoSize = true;
|
||||
this.sundayTaxableLabel.Location = new System.Drawing.Point(6, 29);
|
||||
this.sundayTaxableLabel.Location = new System.Drawing.Point(6, 31);
|
||||
this.sundayTaxableLabel.Name = "sundayTaxableLabel";
|
||||
this.sundayTaxableLabel.Size = new System.Drawing.Size(86, 25);
|
||||
this.sundayTaxableLabel.TabIndex = 0;
|
||||
@@ -576,7 +574,6 @@
|
||||
this.dateTimeGroupBox.Size = new System.Drawing.Size(349, 323);
|
||||
this.dateTimeGroupBox.TabIndex = 5;
|
||||
this.dateTimeGroupBox.TabStop = false;
|
||||
this.dateTimeGroupBox.Text = "Select a date to view";
|
||||
//
|
||||
// monthCalendar
|
||||
//
|
||||
@@ -754,7 +751,6 @@
|
||||
//
|
||||
// costAnalysisGroupBox
|
||||
//
|
||||
this.costAnalysisGroupBox.Controls.Add(this.informationLabel);
|
||||
this.costAnalysisGroupBox.Controls.Add(this.suppliesLabel);
|
||||
this.costAnalysisGroupBox.Controls.Add(this.salaryDollarsLabel);
|
||||
this.costAnalysisGroupBox.Controls.Add(this.salaryPercentageLabel);
|
||||
@@ -768,15 +764,6 @@
|
||||
this.costAnalysisGroupBox.TabStop = false;
|
||||
this.costAnalysisGroupBox.Text = "Cost Analysis";
|
||||
//
|
||||
// informationLabel
|
||||
//
|
||||
this.informationLabel.AutoSize = true;
|
||||
this.informationLabel.Location = new System.Drawing.Point(13, 178);
|
||||
this.informationLabel.Name = "informationLabel";
|
||||
this.informationLabel.Size = new System.Drawing.Size(43, 25);
|
||||
this.informationLabel.TabIndex = 9;
|
||||
this.informationLabel.Text = "info";
|
||||
//
|
||||
// suppliesLabel
|
||||
//
|
||||
this.suppliesLabel.AutoSize = true;
|
||||
@@ -1030,7 +1017,6 @@
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.GroupBox grossProfitGroupBox;
|
||||
private System.Windows.Forms.Label errorLabel;
|
||||
private System.Windows.Forms.Label informationLabel;
|
||||
private System.Windows.Forms.TabControl mainViewTabControl;
|
||||
private System.Windows.Forms.TabPage projectionTab;
|
||||
private System.Windows.Forms.DataGridView projectionsDataGridView;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
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.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AdvertsingProfitControl
|
||||
@@ -17,8 +15,9 @@ namespace AdvertsingProfitControl
|
||||
private double _totalProfitReturnFromAdItems;
|
||||
private double _totalInvoicePurchases; //Total Purchases
|
||||
private double _departmentSales; //weekly sales total
|
||||
private DateTime _currentActiveDate;
|
||||
readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance;
|
||||
private int _LazyPageCounter = 0;
|
||||
private int _LazyPageCounter;
|
||||
|
||||
public FrmMain()
|
||||
{
|
||||
@@ -29,14 +28,15 @@ namespace AdvertsingProfitControl
|
||||
{
|
||||
var databaseTracker = new DatabaseTracker();
|
||||
var databaseReader = new DatabaseReader();
|
||||
monthCalendar.BoldedDates = databaseReader.RetrieveDates(databaseTracker.DatabaseConnectionString).ToArray();
|
||||
RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString));
|
||||
ConstructApcDataGridViews();
|
||||
ConstructInvoicesDataGridView();
|
||||
var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString);
|
||||
monthCalendar.SelectionStart = date;
|
||||
_currentActiveDate = date;
|
||||
LoadDate(date);
|
||||
CalculateProfitAnalysis();
|
||||
CalculateGrossProfit();
|
||||
monthCalendar.DateChanged += ValidateDateChanged;
|
||||
//projectionsDataGridView.KeyDown += FrmMain_KeyDown;
|
||||
//var margin = new Margins(50, 50, 0, 0);
|
||||
//_printDoc.DefaultPageSettings.Margins = margin;
|
||||
@@ -44,6 +44,16 @@ namespace AdvertsingProfitControl
|
||||
|
||||
private void CalculateProfitAnalysis(double shrink = 0.30)
|
||||
{
|
||||
if (actualSalesDataGridView.Rows.Count == 0)
|
||||
{
|
||||
salesProducedLabel.Text = @"Sales Produced By Ad Items (A): No Data";
|
||||
totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): No Data";
|
||||
if (Math.Abs(_departmentSales) < 1)
|
||||
{
|
||||
departmentSalesLabel.Text = @"Department Sales: No Data";
|
||||
}
|
||||
return;
|
||||
}
|
||||
var incompleteData = false;
|
||||
//First grab the total sales and the total profit return generated by the actual sales of product.
|
||||
if (
|
||||
@@ -357,7 +367,7 @@ namespace AdvertsingProfitControl
|
||||
errorLabel.Text = @"Failed to get the date ID number, aborting load operation." + Environment.NewLine;
|
||||
return;
|
||||
}
|
||||
informationLabel.Text = @"Loading data for " + date.ToString("d") + "." + Environment.NewLine;
|
||||
ClearForm();
|
||||
var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||
var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString);
|
||||
var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString);
|
||||
@@ -374,7 +384,7 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
else
|
||||
{
|
||||
informationLabel.Text += @"No comments to display." + Environment.NewLine;
|
||||
commentMainGroupBox.Text = @"Comments (None to Display)";
|
||||
}
|
||||
var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId,
|
||||
databaseTracker.DatabaseConnectionString);
|
||||
@@ -384,7 +394,7 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
else
|
||||
{
|
||||
informationLabel.Text += @"No sales to display." + Environment.NewLine;
|
||||
weeklySalesGroupBox.Text = @"Weekly Sales (Nothing to Display)";
|
||||
}
|
||||
|
||||
var taxable = databaseReader.ReturnTaxableFromDateId(dateId, databaseTracker.DatabaseConnectionString);
|
||||
@@ -394,7 +404,7 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
else
|
||||
{
|
||||
informationLabel.Text += @"No taxable data to display." + Environment.NewLine;
|
||||
taxableGroupBox.Text = @"Taxable (Nothing to Display)";
|
||||
}
|
||||
var costAnalysis = databaseReader.ReturnCostAnalysis(dateId,
|
||||
databaseTracker.DatabaseConnectionString);
|
||||
@@ -404,8 +414,11 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
else
|
||||
{
|
||||
informationLabel.Text += @"No cost analysis data to display." + Environment.NewLine;
|
||||
costAnalysisGroupBox.Text = @"Cost Analysis (Nothing to Display)";
|
||||
}
|
||||
CalculateProfitAnalysis();
|
||||
CalculateGrossProfit();
|
||||
dateTimeGroupBox.Text = @"Loaded " + date.ToString("d");
|
||||
}
|
||||
|
||||
private void LoadProjectionsTable(DataTable projections)
|
||||
@@ -1148,6 +1161,59 @@ namespace AdvertsingProfitControl
|
||||
}
|
||||
return holidayText;
|
||||
}
|
||||
|
||||
private void ValidateDateChanged(object sender, DateRangeEventArgs e)
|
||||
{
|
||||
if (e.Start == _currentActiveDate || !monthCalendar.BoldedDates.Contains(e.Start)) return;
|
||||
_currentActiveDate = e.Start;
|
||||
//Load the specified date from the database.
|
||||
LoadDate(e.Start);
|
||||
}
|
||||
|
||||
private void ClearForm()
|
||||
{
|
||||
projectionsDataGridView.Rows.Clear();
|
||||
inventoryDataGridView.Rows.Clear();
|
||||
actualSalesDataGridView.Rows.Clear();
|
||||
invoicesDataGridView.Rows.Clear();
|
||||
commentsTextBox.Text = string.Empty;
|
||||
commentMainGroupBox.Text = @"Comments";
|
||||
dateTimeGroupBox.Text = string.Empty;
|
||||
salesPerManHourLabel.Text = @"Sales Per Man Hour:";
|
||||
salaryPercentageLabel.Text = @"Salary Percentage:";
|
||||
salaryDollarsLabel.Text = @"Salary Dollars:";
|
||||
suppliesLabel.Text = @"Supplies:";
|
||||
costAnalysisGroupBox.Text = @"Cost Analysis";
|
||||
sundayWeeklySalesLabel.Text = @"Sunday: ";
|
||||
mondayWeeklySalesLabel.Text = @"Monday: ";
|
||||
tuesadayWeeklySalesLabel.Text = @"Tuesday: ";
|
||||
wednesdayWeeklySalesLabel.Text = @"Wednesday: ";
|
||||
thursdayWeeklySalesLabel.Text = @"Wednesday: ";
|
||||
fridayWeeklySalesLabel.Text = @"Friday: ";
|
||||
saturdayWeeklySalesLabel.Text = @"Saturday: ";
|
||||
totalWeeklySalesLabel.Text = @"Total Sales: ";
|
||||
weeklySalesGroupBox.Text = @"Weekly Sales";
|
||||
sundayTaxableLabel.Text = @"Sunday: ";
|
||||
mondayTaxableLabel.Text = @"Monday: ";
|
||||
tuesdayTaxableLabel.Text = @"Tuesday: ";
|
||||
wednesdayTaxableLabel.Text = @"Wednesday: ";
|
||||
thursdayTaxableLabel.Text = @"Wednesday: ";
|
||||
fridayTaxableLabel.Text = @"Friday: ";
|
||||
saturdayTaxableLabel.Text = @"Saturday: ";
|
||||
totalTaxableLabel.Text = @"Total: ";
|
||||
taxableGroupBox.Text = @"Taxable";
|
||||
departmentSalesLabel.Text = @"Department Sales: ";
|
||||
salesProducedLabel.Text = @"Sales Produced By Ad Items (A):";
|
||||
remainingSalesLabel.Text = @"Remaining Sales:";
|
||||
totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): ";
|
||||
totalProfitReturnFromRemaingLabel.Text = @"Total Profit Return From Remaining Sales: ";
|
||||
totalProfitReturnLabel.Text = @"Total Profit Return: ";
|
||||
grossProfitTotalSales.Text = @"Total Sales:";
|
||||
grossProfitLessCostOfSales.Text = @"Less Cost of Sales: ";
|
||||
grossProfitDollarGrossProfitLabel.Text = @"Dollar Gross Profit: ";
|
||||
perfectGrossProfitLabel.Text = @"Percent Gross Profit: ";
|
||||
grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = @"Estimated Weekly Department Expense: ";
|
||||
}
|
||||
}
|
||||
}
|
||||
//http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>YwflYtfjVV9x9+eYf7fKZfD6BpJXoaFqTjumSTnk4Aw=</dsig:DigestValue>
|
||||
<dsig:DigestValue>LhUa23CJtjZ/BowQJj0qgveDidagP1l9WYafRZkbi6Y=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
@@ -43,14 +43,14 @@
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3624448">
|
||||
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3625984">
|
||||
<assemblyIdentity name="AdvertsingProfitControl" version="0.9.5.2" language="neutral" processorArchitecture="amd64" />
|
||||
<hash>
|
||||
<dsig:Transforms>
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>msc2oqq6RpSLr/3P5XGCDPYZql/YogX5J9EV62lCzlM=</dsig:DigestValue>
|
||||
<dsig:DigestValue>NwwEYHm9hzA8o7iitiqniu7tzLtilE7WXD+uqYszcZ4=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
Reference in New Issue
Block a user