//打印指引单 protected void btnPrintSingle_Click(object sender, EventArgs e) { SetInitlocalsetting(hdMac.Text);//设置打印所需的客户端配置信息 string ordernums = GetSelectOrderNums(false); if (ordernums == string.Empty) { return; } DataTable dtSource = mamagement.GetPrintDirectData(ordernums); string[] arrordernum = ordernums.Split(','); Report report = new Report(); for (int i = 0; i < arrordernum.Length; i++) { DataSet ds = new DataSet(); DataTable dt = dtSource.Select("ordernum=" + arrordernum[i]).CopyToDataTable(); DataTable dthead = dt.Clone();//复制表结构 dt.TableName = "dtHealthGuideResult"; dthead.TableName = "dtHealthGuideTitle"; DataRow dr = dt.Rows[0]; dr["AGE"] = WebUI.GetAge(dr["AGE"]); //处理年龄 dr["PHONE"] = dr["PHONE"].ToString().TrimEnd('/').TrimStart('/'); //处理电话格式 dthead.ImportRow(dr); //复制一行 //title DataTable dttitle = new DataTable(); dttitle.TableName = "dtTitle"; dttitle.Columns.Add("titleName", typeof(string));//报告标题 DataRow dttitledr = dttitle.NewRow(); dttitledr[0] = dt.Rows[0]["titleName"]; dttitle.Rows.Add(dttitledr); //title end ds.Tables.Add(dthead); ds.Tables.Add(dt); ds.Tables.Add(dttitle); //后续调用柯木朗方法打印 //.......................... report = commonReport.GetReportByDataset("25", ds, 1); commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData.Copy(), Userinfo); ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson)); } //记录日志 JournalLog(ordernums, "打印指引单"); }
//打印明细 protected void btnPrint_Click(object sender, EventArgs e) { SetInitlocalsetting(hdMac.Text);//获取打印机配置信息 try { if (gvDetail.Rows.Count <= 0 || gvDetail.SelectedRowIndexArray.Length <= 0) { return; } int currentrowindex = (int)ViewState["currentrowindex"]; //hashtable保存报表头尾信息 Hashtable htinfo = new Hashtable(); htinfo["customername"] = gvList.Rows[currentrowindex].Values[1].ToString(); htinfo["salename"] = gvList.Rows[currentrowindex].Values[5].ToString(); htinfo["begindate"] = gvList.Rows[currentrowindex].Values[7].Trim() == "" ? "" : DateTime.Parse(gvList.Rows[currentrowindex].Values[7].Trim()).ToString("yyyy-MM-dd"); htinfo["enddate"] = gvList.Rows[currentrowindex].Values[8].ToString() == "" ? "" : DateTime.Parse(gvList.Rows[currentrowindex].Values[8].ToString()).ToString("yyyy-MM-dd"); htinfo["customertype"] = gvList.Rows[currentrowindex].Values[9].ToString() == "0" ? "项目" : "外包项目"; htinfo["titleName"] = ViewState["dictlabname"].ToString(); double?dictlabid = null; double?checkbillid = null; if (!string.IsNullOrEmpty(gvList.Rows[currentrowindex].Values[6].ToString())) { checkbillid = double.Parse(gvList.Rows[currentrowindex].Values[6].ToString()); } dictlabid = double.Parse(ViewState["dictlabid"].ToString()); //设置打印报表数据 string billheadid = gvList.Rows[currentrowindex].Values[0].ToString(); DataSet ds = new DataSet(); ds = comm.ConvertToDataSet(htinfo, billheadid, "billdetail", checkbillid, dictlabid, ViewState["flag"].ToString()); //打印 Report report = new Report(); report = commonReport.GetReportByDataset("20", ds, 1); commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData.Copy(), Userinfo); ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson)); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
protected void btnPrintIndividual_Click(object sender, EventArgs e) { SetInitlocalsetting(hdMac.Text);//取mac地址 try { if (gvList.Rows.Count <= 0 || gvList.SelectedRowIndexArray.Length <= 0) { return; } //获取勾选的记录 string ordernums = GetGridViewIds(); IList <Billhead> headlist = headService.SelectBillHeadListForPrintByids(ordernums); //定义dataset 存放打印信息 foreach (Billhead head in headlist) { Hashtable htinfo = new Hashtable(); htinfo["Ordernum"] = head.Ordernum; htinfo["Realname"] = head.Realname; htinfo["Productname"] = head.Productname; htinfo["Finalprice"] = head.Totalfinalprice + "(元)"; htinfo["Billbyname"] = head.Username; htinfo["Billbydate"] = System.DateTime.Now.Year + "年" + System.DateTime.Now.Month + "月" + System.DateTime.Now.Day + "日"; htinfo["titleName"] = ViewState["dictlabname"].ToString(); DataSet ds = comm.ConvertToDataSet(htinfo); //打印 CommonReport commonReport = new CommonReport(); Report report = new Report(); List <string> lists = new List <string>(); List <DataSet> dslist = new List <DataSet>(); report = commonReport.GetReportByDataset("30", ds, 1); commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData.Copy(), Userinfo); ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson)); } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
//打印清单 protected void btnPrint_Click(object sender, EventArgs e) { SetInitlocalsetting(hdMac.Text);//取mac地址 try { if (gvList.Rows.Count <= 0 || gvList.SelectedRowIndexArray.Length <= 0) { return; } //获取勾选的记录 string ordernums = GetGridViewIds(); DataSet ds = new DataSet(); //hashtable保存财务报表头尾信息 Hashtable htinfo = new Hashtable(); htinfo["begindate"] = dtpStart.Text; htinfo["enddate"] = dtpEnd.Text; htinfo["customertype"] = "项目"; htinfo["titleName"] = ViewState["dictlabname"].ToString(); //设置打印报表数据 ds = comm.ConvertToDataSet(htinfo, ordernums, "billhead", null, null, ""); CommonReport commonReport = new CommonReport(); Report report = new Report(); report = commonReport.GetReportByDataset("20", ds, 1); commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData.Copy(), Userinfo); ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson)); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
protected void btnPrint_Click(object sender, EventArgs e) { Hashtable htinfo = new Hashtable(); htinfo["Ordernum"] = tbxOrdernum.Text.Trim(); htinfo["Realname"] = tbxName.Text.Trim(); htinfo["Productname"] = ViewState["testname"]; htinfo["Finalprice"] = tbxModifytotalprice.Text + "(元)"; htinfo["Billbyname"] = Userinfo.userId; htinfo["Billbydate"] = System.DateTime.Now.Year + "年" + System.DateTime.Now.Month + "月" + System.DateTime.Now.Day + "日"; htinfo["titleName"] = Request["dictlabname"] == null ? "" : Request["dictlabname"]; DataSet ds = comm.ConvertToDataSet(htinfo); //打印 SetInitlocalsetting(hdMac.Text);//获取打印机配置信息 CommonReport commonReport = new CommonReport(); Report report = new Report(); report = commonReport.GetReportByDataset("30", ds, 1); commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData, Userinfo); ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson)); btnPrint.Enabled = false; gvList.Rows.Clear(); }