public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int subId = 0;
            if (string.IsNullOrEmpty(context.Request.Form["subId"]) || !int.TryParse(context.Request.Form["subId"], out subId) || subId <= 0)
            {
                context.Response.Write("子合约信息错误");
                context.Response.End();
            }

            NFMT.Contract.BLL.ContractSubBLL bll = new NFMT.Contract.BLL.ContractSubBLL();
            NFMT.Common.ResultModel result = bll.GetContractOutCorp(user, subId);
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

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

            string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
            context.Response.Write(jsonStr);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.VerificationUtility ver = new Utility.VerificationUtility();
            ver.JudgeOperate(this.Page, 57, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

            string redirectUrl = string.Format("{0}Funds/ContractReceivableReadyContractList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                this.navigation1.Routes.Add("合约收款分配", string.Format("{0}Funds/ContractReceivableList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("可收款分配合约列表", redirectUrl);
                this.navigation1.Routes.Add("合约收款分配新增", string.Empty);

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

                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = contractSubBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;

                this.spnSubNo.InnerText = sub.SubNo;
                NFMT.Data.Model.MeasureUnit measureUnit = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(a => a.MUId == sub.UnitId);
                if (measureUnit != null)
                    this.spnSubSignAmount.InnerText = sub.SignAmount.ToString() + measureUnit.MUName;
                this.spnPeriodE.InnerText = sub.ContractPeriodE.ToShortDateString();

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

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

                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                if (dt == null || dt.Rows.Count == 0)
                    Response.Redirect(redirectUrl);

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

            }
        }
        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();
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 57, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

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

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

                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                //获取分配
                int allotId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out allotId) || allotId <= 0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.BLL.CashInAllotBLL cashInAllotBLL = new NFMT.Funds.BLL.CashInAllotBLL();
                result = cashInAllotBLL.Get(user, allotId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.Model.CashInAllot cashInAllot = result.ReturnValue as NFMT.Funds.Model.CashInAllot;
                if (cashInAllot == null || cashInAllot.AllotId <= 0)
                    Response.Redirect(redirectUrl);

                this.curCashInAllot = cashInAllot;

                //获取合约分配明细
                NFMT.Funds.BLL.CashInContractBLL cashInContractBLL = new NFMT.Funds.BLL.CashInContractBLL();
                result = cashInContractBLL.GetByAllot(user, allotId, NFMT.Common.StatusEnum.已生效);
                if(result.ResultStatus!=0)
                    Response.Redirect(redirectUrl);

                NFMT.Funds.Model.CashInContract cashInContract = result.ReturnValue as NFMT.Funds.Model.CashInContract;
                if (cashInContract == null || cashInContract.RefId == 0)
                    Response.Redirect(redirectUrl);

                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, cashInContract.SubContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;

                //获取合约
                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.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);

                #region 赋值
                //合约信息
                this.spnContractNo.InnerHtml = contract.ContractNo;
                this.spnAsset.InnerHtml = NFMT.Data.BasicDataProvider.Assets.First(temp => temp.AssetId == contract.AssetId).AssetName;
                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                this.spnSignAmount.InnerHtml = string.Format("{0}{1}", contract.SignAmount.ToString(), muContract.MUName);

                //合约抬头
                NFMT.Contract.BLL.ContractCorporationDetailBLL ccdBll = new NFMT.Contract.BLL.ContractCorporationDetailBLL();

                //内部公司
                result = ccdBll.LoadCorpListByContractId(user, sub.ContractId, true);
                List<NFMT.Contract.Model.ContractCorporationDetail> innerCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;

                foreach (NFMT.Contract.Model.ContractCorporationDetail innerCorp in innerCorps)
                {
                    this.spnInCorpNames.InnerHtml += string.Format("[{0}]  ", innerCorp.CorpName);
                }

                //外部公司
                result = ccdBll.LoadCorpListByContractId(user, sub.ContractId, false);
                List<NFMT.Contract.Model.ContractCorporationDetail> outCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                foreach (NFMT.Contract.Model.ContractCorporationDetail outCorp in outCorps)
                {
                    this.spnOutCorpNames.InnerHtml += string.Format("[{0}]  ", outCorp.CorpName);
                }

                //子合约信息
                this.spnSubNo.InnerHtml = sub.SubNo;

                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(temp => temp.MUId == sub.UnitId);
                if (muSub != null && muSub.MUId > 0)
                    this.spnSubSignAmount.InnerHtml = string.Format("{0}{1}", sub.SignAmount.ToString(), muSub.MUName);
                this.spnPeriodE.InnerHtml = sub.ContractPeriodE.ToShortDateString();

                #endregion

                result = subBLL.GetContractOutCorp(user, sub.SubId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                if (dt == null || dt.Rows.Count == 0)
                    Response.Redirect(redirectUrl);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    System.Data.DataRow dr = dt.Rows[i];

                    if (dr["CorpId"] != DBNull.Value)
                    {
                        if (i != 0)
                            this.curOutCorpIds += ",";

                        this.curOutCorpIds += dr["CorpId"].ToString();
                    }
                }

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

                NFMT.Funds.BLL.CashInContractBLL bll = new NFMT.Funds.BLL.CashInContractBLL();
                NFMT.Common.SelectModel select = bll.GetCurDetailsSelect(1, 100, "cicr.RefId desc", sub.SubId,NFMT.Common.StatusEnum.已生效);
                result = bll.Load(user, select);

                int totalRows = result.AffectCount;
                dt = result.ReturnValue as System.Data.DataTable;

                this.JsonCorpSelect = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

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

                string redirectUrl = "CashInAllotList.aspx";
                this.navigation1.Routes.Add("收款分配列表", redirectUrl);
                this.navigation1.Routes.Add("合约收款分配新增", string.Empty);

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

                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;

                //获取合约
                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.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);

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

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

                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                if (dt == null || dt.Rows.Count == 0)
                    Response.Redirect(redirectUrl);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    System.Data.DataRow dr = dt.Rows[i];

                    if (dr["CorpId"] != DBNull.Value)
                    {
                        if (i != 0)
                            this.curOutCorpIds += ",";

                        this.curOutCorpIds += dr["CorpId"].ToString();
                    }
                }
                this.JsonOutCorp = Newtonsoft.Json.JsonConvert.SerializeObject(result.ReturnValue);

                //拼接合约库存
                NFMT.WareHouse.BLL.StockLogBLL stockLogBLL = new NFMT.WareHouse.BLL.StockLogBLL();
                NFMT.Common.SelectModel select = stockLogBLL.GetLogListBySubSelect(1, 100, "sl.StockLogId desc", sub.SubId);
                result = stockLogBLL.Load(user, select);

                dt = result.ReturnValue as System.Data.DataTable;
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append("[");
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        System.Data.DataRow dr = dt.Rows[i];

                        if (i != 0)
                            sb.Append(",");

                        string refNo = dr["RefNo"].ToString();
                        int stockLogId = 0;
                        decimal stockLogGrossWeight = 0;
                        decimal stockLogNetWeight = 0;
                        int.TryParse(dr["StockLogId"].ToString(), out stockLogId);
                        decimal.TryParse(dr["GrossAmount"].ToString(), out stockLogGrossWeight);
                        decimal.TryParse(dr["NetAmount"].ToString(),out stockLogNetWeight);
                        string muName = dr["MUName"].ToString();
                        string assetName = dr["AssetName"].ToString();
                        string brandName = dr["BrandName"].ToString();

                        sb.Append("{ Html: \"<div style='padding: 1px;'>");
                        sb.AppendFormat("<div>{0}</div>", refNo);
                        sb.AppendFormat("<div>毛重: {0}{1}</div>", stockLogGrossWeight, muName);
                        sb.AppendFormat("<div>净重: {0}{1}</div>", stockLogNetWeight, muName);
                        sb.AppendFormat("<div>品种: {0}</div><div>品牌: {1}</div></div>\"", assetName, brandName);
                        sb.AppendFormat(", Title: \"{0}\"",refNo);
                        sb.Append(",StockLogId:");
                        sb.Append(stockLogId);
                        sb.Append("}");
                    }
                }
                sb.Append("]");

                this.JsonStock = sb.ToString();
            }
        }