Esempio n. 1
0
        private static ReportPaper CreateReportPaperFromXmlNode(XmlNode nodePaper)
        {
            ReportPaper rp = new ReportPaper();

            rp.ReportName = nodePaper.Attributes["reportname"].Value;
            rp.PaperName  = nodePaper.Attributes["papername"].Value;
            rp.Height     = Convert.ToInt32(nodePaper.Attributes["paperheight"].Value);
            rp.Width      = Convert.ToInt32(nodePaper.Attributes["paperwidth"].Value);

            int lx = 0;

            if (!string.IsNullOrEmpty(nodePaper.Attributes["type"].Value))
            {
                lx = Convert.ToInt32(nodePaper.Attributes["type"].Value);
            }
            switch (lx)
            {
            case 0:
                //默认打印机,需要去获取打印机名,先从本地的xml配置中读取,本地没有再去读服务器的
                rp.DefaultPrinterName = nodePaper.InnerText;
                break;

            case 1:
                //这里需要根据类型获取特定的发票打印机,该设置通过Constant类维护,保存在ClientConfig.ini中
                rp.DefaultPrinterName = Constant.CInvoicePrinterName;
                break;

            case 2:
                //这里需要根据类型获取特定的报表打印机,该设置通过Constant类维护,保存在ClientConfig.ini中
                rp.DefaultPrinterName = Constant.CReportPrinterName;
                break;
            }
            rp.PrinterTagType = (PrinterTargetType)lx;
            return(rp);
        }
Esempio n. 2
0
        private void AddRow(TrasenFrame.Classes.ReportPaper rp)
        {
            int row = dgvReport.Rows.Add();

            dgvReport[COL_REPORT_NAME.Name, row].Value  = rp.ReportName;
            dgvReport[COL_PAPER_NAME.Name, row].Value   = rp.PaperName;
            dgvReport[COL_WIDTH.Name, row].Value        = rp.Width;
            dgvReport[COL_HEIGHT.Name, row].Value       = rp.Height;
            dgvReport[COL_TYPE.Name, row].Value         = rp.PrinterTagType.ToString();
            dgvReport[COL_PRINTER_NAME.Name, row].Value = rp.DefaultPrinterName;
        }
Esempio n. 3
0
        /// <summary>
        /// 加载本地报表纸张配置列表
        /// </summary>
        /// <returns></returns>
        public static List <ReportPaper> LoadLocalReportPapers(RelationalDatabase database)
        {
            if (!System.IO.File.Exists(ReportPaper.reportSettingXml))
            {
                SyncPaperDefineFromServer(database);
            }
            XmlDocument document = new XmlDocument();

            document.Load(reportSettingXml);
            XmlNode            rootNode     = document.SelectSingleNode(ReportPaper.ROOT_NODE_NAME);
            List <ReportPaper> reportPapers = new List <ReportPaper>();

            foreach (XmlNode nodePaper in rootNode.ChildNodes)
            {
                ReportPaper rp = CreateReportPaperFromXmlNode(nodePaper);
                reportPapers.Add(rp);
            }
            return(reportPapers);
        }
Esempio n. 4
0
        /// <summary>
        /// 根据报表名称获取报表纸张
        /// </summary>
        /// <param name="reportName">报表名</param>
        /// <param name="bIncludePath">报表名中是否包含路径</param>
        /// <param name="database">数据访问对象</param>
        /// <returns></returns>
        public static ReportPaper GetReportPapterConfigFromLocalXml(string reportName, bool bIncludePath, RelationalDatabase database)
        {
            string _reportName = "";

            if (bIncludePath)
            {
                _reportName = GetReportFileName(reportName);
            }
            else
            {
                _reportName = reportName;
            }

            if (!System.IO.File.Exists(ReportPaper.reportSettingXml))
            {
                SyncPaperDefineFromServer(database);
            }

            XmlDocument document = new XmlDocument();

            document.Load(ReportPaper.reportSettingXml);

            XmlNode     nodeReportPaper = GetNodeByReportName(document, reportName);
            ReportPaper rp = new ReportPaper();

            rp.reportName = reportName;
            if (nodeReportPaper != null)
            {
                rp = CreateReportPaperFromXmlNode(nodeReportPaper);
            }
            else
            {
                //没有找到xml中的配置,设置默认值
                rp.PaperName = "";
                rp.Height    = 0;
                rp.Width     = 0;
            }
            return(rp);
        }
Esempio n. 5
0
 /// <summary>
 /// 设置报表在本地打印时的打印机名称
 /// </summary>
 /// <param name="reportPaper"></param>
 /// <param name="printerName"></param>
 public static void SetReportPaperPrinter(ReportPaper reportPaper, string printerName)
 {
     SetReportPaperPrinter(reportPaper.PaperName, printerName, (int)reportPaper.PrinterTagType);
 }