protected void Page_Load(object sender, EventArgs e) { try { _uer = new publicClass.Uer(Convert.ToInt32(Session["uer_id"])); _dep = new publicClass.Dep(_uer.Udep_id); string cmd_yj = "select top 1 m_date_word from m_state where 1=1 and m_dep_id= " + _uer.Udep_id + "order by m_s_id desc"; publicClass.MSE mse = new publicClass.MSE(DateTime.Now); string cmd_bysr = string.Format("select case when sum(amount) is null then 0 else sum(amount) end from bill where bill_type=1 and isfiled =1 and make_date between '{0}' and '{1}'", mse.S, mse.E); string cmd_byzc = string.Format("select case when sum(amount) is null then 0 else sum(amount) end from bill where bill_type=2 and isfiled =1 and make_date between '{0}' and '{1}'", mse.S, mse.E);; string cmd_zyzh = "select count(*) from depno where 1=1 and state=1"; string cmd_wldw = "select count(*) from exc_dep where 1=1 and state=1"; string cmd_dy = "select count(*) from bill where isfiled=1 and prnt=0"; string cmd_sp = "select count(*) from bill where op=" + _uer.Ulvl; string cmd_gd = "select count(*) from bill where op=5 and isfiled =0"; string str_where = " and dep_id= " + _uer.Udep_id; if (_uer.Ulvl <= 2) { cmd_bysr += " and payfrom = " + _uer.Udep_id; cmd_byzc += " and payfrom =" + _uer.Udep_id; cmd_zyzh += str_where; cmd_wldw += str_where;; cmd_dy += " and payfrom = " + _uer.Udep_id; cmd_sp += " and payfrom = " + _uer.Udep_id; cmd_gd += " and payfrom = " + _uer.Udep_id; } publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmd_yj); yj_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_bysr); bysr_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_byzc); byzc_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_zyzh); zyzh_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_wldw); wldw_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_dy); dy_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_sp); sp_lab.Text = ds.DtOut.Rows[0][0].ToString(); ds = new publicClass.Dosql(); ds.DoRe(cmd_gd); gd_lab.Text = ds.DtOut.Rows[0][0].ToString(); dbsx_lal.Text = (Convert.ToInt32(sp_lab.Text) + Convert.ToInt32(dy_lab.Text) + Convert.ToInt32(gd_lab.Text)).ToString(); sz_lab.Text = (Convert.ToDecimal(bysr_lab.Text) - Convert.ToDecimal(byzc_lab.Text)).ToString(); sp_img.Text = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(sp_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString()); gd_img.Text = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(gd_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString()); dy_img.Text = string.Format("<div class='bar' style='width:{0}%';></div>", (Convert.ToInt16(dy_lab.Text) * 100 / Convert.ToInt16(dbsx_lal.Text)).ToString()); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { _uer = new publicClass.Uer(Convert.ToInt32(Session["uer_id"])); _dep = new publicClass.Dep(_uer.Udep_id); creat_summary(); creat_info_list(); }
protected void Page_Load(object sender, EventArgs e) { _uer = new publicClass.Uer(Convert.ToInt32(Session["uer_id"])); _dep = new publicClass.Dep(_uer.Udep_id); if (!IsPostBack) { bill_list_creat(); } }
protected void filed_Click(object sender, EventArgs e) { try { startup(); if (_bill.Op == 5) { publicClass.Dep dep = new publicClass.Dep(_bill.Payfrom); string head = dep.DeShort + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString(); publicClass.exc_dep exc = new publicClass.exc_dep();; if (_bill.Payto != -1) { exc = new publicClass.exc_dep(_bill.Payto); } else { exc.Edep_name = "无"; exc.Edep_no = "无"; } string secret = "Fd:" + new publicClass.Dep(_bill.Payfrom).DeName; secret += "Fn:" + new publicClass.dep_no(_bill.Payfrom_no).No; secret += "A:" + _bill.Amount; secret += "Td:" + exc.Edep_name + "Tn:" + exc.Edep_no; secret += "Ur:" + new publicClass.Uer(_bill.Maker).Uname + "Md:" + _bill.Make_date.ToShortDateString(); string base64 = publicClass.str2base64.to64(secret); publicClass.MSE mse = new publicClass.MSE(_bill.Make_date); string up_str = string.Format("update bill set isfiled=1,bill_id_head='{0}',bill_id_body =(select max(bill_id_body)+1 from bill where make_date between '{1}' and '{2}'),secret='{3}' where bill_id={4} ", head, mse.S.ToShortDateString(), mse.E.ToShortDateString(), base64, _bill.Bill_id); publicClass.DS_input ip = new publicClass.DS_input(); ip._cmd = up_str; ip._par_name = new string[] { }; ip._par_type = new SqlDbType[] { }; ip._par_val = new object[] { }; publicClass.Dosql ds = new publicClass.Dosql(); ds.DoNoRe(new publicClass.DS_input[] { ip }); } } catch { } finally { Response.Redirect("review.aspx"); } }
protected MemoryStream creatpdf() { string[] cmd = new string[2]; if (Session["bill_preview"] == null) { } else { string billcmd = Session["bill_preview"].ToString(); cmd = billcmd.Split(','); } MemoryStream ms_out = new MemoryStream(); try { publicClass.bill bill = new publicClass.bill(Convert.ToInt32(cmd[0])); publicClass.Dep dep = new publicClass.Dep(bill.Payfrom); publicClass.dep_no dep_no = new publicClass.dep_no(bill.Payfrom_no); publicClass.exc_dep edep = new publicClass.exc_dep(); if (bill.Bill_type == 2) { edep = new publicClass.exc_dep(bill.Payto); } if (cmd[1].ToString() == "1") { //publicClass.sig sig = new publicClass.sig(1); string url = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/billmodel/cd.pdf"; publicClass.Uer maker = new publicClass.Uer(bill.Maker); PdfReader rd = new PdfReader(url); MemoryStream ms = new MemoryStream(); PdfStamper st = new PdfStamper(rd, ms); PdfContentByte cb = st.GetOverContent(1); //iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(publicClass.Sigformat.ToImage(sig.Sig_word), new BaseColor(255, 255, 255)); //img.Transparency = new int[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; //img.SetAbsolutePosition(100, 100); //img.ScaleToFit(100f, 100f); //cb.AddImage(img); //cb.AddImage(img); BaseFont font = BaseFont.CreateFont("c:\\windows\\fonts\\STSONG.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); AcroFields f1 = st.AcroFields; foreach (string x in f1.Fields.Keys) { f1.SetFieldProperty(x, "textfont", font, null); } f1.SetField("ckdw", dep.DeName); f1.SetField("kprq", bill.Make_date.ToShortDateString().ToString()); f1.SetField("jexx", "¥" + bill.Amount.ToString()); f1.SetField("jedx", "人民币: " + publicClass.formatamount.format(bill.Amount)); f1.SetField("ckzh", dep_no.No); f1.SetField("bz", "开户银行:" + dep_no.No_name + "\n说明:" + bill.Summary); f1.SetField("zdr", maker.Uname); string newstr = publicClass.str2base64.to64(publicClass.str2base64.tostr(bill.Secret) + "Pd:" + DateTime.Now.ToShortDateString()); f1.SetField("mm", newstr); f1.SetField("pjbh", bill.Bill_id_head + "-" + bill.Bill_id_body); f1.SetField("kprq", string.Format("{0}年{1}月{2}日", bill.Make_date.Year, bill.Make_date.Month, bill.Make_date.Day)); f1.SetField("dycs", bill.Prnt.ToString()); f1.SetField("dyrq", string.Format("{0}年{1}月{2}日", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)); InsertImg(cb, bill.Bill_id, f1); st.Writer.CloseStream = false; st.Close(); ms_out = ms; } else { string url = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/billmodel/zp.pdf"; publicClass.Uer maker = new publicClass.Uer(bill.Maker); PdfReader rd = new PdfReader(url); MemoryStream ms = new MemoryStream(); PdfStamper st = new PdfStamper(rd, ms); PdfContentByte cb = st.GetOverContent(1); BaseFont font = BaseFont.CreateFont("c:\\windows\\fonts\\STSONG.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); AcroFields f1 = st.AcroFields; foreach (string x in f1.Fields.Keys) { f1.SetFieldProperty(x, "textfont", font, null); } f1.SetField("fkdw", dep.DeName); f1.SetField("kprq", bill.Make_date.ToShortDateString().ToString()); f1.SetField("fkzh", dep_no.No); f1.SetField("skdw", edep.Edep_name); f1.SetField("skzh", edep.Edep_no); f1.SetField("ckzh", dep_no.No); f1.SetField("xxje", "¥" + bill.Amount.ToString()); f1.SetField("dxje", "人民币: " + publicClass.formatamount.format(bill.Amount)); f1.SetField("bz", "开户银行:" + dep_no.No_name + "\n说明:" + bill.Summary); f1.SetField("zdr", maker.Uname); string newstr = publicClass.str2base64.to64(publicClass.str2base64.tostr(bill.Secret) + "Pd:" + DateTime.Now.ToShortDateString()); f1.SetField("mm", newstr); f1.SetField("pjph", bill.Bill_id_head + "-" + bill.Bill_id_body); f1.SetField("kprq", string.Format("{0}年{1}月{2}日", bill.Make_date.Year, bill.Make_date.Month, bill.Make_date.Day)); f1.SetField("dycs", bill.Prnt.ToString()); f1.SetField("dyrq", string.Format("{0}年{1}月{2}日", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)); InsertImg(cb, bill.Bill_id, f1); st.Writer.CloseStream = false; st.Close(); ms_out = ms; } } catch (Exception ex) { base_font = BaseFont.CreateFont(Server.MapPath("\\billmodel\\hwst.ttf"), BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); Font font = new Font(base_font); Document doc = new Document(PageSize.A5.Rotate()); PdfWriter wr = PdfWriter.GetInstance(doc, ms_out); doc.Open(); doc.Add(new Paragraph(ex.Message, font)); doc.Close(); } return(ms_out); }
protected void startup() { _uer = new publicClass.Uer(Convert.ToInt32(Session["uer_id"])); _bill = new publicClass.bill(Convert.ToInt32(Session["bill_filedinfo_id"].ToString())); _dep = new publicClass.Dep(_uer.Udep_id); }