Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string paystatus = Request.QueryString["pay"];
                LoadAusRottenData();

                LoadFile();

                LoadData();

                if (paystatus == "1") //已经支付了
                {
                    string regid = Request.QueryString["regID"].ToString().Trim();
                    RegReimbursementManager rem = new RegReimbursementManager();
                    RegReimbursement        reg = rem.GetModel(regid);
                    this.txtPayer.Text       = reg.payerName;
                    this.txtPaymentDate.Text = reg.paymentDate.ToString("yyyy-MM-dd");
                    //this.ddlPaymentMode.SelectedValue = reg.paymentMode.ToString();
                    this.iptremark.Value = reg.payremark.ToString();

                    this.btnSave.Visible = false;

                    this.chkIsPay.Checked = true;
                    this.chkIsPay.Enabled = false;
                    //this.ddlPaymentMode.Enabled = false;
                    this.iptremark.Disabled   = true;
                    this.iptbankname.Disabled = true;
                    this.iptbanknum.Disabled  = true;
                    this.txtPaymentDate.Attributes.Add("onfocus", "");
                }
                else
                {
                    txtPayer.Text = (Session["login"] as LoginInfo).Cname;

                    txtPaymentDate.Text          = DateTime.Now.ToString("yyyy-MM-dd");
                    this.txtPaymentDate.CssClass = "inputLine readonly Wdate";
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 保存报销登记,保存的信息有(其他信息保存到RegReimbursement表中)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            #region  无用代码
            ///////////
            //EtNet_Models.RegReimbursement mReg = new RegReimbursement();

            //LoginInfo currentUser = Session["login"] as LoginInfo;
            //mReg.id = Guid.NewGuid().ToString();
            //mReg.makerID = currentUser.Id;
            //mReg.makerName = currentUser.Cname;
            //mReg.makeTime = DateTime.Now;
            //mReg.payerID = currentUser.Id;
            //mReg.payerName = currentUser.Cname;
            //mReg.paymentDate = DateTime.Parse(txtPaymentDate.Text.Trim());
            //mReg.paymentMode = int.Parse(ddlPaymentMode.SelectedValue.Trim());
            //mReg.payStatus = chkIsPay.Checked ? 1 : 0;
            //mReg.hasInvoice = int.Parse(ddlHasInvoiceNum.SelectedValue.Trim());


            //if (txtHasInvoceDate.Text.Trim() != "") //收到发票日期
            //{
            //    mReg.hasInvoiceDate = Convert.ToDateTime(txtHasInvoceDate.Text);

            //}

            //if (Request.QueryString["ausID"] != null)
            //{
            //    int ausID;
            //    int.TryParse(Request.QueryString["ausID"].ToString(), out ausID);
            //    mReg.ausID = ausID;
            //}

            //RegReimbursementManager bReg = new RegReimbursementManager();

            //ReimbursementInvoice mRI = new ReimbursementInvoice();

            //ReimbursementInvoiceManager bRI = new ReimbursementInvoiceManager();

            //if (Request.QueryString["regID"] != null && Request.QueryString["regID"].ToString().Trim() != string.Empty)
            //{

            //    string regID = Request.QueryString["regID"].ToString().Trim();


            //    if (string.Empty != regID)
            //    {
            //        mReg = bReg.GetModel(regID);

            //        if (mReg != null)
            //        {
            //            mReg.paymentDate = DateTime.Parse(txtPaymentDate.Text.Trim());
            //            mReg.paymentMode = int.Parse(ddlPaymentMode.SelectedValue.Trim());
            //            mReg.payStatus = chkIsPay.Checked ? 1 : 0;
            //            mReg.hasInvoice = int.Parse(ddlHasInvoiceNum.SelectedValue.Trim());
            //            if (this.txtHasInvoceDate.Text.Trim() != "")
            //            {
            //                mReg.hasInvoiceDate = Convert.ToDateTime(this.txtHasInvoceDate.Text);
            //            }

            //            bReg.Update(mReg);

            //            bRI.DeleteByRegID(regID);
            //        }
            //    }
            //}
            //else
            //    bReg.Add(mReg);

            //string jsonString = hidInvoiceDate.Value;

            //List<InvoiceData> invoiceList = ReadJson(jsonString);


            //mRI.reimbursementID = mReg.id;

            //for (int i = 0, len = invoiceList.Count(); i < len; i++)
            //{
            //    InvoiceData invoiceData = invoiceList[i];

            //    mRI.id = Guid.NewGuid().ToString();
            //    mRI.invoiceNum = invoiceData.Num;
            //    mRI.remark = invoiceData.Remark;

            //    if (mRI.invoiceNum.Trim() == string.Empty && mRI.remark.Trim() == string.Empty)
            //        break;

            //    bRI.Add(mRI);
            //}

            //ClientScript.RegisterStartupScript(Page.GetType(), "a", "alert('保存成功');self.location.href='RegReimbursedFormList.aspx';", true);

            #endregion

            EtNet_Models.RegReimbursement reg = new RegReimbursement();
            LoginInfo payUser = Session["login"] as LoginInfo;


            if (Request.QueryString["ausID"] != null)
            {
                int ausID;
                int.TryParse(Request.QueryString["ausID"].ToString(), out ausID);
                reg.ausID = ausID;
            }
            reg.makerName   = this.lblcanme.Text;                                           //报销人员
            reg.makeTime    = DateTime.Parse(this.lblapplydate.Text.Trim());                //报销日期
            reg.makerID     = LoginInfoManager.getLoginIDByname(this.lblcanme.Text.Trim()); //得到报销人员关联id
            reg.payStatus   = chkIsPay.Checked ? 1 : 0;                                     //费用是否支付
            reg.paymentMode = 1;                                                            /* int.Parse(ddlPaymentMode.SelectedValue.Trim()); //支付方式*/
            reg.payerID     = payUser.Id;                                                   //支付人关联id
            reg.payerName   = payUser.Cname;                                                //支付人名字
            reg.paymentDate = DateTime.Parse(txtPaymentDate.Text.Trim());                   //支付时间
            reg.payremark   = this.iptremark.Value;                                         //支付备注
            reg.bankName    = this.iptbankname.Value;                                       //支付银行
            reg.bankNum     = this.iptbanknum.Value;                                        //支付帐号
            reg.bankId      = int.Parse(this.hidbankid.Value);                              //支付银行对应id
            RegReimbursementManager regmanager = new RegReimbursementManager();

            if (Request.QueryString["regID"] != null && Request.QueryString["regID"].ToString().Trim() != string.Empty)
            {
                string regID = Request.QueryString["regID"].ToString().Trim();


                if (string.Empty != regID)
                {
                    reg = regmanager.GetModel(regID);

                    if (reg != null)
                    {
                        reg.paymentDate = DateTime.Parse(txtPaymentDate.Text.Trim());
                        reg.paymentMode = 1; /* int.Parse(ddlPaymentMode.SelectedValue.Trim());*/
                        reg.payStatus   = chkIsPay.Checked ? 1 : 0;
                        reg.payremark   = this.iptremark.Value;
                        reg.bankName    = this.iptbankname.Value;
                        reg.bankNum     = this.iptbanknum.Value;
                        reg.bankId      = int.Parse(this.hidbankid.Value);
                        regmanager.Update(reg);
                    }
                }
            }
            else
            {
                reg.id = Guid.NewGuid().ToString(); //id主键
                regmanager.Add(reg);
            }
            ClientScript.RegisterStartupScript(Page.GetType(), "a", "alert('保存成功');self.location.href='RegReimbursedFormList.aspx';", true);
        }