Example #1
0
        public ActionResult CMR010_IssueList()
        {
            try
            {
                ICommonHandler CommonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler;

                List <dtIssueListData> rptList = CommonHandler.GetTmpIssueListData();


                ReportDocument rptH = new ReportDocument();
                string         path = ReportUtil.GetReportPath("Reports/CMR010_IssueList.rpt", Server.MapPath("/"));
                //string path = ReportUtil.GetReportTemplatePath("CTR060_CancelContractMemorandum.rpt");

                rptH.Load(path);


                rptH.SetDataSource(rptList);
                //rptH.Subreports["CTR060_1"].SetDataSource(rptListDetail);

                //rptH.SetParameterValue("AutoBillingTypeNone", AutoTransferBillingType.C_AUTO_TRANSFER_BILLING_TYPE_NONE, "CTR060_1");
                //rptH.SetParameterValue("AutoBillingTypeAll", AutoTransferBillingType.C_AUTO_TRANSFER_BILLING_TYPE_ALL, "CTR060_1");
                //rptH.SetParameterValue("AutoBillingTypePartial", AutoTransferBillingType.C_AUTO_TRANSFER_BILLING_TYPE_PARTIAL, "CTR060_1");
                //rptH.SetParameterValue("BankBillingTypeNone", BankTransferBillingType.C_BANK_TRANSFER_BILLING_TYPE_NONE, "CTR060_1");
                //rptH.SetParameterValue("BankBillingTypeAll", BankTransferBillingType.C_BANK_TRANSFER_BILLING_TYPE_ALL, "CTR060_1");
                //rptH.SetParameterValue("BankBillingTypePartial", BankTransferBillingType.C_BANK_TRANSFER_BILLING_TYPE_PARTIAL, "CTR060_1");
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                rptH.Close();
                return(File(stream, "application/pdf"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public ActionResult CTR080_QuotationForCancelContractMemorandum(int iDocID)
        {
            IContractDocumentHandler contractDocHandler = ServiceContainer.GetService <IContractDocumentHandler>() as IContractDocumentHandler;

            List <RPTCancelContractMemoDo>       rptList       = contractDocHandler.GetRptCancelContractMemoData(iDocID);
            List <RPTCancelContractMemoDetailDo> rptListDetail = contractDocHandler.GetRptCancelContractMemoDetail(iDocID);

            bool isShowDefaultData = false;

            if (rptListDetail == null || rptListDetail.Count == 0)
            {
                rptListDetail     = GetDefaultCancelContractMemoDetailData();
                isShowDefaultData = true;
            }

            ReportDocument rptH = new ReportDocument();
            string         path = ReportUtil.GetReportPath("Reports/CTR080_QuotationForCancelContractMemorandum.rpt", Server.MapPath("/"));

            //string path = ReportUtil.GetReportTemplatePath("CTR080_QuotationForCancelContractMemorandum.rpt");

            rptH.Load(path);
            rptH.SetDataSource(rptList);
            rptH.Subreports["CTR080_1"].SetDataSource(rptListDetail);

            rptH.SetParameterValue("ShowDefaultData", isShowDefaultData, "CTR080_1");

            Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            rptH.Close();

            return(File(stream, "application/pdf"));
        }
Example #3
0
        public void TestFooters()
        {
            var dc = new DataContext();

            dc.AddTable("data", new[] {
                new Item2 {
                    Name = "1", Value = 2, G = "1", Weight = 3
                },
                new Item2 {
                    Name = "2", Value = 3, G = "1", Weight = 1
                },
                new Item2 {
                    Name = "3", Value = 4, G = "2", Weight = 4
                }
            });

            var flow = new Flow {
                Orientation = FlowOrientation.Vertical
            };

            flow.AddTable <Item2>("data");

            var rep   = Report.CreateReport(flow, dc);
            var cells = ReportUtil.GetCellMatrix(rep);

            Debug.WriteLine(ReportUtil.RenderTextReport(rep));

            Assert.AreEqual(6, cells.Count);

            //Footers
            Assert.AreEqual(9m / 4, cells[2][2].Value);
            Assert.AreEqual(16m / 4, cells[4][2].Value);
            Assert.AreEqual(25m / 8, cells[5][2].Value);
        }
Example #4
0
        private void btnPrintReport_Click(object sender, EventArgs e)
        {
            var inicio = dtInicialEdit.DateTime;
            var final  = dtFinalEdit.DateTime;
            var conta  = cbConta.SelectedItem as ContaBancaria;

            if (inicio == null && final == null && conta == null)
            {
                XMessageIts.Advertencia("Informe todos os campos para filtro!");
            }
            else
            {
                string reportName = "ExtratoBancario";
                var    param      = new ReportParameter(inicio, final, conta.CodigoContaBancaria);

                //cria o relatorio e avise que nao precisa setar parametros padrão
                XtraReport report = ReportUtil.CreateReportByName(reportName, false);

                if (report != null)
                {
                    //seta os paramentros
                    param.SetParams(report);

                    //gera relatorio
                    ReportUtil.ShowPreviewReport(report);
                }
            }
        }
Example #5
0
        public ActionResult CTR020_ChangeNotice(int iDocID)
        {
            try
            {
                IContractDocumentHandler contractDocHandler = ServiceContainer.GetService <IContractDocumentHandler>() as IContractDocumentHandler;
                List <RPTChangeNoticeDo> rptList            = contractDocHandler.GetRptChangeNoticeData(iDocID);

                IDocumentHandler documentHandler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler;

                //doDocumentDataGenerate doDoc = new doDocumentDataGenerate();
                //if (rptList.Count > 0)
                //{
                //    doDoc.DocumentNo = rptList[0].DocNo;
                //    doDoc.DocumentCode = rptList[0].DocumentCode;
                //    doDoc.DocumentData = rptList;
                //}

                //Stream stream = documentHandler.GenerateDocument(doDoc);

                string path = ReportUtil.GetReportPath("Reports/CTR020_ChangeNotice.rpt", Server.MapPath("/"));
                //string path = ReportUtil.GetReportTemplatePath("CTR020_ChangeNotice.rpt");

                ReportDocument rptH = new ReportDocument();
                rptH.Load(path);
                rptH.SetDataSource(rptList);
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                rptH.Close();

                return(File(stream, "application/pdf"));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    void LoadDataBind()
    {
        string No = Request.QueryString["id"].ToString();//培训编号
        //string TrainingID = Request.QueryString["TrainingID"].ToString();

        string CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;

        //获取培训基本信息
        DataTable dsTrainingAsseInfo = TrainingAsseBus.PrintTrainingAsse(CompanyCD, No);
        //设置考核结果
        DataTable dtResultInfo = TrainingAsseBus.PrintTrainingDetail(CompanyCD, No);

        if (dsTrainingAsseInfo != null)
        {
            //主报表
            rd.Load(Server.MapPath(@"~/PrinttingModel/HumanManager/TrainingAsse.rpt"));
            CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.TrainingAsse"));
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

            //子报表
            if (dtResultInfo != null)
            {
                ReportDocument rdResultInfo = rd.Subreports["TrainingAsseResult.rpt"];
                rdResultInfo.SetDataSource(dtResultInfo);
            }

            //绑定数据
            rd.SetDataSource(dsTrainingAsseInfo);

            this.CrystalReportViewer1.ReportSource = rd;
            rd.SetParameterValue("Today", "制表人:" + userInfo.EmployeeName);
        }
    }
Example #7
0
        /// <summary>
        /// Criar/Alterar relatorio carregado para o cache
        /// </summary>
        /// <param name="reportImageAnt"></param>
        public RbbFrmReportEditorNew(ReportImage reportImageAnt)
            : this()
        {
            this.reportImageAnt = reportImageAnt;

            try
            {
                if (reportImageAnt.IdReport == 0)
                {
                    reportDesigner1.CreateNewReport();
                    reportDesigner1.ActiveDesignPanel.Report.DisplayName = reportImageAnt.ReportDescription;
                }
                else
                {
                    //abri o relatório selecionado
                    var path = new ReportDaoManager().LoadToCache(this.reportImageAnt);
                    reportDesigner1.OpenReport(path);
                    reportDesigner1.ActiveDesignPanel.Name        = this.reportImageAnt.ReportName;
                    reportDesigner1.ActiveDesignPanel.Report.Name = this.reportImageAnt.ReportName;
                }
                this.sqlDataSource = new SqlDataSource(ReportUtil.GetParamDataSource());
                reportDesigner1.ActiveDesignPanel.Report.DataSource = sqlDataSource;
            }
            catch (Exception ex)
            {
                LoggerUtilIts.GenerateLogs(ex);
            }
        }
    /// <summary>
    /// 绑定报表
    /// </summary>
    private void Print()
    {
        UserInfoUtil UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
        /*接受参数*/
        string BillID    = Request.QueryString["BillID"].ToString();
        string CompanyCD = UserInfo.CompanyCD;
        /*读取数据*/
        DataTable SubSellOrderPri    = SubSellOrderBus.GetSubSellOrderPrint(BillID);
        DataTable SubSellOrderDetail = SubSellOrderBus.GetSubSellOrderDetailPrint(BillID);

        /*绑定RPT*/
        if (SubSellOrderPri != null)
        {
            /*加载主报表*/
            rd.Load(Server.MapPath(@"~/PrinttingModel/SubStoreManager/PrintSellBill.rpt"));
            CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.View_PrintSubSellOrderBill"));

            /*加载子报表*/
            ReportDocument rdDetail = rd.Subreports["PrintSellBillDetail.rpt"];
            rdDetail.SetDataSource(SubSellOrderDetail);

            //绑定数据
            rd.SetDataSource(SubSellOrderPri);
            rd.Refresh();
            this.CrystalReportViewer1.ReportSource = rd;
            rd.SetParameterValue("Creator", UserInfo.UserName);
        }
    }
Example #9
0
        public void Test1()
        {
            var dc = new DataContext();

            dc.AddTable("data", new[] {
                new Item {
                    Name = "1", Value = 2
                },
                new Item {
                    Name = "2", Value = 3
                },
                new Item {
                    Name = "3", Value = 4
                }
            });

            var flow = new Flow {
                Orientation = FlowOrientation.Vertical
            };

            flow.AddTable <Item>("data");

            var rep   = Report.CreateReport(flow, dc);
            var cells = ReportUtil.GetCellMatrix(rep);

            //RowNumber
            Assert.AreEqual(1, cells[0][0].Value);
            Assert.AreEqual(2, cells[1][0].Value);
            Assert.AreEqual(3, cells[2][0].Value);

            //RowNumber
            Assert.AreEqual(2, cells[0][2].Value);
            Assert.AreEqual(5, cells[1][2].Value);
            Assert.AreEqual(9, cells[2][2].Value);
        }
    /*绑定主表信息*/
    protected void BindMainInfo()
    {
        /*接受参数*/

        string OrderNo = Request.QueryString["no"].ToString();


        /*读取数据*/
        DataTable dt       = SellOfferBus.GetRepOrder(OrderNo);
        DataTable dtDetail = SellOfferBus.GetRepOrderDetail(OrderNo);

        /*绑定RPT*/
        if (dt != null)
        {
            /*加载主报表*/
            rd.Load(Server.MapPath(@"~/PrinttingModel/SellManager/SellOffer.rpt"));
            crViewer.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.sellmodule_report_SellOffer"));

            /*加载子报表*/
            ReportDocument rdDetail = rd.Subreports["SellOfferDetail.rpt"];
            rdDetail.SetDataSource(dtDetail);

            //绑定数据
            rd.SetDataSource(dt);
            rd.Refresh();
            this.crViewer.ReportSource = rd;
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            rd.SetParameterValue("PrintName", "制表人:" + userInfo.UserName);
        }
    }
Example #11
0
        public static void Build()
        {
            ReportBuilder rptbuild = new ReportBuilder();
            ReportType    vReport  = rptbuild.Report;
            BodyType      vBody    = vReport.Body;

            // double x = 0, y = 0, wd = 0 , ht = 0;

            vReport.Width.Value = RPT_WIDTH;
            vBody.Height.Value  = RPT_HEIGHT;

            DataSetType dataSet = rptbuild.Report.DataSets[0];

            dataSet.Name = "MyDataSource_Items";

            ReportUtil.AddFields(dataSet.Fields, new string[] {
                POUTWARDITEMS.SLNO,
                POUTWARDITEMS.OUTWARD_ID,
                POUTWARDITEMS.STYLE_ID,
                POUTWARDITEMS.ARTICLE_ID,
                POUTWARDITEMS.PRODUCT_ID,
                POUTWARDITEMS.COLOURS_ID,
                POUTWARDITEMS.SIZES_ID,
                POUTWARDITEMS.QTY
            });



            BuildDetail(vBody);

            ///== END OF REPORT  ===========================================================================///
            rptbuild.SaveAs(PRINT_FOLDER + @"\P_OutwardItem.rdlc");
        }
Example #12
0
        internal void InitializeTest()
        {
            ReportUtil.AddTestcaseDetailsToExtentReport();
            browser = ConfigurationManager.AppSettings["Browser"].ToLower();
            url     = ConfigurationManager.AppSettings["URL"];
            switch (browser)
            {
            case "chrome":
                driver = new ChromeDriver();
                break;

            case "firefox":
                driver = new FirefoxDriver();
                break;

            case "ie":
                driver = new InternetExplorerDriver();
                break;

            default:
                throw new Exception("Browser name is not properly mentioned in the App.config file.");
            }
            driver.Manage().Window.Maximize();
            driver.Url = url;
            int waitTime = Convert.ToInt32(ConfigurationManager.AppSettings["WaitTime"]);

            wait           = new WebDriverWait(driver, TimeSpan.FromSeconds(waitTime));
            ScreenshotUtil = new ScreenshotUtil(driver);
        }
Example #13
0
    /*绑定主表信息*/
    protected void BindMainInfo()
    {
        /*接受参数*/

        string OrderNo = Request.QueryString["no"].ToString();


        /*读取数据*/
        DataTable dt = HRProxyBus.GetRepOrder(OrderNo);

        /*绑定RPT*/
        if (dt != null)
        {
            /*加载主报表*/
            rd.Load(Server.MapPath(@"~/PrinttingModel/HumanManager/HRProxy.rpt"));
            crViewer.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.HRProxy"));
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];


            //绑定数据
            rd.SetDataSource(dt);
            rd.Refresh();
            this.crViewer.ReportSource = rd;

            rd.SetParameterValue("Today", "制表人:" + userInfo.EmployeeName);
        }
    }
        /// <summary>
        /// 载入结算报表数据
        /// </summary>
        /// <param name="settlement"></param>
        /// <param name="electricRecords"></param>
        /// <param name="waterRecords"></param>
        /// <returns></returns>
        private List <SettlementReportModel> LoadReportData(Settlement settlement, List <SettlementRecord> electricRecords, List <SettlementRecord> waterRecords)
        {
            List <SettlementReportModel> data = new List <SettlementReportModel>();

            foreach (var item in electricRecords)
            {
                var department = BusinessFactory <DepartmentBusiness> .Instance.FindById(item.DepartmentId);

                var targetRecord = BusinessFactory <TargetRecordBusiness> .Instance.FindByDepartment(settlement.TargetId, department.Id, (int)EnergyType.Electric);

                var model = ReportUtil.SettlementReportTranslate(department.Name, settlement, item, targetRecord);

                data.Add(model);
            }

            foreach (var item in waterRecords)
            {
                var department = BusinessFactory <DepartmentBusiness> .Instance.FindById(item.DepartmentId);

                var targetRecord = BusinessFactory <TargetRecordBusiness> .Instance.FindByDepartment(settlement.TargetId, department.Id, (int)EnergyType.Water);

                var model = ReportUtil.SettlementReportTranslate(department.Name, settlement, item, targetRecord);

                data.Add(model);
            }

            return(data);
        }
    protected void BindInfo()
    {
        CustAdviceModel model    = new CustAdviceModel();
        UserInfoUtil    UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];

        /*接受参数*/
        model.ID = Convert.ToInt32(Request.QueryString["ID"].ToString());

        string CompanyCD = UserInfo.CompanyCD;
        /*读取数据*/
        DataTable dtDetail = new DataTable();
        DataTable dt       = XBase.Business.Office.CustManager.CustAdviceBus.GetOneCustAdviceInfo(model);

        /*绑定RPT*/
        if (dt != null)
        {
            /*加载主报表*/
            this.CrystalReportSource1.ReportDocument.Load(Server.MapPath(@"~/PrinttingModel/CustManager/CustAdvice.rpt"));
            CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.CustAdvice"));
            //绑定数据
            CrystalReportSource1.ReportDocument.SetDataSource(dt);
            CrystalReportSource1.DataBind();
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            CrystalReportSource1.ReportDocument.SetParameterValue("CreatorName", userInfo.UserName);
            CrystalReportSource1.ReportDocument.SetParameterValue("CreatorName", userInfo.UserName);
            CrystalReportSource1.ReportDocument.SetParameterValue("CreatorName", userInfo.UserName);
            this.CrystalReportViewer1.ReportSource = CrystalReportSource1;
        }
    }
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ValidateRequire())
                {
                    return;
                }

                DataTable dtbResult = m_bizReport.GetMOHSummaryReport(Util.ConvertObjectToInteger(cboMonth.SelectedValue), txtYear.IntValue);

                if (!Util.IsNullOrEmptyOrZero(dtbResult.Rows.Count))
                {
                    AppEnvironment.ShowWaitForm("Please Wait", "Initializing Report.");
                    ReportDocument rpt = ReportUtil.LoadReport("RPT010_MOHSummaryReport.rpt");
                    rpt.SetDataSource(dtbResult);
                    string monthYear = cboMonth.Text + " " + txtYear.Text;
                    rpt.SetParameterValue("MonthYear", monthYear);
                    FrmPreviewReport frmPrint = new FrmPreviewReport();

                    AppEnvironment.CloseWaitForm();

                    ReportUtil.PrintPreviewReport(frmPrint, rpt);
                }
                else
                {
                    MessageBox.Show("Data not Found.", "RPT010", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                AppEnvironment.CloseWaitForm();
                ExceptionManager.ManageException(this, ex);
            }
        }
        public ActionResult ISR080_GetRptIECheckSheetData(string strMaintenanceNo, string strSubcontractorCode)
        {
            strMaintenanceNo     = "5020N20110030";
            strSubcontractorCode = "00002";
            IReportHandler           reportHandler = ServiceContainer.GetService <IReportHandler>() as IReportHandler;
            List <RPTIECheckSheetDo> rptList       = reportHandler.GetRptIECheckSheetData(strMaintenanceNo, strSubcontractorCode);

            IDocumentHandler            dochandler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler;
            List <tbm_DocumentTemplate> dLst       = dochandler.GetDocumentTemplateByDocumentCode(DocumentCode.C_DOCUMENT_CODE_IE_CHECK_SHEET);

            ReportDocument rptH = new ReportDocument();

            string path = ReportUtil.GetReportPath("Reports/ISR080_IECheckSheet.rpt", Server.MapPath("/"));

            rptH.Load(path);

            List <RPTIECheckSheetDo> lst = new List <RPTIECheckSheetDo>();

            lst.Add(rptList[0]);

            if (dLst.Count > 0)
            {
                lst[0].DocumentNameEN  = dLst[0].DocumentNameEN;
                lst[0].DocumentVersion = dLst[0].DocumentVersion;
            }

            rptH.SetDataSource(lst);

            Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            rptH.Close();

            return(File(stream, "application/pdf"));
        }
    void LoadDataBind()
    {
        try
        {
            string        Id             = Request.QueryString["Id"].ToString();
            string        CompanyCD      = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD;
            DataSet       ds             = XBase.Business.Office.HumanManager.EmployeeTestBus.GetTestInfoByNO(Id, CompanyCD);
            DataTable     dt             = ds.Tables[0];
            DataTable     dt1            = ds.Tables[1];
            StringBuilder sbUserNameInfo = new StringBuilder();
            if (dt != null)
            {
                rd.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/HumanManager/EmployeeTestReport.rpt"));
                CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.CustContact"));
                //绑定数据
                if (dt1 != null && dt1.Rows.Count > 0)
                {
                    for (int i = 0; i < dt1.Rows.Count; i++)
                    {
                        sbUserNameInfo.Append(dt1.Rows[i]["EmployeeName"] + ",");
                    }
                }
                ReportDocument sub = rd.Subreports[0];
                sub.SetDataSource(dt1);

                rd.SetDataSource(dt);
                this.CrystalReportViewer1.ReportSource = rd;
                rd.SetParameterValue("testPeople", sbUserNameInfo.ToString().TrimEnd(','));
            }
        }
        catch { }
    }
Example #19
0
    /// <summary>
    /// 绑定报表
    /// </summary>
    private void Print()
    {
        UserInfoUtil UserInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
        /*接受参数*/
        int    ID        = int.Parse(Request.QueryString["ID"].ToString());
        string CompanyCD = UserInfo.CompanyCD;
        string DeptID    = Convert.ToString(UserInfo.DeptID);
        /*读取数据*/
        DataTable dtp     = SubStorageBus.SubStorageIn(ID);
        DataTable Details = SubStorageBus.Details(ID, DeptID);

        /*绑定RPT*/
        if (dtp != null)
        {
            /*加载主报表*/
            rd.Load(Server.MapPath(@"~/PrinttingModel/SubStoreManager/PrintSubStorageInit.rpt"));
            CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.View_PrintSubStorageInit"));

            /*加载子报表*/
            ReportDocument rdDetail = rd.Subreports["PrintSubStorageInitDetail.rpt"];
            rdDetail.SetDataSource(Details);

            //绑定数据
            rd.SetDataSource(dtp);

            rd.Refresh();
            this.CrystalReportViewer1.ReportSource = rd;
            rd.SetParameterValue("Creator", UserInfo.UserName);
        }
    }
Example #20
0
 private void barCopyEstrutura_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (gridView1.IsSelectOneRowWarning())
     {
         var dash = gridView1.GetFocusedRow <DashboardImage>();
         ReportUtil.DuplicateDashboard(dash);
     }
 }
Example #21
0
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            ReportDocument rpt = ReportUtil.LoadReport("RPT999_ReportTest.rpt");

            FrmPreviewReport frmPrint = new FrmPreviewReport();

            ReportUtil.PrintPreviewReport(frmPrint, rpt);
        }
Example #22
0
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ValidateRequire())
                {
                    return;
                }

                if (radioBtnType1.Checked)
                {
                    strItemType = radioBtnType1.Text;
                }
                else
                {
                    strItemType = radioBtnType2.Text;
                }

                DataTable dtbResult = m_bizReport.GetCostReports(txtYear.IntValue, Util.ConvertObjectToInteger(cboMonth.SelectedValue)
                                                                 , strProdDateFrom, strProdDateTo, strProdOrderNoFrom, strProdOrderNoTo, strItemType);

                if (!Util.IsNullOrEmptyOrZero(dtbResult.Rows.Count))
                {
                    AppEnvironment.ShowWaitForm("Please Wait", "Initializing Report.");
                    ReportDocument rpt = ReportUtil.LoadReport("RPT020_CostReport.rpt");
                    rpt.SetDataSource(dtbResult);
                    string monthYear = cboMonth.Text + " " + txtYear.Text;

                    DateTime minDate = dtbResult.AsEnumerable()
                                       .Select(cols => cols.Field <DateTime>("DocDate"))
                                       .FirstOrDefault();

                    DateTime maxDate = dtbResult.AsEnumerable()
                                       .Select(cols => cols.Field <DateTime>("DocDate"))
                                       .OrderByDescending(p => p.Ticks)
                                       .FirstOrDefault();

                    //string dateMinMax = minDate.ToString("dd/MM/yyyy") + " - " + maxDate.ToString("dd/MM/yyyy");
                    string dateMinMax = ProdDateFrom.Text + " - " + ProdDateTo.Text;
                    rpt.SetParameterValue("dateMinMax", dateMinMax);
                    rpt.SetParameterValue("MonthYear", monthYear);
                    FrmPreviewReport frmPrint = new FrmPreviewReport();

                    AppEnvironment.CloseWaitForm();

                    ReportUtil.PrintPreviewReport(frmPrint, rpt);
                }
                else
                {
                    MessageBox.Show("Data not Found.", "RPT020", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                AppEnvironment.CloseWaitForm();
                ExceptionManager.ManageException(this, ex);
            }
        }
    private void Search()
    {
        SalaryStandardModel searchModel = new SalaryStandardModel();

        //设置查询条件
        //岗位

        if (ddlDeptName.SelectedValue != "0")//部门
        {
            searchModel.QuarterID = ddlDeptName.SelectedValue;
        }
        if (this.ddlStartMonth.SelectedValue != "0") //起始月份
        {
            searchModel.AdminLevel = ddlStartMonth.SelectedValue;
        }
        if (this.ddlEndMonth.SelectedValue != "0") //结束月份
        {
            searchModel.AdminLevelName = ddlEndMonth.SelectedValue;
        }
        if (this.ddlYear.SelectedValue != "0") //结束月份
        {
            searchModel.UnitPrice = ddlYear.SelectedValue;
        }
        UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
        //查询数据
        DataTable dtNewTable = SalaryStandardBus.SearchSalarySummaryReport(searchModel);
        DataTable dtData     = new DataTable();

        dtData.Columns.Add("Remark");
        dtData.Columns.Add("itemNo");
        dtData.Columns.Add("CompanyCD");
        dtData.Columns.Add("UnitPrice");
        for (int i = 0; i < dtNewTable.Rows.Count; i++)
        {
            DataRow newRow = dtData.NewRow();
            newRow["Remark"]    = getDeptName(dtNewTable.Rows[i]["Remark"] == null ? "" : dtNewTable.Rows[i]["Remark"].ToString());
            newRow["itemNo"]    = dtNewTable.Rows[i]["itemNo"] == null ? "" : dtNewTable.Rows[i]["itemNo"].ToString();
            newRow["CompanyCD"] = dtNewTable.Rows[i]["CompanyCD"] == null ? "" : dtNewTable.Rows[i]["CompanyCD"].ToString();
            newRow["UnitPrice"] = dtNewTable.Rows[i]["UnitPrice"] == null ? "" : dtNewTable.Rows[i]["UnitPrice"].ToString();
            dtData.Rows.Add(newRow);
        }


        ReportDocument oRpt = new ReportDocument();

        CrystalReportSource1.ReportDocument.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/HumanManager/SalarySummeryReport.rpt"));
        // SetDatabaseLogon 拉模式中必须用这个方法来设置登录信息,参数一:用户名;参数二:密码;参数三:服务器;参数四:数据库名
        CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.SalaryReportSummary"));
        //查询数据
        CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["Creator"].Text         = "\"" + "制表人:" + userInfo.EmployeeName + "\"";
        CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["DeptName"].Text        = "\"" + "起始年月:" + ddlYear.SelectedValue + "." + ddlStartMonth.SelectedValue + "\"";
        CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["PerformanceType"].Text = "\"" + "结束年月:" + ddlYear.SelectedValue + "." + ddlEndMonth.SelectedValue + "\"";
        CrystalReportSource1.ReportDocument.SetDataSource(dtData);
        CrystalReportSource1.DataBind();
        // CrystalReportViewer1是水晶报表浏览器,下面是给该浏览器赋上对像
        CrystalReportViewer1.ReportSource = CrystalReportSource1;
        //CrystalReportViewer1.DataBind();
    }
    private void Search()
    {
        SalaryStandardModel searchModel = new SalaryStandardModel();

        //设置查询条件
        //岗位
        if (ddlSearchQuarter.SelectedValue != "0")
        {
            searchModel.QuarterID = ddlSearchQuarter.SelectedValue;
        }
        //岗位职等
        if (ddlSearchQuaterAdmin.SelectedValue != "0")
        {
            searchModel.AdminLevel = ddlSearchQuaterAdmin.SelectedValue;
        }
        //启用状态·
        searchModel.UsedStatus = "1";
        UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
        //查询数据
        DataTable dtData = SalaryStandardBus.SearchSalaryStandardReport(searchModel);

        ReportDocument oRpt = new ReportDocument();

        CrystalReportSource1.ReportDocument.Load(Server.MapPath(@"~/OperatingModel/CrystalReport/HumanManager/SalaryStandardReport.rpt"));
        // SetDatabaseLogon 拉模式中必须用这个方法来设置登录信息,参数一:用户名;参数二:密码;参数三:服务器;参数四:数据库名
        CrystalReportViewer1.LogOnInfo.Add(ReportUtil.GetTableLogOnInfo("officedba.SalaryStandard"));

        //查询数据
        CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["DeptName"].Text        = "\"" + "" + "\"";
        CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["PerformanceType"].Text = "\"" + "" + "\"";
        CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["Creator"].Text         = "\"" + "制表人:" + userInfo.EmployeeName + "\"";

        if (ddlSearchQuarter.SelectedValue != "0" && ddlSearchQuarter.SelectedIndex != -1)
        {
            CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["DeptName"].Text = "\"" + "岗位:" + ddlSearchQuarter.Items[ddlSearchQuarter.SelectedIndex].Text + "\"";
        }
        else
        {
            CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["DeptName"].Text = "\"" + "岗位:" + "全部" + "\"";
        }
        if (this.ddlSearchQuaterAdmin.SelectedValue != "0" && ddlSearchQuaterAdmin.SelectedIndex != -1)
        {
            CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["PerformanceType"].Text = "\"" + "职等:" + ddlSearchQuaterAdmin.Items[ddlSearchQuaterAdmin.SelectedIndex].Text + "\"";
        }
        else
        {
            CrystalReportSource1.ReportDocument.DataDefinition.FormulaFields["PerformanceType"].Text = "\"" + "职等:" + "全部" + "\"";
        }



        CrystalReportSource1.ReportDocument.SetDataSource(dtData);
        CrystalReportSource1.DataBind();
        // CrystalReportViewer1是水晶报表浏览器,下面是给该浏览器赋上对像
        CrystalReportViewer1.ReportSource = CrystalReportSource1;
        // CrystalReportViewer1.DataBind();
    }
Example #25
0
 private void btnCopyEstrutura_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (gridView1.IsSelectOneRowWarning())
     {
         var rpt = gridView1.GetFocusedRow <ReportImage>();
         //encapsulado
         ReportUtil.DuplicateReport(rpt);
     }
 }
Example #26
0
        public ActionResult CTR090_CoverLetter(int iDocID)
        {
            try
            {
                IContractDocumentHandler contractDocHandler = ServiceContainer.GetService <IContractDocumentHandler>() as IContractDocumentHandler;

                List <RPTCoverLetterDo>      rptListCover = contractDocHandler.GetRptCoverLetterData(iDocID);
                List <RPTInstrumentDetailDo> rptListInst  = contractDocHandler.GetRptInstrumentDetailData(iDocID);

                ReportDocument rptH = new ReportDocument();
                string         path = ReportUtil.GetReportPath("Reports/CTR090_CoverLetter.rpt", Server.MapPath("/"));
                //string path = ReportUtil.GetReportTemplatePath("CTR090_CoverLetter.rpt");

                rptH.Load(path);
                rptH.SetDataSource(rptListCover);
                rptH.Subreports["CTR090_1"].SetDataSource(rptListInst);
                rptH.Subreports["CTR090_2"].SetDataSource(rptListInst);
                rptH.Subreports["CTR090_3"].SetDataSource(rptListInst);

                rptH.SetParameterValue("FlagOn", FlagType.C_FLAG_ON);
                rptH.SetParameterValue("ShowInstrument", (rptListInst != null && rptListInst.Count > 0));
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                rptH.Close();


                //IDocumentHandler documentHandler = ServiceContainer.GetService<IDocumentHandler>() as IDocumentHandler;
                //doDocumentDataGenerate doDoc = new doDocumentDataGenerate();
                //if (rptListCover.Count > 0)
                //{
                //    rptListCover[0].DocumentCode = "CTR090";
                //    doDoc.DocumentNo = rptListCover[0].DocNo;
                //    doDoc.DocumentCode = rptListCover[0].DocumentCode;
                //    doDoc.DocumentData = rptListCover;
                //}

                //List<ReportParameterObject> listSubReportDataSource = new List<ReportParameterObject>();
                //listSubReportDataSource.Add(new ReportParameterObject() { SubReportName = "CTR090_1", Value = rptListInst });
                //listSubReportDataSource.Add(new ReportParameterObject() { SubReportName = "CTR090_2", Value = rptListInst });
                //listSubReportDataSource.Add(new ReportParameterObject() { SubReportName = "CTR090_3", Value = rptListInst });

                //doDoc.SubReportDataSource = listSubReportDataSource;

                //List<ReportParameterObject> listMainReportParam = new List<ReportParameterObject>();
                //listMainReportParam.Add(new ReportParameterObject() { ParameterName = "FlagOn", Value = FlagType.C_FLAG_ON });
                //doDoc.MainReportParam = listMainReportParam;
                //doDoc.SubReportParam = null;

                //Stream stream = documentHandler.GenerateDocument(doDoc);


                return(File(stream, "application/pdf"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #27
0
        public void Relatorio()
        {
            try
            {
                StringBuilder conteudo = new StringBuilder();
                conteudo.Append("<h2> Relatorio de Produtos </h2>");
                conteudo.Append($"Relatório gerado em: {DateTime.Now}");
                conteudo.Append("<br/><br/>");

                ProdutoBusiness business = new ProdutoBusiness();
                List <Produto>  lista    = business.ConsultarProduto();

                conteudo.Append("<table border='1' style='width=100%'>");

                conteudo.Append("<tr>");

                conteudo.Append("<th>Codigo</th>");
                conteudo.Append("<th>Nome</th>");
                conteudo.Append("<th>Preço</th>");
                conteudo.Append("<th>Quantidade</th>");
                conteudo.Append("<th>Estoque</th>");

                conteudo.Append("</tr>");


                foreach (Produto produto in lista)
                {
                    conteudo.Append("<tr>");

                    conteudo.Append($"<td>{produto.IdProduto}</td>");
                    conteudo.Append($"<td>{produto.Nome}</td>");
                    conteudo.Append($"<td>{produto.Preco}</td>");
                    conteudo.Append($"<td>{produto.Quantidade}</td>");
                    conteudo.Append($"<td>{produto.Estoque.Nome}</td>");

                    conteudo.Append("</tr>");
                }

                conteudo.Append("</table>");

                //converter PDF ...
                byte[] pdf = ReportUtil.GetPdfFile(conteudo.ToString());
                //download

                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition",
                                   "attachment; filename=relatorio.pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(pdf);
                Response.End();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
Example #28
0
        public static void Build()
        {
            ReportBuilder rptbuild = new ReportBuilder();
            ReportType    vReport  = rptbuild.Report;
            BodyType      vBody    = vReport.Body;

            double x = 0, y = 0, wd = 0, ht = 0;

            vReport.Width.Value = RPT_WIDTH;
            vBody.Height.Value  = RPT_HEIGHT;

            DataSetType dataSet = rptbuild.Report.DataSets[0];

            ReportUtil.AddFields(dataSet.Fields, new string[] {
                POUTWARD.COPIES

                , POUTWARD.COMPANY_NAME
                , POUTWARD.ADDRESS1
                , POUTWARD.ADDRESS2
                , POUTWARD.COMPANY_GSTTIN

                , POUTWARD.OUTWARD_ID
                , POUTWARD.OUTWARD_NO
                , POUTWARD.OUTWARD_DATE

                , POUTWARD.PARTY_NAME
                , POUTWARD.STREET1
                , POUTWARD.STREET2
                , POUTWARD.CITY
                , POUTWARD.STATE
                , POUTWARD.COUNTRY
                , POUTWARD.PINCODE
                , POUTWARD.GSTIN
                , POUTWARD.TOTAL_QTY
                , POUTWARD.TOTAL_BUNDLE
                , POUTWARD.DELIVREDTHROUGH
            });

            x = 0; y = 0; wd = RPT_WIDTH; ht = RPT_HEIGHT;
            ListType Reportlist = ReportUtil.AddList("Reportlist", vBody.ReportItems, x, y, wd, ht);

            Reportlist.Grouping = new GroupingType("group_" + POUTWARD.OUTWARD_ID + "");
            Reportlist.Grouping.GroupExpressions.Add("=Fields!" + POUTWARD.OUTWARD_ID + ".Value");
            Reportlist.Grouping.GroupExpressions.Add("=Fields!" + POUTWARD.COPIES + ".Value");
            Reportlist.Grouping.PageBreakAtEnd = true;


            x = 0; y = 0; wd = RPT_WIDTH; ht = RPT_HEIGHT;
            RectangleType rectWarper = ReportUtil.AddRectangle("rectWarper", Reportlist.ReportItems, x, y, wd, ht);

            rectWarper.Style.BorderStyle.Default = BorderStyleEnum.None;
            BuildDetail(rectWarper);

            //ReportUtil.AttachRulers(Reportlist.ReportItems, RPT_WIDTH, RPT_HEIGHT);
            rptbuild.SaveAs(PRINT_FOLDER + @"\P_Outward.rdlc");
        }
Example #29
0
 async void LoadData()
 {
     try
     {
         root.Content = ReportUtil.BuildReport(await DataAccess.GetReportData());
     }
     catch (NullReferenceException nullReferenceException)
     {
         Console.WriteLine(nullReferenceException);
     }
 }
 private void btnPrintReportNow_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_reportName != null || barCheckContasPagar.Checked || barCheckContasReceber.Checked)
     {
         ReportUtil.PrintReportByName(_reportName);
     }
     else
     {
         XMessageIts.Mensagem("Selecione o relatório a ser gerado !");
     }
 }