コード例 #1
0
        void stat(int rdoFlg)
        {
            string beginDate = this.dteDateStart.Text.Trim();
            string endDate   = this.dteDateEnd.Text.Trim();
            Dictionary <string, string> dicParam = new Dictionary <string, string>();

            if (beginDate != string.Empty && endDate != string.Empty)
            {
                if (Function.Datetime(beginDate + " 00:00:00") > Function.Datetime(endDate + " 00:00:00"))
                {
                    DialogBox.Msg("开始时间不能大于结束时间。");
                    return;
                }
                dicParam.Add("reportDate", beginDate + "|" + endDate);
            }

            if (!string.IsNullOrEmpty(JyStr))
            {
                dicParam.Add("JyStr", JyStr);
            }

            try
            {
                uiHelper.BeginLoading(this);
                if (dicParam.Count > 0)
                {
                    using (ProxyAnaReport proxy = new ProxyAnaReport())
                    {
                        //List<EntityRptYzb> dataSource = null;
                        if (rdoFlg == 0)
                        {
                            xr.DataSource = proxy.Service.GetMzRptYzb(dicParam, statDept);
                        }
                        else if (rdoFlg == 1)
                        {
                            xr.DataSource = proxy.Service.GetZyRptYzb(dicParam, statDept);
                        }

                        //this.gcData.DataSource = dataSource;
                        XRControl xc; //报表上的组件
                        xc = xr.FindControl("lblDate", true);
                        if (xc != null)
                        {
                            (xc as XRLabel).Text = " " + beginDate + " ~ " + endDate;
                        }
                        xr.CreateDocument();
                    }
                }
                else
                {
                    DialogBox.Msg("请输入查询条件。");
                }
            }
            finally
            {
                uiHelper.CloseLoading(this);
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            XtraReport report    = new XtraReport();
            XtraReport subreport = new XtraReport();

            report.LoadLayout(Application.StartupPath + "\\MainReport.repx");
            subreport.LoadLayout(Application.StartupPath + "\\SubReport.repx");
            ((XRSubreport)report.FindControl("xrSubreport1", true)).ReportSource = subreport;
            ((XRSubreport)report.FindControl("xrSubreport1", true)).BeforePrint += new System.Drawing.Printing.PrintEventHandler(Form1_BeforePrint);
            report.ShowPreview();
        }
コード例 #3
0
ファイル: ReportViewer.aspx.cs プロジェクト: rmlarios/PayLots
        public void CargarDatosEmpresa(XtraReport Reporte)
        {
            /*Cargamos los datos de la empresa*/
            clsDatosEmpresa DatosEmpresa = new clsDatosEmpresa();

            DatosEmpresa = Neg.CargarDatosEmpresa();
            Reporte.FindControl("lblNombreEmpresa", true).Text = DatosEmpresa.NombreEmpresa;
            Reporte.FindControl("lblDireccion", true).Text     = DatosEmpresa.Direccion;
            Reporte.FindControl("lblTelefono", true).Text      = DatosEmpresa.Telefono;
            if (DatosEmpresa.Logo != null)
            {
                ((XRPictureBox)Reporte.FindControl("picLogo", true)).Image = Image.FromStream(new MemoryStream(DatosEmpresa.Logo));
            }
            /**********************************/
        }
コード例 #4
0
        public static void PopulateHeaderLabels(XtraReport report, params string[] captions)
        {
            var pageHeaderBand = report.FindControl(ReportHeaderBandName, true);
            if (pageHeaderBand != null)
            {
                var header = pageHeaderBand.Controls.OfType<XRLabel>().FirstOrDefault(label => label.Name == ReportNameLabel);
                if (header != null)
                {
                    header.CanShrink = true;
                    header.Text = captions[0];
                }
                header = pageHeaderBand.Controls.OfType<XRLabel>().FirstOrDefault(label => label.Name == DataFilterLabel);
                if (header != null)
                {
                    string caption = (String.IsNullOrEmpty(captions[1]) == false) ?
                        String.Format("({0})", captions[1]) : String.Empty;
                    header.CanShrink = true;
                    header.Text = caption;
                }
                header = pageHeaderBand.Controls.OfType<XRLabel>().FirstOrDefault(label => label.Name == GridFilterLabel);
                if (header != null)
                {
                    string caption = (String.IsNullOrEmpty(captions[2]) == false) ?
                        String.Format("({0})", captions[2]) : String.Empty;
                    header.CanShrink = true;
                    header.Text = caption;
                }

            }
        }
コード例 #5
0
 public bool LoadXtraReports(XtraReport rpt, int IDHT_ReportMain, DataTable dtMain, DataTable dtSub, string FolderPath)
 {
     try
     {
         DataTable dt = oDHT_Report.GetByIDReportMain(IDHT_ReportMain);
         if (dt.Rows.Count <= 0)
         {
             return(false);
         }
         if (!LoadXtraReport(rpt, dt.Rows[0]["ReportName"].ToString(), dtMain, FolderPath, "" + dt.Rows[0]["FieldsFormatNumber"]))
         {
             return(false);
         }
         XtraReport  rptSub = new XtraReport();
         XRSubreport xrs;
         for (int i = 1; i < dt.Rows.Count; i++)
         {
             if (!LoadXtraReport(rptSub, dt.Rows[i]["ReportName"].ToString(), dtSub, FolderPath, "" + dt.Rows[i]["FieldsFormatNumber"]))
             {
                 return(false);
             }
             xrs = (XRSubreport)rpt.FindControl("" + dt.Rows[i]["FieldSubReport"], true);
             if (xrs != null)
             {
                 xrs.ReportSource = rptSub;
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #6
0
ファイル: frmstatventlevel.cs プロジェクト: iamwsx05/report
        /// <summary>
        /// Stat
        /// </summary>
        void Stat()
        {
            if (Function.Datetime(this.StartDate) > Function.Datetime(this.EndDate))
            {
                DialogBox.Msg("开始时间不能大于结束时间。");
                this.dteStartDate.Focus();
                return;
            }

            try
            {
                uiHelper.BeginLoading(this);
                using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                {
                    xr.DataSource = proxy.Service.GetStatEventLevel(this.StartDate, this.EndDate);
                    XRControl xc; //报表上的组件
                    xc = xr.FindControl("lblDate", true);
                    if (xc != null)
                    {
                        (xc as XRLabel).Text = " " + this.StartDate + " ~ " + this.EndDate;
                    }
                    xr.CreateDocument();
                }
            }
            finally
            {
                uiHelper.CloseLoading(this);
            }
        }
コード例 #7
0
        public frmDevReport(DataTable dtMain, DataTable dtSub, string ReportMainName, string ReportSubName,
                            string[] FieldSubReport, string[] FieldFormatNumberMain, string[] FieldFormatNumberSub, string WaterMark)
        {
            InitializeComponent();
            rpt         = new XtraReport();
            oBHT_Report = new cBHT_Report();

            oBHT_Report.LoadXtraReport(rpt, ReportMainName, dtMain, Application.StartupPath, FieldFormatNumberMain, "");

            XtraReport rptSub = new XtraReport();

            oBHT_Report.LoadXtraReport(rptSub, ReportSubName, dtSub, Application.StartupPath, FieldFormatNumberSub, "");

            if (FieldSubReport != null)
            {
                foreach (string str in FieldSubReport)
                {
                    XRSubreport xrs = (XRSubreport)rpt.FindControl(str, true);
                    if (xrs != null)
                    {
                        xrs.ReportSource = rptSub;
                    }
                }
            }
            rpt.Watermark.Text           = WaterMark;
            printControl1.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument();
        }
コード例 #8
0
        /// <summary>
        /// GetXR
        /// </summary>
        /// <returns></returns>
        XtraReport GetXR(decimal rptId)
        {
            EntitySysReport rptVo = null;

            using (ProxyCommon proxy = new ProxyCommon())
            {
                rptVo = proxy.Service.GetReport(this.rptId);
            }
            XtraReport xr = new XtraReport();

            if (rptVo != null)
            {
                MemoryStream ms = new MemoryStream();
                ms.Write(rptVo.rptFile, 0, rptVo.rptFile.Length);
                xr.LoadLayout(ms);
            }
            xr.DataSource = this.gcData.DataSource as List <EntityYgInpatStat>;
            XRControl xc; //报表上的组件

            xc = xr.FindControl("lblDate", true);
            if (xc != null)
            {
                (xc as XRLabel).Text = " " + dateScope;
            }
            xr.CreateDocument();
            return(xr);
        }
コード例 #9
0
        public static void SetLableText(XtraReport report, string labelName, string sText)
        {
            var lbl = report.FindControl(labelName, true) as XRLabel;

            if (lbl != null)
            {
                lbl.Text = sText;
            }
        }
コード例 #10
0
        public static void BindPicture(XtraReport report, Object dataSource, string picName, string boundName)
        {
            var pic = report.FindControl(picName, true) as XRPictureBox;

            if (pic != null)
            {
                pic.DataBindings.Clear();
                pic.DataBindings.Add("Image", dataSource, boundName);
            }
        }
コード例 #11
0
        public static void BindBarCode(XtraReport report, Object dataSource, string barcodeName, string boundName)
        {
            var barcode = report.FindControl(barcodeName, true) as XRBarCode;

            if (barcode != null)
            {
                barcode.DataBindings.Clear();
                barcode.DataBindings.Add("Text", dataSource, boundName);
            }
        }
コード例 #12
0
        public static void BindLabel(XtraReport report, Object dataSource, string labelName, string boundName)
        {
            var lbl = report.FindControl(labelName, true) as XRLabel;

            if (lbl != null)
            {
                lbl.DataBindings.Clear();
                lbl.DataBindings.Add("Text", dataSource, boundName);
            }
        }
コード例 #13
0
        void GiderYazdir(bool Disigner)
        {
            try
            {
                System.Data.DataSet ds      = new DataSet("Test");
                DataTable           dtliste = (DataTable)gcGiderler.DataSource;

                dtliste.TableName = "dtliste";
                ds.Tables.Add(dtliste);
                //şirket bilgileri
                DataTable Sirket = DB.GetData(@"select * from Sirketler with(nolock)");
                Sirket.TableName = "Sirket";
                ds.Tables.Add(Sirket);

                string exedizini = Path.GetDirectoryName(Application.ExecutablePath);

                string RaporDosyasi = exedizini + "\\Raporlar\\Giderler.repx";
                if (!File.Exists(RaporDosyasi))
                {
                    MessageBox.Show("Giderler.repx Dosya Bulunamadı");
                    return;
                }
                XtraReport rapor = new XtraReport();

                rapor.LoadLayout(RaporDosyasi);
                rapor.FindControl("label3", true).Text = deBasGelir.Text + "         " + deBitGelir.Text;

                rapor.Name = "Giderler";

                rapor.Report.Name = "Giderler";

                rapor.DataSource = ds;

                if (Disigner)
                {
                    rapor.ShowDesignerDialog();
                }
                else
                {
                    rapor.ShowPreviewDialog();
                }
                //ds.Dispose();
                ds.Tables.Remove(dtliste);
                ds.Tables.Remove(Sirket);


                dtliste.Dispose();
                ds.Dispose();
                rapor.Dispose();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Hata Oluştu " + exp.Message);
            }
        }
コード例 #14
0
ファイル: PrintManage.cs プロジェクト: treesan/taobao-alading
        private void SetValue(XtraReport xtraReport, string ctrlName, string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                value = string.Empty;
            }

            XRControl ctrl = xtraReport.FindControl(ctrlName, true);

            if (ctrl != null)
            {
                ctrl.Text = value;
            }
        }
コード例 #15
0
        public void CreateReportWithBookmark()
        {
            ReportDataV2 reportData = ObjectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", "ReportWithBookmark"));

            if (reportData == null)
            {
                reportData = ObjectSpace.CreateObject <ReportDataV2>();
                XtraReport rep = new XtraReport();
#if !DXCORE3
                byte[]       byteArray = Encoding.UTF8.GetBytes(ConvertVersion(OrdinalReportResource.ReportLayout));
                MemoryStream stream    = new MemoryStream(byteArray);
                rep.LoadLayout(stream);
#else
                var assembly      = Assembly.GetExecutingAssembly();
                var resourceNames = assembly.GetManifestResourceNames();
                var resourceName  = resourceNames.FirstOrDefault(p => p.Contains("OrdinalReport.repx"));

                using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
                    rep.LoadLayout(stream);
                }
#endif
                rep.DisplayName = "ReportWithBookmark";
                rep.Bookmark    = "Names";
                XRControl control = rep.FindControl("label5", true);
                if (control != null)
                {
                    control.DataBindings.Add(new DevExpress.XtraReports.UI.XRBinding("Bookmark", null, "FirstName"));
                }
                control = rep.FindControl("label9", true);
                if (control != null)
                {
                    control.Text = "Report with bookmarks";
                }
                ReportDataProvider.ReportsStorage.SaveReport(reportData, rep);
            }
        }
        protected static byte[] SerializeControls(XRControl[] controls)
        {
            XtraReport tempReport = new XtraReport();
            DetailBand tempBand   = new DetailBand();

            tempReport.Bands.Add(tempBand);

            using (XtraReport cloneReport = new XtraReport()) {
                using (MemoryStream stream = new MemoryStream()) {
                    controls[0].RootReport.SaveLayoutToXml(stream);
                    stream.Position = 0;

                    cloneReport.LoadLayoutFromXml(stream);
                }
                foreach (XRControl control in controls)
                {
                    XRControl clone = cloneReport.FindControl(control.Name, true);
                    if (clone != null)
                    {
                        tempBand.Controls.Add(clone);
                    }
                }
            }

            float topMost  = float.MaxValue;
            float leftMost = float.MaxValue;

            foreach (XRControl control in tempBand.Controls)
            {
                topMost  = Math.Min(topMost, control.TopF);
                leftMost = Math.Min(leftMost, control.LeftF);
            }

            foreach (XRControl control in tempBand.Controls)
            {
                control.LocationF = new PointF(control.LeftF - leftMost, control.TopF - topMost);
            }

            byte[] layoutBytes = null;

            using (MemoryStream stream = new MemoryStream()) {
                tempReport.SaveLayoutToXml(stream);
                layoutBytes = stream.ToArray();
            }

            tempReport.Dispose();
            return(layoutBytes);
        }
コード例 #17
0
        public static void GetSales(DateTime start, DateTime end, Klienti klienti)
        {
            string     path   = System.IO.Path.GetFullPath(@"Reporting\Shitjet.txt");
            XtraReport report = new XtraReport();

            report = XtraReport.FromFile(path, true);
            report.FindControl("lbInvoice", true).Text = "Raport Shitjesh " + klienti.Emri;
            ReportPrintTool    pt = new ReportPrintTool(report);
            PrintingSystemBase ps = pt.PrintingSystem;

            report.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Parameters, DevExpress.XtraPrinting.CommandVisibility.None);
            report.DataSource  = GetAll.GetSales(start, end, klienti.ID);
            report.DataMember  = "CustomSqlQuery";
            report.DisplayName = "Invoice";
            report.ShowPreview();
        }
コード例 #18
0
        public bool LoadXtraReport(XtraReport rpt, string ReportName, DataTable dtReport, string FolderPath, string FieldsFormatNumber)
        {
            // Nếu đã có file .xml trong thư mục báo cáo thì load trực tiếp
            // Nếu chưa có thì load trong DB sau đó save lại vào thư mục báo cáo
            string FullFileName = FolderPath + "\\Template\\" + ReportName + ".repx";

            if (!File.Exists(FullFileName))
            {
                var       client = new UnimOsServiceClient();
                DataTable dt     = ConvertList.ToDataTable <sp_HT_Report_GetByNameResult>(client.cDHT_Report_GetByName_2(GlobalVar.MaXacThuc, ReportName));
                client.Close();
                if (dt.Rows.Count > 0)
                {
                    string Detail = dt.Rows[0]["Detail"].ToString();
                    if (Detail != "")
                    {
                        try
                        {
                            File.WriteAllText(FullFileName, Detail);
                        }
                        catch
                        {
                            return(false);
                        }
                    }
                }
            }
            // Load report từ file
            rpt.LoadLayout(FolderPath + "\\Template\\" + ReportName + ".repx");

            rpt.DataSource = dtReport;

            if (dtReport != null && FieldsFormatNumber != "")
            {
                string[] arrField = FieldsFormatNumber.Split(',');
                foreach (string str in arrField)
                {
                    XRControl xrc = rpt.FindControl(str, true);
                    if (xrc != null)
                    {
                        xrc.DataBindings.Add("Text", dtReport, str, "{0:n0}");
                    }
                }
            }
            return(true);
        }
コード例 #19
0
        public void CreateReportMultiValueParameters()
        {
            ReportDataV2 reportData = ObjectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", "ReportWithMultiValueParameters"));

            if (reportData == null)
            {
                reportData = ObjectSpace.CreateObject <ReportDataV2>();
                XtraReport rep = new XtraReport();
#if !DXCORE3
                byte[]       byteArray = Encoding.UTF8.GetBytes(ConvertVersion(OrdinalReportResource.ReportLayout));
                MemoryStream stream    = new MemoryStream(byteArray);
                rep.LoadLayout(stream);
#else
                var assembly      = Assembly.GetExecutingAssembly();
                var resourceNames = assembly.GetManifestResourceNames();
                var resourceName  = resourceNames.FirstOrDefault(p => p.Contains("OrdinalReport.repx"));

                using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
                    rep.LoadLayout(stream);
                }
#endif
                rep.DisplayName  = "ReportWithMultiValueParameters";
                rep.FilterString = "[Title Of Courtesy] In (?parameterTitle) Or [Position] In (?parameterPosition)";
                DevExpress.XtraReports.Parameters.Parameter parameterTitle    = new DevExpress.XtraReports.Parameters.Parameter();
                DevExpress.XtraReports.Parameters.Parameter parameterPosition = new DevExpress.XtraReports.Parameters.Parameter();
                parameterTitle.Description    = "Title";
                parameterTitle.Type           = typeof(TitleOfCourtesy);
                parameterTitle.Name           = "parameterTitle";
                parameterTitle.MultiValue     = true;
                parameterPosition.Description = "Position";
                parameterPosition.Name        = "parameterPosition";
                parameterPosition.Type        = typeof(Position);
                parameterPosition.MultiValue  = true;
                rep.Parameters.AddRange(new DevExpress.XtraReports.Parameters.Parameter[] {
                    parameterTitle,
                    parameterPosition
                });
                XRControl control = rep.FindControl("label9", true);
                if (control != null)
                {
                    control.Text = "Contacts with parameters";
                }
                ReportDataProvider.ReportsStorage.SaveReport(reportData, rep);
            }
        }
コード例 #20
0
        public bool LoadXtraReport(XtraReport rpt, string ReportName, DataTable dtReport, string FolderPath, string[] FieldsFormatNumber, string FormatType)
        {
            // Nếu đã có file .xml trong thư mục báo cáo thì load trực tiếp
            // Nếu chưa có thì load trong DB sau đó save lại vào thư mục báo cáo
            string FullFileName = FolderPath + "\\Template\\" + ReportName + ".repx";

            if (!File.Exists(FullFileName))
            {
                DataTable dt = oDHT_Report.GetByName(ReportName);
                if (dt.Rows.Count > 0)
                {
                    string Detail = dt.Rows[0]["Detail"].ToString();
                    if (Detail != "")
                    {
                        try
                        {
                            File.WriteAllText(FullFileName, Detail);
                        }
                        catch
                        {
                            return(false);
                        }
                    }
                }
            }
            // Load report từ file
            rpt.LoadLayout(FolderPath + "\\Template\\" + ReportName + ".repx");

            rpt.DataSource = dtReport;

            if (dtReport != null && FieldsFormatNumber != null)
            {
                foreach (string str in FieldsFormatNumber)
                {
                    XRControl xrc = rpt.FindControl(str, true);
                    if (xrc != null)
                    {
                        xrc.DataBindings.Add("Text", dtReport, str, "{" + FormatType + "}");
                    }
                }
            }
            return(true);
        }
コード例 #21
0
        /// <summary>
        /// 報表套用模板
        /// </summary>
        /// <param name="detailReport">報表</param>
        /// <param name="mainReport">模板報表</param>
        /// <returns></returns>
        public XtraReport CreateCompositeReport(XtraReport detailReport, XtraReport mainReport)
        {
            // Create a subreport.
            XRSubreport subreport = new XRSubreport();

            mainReport.Margins = detailReport.Margins;
            // Create a detail band and add it to the main report.

            DetailBand detailBand = (DetailBand)mainReport.Bands[BandKind.Detail];

            mainReport.Bands.Add(detailBand);

            // Set the subreport's location.
            subreport.Location = new System.Drawing.Point(mainReport.FindControl("PageHeader", true).Width, mainReport.FindControl("PageHeader", true).Height);

            // 設定報表
            subreport.ReportSource = detailReport;

            // Add the subreport to the detail band.
            detailBand.Controls.Add(subreport);
            return(mainReport);
        }
コード例 #22
0
ファイル: frmstatinstrument.cs プロジェクト: iamwsx05/report
        /// <summary>
        /// Stat
        /// </summary>
        void Stat()
        {
            #region 条件
            if (this.dteStart.DateTime.Date > this.dteEnd.DateTime.Date)
            {
                DialogBox.Msg("开始时间不能大于结束时间。");
                this.dteStart.Focus();
                return;
            }
            string startDate = this.dteStart.Text;
            string endDate   = this.dteEnd.Text;
            string deptCode  = string.Empty;
            if (this.ucDept.DeptVo != null && !string.IsNullOrEmpty(this.ucDept.DeptName) && !string.IsNullOrEmpty(this.ucDept.DeptVo.deptCode))
            {
                deptCode = this.ucDept.DeptVo.deptCode;
            }
            #endregion

            try
            {
                uiHelper.BeginLoading(this);
                using (ProxyAdverseEvent proxy = new ProxyAdverseEvent())
                {
                    xr.DataSource = proxy.Service.GetStatInstrument(startDate, endDate, deptCode);
                    XRControl xc; //报表上的组件
                    xc = xr.FindControl("lblDate", true);
                    if (xc != null)
                    {
                        (xc as XRLabel).Text = " " + startDate + " ~ " + endDate;
                    }
                    xr.CreateDocument();
                }
            }
            finally
            {
                uiHelper.CloseLoading(this);
            }
        }
コード例 #23
0
        private void doAcceptance()
        {
            XtraReport mReport = new XtraReport();

            mReport.LoadLayout(Application.StartupPath + "\\Report\\" + this.comboBox1.Text); //报表模板文件

            DataTable taskError = new DataTable();

            if (ReportDia.wwcxmTable != null)
            {
                taskError = ReportDia.wwcxmTable;
            }
            taskError.TableName = "taskError";
            DataTable checkError = new DataTable();
            DataTable attrError  = AttrDia.attrErrorTable;

            if (attrError != null)
            {
                checkError = attrError;
            }
            DataTable topotable = TopoDia.topoErrorTable;

            if (topotable != null)
            {
                checkError.Merge(topotable);
                checkError.TableName = "checkError";
            }
            //查找组件
            DetailReportBand DetailReport  = mReport.FindControl("DetailReport", true) as DetailReportBand;
            DetailReportBand DetailReport1 = mReport.FindControl("DetailReport1", true) as DetailReportBand;
            DetailBand       Detail1       = mReport.FindControl("Detail1", true) as DetailBand;
            DetailBand       Detail2       = mReport.FindControl("Detail2", true) as DetailBand;
            XRLabel          xrLabel4      = mReport.FindControl("XRLabel4", true) as XRLabel;  //联系人
            XRLabel          xrLabel5      = mReport.FindControl("XRLabel5", true) as XRLabel;  //联系方式
            XRLabel          xrLabel11     = mReport.FindControl("XRLabel11", true) as XRLabel; //检查人

            DetailReport.DataSource  = taskError;
            DetailReport1.DataSource = checkError;
            mReport.ShowPreviewDialog();
        }
コード例 #24
0
 public bool LoadXtraReports(XtraReport rpt, int IDHT_ReportMain, DataTable dtMain, DataTable dtSub, string FolderPath)
 {
     try
     {
         var       client = new UnimOsServiceClient();
         DataTable dt     = ConvertList.ToDataTable <HT_ReportInfo>(client.cDHT_Report_GetByIDReportMain(GlobalVar.MaXacThuc, IDHT_ReportMain));
         client.Close();
         if (dt.Rows.Count <= 0)
         {
             return(false);
         }
         if (!LoadXtraReport(rpt, dt.Rows[0]["ReportName"].ToString(), dtMain, FolderPath, "" + dt.Rows[0]["FieldsFormatNumber"]))
         {
             return(false);
         }
         XtraReport  rptSub = new XtraReport();
         XRSubreport xrs;
         for (int i = 1; i < dt.Rows.Count; i++)
         {
             if (!LoadXtraReport(rptSub, dt.Rows[i]["ReportName"].ToString(), dtSub, FolderPath, "" + dt.Rows[i]["FieldsFormatNumber"]))
             {
                 return(false);
             }
             xrs = (XRSubreport)rpt.FindControl("" + dt.Rows[i]["FieldSubReport"], true);
             if (xrs != null)
             {
                 xrs.ReportSource = rptSub;
             }
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #25
0
 private string SetVariables(DataRow dr, XtraReport rptTmp, string Cert)
 {
     try
     {
         foreach (DictionaryEntry de in Config.Variables)
         {
             string key = de.Key.ToString();
             if (key.Contains("@"))
             {
                 key = key.Remove(0, 1);
             }
             XRControl xrc = rptTmp.FindControl(key, true);
             if (xrc != null)
             {
                 string   value = de.Value.ToString();
                 DateTime r;
                 if (DateTime.TryParse(value, out r))
                 {
                     //if (value == "") value = DateTime.Now.ToShortDateString();
                     value = DateTime.Parse(value).ToString("dd/MM/yyyy");//.ToShortDateString();
                 }
                 xrc.Text = value;
                 xrc      = null;
             }
         }
         foreach (DataColumn c in Data.Tables[0].Columns)
         {
             XRControl xrc = rptTmp.FindControl(c.ColumnName, true);
             if (xrc != null)
             {
                 string value = dr[c].ToString();
                 if (c.DataType == typeof(decimal))
                 {
                     value = decimal.Parse(value).ToString("### ### ### ##0.####").Trim();
                     value = value.Replace(".", ",").Replace(" ", ".");
                 }
                 if (c.DataType == typeof(DateTime))
                 {
                     if (value == "")
                     {
                         value = DateTime.Now.ToShortDateString();
                     }
                     value = DateTime.Parse(value).ToString("dd/MM/yyyy");//.ToShortDateString();
                 }
                 xrc.Text = value;
             }
         }
         //Logo
         XRControl Logo = rptTmp.FindControl("Logo", true);
         if (Logo != null)
         {
             if (File.Exists(DuongDanInvoice + "\\Logo.png"))
             {
                 string   path     = DuongDanInvoice + "\\Logo.png";
                 FileInfo fileInfo = new FileInfo(path);
                 byte[]   data     = new byte[fileInfo.Length];
                 using (FileStream fs = fileInfo.OpenRead())
                 {
                     fs.Read(data, 0, data.Length);
                 }
                 // fileInfo.Delete();
                 MemoryStream ms   = new MemoryStream(data);
                 Image        logo = Image.FromStream(ms);
                 (Logo as XRPictureBox).Image = logo;
             }
         }
         //QrCocde
         XRControl QRcode = rptTmp.FindControl("QRCodeImage", true);
         if (QRcode != null && (XRPictureBox)QRcode != null)
         {
             QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
             qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC;
             qrCodeEncoder.QRCodeScale        = 4;
             qrCodeEncoder.QRCodeVersion      = 8;
             qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
             Image image;
             try
             {
                 image = qrCodeEncoder.Encode(Cert);
                 ((XRPictureBox)QRcode).Image = image;
             }
             catch (Exception ex)
             {
                 return(ex.Message);
             }
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
     return(string.Empty);
 }
コード例 #26
0
        private void sbtGelirMail_Click(object sender, EventArgs e)
        {
            if (lUEKullanicilar.EditValue.ToString().Length < 10)
            {
                return;
            }

            DialogResult secim;

            secim = DevExpress.XtraEditors.XtraMessageBox.Show("Gider Raporu " +
                                                               lUEKullanicilar.EditValue.ToString() + " E-Posta(pdf) Gönderilsin mi?", Degerler.mesajbaslik, MessageBoxButtons.YesNo, MessageBoxIcon.Question, System.Windows.Forms.MessageBoxDefaultButton.Button2);
            if (secim == DialogResult.No)
            {
                return;
            }

            System.Data.DataSet ds      = new DataSet("Test");
            DataTable           dtliste = (DataTable)gcGelirler.DataSource;//DB.GetData(sql);

            dtliste.TableName = "dtliste";
            ds.Tables.Add(dtliste);
            //şirket bilgileri
            DataTable Sirket = DB.GetData(@"select * from Sirketler with(nolock)");

            Sirket.TableName = "Sirket";
            ds.Tables.Add(Sirket);

            string exedizini = Path.GetDirectoryName(Application.ExecutablePath);

            string RaporDosyasi = exedizini + "\\Raporlar\\Gelirler.repx";

            if (!File.Exists(RaporDosyasi))
            {
                MessageBox.Show("Giderler.repx Dosya Bulunamadı");
                return;
            }
            XtraReport rapor = new XtraReport();

            rapor.LoadLayout(RaporDosyasi);
            rapor.FindControl("label3", true).Text = deBasGelir.Text + "         " + deBitGelir.Text;

            rapor.Name = "Gelirler";

            rapor.Report.Name = "Gelirler";

            rapor.DataSource = ds;
            string dosyaadi = Application.StartupPath + "\\Gelirler.pdf";

            rapor.ExportToPdf(dosyaadi);

            //ds.Dispose();
            ds.Tables.Remove(dtliste);
            ds.Tables.Remove(Sirket);


            dtliste.Dispose();
            ds.Dispose();
            rapor.Dispose();

            DB.epostagonder(lUEKullanicilar.EditValue.ToString(), "Gelirler Raporu", dosyaadi, "Gün Sonu Raporu");

            formislemleri.Mesajform("E-Posta Gönderildi.", "S", 200);
        }
コード例 #27
0
ファイル: FormCheckMain.cs プロジェクト: 605258778/GISData
        /// <summary>
        /// 生成验收单
        /// </summary>
        /// <param name="modelName"></param>
        private void doAcceptance(string modelName)
        {
            try
            {
                XtraReport mReport = new XtraReport();
                mReport.LoadLayout(Application.StartupPath + "\\Report\\" + modelName); //报表模板文件

                DataTable taskError = new DataTable();
                if (ReportDia.wwcxmTable != null)
                {
                    taskError = ReportDia.wwcxmTable;
                }
                taskError.TableName = "taskError";
                DataTable checkError = new DataTable();
                DataTable attrError  = AttrDia.attrErrorTable;
                if (attrError != null)
                {
                    checkError = attrError;
                }
                DataTable topotable = TopoDia.topoErrorTable;
                if (topotable != null)
                {
                    checkError.Merge(topotable);
                    checkError.TableName = "checkError";
                }

                //查找组件
                //DetailReportBand DetailReport = mReport.FindControl("DetailReport", true) as DetailReportBand;
                //DetailReportBand DetailReport1 = mReport.FindControl("DetailReport1", true) as DetailReportBand;
                XRLabel lxr        = mReport.FindControl("lxr", true) as XRLabel;       //联系人
                XRLabel lxdh       = mReport.FindControl("lxdh", true) as XRLabel;      //联系方式
                XRLabel jcr        = mReport.FindControl("jcr", true) as XRLabel;       //检查人
                XRLabel gldwstring = mReport.FindControl("gldw", true) as XRLabel;      //管理单位
                XRLabel startime   = mReport.FindControl("startime", true) as XRLabel;  //开始检查时间
                XRLabel printtime  = mReport.FindControl("printtime", true) as XRLabel; //打印时间
                XRLabel checklog   = mReport.FindControl("checklog", true) as XRLabel;  //检查日志

                CommonClass common = new CommonClass();
                string      gldw   = common.GetConfigValue("GLDW");

                ConnectDB db = new ConnectDB();
                DataTable DT = db.GetDataBySql("select * from GISDATA_GLDW where GLDW = '" + gldw + "'");
                DataRow   dr = DT.Select(null)[0];

                lxr.Text        = dr["CONTACTS"].ToString();
                lxdh.Text       = dr["TEL"].ToString();
                jcr.Text        = common.GetConfigValue("USER") == "" ? "曾伟" : common.GetConfigValue("USER");
                gldwstring.Text = dr["GLDWNAME"].ToString();
                startime.Text   = dr["STARTTIME"].ToString();
                string   log      = dr["CHECKLOG"].ToString();
                string[] logArrar = log.Split('\n');
                checklog.Text = "";
                for (int j = 0; j < logArrar.Length - 1; j++)
                {
                    checklog.Text += "第" + (j + 1).ToString() + "次检查:" + logArrar[j] + "\n";
                }
                //checklog.Text = dr["CHECKLOG"].ToString();
                printtime.Text = DateTime.Now.ToLocalTime().ToString();
                //DetailReport.DataSource = taskError;
                //DetailReport1.DataSource = checkError;
                mReport.ShowPreviewDialog();
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(typeof(FormCheckMain), e);
            }
        }
コード例 #28
0
        private void SettingReport(XtraReport inputReport)
        {
            _MainReport = inputReport;

            if (PrintableComponent != null)
            {
                PrintableComponentContainer pcc = (PrintableComponentContainer)_MainReport.FindControl("printableComponentContainerMain", true);
                if (pcc != null)
                {
                    pcc.PrintableComponent = PrintableComponent;
                }
            }

            XRLabel lblHandlingDescription = (XRLabel)_MainReport.FindControl("lblHandlingDescription", true);

            if (lblHandlingDescription != null)
            {
                lblHandlingDescription.Visible = IsHandlePersonVisible;
            }

            XRLabel lblManagerDescription = (XRLabel)_MainReport.FindControl("lblManagerDescription", true);

            if (lblManagerDescription != null)
            {
                lblManagerDescription.Visible = IsManagerVisible;
            }

            Parameter pReportTitle = _MainReport.Parameters["ReportTitle"];

            if (pReportTitle != null)
            {
                pReportTitle.Value   = ReportTitle;
                pReportTitle.Visible = false;
            }

            Parameter pUserName = _MainReport.Parameters["UserName"];

            if (pUserName != null)
            {
                pUserName.Value   = GlobalInfo.USER_NAME;
                pUserName.Visible = false;
            }

            Parameter pOcfDate = _MainReport.Parameters["OcfDate"];

            if (pOcfDate != null)
            {
                pOcfDate.Value   = "中華民國 " + (GlobalInfo.OCF_DATE.Year - 1911) + " 年 " + GlobalInfo.OCF_DATE.ToString("MM 月 dd 日 ");
                pOcfDate.Visible = false;
            }

            Parameter pReportID = _MainReport.Parameters["ReportID"];

            if (pReportID != null)
            {
                pReportID.Value   = ReportID;
                pReportID.Visible = false;
            }

            Parameter pLeftMemo = _MainReport.Parameters["LeftMemo"];

            if (pLeftMemo != null)
            {
                pLeftMemo.Value   = LeftMemo;
                pLeftMemo.Visible = false;
            }

            Parameter pFooterMemo = _MainReport.Parameters["FooterMemo"];

            if (pFooterMemo != null)
            {
                pFooterMemo.Value   = FooterMemo;
                pFooterMemo.Visible = false;
            }

            _MainReport.DisplayName       = ReportTitle;
            _MainReport.RequestParameters = false;
            _MainReport.Visible           = true;

            _MainReport.ShowPrintStatusDialog = false;
        }