Example #1
0
        /// <summary>
        /// 打印报告单事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            SetInitlocalsetting(hdMac.Text);//取mac地址
            string ordernums = GetSelectOrderNums();

            if (ordernums == string.Empty)
            {
                return;
            }

            //旧版打印1.0
            //Report report = new Report();
            //foreach (int row in gdOrders.SelectedRowIndexArray)
            //{
            //    string ordernum = gdOrders.DataKeys[row][0].ToString();
            //    //根据体检号得到报告单模板,从数据库读取报告数据。
            //    report = commonReport.GetReport(ordernum, 1);
            //    #region 修改打印状态、添加操作日志
            //    Hashtable ht = new Hashtable();
            //    ht.Add("ordernum", ordernum);
            //    ht.Add("oldstatus", (int)ParamStatus.OrdersStatus.FinishCheck);
            //    ht.Add("status", (int)ParamStatus.OrdersStatus.FinishPrint);
            //    ordersService.EditStatusByOldStatus(ht);
            //    ordersService.AddOperationLog(ordernum, null, "报告单集中打印", "打印报告单", "修改留痕", "");
            //    #endregion
            //    //序列化报告、报告数据,获取打印机
            //    commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData, Userinfo);
            //    ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson));
            //}

            //打印2.0
            foreach (int row in gdOrders.SelectedRowIndexArray)
            {
                string ordernum = gdOrders.DataKeys[row][0].ToString();
                #region 修改打印状态、添加操作日志
                Hashtable ht = new Hashtable();
                ht.Add("ordernum", ordernum);
                ht.Add("oldstatus", (int)ParamStatus.OrdersStatus.FinishCheck);
                ht.Add("status", (int)ParamStatus.OrdersStatus.FinishPrint);
                ordersService.EditStatusByOldStatus(ht);
                ordersService.AddOperationLog(ordernum, null, "报告单集中打印", "打印报告单", "修改留痕", "");
                #endregion
                Hashtable htPrint = commonReport.PrintReport3(ordernum, Userinfo, 1);
                ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", htPrint["printer"].ToString(), htPrint["json"].ToString(), htPrint["dsjson"].ToString()));
            }
        }