private void SetDataSource(ReportDocument Report) { string TransactionNo = Session["tranno"].ToString(); ReportDataset rptds = new ReportDataset(); Stock clsStock = new Stock(); DataTable dt = clsStock.Search(TransactionNo); clsStock.CommitAndDispose(); long StockID = Convert.ToInt64(dt.Rows[0]["StockID"].ToString()); StockItem clsStockItem = new StockItem(); DataTable dtItems = clsStockItem.ListAsDataTable(StockID); clsStockItem.CommitAndDispose(); foreach(DataRow dr in dt.Rows) { DataRow drNew = rptds.Stocks.NewRow(); foreach (DataColumn dc in rptds.Stocks.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.Stocks.Rows.Add(drNew); } foreach(DataRow dr in dtItems.Rows) { DataRow drNew = rptds.StockItems.NewRow(); foreach (DataColumn dc in rptds.StockItems.Columns) drNew[dc] = dr[dc.ColumnName]; rptds.StockItems.Rows.Add(drNew); } Report.SetDataSource(rptds); SetParameters(Report); }
private void SetDataSourceProductHistory(ReportDocument Report) { ReportDataset rptds = new ReportDataset(); DateTime DateFrom = DateTime.MinValue; try { DateFrom = Convert.ToDateTime(txtStartDate.Text + " " + txtStartTime.Text); } catch { } DateTime DateTo = DateTime.MinValue; try { DateTo = Convert.ToDateTime(txtEndDate.Text + " " + txtEndTime.Text); } catch { } StockItem clsStockItem = new StockItem(); MySqlDataReader myreader = clsStockItem.ProductHistoryReport(Convert.ToInt64(cboProductCode.SelectedItem.Value), DateFrom, DateTo); clsStockItem.CommitAndDispose(); while (myreader.Read()) { DataRow drStockItem = rptds.ProductHistory.NewRow(); foreach (DataColumn dc in rptds.ProductHistory.Columns) drStockItem[dc] = myreader[dc.ColumnName]; rptds.ProductHistory.Rows.Add(drStockItem); } Report.SetDataSource(rptds); }
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 LoadItems() { DataClass clsDataClass = new DataClass(); StockItem clsStockItem = new StockItem(); lstItem.DataSource = clsStockItem.ListAsDataTable(Convert.ToInt64(lblStockID.Text)).DefaultView; lstItem.DataBind(); clsStockItem.CommitAndDispose(); ComputeAmount(); }