zoukankan      html  css  js  c++  java
  • Devexpress 明细报表

        public class InOrder
        {
            public String Title { get; set; }
            public String EmpNo { get; set; }
            public List<InOrderItem> Items { get; set; }
            public decimal? GroupSum
            {
                get
                {
                    return Items.Sum(ent => ent.Amount);
                }
            }
            public InOrder()
            {
                Items = new List<InOrderItem>();
            }
        }
        public class InOrderItem
        {
            public long? Id { get; set; }
            public decimal? Amount { get; set; }
            public String Name { get; set; }
        }
    View Code
            public List<InOrder> Orders = new List<InOrder>();
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                var rnd = new Random(Environment.TickCount);
                for (int i = 0; i < 10; i++)
                {
                    var order = new InOrder();
                    order.EmpNo = "00102" + i;
                    order.Title = "入库单" + Guid.NewGuid().ToString();
                    Orders.Add(order);
                    var itemCount = rnd.Next(10, 60);
                    for (int j = 0; j < itemCount; j++)
                    {
                        var item = new InOrderItem();
                        order.Items.Add(item);
                        item.Id = j;
                        item.Name = "项目" + Path.GetRandomFileName();
                        item.Amount =(decimal) rnd.NextDouble() * 100;
                       
                    }
                }
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                #region
                var rpt = new XtraReport1();
                rpt.DataSource = Orders;
                rpt.RequestParameters = false;
                rpt.PrintingSystem.ShowMarginsWarning = false;
                rpt.PrintingSystem.ShowPrintStatusDialog = false;
                ReportPrintTool printTool = new ReportPrintTool(rpt);
                printTool.Report.CreateDocument(false);
                printTool.PrintingSystem.ShowMarginsWarning = false;
                Application.DoEvents();
                printTool.ShowPreviewDialog();
                #endregion
            }
    View Code

    先设置下报表尺寸为A4
    A4= 210mm × 297 mm

    Letter= 216mm × 279mm (8.5X11英寸)

    letter size是纸张尺寸的一种,主要应用与美国、墨西哥和加拿大等国家。

  • 相关阅读:
    hibernate中的配置参数详解
    js 提示框
    Caused by: java.sql.SQLException: 数字溢出
    什么是Assembly(程序集)?
    我的邮箱
    hdu 3746(KMP的循环节问题)
    hdu 1176(一道简单的dp)
    hdu 1385(求出最短路并输出最短路径)
    hdu 1003(最大连续字串)
    hdu 4512(最长公共递增子序列加强版)
  • 原文地址:https://www.cnblogs.com/wdfrog/p/12854698.html
Copyright © 2011-2022 走看看