Exemple #1
0
 protected void Unnamed_Click(object sender, EventArgs e)
 {
     try
     {
         publicClass.bill bill = new publicClass.bill(Convert.ToInt32(((Button)sender).CommandArgument));
         if (bill.Payfrom != _uer.Udep_id)
         {
             throw new Exception("无权删除此票据!");
         }
         string cmd = "delete from bill where bill_id=@bill_id";
         publicClass.DS_input ip = new publicClass.DS_input();
         ip._cmd      = cmd;
         ip._par_name = new string[] { "@bill_id" };
         ip._par_type = new SqlDbType[] { SqlDbType.BigInt };
         ip._par_val  = new object[] { ((Button)sender).CommandArgument };
         publicClass.Dosql      ds = new publicClass.Dosql();
         publicClass.DS_input[] i  = { ip };
         ds.DoNoRe(i);
         bill_list_creat();
     }
     catch (Exception ex)
     {
         publicClass.calljs.alert(this, ex.Message);
     }
 }
Exemple #2
0
        protected void OK_Click(object sender, EventArgs e)
        {
            try
            {
                string            cmd_chk_date = "select top 1 * from m_state where m_dep_id =" + _uer.Udep_id + " order by m_s_id desc";
                publicClass.Dosql ds           = new publicClass.Dosql();
                ds.DoRe(cmd_chk_date);
                DateTime m_date = Convert.ToDateTime(ds.DtOut.Rows[0]["m_date"]);
                if (Convert.ToDateTime(make_date_txt.Text) <= m_date)
                {
                    publicClass.calljs.alert(this, "选择的填单日期已月结,请取消月结后在尝试填写票据!");
                    return;
                }

                publicClass.bill _bill = new publicClass.bill();
                _bill.Bill_id_head = "";
                _bill.Bill_id_body = 0;
                _bill.Bill_type    = 1;
                _bill.Payfrom      = _uer.Udep_id;
                _bill.Payto        = -1;
                _bill.Amount       = Convert.ToDecimal(this.Amount.Text);
                _bill.Summary      = Summary.Text;
                _bill.Maker        = _uer.Uid;
                _bill.Make_date    = Convert.ToDateTime(make_date_txt.Text);
                _bill.Isdel        = false;
                _bill.Iscx         = false;
                _bill.Prnt         = 0;
                _bill.Op           = 1;
                //_bill.Dep_id = _uer.Udep_id;
                _bill.Secret     = "";
                _bill.Payfrom_no = Convert.ToInt32(this.No.SelectedValue);
                _bill.Payto_no   = -1;
                _bill.Isfiled    = false;
                _bill.Truedate   = DateTime.Now;
                _bill.save();
                publicClass.calljs.alert(this, "保存成功");
                this.Amount.Text  = "";
                this.Summary.Text = "";
                Response.Redirect("review.aspx");
            }
            catch (Exception ex)
            {
                publicClass.calljs.alert(this, "填写项错误,单据保存失败!");
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
 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);
 }