|
|
|
@@ -95,7 +95,6 @@ namespace AdvertsingProfitControl
|
|
|
|
|
actualSalesDataGridView.EditingControlShowing += DisplayAutoCompleteOnEditingControlShowing;
|
|
|
|
|
//After all events have been set, construct the DataGridVeiws for use.
|
|
|
|
|
ConstructApcDataGridViews();
|
|
|
|
|
LoadDate(date);
|
|
|
|
|
//Set-up events for the Invoice table.
|
|
|
|
|
invoicesDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
//Validate that the row the user is trying to leave is legal (has at least an ad item entered) and prevent the user from leaving the row is its not.
|
|
|
|
@@ -155,6 +154,7 @@ namespace AdvertsingProfitControl
|
|
|
|
|
salaryDollarsTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
LoadDate(date);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sealed override string Text
|
|
|
|
@@ -163,16 +163,6 @@ namespace AdvertsingProfitControl
|
|
|
|
|
set { base.Text = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//private void RestoreActiveDate(object sender, EventArgs e)
|
|
|
|
|
//{
|
|
|
|
|
// var calendar = (MonthCalendar) sender;
|
|
|
|
|
// if (calendar.SelectionStart == _currentActiveDate || calendar.BoldedDates.Contains(calendar.SelectionStart)) return;
|
|
|
|
|
// MessageBox.Show(@"This date doesn't appear to be in the database.", @"Date not Found");
|
|
|
|
|
// weekEndingCalendar.DateChanged -= ValidateDateChanged;
|
|
|
|
|
// weekEndingCalendar.SelectionStart = _currentActiveDate;
|
|
|
|
|
// weekEndingCalendar.DateChanged += ValidateDateChanged;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
#region Global Event Handlers
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@@ -1909,6 +1899,7 @@ namespace AdvertsingProfitControl
|
|
|
|
|
#region Weekly Sales Events
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Event Used: Validating
|
|
|
|
|
/// Validates the contents of the weekly sales text boxes and adds up the total.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
@@ -1937,6 +1928,11 @@ namespace AdvertsingProfitControl
|
|
|
|
|
textBox.Text = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isWeeklySalesDirtyCheckBox.Tag != null)
|
|
|
|
|
{
|
|
|
|
|
isWeeklySalesDirtyCheckBox.Checked = true;
|
|
|
|
|
_isFormDirty = true;
|
|
|
|
|
}
|
|
|
|
|
//Update the total sales text box before returning.
|
|
|
|
|
var totalWeeklySales = 0.00;
|
|
|
|
|
if (sundayWeeklySalesTextBox.Text != "") totalWeeklySales += double.Parse(sundayWeeklySalesTextBox.Text);
|
|
|
|
@@ -2002,6 +1998,11 @@ namespace AdvertsingProfitControl
|
|
|
|
|
textBox.Text = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isTaxableDirtyCheckBox.Tag != null)
|
|
|
|
|
{
|
|
|
|
|
isTaxableDirtyCheckBox.Checked = true;
|
|
|
|
|
_isFormDirty = true;
|
|
|
|
|
}
|
|
|
|
|
//Update the total sales text box before returning.
|
|
|
|
|
var totalTaxable = 0.00;
|
|
|
|
|
if (sundayTaxableTextBox.Text != "") totalTaxable += double.Parse(sundayTaxableTextBox.Text);
|
|
|
|
@@ -2118,7 +2119,6 @@ namespace AdvertsingProfitControl
|
|
|
|
|
if (result == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
_currentActiveDate = e.Start;
|
|
|
|
|
_isFormDirty = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@@ -2127,8 +2127,10 @@ namespace AdvertsingProfitControl
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Text = @"Modify Record (Current Record: " + e.Start.ToString("d") + @")";
|
|
|
|
|
//Clear the form state.
|
|
|
|
|
ClearFormState();
|
|
|
|
|
//Load the specified date from the database.
|
|
|
|
|
|
|
|
|
|
LoadDate(e.Start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadDate(DateTime date)
|
|
|
|
@@ -2143,22 +2145,238 @@ namespace AdvertsingProfitControl
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Re-enable the events
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
projectionsDataGridView.CellEnter -= StoreBeginningCellValue;
|
|
|
|
|
projectionsDataGridView.RowLeave -= UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
projectionsDataGridView.CellValidating -= ValidateSalesDataGridViewCellContents;
|
|
|
|
|
projectionsDataGridView.RowValidating -= ValidateProjectedRow;
|
|
|
|
|
projectionsDataGridView.RowsRemoved -= ProjectionRowRemoved;
|
|
|
|
|
inventoryDataGridView.CellEnter -= StoreBeginningCellValue;
|
|
|
|
|
inventoryDataGridView.RowLeave -= UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
inventoryDataGridView.CellValidating -= ValidateInventoryCellContents;
|
|
|
|
|
inventoryDataGridView.RowValidating -= ValidateInventoryRow;
|
|
|
|
|
inventoryDataGridView.RowsRemoved -= InventoryRowRemoved;
|
|
|
|
|
actualSalesDataGridView.CellEnter -= StoreBeginningCellValue;
|
|
|
|
|
actualSalesDataGridView.RowLeave -= UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
actualSalesDataGridView.CellValidating -= ValidateSalesDataGridViewCellContents;
|
|
|
|
|
actualSalesDataGridView.RowValidating -= ValidateActualSalesRow;
|
|
|
|
|
actualSalesDataGridView.RowsRemoved -= ActualSalesRowRemoved;
|
|
|
|
|
invoicesDataGridView.CellEnter -= StoreBeginningCellValue;
|
|
|
|
|
invoicesDataGridView.RowValidating -= ValidateInvoiceRow;
|
|
|
|
|
invoicesDataGridView.CellValidating -= ValidateInvoicesCellContents;
|
|
|
|
|
commentsTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
commentsTextBox.KeyDown -= CheckForKeyCommand;
|
|
|
|
|
commentsTextBox.Leave -= CheckForTextChangeOnLeave;
|
|
|
|
|
sundayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
sundayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
mondayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
mondayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
thursdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
fridayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
fridayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
saturdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
totalWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
totalWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
sundayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
sundayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
mondayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
mondayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
tuesdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
wednesdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
thursdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
fridayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
fridayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
saturdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
totalTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
totalTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
salesPerManHourTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
salesPerManHourTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
salaryPercentageTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
salaryPercentageTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
salaryDollarsTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
salaryDollarsTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
suppliesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
suppliesTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
//Clear errors and information.
|
|
|
|
|
informationLabel.Text = "";
|
|
|
|
|
errorLabel.Text = "";
|
|
|
|
|
//Clear projections
|
|
|
|
|
projectionsDataGridView.Rows.Clear();
|
|
|
|
|
//Clear inventory
|
|
|
|
|
inventoryDataGridView.Rows.Clear();
|
|
|
|
|
//Clear actual sales
|
|
|
|
|
actualSalesDataGridView.Rows.Clear();
|
|
|
|
|
//Reset the ad special index.
|
|
|
|
|
_adSpecialIndex = -1;
|
|
|
|
|
//Clear the beginning cell value variable.
|
|
|
|
|
_beginningCellValue = "";
|
|
|
|
|
//Reset the form's dirty flag
|
|
|
|
|
_isFormDirty = false;
|
|
|
|
|
//Clear invoices
|
|
|
|
|
invoicesDataGridView.Rows.Clear();
|
|
|
|
|
//Clear comments
|
|
|
|
|
isCommentDirtyCheckBox.Checked = false;
|
|
|
|
|
isCommentDirtyCheckBox.Text = @"IsCommentDirty";
|
|
|
|
|
isCommentDirtyCheckBox.Tag = null;
|
|
|
|
|
commentsTextBox.Text = "";
|
|
|
|
|
commentsGroupBox.Text = @"Comments (Characters Remaining: " + commentsTextBox.MaxLength + @")";
|
|
|
|
|
//Clear weekly sales.
|
|
|
|
|
isWeeklySalesDirtyCheckBox.Checked = false;
|
|
|
|
|
isWeeklySalesDirtyCheckBox.Text = @"IsWeeklySalesDirty";
|
|
|
|
|
isWeeklySalesDirtyCheckBox.Tag = null;
|
|
|
|
|
sundayWeeklySalesTextBox.Text = "";
|
|
|
|
|
mondayWeeklySalesTextBox.Text = "";
|
|
|
|
|
tuesdayWeeklySalesTextBox.Text = "";
|
|
|
|
|
wednesdayWeeklySalesTextBox.Text = "";
|
|
|
|
|
thursdayWeeklySalesTextBox.Text = "";
|
|
|
|
|
fridayWeeklySalesTextBox.Text = "";
|
|
|
|
|
saturdayWeeklySalesTextBox.Text = "";
|
|
|
|
|
totalWeeklySalesTextBox.Text = "";
|
|
|
|
|
//Clear taxable.
|
|
|
|
|
isTaxableDirtyCheckBox.Checked = false;
|
|
|
|
|
isTaxableDirtyCheckBox.Text = @"IsTaxableDirty";
|
|
|
|
|
isTaxableDirtyCheckBox.Tag = null;
|
|
|
|
|
sundayTaxableTextBox.Text = "";
|
|
|
|
|
mondayTaxableTextBox.Text = "";
|
|
|
|
|
tuesdayTaxableTextBox.Text = "";
|
|
|
|
|
wednesdayTaxableTextBox.Text = "";
|
|
|
|
|
thursdayTaxableTextBox.Text = "";
|
|
|
|
|
fridayTaxableTextBox.Text = "";
|
|
|
|
|
saturdayTaxableTextBox.Text = "";
|
|
|
|
|
totalTaxableTextBox.Text = "";
|
|
|
|
|
//Clear cost analysis
|
|
|
|
|
isCostAnalysisDirtyCheckBox.Checked = false;
|
|
|
|
|
isCostAnalysisDirtyCheckBox.Text = @"IsCostAnalysisDirty";
|
|
|
|
|
isCostAnalysisDirtyCheckBox.Tag = null;
|
|
|
|
|
salesPerManHourTextBox.Text = "";
|
|
|
|
|
salaryPercentageTextBox.Text = "";
|
|
|
|
|
salaryDollarsTextBox.Text = "";
|
|
|
|
|
suppliesTextBox.Text = "";
|
|
|
|
|
//Re-enable the events for all the controls.
|
|
|
|
|
projectionsDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
projectionsDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
projectionsDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
|
|
|
|
projectionsDataGridView.RowValidating += ValidateProjectedRow;
|
|
|
|
|
projectionsDataGridView.RowsRemoved += ProjectionRowRemoved;
|
|
|
|
|
inventoryDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
inventoryDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
inventoryDataGridView.CellValidating += ValidateInventoryCellContents;
|
|
|
|
|
inventoryDataGridView.RowValidating += ValidateInventoryRow;
|
|
|
|
|
inventoryDataGridView.RowsRemoved += InventoryRowRemoved;
|
|
|
|
|
actualSalesDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
actualSalesDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
actualSalesDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
|
|
|
|
actualSalesDataGridView.RowValidating += ValidateActualSalesRow;
|
|
|
|
|
actualSalesDataGridView.RowsRemoved += ActualSalesRowRemoved;
|
|
|
|
|
|
|
|
|
|
invoicesDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
invoicesDataGridView.RowValidating += ValidateInvoiceRow;
|
|
|
|
|
invoicesDataGridView.CellValidating += ValidateInvoicesCellContents;
|
|
|
|
|
|
|
|
|
|
commentsTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
commentsTextBox.KeyDown += CheckForKeyCommand;
|
|
|
|
|
commentsTextBox.Leave += CheckForTextChangeOnLeave;
|
|
|
|
|
|
|
|
|
|
sundayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
sundayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
mondayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
mondayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
thursdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
fridayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
fridayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
saturdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
totalWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
totalWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
|
|
|
|
|
sundayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
sundayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
mondayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
mondayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
tuesdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
wednesdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
thursdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
fridayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
fridayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
saturdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
totalTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
totalTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
|
|
|
|
|
salesPerManHourTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
salesPerManHourTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
salaryPercentageTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
salaryPercentageTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
salaryDollarsTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
salaryDollarsTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Data Loading Methods
|
|
|
|
|
|
|
|
|
|
private void LoadProjectionsTable(DataTable projections)
|
|
|
|
|
{
|
|
|
|
|
//Assuming all the tables are correctly aligned.
|
|
|
|
@@ -2242,6 +2460,11 @@ namespace AdvertsingProfitControl
|
|
|
|
|
}
|
|
|
|
|
projectionsDataGridView.Rows.Add(newRow);
|
|
|
|
|
}
|
|
|
|
|
//Re-enable the events
|
|
|
|
|
projectionsDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
projectionsDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
projectionsDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
|
|
|
|
projectionsDataGridView.RowValidating += ValidateProjectedRow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadInventory(DataTable inventoryTable)
|
|
|
|
@@ -2329,6 +2552,11 @@ namespace AdvertsingProfitControl
|
|
|
|
|
}
|
|
|
|
|
inventoryDataGridView.Rows.Add(newRow);
|
|
|
|
|
}
|
|
|
|
|
//Re-enable the events
|
|
|
|
|
inventoryDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
inventoryDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
inventoryDataGridView.CellValidating += ValidateInventoryCellContents;
|
|
|
|
|
inventoryDataGridView.RowValidating += ValidateInventoryRow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadActualSales(DataTable actualSales)
|
|
|
|
@@ -2416,11 +2644,362 @@ namespace AdvertsingProfitControl
|
|
|
|
|
}
|
|
|
|
|
actualSalesDataGridView.Rows.Add(newRow);
|
|
|
|
|
}
|
|
|
|
|
//Re-enable the events
|
|
|
|
|
actualSalesDataGridView.CellEnter += StoreBeginningCellValue;
|
|
|
|
|
actualSalesDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
|
|
|
|
actualSalesDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
|
|
|
|
actualSalesDataGridView.RowValidating += ValidateActualSalesRow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void NormalizeApcTables(DataTable projetions, DataTable inventory, DataTable actualSales, string dateId)
|
|
|
|
|
private void LoadInvoices(DataTable invoices)
|
|
|
|
|
{
|
|
|
|
|
for (var rowIndex = 0; rowIndex < invoices.Rows.Count; rowIndex++)
|
|
|
|
|
{
|
|
|
|
|
var row = new DataGridViewRow();
|
|
|
|
|
for (var cellIndex = 0; cellIndex < invoices.Rows[rowIndex].ItemArray.Length; cellIndex++)
|
|
|
|
|
{
|
|
|
|
|
//Get the
|
|
|
|
|
//Format the invoice date.
|
|
|
|
|
if (cellIndex == 1)
|
|
|
|
|
{
|
|
|
|
|
var date = DateTime.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString());
|
|
|
|
|
var cell = new DataGridViewTextBoxCell
|
|
|
|
|
{
|
|
|
|
|
Value = date.ToString("d")
|
|
|
|
|
};
|
|
|
|
|
row.Cells.Add(cell);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (invoices.Rows[rowIndex].ItemArray[cellIndex].ToString() != "0")
|
|
|
|
|
{
|
|
|
|
|
var cell = new DataGridViewTextBoxCell
|
|
|
|
|
{
|
|
|
|
|
Value = invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()
|
|
|
|
|
};
|
|
|
|
|
row.Cells.Add(cell);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var cell = new DataGridViewTextBoxCell
|
|
|
|
|
{
|
|
|
|
|
Value = ""
|
|
|
|
|
};
|
|
|
|
|
row.Cells.Add(cell);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
invoicesDataGridView.Rows.Add(row);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadComments(int id, string comments)
|
|
|
|
|
{
|
|
|
|
|
//commentsTextBox.TextChanged -= DisplayRemainingCommentCharacterCount;
|
|
|
|
|
commentsTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
commentsTextBox.KeyDown -= CheckForKeyCommand;
|
|
|
|
|
commentsTextBox.Leave -= CheckForTextChangeOnLeave;
|
|
|
|
|
|
|
|
|
|
isCommentDirtyCheckBox.Text = @"isCommentsDirty (" + id + @")";
|
|
|
|
|
isCommentDirtyCheckBox.Tag = id;
|
|
|
|
|
|
|
|
|
|
commentsTextBox.Text = comments;
|
|
|
|
|
|
|
|
|
|
//commentsGroupBox.Text = @"Comments (Characters Remaining: " + commentsTextBox.MaxLength + @")";
|
|
|
|
|
//commentsTextBox.TextChanged += DisplayRemainingCommentCharacterCount;
|
|
|
|
|
commentsTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
commentsTextBox.KeyDown += CheckForKeyCommand;
|
|
|
|
|
commentsTextBox.Leave += CheckForTextChangeOnLeave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadWeeklySales(DataTable weeklySales)
|
|
|
|
|
{
|
|
|
|
|
sundayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
sundayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
mondayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
mondayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
thursdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
fridayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
fridayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
saturdayWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
totalWeeklySalesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
totalWeeklySalesTextBox.Validating -= ValidateWeeklySales;
|
|
|
|
|
|
|
|
|
|
//Spin through the only row in the weekly sales table. Item in item
|
|
|
|
|
//array index zero (0) is the ID number of the weekly sales.
|
|
|
|
|
for (var cellIndex = 0; cellIndex < weeklySales.Rows[0].ItemArray.Length; cellIndex++)
|
|
|
|
|
{
|
|
|
|
|
if (cellIndex == 0)
|
|
|
|
|
{
|
|
|
|
|
//ID number
|
|
|
|
|
var id = int.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString());
|
|
|
|
|
isWeeklySalesDirtyCheckBox.Tag = id;
|
|
|
|
|
isWeeklySalesDirtyCheckBox.Text = @"IsWeeklySalesDirty (" + id + @")";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
string formattedNumber;
|
|
|
|
|
switch (cellIndex)
|
|
|
|
|
{
|
|
|
|
|
case 1: //Sunday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
sundayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2: //Monday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
mondayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3: //Tuesday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
tuesdayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4: //Wednesday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
wednesdayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5: //Thursday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
thursdayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 6: //Friday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
fridayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7: //Saturday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
saturdayWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 8: //Total Sales
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
totalWeeklySalesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sundayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
sundayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
mondayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
mondayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
thursdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
fridayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
fridayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
saturdayWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
totalWeeklySalesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
totalWeeklySalesTextBox.Validating += ValidateWeeklySales;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadTaxable(DataTable taxable)
|
|
|
|
|
{
|
|
|
|
|
sundayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
sundayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
mondayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
mondayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
tuesdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
wednesdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
thursdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
fridayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
fridayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
saturdayTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
totalTaxableTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
totalTaxableTextBox.Validating -= ValidateTaxableFields;
|
|
|
|
|
//Spin through the only row in the taxable table. Item in item
|
|
|
|
|
//array index zero (0) is the ID number of the weekly sales.
|
|
|
|
|
for (var cellIndex = 0; cellIndex < taxable.Rows[0].ItemArray.Length; cellIndex++)
|
|
|
|
|
{
|
|
|
|
|
if (cellIndex == 0)
|
|
|
|
|
{
|
|
|
|
|
//ID number
|
|
|
|
|
var id = int.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString());
|
|
|
|
|
isTaxableDirtyCheckBox.Tag = id;
|
|
|
|
|
isTaxableDirtyCheckBox.Text = @"IsTaxableDirty (" + id + @")";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
string formattedNumber;
|
|
|
|
|
switch (cellIndex)
|
|
|
|
|
{
|
|
|
|
|
case 1: //Sunday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
sundayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2: //Monday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
mondayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3: //Tuesday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
tuesdayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4: //Wednesday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
wednesdayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 5: //Thursday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
thursdayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 6: //Friday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
fridayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7: //Saturday
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
saturdayTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 8: //Total Taxable
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
totalTaxableTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sundayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
sundayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
mondayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
mondayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
tuesdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
tuesdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
wednesdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
wednesdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
thursdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
thursdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
fridayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
fridayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
saturdayTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
saturdayTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
totalTaxableTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
totalTaxableTextBox.Validating += ValidateTaxableFields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadCostAnalysis(DataTable costAnalysis)
|
|
|
|
|
{
|
|
|
|
|
salesPerManHourTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
salesPerManHourTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
salaryPercentageTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
salaryPercentageTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
salaryDollarsTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
salaryDollarsTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
suppliesTextBox.Enter -= StoreBeginningTextBoxValue;
|
|
|
|
|
suppliesTextBox.Validating -= ValidateCostAnalysisValues;
|
|
|
|
|
//Spin through the only row in the taxable table. Item in item
|
|
|
|
|
//array index zero (0) is the ID number of the weekly sales.
|
|
|
|
|
for (var cellIndex = 0; cellIndex < costAnalysis.Rows[0].ItemArray.Length; cellIndex++)
|
|
|
|
|
{
|
|
|
|
|
if (cellIndex == 0)
|
|
|
|
|
{
|
|
|
|
|
//ID number
|
|
|
|
|
var id = int.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString());
|
|
|
|
|
isCostAnalysisDirtyCheckBox.Tag = id;
|
|
|
|
|
isCostAnalysisDirtyCheckBox.Text = @"IsCostAnalysisDirty (" + id + @")";
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
string formattedNumber;
|
|
|
|
|
switch (cellIndex)
|
|
|
|
|
{
|
|
|
|
|
case 1: //Sales per man hour
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
salesPerManHourTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2: //Salary Percentage
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
salaryPercentageTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3: //Salary Dollars
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
salaryDollarsTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4: //Supplies
|
|
|
|
|
formattedNumber = Math.Round(double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()), 2).ToString("N", new CultureInfo("en-US"));
|
|
|
|
|
if (formattedNumber != "0.00")
|
|
|
|
|
{
|
|
|
|
|
suppliesTextBox.Text = formattedNumber;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
salesPerManHourTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
salesPerManHourTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
salaryPercentageTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
salaryPercentageTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
salaryDollarsTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
salaryDollarsTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
|
|
|
|
|
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//private void NormalizeApcTables(DataTable projections, DataTable inventory, DataTable actualSales, string dateId)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|