Beispiel #1
0
        protected void show_bill()
        {
            if (_bill.Bill_type == 1)
            {
                CD.Visible     = true;
                ZP.Visible     = false;
                cd_ckdw.Text   = new publicClass.Dep(_bill.Payfrom).DeName;
                cd_bz.Text     = _bill.Summary;
                cd_pjbh.Text   = _bill.Bill_id_head + "-" + _bill.Bill_id_body;
                cd_dycs.Text   = _bill.Prnt + "次";
                cd_ckzh.Text   = new publicClass.dep_no(_bill.Payfrom_no).No + "(" + new publicClass.dep_no(_bill.Payfrom_no).No_name + ")";
                cd_maker.Text  = new publicClass.Uer(_bill.Maker).Uname;
                cd_amount.Text = _bill.Amount.ToString();
                cd_kpsj.Text   = _bill.Truedate.ToShortDateString();
                cd_jzrq.Text   = _bill.Make_date.ToShortDateString();
            }
            else
            {
                CD.Visible   = false;
                ZP.Visible   = true;
                zp_fkdw.Text = new publicClass.Dep(_bill.Payfrom).DeName;
                zp_fkzh.Text = new publicClass.dep_no(_bill.Payfrom_no).No + "(" + new publicClass.dep_no(_bill.Payfrom_no).No_name + ")";
                publicClass.exc_dep edep = new publicClass.exc_dep(_bill.Payto);
                zp_skdw.Text   = edep.Edep_name;
                zp_skzh.Text   = edep.Edep_no;
                zp_maker.Text  = new publicClass.Uer(_bill.Maker).Uname;
                zp_amount.Text = _bill.Amount.ToString();
                zp_kprq.Text   = _bill.Truedate.ToShortDateString();
                zp_jzrq.Text   = _bill.Make_date.ToShortDateString();
                zp_bz.Text     = _bill.Summary;
                zp_pjbh.Text   = _bill.Bill_id_head + "-" + _bill.Bill_id_body;

                zp_dycs.Text = _bill.Prnt + "次";
            }
        }
Beispiel #2
0
 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");
     }
 }
Beispiel #3
0
 protected void savenew_Click(object sender, EventArgs e)
 {
     try
     {
         publicClass.exc_dep edep = new publicClass.exc_dep();
         edep.Edep_name = this.edep_name.Text.Length == 0?null:edep_name.Text;
         edep.Edep_no   = this.edep_no.Text.Length == 0?null: edep_no.Text;
         edep.Summary   = this.summary.Text.Length == 0?null: summary.Text;
         edep.Dep_id    = this.headbar.Uer.Udep_id;
         edep.State     = false;
         edep.Save();
         list(Session["edep_list"].ToString());
         this.list_tab.Visible    = true;
         this.new_dep_div.Visible = false;
         this.ymbt.Text           = "往来单位列表";
         this.edep_name.Text      = "";
         this.edep_no.Text        = "";
         this.summary.Text        = "";
     }
     catch
     {
         this.ErrStr.Text = "新建单位失败,请确认填写无误!";
     }
 }
Beispiel #4
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);
        }