Exemplo n.º 1
0
        /// <summary>
        /// Build and show Local Receiving Material
        /// </summary>
        /// <author> Tuan TQ, 11 Jun, 2006</author>
        public DataTable ExecuteReport(string pstrCCNID,
                                       string pstrMasLocID,
                                       string pstrFromDate,
                                       string pstrToDate,
                                       string pstrCurrencyID,
                                       string pstrExchangeRate,
                                       string pstrProductIDList,
                                       string pstrVendorIDList
                                       )
        {
            const string DATE_HOUR_FORMAT = "dd-MM-yyyy HH:mm";
            const string NUMERIC_FORMAT   = "#,##0.00";

            const string REPORT_TEMPLATE = "LocalReceivingMaterialReport.xml";

            const string RPT_PAGE_HEADER = "PageHeader";

            const string REPORT_NAME     = "LocalReceivingMaterialReport";
            const string RPT_TITLE_FLD   = "fldTitle";
            const string RPT_COMPANY_FLD = "fldCompany";

            const string RPT_CCN_FLD             = "CCN";
            const string RPT_MASTER_LOCATION_FLD = "Master Location";
            const string RPT_FROM_DATE_FLD       = "From Date";
            const string RPT_TO_DATE_FLD         = "To Date";
            const string RPT_PART_NUMBER_FLD     = "Part Number";
            const string RPT_CURRENCY_FLD        = "Currency";
            const string RPT_EXCHANGE_RATE_FLD   = "Exchange Rate";
            const string RPT_VENDOR_FLD          = "Vendor";

            DataTable dtbDataSource = null;

            string strHomeCurrency = GetHomeCurrency(pstrCCNID);

            DateTime dtmFromDate = DateTime.MinValue;
            DateTime dtmToDate   = DateTime.MinValue;

            try
            {
                dtmFromDate = Convert.ToDateTime(pstrFromDate);
            }
            catch {}
            try
            {
                dtmToDate = Convert.ToDateTime(pstrToDate);
            }
            catch {}

            #region build table schema

            dtbDataSource = new DataTable();
            dtbDataSource.Columns.Add(new DataColumn("PartyCode", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("PartyName", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("ProductID", typeof(int)));
            dtbDataSource.Columns.Add(new DataColumn("PartNo", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("PartName", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("PartModel", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("BuyingUM", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("CategoryCode", typeof(string)));
            dtbDataSource.Columns.Add(new DataColumn("ReceiveQuantity", typeof(decimal)));
            dtbDataSource.Columns.Add(new DataColumn("Amount", typeof(decimal)));
            dtbDataSource.Columns.Add(new DataColumn("VATAmount", typeof(decimal)));
            dtbDataSource.Columns.Add(new DataColumn("ReturnedQuantity", typeof(decimal)));
            dtbDataSource.Columns["ReturnedQuantity"].AllowDBNull = true;
            dtbDataSource.Columns.Add(new DataColumn("ReturnedAmount", typeof(decimal)));
            dtbDataSource.Columns["ReturnedAmount"].AllowDBNull = true;
            dtbDataSource.Columns.Add(new DataColumn("ReturnedVATAmount", typeof(decimal)));
            dtbDataSource.Columns["ReturnedVATAmount"].AllowDBNull = true;

            #endregion

            // get receive data
            DataTable dtbReceipt = GetReceiptData(pstrCCNID, pstrMasLocID, dtmFromDate, dtmToDate,
                                                  pstrProductIDList, pstrCurrencyID, pstrExchangeRate, pstrVendorIDList);
            // get return data
            DataTable dtbReturn = GetReturnData(pstrCCNID, pstrMasLocID, dtmFromDate, dtmToDate,
                                                pstrProductIDList, pstrCurrencyID, pstrExchangeRate, pstrVendorIDList);

            // list of party
            ArrayList arrParty = GetPartyIDs(pstrCCNID, pstrMasLocID, dtmFromDate, dtmToDate, pstrProductIDList, pstrVendorIDList);
            foreach (string strPartyID in arrParty)
            {
                // item of current party
                DataRow[] drowsItem        = dtbReceipt.Select("PartyID = " + strPartyID, "ProductID ASC");
                string    strLastProductID = string.Empty;
                foreach (DataRow drowItem in drowsItem)
                {
                    if (strLastProductID != drowItem["ProductID"].ToString())
                    {
                        strLastProductID = drowItem["ProductID"].ToString();

                        string strFilter = "PartyID = " + strPartyID + " AND ProductID = " + strLastProductID;

                        #region general information

                        DataRow drowResult = dtbDataSource.NewRow();
                        drowResult["PartyCode"]    = drowItem["PartyCode"];
                        drowResult["PartyName"]    = drowItem["PartyName"];
                        drowResult["PartNo"]       = drowItem["PartNo"];
                        drowResult["PartName"]     = drowItem["PartName"];
                        drowResult["PartModel"]    = drowItem["PartModel"];
                        drowResult["BuyingUM"]     = drowItem["BuyingUM"];
                        drowResult["CategoryCode"] = drowItem["CategoryCode"];
                        drowResult["ProductID"]    = drowItem["ProductID"];

                        #endregion

                        #region receive data

                        decimal decReceiveQuantity = 0, decAmount = 0, decVATAmount = 0;
                        try
                        {
                            decReceiveQuantity = Convert.ToDecimal(dtbReceipt.Compute("SUM(ReceiveQuantity)", strFilter));
                        }
                        catch {}
                        try
                        {
                            decAmount = Convert.ToDecimal(dtbReceipt.Compute("SUM(Amount)", strFilter));
                        }
                        catch {}
                        try
                        {
                            decVATAmount = Convert.ToDecimal(dtbReceipt.Compute("SUM(VATAmount)", strFilter));
                        }
                        catch {}

                        drowResult["ReceiveQuantity"] = decReceiveQuantity;
                        drowResult["Amount"]          = decAmount;
                        drowResult["VATAmount"]       = decVATAmount;

                        #endregion

                        #region return data

                        decimal decReturnedQuantity = 0, decReturnedAmount = 0, decReturnedVATAmount = 0;
                        try
                        {
                            decReturnedQuantity = Convert.ToDecimal(dtbReturn.Compute("SUM(Quantity)", strFilter));
                        }
                        catch {}
                        try
                        {
                            decReturnedAmount = Convert.ToDecimal(dtbReturn.Compute("SUM(Amount)", strFilter));
                        }
                        catch {}
                        try
                        {
                            decReturnedVATAmount = Convert.ToDecimal(dtbReturn.Compute("SUM(VATAmount)", strFilter));
                        }
                        catch {}

                        if (decReturnedQuantity != 0)
                        {
                            drowResult["ReturnedQuantity"] = decReturnedQuantity;
                        }
                        if (decReturnedAmount != 0)
                        {
                            drowResult["ReturnedAmount"] = decReturnedAmount;
                        }
                        if (decReturnedVATAmount != 0)
                        {
                            drowResult["ReturnedVATAmount"] = decReturnedVATAmount;
                        }

                        #endregion

                        // insert to result table
                        dtbDataSource.Rows.Add(drowResult);
                    }
                }
            }

            //Create builder object
            ReportWithSubReportBuilder reportBuilder = new ReportWithSubReportBuilder();

            //Set report name
            reportBuilder.ReportName = REPORT_NAME;

            //Set Datasource
            reportBuilder.SourceDataTable = dtbDataSource;

            //Set report layout location
            reportBuilder.ReportDefinitionFolder = mstrReportDefinitionFolder;
            reportBuilder.ReportLayoutFile       = REPORT_TEMPLATE;

            reportBuilder.UseLayoutFile = true;
            reportBuilder.MakeDataTableForRender();

            // and show it in preview dialog
            C1PrintPreviewDialog printPreview = new C1PrintPreviewDialog();

            //Attach report viewer
            reportBuilder.ReportViewer = printPreview.ReportViewer;
            reportBuilder.RenderReport();

            reportBuilder.DrawPredefinedField(RPT_COMPANY_FLD, GetCompanyFullName());
            //Draw parameters
            NameValueCollection arrParamAndValue = new NameValueCollection();

            arrParamAndValue.Add(RPT_CCN_FLD, GetCCNInfoByID(pstrCCNID));
            arrParamAndValue.Add(RPT_MASTER_LOCATION_FLD, GetMasterLocationInfoByID(pstrMasLocID));

            Hashtable htbCurrency = GetCurrencyInfo(pstrCurrencyID);
            if (htbCurrency != null)
            {
                arrParamAndValue.Add(RPT_CURRENCY_FLD, htbCurrency[PRODUCT_CODE_FLD].ToString());

                if (strHomeCurrency == pstrCurrencyID)
                {
                    arrParamAndValue.Add(RPT_EXCHANGE_RATE_FLD, decimal.One.ToString(NUMERIC_FORMAT));
                }
                else
                {
                    if (pstrExchangeRate != string.Empty && pstrExchangeRate != null)
                    {
                        arrParamAndValue.Add(RPT_EXCHANGE_RATE_FLD, decimal.Parse(pstrExchangeRate).ToString(NUMERIC_FORMAT));
                    }
                    else
                    {
                        arrParamAndValue.Add(RPT_EXCHANGE_RATE_FLD, decimal.Parse(htbCurrency[EXCHANGE_RATE_FLD].ToString()).ToString(NUMERIC_FORMAT));
                    }
                }
            }

            if (pstrFromDate != null && pstrFromDate != string.Empty)
            {
                arrParamAndValue.Add(RPT_FROM_DATE_FLD, DateTime.Parse(pstrFromDate).ToString(DATE_HOUR_FORMAT));
            }

            if (pstrToDate != null && pstrToDate != string.Empty)
            {
                arrParamAndValue.Add(RPT_TO_DATE_FLD, DateTime.Parse(pstrToDate).ToString(DATE_HOUR_FORMAT));
            }

            if (pstrProductIDList != null && pstrProductIDList != string.Empty)
            {
                arrParamAndValue.Add(RPT_PART_NUMBER_FLD, GetProductInfo(pstrProductIDList));
            }

            if (pstrVendorIDList != null && pstrVendorIDList != string.Empty)
            {
                arrParamAndValue.Add(RPT_VENDOR_FLD, GetPartyInfo(pstrVendorIDList));
            }

            //Anchor the Parameter drawing canvas cordinate to the fldTitle
            Field  fldTitle  = reportBuilder.GetFieldByName(RPT_TITLE_FLD);
            double dblStartX = fldTitle.Left;
            double dblStartY = fldTitle.Top + 1.3 * fldTitle.RenderHeight;
            reportBuilder.GetSectionByName(RPT_PAGE_HEADER).CanGrow = true;
            reportBuilder.DrawParameters(reportBuilder.GetSectionByName(RPT_PAGE_HEADER), dblStartX, dblStartY, arrParamAndValue, reportBuilder.Report.Font.Size);

            try
            {
                printPreview.FormTitle = reportBuilder.GetFieldByName(RPT_TITLE_FLD).Text;
            }
            catch
            {
            }

            reportBuilder.RefreshReport();
            printPreview.Show();

            //return table
            return(dtbDataSource);
        }
Exemplo n.º 2
0
        public DataTable ExecuteReport(string pstrCCN, string pstrCategory, string pstrModel, string pstrSource, string pstrType, string pstrMakeItem)
        {
            try
            {
                //const char UNCHECK_SQUARE_CHAR = (char)111;
                //const char CHECK_SQUARE_CHAR = (char)120;
                //const char SPACE_CHAR = (char)32;

                //Report name
                const string REPORT_NAME   = "ItemListReport";
                const string REPORT_LAYOUT = "ItemListReport.xml";

                const string RPT_HEADER = "Header";
                //Report field names
                const string RPT_TITLE_FIELD = "fldTitle";
                //Report field names
                const string RPT_CCN       = "CCN";
                const string RPT_CATEGORY  = "Category";
                const string RPT_MODEL     = "Model";
                const string RPT_SOURCE    = "Source";
                const string RPT_TYPE      = "Type";
                const string RPT_MAKE_ITEM = "Make";

                DataTable dtbItemList = GetItemListData(pstrCCN, pstrCategory, pstrModel, pstrSource, pstrType, pstrMakeItem);

                //Create builder object
                ReportWithSubReportBuilder reportBuilder = new ReportWithSubReportBuilder();
                //Set report name
                reportBuilder.ReportName = REPORT_NAME;

                //Set Datasource
                reportBuilder.SourceDataTable = dtbItemList;

                //Set report layout location
                reportBuilder.ReportDefinitionFolder = mstrReportDefinitionFolder;
                reportBuilder.ReportLayoutFile       = REPORT_LAYOUT;

                reportBuilder.UseLayoutFile = true;
                reportBuilder.MakeDataTableForRender();

                // and show it in preview dialog
                PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog printPreview = new PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog();

                //Attach report viewer
                reportBuilder.ReportViewer = printPreview.ReportViewer;
                reportBuilder.RenderReport();

                //Draw parameters
                System.Collections.Specialized.NameValueCollection arrParamAndValue = new System.Collections.Specialized.NameValueCollection();
                arrParamAndValue.Add(RPT_CCN, pstrCCN);
                if (pstrCategory != string.Empty)
                {
                    arrParamAndValue.Add(RPT_CATEGORY, pstrCategory);
                }

                if (pstrModel != string.Empty)
                {
                    arrParamAndValue.Add(RPT_MODEL, pstrModel);
                }

                if (pstrSource != string.Empty)
                {
                    arrParamAndValue.Add(RPT_SOURCE, pstrSource);
                }

                if (pstrType != string.Empty)
                {
                    arrParamAndValue.Add(RPT_TYPE, pstrType);
                }

                if (pstrMakeItem.ToUpper().Equals("TRUE") || pstrMakeItem.Equals("1"))
                {
                    arrParamAndValue.Add(RPT_MAKE_ITEM, "x");
                }

                //Anchor the Parameter drawing canvas cordinate to the fldTitle
                C1.C1Report.Field fldTitle  = reportBuilder.GetFieldByName(RPT_TITLE_FIELD);
                double            dblStartX = fldTitle.Left;
                double            dblStartY = fldTitle.Top + 1.3 * fldTitle.RenderHeight;
                reportBuilder.GetSectionByName(RPT_HEADER).CanGrow = true;
                reportBuilder.DrawParameters(reportBuilder.GetSectionByName(RPT_HEADER), dblStartX, dblStartY, arrParamAndValue, reportBuilder.Report.Font.Size);

                try
                {
                    printPreview.FormTitle = reportBuilder.GetFieldByName(RPT_TITLE_FIELD).Text;
                }
                catch {}

                //Show report
                reportBuilder.RefreshReport();
                printPreview.Show();

                return(dtbItemList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Build and show Detai lItem Price By PO Receipt
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author> Tuan TQ, 11 Apr, 2006</author>
        public DataTable ExecuteReport(string pstrCCNID,
                                       string pstrMasLocID,
                                       string pstrFromDate,
                                       string pstrToDate,
                                       string pstrCurrencyID,
                                       string pstrExchangeRate,
                                       string pstrProductIDList,
                                       string pstrVendorType,
                                       string pstrVendorIDList
                                       )
        {
            string strPOTypeID = Convert.ToString((int)PCSComUtils.Common.POReceiptTypeEnum.ByInvoice);

            const string DATE_HOUR_FORMAT = "dd-MM-yyyy HH:mm";
            const string NUMERIC_FORMAT   = "#,##0.00";

            const string REPORT_TEMPLATE_LOCAL = "ReceivingMaterialReport_Local.xml";
            const string REPORT_TEMPLATE       = "ReceivingMaterialReport.xml";

            const string RPT_PAGE_HEADER = "PageHeader";

            const string REPORT_NAME     = "ReceivingMaterialReport";
            const string RPT_TITLE_FLD   = "fldTitle";
            const string RPT_COMPANY_FLD = "fldCompany";

            const string RPT_CCN_FLD             = "CCN";
            const string RPT_MASTER_LOCATION_FLD = "Master Location";
            const string RPT_FROM_DATE_FLD       = "From Date";
            const string RPT_TO_DATE_FLD         = "To Date";
            const string RPT_PART_NUMBER_FLD     = "Part Number";
            const string RPT_CURRENCY_FLD        = "Currency";
            const string RPT_EXCHANGE_RATE_FLD   = "Exchange Rate";
            const string RPT_VENDOR_FLD          = "Vendor";
            const string RPT_VENDOR_TYPE_FLD     = "Vendor Type";

            DataTable dtbDataSource = null;

            string strHomeCurrency = GetHomeCurrency(pstrCCNID);

            dtbDataSource = GetReceivingMaterialReportData(pstrCCNID,
                                                           pstrMasLocID,
                                                           pstrFromDate,
                                                           pstrToDate,
                                                           pstrProductIDList,
                                                           pstrCurrencyID,
                                                           pstrExchangeRate,
                                                           strHomeCurrency,
                                                           pstrVendorType,
                                                           pstrVendorIDList);

            //Create builder object
            ReportWithSubReportBuilder reportBuilder = new ReportWithSubReportBuilder();

            //Set report name
            reportBuilder.ReportName = REPORT_NAME;

            //Set Datasource
            reportBuilder.SourceDataTable = dtbDataSource;

            //Set report layout location
            reportBuilder.ReportDefinitionFolder = mstrReportDefinitionFolder;
            if (pstrVendorType != null && pstrVendorType != string.Empty)
            {
                if (pstrVendorType.ToUpper() == LOCAL_STRING.ToUpper())
                {
                    reportBuilder.ReportLayoutFile = REPORT_TEMPLATE_LOCAL;
                }
                else
                {
                    reportBuilder.ReportLayoutFile = REPORT_TEMPLATE;
                }
            }
            else
            {
                reportBuilder.ReportLayoutFile = REPORT_TEMPLATE;
            }

            reportBuilder.UseLayoutFile = true;
            reportBuilder.MakeDataTableForRender();

            // and show it in preview dialog
            PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog printPreview = new PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog();

            //Attach report viewer
            reportBuilder.ReportViewer = printPreview.ReportViewer;
            reportBuilder.RenderReport();

            reportBuilder.DrawPredefinedField(RPT_COMPANY_FLD, GetCompanyFullName());
            //Draw parameters
            System.Collections.Specialized.NameValueCollection arrParamAndValue = new System.Collections.Specialized.NameValueCollection();

            arrParamAndValue.Add(RPT_CCN_FLD, GetCCNInfoByID(pstrCCNID));
            arrParamAndValue.Add(RPT_MASTER_LOCATION_FLD, GetMasterLocationInfoByID(pstrMasLocID));

            Hashtable htbCurrency = GetCurrencyInfo(pstrCurrencyID);

            if (htbCurrency != null)
            {
                arrParamAndValue.Add(RPT_CURRENCY_FLD, htbCurrency[PRODUCT_CODE_FLD].ToString());

                if (strHomeCurrency == pstrCurrencyID)
                {
                    arrParamAndValue.Add(RPT_EXCHANGE_RATE_FLD, decimal.One.ToString(NUMERIC_FORMAT));
                }
                else
                {
                    if (pstrExchangeRate != string.Empty && pstrExchangeRate != null)
                    {
                        arrParamAndValue.Add(RPT_EXCHANGE_RATE_FLD, decimal.Parse(pstrExchangeRate).ToString(NUMERIC_FORMAT));
                    }
                    else
                    {
                        arrParamAndValue.Add(RPT_EXCHANGE_RATE_FLD, decimal.Parse(htbCurrency[EXCHANGE_RATE_FLD].ToString()).ToString(NUMERIC_FORMAT));
                    }
                }
            }

            if (pstrFromDate != null && pstrFromDate != string.Empty)
            {
                arrParamAndValue.Add(RPT_FROM_DATE_FLD, DateTime.Parse(pstrFromDate).ToString(DATE_HOUR_FORMAT));
            }

            if (pstrToDate != null && pstrToDate != string.Empty)
            {
                arrParamAndValue.Add(RPT_TO_DATE_FLD, DateTime.Parse(pstrToDate).ToString(DATE_HOUR_FORMAT));
            }

            if (pstrProductIDList != null && pstrProductIDList != string.Empty)
            {
                arrParamAndValue.Add(RPT_PART_NUMBER_FLD, GetProductInfo(pstrProductIDList));
            }

            if (pstrVendorType != null && pstrVendorType != string.Empty)
            {
                arrParamAndValue.Add(RPT_VENDOR_TYPE_FLD, pstrVendorType);
            }

            if (pstrVendorIDList != null && pstrVendorIDList != string.Empty)
            {
                arrParamAndValue.Add(RPT_VENDOR_FLD, GetPartyInfo(pstrVendorIDList));
            }

            //Anchor the Parameter drawing canvas cordinate to the fldTitle
            C1.C1Report.Field fldTitle  = reportBuilder.GetFieldByName(RPT_TITLE_FLD);
            double            dblStartX = fldTitle.Left;
            double            dblStartY = fldTitle.Top + 1.3 * fldTitle.RenderHeight;

            reportBuilder.GetSectionByName(RPT_PAGE_HEADER).CanGrow = true;
            reportBuilder.DrawParameters(reportBuilder.GetSectionByName(RPT_PAGE_HEADER), dblStartX, dblStartY, arrParamAndValue, reportBuilder.Report.Font.Size);

            try
            {
                printPreview.FormTitle = reportBuilder.GetFieldByName(RPT_TITLE_FLD).Text;
            }
            catch
            {}

            reportBuilder.RefreshReport();
            printPreview.Show();

            //return table
            return(dtbDataSource);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Build and show Detai lItem Price By PO Receipt
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author> Tuan TQ, 11 Apr, 2006</author>
        public DataTable ExecuteReport(string pstrCCNID,
                                       string pstrFromDate,
                                       string pstrToDate,
                                       string pstrCurrencyIDList
                                       )
        {
            try
            {
                string strPOTypeID = Convert.ToString((int)PCSComUtils.Common.POReceiptTypeEnum.ByInvoice);

                const string DATE_HOUR_FORMAT = "dd-MM-yyyy HH:mm";
                const string NUMERIC_FORMAT   = "#,##0.00";

                const string REPORT_TEMPLATE = "ImportMaterialReport.xml";
                const string RPT_PAGE_HEADER = "PageHeader";

                const string REPORT_NAME     = "ImportMaterialReport";
                const string RPT_TITLE_FLD   = "fldTitle";
                const string RPT_COMPANY_FLD = "fldCompany";

                const string RPT_CCN_FLD       = "CCN";
                const string RPT_FROM_DATE_FLD = "From Date";
                const string RPT_TO_DATE_FLD   = "To Date";
                const string RPT_CURRENCY_FLD  = "Currency";

                DataTable dtbDataSource = null;

                dtbDataSource = GetImportMaterialReport(pstrCCNID, pstrFromDate, pstrToDate, pstrCurrencyIDList);

                //Create builder object
                ReportWithSubReportBuilder reportBuilder = new ReportWithSubReportBuilder();

                //Set report name
                reportBuilder.ReportName = REPORT_NAME;

                //Set Datasource
                reportBuilder.SourceDataTable = dtbDataSource;

                //Set report layout location
                reportBuilder.ReportDefinitionFolder = mstrReportDefinitionFolder;
                reportBuilder.ReportLayoutFile       = REPORT_TEMPLATE;

                reportBuilder.UseLayoutFile = true;
                reportBuilder.MakeDataTableForRender();

                // and show it in preview dialog
                PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog printPreview = new PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog();

                //Attach report viewer
                reportBuilder.ReportViewer = printPreview.ReportViewer;
                reportBuilder.RenderReport();

                reportBuilder.DrawPredefinedField(RPT_COMPANY_FLD, GetCompanyFullName());
                //Draw parameters
                System.Collections.Specialized.NameValueCollection arrParamAndValue = new System.Collections.Specialized.NameValueCollection();

                arrParamAndValue.Add(RPT_CCN_FLD, GetCCNInfoByID(pstrCCNID));

                if (pstrFromDate != null && pstrFromDate != string.Empty)
                {
                    arrParamAndValue.Add(RPT_FROM_DATE_FLD, DateTime.Parse(pstrFromDate).ToString(DATE_HOUR_FORMAT));
                }

                if (pstrToDate != null && pstrToDate != string.Empty)
                {
                    arrParamAndValue.Add(RPT_TO_DATE_FLD, DateTime.Parse(pstrToDate).ToString(DATE_HOUR_FORMAT));
                }

                if (pstrCurrencyIDList != null && pstrCurrencyIDList != string.Empty)
                {
                    arrParamAndValue.Add(RPT_CURRENCY_FLD, GetCurrencyInfo(pstrCurrencyIDList));
                }

                //Anchor the Parameter drawing canvas cordinate to the fldTitle
                C1.C1Report.Field fldTitle  = reportBuilder.GetFieldByName(RPT_TITLE_FLD);
                double            dblStartX = fldTitle.Left;
                double            dblStartY = fldTitle.Top + 1.3 * fldTitle.RenderHeight;
                reportBuilder.GetSectionByName(RPT_PAGE_HEADER).CanGrow = true;
                reportBuilder.DrawParameters(reportBuilder.GetSectionByName(RPT_PAGE_HEADER), dblStartX, dblStartY, arrParamAndValue, reportBuilder.Report.Font.Size);

                try
                {
                    printPreview.FormTitle = reportBuilder.GetFieldByName(RPT_TITLE_FLD).Text;
                }
                catch
                {}

                reportBuilder.RefreshReport();
                printPreview.Show();

                //return table
                return(dtbDataSource);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }