Пример #1
0
        public string GetTransferPurposes(PrePayData data)
        {
            string value = string.Empty;

            try
            {
                if (data.OPPPRIVATEFLAG == 1)
                {
                    //结果集有两种单据以上就填写费用,如果只有单独一个
                    var list = data.DetailedData.Select(c => c.BILLTYPE).Distinct().ToList();
                    if (list.Count > 1)
                    {
                        value = "费用";
                    }
                    else
                    {
                        value = list[0];
                    }
                }
                else if (data.OPPPRIVATEFLAG == 2)
                {
                    //对公付款要查询相应单据
                    string sql = "select a.TRANSACTIONDATE,case when a.shopcode is null then a.boot_DP_name else c.name end name,b.account_name  from  FEE_NOTICEBILL a  left join  FEE_NOTICEBILL_ITEMS b on a.id=b.PID  left join shop c on a.shopcode=c.code where a.billno='" + data.DetailedData[0].BILLNO + "'";

                    OracleHelper _oraDal = new OracleHelper();

                    var dt = _oraDal.ExecuteQuery(sql);

                    if (dt.Rows.Count > 0)
                    {
                        value = Convert.ToDateTime(dt.Rows[0][0]).Month + dt.Rows[0][1].ToString() + dt.Rows[0][2].ToString().Replace('-', ' ').Trim();

                        int StrLength = GetLength(value);
                        if (StrLength > 32)
                        {
                            value = value.Remove(16);
                        }
                    }
                }
                else
                {
                    //外汇暂时不处理
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(value);
        }
Пример #2
0
        /// <summary>
        /// 获取费用数据
        /// </summary>
        /// <param name="Time">时间</param>
        /// <param name="Type">类型</param>
        /// <param name="PayCode">付款公司代码</param>
        /// <param name="City">城市</param>
        /// <param name="BillType">单据类型</param>
        /// <param name="PayCompanyCode">付款公司代码()</param>
        /// <param name="TradeType">对公对私标识</param>
        /// <returns></returns>
        public ActionResult GetIndexData(DateTime Time, string Type, string PayCode = "1", string City = "", string BillType = "", string PayCompanyCode = "", string TradeType = "")
        {
            IGetFeeData _IGetFeeData = new GetFeeData();

            List <ReturnFeeData> Model;

            Model = _IGetFeeData.GetFeeShowData(Time, PayCompanyCode, TradeType);

            Model = Model.Where(c => c.AMOUNTMONEY > 0).ToList();  //只显示大于0的数据

            DataTable dt = new DataTable();

            switch (Type.ToLower())
            {
            case "prepay":

                List <PrePayData> PrePay = new List <PrePayData>();

                #region  付款状态属于未推送的才能付款
                var PreModel = Model.Where(c => c.PAYSTATUS == 0 && string.IsNullOrEmpty(c.PREPAIDBANKNUMBER) && !string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK) && c.BILLTYPE != "付款通知书").ToList();

                if (!string.IsNullOrEmpty(PayCode) && string.IsNullOrEmpty(City) && string.IsNullOrEmpty(BillType))
                {
                    var PreModel2 = PreModel.GroupBy(c => new { c.PAYCOMPANYCODE, c.ACCOUNTUSERNAME }).ToList();

                    foreach (var item in PreModel2)
                    {
                        PrePayData pay = new PrePayData();
                        pay.TradeType         = "103";
                        pay.PREPAIDBANKNUMBER = MultiBank.Extention.IdHelper.CreateGuid();
                        pay.PAYCOMPANYCODE    = item.Key.PAYCOMPANYCODE;
                        pay.OPPPRIVATEFLAG    = 1;
                        pay.ACCOUNTUSERNAME   = item.Key.ACCOUNTUSERNAME;
                        pay.TotalMoney        = item.Sum(c => c.AMOUNTMONEY);

                        pay.DetailedData = item.ToList();
                        pay.CompleteTime = item.Min(c => c.SETTINGTIME);
                        PrePay.Add(pay);
                    }
                }
                else if (!string.IsNullOrEmpty(PayCode) && !string.IsNullOrEmpty(City) && string.IsNullOrEmpty(BillType))
                {
                    var PreModel2 = PreModel.GroupBy(c => new { c.PAYCOMPANYCODE, c.ACCOUNTUSERNAME, c.CITY }).ToList();

                    foreach (var item in PreModel2)
                    {
                        PrePayData pay = new PrePayData();
                        pay.TradeType         = "103";
                        pay.PREPAIDBANKNUMBER = MultiBank.Extention.IdHelper.CreateGuid();
                        pay.PAYCOMPANYCODE    = item.Key.PAYCOMPANYCODE;
                        pay.OPPPRIVATEFLAG    = 1;
                        pay.ACCOUNTUSERNAME   = item.Key.ACCOUNTUSERNAME;
                        pay.TotalMoney        = item.Sum(c => c.AMOUNTMONEY);
                        pay.CITY = item.Key.CITY;

                        pay.DetailedData = item.ToList();
                        pay.CompleteTime = item.Min(c => c.SETTINGTIME);
                        PrePay.Add(pay);
                    }
                }
                else if (!string.IsNullOrEmpty(PayCode) && string.IsNullOrEmpty(City) && !string.IsNullOrEmpty(BillType))
                {
                    var PreModel2 = PreModel.GroupBy(c => new { c.PAYCOMPANYCODE, c.ACCOUNTUSERNAME, c.BILLTYPE }).ToList();

                    foreach (var item in PreModel2)
                    {
                        PrePayData pay = new PrePayData();
                        pay.TradeType         = "103";
                        pay.PREPAIDBANKNUMBER = MultiBank.Extention.IdHelper.CreateGuid();
                        pay.PAYCOMPANYCODE    = item.Key.PAYCOMPANYCODE;
                        pay.OPPPRIVATEFLAG    = 1;
                        pay.ACCOUNTUSERNAME   = item.Key.ACCOUNTUSERNAME;
                        pay.TotalMoney        = item.Sum(c => c.AMOUNTMONEY);
                        pay.BILLTYPE          = item.Key.BILLTYPE;

                        pay.DetailedData = item.ToList();
                        pay.CompleteTime = item.Min(c => c.SETTINGTIME);
                        PrePay.Add(pay);
                    }
                }
                else
                {
                    var PreModel2 = PreModel.GroupBy(c => new { c.PAYCOMPANYCODE, c.ACCOUNTUSERNAME, c.BILLTYPE, c.CITY }).ToList();

                    foreach (var item in PreModel2)
                    {
                        PrePayData pay = new PrePayData();
                        pay.TradeType         = "103";
                        pay.PREPAIDBANKNUMBER = MultiBank.Extention.IdHelper.CreateGuid();
                        pay.PAYCOMPANYCODE    = item.Key.PAYCOMPANYCODE;
                        pay.OPPPRIVATEFLAG    = 1;
                        pay.ACCOUNTUSERNAME   = item.Key.ACCOUNTUSERNAME;
                        pay.TotalMoney        = item.Sum(c => c.AMOUNTMONEY);
                        pay.CITY     = item.Key.CITY;
                        pay.BILLTYPE = item.Key.BILLTYPE;

                        pay.DetailedData = item.ToList();
                        pay.CompleteTime = item.Min(c => c.SETTINGTIME);
                        PrePay.Add(pay);
                    }
                }

                //这里处理付款通知书
                var PreModel3 = Model.Where(c => c.PAYSTATUS == 0 && string.IsNullOrEmpty(c.PREPAIDBANKNUMBER) && !string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK) && c.BILLTYPE == "付款通知书").ToList();

                foreach (var item in PreModel3)
                {
                    PrePayData pay = new PrePayData();

                    var Istrue = _IGetFeeData.IsBelongInternalTransfer(item.BILLNO);
                    if (Istrue)
                    {
                        //获取付款公司名称
                        var PayName = GetCompanyName(item.PAYCOMPANYCODE);
                        //需付款公司代码一致且付款名称相同才是组织间
                        if (item.COMPANYCODE == item.PAYCOMPANYCODE && PayName == item.ACCOUNTUSERNAME)
                        {
                            pay.TradeType = "1008";
                        }
                        else
                        {
                            pay.TradeType = "104";
                        }
                    }
                    else
                    {
                        pay.TradeType = "103";
                    }

                    pay.PREPAIDBANKNUMBER = MultiBank.Extention.IdHelper.CreateGuid();
                    pay.PAYCOMPANYCODE    = item.PAYCOMPANYCODE;
                    pay.OPPPRIVATEFLAG    = item.OPPPRIVATEFLAG;
                    pay.ACCOUNTUSERNAME   = item.ACCOUNTUSERNAME;
                    pay.TotalMoney        = item.AMOUNTMONEY;
                    pay.CITY         = item.CITY;
                    pay.BILLTYPE     = item.BILLTYPE;
                    pay.CompleteTime = item.SETTINGTIME;
                    pay.DetailedData = new List <ReturnFeeData>()
                    {
                        item
                    };

                    PrePay.Add(pay);
                }

                #endregion

                //删选掉不需要付款的单据
                PrePay = PrePay.Where(c => c.TotalMoney > 0).ToList();

                //按照办结日期进行降序排列
                PrePay = PrePay.OrderByDescending(c => c.CompleteTime).ToList();

                this.KeepCache(this.CurrentSession.UserName, PrePay);

                dt = ConvertToDataTable(PrePay, null, "prepay");

                this.KeepCache(this.CurrentSession.UserName + "V1", dt);

                break;

            case "original":
                dt = ConvertToDataTable(null, Model, "original");

                this.KeepCache(this.CurrentSession.UserName, dt);
                break;

            case "invalid":

                var invalid = Model.Where(c => string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK)).ToList();
                dt = ConvertToDataTable(null, invalid, "original");

                this.KeepCache(this.CurrentSession.UserName, dt);
                break;

            case "notpush":

                var notPush = Model.Where(c => c.PAYSTATUS == 0 && string.IsNullOrEmpty(c.PREPAIDBANKNUMBER) && !string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK)).ToList();

                dt = ConvertToDataTable(null, notPush, "notpush");

                this.KeepCache(this.CurrentSession.UserName, dt);
                break;

            case "nopay":

                var noPay = Model.Where(c => c.PAYSTATUS != 0 && c.PAYSTATUS != 2 && !string.IsNullOrEmpty(c.PREPAIDBANKNUMBER) && !string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK) && c.DEALSTATE == 2).ToList();

                dt = ConvertToDataTable(null, noPay, "nopay");

                this.KeepCache(this.CurrentSession.UserName, dt);
                break;

            case "successpay":

                var successPay = Model.Where(c => c.PAYSTATUS == 2 && !string.IsNullOrEmpty(c.PREPAIDBANKNUMBER) && !string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK) && c.DEALSTATE == 2).ToList();

                dt = ConvertToDataTable(null, successPay, "successpay");

                this.KeepCache(this.CurrentSession.UserName, dt);
                break;

            case "fail":

                var fail = Model.Where(c => c.PAYSTATUS != 0 && !string.IsNullOrEmpty(c.PREPAIDBANKNUMBER) && !string.IsNullOrEmpty(c.ACCOUNTSUBBRANCHBANK) && c.DEALSTATE == 3).ToList();

                dt = ConvertToDataTable(null, fail, "fail");

                this.KeepCache(this.CurrentSession.UserName, dt);

                break;

            default:
                break;
            }
            return(this.SuccessData(dt));
        }