Exemplo n.º 1
0
        private void BindUnRepayRd()
        {
            string strSql = "select d.borrowapplydetailid, d.borrowapplymasterid, t.borrowapplymastercode,"
                + " (case t.repaytype when 1 then '普通借款' when 2 then '备用金借款' when 3 then '专项借款'"
                + " End) repaytypename, t.updatedate, s.subjectname, d.chargetype, d.usablemoney, d.borrowmoney,"
                + " d.unrepaymoney, d.ROWID from t_fb_borrowapplydetail d inner join t_fb_borrowapplymaster t"
                + " on d.borrowapplymasterid = t.borrowapplymasterid inner join t_fb_subject s on d.subjectid = s.subjectid "
                + " where t.checkstates = 2";

            BorrowApplyMasterDAL dalBorrow = new BorrowApplyMasterDAL();
            DataTable dt = dalBorrow.GetUnRepayRdList(strSql);
            if (dt == null)
            {
                return;
            }

            gvUnRepayList.DataSource = dt;
            gvUnRepayList.DataBind();
        }
Exemplo n.º 2
0
        private void BindUnRepayRd()
        {
            string strSql = "select d.borrowapplydetailid, d.borrowapplymasterid, t.borrowapplymastercode,"
                            + " (case t.repaytype when 1 then '普通借款' when 2 then '备用金借款' when 3 then '专项借款'"
                            + " End) repaytypename, t.updatedate, s.subjectname, d.chargetype, d.usablemoney, d.borrowmoney,"
                            + " d.unrepaymoney, d.ROWID from t_fb_borrowapplydetail d inner join t_fb_borrowapplymaster t"
                            + " on d.borrowapplymasterid = t.borrowapplymasterid inner join t_fb_subject s on d.subjectid = s.subjectid "
                            + " where t.checkstates = 2";

            BorrowApplyMasterDAL dalBorrow = new BorrowApplyMasterDAL();
            DataTable            dt        = dalBorrow.GetUnRepayRdList(strSql);

            if (dt == null)
            {
                return;
            }

            gvUnRepayList.DataSource = dt;
            gvUnRepayList.DataBind();
        }
Exemplo n.º 3
0
        protected void btnUpdateUnRepayRd_Click(object sender, EventArgs e)
        {
            BorrowApplyMasterDAL dalBorrow = new BorrowApplyMasterDAL();
            RepayApplyMasterDAL dalRepay = new RepayApplyMasterDAL();
            ChargeApplyMasterDAL dalCharge = new ChargeApplyMasterDAL();

            foreach (GridViewRow row in gvUnRepayList.Rows)
            {
                string strId = Server.HtmlDecode(row.Cells[1].Text).ToString();
                string strBorrow = Server.HtmlDecode(row.Cells[6].Text).ToString();
                string strUnRepay = Server.HtmlDecode(row.Cells[7].Text).ToString();
                if (string.IsNullOrWhiteSpace(strId) || string.IsNullOrWhiteSpace(strBorrow) || string.IsNullOrWhiteSpace(strUnRepay))
                {
                    continue;
                }                

                string strSql_Repay = string.Format(string.Copy(strRepaySearch), strId);

                DataTable dtRepay = dalRepay.GetRepayRdList(strSql_Repay);
                if (dtRepay == null)
                {
                    continue;
                }                

                decimal dRepayMoney = 0;
                decimal dUpdateMoney = 0;
                decimal dBorrow = 0;
                decimal dUnRepay = 0;
                decimal.TryParse(strBorrow, out dBorrow);
                decimal.TryParse(strUnRepay, out dUnRepay);
                foreach (DataRow item in dtRepay.Rows)
                {
                    decimal dRepayTemp = 0, dChage = 0;
                    string strRepayId = string.Empty, strOrderType = string.Empty;

                    if (item["ORDERTYPE"] == null || item["REPAYMONEY"] == null || item["CHARGEMONEY"] == null)
                    {
                        continue;
                    }

                    strRepayId = item["REPAYAPPLYDETAILID"].ToString();
                    strOrderType = item["ORDERTYPE"].ToString();

                    if (strOrderType == "Repay")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                    }
                    else if (strOrderType == "Charge")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                        decimal.TryParse(item["CHARGEMONEY"].ToString(), out dChage);

                        decimal dTemp = dBorrow - dRepayMoney;
                        bool bUpdate = false;
                        if (dTemp >= dChage)
                        {
                            if (dRepayTemp < dChage)
                            {
                                dRepayTemp = dChage;
                                bUpdate = true;
                            }
                        }
                        else
                        {
                            if (dRepayTemp != dTemp)
                            {
                                dRepayTemp = dTemp;
                                bUpdate = true;
                            }
                        }

                        if (bUpdate)
                        {
                            string strUpdateChage = string.Format(string.Copy(strChageUpdate), dRepayTemp, strRepayId);
                            dalCharge.UpdateBySql(strUpdateChage);
                            Literal5.Text += "已更新的冲借款" + strRepayId + ";";
                        } 
                    }
                    dRepayMoney += dRepayTemp;
                }

                if (dRepayMoney == 0)
                {
                    Literal4.Text += "该借款" + strId + "不存在还款;";
                }

                if (dRepayMoney > dBorrow)
                {
                    dRepayMoney = dBorrow;
                    Literal4.Text += "还款超出借款" + strId + ";";
                }

                dUpdateMoney = dBorrow - dRepayMoney;
                if (dUpdateMoney == dUnRepay)
                {
                    continue;
                }
                string strUpdateBorrow = string.Format(string.Copy(strBorrowUpdate), dUpdateMoney, strId);
                dalBorrow.UpdateBySql(strUpdateBorrow);
                Literal3.Text += "已更新的借款" + strId + ";";
            }
        }
Exemplo n.º 4
0
        protected void btnUpdateUnRepayRd_Click(object sender, EventArgs e)
        {
            BorrowApplyMasterDAL dalBorrow = new BorrowApplyMasterDAL();
            RepayApplyMasterDAL  dalRepay  = new RepayApplyMasterDAL();
            ChargeApplyMasterDAL dalCharge = new ChargeApplyMasterDAL();

            foreach (GridViewRow row in gvUnRepayList.Rows)
            {
                string strId      = Server.HtmlDecode(row.Cells[1].Text).ToString();
                string strBorrow  = Server.HtmlDecode(row.Cells[6].Text).ToString();
                string strUnRepay = Server.HtmlDecode(row.Cells[7].Text).ToString();
                if (string.IsNullOrWhiteSpace(strId) || string.IsNullOrWhiteSpace(strBorrow) || string.IsNullOrWhiteSpace(strUnRepay))
                {
                    continue;
                }

                string strSql_Repay = string.Format(string.Copy(strRepaySearch), strId);

                DataTable dtRepay = dalRepay.GetRepayRdList(strSql_Repay);
                if (dtRepay == null)
                {
                    continue;
                }

                decimal dRepayMoney  = 0;
                decimal dUpdateMoney = 0;
                decimal dBorrow      = 0;
                decimal dUnRepay     = 0;
                decimal.TryParse(strBorrow, out dBorrow);
                decimal.TryParse(strUnRepay, out dUnRepay);
                foreach (DataRow item in dtRepay.Rows)
                {
                    decimal dRepayTemp = 0, dChage = 0;
                    string  strRepayId = string.Empty, strOrderType = string.Empty;

                    if (item["ORDERTYPE"] == null || item["REPAYMONEY"] == null || item["CHARGEMONEY"] == null)
                    {
                        continue;
                    }

                    strRepayId   = item["REPAYAPPLYDETAILID"].ToString();
                    strOrderType = item["ORDERTYPE"].ToString();

                    if (strOrderType == "Repay")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                    }
                    else if (strOrderType == "Charge")
                    {
                        decimal.TryParse(item["REPAYMONEY"].ToString(), out dRepayTemp);
                        decimal.TryParse(item["CHARGEMONEY"].ToString(), out dChage);

                        decimal dTemp   = dBorrow - dRepayMoney;
                        bool    bUpdate = false;
                        if (dTemp >= dChage)
                        {
                            if (dRepayTemp < dChage)
                            {
                                dRepayTemp = dChage;
                                bUpdate    = true;
                            }
                        }
                        else
                        {
                            if (dRepayTemp != dTemp)
                            {
                                dRepayTemp = dTemp;
                                bUpdate    = true;
                            }
                        }

                        if (bUpdate)
                        {
                            string strUpdateChage = string.Format(string.Copy(strChageUpdate), dRepayTemp, strRepayId);
                            dalCharge.UpdateBySql(strUpdateChage);
                            Literal5.Text += "已更新的冲借款" + strRepayId + ";";
                        }
                    }
                    dRepayMoney += dRepayTemp;
                }

                if (dRepayMoney == 0)
                {
                    Literal4.Text += "该借款" + strId + "不存在还款;";
                }

                if (dRepayMoney > dBorrow)
                {
                    dRepayMoney    = dBorrow;
                    Literal4.Text += "还款超出借款" + strId + ";";
                }

                dUpdateMoney = dBorrow - dRepayMoney;
                if (dUpdateMoney == dUnRepay)
                {
                    continue;
                }
                string strUpdateBorrow = string.Format(string.Copy(strBorrowUpdate), dUpdateMoney, strId);
                dalBorrow.UpdateBySql(strUpdateBorrow);
                Literal3.Text += "已更新的借款" + strId + ";";
            }
        }