public void ProcessRequest(HttpContext context)
        {
            int subContractId = 0;
            if (string.IsNullOrEmpty(context.Request["cid"]) || !int.TryParse(context.Request["cid"], out subContractId) || subContractId <= 0)
                subContractId = 0;

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
            NFMT.Common.ResultModel result = bll.GetContractStock(user, subContractId);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            Dictionary<string, object> dic = new Dictionary<string, object>();

            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            int status = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["s"]))
            {
                if (!int.TryParse(context.Request.QueryString["s"], out status))
                    status = 0;
            }

            int empId = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["e"]))
            {
                if (!int.TryParse(context.Request.QueryString["e"], out empId))
                    empId = 0;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
                orderStr = string.Format("{0} {1}", context.Request.QueryString["sortdatafield"].Trim(), context.Request.QueryString["sortorder"].Trim());

            NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
            NFMT.Common.SelectModel select = bll.GetAllotSelect(pageIndex, pageSize, orderStr, empId, status);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "application/json; charset=utf-8";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            System.Collections.Generic.Dictionary<string, object> dic = new System.Collections.Generic.Dictionary<string, object>();

            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);

            context.Response.Write(postData);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            int allotId = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["id"], out allotId) || allotId <= 0)
            {
                context.Response.Write("收款分配序号错误");
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                context.Response.Write("操作错误");
                context.Response.End();
            }

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

            NFMT.Funds.BLL.CashInCorpBLL bll = new NFMT.Funds.BLL.CashInCorpBLL();
            NFMT.Funds.BLL.CashInAllotBLL cashInAllotBLL = new NFMT.Funds.BLL.CashInAllotBLL();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.作废:
                    result = bll.Invalid(user, allotId);
                    break;
                case NFMT.Common.OperateEnum.撤返:
                    result = cashInAllotBLL.Goback(user, allotId);
                    break;
                case NFMT.Common.OperateEnum.执行完成:
                    result = bll.Complete(user, allotId);
                    break;
                case NFMT.Common.OperateEnum.执行完成撤销:
                    result = bll.CompleteCancel(user, allotId);
                    break;
                case NFMT.Common.OperateEnum.关闭:
                    result = bll.Close(user, allotId);
                    break;
            }

            if (result.ResultStatus == 0)
                result.Message = string.Format("{0}成功", operateEnum.ToString());

            context.Response.Write(result.Message);
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "CashInAllotMainReadyCashInList.aspx";

            if (!IsPostBack)
            {
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 122, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

                this.navigation1.Routes.Add("收款分配", "CashInAllotMainList.aspx");
                this.navigation1.Routes.Add("收款登记列表", redirectUrl);
                this.navigation1.Routes.Add("收款分配新增", string.Empty);

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

                int cashInId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out cashInId) || cashInId <= 0)
                    Utility.JsUtility.WarmAlert(this.Page, "参数错误", redirectUrl);

                //获取收款
                NFMT.Funds.BLL.CashInBLL cashInBLL = new NFMT.Funds.BLL.CashInBLL();
                result = cashInBLL.Get(user, cashInId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                cashIn = result.ReturnValue as NFMT.Funds.Model.CashIn;
                if (cashIn == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取收款出错", redirectUrl);

                //初始化
                InitCashInInfo(cashIn, redirectUrl);

                NFMT.Funds.BLL.CashInAllotBLL cashInAllotBLL = new NFMT.Funds.BLL.CashInAllotBLL();
                result = cashInAllotBLL.GetCanAllotBala(user, cashInId, false);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                CanAllotBala = (decimal)result.ReturnValue;

                NFMT.Invoice.BLL.SIBLL sIBLL = new NFMT.Invoice.BLL.SIBLL();
                result = sIBLL.GetSIIdsByCustomCorpId(user, cashIn.PayCorpId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                sIIds = result.ReturnValue != null ? result.ReturnValue.ToString() : string.Empty;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

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

            if (string.IsNullOrEmpty(context.Request.Form["source"]))
            {
                result.Message = "数据源为空";
                result.ResultStatus = -1;
                context.Response.Write(serializer.Serialize(result));
                context.Response.End();
            }

            bool isPass = false;
            if (string.IsNullOrEmpty(context.Request.Form["ispass"]) || !bool.TryParse(context.Request.Form["ispass"], out isPass))
            {
                result.Message = "审核结果错误";
                result.ResultStatus = -1;
                context.Response.Write(serializer.Serialize(result));
                context.Response.End();
            }

            try
            {
                string jsonData = context.Request.Form["source"];
                var obj = serializer.Deserialize<NFMT.WorkFlow.Model.DataSource>(jsonData);

                NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
                result = bll.Audit(user, obj, isPass);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultStatus = -1;
            }

            context.Response.Write(serializer.Serialize(result));
            context.Response.End();
        }
Esempio n. 6
0
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "CashInDate":
                        sortDataField = "ci.CashInDate";
                        break;
                    case "InCorp":
                        sortDataField = "inCorp.CorpName";
                        break;
                    case "OutCorp":
                        sortDataField = "outCorp.CorpName";
                        break;
                    case "CashInBankName":
                        sortDataField = "ban.BankName";
                        break;
                    case "CashInBala":
                        sortDataField = "ci.CashInBala";
                        break;
                    case "LastBala":
                        sortDataField = "ci.CashInBala - ISNULL(ref.SumBala,0)";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string detailIds = context.Request.QueryString["detailIds"];
            string cashInIds = context.Request.QueryString["cashInIds"];

            int currencyId = 0;
            if(string.IsNullOrEmpty(context.Request.QueryString["currencyId"]) || !int.TryParse(context.Request.QueryString["currencyId"],out currencyId))
                currencyId =0 ;

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

            NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
            NFMT.Common.SelectModel select = bll.GetCashInLastSelect(pageIndex, pageSize, orderStr, detailIds,cashInIds,currencyId,subId);

            //NFMT.Authority.CorpAuth auth = new NFMT.Authority.CorpAuth();
            //auth.AuthColumnNames.Add("ci.");
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

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

            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("count", totalRows);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string detailStr = context.Request.Form["Details"];
            if (string.IsNullOrEmpty(detailStr))
            {
                context.Response.Write("分配信息不能为空");
                context.Response.End();
            }

            string memo = context.Request.Form["Memo"];

            int corpId = 0;
            if (string.IsNullOrEmpty(context.Request.Form["CorpId"]) || !int.TryParse(context.Request.Form["CorpId"], out corpId) || corpId <= 0)
            {
                context.Response.Write("公司信息错误");
                context.Response.End();
            }

            bool isShare = false;
            if (string.IsNullOrEmpty(context.Request.Form["IsShare"]) || !bool.TryParse(context.Request.Form["IsShare"], out isShare))
            {
                context.Response.Write("是否共享信息错误");
                context.Response.End();
            }

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

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                List<NFMT.Funds.Model.CashInCorp> details = serializer.Deserialize<List<NFMT.Funds.Model.CashInCorp>>(detailStr);
                if (details == null)
                {
                    context.Response.Write("分配信息错误");
                    context.Response.End();
                }

                NFMT.Funds.Model.CashInAllot allot = new NFMT.Funds.Model.CashInAllot();
                allot.AllotDesc = memo;
                allot.AllotStatus = NFMT.Common.StatusEnum.已录入;

                foreach (NFMT.Funds.Model.CashInCorp corp in details)
                {
                    corp.CorpId = corpId;
                    corp.IsShare = isShare;
                }
                NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
                result = bll.CreateCorp(user, allot, details);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
            }

            if (result.ResultStatus == 0)
                result.Message = "分配成功";

            context.Response.Write(result.Message);
            context.Response.End();
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = "CashInAllotList.aspx";
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

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

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

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

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

                //获取收款分配
                NFMT.Funds.BLL.CashInAllotBLL allotBLL = new NFMT.Funds.BLL.CashInAllotBLL();
                result = allotBLL.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.curAllot = cashInAllot;

                 //获取公司关联列表
                NFMT.Funds.BLL.CashInCorpBLL corpBLL = new NFMT.Funds.BLL.CashInCorpBLL();
                result = corpBLL.Load(user, allotId);
                if(result.ResultStatus!=0)
                    Response.Redirect(redirectUrl);

                List<NFMT.Funds.Model.CashInCorp> cashInCorps = result.ReturnValue as List<NFMT.Funds.Model.CashInCorp>;
                if (cashInCorps == null || cashInCorps.Count == 0)
                    Response.Redirect(redirectUrl);

                this.isShare = cashInCorps[0].IsShare;

                NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.FirstOrDefault(temp => temp.CorpId == cashInCorps[0].CorpId);
                if (corp == null || corp.CorpId <= 0)
                    Response.Redirect(redirectUrl);

                this.curCorp = corp;

                int pageIndex = 1, pageSize = 100;
                string orderStr = string.Empty, whereStr = string.Empty;

                NFMT.Funds.BLL.CashInAllotDetailBLL bll = new NFMT.Funds.BLL.CashInAllotDetailBLL();
                NFMT.Common.SelectModel select = bll.GetCurDetailsSelect(pageIndex, pageSize, orderStr,cashInAllot.AllotId);
                result = bll.Load(user, select);

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

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

            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string cashInAllotStr = context.Request.Form["cashInAllot"];
            if (string.IsNullOrEmpty(cashInAllotStr))
            {
                context.Response.Write("收款分配信息不能为空");
                context.Response.End();
            }

            string cashInCorpStr = context.Request.Form["cashInCorp"];
            if (string.IsNullOrEmpty(cashInCorpStr))
            {
                context.Response.Write("收款分配至公司信息不能为空");
                context.Response.End();
            }

            string cashInContractStr = context.Request.Form["cashInContract"];
            if (string.IsNullOrEmpty(cashInContractStr))
            {
                context.Response.Write("收款分配至合约信息不能为空");
                context.Response.End();
            }

            string cashInStockStr = context.Request.Form["cashInStock"];
            if (string.IsNullOrEmpty(cashInStockStr))
            {
                context.Response.Write("收款分配至库存信息不能为空");
                context.Response.End();
            }

            string cashInInvoiceStr = context.Request.Form["cashInInvoice"];

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

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

                NFMT.Funds.Model.CashInAllot cashInAllot = serializer.Deserialize<NFMT.Funds.Model.CashInAllot>(cashInAllotStr);
                NFMT.Funds.Model.CashInCorp cashInCorp = serializer.Deserialize<NFMT.Funds.Model.CashInCorp>(cashInCorpStr);
                NFMT.Funds.Model.CashInContract cashInContract = serializer.Deserialize<NFMT.Funds.Model.CashInContract>(cashInContractStr);
                List<NFMT.Funds.Model.CashInStcok> cashInStcoks = serializer.Deserialize<List<NFMT.Funds.Model.CashInStcok>>(cashInStockStr);

                List<NFMT.Funds.Model.CashInInvoice> cashInInvoices = new List<NFMT.Funds.Model.CashInInvoice>();
                if (!string.IsNullOrEmpty(cashInInvoiceStr))
                    cashInInvoices = serializer.Deserialize<List<NFMT.Funds.Model.CashInInvoice>>(cashInInvoiceStr);

                cashInAllot.Alloter = user.EmpId;
                cashInAllot.AllotTime = DateTime.Now;

                NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
                result = bll.Create(user, cashInAllot, cashInCorp, cashInContract, cashInStcoks, cashInInvoices);

                if (result.ResultStatus == 0)
                    result.Message = "收款分配新增成功";
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
            context.Response.End();
        }
        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.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.执行完成, NFMT.Common.OperateEnum.执行完成撤销 });
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

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

                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);

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

                //获取合约分配明细
                NFMT.Funds.BLL.CashInContractBLL cashInContractBLL = new NFMT.Funds.BLL.CashInContractBLL();
                NFMT.Common.StatusEnum status = NFMT.Common.StatusEnum.已生效;
                if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已完成)
                    status = NFMT.Common.StatusEnum.已完成;
                else if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已关闭)
                    status = NFMT.Common.StatusEnum.已关闭;

                result = cashInContractBLL.GetByAllot(user, allotId, status);
                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

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

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

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

                string json = serializer.Serialize(cashInAllot);
                this.hidModel.Value = json;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            //DateTime startDate = NFMT.Common.DefaultValue.DefaultTime;
            //DateTime endDate = NFMT.Common.DefaultValue.DefaultTime;

            //if (string.IsNullOrEmpty(context.Request["s"]) || !DateTime.TryParse(context.Request["s"], out startDate))
            //    startDate = NFMT.Common.DefaultValue.DefaultTime;

            //if (string.IsNullOrEmpty(context.Request["e"]) || !DateTime.TryParse(context.Request["e"], out endDate))
            //    endDate = NFMT.Common.DefaultValue.DefaultTime;
            //else
            //    endDate.AddDays(1);

            //string refNo = context.Request["r"];

            int cashInId = 0;
            if (string.IsNullOrEmpty(context.Request.QueryString["id"]) || !int.TryParse(context.Request.QueryString["id"], out cashInId))
                cashInId = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "CashInId":
                        sortDataField = "ci.CashInId";
                        break;
                    case "CorpName":
                        sortDataField = "corp.CorpName";
                        break;
                    case "corpAllotBala":
                        sortDataField = "corpAllotInfo.corpAllotBala";
                        break;
                    case "ContractNo":
                        sortDataField = "con.ContractNo";
                        break;
                    case "conAllotBala":
                        sortDataField = "conAllotInfo.conAllotBala";
                        break;
                    case "RefNo":
                        sortDataField = "sn.RefNo";
                        break;
                    case "stAllotBala":
                        sortDataField = "stAllotInfo.stAllotBala";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Funds.BLL.CashInAllotBLL bll = new NFMT.Funds.BLL.CashInAllotBLL();
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.SelectModel select = bll.GetCustomReportSelect(pageIndex, pageSize, orderStr, cashInId);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            Dictionary<string, object> dic = new Dictionary<string, object>();

            dic.Add("count", totalRows);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "CashInAllotMainList.aspx";

            if (!IsPostBack)
            {
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 122, 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 allotId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out allotId) || allotId <= 0)
                    this.WarmAlert("序号错误", redirectUrl);

                //获取收款分配
                NFMT.Funds.BLL.CashInAllotBLL cashInAllotBLL = new NFMT.Funds.BLL.CashInAllotBLL();
                result = cashInAllotBLL.Get(user, allotId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                cashInAllot = result.ReturnValue as NFMT.Funds.Model.CashInAllot;
                if (cashInAllot == null)
                    this.WarmAlert("获取收款分配失败", redirectUrl);

                NFMT.Common.StatusEnum status = NFMT.Common.StatusEnum.已生效;
                if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已完成)
                    status = NFMT.Common.StatusEnum.已完成;
                else if(cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已作废)
                    status = NFMT.Common.StatusEnum.已作废;
                else if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已关闭)
                    status = NFMT.Common.StatusEnum.已关闭;

                //获取收款分配至公司
                NFMT.Funds.BLL.CashInCorpBLL cashInCorpBLL = new NFMT.Funds.BLL.CashInCorpBLL();
                result = cashInCorpBLL.Load(user, allotId, status);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                List<NFMT.Funds.Model.CashInCorp> cashInCorps = result.ReturnValue as List<NFMT.Funds.Model.CashInCorp>;
                if (cashInCorps == null || !cashInCorps.Any())
                    this.WarmAlert("获取收款分配至公司失败", redirectUrl);

                cashInCorp = cashInCorps.FirstOrDefault();

                //获取收款分配至合约
                NFMT.Funds.BLL.CashInContractBLL cashInContractBLL = new NFMT.Funds.BLL.CashInContractBLL();
                result = cashInContractBLL.GetByAllot(user, allotId, status);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                cashInContract = result.ReturnValue as NFMT.Funds.Model.CashInContract;
                if (cashInContract == null)
                    this.WarmAlert("获取收款分配至合约失败", redirectUrl);

                //获取收款分配至库存
                NFMT.Funds.BLL.CashInStcokBLL cashInStockBLL = new NFMT.Funds.BLL.CashInStcokBLL();
                result = cashInStockBLL.LoadByAllot(user, allotId, status);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                cashInStocks = result.ReturnValue as List<NFMT.Funds.Model.CashInStcok>;
                if (cashInStocks == null || !cashInStocks.Any())
                    this.WarmAlert("获取收款分配至库存失败", redirectUrl);

                //获取合约列表
                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                NFMT.Common.SelectModel select = contractSubBLL.GetListSelect(1, 200, string.Empty, cashInContract.SubContractId);
                result = contractSubBLL.Load(user, select);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

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

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

                //获取库存列表
                result = cashInStockBLL.GetStockInfoByAlotId(user, allotId, status);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

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

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

                //获取收款登记信息
                NFMT.Funds.BLL.CashInBLL cashInBLL = new NFMT.Funds.BLL.CashInBLL();
                result = cashInBLL.Get(user, cashInCorp.CashInId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                cashIn = result.ReturnValue as NFMT.Funds.Model.CashIn;
                if (cashIn == null)
                    this.WarmAlert("获取收款登记失败", redirectUrl);

                //初始化
                InitCashInInfo(cashIn, redirectUrl);

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string json = serializer.Serialize(cashInAllot);
                this.hidModel.Value = json;

                NFMT.Funds.BLL.CashInInvoiceBLL cashInInvoiceBLL = new NFMT.Funds.BLL.CashInInvoiceBLL();
                result = cashInInvoiceBLL.GetSIIdsbyAllotId(user, allotId);
                if (result.ResultStatus != 0)
                    this.WarmAlert(result.Message, redirectUrl);

                upSIIds = result.ReturnValue != null ? result.ReturnValue.ToString() : string.Empty;
            }
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.VerificationUtility ver = new Utility.VerificationUtility();
            ver.JudgeOperate(this.Page, 58, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.执行完成, NFMT.Common.OperateEnum.执行完成撤销 });

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            int allotId = 0;
            string redirctUrl = "CashInAllotStockList.aspx";

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

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

            //获取收款分配主表
            NFMT.Funds.BLL.CashInAllotBLL cashInAllotBLL = new NFMT.Funds.BLL.CashInAllotBLL();
            result = cashInAllotBLL.Get(user, allotId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirctUrl);

            cashInAllot = result.ReturnValue as NFMT.Funds.Model.CashInAllot;
            if (cashInAllot == null)
                Response.Redirect(redirctUrl);

            NFMT.Common.StatusEnum status = NFMT.Common.StatusEnum.已生效;
            if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已完成)
                status = NFMT.Common.StatusEnum.已完成;
            else if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已作废)
                status = NFMT.Common.StatusEnum.已作废;
            else if (cashInAllot.AllotStatus == NFMT.Common.StatusEnum.已关闭)
                status = NFMT.Common.StatusEnum.已关闭;

            //通过收款分配Id获取库存收款分配明细表
            NFMT.Funds.BLL.CashInStcokBLL cashInStcokBLL = new NFMT.Funds.BLL.CashInStcokBLL();
            result = cashInStcokBLL.LoadByAllot(user, allotId, status);
            if (result.ResultStatus != 0)
                Response.Redirect(redirctUrl);

            List<NFMT.Funds.Model.CashInStcok> cashInStcoks = result.ReturnValue as List<NFMT.Funds.Model.CashInStcok>;
            if (cashInStcoks == null)
                Response.Redirect(redirctUrl);

            NFMT.Funds.Model.CashInStcok cashInStock = cashInStcoks[0];
            if (cashInStock == null)
                Response.Redirect(redirctUrl);

            int stockLogId = cashInStock.StockLogId;

            //获取库存流水
            NFMT.WareHouse.BLL.StockLogBLL stockLogBLL = new NFMT.WareHouse.BLL.StockLogBLL();
            result = stockLogBLL.Get(user, stockLogId);

            if (result.ResultStatus != 0)
                Response.Redirect(redirctUrl);

            NFMT.WareHouse.Model.StockLog stockLog = result.ReturnValue as NFMT.WareHouse.Model.StockLog;
            if (stockLog == null || stockLog.StockLogId <= 0)
                Response.Redirect(redirctUrl);

            this.curStockLog = stockLog;

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

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

            this.curSub = sub;

            //合约抬头
            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);
            }

            NFMT.Data.Model.MeasureUnit mu = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == sub.UnitId);
            if (mu != null && mu.MUId > 0)
                this.spnSignAmount.InnerHtml = string.Format("{0},{1}", sub.SignAmount, mu.MUName);

            //获取库存
            NFMT.WareHouse.BLL.StockBLL stockBLL = new NFMT.WareHouse.BLL.StockBLL();
            result = stockBLL.Get(user, stockLog.StockId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirctUrl);

            NFMT.WareHouse.Model.Stock stock = result.ReturnValue as NFMT.WareHouse.Model.Stock;
            if (stock == null || stock.StockId <= 0)
                Response.Redirect(redirctUrl);

            this.curStock = stock;

            //获取业务单号
            NFMT.WareHouse.BLL.StockNameBLL stockNameBLL = new NFMT.WareHouse.BLL.StockNameBLL();
            result = stockNameBLL.Get(user, stock.StockNameId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirctUrl);

            NFMT.WareHouse.Model.StockName stockName = result.ReturnValue as NFMT.WareHouse.Model.StockName;
            if (stockName == null || stockName.StockNameId <= 0)
                Response.Redirect(redirctUrl);

            this.spanRefNo.InnerHtml = stockName.RefNo;
            this.spanStockDate.InnerHtml = stock.StockDate.ToShortDateString();

            NFMT.User.Model.Corporation ownCorp = NFMT.User.UserProvider.Corporations.FirstOrDefault(temp => temp.CorpId == stock.CorpId);

            if (ownCorp != null && ownCorp.CorpId > 0)
                this.spanCorpId.InnerHtml = ownCorp.CorpName;

            if (mu != null && mu.MUId > 0)
                this.spanGrossAmout.InnerHtml = string.Format("{0},{1}", stock.GrossAmount, mu.MUName);

            NFMT.Data.Model.Asset ass = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == stock.AssetId);
            if (ass != null && ass.AssetId > 0)
                this.spanAssetId.InnerHtml = ass.AssetName;

            NFMT.Data.Model.Brand bra = NFMT.Data.BasicDataProvider.Brands.FirstOrDefault(temp => temp.BrandId == stock.BrandId);
            if (bra != null && bra.BrandId > 0)
                this.spanBrandId.InnerHtml = bra.BrandName;

            this.navigation1.Routes.Add("库存分配列表", redirctUrl);
            this.navigation1.Routes.Add("库存分配明细", string.Empty);

            this.JsonOutCorp = Newtonsoft.Json.JsonConvert.SerializeObject(outCorps);

            for (int i = 0; i < outCorps.Count; i++)
            {
                NFMT.Contract.Model.ContractCorporationDetail corp = outCorps[i];
                if (corp.CorpId > 0)
                {
                    if (i != 0)
                        this.curOutCorpIds += ",";

                    this.curOutCorpIds += corp.CorpId;
                }
            }

            NFMT.Funds.BLL.CashInStcokBLL bll = new NFMT.Funds.BLL.CashInStcokBLL();
            NFMT.Common.SelectModel select = bll.GetCurDetailsSelect(1, 100, "cisr.RefId desc", stockLogId);
            result = bll.Load(user, select);

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

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

            string json = serializer.Serialize(cashInAllot);
            this.hidModel.Value = json;
        }