Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }