Added code to pull in all items in the new modify record form. Updated the database reader code and broke the main form. Fixed a bug where weekly sales and taxable would not set the dirty flag if text was cleared from a text box after pulling from the database. Known bug: when an ad special row's group is changed to another ad special group, i.e. "Weekend Ad" to "New Years Ad", the pending edit color is not shown in the header cells of the members and only the ad special row.
This commit is contained in:
Binary file not shown.
@@ -466,6 +466,40 @@ namespace AdvertsingProfitControl
|
|||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Created for the new modify record form, returns the ID of the comment being grabbed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dateId"></param>
|
||||||
|
/// <param name="connectionString"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<string> RetrieveComments(int dateId, string connectionString)
|
||||||
|
{
|
||||||
|
var dataTable = new DataTable();
|
||||||
|
var oleDbCommand = new OleDbCommand
|
||||||
|
{
|
||||||
|
CommandText = "SELECT Comment.ID, Comment.Comment FROM Comment WHERE Comment.FK_DateID = ?"
|
||||||
|
};
|
||||||
|
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||||
|
var connection = new OleDbConnection(connectionString);
|
||||||
|
oleDbCommand.Connection = connection;
|
||||||
|
using (connection)
|
||||||
|
{
|
||||||
|
using (oleDbCommand)
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
using (var dataAdapter = new OleDbDataAdapter(oleDbCommand))
|
||||||
|
{
|
||||||
|
dataAdapter.Fill(dataTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var comments = new List<string>();
|
||||||
|
if (dataTable.Rows.Count != 1) return comments;
|
||||||
|
comments.Add(dataTable.Rows[0].ItemArray[0].ToString());
|
||||||
|
comments.Add(dataTable.Rows[0].ItemArray[1].ToString());
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Ad Special Functions
|
#region Ad Special Functions
|
||||||
@@ -781,7 +815,7 @@ namespace AdvertsingProfitControl
|
|||||||
var dataTable = new DataTable();
|
var dataTable = new DataTable();
|
||||||
var oleDbCommand = new OleDbCommand()
|
var oleDbCommand = new OleDbCommand()
|
||||||
{
|
{
|
||||||
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 = ?"
|
CommandText = "SELECT Invoice.ID, Invoice.InvoiceDate, Supplier.SupplierName, Invoice.InvoiceNumber, Invoice.InvoiceNetAmountAtCost, Invoice.InvoiceNetAmount, Invoice.InvoiceNote FROM (Supplier INNER JOIN Invoice ON Supplier.ID = Invoice.FK_Supplier) WHERE FK_DateID = ?"
|
||||||
};
|
};
|
||||||
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||||
var connection = new OleDbConnection(connectionString);
|
var connection = new OleDbConnection(connectionString);
|
||||||
@@ -806,7 +840,7 @@ namespace AdvertsingProfitControl
|
|||||||
var dataTable = new DataTable();
|
var dataTable = new DataTable();
|
||||||
var oleDbCommand = new OleDbCommand()
|
var oleDbCommand = new OleDbCommand()
|
||||||
{
|
{
|
||||||
CommandText = "SELECT WeeklySales.Sunday, WeeklySales.Monday, WeeklySales.Tuesday, WeeklySales.Wednesday, WeeklySales.Thursday, WeeklySales.Friday, WeeklySales.Saturday, WeeklySales.TotalSales FROM WeeklySales WHERE FK_DateID = ?"
|
CommandText = "SELECT WeeklySales.ID, WeeklySales.Sunday, WeeklySales.Monday, WeeklySales.Tuesday, WeeklySales.Wednesday, WeeklySales.Thursday, WeeklySales.Friday, WeeklySales.Saturday, WeeklySales.TotalSales FROM WeeklySales WHERE FK_DateID = ?"
|
||||||
};
|
};
|
||||||
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||||
var connection = new OleDbConnection(connectionString);
|
var connection = new OleDbConnection(connectionString);
|
||||||
@@ -829,9 +863,9 @@ namespace AdvertsingProfitControl
|
|||||||
public DataTable ReturnTaxableFromDateId(string dateId, string connectionString)
|
public DataTable ReturnTaxableFromDateId(string dateId, string connectionString)
|
||||||
{
|
{
|
||||||
var dataTable = new DataTable();
|
var dataTable = new DataTable();
|
||||||
var oleDbCommand = new OleDbCommand()
|
var oleDbCommand = new OleDbCommand
|
||||||
{
|
{
|
||||||
CommandText = "SELECT Taxable.Sunday, Taxable.Monday, Taxable.Tuesday, Taxable.Wednesday, Taxable.Thursday, Taxable.Friday, Taxable.Saturday, Taxable.Total FROM Taxable WHERE FK_DateID = ?"
|
CommandText = "SELECT Taxable.ID, Taxable.Sunday, Taxable.Monday, Taxable.Tuesday, Taxable.Wednesday, Taxable.Thursday, Taxable.Friday, Taxable.Saturday, Taxable.Total FROM Taxable WHERE FK_DateID = ?"
|
||||||
};
|
};
|
||||||
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
oleDbCommand.Parameters.AddWithValue("DateID", dateId);
|
||||||
var connection = new OleDbConnection(connectionString);
|
var connection = new OleDbConnection(connectionString);
|
||||||
@@ -851,6 +885,32 @@ namespace AdvertsingProfitControl
|
|||||||
return dataTable;
|
return dataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DataTable ReturnCostAnalysis(int dateId, string connectionString)
|
||||||
|
{
|
||||||
|
var dataTable = new DataTable();
|
||||||
|
var oleDbCommand = new OleDbCommand
|
||||||
|
{
|
||||||
|
CommandText = "SELECT CostOfSalesAnalysis.ID, CostOfSalesAnalysis.SalesPerManHour, CostOfSalesAnalysis.SalaryPercentage, CostOfSalesAnalysis.SalaryDollars, CostOfSalesAnalysis.Supplies FROM CostOfSalesAnalysis WHERE FK_DateID = ?"
|
||||||
|
};
|
||||||
|
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 ReturnWeekEndingTable(string connectionString)
|
public DataTable ReturnWeekEndingTable(string connectionString)
|
||||||
{
|
{
|
||||||
var dataTable = new DataTable();
|
var dataTable = new DataTable();
|
||||||
|
|||||||
@@ -416,8 +416,8 @@ namespace AdvertsingProfitControl
|
|||||||
_gCostOfSalesCalculatedTotal = costOfSalesSum;
|
_gCostOfSalesCalculatedTotal = costOfSalesSum;
|
||||||
|
|
||||||
object[] invoiceTotalRow = new object[invoiceTable.Columns.Count];
|
object[] invoiceTotalRow = new object[invoiceTable.Columns.Count];
|
||||||
invoiceTotalRow[0] = "Total Purchases";
|
invoiceTotalRow[2] = "Total Purchases";
|
||||||
invoiceTotalRow[4] = costOfSalesSum;
|
invoiceTotalRow[5] = costOfSalesSum;
|
||||||
invoiceTable.Rows.Add(invoiceTotalRow);
|
invoiceTable.Rows.Add(invoiceTotalRow);
|
||||||
|
|
||||||
return invoiceTable;
|
return invoiceTable;
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ namespace AdvertsingProfitControl
|
|||||||
actualSalesDataGridView.EditingControlShowing += DisplayAutoCompleteOnEditingControlShowing;
|
actualSalesDataGridView.EditingControlShowing += DisplayAutoCompleteOnEditingControlShowing;
|
||||||
//After all events have been set, construct the DataGridVeiws for use.
|
//After all events have been set, construct the DataGridVeiws for use.
|
||||||
ConstructApcDataGridViews();
|
ConstructApcDataGridViews();
|
||||||
LoadDate(date);
|
|
||||||
//Set-up events for the Invoice table.
|
//Set-up events for the Invoice table.
|
||||||
invoicesDataGridView.CellEnter += StoreBeginningCellValue;
|
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.
|
//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;
|
salaryDollarsTextBox.Validating += ValidateCostAnalysisValues;
|
||||||
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
|
suppliesTextBox.Enter += StoreBeginningTextBoxValue;
|
||||||
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
suppliesTextBox.Validating += ValidateCostAnalysisValues;
|
||||||
|
LoadDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override string Text
|
public sealed override string Text
|
||||||
@@ -163,16 +163,6 @@ namespace AdvertsingProfitControl
|
|||||||
set { base.Text = value; }
|
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
|
#region Global Event Handlers
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1909,6 +1899,7 @@ namespace AdvertsingProfitControl
|
|||||||
#region Weekly Sales Events
|
#region Weekly Sales Events
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Event Used: Validating
|
||||||
/// Validates the contents of the weekly sales text boxes and adds up the total.
|
/// Validates the contents of the weekly sales text boxes and adds up the total.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
@@ -1937,6 +1928,11 @@ namespace AdvertsingProfitControl
|
|||||||
textBox.Text = "";
|
textBox.Text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isWeeklySalesDirtyCheckBox.Tag != null)
|
||||||
|
{
|
||||||
|
isWeeklySalesDirtyCheckBox.Checked = true;
|
||||||
|
_isFormDirty = true;
|
||||||
|
}
|
||||||
//Update the total sales text box before returning.
|
//Update the total sales text box before returning.
|
||||||
var totalWeeklySales = 0.00;
|
var totalWeeklySales = 0.00;
|
||||||
if (sundayWeeklySalesTextBox.Text != "") totalWeeklySales += double.Parse(sundayWeeklySalesTextBox.Text);
|
if (sundayWeeklySalesTextBox.Text != "") totalWeeklySales += double.Parse(sundayWeeklySalesTextBox.Text);
|
||||||
@@ -2002,6 +1998,11 @@ namespace AdvertsingProfitControl
|
|||||||
textBox.Text = "";
|
textBox.Text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isTaxableDirtyCheckBox.Tag != null)
|
||||||
|
{
|
||||||
|
isTaxableDirtyCheckBox.Checked = true;
|
||||||
|
_isFormDirty = true;
|
||||||
|
}
|
||||||
//Update the total sales text box before returning.
|
//Update the total sales text box before returning.
|
||||||
var totalTaxable = 0.00;
|
var totalTaxable = 0.00;
|
||||||
if (sundayTaxableTextBox.Text != "") totalTaxable += double.Parse(sundayTaxableTextBox.Text);
|
if (sundayTaxableTextBox.Text != "") totalTaxable += double.Parse(sundayTaxableTextBox.Text);
|
||||||
@@ -2118,7 +2119,6 @@ namespace AdvertsingProfitControl
|
|||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
_currentActiveDate = e.Start;
|
_currentActiveDate = e.Start;
|
||||||
_isFormDirty = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2127,8 +2127,10 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text = @"Modify Record (Current Record: " + e.Start.ToString("d") + @")";
|
Text = @"Modify Record (Current Record: " + e.Start.ToString("d") + @")";
|
||||||
|
//Clear the form state.
|
||||||
|
ClearFormState();
|
||||||
//Load the specified date from the database.
|
//Load the specified date from the database.
|
||||||
|
LoadDate(e.Start);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadDate(DateTime date)
|
private void LoadDate(DateTime date)
|
||||||
@@ -2143,22 +2145,238 @@ namespace AdvertsingProfitControl
|
|||||||
LoadInventory(inventory);
|
LoadInventory(inventory);
|
||||||
LoadActualSales(actualSales);
|
LoadActualSales(actualSales);
|
||||||
var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString);
|
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.CellEnter += StoreBeginningCellValue;
|
||||||
projectionsDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
projectionsDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
projectionsDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
projectionsDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
||||||
projectionsDataGridView.RowValidating += ValidateProjectedRow;
|
projectionsDataGridView.RowValidating += ValidateProjectedRow;
|
||||||
|
projectionsDataGridView.RowsRemoved += ProjectionRowRemoved;
|
||||||
inventoryDataGridView.CellEnter += StoreBeginningCellValue;
|
inventoryDataGridView.CellEnter += StoreBeginningCellValue;
|
||||||
inventoryDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
inventoryDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
inventoryDataGridView.CellValidating += ValidateInventoryCellContents;
|
inventoryDataGridView.CellValidating += ValidateInventoryCellContents;
|
||||||
inventoryDataGridView.RowValidating += ValidateInventoryRow;
|
inventoryDataGridView.RowValidating += ValidateInventoryRow;
|
||||||
|
inventoryDataGridView.RowsRemoved += InventoryRowRemoved;
|
||||||
actualSalesDataGridView.CellEnter += StoreBeginningCellValue;
|
actualSalesDataGridView.CellEnter += StoreBeginningCellValue;
|
||||||
actualSalesDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
actualSalesDataGridView.RowLeave += UpdateUsedAdItemCollectionOnRowLeave;
|
||||||
actualSalesDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
actualSalesDataGridView.CellValidating += ValidateSalesDataGridViewCellContents;
|
||||||
actualSalesDataGridView.RowValidating += ValidateActualSalesRow;
|
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)
|
private void LoadProjectionsTable(DataTable projections)
|
||||||
{
|
{
|
||||||
//Assuming all the tables are correctly aligned.
|
//Assuming all the tables are correctly aligned.
|
||||||
@@ -2242,6 +2460,11 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
projectionsDataGridView.Rows.Add(newRow);
|
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)
|
private void LoadInventory(DataTable inventoryTable)
|
||||||
@@ -2329,6 +2552,11 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
inventoryDataGridView.Rows.Add(newRow);
|
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)
|
public void LoadActualSales(DataTable actualSales)
|
||||||
@@ -2416,11 +2644,362 @@ namespace AdvertsingProfitControl
|
|||||||
}
|
}
|
||||||
actualSalesDataGridView.Rows.Add(newRow);
|
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)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>hjoJ6F3S2mx0T7+16nfA9mg2vO2CJ4FO+GQ/EyPYf58=</dsig:DigestValue>
|
<dsig:DigestValue>v/vV1JQ1KwJ475DzlF/9pMJ1BiE2M9/K5exyQW56JdA=</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="3594752">
|
<dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="AdvertsingProfitControl.exe" size="3606016">
|
||||||
<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>vZ/15zn6UnQyxvEn4XYMV+E1MUxIXiQdJmnSal6RNFc=</dsig:DigestValue>
|
<dsig:DigestValue>X9LoHKI4Q8rmL073oAPMcfETygEZnYWzLirYaKYjcvQ=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -93,7 +93,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>ZGKhdhvn6U66O06l/eGiap8UW45ciijpPInT3o/xuMc=</dsig:DigestValue>
|
<dsig:DigestValue>dJHxM6HPIKo4c5VqxwCZb6aI2vGij+MP5mUPlilWJ/A=</dsig:DigestValue>
|
||||||
</hash>
|
</hash>
|
||||||
</file>
|
</file>
|
||||||
<file name="Stretched Logo Collection.ico" size="370070">
|
<file name="Stretched Logo Collection.ico" size="370070">
|
||||||
|
|||||||
Reference in New Issue
Block a user