private void ourButton2_Click_1(object sender, EventArgs e) { UserProc.WaitStart(this); var das = db.Queryable <BaseIList>().Where(it => it.leibie == benleibie && it.SN == SN_SN).First(); if (das != null) { BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = das; FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.RDLC.rptMD.rdlc"; string[] asdf = das.item3.Split("||".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); float[] a = { 0, 0, 0, 0, 0 }; for (var i = 0; i < asdf.Length; i++) { asdf[i] = asdf[i] == "-" ? " " : asdf[i]; int www = (int)Math.Floor((double)i / 12); a[www] += asdf[i] == " " ? 0 : float.Parse(asdf[i]); } string[] b = new string[5]; for (int i = 0; i < a.Length; i++) { b[i] = a[i] + ""; b[i] = b[i] == "0" ? " " : b[i]; } ReportParameter parameters2 = new ReportParameter("P2", asdf); ReportParameter parameters3 = new ReportParameter("P3", ClsLogUser.XinMing); ReportParameter parameters4 = new ReportParameter("P4", b); frmPrn.rptView.LocalReport.SetParameters(parameters2); frmPrn.rptView.LocalReport.SetParameters(parameters3); frmPrn.rptView.LocalReport.SetParameters(parameters4); frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = bindingSource; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); } else { MessageBox.Show("数据错误,请重新选择在打印", "提示"); } UserProc.WaitEnd(this); }
//打印 private void editBtnPrn_Click(object sender, EventArgs e) { if ((string)editImgLDH.Tag == "") { return; } this.lblwait.showme(); FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.rptXY.rdlc"; frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource1 = new ReportDataSource(); reportDataSource1.Name = "ldmain"; reportDataSource1.Value = (object)this.bsShowMain; ReportDataSource reportDataSource2 = new ReportDataSource(); reportDataSource2.Name = "lddata"; reportDataSource2.Value = (object)this.bsShowData; frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource1); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource2); string filename = Application.StartupPath + "\\imgLDH.Bmp"; this.editImgLDH.Image.Save(filename, ImageFormat.Bmp); string str = "file:///" + filename.Replace("\\", "/"); frmPrn.rptView.LocalReport.EnableExternalImages = true; ReportParameter reportParameter1 = new ReportParameter("LDH", str); ReportParameter reportParameter2 = new ReportParameter("GSname", UserProc.GSname); frmPrn.rptView.LocalReport.SetParameters((IEnumerable <ReportParameter>) new ReportParameter[2] { reportParameter1, reportParameter2 }); frmPrn.rptView.RefreshReport(); int num = (int)frmPrn.ShowDialog(); frmPrn.Close(); this.lblwait.hideme(); }
private void editBtnPrn_Click(object sender, EventArgs e) { if (this.showLDH == "") { return; } this.lblwait.showme(); FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.RDLC.rptSchCB.rdlc"; frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource1 = new ReportDataSource(); reportDataSource1.Name = "ldmain"; reportDataSource1.Value = (object)this.bsShowMain; ReportDataSource reportDataSource2 = new ReportDataSource(); reportDataSource2.Name = "lddata"; DataTable dataTable = (DataTable)bsShowData.DataSource; List <T_PFdataT> list_T_PFdataT = new List <T_PFdataT>(); for (var i = 0; i < dataTable.Rows.Count; i++) { T_PFdataT t_PFdataT = new T_PFdataT(); var a = dataTable.Rows[i]; t_PFdataT.gongxu = a.Field <string>("gongxu"); t_PFdataT.ranliao = a.Field <string>("ranliao"); t_PFdataT.bili = a.Field <Decimal>("bili"); t_PFdataT.biliDW = a.Field <string>("biliDW"); t_PFdataT.yongliang = a.Field <Decimal>("yongliang"); t_PFdataT.yongliangDW = a.Field <string>("yongliangDW"); t_PFdataT.yaoqiu = a.Field <string>("yaoqiu"); t_PFdataT.JLbili = a.Field <Decimal>("JLbili"); t_PFdataT.JLyongliang = a.Field <Decimal>("JLyongliang"); t_PFdataT.JLyongliangDW = a.Field <string>("JLyongliangDW"); t_PFdataT.SNld = a.Field <long>("SNld"); t_PFdataT.danjia = a.Field <Decimal?>("danjia"); t_PFdataT.jine = a.Field <Decimal?>("jine"); list_T_PFdataT.Add(t_PFdataT); } reportDataSource2.Value = (object)list_T_PFdataT; frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource1); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource2); string filename = Application.StartupPath + "\\imgLDH.Bmp"; this.editImgLDH.Image.Save(filename, ImageFormat.Bmp); string str = "file:///" + filename.Replace("\\", "/"); frmPrn.rptView.LocalReport.EnableExternalImages = true; ReportParameter reportParameter1 = new ReportParameter("LDH", str); ReportParameter reportParameter2 = new ReportParameter("GSname", UserProc.GSname); frmPrn.rptView.LocalReport.SetParameters((IEnumerable <ReportParameter>) new ReportParameter[2] { reportParameter1, reportParameter2 }); frmPrn.rptView.RefreshReport(); int num = (int)frmPrn.ShowDialog(); frmPrn.Close(); this.lblwait.hideme(); }
private void button5_Click(object sender, EventArgs e) { LCKA lcka = getByWhere[0]; UserProc.WaitStart(this); string asd = lcka.riqiZhidan.ToString("yy-MM-dd HH:mm"); //asd = asd.Replace("月", "-").Replace("日", ""); Console.WriteLine("-------------" + asd); List <LCKA> list = new List <LCKA>(); if (lcka == null) { MessageBox.Show(this, "该流程卡已不存在!请核对!", "提示"); UserProc.WaitEnd(this); } else { var asdfg = db.Queryable <BaseIList>() .Where(it => it.leibie == "产量登记" && it.item1 == "开卡" && it.dingdanhao == lcka.liushuihao) .First(); if (asdfg == null) { var sd = new BaseIList() { leibie = "产量登记", dingdanhao = lcka.liushuihao, pingmin = lcka.peiming, seming = lcka.sebie, sehao = lcka.sehao, item0 = ClsLogUser.XinMing, //操作人员 pishu = lcka.peishu, item1 = "开卡", //工序 zongliang = lcka.zhongliang, item2 = "0%", //百分比 riqi = DateTime.Now, item3 = "开卡", kehu = lcka.kehu, }; db.Insertable <BaseIList>(sd).ExecuteCommand(); } list.Add(lcka); /* * if (lcka.zonggangshu == "" || !UserProc.IsInt(lcka.zonggangshu)) * { * list.Add(lcka); * } * else * { * int num = Convert.ToInt32(lcka.zonggangshu); * for (int i = 0; i < num; i++) * { * LCKA asd1 = new LCKA(); * asd1 = TransExpV2<LCKA, LCKA>.Trans(lcka); * asd1.liushuihao = string.Format("{0}", (int.Parse(lcka.liushuihao) + i)); * list.Add(asd1); * } * } */ FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.Report2.rdlc"; string filename = Application.StartupPath + "\\imgLCK.Bmp"; pictureBox1.Image.Save(filename, ImageFormat.Bmp); string str = "file:///" + filename.Replace("\\", "/"); frmPrn.rptView.LocalReport.EnableExternalImages = true; ReportParameter reportParameter1 = new ReportParameter("LDH", str); ReportParameter parameters = new ReportParameter("p1", sclcgx.txt.Text); ReportParameter parameters1 = new ReportParameter("riqi", asd); string[] array = new string[30]; var asde = db.Queryable <LCMX>().Where(it => it.SNka == lcka.SN).ToList(); //string[] asdf = sclcgx.txt.Text.Split("->".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < asde.Count; i++) { array[i] = asde[i].gongxu; } for (int i = asde.Count; i < 30; i++) { array[i] = ""; } ReportParameter parameters2 = new ReportParameter("p2", array); //BindingSource asdfds = new BindingSource(); //asdfds.DataSource = asde; //ReportDataSource reportDataSource1 = new ReportDataSource(); //reportDataSource1.Name = "lblcmx"; //reportDataSource1.Value = asdfds; frmPrn.rptView.LocalReport.SetParameters(parameters); frmPrn.rptView.LocalReport.SetParameters(parameters1); frmPrn.rptView.LocalReport.SetParameters(reportParameter1); frmPrn.rptView.LocalReport.SetParameters(parameters2); frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = list; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); //frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource1); var a = frmPrn.rptView.LocalReport.DataSources; frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); UserProc.WaitEnd(this); } }
private void 打印简历ToolStripMenuItem_Click(object sender, EventArgs e) { UserProc.WaitStart(this); RSManage rSManage = db.Queryable <RSManage>().Where(it => it.SN == sn_sn).First(); if (rSManage == null) { MessageBox.Show("请先选择要打印的行"); } else { RSManage1 rSManage1 = new RSManage1(); string[] xinbie = rSManage.Xingbie.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.SN = rSManage.SN; rSManage1.Name = rSManage.Name; rSManage1.Yixiang = rSManage.Yixiang; rSManage1.Addr = rSManage.Addr; rSManage1.phone = rSManage.phone; rSManage1.EMail = rSManage.EMail; rSManage1.born = rSManage.born; rSManage1.JiGuan = rSManage.JiGuan; rSManage1.Xingbie = rSManage.Xingbie; rSManage1.Ziwopngjia = rSManage.Ziwopngjia; rSManage1.Xingbie = xinbie.Length == 0 ? "" : xinbie[0]; rSManage1.sf = xinbie.Length == 1 ? "" : xinbie[1]; string[] jy = rSManage.JiaoYu.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.JiaoYu1 = jy[0] == "null" ? "" : jy[0]; rSManage1.JiaoYu2 = jy[1] == "null" ? "" : jy[1]; rSManage1.JiaoYu3 = jy[2] == "null" ? "" : jy[2]; rSManage1.JiaoYu4 = jy[3] == "null" ? "" : jy[3]; string[] gzjy = rSManage.gzjy.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.gzjy1 = gzjy[0] == "null" ? "" : gzjy[0]; rSManage1.gzjy2 = gzjy[1] == "null" ? "" : gzjy[1]; rSManage1.gzjy3 = gzjy[2] == "null" ? "" : gzjy[2]; rSManage1.gzjy4 = gzjy[3] == "null" ? "" : gzjy[3]; string[] JiNeng = rSManage.JiNeng.Split(new string[] { "||" }, StringSplitOptions.RemoveEmptyEntries); rSManage1.JiNeng1 = JiNeng[0] == "null" ? "" : JiNeng[0]; rSManage1.JiNeng2 = JiNeng[1] == "null" ? "" : JiNeng[1]; rSManage1.JiNeng3 = JiNeng[2] == "null" ? "" : JiNeng[2]; rSManage1.JiNeng4 = JiNeng[3] == "null" ? "" : JiNeng[3]; FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.RDLC.rptTXL.rdlc"; BindingSource bindingSource = new BindingSource(); bindingSource.DataSource = rSManage1; ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = bindingSource; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); var a = frmPrn.rptView.LocalReport.DataSources; frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); UserProc.WaitEnd(this); } }