private void SetDataSource(ReportDocument Report) { // ReportDataset rptds = new ReportDataset(); DateTime StartTransactionDate = DateTime.MinValue; try { StartTransactionDate = Convert.ToDateTime(txtStartTransactionDate.Text + " " + txtStartTime.Text); } catch {} DateTime EndTransactionDate = DateTime.MinValue; try { EndTransactionDate = Convert.ToDateTime(txtEndTransactionDate.Text + " " + txtEndTime.Text); } catch {} Int32 Limit = 0; try { Limit = Convert.ToInt32(txtLimit.Text); } catch {} System.Data.DataSet ds = new System.Data.DataSet(); SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(); ds.Tables.Add(clsSalesTransactionItems.MostSalableItems(StartTransactionDate, EndTransactionDate, Limit)); clsSalesTransactionItems.CommitAndDispose(); Report.SetDataSource(ds); SetParameters(Report); }
private void SetDataSource(ReportDocument Report) { DateTime StartTransactionDate = DateTime.MinValue; try { StartTransactionDate = Convert.ToDateTime(txtStartTransactionDate.Text + " " + txtStartTime.Text); } catch { } DateTime EndTransactionDate = DateTime.MinValue; try { EndTransactionDate = Convert.ToDateTime(txtEndTransactionDate.Text + " " + txtEndTime.Text); } catch { } System.Data.DataSet ds = new System.Data.DataSet(); SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(); if (cboContactCode.SelectedItem.Value != "0") { ds.Tables.Add(clsSalesTransactionItems.AgentsCommision(long.Parse(cboContactCode.SelectedValue), StartTransactionDate, EndTransactionDate)); } else { ds.Tables.Add(clsSalesTransactionItems.AgentsCommision(cboDepartment.SelectedItem.Text, cboPosition.SelectedItem.Text, StartTransactionDate, EndTransactionDate)); } clsSalesTransactionItems.CommitAndDispose(); Report.SetDataSource(ds); SetParameters(Report); }
private void SetDataSource(ReportDocument Report) { ReportDataset rptds = new ReportDataset(); DataRow drNew; /****************************sales transaction *****************************/ SalesTransactions clsSalesTransactions = new SalesTransactions(); SalesTransactionDetails clsDetails = clsSalesTransactions.Details(txtTransactionNo.Text, txtTerminalNo.Text, int.Parse(cboBranch.SelectedItem.Value)); clsSalesTransactions.CommitAndDispose(); if (clsDetails.isExist == true) { drNew = rptds.Transactions.NewRow(); drNew["BranchCode"] = clsDetails.BranchCode; drNew["TransactionID"] = clsDetails.TransactionID; drNew["TransactionNo"] = clsDetails.TransactionNo; drNew["CustomerName"] = clsDetails.CustomerName; drNew["CashierName"] = clsDetails.CashierName; drNew["TerminalNo"] = clsDetails.TerminalNo; drNew["TransactionDate"] = clsDetails.TransactionDate; drNew["DateSuspended"] = clsDetails.DateSuspended.ToString(); drNew["DateResumed"] = clsDetails.DateResumed; drNew["TransactionStatus"] = clsDetails.TransactionStatus; drNew["SubTotal"] = clsDetails.SubTotal; drNew["ItemsDiscount"] = clsDetails.ItemsDiscount; drNew["Discount"] = clsDetails.Discount; drNew["VAT"] = clsDetails.VAT; drNew["VatableAmount"] = clsDetails.VATableAmount; drNew["LocalTax"] = clsDetails.LocalTax; drNew["AmountPaid"] = clsDetails.AmountPaid; drNew["CashPayment"] = clsDetails.CashPayment; drNew["ChequePayment"] = clsDetails.ChequePayment; drNew["CreditCardPayment"] = clsDetails.CreditCardPayment; drNew["BalanceAmount"] = clsDetails.BalanceAmount; drNew["ChangeAmount"] = clsDetails.ChangeAmount; drNew["DateClosed"] = clsDetails.DateClosed; drNew["PaymentType"] = clsDetails.PaymentType.ToString("d"); drNew["ItemsDiscount"] = clsDetails.ItemsDiscount; drNew["Charge"] = clsDetails.Charge; drNew["CreditPayment"] = clsDetails.CreditPayment; drNew["CreatedByName"] = clsDetails.CreatedByName; rptds.Transactions.Rows.Add(drNew); /****************************sales transaction items*****************************/ SalesTransactionItems clsSalesTransactionItems = new SalesTransactionItems(); System.Data.DataTable dt = clsSalesTransactionItems.List(clsDetails.TransactionID, clsDetails.TransactionDate, "TransactionItemsID", SortOption.Ascending); clsSalesTransactionItems.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { drNew = rptds.TransactionItems.NewRow(); foreach (DataColumn dc in rptds.TransactionItems.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.TransactionItems.Rows.Add(drNew); } } Report.SetDataSource(rptds); SetParameters(Report); }
private void SetDataSource(ReportDocument Report) { ReportDataset rptds = new ReportDataset(); Int64 intProductID = 0; if (cboProductCode.Items.Count > 0) { intProductID = Int64.Parse(cboProductCode.SelectedItem.Value); } Int64 intMatrixID = 0; if (cboVariation.Items.Count > 0) { intMatrixID = Int64.Parse(cboVariation.SelectedItem.Value); } DateTime DateFrom = DateTime.MinValue; DateFrom = DateTime.TryParse(txtStartDate.Text + " " + txtStartTime.Text, out DateFrom) ? DateFrom : DateTime.MinValue; DateTime DateTo = DateTime.MinValue; DateTo = DateTime.TryParse(txtEndDate.Text + " " + txtEndTime.Text, out DateTo) ? DateTo : DateTime.MinValue; Int32 intLimit = 0; intLimit = Int32.TryParse(txtLimit.Text, out intLimit) ? intLimit : 0; Int32 intBranchID = 0; intBranchID = Int32.TryParse(cboBranch.SelectedItem.Value, out intBranchID) ? intBranchID : 0; switch (cboReportType.SelectedValue) { case ReportTypes.ProductHistoryMovement: #region Product History Movement StockItem clsStockItem = new StockItem(); System.Data.DataTable dtProductHistoryMovement = clsStockItem.ProductMovementReport(intProductID, intMatrixID, DateFrom, DateTo, intBranchID); clsStockItem.CommitAndDispose(); foreach (DataRow dr in dtProductHistoryMovement.Rows) { DataRow drNew = rptds.ProductMovement.NewRow(); foreach (DataColumn dc in rptds.ProductMovement.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.ProductMovement.Rows.Add(drNew); } break; #endregion case ReportTypes.ProductHistoryPrice: #region Product price history ProductPackagePriceHistory clsProductPackagePriceHistory = new ProductPackagePriceHistory(); clsProductPackagePriceHistory.GetConnection(); System.Data.DataTable dtProductList = clsProductPackagePriceHistory.List(DateFrom, DateTo, intProductID); clsProductPackagePriceHistory.CommitAndDispose(); foreach (DataRow dr in dtProductList.Rows) { DataRow drNew = rptds.ProductPriceHistory.NewRow(); foreach (DataColumn dc in rptds.ProductPriceHistory.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.ProductPriceHistory.Rows.Add(drNew); } break; #endregion case ReportTypes.ProductHistoryMostSaleable: #region Most Saleable SalesTransactionItems clsSalesTransactionItemsMost = new SalesTransactionItems(); System.Data.DataTable dtMostSaleable = clsSalesTransactionItemsMost.MostSalableItems(DateFrom, DateTo, intLimit); clsSalesTransactionItemsMost.CommitAndDispose(); foreach (DataRow dr in dtMostSaleable.Rows) { DataRow drNew = rptds.MostSalableItems.NewRow(); foreach (DataColumn dc in rptds.MostSalableItems.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.MostSalableItems.Rows.Add(drNew); } break; #endregion case ReportTypes.ProductHistoryLeastSaleable: #region Least Saleable SalesTransactionItems clsSalesTransactionItemsLeast = new SalesTransactionItems(); System.Data.DataTable dtLeastSaleable = clsSalesTransactionItemsLeast.LeastSalableItems(DateFrom, DateTo, intLimit); clsSalesTransactionItemsLeast.CommitAndDispose(); foreach (DataRow dr in dtLeastSaleable.Rows) { DataRow drNew = rptds.LeastSalableItems.NewRow(); foreach (DataColumn dc in rptds.LeastSalableItems.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.LeastSalableItems.Rows.Add(drNew); } break; #endregion } Report.SetDataSource(rptds); SetParameters(Report); }
private void SetDataSource(ReportDocument Report) { ReportDataset rptds = new ReportDataset(); //long lngProductGroupName = long.Parse(cboProductGroup.SelectedItem.Value); //long lngSubGroupName = long.Parse(cboSubGroup.SelectedItem.Value); string ProductGroupName = string.Empty; if (cboProductGroup.SelectedItem.Value != Constants.ZERO_STRING) { ProductGroupName = cboProductGroup.SelectedItem.Value; } string SubGroupName = string.Empty; if (cboSubGroup.SelectedItem.Value != Constants.ZERO_STRING) { SubGroupName = cboSubGroup.SelectedItem.Value; } string ReportType = cboReportType.SelectedItem.Text; ProductColumns clsProductColumns = new ProductColumns(); #region clsProductColumns clsProductColumns.ProductCode = true; clsProductColumns.BarCode = true; clsProductColumns.BarCode2 = true; clsProductColumns.BarCode3 = true; clsProductColumns.ProductDesc = true; clsProductColumns.ProductSubGroupName = true; clsProductColumns.BaseUnitName = true; clsProductColumns.UnitName = true; clsProductColumns.ProductGroupName = true; clsProductColumns.DateCreated = true; clsProductColumns.Price = true; clsProductColumns.Quantity = true; clsProductColumns.MinThreshold = true; clsProductColumns.MaxThreshold = true; clsProductColumns.PurchasePrice = true; clsProductColumns.SupplierName = true; clsProductColumns.QuantityIN = true; clsProductColumns.QuantityOUT = true; clsProductColumns.RIDMinThreshold = true; clsProductColumns.RIDMaxThreshold = true; clsProductColumns.RID = true; //clsProductColumns.BranchActualQuantity = true; //clsProductColumns.BranchQuantity = true; //clsProductColumns.BranchQuantityIN = true; //clsProductColumns.BranchQuantityOUT = true; #endregion ProductDetails clsSearchKey = new ProductDetails(); #region Search Key clsSearchKey.BranchID = Convert.ToInt32(cboBranch.SelectedItem.Value); clsSearchKey.SupplierID = Convert.ToInt32(cboContact.SelectedItem.Value); clsSearchKey.ProductGroupID = Convert.ToInt64(cboProductGroup.SelectedItem.Value); clsSearchKey.ProductSubGroupID = Convert.ToInt64(cboSubGroup.SelectedItem.Value); clsSearchKey.ProductCode = txtProductCode.Text; #endregion Products clsProduct = new Products(); clsProduct.GetConnection(); ProductInventories clsProductInventories = new ProductInventories(clsProduct.Connection, clsProduct.Transaction); DataTable dt; string ProductIDs = null; switch (cboReportType.SelectedValue) { case ReportTypes.ProductList: #region Products List dt = clsProductInventories.ListAsDataTable(Int32.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text); clsProduct.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.Products.NewRow(); foreach (DataColumn dc in rptds.Products.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.Products.Rows.Add(drNew); } break; #endregion case ReportTypes.ProductPriceList: #region Products Price List dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text); clsProduct.CommitAndDispose(); foreach (DataRow dr in dt.Rows) { DataRow drNew = rptds.Products.NewRow(); foreach (DataColumn dc in rptds.Products.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.Products.Rows.Add(drNew); ProductIDs += dr["ProductID"].ToString() + ","; } break; #endregion case ReportTypes.ProductListWithInvalidMatrix: #region Products List With Invalid Unit Matrix dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text, ShowOnlyWithInvalidUnitMatrix: true); clsProduct.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.Products.NewRow(); foreach (DataColumn dc in rptds.Products.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.Products.Rows.Add(drNew); } break; #endregion case ReportTypes.WeightedProductsForWeighingScale: case ReportTypes.CountedProductsForWeighingScale: #region Weighted and Counted Products For Weighing Scale dt = clsProductInventories.ListAsDataTable(int.Parse(cboBranch.SelectedItem.Value), SupplierID: long.Parse(cboContact.SelectedItem.Value), ProductGroupID: long.Parse(cboProductGroup.SelectedItem.Value), ProductSubGroupID: long.Parse(cboSubGroup.SelectedItem.Value), ProductCode: txtProductCode.Text); clsProduct.CommitAndDispose(); foreach (DataRow dr in dt.Rows) { if (dr[ProductColumnNames.BarCode].ToString() != null && dr[ProductColumnNames.BarCode].ToString() != string.Empty) { DataRow drNew = rptds.Products.NewRow(); foreach (DataColumn dc in rptds.Products.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.Products.Rows.Add(drNew); ProductIDs += dr["ProductID"].ToString() + ","; } } break; #endregion case ReportTypes.ProductsInDemoReport: #region Products In Demo DateTime StartTransactionDate = DateTime.TryParse(txtStartDate.Text + " " + txtStartTime.Text, out StartTransactionDate) ? StartTransactionDate : DateTime.MinValue; DateTime EndTransactionDate = DateTime.TryParse(txtEndDate.Text + " " + txtEndTime.Text, out EndTransactionDate) ? EndTransactionDate : DateTime.MinValue; SalesTransactionItems clsSalesTransactionItemsDemo = new SalesTransactionItems(); System.Data.DataTable dtDemo = clsSalesTransactionItemsDemo.ProductsInDemoReport(Int32.Parse(cboBranch.SelectedItem.Value), Int64.Parse(cboContact.SelectedItem.Value), cboProductGroup.SelectedItem.Text, cboSubGroup.SelectedItem.Text, txtProductCode.Text, "", StartTransactionDate, EndTransactionDate); clsSalesTransactionItemsDemo.CommitAndDispose(); foreach (DataRow dr in dtDemo.Rows) { DataRow drNew = rptds.ProductsInDemo.NewRow(); foreach (DataColumn dc in rptds.ProductsInDemo.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.ProductsInDemo.Rows.Add(drNew); } break; #endregion default: return; } Report.SetDataSource(rptds); SetParameters(Report); }
private void SetDataSource(ReportDocument Report) { string strProductGroup = cboProductGroup.SelectedItem.Text == Constants.ALL ? string.Empty : cboProductGroup.SelectedItem.Text; string TransactionNo = txtTransactionNo.Text; string CustomerGroupName = cboContactGroupName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactGroupName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboContactGroupName.SelectedItem.Text; string CustomerName = cboContactName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboContactName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboContactName.SelectedItem.Text; string AgentName = cboAgent.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboAgent.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboAgent.SelectedItem.Text; string CashierName = cboCashierName.SelectedItem.Text.Substring(0, 3).Trim() == Constants.ALL ? cboCashierName.SelectedItem.Text.Replace("ALL", "").Replace("LIKE", "").Trim() : cboCashierName.SelectedItem.Text; string TerminalNo = cboTerminalNo.SelectedItem.Text == Constants.ALL ? string.Empty : cboTerminalNo.SelectedItem.Text; DateTime StartTransactionDate = DateTime.MinValue; StartTransactionDate = DateTime.TryParse(txtStartTransactionDate.Text + " " + txtStartTime.Text, out StartTransactionDate) ? StartTransactionDate : DateTime.MinValue; DateTime EndTransactionDate = DateTime.MinValue; EndTransactionDate = DateTime.TryParse(txtEndTransactionDate.Text + " " + txtEndTime.Text, out EndTransactionDate) ? EndTransactionDate : DateTime.MinValue; TransactionStatus Status = (TransactionStatus)Enum.Parse(typeof(TransactionStatus), cboTransactionStatus.SelectedItem.Value); PaymentTypes PaymentType = (PaymentTypes)Enum.Parse(typeof(PaymentTypes), cboPaymentType.SelectedItem.Value); DataTable dt = new DataTable(); ReportDataset rptds = new ReportDataset(); SalesTransactions clsSalesTransactions; SalesTransactionItems clsSalesTransactionItems; SalesTransactionsColumns clsSalesTransactionsColumns = new SalesTransactionsColumns(); #region clsSalesTransactionsColumns clsSalesTransactionsColumns.BranchCode = true; clsSalesTransactionsColumns.TransactionNo = true; clsSalesTransactionsColumns.CustomerName = true; clsSalesTransactionsColumns.CustomerGroupName = true; clsSalesTransactionsColumns.CashierName = true; clsSalesTransactionsColumns.TerminalNo = true; clsSalesTransactionsColumns.TransactionDate = true; clsSalesTransactionsColumns.DateSuspended = true; clsSalesTransactionsColumns.DateResumed = true; clsSalesTransactionsColumns.TransactionStatus = true; clsSalesTransactionsColumns.SubTotal = true; clsSalesTransactionsColumns.Discount = true; clsSalesTransactionsColumns.VAT = true; clsSalesTransactionsColumns.VATableAmount = true; clsSalesTransactionsColumns.LocalTax = true; clsSalesTransactionsColumns.AmountPaid = true; clsSalesTransactionsColumns.CashPayment = true; clsSalesTransactionsColumns.ChequePayment = true; clsSalesTransactionsColumns.CreditCardPayment = true; clsSalesTransactionsColumns.BalanceAmount = true; clsSalesTransactionsColumns.ChangeAmount = true; clsSalesTransactionsColumns.DateClosed = true; clsSalesTransactionsColumns.PaymentType = true; clsSalesTransactionsColumns.ItemsDiscount = true; clsSalesTransactionsColumns.Charge = true; clsSalesTransactionsColumns.CreditPayment = true; clsSalesTransactionsColumns.CreatedByName = true; clsSalesTransactionsColumns.AgentName = true; clsSalesTransactionsColumns.PaxNo = true; #endregion SalesTransactionDetails clsSearchKey = new SalesTransactionDetails(); clsSearchKey = new SalesTransactionDetails(); clsSearchKey.TransactionNo = TransactionNo; clsSearchKey.CustomerGroupName = CustomerGroupName; clsSearchKey.CustomerName = CustomerName; clsSearchKey.CashierName = CashierName; clsSearchKey.TerminalNo = TerminalNo; clsSearchKey.BranchID = int.Parse(cboBranch.SelectedItem.Value); clsSearchKey.TransactionDateFrom = StartTransactionDate; clsSearchKey.TransactionDateTo = EndTransactionDate; clsSearchKey.TransactionStatus = Status; clsSearchKey.PaymentType = PaymentType; clsSearchKey.AgentName = AgentName; clsSearchKey.isConsignmentSearch = cboConsignment.SelectedItem.Value; if (clsSearchKey.isConsignmentSearch != "-1") { clsSearchKey.isConsignment = bool.Parse(cboConsignment.SelectedItem.Value); } string strReportType = cboReportType.SelectedValue; switch (strReportType) { case ReportTypes.ANALYTICS_All: case ReportTypes.ANALYTICS_All_Covers: #region Daily, Weekely, Monthly Sales Transaction clsSalesTransactions = new SalesTransactions(); dt = clsSalesTransactions.List(clsSalesTransactionsColumns, clsSearchKey, System.Data.SqlClient.SortOrder.Ascending, 0, "TransactionDate", System.Data.SqlClient.SortOrder.Ascending); clsSalesTransactions.CommitAndDispose(); foreach (DataRow dr in dt.Rows) { DataRow drNew = rptds.Transactions.NewRow(); foreach (DataColumn dc in rptds.Transactions.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.Transactions.Rows.Add(drNew); } break; #endregion case ReportTypes.ANALYTICS_ItemsForPOBasedOnSales: #region Items For PO Based On Sales SaleperItemFilterType enumSaleperItemFilterType = SaleperItemFilterType.ShowBothPositiveAndNegative; if (rdoShowPositiveOnly.Checked) { enumSaleperItemFilterType = SaleperItemFilterType.ShowPositiveOnly; } if (rdoShowNegativeOnly.Checked) { enumSaleperItemFilterType = SaleperItemFilterType.ShowNegativeOnly; } clsSalesTransactionItems = new SalesTransactionItems(); //if (cboProductGroup.Text == Constants.ALL) // dt = clsSalesTransactionItems.SalesPerItem(TransactionNo + "%", CustomerName + "%", CashierName + "%", // TerminalNo + "%", StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType); //else // dt = clsSalesTransactionItems.SalesPerItemByGroup(strProductGroup + "%", TransactionNo + "%", CustomerName + "%", CashierName + "%", // TerminalNo + "%", StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType); if (cboProductGroup.Text == Constants.ALL) { dt = clsSalesTransactionItems.SalesPerItem(TransactionNo, CustomerName, CashierName, TerminalNo, StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType); } else { dt = clsSalesTransactionItems.SalesPerItemByGroupProc(strProductGroup, TransactionNo, CustomerName, CashierName, TerminalNo, StartTransactionDate, EndTransactionDate, Status, PaymentType, enumSaleperItemFilterType); } clsSalesTransactionItems.CommitAndDispose(); foreach (DataRow dr in dt.Rows) { DataRow drNew = rptds.SalesTransactionPerItem.NewRow(); foreach (DataColumn dc in rptds.SalesTransactionPerItem.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.SalesTransactionPerItem.Rows.Add(drNew); } break; #endregion default: break; } Report.SetDataSource(rptds); SetParameters(Report); }