コード例 #1
0
ファイル: MainView.cs プロジェクト: ZixiangBoy/YongERP
        private static void DoPrint(List <t_trade> trds)
        {
            var ps = new PrintingSystem();

            ps.Document.Pages.Clear();
            ps.ShowMarginsWarning = false;
            ps.ClearContent();

            var whr = trds.Select(k => k.Guid.ToString()).Aggregate((s1, s2) => s1 + "','" + s2);

            using (var db = new Database()) {
                var vtrds  = db.Fetch <t_trade>(string.Format(" where guid in ('{0}')", whr));
                var orders = db.Fetch <t_order>(string.Format(" where tradeguid in ('{0}')", whr));
                vtrds.ForEach(trd => {
                    var prtinfo    = new PrintInfo();
                    prtinfo.Trade  = trd;
                    prtinfo.Orders = orders.Where(odr => odr.TradeGuid == trd.Guid).ToList();
                    var rptfh      = new rptFH();
                    rptfh.BindPrintData(prtinfo);
                    rptfh.CreateDocument();

                    ps.Document.Pages.AddRange(rptfh.Pages);
                });
            }

            ps.Print();
        }
コード例 #2
0
ファイル: MainView.cs プロジェクト: ZixiangBoy/YongERP
        private static void DoPrint(List<t_trade> trds)
        {
            var ps = new PrintingSystem();
            ps.Document.Pages.Clear();
            ps.ShowMarginsWarning = false;
            ps.ClearContent();

            var whr = trds.Select(k => k.Guid.ToString()).Aggregate((s1, s2) => s1 + "','" + s2);
            using (var db = new Database()) {
                var vtrds = db.Fetch<t_trade>(string.Format(" where guid in ('{0}')", whr));
                var orders = db.Fetch<t_order>(string.Format(" where tradeguid in ('{0}')", whr));
                vtrds.ForEach(trd => {
                    var prtinfo = new PrintInfo();
                    prtinfo.Trade = trd;
                    prtinfo.Orders = orders.Where(odr => odr.TradeGuid == trd.Guid).ToList();
                    var rptfh = new rptFH();
                    rptfh.BindPrintData(prtinfo);
                    rptfh.CreateDocument();

                    ps.Document.Pages.AddRange(rptfh.Pages);
                });
            }

            ps.Print();
        }