コード例 #1
0
        public void TestCreate()
        {
            var input = new Input();
            var args  = new InputArgs(input);
            var cargs = InputArgs.Create(input);


            Assert.AreEqual(input, cargs.Input);
            Assert.AreEqual(args, cargs);
        }
コード例 #2
0
        private void Print(int printmode = 0)
        {
            DataTable mainDataTable = new DataTable();

            mainDataTable.Columns.Add("单据编号");
            mainDataTable.Columns.Add("采购日期");
            mainDataTable.Columns.Add("制单人");
            var row = mainDataTable.NewRow();

            row["单据编号"] = _purchaseOrder.DocumentNumber;
            row["采购日期"] = _purchaseOrder.CreateTime.ToShortDateString();
            row["制单人"]  = _purchaseOrder.EmployeeName;
            mainDataTable.Rows.Add(row);


            DataTable detailDataTable = new DataTable();

            detailDataTable.Columns.Add("医疗器械名称");
            detailDataTable.Columns.Add("规格");
            detailDataTable.Columns.Add("生产企业");
            detailDataTable.Columns.Add("数量");
            detailDataTable.Columns.Add("单价");
            detailDataTable.Columns.Add("金额");

            foreach (var item in _listPurchaseOrderDetail)
            {
                var newrow = detailDataTable.NewRow();
                newrow["医疗器械名称"] = item.ProductGeneralName;
                newrow["规格"]     = item.DictionarySpecificationCode;
                newrow["生产企业"]   = item.FactoryName;
                newrow["数量"]     = item.Amount.ToString("#0.00");
                newrow["单价"]     = item.PurchasePrice.ToString("#0.00");
                newrow["金额"]     = (item.Amount * item.PurchasePrice).ToString("#0.00");

                detailDataTable.Rows.Add(newrow);
            }


            var data = new
            {
                TEMPLATE  = "PurchaseOrder.frx",
                PRINTMODE = printmode,
                DATA      = new
                {
                    MAINDATA   = mainDataTable,
                    DETAILDATA = detailDataTable
                }
            };
            var input = InputArgs.Create("", "", "", "", "", TechSvr.Utils.Json.ToJson(data), "PrintTemplate");

            new PrintCommand().Excute(input);
        }