public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json; charset=utf-8";

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

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

            NFMT.Contract.BLL.SubPriceBLL subPriceBLL = new NFMT.Contract.BLL.SubPriceBLL();
            result = subPriceBLL.GetPriceBySubId(user, subContractId);
            if (result.ResultStatus != 0)
                context.Response.End();

            NFMT.Contract.Model.SubPrice subPrice = result.ReturnValue as NFMT.Contract.Model.SubPrice;
            if (subPrice == null)
                context.Response.End();

            NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
            result = contractSubBLL.Get(user, subContractId);
            if (result.ResultStatus != 0)
                context.Response.End();

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

            if (contractSub.PriceMode == (int)NFMT.Contract.PriceModeEnum.点价)
                context.Response.Write(subPrice.AlmostPrice);
            else if (contractSub.PriceMode == (int)NFMT.Contract.PriceModeEnum.定价)
                context.Response.Write(subPrice.FixedPrice);
            else
                context.Response.Write(0);
        }
Пример #2
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;
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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;
            }
        }