Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                VerificationUtility ver = new VerificationUtility();
                ver.JudgeOperate(this.Page, 52, new List<OperateEnum>() { OperateEnum.录入 });

                string redirectUrl = "PayApplyList.aspx";

                this.navigation1.Routes.Add("付款申请列表", redirectUrl);
                this.navigation1.Routes.Add("付款申请合约列表", "PayApplyContractList.aspx");
                this.navigation1.Routes.Add("付款申请新增", string.Empty);

                int subId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out subId))
                    Response.Redirect(redirectUrl);

                UserModel user = UserUtility.CurrentUser;
                this.curUser = user;

                //子合约
                ContractSubBLL subBll = new ContractSubBLL();
                ResultModel result = subBll.Get(user, subId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                ContractSub sub = result.ReturnValue as ContractSub;
                if (sub == null || sub.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;

                //合约
                ContractBLL bll = new ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;

                //局域变量赋值
                this.PayMatterStyle = (int)StyleEnum.付款事项;
                this.PayModeStyle = (int)StyleEnum.PayMode;

                PayApplyBLL payApplyBLL = new PayApplyBLL();
                result = payApplyBLL.GetContractBalancePayment(user, sub.SubId, 0);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                BalancePaymentValue = (decimal)result.ReturnValue;
            }
        }
Beispiel #2
0
        public ResultModel ContractOutCreate(NFMT.Common.UserModel user, Contract.Model.Contract contract, Model.ContractDetail contractDetail, Model.ContractPrice contractPrice, List<Model.ContractCorporationDetail> outCorps, List<Model.ContractCorporationDetail> inCorps, List<Model.ContractDept> depts, List<NFMT.Contract.Model.ContractClause> contractClauses, Model.ContractSub sub, List<Model.ContractTypeDetail> contractTypes)
        {
            ResultModel result = new ResultModel();

            try
            {
                BLL.ContractSubBLL subBLL = new ContractSubBLL();

                //新增主合约
                contract.CreateFrom = (int)NFMT.Common.CreateFromEnum.销售合约库存创建;
                result = this.Create(user, contract, contractDetail, contractPrice, outCorps, inCorps, depts, contractClauses, contractTypes);

                if (result.ResultStatus != 0)
                    return result;

                Model.Contract resultContract = result.ReturnValue as Model.Contract;
                if (resultContract == null || resultContract.ContractId <= 0)
                {
                    result.ResultStatus = -1;
                    result.Message = "新增主合约失败";
                    return result;
                }

                //新增子合约
                sub.AssetId = resultContract.AssetId;
                sub.ContractDate = resultContract.ContractDate;
                sub.ContractId = resultContract.ContractId;
                sub.ContractLimit = resultContract.ContractLimit;
                sub.ContractSide = resultContract.ContractSide;
                sub.CreateFrom = resultContract.CreateFrom;
                sub.DeliveryDate = resultContract.DeliveryDate;
                sub.DeliveryStyle = resultContract.DeliveryStyle;
                sub.InitQP = resultContract.InitQP;
                sub.Memo = resultContract.Memo;
                sub.OutContractNo = resultContract.OutContractNo;
                sub.Premium = resultContract.Premium;
                sub.PriceMode = resultContract.PriceMode;
                sub.SettleCurrency = resultContract.SettleCurrency;
                sub.SubStatus = StatusEnum.已录入;
                sub.TradeBorder = resultContract.TradeBorder;
                sub.TradeDirection = resultContract.TradeDirection;
                sub.UnitId = resultContract.UnitId;

                //子合约明细
                Model.SubDetail detail = new SubDetail();
                detail.DelayRate = contractDetail.DelayRate;
                detail.DelayType = contractDetail.DelayType;
                detail.DiscountBase = contractDetail.DiscountBase;
                detail.DiscountRate = contractDetail.DiscountRate;
                detail.DiscountType = contractDetail.DiscountType;
                detail.MoreOrLess = contractDetail.MoreOrLess;
                detail.Status = StatusEnum.已生效;

                //子合约价格明细
                Model.SubPrice price = new SubPrice();
                price.DoPriceBeginDate = contractPrice.DoPriceBeginDate;
                price.DoPriceEndDate = contractPrice.DoPriceEndDate;
                price.FixedPrice = contractPrice.FixedPrice;
                price.FixedPriceMemo = contractPrice.FixedPriceMemo;
                price.IsQP = contractPrice.IsQP;
                price.MarginAmount = contractPrice.MarginAmount;
                price.MarginMemo = contractPrice.MarginMemo;
                price.MarginMode = contractPrice.MarginMode;
                price.PriceFrom = contractPrice.PriceFrom;
                price.PriceStyle1 = contractPrice.PriceStyle1;
                price.PriceStyle2 = contractPrice.PriceStyle2;
                price.Status = StatusEnum.已生效;
                price.WhoDoPrice = contractPrice.WhoDoPrice;
                price.AlmostPrice = contractPrice.AlmostPrice;

                //子合约抬头
                List<Model.SubCorporationDetail> outSubCorps = new List<SubCorporationDetail>();
                List<Model.SubCorporationDetail> inSubCorps = new List<SubCorporationDetail>();

                foreach (Model.ContractCorporationDetail corp in outCorps)
                {
                    Model.SubCorporationDetail subCorp = new SubCorporationDetail();
                    subCorp.ContractId = resultContract.ContractId;
                    subCorp.CorpId = corp.CorpId;
                    subCorp.CorpName = corp.CorpName;
                    subCorp.DetailStatus = StatusEnum.已生效;
                    subCorp.IsDefaultCorp = corp.IsDefaultCorp;
                    subCorp.IsInnerCorp = corp.IsInnerCorp;

                    outSubCorps.Add(subCorp);
                }

                foreach (Model.ContractCorporationDetail corp in inCorps)
                {
                    Model.SubCorporationDetail subCorp = new SubCorporationDetail();
                    subCorp.ContractId = resultContract.ContractId;
                    subCorp.CorpId = corp.CorpId;
                    subCorp.CorpName = corp.CorpName;
                    subCorp.DetailStatus = StatusEnum.已生效;
                    subCorp.IsDefaultCorp = corp.IsDefaultCorp;
                    subCorp.IsInnerCorp = corp.IsInnerCorp;

                    inSubCorps.Add(subCorp);
                }

                //子合约类型明细
                List<Model.SubTypeDetail> subTypes = new List<SubTypeDetail>();
                foreach (Model.ContractTypeDetail contractType in contractTypes)
                {
                    Model.SubTypeDetail subType = new SubTypeDetail();
                    subType.ContractId = resultContract.ContractId;
                    subType.ContractType = contractType.ContractType;
                    subType.DetailStatus = StatusEnum.已生效;

                    subTypes.Add(subType);
                }

                result = subBLL.Create(user, sub, detail, price, outSubCorps, inSubCorps, subTypes);
                if (result.ResultStatus != 0)
                    return result;

                Model.ContractSub resultSub = result.ReturnValue as Model.ContractSub;
                if (resultSub == null || resultSub.SubId <= 0)
                {
                    result.ResultStatus = -1;
                    result.Message = "新增子合约失败";
                    return result;
                }

                result.ReturnValue = resultContract;
                result.AffectCount = resultSub.SubId;
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
Beispiel #3
0
        public ResultModel ContractInUpdate(NFMT.Common.UserModel user, Contract.Model.Contract contract, Model.ContractDetail contractDetail, Model.ContractPrice contractPrice, List<Model.ContractCorporationDetail> outCorps, List<Model.ContractCorporationDetail> inCorps, List<Model.ContractDept> depts, List<NFMT.Contract.Model.ContractClause> contractClauses, Model.ContractSub sub, List<Model.ContractTypeDetail> contractTypes)
        {
            ResultModel result = new ResultModel();

            try
            {
                if (contract == null)
                {
                    result.ResultStatus = -1;
                    result.Message = "合约不存在";
                    return result;
                }

                BLL.ContractSubBLL subBLL = new ContractSubBLL();

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    result = this.Update(user, contract, contractDetail, contractPrice, outCorps, inCorps, depts, contractClauses, contractTypes);

                    //子合约
                    sub.ContractId = contract.ContractId;
                    sub.AssetId = contract.AssetId;
                    sub.ContractDate = contract.ContractDate;
                    sub.ContractId = contract.ContractId;
                    sub.ContractLimit = contract.ContractLimit;
                    sub.ContractSide = contract.ContractSide;
                    sub.DeliveryDate = contract.DeliveryDate;
                    sub.DeliveryStyle = contract.DeliveryStyle;
                    sub.InitQP = contract.InitQP;
                    sub.Memo = contract.Memo;
                    sub.OutContractNo = contract.OutContractNo;
                    sub.Premium = contract.Premium;
                    sub.PriceMode = contract.PriceMode;
                    sub.SettleCurrency = contract.SettleCurrency;
                    sub.TradeBorder = contract.TradeBorder;
                    sub.TradeDirection = contract.TradeDirection;
                    sub.UnitId = contract.UnitId;

                    //子合约明细
                    Model.SubDetail detail = new SubDetail();
                    detail.DelayRate = contractDetail.DelayRate;
                    detail.DelayType = contractDetail.DelayType;
                    detail.DiscountBase = contractDetail.DiscountBase;
                    detail.DiscountRate = contractDetail.DiscountRate;
                    detail.DiscountType = contractDetail.DiscountType;
                    detail.MoreOrLess = contractDetail.MoreOrLess;
                    detail.Status = StatusEnum.已生效;

                    //子合约价格明细
                    Model.SubPrice price = new SubPrice();
                    price.DoPriceBeginDate = contractPrice.DoPriceBeginDate;
                    price.DoPriceEndDate = contractPrice.DoPriceEndDate;
                    price.FixedPrice = contractPrice.FixedPrice;
                    price.FixedPriceMemo = contractPrice.FixedPriceMemo;
                    price.IsQP = contractPrice.IsQP;
                    price.MarginAmount = contractPrice.MarginAmount;
                    price.MarginMemo = contractPrice.MarginMemo;
                    price.MarginMode = contractPrice.MarginMode;
                    price.PriceFrom = contractPrice.PriceFrom;
                    price.PriceStyle1 = contractPrice.PriceStyle1;
                    price.PriceStyle2 = contractPrice.PriceStyle2;
                    price.Status = StatusEnum.已生效;
                    price.WhoDoPrice = contractPrice.WhoDoPrice;
                    price.AlmostPrice = contractPrice.AlmostPrice;

                    //子合约抬头
                    List<Model.SubCorporationDetail> outSubCorps = new List<SubCorporationDetail>();
                    List<Model.SubCorporationDetail> inSubCorps = new List<SubCorporationDetail>();

                    foreach (Model.ContractCorporationDetail corp in outCorps)
                    {
                        Model.SubCorporationDetail subCorp = new SubCorporationDetail();
                        subCorp.ContractId = contract.ContractId;
                        subCorp.CorpId = corp.CorpId;
                        subCorp.CorpName = corp.CorpName;
                        subCorp.DetailStatus = StatusEnum.已生效;
                        subCorp.IsDefaultCorp = corp.IsDefaultCorp;
                        subCorp.IsInnerCorp = corp.IsInnerCorp;

                        outSubCorps.Add(subCorp);
                    }

                    foreach (Model.ContractCorporationDetail corp in inCorps)
                    {
                        Model.SubCorporationDetail subCorp = new SubCorporationDetail();
                        subCorp.ContractId = contract.ContractId;
                        subCorp.CorpId = corp.CorpId;
                        subCorp.CorpName = corp.CorpName;
                        subCorp.DetailStatus = StatusEnum.已生效;
                        subCorp.IsDefaultCorp = corp.IsDefaultCorp;
                        subCorp.IsInnerCorp = corp.IsInnerCorp;

                        inSubCorps.Add(subCorp);
                    }

                    //子合约类型明细
                    List<Model.SubTypeDetail> subTypes = new List<SubTypeDetail>();
                    foreach (Model.ContractTypeDetail contractType in contractTypes)
                    {
                        Model.SubTypeDetail subType = new SubTypeDetail();
                        subType.ContractId = contract.ContractId;
                        subType.ContractType = contractType.ContractType;
                        subType.DetailStatus = StatusEnum.已生效;

                        subTypes.Add(subType);
                    }

                    result = subBLL.Update(user, sub, detail, price, outSubCorps, inSubCorps, subTypes);

                    scope.Complete();
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            return result;
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            VerificationUtility ver = new VerificationUtility();
            ver.JudgeOperate(this.Page, 52, new List<OperateEnum>() { OperateEnum.修改 });

            if (!IsPostBack)
            {
                UserModel user = UserUtility.CurrentUser;
                this.curUser = user;

                this.PayMatterStyle = (int)StyleEnum.付款事项;
                this.PayModeStyle = (int)StyleEnum.PayMode;

                string redirectUrl = "PayApplyList.aspx";

                this.navigation1.Routes.Add("付款申请列表", redirectUrl);
                this.navigation1.Routes.Add("付款申请明细", string.Empty);

                int applyId = 0, payApplyId = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["aid"]))
                    int.TryParse(Request.QueryString["aid"], out applyId);
                if (applyId <= 0 && (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out payApplyId)))
                    this.WarmAlert("付款申请序号错误", redirectUrl);

                ResultModel result = new ResultModel();

                //获取付款申请
                PayApplyBLL payApplyBLL = new PayApplyBLL();
                if (applyId > 0)
                    result = payApplyBLL.GetByApplyId(user, applyId);
                else
                    result = payApplyBLL.Get(user, payApplyId);

                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款申请失败", redirectUrl);

                PayApply payApply = result.ReturnValue as PayApply;
                if (payApply == null || payApply.PayApplyId <= 0)
                    this.WarmAlert("获取付款申请失败", redirectUrl);

                this.curPayApply = payApply;

                //获取主申请
                ApplyBLL applyBLL = new ApplyBLL();
                result = applyBLL.Get(user, payApply.ApplyId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取主申请失败", redirectUrl);

                Apply apply = result.ReturnValue as Apply;
                if (apply == null || apply.ApplyId <= 0)
                    this.WarmAlert("获取主申请失败", redirectUrl);

                this.curApply = apply;

                //获取合约付款申请
                ContractPayApplyBLL contractPayApplyBLL = new ContractPayApplyBLL();
                result = contractPayApplyBLL.GetByPayApplyId(user, payApply.PayApplyId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                ContractPayApply contractPayApply = result.ReturnValue as ContractPayApply;
                if (contractPayApply == null || contractPayApply.RefId <= 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                //获取子合约
                ContractSubBLL subBll = new ContractSubBLL();
                result = subBll.Get(user, contractPayApply.ContractSubId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取子合约失败", redirectUrl);
                ContractSub sub = result.ReturnValue as ContractSub;
                if (sub == null || sub.ContractId == 0)
                    this.WarmAlert("获取子合约失败", redirectUrl);

                this.curSub = sub;

                //合约
                ContractBLL bll = new ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId == 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;

                SelectModel select = payApplyBLL.GetPayApplyStocksSelect(1, 100, "spa.RefId desc", payApply.PayApplyId);
                result = payApplyBLL.Load(user, select, DefaultValue.ClearAuth);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款库存列表失败", redirectUrl);

                DataTable dt = result.ReturnValue as DataTable;
                if (dt == null)
                    this.WarmAlert("获取付款库存列表失败", redirectUrl);

                this.StockDetailsJson = JsonConvert.SerializeObject(dt, new DataTableConverter());

                //付款明细
                PaymentBLL paymentBLL = new PaymentBLL();
                select = paymentBLL.GetSelectModel(1, 100, "pay.PaymentId desc", DefaultValue.DefaultTime, DefaultValue.DefaultTime, 0, 0, (int)StatusEnum.已生效, payApply.PayApplyId);
                result = paymentBLL.Load(user, select, DefaultValue.ClearAuth);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款明细失败", redirectUrl);

                dt = result.ReturnValue as DataTable;
                if (dt == null)
                    this.WarmAlert("获取付款明细失败", redirectUrl);
                this.PaymentJson = JsonConvert.SerializeObject(dt, new DataTableConverter());

                //审核实体
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string json = serializer.Serialize(apply);
                this.hidModel.Value = json;

                FundsStyleEnum fundsStyle = (FundsStyleEnum)payApply.PayApplySource;
                result = payApplyBLL.GetAuditInfo(user, payApply.ApplyId, fundsStyle);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款申请审核信息失败", redirectUrl);

                //this.txbAuditInfo.InnerHtml = result.ReturnValue.ToString();

                if (apply.ApplyStatus != StatusEnum.已录入 && apply.ApplyStatus != StatusEnum.待审核 && apply.ApplyStatus != StatusEnum.审核拒绝
                    && apply.ApplyStatus != StatusEnum.已撤返)
                {
                    //this.jqxAuditInfoExpander.Visible = false;
                }
                else if (apply.ApplyStatus == StatusEnum.已生效 || apply.ApplyStatus == StatusEnum.已完成)
                {

                }
            }
        }