Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "InvoiceProvisionalList.aspx";

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

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

                //获取合约与子合约
                int subId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out subId))
                    Response.Redirect(redirectUrl);

                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.curContractSub = sub;

                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.Buy)
                {
                    outSelf = 0;
                    inSelf = 1;
                    invoiceDirection = NFMT.Invoice.InvoiceDirectionEnum.收取;
                }

                this.SelectJson(sub.SubId, invoiceDirection);

                this.navigation1.Routes.Add("临票列表", redirectUrl);
                this.navigation1.Routes.Add(string.Format("临票新增", invoiceDirection), string.Empty);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.navigation1.Routes.Add("制单指令列表", "OrderList.aspx");
                this.navigation1.Routes.Add("可制单合约列表", "OrderContractList.aspx");
                this.navigation1.Routes.Add("制单指令新增", string.Empty);

                string redirectUrl = "OrderList.aspx";

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

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

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                this.curDeptId = user.DeptId;

                NFMT.Contract.BLL.ContractSubBLL subBll = new NFMT.Contract.BLL.ContractSubBLL();
                NFMT.Common.ResultModel 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.ContractId == 0)
                    Response.Redirect(redirectUrl);
                this.curSub = sub;

                NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

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

                NFMT.Data.Model.Asset ass = NFMT.Data.BasicDataProvider.Assets.First(temp => temp.AssetId == con.AssetId);
                this.curAsset = ass;

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == con.UnitId);
                this.curMUName = muContract.MUName;

                NFMT.Data.Model.Currency cur = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                this.curCurrency = cur;

                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";
            int id = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["id"], out id) || id <= 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.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
            NFMT.Contract.Model.Contract contract = new NFMT.Contract.Model.Contract()
            {
                LastModifyId = user.EmpId,
                ContractId = id
            };

            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.作废:
                    result = contractBLL.Invalid(user, contract);
                    break;
                case NFMT.Common.OperateEnum.撤返:
                    result = contractBLL.GoBack(user, contract);
                    break;
                case NFMT.Common.OperateEnum.执行完成:
                    result = contractBLL.Complete(user, id);
                    break;
                case NFMT.Common.OperateEnum.执行完成撤销:
                    result = contractBLL.CompleteCancel(user, id);
                    break;
            }

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

            context.Response.Write(result.Message);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 43, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

                this.navigation1.Routes.Add("出库申请列表", "StockOutApplyList.aspx");
                this.navigation1.Routes.Add("可配货子合约列表", "StockOutApplyContractList.aspx");
                this.navigation1.Routes.Add("子合约配货", string.Empty);

                string redirectUrl = "StockOutApplyContractList.aspx";

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

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

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                this.curDeptId = user.DeptId;

                NFMT.Contract.BLL.ContractSubBLL subBll = new NFMT.Contract.BLL.ContractSubBLL();
                NFMT.Common.ResultModel 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.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;

                NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

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

                this.curContract = con;

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "StockOutApplyList.aspx";

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 43, 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 applyId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["aid"]) || !int.TryParse(Request.QueryString["aid"], out applyId))
                    applyId = 0;

                if (applyId==0 && string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                int stockOutApplyId = 0;
                if (applyId == 0 &&  !int.TryParse(Request.QueryString["id"], out stockOutApplyId))
                    Response.Redirect(redirectUrl);

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                //获取出库申请
                NFMT.WareHouse.BLL.StockOutApplyBLL stockOutApplyBLL = new NFMT.WareHouse.BLL.StockOutApplyBLL();
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
                if(applyId>0)
                    result = stockOutApplyBLL.GetByApplyId(user, applyId);
                else
                    result = stockOutApplyBLL.Get(user, stockOutApplyId);

                if(result.ResultStatus!=0)
                    Response.Redirect(redirectUrl);
                NFMT.WareHouse.Model.StockOutApply apply = result.ReturnValue as NFMT.WareHouse.Model.StockOutApply;
                if(apply==null || apply.ApplyId==0)
                    Response.Redirect(redirectUrl);

                stockOutApplyId = apply.StockOutApplyId;

                //获取主申请表信息
                NFMT.Operate.BLL.ApplyBLL mainApplyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = mainApplyBLL.Get(user, apply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                mainApply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if (mainApply == null || mainApply.ApplyId <= 0)
                    Response.Redirect(redirectUrl);

                //获取关联子合约
                NFMT.Contract.BLL.ContractSubBLL subBll = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBll.Get(user, apply.SubContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.ContractId == 0)
                    Response.Redirect(redirectUrl);

                //获取关联合约
                NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.Contract con = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (con == null || con.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.curAsset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == con.AssetId);
                this.curUint = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == con.UnitId);
                this.curApply = mainApply;
                this.curContract = con;
                this.curSub = sub;
                this.curCurrency = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                this.curStockOutApply = apply;

                NFMT.Data.Model.MeasureUnit subMU = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == sub.UnitId);
                this.txbMemo.Value = mainApply.ApplyDesc;

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

                NFMT.Common.SelectModel select = stockOutApplyBLL.GetOutApplySelectedSelect(1, 100, "sto.StockId desc", string.Empty, curStockOutApply.StockOutApplyId);
                result = stockOutApplyBLL.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.JsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

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

                result = stockOutApplyBLL.GetAuditInfo(user, apply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect("StockOutApplyList.aspx");

                this.txbAuditInfo.InnerHtml = result.ReturnValue.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            this.curUser = user;

            string redirectUrl = string.Format("{0}WareHouse/StockInByContract.aspx", NFMT.Common.DefaultValue.NftmSiteName);

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

                this.navigation1.Routes.Add("入库登记", string.Format("{0}WareHouse/StockInList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("合约入库", redirectUrl);
                this.navigation1.Routes.Add("入库登记新增", string.Empty);

                this.hidBDStyleId.Value = ((int)NFMT.Data.StyleEnum.报关状态).ToString();

                NFMT.User.UserSecurity security = user as NFMT.User.UserSecurity;
                this.curDeptId = security.Dept.DeptId;

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                int id = 0;//子合约Id
                if (!int.TryParse(Request.QueryString["id"], out id) || id == 0)
                    Response.Redirect(redirectUrl);

                this.hidContractSubId.Value = id.ToString();

                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                NFMT.Common.ResultModel result = contractSubBLL.Get(user, id);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.ContractSub contractSub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (contractSub == null)
                    Response.Redirect(redirectUrl);

                this.curSub = contractSub;

                int contractId = contractSub.ContractId;
                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.Get(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

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

                this.curContract = contract;

                this.hidAssetId.Value = contract.AssetId.ToString();
                this.hidMUId.Value = contract.UnitId.ToString();

                this.SubId = contractSub.SubId;

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

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "InvoiceSuppleFinalList.aspx";

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

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

                //获取终票
                int finalId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out finalId))
                    Response.Redirect(redirectUrl);

                NFMT.Invoice.BLL.BusinessInvoiceBLL businessInvoiceBLL = new NFMT.Invoice.BLL.BusinessInvoiceBLL();
                result = businessInvoiceBLL.Get(user, finalId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Invoice.Model.BusinessInvoice finalInvoice = result.ReturnValue as NFMT.Invoice.Model.BusinessInvoice;
                if (finalInvoice == null || finalInvoice.BusinessInvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curFinalInvoice = finalInvoice;

                //获取主发票
                NFMT.Operate.BLL.InvoiceBLL invoiceBLL = new NFMT.Operate.BLL.InvoiceBLL();
                result = invoiceBLL.Get(user, finalInvoice.InvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Operate.Model.Invoice invoice = result.ReturnValue as NFMT.Operate.Model.Invoice;
                if (invoice == null || invoice.InvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curInvoice = invoice;

                //获取合约与子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, finalInvoice.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.curContractSub = sub;

                //币种和计量单位
                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;
                NFMT.Data.Model.MeasureUnit mu = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == sub.UnitId);
                if (mu != null && mu.MUId > 0)
                    this.curUnit = mu.MUName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.Buy)
                    invoiceDirection = NFMT.Invoice.InvoiceDirectionEnum.收取;

                this.SelectJson(finalInvoice.BusinessInvoiceId);

                this.navigation1.Routes.Add("补零终票列表", redirectUrl);
                this.navigation1.Routes.Add("补零终票新增", string.Empty);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "InvoiceDirectFinalList.aspx";

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

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

                //获取合约与子合约
                int subId = 0;
                if(string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"],out subId))
                    Response.Redirect(redirectUrl);

                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.curContractSub = sub;

                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                if (contract.TradeDirection ==(int)NFMT.Contract.TradeDirectionEnum.Buy)
                    invoiceDirection = NFMT.Invoice.InvoiceDirectionEnum.收取;

                //获取子合约价格明细
                NFMT.Contract.BLL.SubPriceBLL subPriceBLL = new NFMT.Contract.BLL.SubPriceBLL();
                result = subPriceBLL.GetPriceBySubId(user, sub.SubId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.SubPrice subPrice = result.ReturnValue as NFMT.Contract.Model.SubPrice;
                if(subPrice == null || subPrice.SubPriceId<=0)
                    Response.Redirect(redirectUrl);

                if (sub.PriceMode == (int)NFMT.Contract.PriceModeEnum.Pricing)
                {
                    //定价合约
                    this.AvgPrice = subPrice.FixedPrice.ToString("0.0000");
                }
                else if ((subPrice.WhoDoPrice == (int)NFMT.Contract.WhoDoPriceEnum.我方 && contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.采购) || contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.销售)
                {
                    //点价合约
                    //获取当前子合约下点价列表
                    NFMT.DoPrice.BLL.PricingBLL pricingBLL = new NFMT.DoPrice.BLL.PricingBLL();
                    result = pricingBLL.Load(user, sub.SubId);
                    if (result.ResultStatus != 0)
                    {
                        Response.Write("<script>");
                        Response.Write("alert(\"该合约未进行任何点价,不能开具或收取直接终票\");");
                        Response.Write(string.Format("document.local.href={0};",redirectUrl));
                        Response.Write("</script>");
                        Response.End();
                    }

                    List<NFMT.DoPrice.Model.Pricing> pricings = result.ReturnValue as List<NFMT.DoPrice.Model.Pricing>;
                    if (pricings == null || pricings.Count <= 0)
                    {
                        Response.Write("<script>");
                        Response.Write("alert(\"该合约未进行任何点价,不能开具或收取直接终票\");");
                        Response.Write(string.Format("document.location.href =\"{0}\";", redirectUrl));
                        Response.Write("</script>");
                        Response.End();
                    }
                    decimal sumBala = pricings.Sum(temp => temp.FinalPrice * temp.PricingWeight);
                    decimal sumAmount = pricings.Sum(temp => temp.PricingWeight);

                    decimal avgPrice = sumBala / sumAmount;
                    this.AvgPrice = avgPrice.ToString("0.0000");
                }

                this.SelectJson(sub.SubId, invoiceDirection);

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

                this.navigation1.Routes.Add("直接终票列表", redirectUrl);
                this.navigation1.Routes.Add(string.Format("直接终票新增", invoiceDirection), string.Empty);

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curContractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "InvoiceDirectFinalList.aspx";

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

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

                //获取合约与子合约
                int subId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out subId))
                    Response.Redirect(redirectUrl);

                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.curContractSub = sub;

                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.Buy)
                    invoiceDirection = NFMT.Invoice.InvoiceDirectionEnum.收取;

                int pageIndex = 1, pageSize = 100;
                string orderStr = string.Empty, whereStr = string.Empty;
                NFMT.Common.SelectModel select = new NFMT.Common.SelectModel();
                NFMT.Invoice.BLL.BusinessInvoiceBLL bll = new NFMT.Invoice.BLL.BusinessInvoiceBLL();

                if (sub.PriceMode == (int)NFMT.Contract.PriceModeEnum.定价)
                {
                    //定价合约

                    //获取子合约价格明细
                    NFMT.Contract.BLL.SubPriceBLL subPriceBLL = new NFMT.Contract.BLL.SubPriceBLL();
                    result = subPriceBLL.GetPriceBySubId(user, sub.SubId);
                    if (result.ResultStatus != 0)
                        Response.Redirect(redirectUrl);

                    NFMT.Contract.Model.SubPrice subPrice = result.ReturnValue as NFMT.Contract.Model.SubPrice;
                    if (subPrice == null || subPrice.SubPriceId <= 0)
                        Response.Redirect(redirectUrl);
                    this.AvgPrice = subPrice.FixedPrice;
                    select = bll.GetDirectFinalStocksSelect(pageIndex, pageSize, orderStr, subId, 0, false, false);
                }
                else
                {
                    select = bll.GetDirectStocksModel(pageIndex, pageSize, orderStr, subId, false, 0);
                }

                result = bll.Load(user, select, NFMT.Common.DefaultValue.ClearAuth);
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.SelectedJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

                //if (sub.PriceMode == (int)NFMT.Contract.PriceModeEnum.点价)
                //{
                    decimal sumBala = dt.Select().Sum(temp => Convert.ToDecimal(temp["Bala"]));
                    decimal sumNetAmount = dt.Select().Sum(temp => Convert.ToDecimal(temp["NetAmount"]));

                    if (sumNetAmount == 0)
                        this.WarmAlert("未确认价格,禁止开终票", redirectUrl);
                if (sumNetAmount > 0)
                {
                    this.netAmount = sumNetAmount;
                    this.invoiceBala = Math.Round(sumBala, 2, MidpointRounding.AwayFromZero);
                    this.AvgPrice = Math.Round(this.invoiceBala/sumNetAmount, 4, MidpointRounding.AwayFromZero);
                }
                //}

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

                this.navigation1.Routes.Add("直接终票列表", redirectUrl);
                this.navigation1.Routes.Add(string.Format("直接终票新增", invoiceDirection), string.Empty);

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curContractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                string redirectUrl = "OrderList.aspx";

                this.navigation1.Routes.Add("制单指令列表", redirectUrl);
                this.navigation1.Routes.Add("制单指令明细", string.Empty);

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

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

                //获取制单指令
                NFMT.Document.BLL.DocumentOrderBLL orderBLL = new NFMT.Document.BLL.DocumentOrderBLL();
                result = orderBLL.Get(user, orderId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Document.Model.DocumentOrder order = result.ReturnValue as NFMT.Document.Model.DocumentOrder;
                if (order == null || order.OrderId <= 0)
                    Response.Redirect(redirectUrl);

                this.curOrder = order;

                NFMT.Document.BLL.DocumentOrderDetailBLL detailBLL = new NFMT.Document.BLL.DocumentOrderDetailBLL();
                result = detailBLL.GetByOrderId(user, order.OrderId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Document.Model.DocumentOrderDetail orderDetail = result.ReturnValue as NFMT.Document.Model.DocumentOrderDetail;
                if (orderDetail == null || orderDetail.DetailId <= 0)
                    Response.Redirect(redirectUrl);

                this.curOrderDetail = orderDetail;

                #region 合约信息

                //合约信息
                NFMT.Contract.BLL.ContractSubBLL subBll = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBll.Get(user, order.SubId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.ContractId == 0)
                    Response.Redirect(redirectUrl);
                this.curSub = sub;

                NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

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

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == con.UnitId);
                NFMT.Data.Model.Currency cur = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                this.curCurrency = cur;

                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curSub;
                this.contractExpander1.RedirectUrl = redirectUrl;

                #endregion

                NFMT.Common.SelectModel select = orderBLL.GetOrderSelectedSelect(1, 100, "dos.DetailId desc", order.OrderId);
                result = orderBLL.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.JsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

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

                //attach
                this.attach1.BusinessIdValue = this.curOrder.OrderId;
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.VerificationUtility ver = new Utility.VerificationUtility();
            ver.JudgeOperate(this.Page, 79, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            this.hidTradeDirection.Value = ((int)NFMT.Data.StyleEnum.TradeDirection).ToString();
            this.hidTradeBorder.Value = ((int)NFMT.Data.StyleEnum.TradeBorder).ToString();
            this.hidMarginMode.Value = ((int)NFMT.Data.StyleEnum.MarginMode).ToString();
            this.hidValueRateType.Value = ((int)NFMT.Data.StyleEnum.ValueRateType).ToString();
            this.hidDiscountBase.Value = ((int)NFMT.Data.StyleEnum.DiscountBase).ToString();
            this.hidWhoDoPrice.Value = ((int)NFMT.Data.StyleEnum.WhoDoPrice).ToString();
            this.hidSummaryPrice.Value = ((int)NFMT.Data.StyleEnum.SummaryPrice).ToString();

            string redirectUrl = "SubList.aspx";

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

            this.navigation1.Routes.Add("子合约列表", redirectUrl);
            this.navigation1.Routes.Add("子合约修改", string.Empty);

            this.hidTradeDirection.Value = ((int)NFMT.Data.StyleEnum.TradeDirection).ToString();
            this.hidTradeBorder.Value = ((int)NFMT.Data.StyleEnum.TradeBorder).ToString();
            this.hidMarginMode.Value = ((int)NFMT.Data.StyleEnum.MarginMode).ToString();
            this.hidValueRateType.Value = ((int)NFMT.Data.StyleEnum.ValueRateType).ToString();
            this.hidDiscountBase.Value = ((int)NFMT.Data.StyleEnum.DiscountBase).ToString();
            this.hidWhoDoPrice.Value = ((int)NFMT.Data.StyleEnum.WhoDoPrice).ToString();
            this.hidSummaryPrice.Value = ((int)NFMT.Data.StyleEnum.SummaryPrice).ToString();

            NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
            NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
            NFMT.Contract.BLL.SubDetailBLL detailBLL = new NFMT.Contract.BLL.SubDetailBLL();
            NFMT.Contract.BLL.SubPriceBLL priceBLL = new NFMT.Contract.BLL.SubPriceBLL();
            NFMT.Contract.BLL.SubCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.SubCorporationDetailBLL();
            NFMT.Contract.BLL.ContractDeptBLL deptBLL = new NFMT.Contract.BLL.ContractDeptBLL();

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

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

            int contractId = this.curSub.ContractId;

            //获取合约
            result = contractBLL.Get(user, contractId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            curContract = result.ReturnValue as NFMT.Contract.Model.Contract;
            if (curContract == null)
                Response.Redirect(redirectUrl);

            //获取明细
            result = detailBLL.GetDetailBySubId(user, subId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            this.curSubDetail = result.ReturnValue as NFMT.Contract.Model.SubDetail;
            if (curSubDetail == null)
                Response.Redirect(redirectUrl);

            //获取价格
            result = priceBLL.GetPriceBySubId(user, subId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            curSubPrice = result.ReturnValue as NFMT.Contract.Model.SubPrice;
            if (curSubPrice == null)
                Response.Redirect(redirectUrl);

            //获取公司列表
            //我方公司
            result = corpBLL.Load(user, subId, true);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            curInCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
            if (curInCorps == null || curInCorps.Count == 0)
                Response.Redirect(redirectUrl);

            //对方公司
            result = corpBLL.Load(user, subId, false);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            curOutCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
            if (curOutCorps == null || curOutCorps.Count == 0)
                Response.Redirect(redirectUrl);

            //执行部门
            result = deptBLL.LoadDeptByContractId(user, contractId);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);

            curDepts = result.ReturnValue as List<NFMT.Contract.Model.ContractDept>;

            foreach (var obj in curOutCorps)
            {
                if (curOutCorps.IndexOf(obj) > 0)
                    curOutCorpsString += ",";
                curOutCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in this.curInCorps)
            {
                if (curInCorps.IndexOf(obj) > 0)
                    this.curInCorpsString += ",";
                curInCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in this.curDepts)
            {
                if (curDepts.IndexOf(obj) > 0)
                    curDeptsString += ",";
                curDeptsString += obj.DeptId.ToString();
            }

            //attach
            this.attach1.BusinessIdValue = this.curSub.SubId;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "InvoiceDirectFinalList.aspx";

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

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

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

                //获取直接终票
                int businessInvoiceId = 0;
                if (invoiceId == 0 && (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out businessInvoiceId)))
                    Response.Redirect(redirectUrl);
                NFMT.Invoice.BLL.BusinessInvoiceBLL businessInvoiceBLL = new NFMT.Invoice.BLL.BusinessInvoiceBLL();

                if (invoiceId > 0)
                    result = businessInvoiceBLL.GetByInvoiceId(user, invoiceId);
                else
                    result = businessInvoiceBLL.Get(user, businessInvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Invoice.Model.BusinessInvoice businessInvoice = result.ReturnValue as NFMT.Invoice.Model.BusinessInvoice;
                if (businessInvoice == null || businessInvoice.BusinessInvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curBusinessInvoice = businessInvoice;

                //获取发票主体
                NFMT.Operate.BLL.InvoiceBLL invoiceBLL = new NFMT.Operate.BLL.InvoiceBLL();
                result = invoiceBLL.Get(user, businessInvoice.InvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Operate.Model.Invoice invoice = result.ReturnValue as NFMT.Operate.Model.Invoice;
                if (invoice == null || invoice.InvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curInvoice = invoice;

                //获取合约与子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, businessInvoice.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.curContractSub = sub;

                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.Buy)
                    invoiceDirection = NFMT.Invoice.InvoiceDirectionEnum.收取;

                this.SelectJson(businessInvoice, invoiceDirection);

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

                this.navigation1.Routes.Add("直接终票列表", redirectUrl);
                this.navigation1.Routes.Add(string.Format("直接终票明细", invoiceDirection), string.Empty);

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

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curContractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = string.Format("{0}DoPrice/PricingApplyList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

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

                this.hidSummaryPrice.Value = ((int)NFMT.Data.StyleEnum.SummaryPrice).ToString();

                this.navigation1.Routes.Add("点价申请", redirectUrl);
                this.navigation1.Routes.Add("点价申请修改", string.Empty);

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

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

                NFMT.DoPrice.BLL.PricingApplyBLL pricingApplyBLL = new NFMT.DoPrice.BLL.PricingApplyBLL();
                //获取点价申请
                result = pricingApplyBLL.Get(user, pricingApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                pricingApply = result.ReturnValue as NFMT.DoPrice.Model.PricingApply;
                if (pricingApply == null || pricingApply.PricingApplyId <= 0)
                    Response.Redirect(redirectUrl);

                int subId = pricingApply.SubContractId;

                //获取申请
                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, pricingApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if (apply == null || apply.ApplyId <= 0)
                    Response.Redirect(redirectUrl);

                //获取合约与子合约
                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.curContractSub = sub;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                currencyId = curContract.SettleCurrency;
                assetId = curContract.AssetId;
                mUId = curContract.UnitId;

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

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

                alreadyPricingWeight = Convert.ToDecimal(result.ReturnValue.ToString());

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curContractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = string.Format("{0}DoPrice/PricingList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 60, 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);

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

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

                NFMT.DoPrice.BLL.PricingBLL pricingBLL = new NFMT.DoPrice.BLL.PricingBLL();
                //获取点价实体
                result = pricingBLL.Get(user, pricingId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                pricing = result.ReturnValue as NFMT.DoPrice.Model.Pricing;
                if (pricing == null)
                    Response.Redirect(redirectUrl);

                int pricingApplyId = pricing.PricingApplyId;

                NFMT.DoPrice.BLL.PricingApplyBLL pricingApplyBLL = new NFMT.DoPrice.BLL.PricingApplyBLL();
                //获取点价申请
                result = pricingApplyBLL.Get(user, pricingApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                pricingApply = result.ReturnValue as NFMT.DoPrice.Model.PricingApply;
                if (pricingApply == null || pricingApply.PricingApplyId <= 0)
                    Response.Redirect(redirectUrl);

                int subId = pricingApply.SubContractId;

                //获取申请
                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, pricingApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if (apply == null || apply.ApplyId <= 0)
                    Response.Redirect(redirectUrl);

                //获取合约与子合约
                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.curContractSub = sub;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                currencyId = curContract.SettleCurrency;
                assetId = curContract.AssetId;
                mUId = curContract.UnitId;
                NFMT.Data.Model.MeasureUnit mu = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == curContract.UnitId);
                if (mu != null && mu.MUId > 0)
                    this.curMUName = mu.MUName;

                if (currencyId != 0)
                {
                    NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(a => a.CurrencyId == currencyId);
                    if (currency != null)
                        currencyName = currency.CurrencyName;
                }

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

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

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curContractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
Beispiel #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 37, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.查询 });

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

                //this.navigation1.Routes.Add("合约列表", redirectUrl);
                //this.navigation1.Routes.Add("合约预览", string.Empty);

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

                //获取合约
                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.Get(user, contractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

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

                //获取品种
                asset = NFMT.Data.BasicDataProvider.Assets.SingleOrDefault(a => a.AssetId == contract.AssetId);
                if (asset == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取品种失败", redirectUrl);

                NFMT.Contract.BLL.ContractCorporationDetailBLL contractCorporationDetailBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();

                //采购销售
                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.采购)
                {
                    tradeDirection = "采购";
                    isSelf = true;
                }
                else if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.销售)
                {
                    tradeDirection = "销售";
                    isSelf = false;
                }

                //买方抬头
                result = contractCorporationDetailBLL.LoadByContractId(user, contractId, isSelf);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                buyCorporationDetails = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                if (buyCorporationDetails == null || !buyCorporationDetails.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取买方抬头失败", redirectUrl);

                List<string> corpNames = new List<string>();
                buyCorporationDetails.ForEach(detail =>
                {
                    corp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == detail.CorpId);
                    if (!corpNames.Contains(corp.CorpName))
                        corpNames.Add(corp.CorpName);
                });

                buyCorpName = string.Join(",", corpNames);

                if (string.IsNullOrEmpty(buyCorpName))
                    Utility.JsUtility.WarmAlert(this.Page, "获取买方抬头失败", redirectUrl);

                //卖方抬头
                result = contractCorporationDetailBLL.LoadByContractId(user, contractId, !isSelf);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                sellCorporationDetails = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                if (sellCorporationDetails == null || !sellCorporationDetails.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取卖方抬头失败", redirectUrl);

                corpNames.Clear();
                sellCorporationDetails.ForEach(detail =>
                {
                    corp = NFMT.User.UserProvider.Corporations.SingleOrDefault(a => a.CorpId == detail.CorpId);
                    if (!corpNames.Contains(corp.CorpName))
                        corpNames.Add(corp.CorpName);
                });

                sellCorpName = string.Join(",", corpNames);

                if (string.IsNullOrEmpty(sellCorpName))
                    Utility.JsUtility.WarmAlert(this.Page, "获取卖方抬头失败", redirectUrl);

                //列表明细
                result = contractBLL.GetContractDetail(user, contractId, (NFMT.Contract.TradeDirectionEnum)contract.TradeDirection);
                //if (result.ResultStatus != 0)
                //    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                dt = result.ReturnValue as System.Data.DataTable;
                //if (dt == null || dt.Rows.Count < 1)
                //    Utility.JsUtility.WarmAlert(this.Page, "获取合约明细失败", redirectUrl);

                contractDetailStr = GetGridDetail(dt, contract);

                //合约条款
                NFMT.Contract.BLL.ContractClauseBLL contractClauseBLL = new NFMT.Contract.BLL.ContractClauseBLL();
                result = contractClauseBLL.LoadClauseByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                List<NFMT.Data.Model.ContractClause> contractClauses = result.ReturnValue as List<NFMT.Data.Model.ContractClause>;
                if (contractClauses == null || !contractClauses.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取合约条款失败", redirectUrl);

                contractClausesStr = GetMasterClause(contractClauses);
            }
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = string.Format("{0}DoPrice/PriceConfirmList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

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

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

                this.navigation1.Routes.Add("价格确认单列表", redirectUrl);
                this.navigation1.Routes.Add("价格确认单明细", string.Empty);

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

                NFMT.DoPrice.BLL.PriceConfirmBLL priceConfirmBLL = new NFMT.DoPrice.BLL.PriceConfirmBLL();
                result = priceConfirmBLL.Get(user, priceConfirmId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                priceConfirm = result.ReturnValue as NFMT.DoPrice.Model.PriceConfirm;
                if (priceConfirm == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取价格确认单失败", redirectUrl);

                int subId = priceConfirm.SubId;

                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = contractSubBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Utility.JsUtility.WarmAlert(this.Page, "获取子合约失败", redirectUrl);

                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                //获取合约
                contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取合约失败", redirectUrl);

                this.txbContractNo.Value = contract.OutContractNo;

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.采购)
                    strTradeDirection = "采购";
                else if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.销售)
                    strTradeDirection = "销售";
                else
                    strTradeDirection = string.Empty;

                this.txbTradeDirection.Value = strTradeDirection;

                //获取子合约中的币种
                cur = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(a => a.CurrencyId == sub.SettleCurrency);
                if (cur == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取币种失败", redirectUrl);

                //获取合约单位
                mu = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(a => a.MUId == sub.UnitId);
                if (mu == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取单位失败", redirectUrl);

                //获取合约抬头
                //我方
                NFMT.Contract.BLL.SubCorporationDetailBLL subCorporationDetailBLL = new NFMT.Contract.BLL.SubCorporationDetailBLL();
                result = subCorporationDetailBLL.Load(user, subId, true);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                subInCorpDetails = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                if (subInCorpDetails == null || !subInCorpDetails.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取我方抬头失败", redirectUrl);

                this.txbInCorpId.Value = subInCorpDetails.SingleOrDefault(a => a.IsDefaultCorp == true).CorpName;

                //对方
                result = subCorporationDetailBLL.Load(user, subId, false);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                subOutCorpDetails = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                if (subInCorpDetails == null || !subInCorpDetails.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取我方抬头失败", redirectUrl);

                this.txbOutCorpId.Value = subOutCorpDetails.SingleOrDefault(a => a.IsDefaultCorp == true).CorpName;

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

                SelectJson(sub.SubId, priceConfirmId);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "StockOutApplyList.aspx";

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

                this.navigation1.Routes.Add("出库申请列表", redirectUrl);
                this.navigation1.Routes.Add("出库申请修改", string.Empty);

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

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

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

                //获取出库申请
                NFMT.WareHouse.BLL.StockOutApplyBLL stockOutApplyBLL = new NFMT.WareHouse.BLL.StockOutApplyBLL();
                NFMT.Common.ResultModel result = stockOutApplyBLL.Get(user, stockOutApplyId);
                if(result.ResultStatus!=0)
                    Response.Redirect(redirectUrl);
                NFMT.WareHouse.Model.StockOutApply apply = result.ReturnValue as NFMT.WareHouse.Model.StockOutApply;
                if(apply==null || apply.ApplyId==0)
                    Response.Redirect(redirectUrl);

                this.curStockOutApply = apply;

                //获取关联子合约
                NFMT.Contract.BLL.ContractSubBLL subBll = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBll.Get(user, apply.SubContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;
                this.curCurrency = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);

                //获取关联合约
                NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.Contract con = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (con == null || con.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.curContract = con;
                this.curAsset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == con.AssetId);
                this.curUint = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == sub.UnitId);

                //获取主申请信息
                NFMT.Operate.BLL.ApplyBLL mainApplyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = mainApplyBLL.Get(user, apply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Operate.Model.Apply mainApply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if(mainApply==null || mainApply.ApplyId<=0)
                    Response.Redirect(redirectUrl);

                if(mainApply.ApplyStatus >=NFMT.Common.StatusEnum.待审核)
                    Response.Redirect(redirectUrl);

                this.txbMemo.Value = mainApply.ApplyDesc;
                this.curApply = mainApply;

                //获取当前出库申请明细
                //NFMT.WareHouse.BLL.StockOutApplyDetailBLL detailBLL = new NFMT.WareHouse.BLL.StockOutApplyDetailBLL();
                //result = detailBLL.Load(user, apply.StockOutApplyId);
                //if(result.ResultStatus!=0)
                //    Response.Redirect(redirectUrl);

                //List<NFMT.WareHouse.Model.StockOutApplyDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.StockOutApplyDetail>;
                //if(details==null)
                //    Response.Redirect(redirectUrl);

                NFMT.Common.SelectModel select = stockOutApplyBLL.GetOutApplySelectedSelect(1, 100, "sto.StockId desc",string.Empty,curStockOutApply.StockOutApplyId);
                result = stockOutApplyBLL.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.JsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

                this.contractExpander1.CurContract = con;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "InvoiceReplaceFinalList.aspx";

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

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

                //获取替临终票
                int replaceId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out replaceId))
                    Response.Redirect(redirectUrl);

                NFMT.Invoice.BLL.BusinessInvoiceBLL businessInvoiceBLL = new NFMT.Invoice.BLL.BusinessInvoiceBLL();
                result = businessInvoiceBLL.Get(user, replaceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Invoice.Model.BusinessInvoice replaceInvoice = result.ReturnValue as NFMT.Invoice.Model.BusinessInvoice;
                if (replaceInvoice == null || replaceInvoice.BusinessInvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curReplaceInvoice = replaceInvoice;

                //获取发票主体
                NFMT.Operate.BLL.InvoiceBLL invoiceBLL = new NFMT.Operate.BLL.InvoiceBLL();
                result = invoiceBLL.Get(user, replaceInvoice.InvoiceId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Operate.Model.Invoice invoice = result.ReturnValue as NFMT.Operate.Model.Invoice;
                if (invoice == null || invoice.InvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curInvoice = invoice;

                //获取临票
                result = businessInvoiceBLL.Get(user, replaceInvoice.RefInvoiceId);
                if(result.ResultStatus!=0)
                    Response.Redirect(redirectUrl);

                NFMT.Invoice.Model.BusinessInvoice provisionalInvoice = result.ReturnValue as NFMT.Invoice.Model.BusinessInvoice;
                if (provisionalInvoice == null || provisionalInvoice.BusinessInvoiceId <= 0)
                    Response.Redirect(redirectUrl);

                this.curProvisionalInvoice = provisionalInvoice;

                //获取合约与子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, replaceInvoice.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);

                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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);

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.Buy)
                    invoiceDirection = NFMT.Invoice.InvoiceDirectionEnum.收取;

                this.curContract = contract;

                this.SelectJson(replaceInvoice, invoiceDirection);

                this.navigation1.Routes.Add("替临终票列表", redirectUrl);
                this.navigation1.Routes.Add(string.Format("替临终票修改", invoiceDirection), string.Empty);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }
Beispiel #19
0
        private void SetContractData()
        {
            NFMT.Contract.Model.ContractSub sub = null;
            NFMT.Contract.Model.Contract contract = null;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.IsNullOrEmpty(this.RedirectUrl)?Request.UrlReferrer.AbsolutePath:this.RedirectUrl;

            #region 初始化合约实体
            if (this.CurContractSub != null && this.CurContractSub.SubId > 0)
                sub = this.CurContractSub;
            else
            {
                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, this.subContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Response.Redirect(redirectUrl);
            }
            if (this.CurContract != null && this.CurContract.ContractId > 0)
                contract = this.CurContract;
            else
            {
                //获取合约
                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.Get(user, this.contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId <= 0)
                    Response.Redirect(redirectUrl);
            }
            #endregion

            #region 赋值

            //我方抬头
            NFMT.Contract.BLL.SubCorporationDetailBLL corpDetailBLL = new NFMT.Contract.BLL.SubCorporationDetailBLL();
            result = corpDetailBLL.Load(user, sub.SubId, true);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            List<NFMT.Contract.Model.SubCorporationDetail> inCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
            if (inCorps != null && inCorps.Count > 0)
            {
                this.spnInCorpNames.InnerHtml = string.Empty;
                foreach (NFMT.Contract.Model.SubCorporationDetail inCorp in inCorps)
                {
                    this.spnInCorpNames.InnerHtml += string.Format("[{0}]", inCorp.CorpName);
                }
            }

            //对方抬头
            result = corpDetailBLL.Load(user, sub.SubId, false);
            if (result.ResultStatus != 0)
                Response.Redirect(redirectUrl);
            List<NFMT.Contract.Model.SubCorporationDetail> outCorps = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
            if (outCorps != null && outCorps.Count > 0)
            {
                this.spnOutCorpNames.InnerHtml = string.Empty;
                foreach (NFMT.Contract.Model.SubCorporationDetail outCorp in outCorps)
                {
                    this.spnOutCorpNames.InnerHtml += string.Format("[{0}]", outCorp.CorpName);
                }
            }

            //子合约编号
            this.spnSubNo.InnerHtml = sub.SubNo;

            //品种
            NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == contract.AssetId);
            if (asset != null && asset.AssetId > 0)
                this.spnAsset.InnerHtml = asset.AssetName;

            //签订数量
            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.ToString(), mu.MUName);

            //执行最终日
            this.spnPeriodE.InnerHtml = sub.ContractPeriodE.ToString("yyyy-MM-dd");

            //升贴水
            NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
            if (currency != null && currency.CurrencyId > 0)
                this.spnPremium.InnerHtml = string.Format("{0}{1}", sub.Premium.ToString("0.00"), currency.CurrencyName);
            #endregion
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 37, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.执行完成, NFMT.Common.OperateEnum.执行完成撤销 });

                int contractId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect("ContractList.aspx");
                if (!int.TryParse(Request.QueryString["id"], out contractId))
                    Response.Redirect("ContractList.aspx");

                this.navigation1.Routes.Add("合约列表", "ContractList.aspx");
                this.navigation1.Routes.Add("合约查看", string.Empty);

                //类型
                this.hidTradeDirection.Value = ((int)NFMT.Data.StyleEnum.TradeDirection).ToString();
                this.hidTradeBorder.Value = ((int)NFMT.Data.StyleEnum.TradeBorder).ToString();
                this.hidContractLimit.Value = ((int)NFMT.Data.StyleEnum.ContractLimit).ToString();
                //this.hidPriceMode.Value = ((int)NFMT.Data.StyleEnum.PriceMode).ToString();
                this.hidMarginMode.Value = ((int)NFMT.Data.StyleEnum.MarginMode).ToString();
                this.hidValueRateType.Value = ((int)NFMT.Data.StyleEnum.ValueRateType).ToString();
                this.hidDiscountBase.Value = ((int)NFMT.Data.StyleEnum.DiscountBase).ToString();
                this.hidWhoDoPrice.Value = ((int)NFMT.Data.StyleEnum.WhoDoPrice).ToString();
                this.hidSummaryPrice.Value = ((int)NFMT.Data.StyleEnum.SummaryPrice).ToString();

                user = Utility.UserUtility.CurrentUser;

                contractBLL = new NFMT.Contract.BLL.ContractBLL();
                NFMT.Contract.BLL.ContractDetailBLL detailBLL = new NFMT.Contract.BLL.ContractDetailBLL();
                NFMT.Contract.BLL.ContractPriceBLL priceBLL = new NFMT.Contract.BLL.ContractPriceBLL();
                NFMT.Contract.BLL.ContractCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();
                NFMT.Contract.BLL.ContractDeptBLL deptBLL = new NFMT.Contract.BLL.ContractDeptBLL();

                //获取合约
                NFMT.Common.ResultModel result = contractBLL.Get(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curContract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (curContract == null)
                    Response.Redirect("ContractList.aspx");

                //获取明细
                result = detailBLL.GetDetailByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curContraceDetail = result.ReturnValue as NFMT.Contract.Model.ContractDetail;
                if (curContraceDetail == null)
                    Response.Redirect("ContractList.aspx");

                //获取价格
                result = priceBLL.GetPriceByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curContractPrice = result.ReturnValue as NFMT.Contract.Model.ContractPrice;
                if (curContractPrice == null)
                    Response.Redirect("ContractList.aspx");

                //获取公司列表
                //我方公司
                result = corpBLL.LoadCorpListByContractId(user, contractId, true);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curInCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                if (curInCorps == null || curInCorps.Count == 0)
                    Response.Redirect("ContractList.aspx");

                //对方公司
                result = corpBLL.LoadCorpListByContractId(user, contractId, false);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curOutCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                if (curOutCorps == null || curOutCorps.Count == 0)
                    Response.Redirect("ContractList.aspx");

                //执行部门
                result = deptBLL.LoadDeptByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");

                curDepts = result.ReturnValue as List<NFMT.Contract.Model.ContractDept>;

                foreach (var obj in curOutCorps)
                {
                    if (curOutCorps.IndexOf(obj) > 0)
                        curOutCorpsString += ",";
                    curOutCorpsString += obj.CorpId.ToString();
                }

                foreach (var obj in this.curInCorps)
                {
                    if (curInCorps.IndexOf(obj) > 0)
                        this.curInCorpsString += ",";
                    curInCorpsString += obj.CorpId.ToString();
                }

                foreach (var obj in this.curDepts)
                {
                    if (curDepts.IndexOf(obj) > 0)
                        curDeptsString += ",";
                    curDeptsString += obj.DeptId.ToString();
                }

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

                this.attach1.BusinessIdValue = this.curContract.ContractId;
            }
        }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "StockReceiptList.aspx";

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

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

                //获取仓库回执
                int receiptId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out receiptId))
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.BLL.StockReceiptBLL receiptBLL = new NFMT.WareHouse.BLL.StockReceiptBLL();
                result = receiptBLL.Get(user, receiptId);

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

                NFMT.WareHouse.Model.StockReceipt stockReceipt = result.ReturnValue as NFMT.WareHouse.Model.StockReceipt;
                if (stockReceipt == null || stockReceipt.ReceiptId <= 0)
                    Response.Redirect(redirectUrl);

                this.curStockReceipt = stockReceipt;

                //获取合约与子合约
                NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBLL.Get(user, stockReceipt.ContractSubId);
                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.curContractSub = sub;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

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

                this.navigation1.Routes.Add("回执列表", redirectUrl);
                this.navigation1.Routes.Add("回执明细", string.Empty);

                string sids = "0";
                //获取回执明细
                NFMT.WareHouse.BLL.StockReceiptDetailBLL detailBLL = new NFMT.WareHouse.BLL.StockReceiptDetailBLL();
                result = detailBLL.Load(user, stockReceipt.ReceiptId,NFMT.Common.StatusEnum.已作废);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                List<NFMT.WareHouse.Model.StockReceiptDetail> details = result.ReturnValue as List<NFMT.WareHouse.Model.StockReceiptDetail>;
                if (details == null)
                    Response.Redirect(redirectUrl);

                if (details.Count > 0)
                    sids = string.Empty;
                for (int i = 0; i < details.Count; i++)
                {
                    NFMT.WareHouse.Model.StockReceiptDetail detail = details[i];
                    sids += detail.StockLogId.ToString();
                    if (i < details.Count - 1)
                        sids += ",";
                }

                NFMT.Common.SelectModel select = receiptBLL.GetReceiptingStockListSelect(1, 100, "sto.StockId desc", sub.SubId, receiptId, sids);
                result = receiptBLL.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.curReceiptingJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string json = serializer.Serialize(stockReceipt);
                this.hidModel.Value = json;
            }
        }
Beispiel #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = "StockReceiptList.aspx";

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

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

                //获取合约与子合约
                int subId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out subId))
                    Response.Redirect(redirectUrl);

                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.curContractSub = sub;

                //合约币种
                NFMT.Data.Model.Currency currency = NFMT.Data.BasicDataProvider.Currencies.FirstOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                if (currency != null && currency.CurrencyId > 0)
                    this.currencyName = currency.CurrencyName;
                //合约计量单位
                NFMT.Data.Model.MeasureUnit mu = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == sub.UnitId);
                if (mu != null && mu.MUId > 0)
                    this.MUName = mu.MUName;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

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

                this.navigation1.Routes.Add("回执列表", redirectUrl);
                this.navigation1.Routes.Add("合约列表", "StockReceiptContractList.aspx");
                this.navigation1.Routes.Add("回执新增", string.Empty);

                tradeDirString = ((NFMT.Contract.TradeDirectionEnum)contract.TradeDirection).ToString();

                //ReceiptingStockList Json
                NFMT.WareHouse.BLL.StockReceiptBLL bll = new NFMT.WareHouse.BLL.StockReceiptBLL();

                int receiptId = 0;
                string sids = "0";
                NFMT.Common.SelectModel select = bll.GetReceiptingStockListSelect(1, 100, "sto.StockId desc", sub.SubId, receiptId, sids);
                result = bll.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.curReceiptingJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

            }
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                this.curUser = user;

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

                string redirectUrl = "OrderList.aspx";
                this.navigation1.Routes.Add("制单指令列表", redirectUrl);
                this.navigation1.Routes.Add("制单指令修改", string.Empty);

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

                //获取制单指令
                NFMT.Document.BLL.DocumentOrderBLL orderBLL = new NFMT.Document.BLL.DocumentOrderBLL();
                result = orderBLL.Get(user, orderId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Document.Model.DocumentOrder order = result.ReturnValue as NFMT.Document.Model.DocumentOrder;
                if (order == null || order.OrderId <= 0)
                    Response.Redirect(redirectUrl);

                this.curOrder = order;

                NFMT.Document.BLL.DocumentOrderDetailBLL detailBLL = new NFMT.Document.BLL.DocumentOrderDetailBLL();
                result = detailBLL.GetByOrderId(user, order.OrderId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Document.Model.DocumentOrderDetail orderDetail = result.ReturnValue as NFMT.Document.Model.DocumentOrderDetail;
                if (orderDetail == null || orderDetail.DetailId <= 0)
                    Response.Redirect(redirectUrl);

                this.curOrderDetail = orderDetail;

                NFMT.Contract.BLL.ContractSubBLL subBll = new NFMT.Contract.BLL.ContractSubBLL();
                result = subBll.Get(user, order.SubId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.ContractId == 0)
                    Response.Redirect(redirectUrl);
                this.curSub = sub;

                NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

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

                NFMT.Data.Model.Asset ass = NFMT.Data.BasicDataProvider.Assets.First(temp => temp.AssetId == con.AssetId);
                this.curAsset = ass;

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == con.UnitId);
                this.curUnit = muContract;

                NFMT.Data.Model.Currency cur = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(temp => temp.CurrencyId == sub.SettleCurrency);
                this.curCurrency = cur;

                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curSub;
                this.contractExpander1.RedirectUrl = redirectUrl;

                NFMT.Common.SelectModel select = orderBLL.GetNoStockOrderSelect(1, 100, "dos.DetailId desc", order.OrderId);
                result = orderBLL.Load(user, select);
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                if (dt != null)
                {
                    foreach (System.Data.DataRow dr in dt.Rows)
                    {
                        if (ass != null)
                            dr["AssetName"] = ass.AssetName;
                        if (muSub != null)
                            dr["MUName"] = muSub.MUName;
                    }
                }

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

                //attach
                this.attach1.BusinessIdValue = this.curOrder.OrderId;
            }
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.VerificationUtility ver = new Utility.VerificationUtility();
            ver.JudgeOperate(this.Page, 37, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

            user = Utility.UserUtility.CurrentUser;
            string redirectUrl = "ContractOutStockList.aspx";

            this.navigation1.Routes.Add("合约列表", "ContractList.aspx");
            this.navigation1.Routes.Add("库存列表", redirectUrl);
            this.navigation1.Routes.Add("合约明细", string.Empty);

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

            int contractId = 0;
            if (subId <= 0 && (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out contractId) || contractId <= 0))
                Utility.JsUtility.WarmAlert(this, "合约序号错误", redirectUrl);

            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
            NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
            NFMT.Contract.BLL.ContractDetailBLL detailBLL = new NFMT.Contract.BLL.ContractDetailBLL();
            NFMT.Contract.BLL.ContractPriceBLL priceBLL = new NFMT.Contract.BLL.ContractPriceBLL();
            NFMT.Contract.BLL.ContractCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();
            NFMT.Contract.BLL.ContractDeptBLL deptBLL = new NFMT.Contract.BLL.ContractDeptBLL();

            //主合约进入
            if (contractId > 0)
            {
                result = contractBLL.Get(user, contractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId <= 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                if (contract.CreateFrom != (int)NFMT.Common.CreateFromEnum.销售合约库存创建)
                    Utility.JsUtility.WarmAlert(this, "合约创建来源不正确", redirectUrl);

                this.curContract = contract;

                result = subBLL.GetSubByContractId(user, contract.ContractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                this.curSub = sub;
            }
            else if (subId > 0)//子合约进入
            {
                result = subBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                this.curSub = sub;

                result = contractBLL.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId <= 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                if (contract.CreateFrom != (int)NFMT.Common.CreateFromEnum.销售合约库存创建)
                    Utility.JsUtility.WarmAlert(this, "合约创建来源不正确", redirectUrl);

                this.curContract = contract;
            }

            //获取合约品种
            NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == this.curContract.AssetId);
            if (asset == null || asset.AssetId <= 0)
                Utility.JsUtility.WarmAlert(this, "合约品种获取失败", redirectUrl);

            this.curAsset = asset;

            //获取明细
            result = detailBLL.GetDetailByContractId(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约明细获取失败", redirectUrl);
            curContraceDetail = result.ReturnValue as NFMT.Contract.Model.ContractDetail;
            if (curContraceDetail == null)
                Utility.JsUtility.WarmAlert(this, "合约明细获取失败", redirectUrl);

            //获取价格
            result = priceBLL.GetPriceByContractId(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约价格获取失败", redirectUrl);
            curContractPrice = result.ReturnValue as NFMT.Contract.Model.ContractPrice;
            if (curContractPrice == null)
                Utility.JsUtility.WarmAlert(this, "合约价格获取失败", redirectUrl);

            //获取公司列表
            //我方公司
            result = corpBLL.LoadCorpListByContractId(user, this.curContract.ContractId, true);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约我方抬头获取失败", redirectUrl);
            List<NFMT.Contract.Model.ContractCorporationDetail> inCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
            if (inCorps == null || inCorps.Count == 0)
                Utility.JsUtility.WarmAlert(this, "合约我方抬头获取失败", redirectUrl);

            //对方公司
            result = corpBLL.LoadCorpListByContractId(user, this.curContract.ContractId, false);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约对方抬头获取失败", redirectUrl);
            List<NFMT.Contract.Model.ContractCorporationDetail> outCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
            if (outCorps == null || outCorps.Count == 0)
                Utility.JsUtility.WarmAlert(this, "合约对方抬头获取失败", redirectUrl);

            //执行部门
            result = deptBLL.LoadDeptByContractId(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");

            List<NFMT.Contract.Model.ContractDept> depts = result.ReturnValue as List<NFMT.Contract.Model.ContractDept>;

            foreach (var obj in outCorps)
            {
                if (outCorps.IndexOf(obj) > 0)
                    curOutCorpsString += ",";
                curOutCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in inCorps)
            {
                if (inCorps.IndexOf(obj) > 0)
                    this.curInCorpsString += ",";
                curInCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in depts)
            {
                if (depts.IndexOf(obj) > 0)
                    curDeptsString += ",";
                curDeptsString += obj.DeptId.ToString();
            }

            //合约类型
            NFMT.Contract.BLL.ContractTypeDetailBLL contractTypeBLL = new NFMT.Contract.BLL.ContractTypeDetailBLL();
            result = contractTypeBLL.LoadContractTypesById(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                this.WarmAlert("合约类型获取失败", redirectUrl);
            List<NFMT.Contract.Model.ContractTypeDetail> contractTypes = result.ReturnValue as List<NFMT.Contract.Model.ContractTypeDetail>;
            if (contractTypes == null)
                this.WarmAlert("合约类型获取失败", redirectUrl);
            foreach (NFMT.Contract.Model.ContractTypeDetail contractType in contractTypes)
            {
                if (contractTypes.IndexOf(contractType) > 0)
                    this.curContractTypesString += ",";

                this.curContractTypesString += contractType.ContractType.ToString();
            }

            int pageIndex = 1;
            int pageSize = 100;
            string orderStr = string.Empty;
            NFMT.WareHouse.BLL.StockLogBLL stockLogBLL = new NFMT.WareHouse.BLL.StockLogBLL();
            NFMT.Common.SelectModel select = stockLogBLL.GetContractOutStockSelect(pageIndex, pageSize, orderStr, this.curSub.SubId);
            result = stockLogBLL.Load(user, select, NFMT.Common.DefaultValue.ClearAuth);
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            this.SelectedJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

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

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

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

                string redirectUrl = "InterestContractList.aspx";
                this.navigation1.Routes.Add("利息结算列表", "InterestList.aspx");
                this.navigation1.Routes.Add("质押合约列表", redirectUrl);
                this.navigation1.Routes.Add("利息结算新增", string.Empty);

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

                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                result = contractSubBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Utility.JsUtility.WarmAlert(this.Page, "获取子合约失败", redirectUrl);

                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                result = contractBLL.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                //获取合约
                contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取合约失败", redirectUrl);

                this.txbContractNo.Value = contract.OutContractNo;

                if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.采购)
                    strTradeDirection = "采购";
                else if (contract.TradeDirection == (int)NFMT.Contract.TradeDirectionEnum.销售)
                    strTradeDirection = "销售";
                else
                    strTradeDirection = string.Empty;

                this.txbTradeDirection.Value = strTradeDirection;

                NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.SingleOrDefault(a => a.AssetId == contract.AssetId);
                this.txbAssetName.Value = asset.AssetName;

                //获取子合约中的币种
                cur = NFMT.Data.BasicDataProvider.Currencies.SingleOrDefault(a => a.CurrencyId == sub.SettleCurrency);
                if (cur == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取币种失败", redirectUrl);

                //获取合约单位
                mu = NFMT.Data.BasicDataProvider.MeasureUnits.SingleOrDefault(a => a.MUId == sub.UnitId);
                if (mu == null)
                    Utility.JsUtility.WarmAlert(this.Page, "获取单位失败", redirectUrl);

                //获取合约抬头
                //我方
                NFMT.Contract.BLL.SubCorporationDetailBLL subCorporationDetailBLL = new NFMT.Contract.BLL.SubCorporationDetailBLL();
                result = subCorporationDetailBLL.Load(user, subId, true);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                subInCorpDetails = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                if (subInCorpDetails == null || !subInCorpDetails.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取我方抬头失败", redirectUrl);

                this.txbInCorpId.Value = subInCorpDetails.FirstOrDefault(a => a.IsDefaultCorp == true).CorpName;

                //对方
                result = subCorporationDetailBLL.Load(user, subId, false);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this.Page, result.Message, redirectUrl);

                subOutCorpDetails = result.ReturnValue as List<NFMT.Contract.Model.SubCorporationDetail>;
                if (subInCorpDetails == null || !subInCorpDetails.Any())
                    Utility.JsUtility.WarmAlert(this.Page, "获取我方抬头失败", redirectUrl);

                this.txbOutCorpId.Value = subOutCorpDetails.FirstOrDefault(a => a.IsDefaultCorp == true).CorpName;

                //获取剩余本金
                NFMT.DoPrice.BLL.InterestBLL interestBLL = new NFMT.DoPrice.BLL.InterestBLL();
                result = interestBLL.GetLastCapitalBySubId(user, subId);
                if (result.ResultStatus == 0 && result.ReturnValue != null)
                {
                    decimal.TryParse(result.ReturnValue.ToString(), out this.lastPayCapital);
                }

                //获取剩余净重
                result = interestBLL.GetLastNetWeightBySubId(user, subId);
                if (result.ResultStatus == 0 && result.ReturnValue != null)
                {
                    decimal.TryParse(result.ReturnValue.ToString(), out this.netWeight);
                }

                this.SelectJson(sub.SubId);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string redirectUrl = string.Format("{0}DoPrice/PricingApplyDelayList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 105, 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);

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

                //获取合约与子合约
                int subId = 0;

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

                NFMT.DoPrice.BLL.PricingApplyDelayBLL pricingApplyDelayBLL = new NFMT.DoPrice.BLL.PricingApplyDelayBLL();
                result = pricingApplyDelayBLL.Get(user, delayId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                pricingApplyDelay = result.ReturnValue as NFMT.DoPrice.Model.PricingApplyDelay;
                if (pricingApplyDelay == null)
                    Response.Redirect(redirectUrl);

                pricingApplyId = pricingApplyDelay.PricingApplyId;

                NFMT.DoPrice.BLL.PricingApplyBLL pricingApplyBLL = new NFMT.DoPrice.BLL.PricingApplyBLL();
                result = pricingApplyBLL.Get(user, pricingApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                 pricingApply = result.ReturnValue as NFMT.DoPrice.Model.PricingApply;
                if (pricingApply == null)
                    Response.Redirect(redirectUrl);

                subId = pricingApply.SubContractId;

                NFMT.Operate.BLL.ApplyBLL applyBLL = new NFMT.Operate.BLL.ApplyBLL();
                result = applyBLL.Get(user, pricingApply.ApplyId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                if (apply == null)
                    Response.Redirect(redirectUrl);

                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.curContractSub = sub;

                NFMT.Contract.BLL.ContractBLL conBLL = new NFMT.Contract.BLL.ContractBLL();
                result = conBLL.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.curContract = contract;

                currencyId = curContract.SettleCurrency;
                assetId = curContract.AssetId;
                mUId = curContract.UnitId;

                NFMT.Data.Model.MeasureUnit muContract = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == contract.UnitId);
                NFMT.Data.Model.MeasureUnit muSub = NFMT.Data.BasicDataProvider.MeasureUnits.Single(temp => temp.MUId == sub.UnitId);

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

                alreadyPricingWeight = Convert.ToDecimal(result.ReturnValue.ToString());

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

                this.contractExpander1.CurContract = this.curContract;
                this.contractExpander1.CurContractSub = this.curContractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;
            }
        }