private void CreateReport(ReportOrderedBy sOrder, bool includeZeroItems, string output) { if (!bUsingCatGroups) { string[] sCats = { InputTextBox("CAT").Text }; if (string.Equals(output, "P", StringComparison.OrdinalIgnoreCase)) { sEngine.StockReportToPrinter(sCats, sOrder, "", includeZeroItems); } else if (string.Equals(output, "S", StringComparison.OrdinalIgnoreCase)) { sEngine.StockReportToFile(sCats, sOrder, "", includeZeroItems); frmReportViewer fViewer = new frmReportViewer(ReportType.StockLevelReport); fViewer.ShowDialog(); } } else { string[] sCats = sEngine.GetListOfCatGroupCategories(InputTextBox("CAT").Text); if (string.Equals(output, "P", StringComparison.OrdinalIgnoreCase)) { sEngine.StockReportToPrinter(sCats, sOrder, InputTextBox("CAT").Text, includeZeroItems); } else if (string.Equals(output, "S", StringComparison.OrdinalIgnoreCase)) { sEngine.StockReportToFile(sCats, sOrder, InputTextBox("CAT").Text, includeZeroItems); frmReportViewer fViewer = new frmReportViewer(ReportType.StockLevelReport); fViewer.ShowDialog(); } } this.Close(); }
void lbOptions_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { switch (lbOptions.SelectedIndex) { case 0: SelectedOrder = ReportOrderedBy.CodeAlphabetical; break; case 1: SelectedOrder = ReportOrderedBy.DescAlphabetical; break; case 2: SelectedOrder = ReportOrderedBy.QIS; break; } OptionSelected = true; this.Close(); } else if (e.KeyCode == Keys.Escape) { this.Close(); } }
void CreateReport() { // Get Layout frmSalesReportType fType = new frmSalesReportType(); fType.ShowDialog(); if (!fType.OptionSelected) { InputTextBox("SORP").Focus(); return; } SalesReportType sType = fType.sType; // Get Order ReportOrderedBy rOrder = ReportOrderedBy.DescAlphabetical; if (sType == SalesReportType.AllStock) { frmSalesReportOrder fOrder = new frmSalesReportOrder(); fOrder.ShowDialog(); if (!fOrder.OptionSelected) { InputTextBox("SORP").Focus(); return; } rOrder = fOrder.SelectedOrder; } this.CreateReport(sType, rOrder, InputTextBox("SORP").Text); }
public SaleReportItem(string Barcode, ref Table tStockStats, ref Table tMainStock, ref Table tCommission, Period pPeriod, ReportOrderedBy rOrder) { sBarcode = Barcode; string sPeriodCode = ""; switch (pPeriod) { case Period.Daily: sPeriodCode = "D"; break; case Period.Weekly: sPeriodCode = "W"; break; case Period.Monthly: sPeriodCode = "M"; break; case Period.Yearly: sPeriodCode = "Y"; break; } string[] sStockStatsRecord = tStockStats.GetRecordFrom(Barcode, 0, true); string[] sMainStockRecord = tMainStock.GetRecordFrom(Barcode, 0, true); dQuantitySold = Convert.ToDecimal(sStockStatsRecord[tStockStats.FieldNumber(sPeriodCode + "QSOLD")]); dGrossSales = Convert.ToDecimal(sStockStatsRecord[tStockStats.FieldNumber(sPeriodCode + "GSALES")]); dNetSales = Convert.ToDecimal(sStockStatsRecord[tStockStats.FieldNumber(sPeriodCode + "NSALES")]); dStockLevel = Convert.ToDecimal(sStockStatsRecord[tStockStats.FieldNumber("QIS")]); dCOGS = Convert.ToDecimal(sStockStatsRecord[tStockStats.FieldNumber(sPeriodCode + "COGS")]); sDescription = sMainStockRecord[tMainStock.FieldNumber("DESCRIPTIO")]; dProfitAmount = dNetSales - dCOGS; if (dCOGS == 0) { dProfitPercent = 100; } else { if (dNetSales == 0) { dProfitPercent = -100; } else { dProfitPercent = (100 / dNetSales) * dProfitAmount; } } Order = rOrder; }
void lbOptions_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { switch (lbOptions.SelectedIndex) { case 0: SelectedOrder = ReportOrderedBy.DescAlphabetical; break; case 1: SelectedOrder = ReportOrderedBy.QuantitySold; break; case 2: SelectedOrder = ReportOrderedBy.CodeAlphabetical; break; case 3: SelectedOrder = ReportOrderedBy.GrossSales; break; case 4: SelectedOrder = ReportOrderedBy.NetSales; break; case 5: SelectedOrder = ReportOrderedBy.Profit; break; case 6: SelectedOrder = ReportOrderedBy.ProfitPercent; break; } OptionSelected = true; this.Close(); } else if (e.KeyCode == Keys.Escape) { this.Close(); } }
public StockReportItem(ReportOrderedBy r) { rOrder = r; }
private void CreateReport(SalesReportType sType, ReportOrderedBy rOrder, string output) { // Do Report if (output.Equals("S", StringComparison.OrdinalIgnoreCase)) { if (InputTextBox("DATE").Text != "" && System.IO.Directory.Exists(InputTextBox("DATE").Text)) { StockEngine sOldEngine = new StockEngine(InputTextBox("DATE").Text); sOldEngine.SalesReportToFile(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); string sTitle = ""; switch (rtSelectedReport) { case Period.Daily: string sDate = sOldEngine.GetLastCollectionDate(); string sTitleDate = sDate[0].ToString() + sDate[1].ToString() + "/" + sDate[2].ToString() + sDate[3].ToString() + "/" + sDate[4].ToString() + sDate[5].ToString(); sTitle = "Daily Sales Report for " + sTitleDate; break; case Period.Weekly: sTitle = "Weekly Sales Report for Week Commencing " + sEngine.GetWeekCommencingDate(); break; case Period.Monthly: sTitle = "Monthly Sales Report for " + sEngine.GetMonthDate(); break; case Period.Yearly: string sLastCollection = sEngine.GetLastCollectionDate(); string sYear = sLastCollection[4].ToString() + sLastCollection[5].ToString(); sTitle = "Yearly Sales Report for " + "20" + sYear; break; } frmReportViewer fViewer = new frmReportViewer(ReportType.SalesReport); fViewer.ShowDialog(); this.Close(); } else { sEngine.SalesReportToFile(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); string sTitle = ""; switch (rtSelectedReport) { case Period.Daily: string sDate = sEngine.GetLastCollectionDate(); string sTitleDate = sDate[0].ToString() + sDate[1].ToString() + "/" + sDate[2].ToString() + sDate[3].ToString() + "/" + sDate[4].ToString() + sDate[5].ToString(); sTitle = "Daily Sales Report for " + sTitleDate; break; case Period.Weekly: sTitle = "Weekly Sales Report for Week Commencing " + sEngine.GetWeekCommencingDate(); break; case Period.Monthly: sTitle = "Monthly Sales Report for " + sEngine.GetMonthDate(); break; case Period.Yearly: string sLastCollection = sEngine.GetLastCollectionDate(); string sYear = sLastCollection[4].ToString() + sLastCollection[5].ToString(); sTitle = "Yearly Sales Report for " + "20" + sYear; break; } frmReportViewer fViewer = new frmReportViewer(ReportType.SalesReport); fViewer.ShowDialog(); this.Close(); } } else if (output.Equals("P", StringComparison.OrdinalIgnoreCase)) { if (InputTextBox("DATE").Text != "" && System.IO.Directory.Exists(InputTextBox("DATE").Text)) { StockEngine sOldEngine = new StockEngine(InputTextBox("DATE").Text); sOldEngine.SalesReportToFile(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); string sTitle = ""; switch (rtSelectedReport) { case Period.Daily: string sDate = sOldEngine.GetLastCollectionDate(); string sTitleDate = sDate[0].ToString() + sDate[1].ToString() + "/" + sDate[2].ToString() + sDate[3].ToString() + "/" + sDate[4].ToString() + sDate[5].ToString(); sTitle = "Daily Sales Report for " + sTitleDate; break; case Period.Weekly: sTitle = "Weekly Sales Report for Week Commencing " + sEngine.GetWeekCommencingDate(); break; case Period.Monthly: sTitle = "Monthly Sales Report for " + sEngine.GetMonthDate(); break; case Period.Yearly: string sLastCollection = sEngine.GetLastCollectionDate(); string sYear = sLastCollection[4].ToString() + sLastCollection[5].ToString(); sTitle = "Yearly Sales Report for " + "20" + sYear; break; } sOldEngine.SalesReportToPrinter(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); this.Close(); } else { sEngine.SalesReportToFile(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); string sTitle = ""; switch (rtSelectedReport) { case Period.Daily: string sDate = sEngine.GetLastCollectionDate(); string sTitleDate = sDate[0].ToString() + sDate[1].ToString() + "/" + sDate[2].ToString() + sDate[3].ToString() + "/" + sDate[4].ToString() + sDate[5].ToString(); sTitle = "Daily Sales Report for " + sTitleDate; break; case Period.Weekly: sTitle = "Weekly Sales Report for Week Commencing " + sEngine.GetWeekCommencingDate(); break; case Period.Monthly: sTitle = "Monthly Sales Report for " + sEngine.GetMonthDate(); break; case Period.Yearly: string sLastCollection = sEngine.GetLastCollectionDate(); string sYear = sLastCollection[4].ToString() + sLastCollection[5].ToString(); sTitle = "Yearly Sales Report for " + "20" + sYear; break; } sEngine.SalesReportToPrinter(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); } } else if (output.Equals("T", StringComparison.OrdinalIgnoreCase)) { if (InputTextBox("DATE").Text != "" && System.IO.Directory.Exists(InputTextBox("DATE").Text)) { StockEngine sOldEngine = new StockEngine(InputTextBox("DATE").Text); sOldEngine.SalesReportToSpreadsheet(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); string sTitle = ""; switch (rtSelectedReport) { case Period.Daily: string sDate = sOldEngine.GetLastCollectionDate(); string sTitleDate = sDate[0].ToString() + sDate[1].ToString() + "/" + sDate[2].ToString() + sDate[3].ToString() + "/" + sDate[4].ToString() + sDate[5].ToString(); sTitle = "Daily Sales Report for " + sTitleDate; break; case Period.Weekly: sTitle = "Weekly Sales Report for Week Commencing " + sEngine.GetWeekCommencingDate(); break; case Period.Monthly: sTitle = "Monthly Sales Report for " + sEngine.GetMonthDate(); break; case Period.Yearly: string sLastCollection = sEngine.GetLastCollectionDate(); string sYear = sLastCollection[4].ToString() + sLastCollection[5].ToString(); sTitle = "Yearly Sales Report for " + "20" + sYear; break; } this.Close(); } else { sEngine.SalesReportToSpreadsheet(InputTextBox("STARTCAT").Text, InputTextBox("ENDCAT").Text, sType, rtSelectedReport, rOrder); string sTitle = ""; switch (rtSelectedReport) { case Period.Daily: string sDate = sEngine.GetLastCollectionDate(); string sTitleDate = sDate[0].ToString() + sDate[1].ToString() + "/" + sDate[2].ToString() + sDate[3].ToString() + "/" + sDate[4].ToString() + sDate[5].ToString(); sTitle = "Daily Sales Report for " + sTitleDate; break; case Period.Weekly: sTitle = "Weekly Sales Report for Week Commencing " + sEngine.GetWeekCommencingDate(); break; case Period.Monthly: sTitle = "Monthly Sales Report for " + sEngine.GetMonthDate(); break; case Period.Yearly: string sLastCollection = sEngine.GetLastCollectionDate(); string sYear = sLastCollection[4].ToString() + sLastCollection[5].ToString(); sTitle = "Yearly Sales Report for " + "20" + sYear; break; } } } this.Close(); }