protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}Funds/ContractReceivableList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 57, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.执行完成, NFMT.Common.OperateEnum.执行完成撤销 });

                this.navigation1.Routes.Add("合约收款分配", redirectUrl);
                this.navigation1.Routes.Add("合约收款分配明细", string.Empty);

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

                this.hidid.Value = receivableAllotId.ToString();

                NFMT.Funds.BLL.ReceivableAllotBLL receivableAllotBLL = new NFMT.Funds.BLL.ReceivableAllotBLL();
                NFMT.Common.ResultModel result = receivableAllotBLL.Get(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.Model.ReceivableAllot receivableAllot = result.ReturnValue as NFMT.Funds.Model.ReceivableAllot;
                if (receivableAllot != null)
                {
                    NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(a => a.CurrencyId == receivableAllot.CurrencyId);
                    if (currency != null)
                        this.spanAllotBala.InnerText = receivableAllot.AllotBala.ToString() + currency.CurrencyName;

                    this.spanAllotDesc.InnerText = receivableAllot.AllotDesc;

                    NFMT.User.Model.Employee employee = NFMT.User.UserProvider.Employees.SingleOrDefault(a => a.EmpId == receivableAllot.EmpId);
                    if (employee != null)
                        this.spanEmpId.InnerText = employee.Name;

                    this.spanAllotTime.InnerText = receivableAllot.AllotTime.ToString();

                    string json = serializer.Serialize(receivableAllot);
                    this.hidModel.Value = json;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}Funds/ReceivableStockList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            if (!IsPostBack)
            {
                this.navigation1.Routes.Add("库存收款分配", redirectUrl);
                this.navigation1.Routes.Add("库存收款分配修改", string.Empty);

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

                this.hidid.Value = receivableAllotId.ToString();

                NFMT.Funds.BLL.StcokReceivableBLL stcokReceivableBLL = new NFMT.Funds.BLL.StcokReceivableBLL();
                NFMT.Funds.BLL.ContractReceivableBLL contractReceivableBLL = new NFMT.Funds.BLL.ContractReceivableBLL();
                NFMT.Common.ResultModel result = stcokReceivableBLL.GetStockId(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                int stockId = (int)result.ReturnValue;
                this.hidStockId.Value = stockId.ToString();

                //库存信息
                NFMT.WareHouse.BLL.StockBLL stockBLL = new NFMT.WareHouse.BLL.StockBLL();
                result = stockBLL.GetStockContractOutCorp(user, stockId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                this.hidCorps.Value = Newtonsoft.Json.JsonConvert.SerializeObject(result.ReturnValue);

                result = stockBLL.Get(user, stockId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.Stock stock = result.ReturnValue as NFMT.WareHouse.Model.Stock;
                if (stock != null)
                {
                    this.hidStockNameId.Value = stock.StockNameId.ToString();

                    NFMT.WareHouse.BLL.StockNameBLL stockNameBLL = new NFMT.WareHouse.BLL.StockNameBLL();
                    result = stockNameBLL.Get(user, stock.StockNameId);
                    if (result.ResultStatus != 0)
                        Response.Redirect(redirectUrl);
                    NFMT.WareHouse.Model.StockName stockName = result.ReturnValue as NFMT.WareHouse.Model.StockName;

                    if (stockName != null)
                        this.spanRefNo.InnerText = stockName.RefNo;
                    this.spanStockDate.InnerText = stock.StockDate.ToShortDateString();

                    NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == stock.CorpId);
                    if (corp != null)
                        this.spanCorpId.InnerText = corp.CorpName;

                    NFMT.Data.Model.MeasureUnit measureUnit = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(a => a.MUId == stock.UintId);
                    if (measureUnit != null)
                        this.spanGrossAmout.InnerText = stock.GrossAmount + measureUnit.MUName;

                    NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.SingleOrDefault(a => a.AssetId == stock.AssetId);
                    if (asset != null)
                        this.spanAssetId.InnerText = asset.AssetName;

                    NFMT.Data.Model.Brand brand = NFMT.Data.BasicDataProvider.Brands.SingleOrDefault(a => a.BrandId == stock.BrandId);
                    if (brand != null)
                        this.spanBrandId.InnerText = brand.BrandName;

                    NFMT.Funds.BLL.ReceivableAllotBLL receivableAllotBLL = new NFMT.Funds.BLL.ReceivableAllotBLL();
                    result = receivableAllotBLL.GetStockAllotAmount(user, stockId);
                    if (result.ResultStatus != 0)
                        Response.Redirect(redirectUrl);

                    this.spanAllotAmount.InnerText = result.ReturnValue == null ? "" : result.ReturnValue.ToString();

                    //分配信息
                    result = receivableAllotBLL.Get(user, receivableAllotId);
                    if (result.ResultStatus != 0)
                        Response.Redirect(redirectUrl);

                    NFMT.Funds.Model.ReceivableAllot receivableAllot = result.ReturnValue as NFMT.Funds.Model.ReceivableAllot;
                    if (receivableAllot != null)
                    {
                        this.txbMemo.Value = receivableAllot.AllotDesc;
                        this.hidcurrencyId.Value = receivableAllot.CurrencyId.ToString();
                        this.hidAllotFrom.Value = receivableAllot.AllotFrom.ToString();

                        if (receivableAllot.AllotFrom == NFMT.Data.DetailProvider.Details(NFMT.Data.StyleEnum.分配来源)["Receivable"].StyleDetailId)
                        {
                            //获取收款登记相关
                            result = stcokReceivableBLL.GetReceIds(user, receivableAllotId);
                            if (result.ResultStatus != 0)
                                Response.Redirect(redirectUrl);

                            this.hidReceIds.Value = result.ReturnValue.ToString();

                            result = stcokReceivableBLL.GetRowsDetail(user, receivableAllotId);
                            if (result.ResultStatus != 0)
                                Response.Redirect(redirectUrl);

                            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

                            this.hidRowDetail.Value = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
                        }
                        else if (receivableAllot.AllotFrom == NFMT.Data.DetailProvider.Details(NFMT.Data.StyleEnum.分配来源)["CorpReceivable"].StyleDetailId)
                        {
                            //获取公司收款相关
                            result = contractReceivableBLL.GetCorpRefIds(user, receivableAllotId);
                            if (result.ResultStatus != 0)
                                Response.Redirect(redirectUrl);

                            this.hidCorpRefIds.Value = result.ReturnValue.ToString();

                            result = contractReceivableBLL.GetRowsDetailByCorp(user, receivableAllotId);
                            if (result.ResultStatus != 0)
                                Response.Redirect(redirectUrl);

                            System.Data.DataTable dtCorp = result.ReturnValue as System.Data.DataTable;

                            this.hidRowDetailCorp.Value = Newtonsoft.Json.JsonConvert.SerializeObject(dtCorp);
                        }
                        else if (receivableAllot.AllotFrom == NFMT.Data.DetailProvider.Details(NFMT.Data.StyleEnum.分配来源)["ContractReceivable"].StyleDetailId)
                        {
                            //获取合约收款相关
                            result = stcokReceivableBLL.GetReceIdsForContract(user, receivableAllotId);
                            if (result.ResultStatus != 0)
                                Response.Redirect(redirectUrl);

                            this.hidReceIdsForContract.Value = result.ReturnValue.ToString();

                            result = stcokReceivableBLL.GetRowsDetailForContract(user, receivableAllotId);
                            if (result.ResultStatus != 0)
                                Response.Redirect(redirectUrl);

                            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

                            this.hidRowDetailForContract.Value = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}Funds/ReceivableCorpList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            if (!IsPostBack)
            {
                this.navigation1.Routes.Add("公司收款分配", redirectUrl);
                this.navigation1.Routes.Add("公司收款分配修改", string.Empty);

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

                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                //获取分配
                NFMT.Funds.BLL.ReceivableAllotBLL allotBLL = new NFMT.Funds.BLL.ReceivableAllotBLL();
                result = allotBLL.Get(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.Model.ReceivableAllot recAllot = result.ReturnValue as NFMT.Funds.Model.ReceivableAllot;
                if (recAllot == null || recAllot.ReceivableAllotId <= 0)
                    Response.Redirect(redirectUrl);

                this.curRecAllot = recAllot;
                this.currencyId = recAllot.CurrencyId;

                //获取分配明细列表
                NFMT.Funds.BLL.RecAllotDetailBLL recAllotDetailBLL = new NFMT.Funds.BLL.RecAllotDetailBLL();
                result = recAllotDetailBLL.Load(user, recAllot.ReceivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                List<NFMT.Funds.Model.RecAllotDetail> details = result.ReturnValue as List<NFMT.Funds.Model.RecAllotDetail>;
                if (details == null)
                    Response.Redirect(redirectUrl);

                foreach (NFMT.Funds.Model.RecAllotDetail d in details)
                {
                    if (details.IndexOf(d) != 0)
                    {
                        this.curRids += ",";
                        this.curDids += ",";
                    }

                    this.curRids += d.RecId.ToString();
                    this.curDids += d.DetailId.ToString();
                }

                //获取分配公司明细列表
                NFMT.Funds.BLL.CorpReceivableBLL corpReceivalbleBLL = new NFMT.Funds.BLL.CorpReceivableBLL();
                result = corpReceivalbleBLL.Load(user, recAllot.ReceivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                List<NFMT.Funds.Model.CorpReceivable> corpDetails = result.ReturnValue as List<NFMT.Funds.Model.CorpReceivable>;
                if (corpDetails == null)
                    Response.Redirect(redirectUrl);

                //公司信息
                if (corpDetails.Count == 0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.Model.CorpReceivable corpDetail = corpDetails[0];
                NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.FirstOrDefault(temp => temp.CorpId == corpDetail.CorpId);
                if (corp != null && corp.CorpId > 0)
                {
                    this.spanBlocId.InnerHtml = corp.BlocName;
                    this.spanCorpCode.InnerHtml = corp.CorpCode;
                    this.spanCorpName.InnerHtml = corp.CorpName;
                    this.spanTaxPlayer.InnerHtml = corp.TaxPayerId;
                    this.spanCorpAddress.InnerHtml = corp.CorpAddress;
                    this.spanCorpTel.InnerHtml = corp.CorpTel;
                    this.spanCorpFax.InnerHtml = corp.CorpFax;
                    this.spanCorpZip.InnerHtml = corp.CorpZip;

                    this.curCorp = corp;
                }
                this.isShare = corpDetail.IsShare;

                result = corpReceivalbleBLL.GetRowsDetail(user, receivableAllotId,NFMT.Common.StatusEnum.已作废);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.curJsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt);

                string json = serializer.Serialize(recAllot);
                this.hidModel.Value = json;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}Funds/ContractReceivableList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 57, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("合约收款分配", redirectUrl);
                this.navigation1.Routes.Add("合约收款分配修改", string.Empty);

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

                this.hidid.Value = receivableAllotId.ToString();

                NFMT.Funds.BLL.ContractReceivableBLL contractReceivableBLL = new NFMT.Funds.BLL.ContractReceivableBLL();
                NFMT.Common.ResultModel result = contractReceivableBLL.GetSubId(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                int subId = (int)result.ReturnValue;
                this.hidsubId.Value = subId.ToString();

                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = contractSubBLL.GetContractOutCorp(user, subId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                this.hidCorps.Value = Newtonsoft.Json.JsonConvert.SerializeObject(result.ReturnValue);

                result = contractReceivableBLL.GetReceIds(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                this.hidReceIds.Value = result.ReturnValue.ToString();

                result = contractReceivableBLL.GetCorpRefIds(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                this.hidCorpRefIds.Value = result.ReturnValue.ToString();

                result = contractReceivableBLL.GetRowsDetail(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

                this.hidRowDetail.Value = Newtonsoft.Json.JsonConvert.SerializeObject(dt);

                result = contractReceivableBLL.GetRowsDetailByCorp(user, receivableAllotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                System.Data.DataTable dtCorp = result.ReturnValue as System.Data.DataTable;

                this.hidRowDetailCorp.Value = Newtonsoft.Json.JsonConvert.SerializeObject(dtCorp);

                result = contractSubBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                //子合约信息
                NFMT.Contract.Model.ContractSub contractSub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (contractSub != null)
                {
                    this.hidCurrucyId.Value = contractSub.SettleCurrency.ToString();
                    this.hidcontractId.Value = contractSub.ContractId.ToString();
                    this.spnSubNo.InnerText = contractSub.SubNo;
                    NFMT.Data.Model.MeasureUnit measureUnit = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(a => a.MUId == contractSub.UnitId);
                    if (measureUnit != null)
                        this.spnSubSignAmount.InnerText = contractSub.SignAmount.ToString() + measureUnit.MUName;
                    this.spnPeriodE.InnerText = contractSub.ContractPeriodE.ToShortDateString();

                    NFMT.Funds.BLL.ReceivableAllotBLL receivableAllotBLL = new NFMT.Funds.BLL.ReceivableAllotBLL();
                    result = receivableAllotBLL.GetSubContractAllotAmount(user, subId);
                    if (result.ResultStatus != 0)
                        Response.Redirect(redirectUrl);

                    this.spanAllotAmount.InnerText = result.ReturnValue == null ? "" : result.ReturnValue.ToString();

                    //分配信息
                    result = receivableAllotBLL.Get(user, receivableAllotId);
                    if (result.ResultStatus != 0)
                        Response.Redirect(redirectUrl);

                    NFMT.Funds.Model.ReceivableAllot receivableAllot = result.ReturnValue as NFMT.Funds.Model.ReceivableAllot;
                    if (receivableAllot != null)
                    {
                        this.txbMemo.Value = receivableAllot.AllotDesc;
                        this.hidAllotFrom.Value = receivableAllot.AllotFrom.ToString();
                    }
                }
            }
        }