Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                VerificationUtility ver = new VerificationUtility();
                ver.JudgeOperate(this.Page, 52, new List<OperateEnum>() { OperateEnum.录入 });

                string redirectUrl = "PayApplyList.aspx";

                this.navigation1.Routes.Add("付款申请列表", redirectUrl);
                this.navigation1.Routes.Add("付款申请合约列表", "PayApplyContractList.aspx");
                this.navigation1.Routes.Add("付款申请新增", string.Empty);

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

                UserModel user = UserUtility.CurrentUser;
                this.curUser = user;

                //子合约
                ContractSubBLL subBll = new ContractSubBLL();
                ResultModel result = subBll.Get(user, subId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);
                ContractSub sub = result.ReturnValue as ContractSub;
                if (sub == null || sub.ContractId == 0)
                    Response.Redirect(redirectUrl);

                this.curSub = sub;

                //合约
                ContractBLL bll = new ContractBLL();
                result = bll.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.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = sub;
                this.contractExpander1.RedirectUrl = redirectUrl;

                //局域变量赋值
                this.PayMatterStyle = (int)StyleEnum.付款事项;
                this.PayModeStyle = (int)StyleEnum.PayMode;

                PayApplyBLL payApplyBLL = new PayApplyBLL();
                result = payApplyBLL.GetContractBalancePayment(user, sub.SubId, 0);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                BalancePaymentValue = (decimal)result.ReturnValue;
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserModel user = UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                SelectModel select = null;
                ResultModel result = null;
                BaseBLL bll = null;

                int pageIndex = 1, pageSize = 99999999, rt = 0;
                string orderStr = string.Empty;
                if (string.IsNullOrEmpty(Request.QueryString["rt"]) || !int.TryParse(Request.QueryString["rt"], out rt) || rt <= 0)
                {
                    Response.Write("报表导出错误");
                    Response.End();
                }

                ReportType reportType = (ReportType)rt;

                DateTime startDate = DefaultValue.DefaultTime;
                DateTime endDate = DefaultValue.DefaultTime;

                if (string.IsNullOrEmpty(Request.QueryString["sd"]) || !DateTime.TryParse(Request.QueryString["sd"], out startDate))
                    startDate = DefaultValue.DefaultTime;

                if (string.IsNullOrEmpty(Request.QueryString["ed"]) || !DateTime.TryParse(Request.QueryString["ed"], out endDate))
                    endDate = DefaultValue.DefaultTime;
                else
                    endDate = endDate.AddDays(1);

                string contractNo = Request.QueryString["cn"];

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

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

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

                switch (reportType)
                {
                    case ReportType.StockReport:

                        #region StockReport
                        StockBLL stockBLL = new StockBLL();
                        bll = stockBLL;

                        DateTime stockDateBegin = DefaultValue.DefaultTime;
                        DateTime stockDateEnd = DefaultValue.DefaultTime;
                        if (string.IsNullOrEmpty(Request.QueryString["sdb"]) || !DateTime.TryParse(Request.QueryString["sdb"], out stockDateBegin))
                            stockDateBegin = DefaultValue.DefaultTime;

                        if (string.IsNullOrEmpty(Request.QueryString["sde"]) || !DateTime.TryParse(Request.QueryString["sde"], out stockDateEnd))
                            stockDateEnd = DefaultValue.DefaultTime;
                        else
                            stockDateEnd = stockDateEnd.AddDays(1);

                        string stockName = Request.QueryString["sn"];

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

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

                        int stockStatus = 0;
                        if (string.IsNullOrEmpty(Request.QueryString["s"]) || int.TryParse(Request.QueryString["s"], out stockStatus))
                            stockStatus = 0;

                        orderStr = "sto.StockId desc";

                        select = stockBLL.GetStockReportSelect(pageIndex, pageSize, orderStr, stockName, stockDateBegin, stockDateEnd, corpId, stockStatus, saleInfo);
                        #endregion

                        break;
                    case ReportType.StockLogReport:

                        #region StockLogReport
                        StockLogBLL stockLogBLL = new StockLogBLL();
                        bll = stockLogBLL;

                        string refNo = Request.QueryString["rn"];

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

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

                        orderStr = "sl.StockLogId desc";
                        select = stockLogBLL.GetStockLogReportSelect(pageIndex, pageSize, orderStr, refNo, logType, customsType, assetId, startDate, endDate);
                        #endregion

                        break;
                    case ReportType.PricingLogReport:

                        #region PricingLogReport
                        PricingBLL pricingBLL = new PricingBLL();
                        bll = pricingBLL;

                        DateTime pricingstartDate = DefaultValue.DefaultTime;
                        DateTime pricingendDate = DefaultValue.DefaultTime;

                        if (string.IsNullOrEmpty(Request.QueryString["s"]) || !DateTime.TryParse(Request.QueryString["s"], out pricingstartDate))
                            pricingstartDate = DefaultValue.DefaultTime;

                        if (string.IsNullOrEmpty(Request.QueryString["e"]) || !DateTime.TryParse(Request.QueryString["e"], out pricingendDate))
                            pricingendDate = DefaultValue.DefaultTime;
                        else
                            pricingendDate = pricingendDate.AddDays(1);

                        contractNo = Request.QueryString["c"];

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

                        orderStr = "p.PricingId desc";
                        select = pricingBLL.GetDoPriceReportSelect(pageIndex, pageSize, orderStr, contractNo, pricingassetId, pricingstartDate, pricingendDate);
                        #endregion

                        break;
                    case ReportType.CustomsReport:

                        #region CustomsReport
                        CustomsClearanceBLL customsClearanceBLL = new CustomsClearanceBLL();
                        bll = customsClearanceBLL;

                        DateTime customstartDate = DefaultValue.DefaultTime;
                        DateTime customendDate = DefaultValue.DefaultTime;

                        if (string.IsNullOrEmpty(Request.QueryString["s"]) || !DateTime.TryParse(Request.QueryString["s"], out customstartDate))
                            customstartDate = DefaultValue.DefaultTime;

                        if (string.IsNullOrEmpty(Request.QueryString["e"]) || !DateTime.TryParse(Request.QueryString["e"], out customendDate))
                            customendDate = DefaultValue.DefaultTime;
                        else
                            customendDate = customendDate.AddDays(1);

                        string customRefNo = Request.QueryString["r"];

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

                        orderStr = "cc.CustomsId desc";
                        select = customsClearanceBLL.GetCustomReportSelect(pageIndex, pageSize, orderStr, customsCorpId, customRefNo, customstartDate, customendDate);
                        #endregion

                        break;
                    case ReportType.ContractProgress:

                        #region ContractProgress
                        int tradeBorder = 0;
                        if (string.IsNullOrEmpty(Request.QueryString["tb"]) || !int.TryParse(Request.QueryString["tb"], out tradeBorder))
                            tradeBorder = 0;

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

                        ContractBLL contractBLL = new ContractBLL();
                        bll = contractBLL;
                        orderStr = "con.ContractId desc";
                        select = contractBLL.GetContractProgressSelect(pageIndex, pageSize, orderStr, startDate, endDate, contractNo, inCorpId, outCorpId, tradeBorder, tradeDirection);

                        #endregion

                        break;
                    case ReportType.BusInvReport:

                        #region BusInvReport
                        BusinessInvoiceBLL businessInvoiceBLL = new BusinessInvoiceBLL();
                        bll = businessInvoiceBLL;

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

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

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

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

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

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

                        orderStr = "inv.InvoiceId desc";
                        select = businessInvoiceBLL.GetBusInvReportSelect(pageIndex, pageSize, orderStr, inCorpId, outCorpId, invType, BusInvassetId, startDate, endDate);

                        #endregion

                        break;

                    case ReportType.CashLogReport:

                        #region CashLogReport
                        FundsLogBLL fundsLogBLL = new FundsLogBLL();
                        bll = fundsLogBLL;
                        orderStr = "fl.FundsLogId desc";
                        select = fundsLogBLL.GetFundsLogReportSelect(pageIndex, pageSize, orderStr,startDate,endDate, inCorpId, outCorpId,logType);
                        #endregion

                        break;
                    case ReportType.FundsCurrent:

                        #region FundsCurrent
                        FundsBLL fundsBLL = new FundsBLL();
                        bll = fundsBLL;

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

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

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

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

                        orderStr = "corp.CorpName asc";
                        select = fundsBLL.GetFundsCurrentReportSelect(pageIndex, pageSize, orderStr, inCorpId, outCorpId, startDate, endDate);

                        #endregion

                        break;
                    case ReportType.StockReceiptReport:

                        #region StockReceipt
                        StockReceiptBLL stockReceiptBLL = new StockReceiptBLL();
                        bll = stockReceiptBLL;

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

                        refNo = Request.QueryString["refNo"];

                        orderStr = "sis.RefId desc";
                        select = stockReceiptBLL.GetReceiptReportSelect(pageIndex, pageSize, orderStr, stockReceiptAssetId, refNo);

                        #endregion

                        break;
                    case ReportType.GrossProfitReport:

                        #region GrossProfitReport
                        BusinessInvoiceDetailBLL businessInvoiceDetailBLL = new BusinessInvoiceDetailBLL();
                        bll = businessInvoiceDetailBLL;

                        refNo = string.Empty;
                        refNo = Request.QueryString["refNo"];

                        string cardNo = Request.QueryString["cardNo"];

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

                        orderStr = "st.StockId desc";
                        select = businessInvoiceDetailBLL.GetReportSelect(pageIndex, pageSize, orderStr, refNo, brandId, cardNo);

                        #endregion

                        break;
                    case ReportType.FinancingPledgeApplyReport:

                        #region FinancingPledgeApplyReport
                        PledgeApplyBLL pledgeApplyBLL = new PledgeApplyBLL();
                        bll = pledgeApplyBLL;

                        string pledgeApplyNo = Request.QueryString["paNo"];
                        refNo = Request.QueryString["refNo"];

                        DateTime beginDate = DefaultValue.DefaultTime;

                        if (!string.IsNullOrEmpty(Request.QueryString["fromDate"]))
                        {
                            if (!DateTime.TryParse(Request.QueryString["fromDate"], out beginDate))
                                beginDate = DefaultValue.DefaultTime;
                        }
                        if (!string.IsNullOrEmpty(Request.QueryString["toDate"]))
                        {
                            if (!DateTime.TryParse(Request.QueryString["toDate"], out endDate))
                                endDate = DefaultValue.DefaultTime;
                            else
                                endDate = endDate.AddDays(1);
                        }
                        int status = -1, bankId = -1;
                        assetId = -1;
                        if (!string.IsNullOrEmpty(Request.QueryString["status"]))
                            int.TryParse(Request.QueryString["status"], out status);

                        if (!string.IsNullOrEmpty(Request.QueryString["assetId"]))
                            int.TryParse(Request.QueryString["assetId"], out assetId);

                        if (!string.IsNullOrEmpty(Request.QueryString["bankId"]))
                            int.TryParse(Request.QueryString["bankId"], out bankId);

                        orderStr = "pa.PledgeApplyId desc";
                        select = pledgeApplyBLL.GetSelectModel(pageIndex, pageSize, orderStr, beginDate, endDate, bankId, assetId, status, pledgeApplyNo, refNo);

                        #endregion

                        break;
                    case ReportType.FinancingRepoApplyReport:

                        #region FinancingRepoApplyReport
                        RepoApplyBLL repoApplyBLL = new RepoApplyBLL();
                        bll = repoApplyBLL;

                        pledgeApplyNo = Request.QueryString["paNo"];
                        string repoApplyIdNo = Request.QueryString["reNo"];
                        refNo = Request.QueryString["refNo"];

                        beginDate = DefaultValue.DefaultTime;

                        if (!string.IsNullOrEmpty(Request.QueryString["fromDate"]))
                        {
                            if (!DateTime.TryParse(Request.QueryString["fromDate"], out beginDate))
                                beginDate = DefaultValue.DefaultTime;
                        }
                        if (!string.IsNullOrEmpty(Request.QueryString["toDate"]))
                        {
                            if (!DateTime.TryParse(Request.QueryString["toDate"], out endDate))
                                endDate = DefaultValue.DefaultTime;
                            else
                                endDate = endDate.AddDays(1);
                        }

                        status = -1;
                        if (!string.IsNullOrEmpty(Request.QueryString["s"]))
                            int.TryParse(Request.QueryString["s"], out status);

                        orderStr = "ra.RepoApplyId desc";
                        select = repoApplyBLL.GetSelectModel(pageIndex, pageSize, orderStr, status, pledgeApplyNo, repoApplyIdNo, refNo, beginDate, endDate);

                        #endregion

                        break;

                    case ReportType.BankPledgeReport:

                        #region BankPledgeReport
                        PledgeApplyStockDetailBLL pledgeApplyStockDetailBLL = new PledgeApplyStockDetailBLL();
                        bll = pledgeApplyStockDetailBLL;

                        refNo = Request.QueryString["refNo"];

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

                        beginDate = DefaultValue.DefaultTime;

                        if (!string.IsNullOrEmpty(Request.QueryString["s"]))
                        {
                            if (!DateTime.TryParse(Request.QueryString["s"], out beginDate))
                                beginDate = DefaultValue.DefaultTime;
                        }
                        if (!string.IsNullOrEmpty(Request.QueryString["e"]))
                        {
                            if (!DateTime.TryParse(Request.QueryString["e"], out endDate))
                                endDate = DefaultValue.DefaultTime;
                            else
                                endDate = endDate.AddDays(1);
                        }

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

                        orderStr = "bank.BankName desc";
                        select = pledgeApplyStockDetailBLL.GetBankPledgeReportSelect(pageIndex, pageSize, orderStr, refNo, bankId, beginDate, endDate, repoInfo);

                        #endregion

                        break;
                    case ReportType.FundsCurrentByStock:

                        #region FundsCurrentByStock
                        fundsBLL = new FundsBLL();
                        bll = fundsBLL;

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

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

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

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

                        orderStr = "corp.CorpName asc";
                        select = fundsBLL.GetFundsCurrentByStockReportSelect(pageIndex, pageSize, orderStr, inCorpId, outCorpId, startDate, endDate);

                        #endregion

                        break;
                    default:
                        Response.Write("报表报导错误");
                        Response.End();
                        break;
                }

                result = bll.Load(user, select);

                if (result.ResultStatus != 0 || result.ReturnValue == null)
                {
                    Response.Write("报表报导错误");
                    Response.End();
                }

                DataTable dt = result.ReturnValue as DataTable;
                if (dt == null)
                {
                    Response.Write("报表报导错误");
                    Response.End();
                }

                #region
                ////生成一个新的文件名用全球唯一标识符 (GUID)来标识
                //string newpath = Server.MapPath(".") + @"\Files\Excel\" + Guid.NewGuid() + ".xlsx";

                ////调用的模板文件
                //System.IO.FileInfo mode = new System.IO.FileInfo(Server.MapPath("~/Report/Model/StockReport.xlsx"));
                //mode.IsReadOnly = false;

                //Excel.Application app = new Excel.Application();
                //if (app == null)
                //{
                //    return;
                //}
                //app.Application.DisplayAlerts = false;
                //app.Visible = false;

                //if (mode.Exists)
                //{
                //    Excel.Workbook tworkbook;
                //    Object missing = System.Reflection.Missing.Value;

                //    app.Workbooks.Add(missing);
                //    //调用模板
                //    tworkbook = app.Workbooks.Open(mode.FullName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
                //    Excel.Worksheet tworksheet = (Excel.Worksheet)tworkbook.Sheets[1];
                //    Excel.Range r = tworksheet.get_Range("A2", missing);
                //    r = r.get_Resize(dt.Rows.Count, 13);
                //    string[,] objData = new string[dt.Rows.Count, 13];

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

                //        objData[i, 0] = ((DateTime)dr["StockDate"]).ToShortDateString();
                //        objData[i, 1] = dr["CorpName"].ToString();
                //        objData[i, 2] = dr["RefNo"].ToString();
                //        objData[i, 3] = dr["AssetName"].ToString();
                //        objData[i, 4] = dr["CurGrossAmount"].ToString();
                //        objData[i, 5] = dr["CurNetAmount"].ToString();
                //        objData[i, 6] = dr["MUName"].ToString();
                //        objData[i, 7] = dr["BrandName"].ToString();
                //        objData[i, 8] = dr["DPName"].ToString();
                //        objData[i, 9] = dr["PaperNo"].ToString();
                //        objData[i, 10] = dr["CardNo"].ToString();
                //        objData[i, 11] = dr["CustomsTypeName"].ToString();
                //        objData[i, 12] = dr["StatusName"].ToString();
                //    }
                //    r.Value = objData;

                //    tworksheet.SaveAs(newpath, missing, missing, missing, missing, missing, missing, missing, missing, missing);

                //    tworkbook.Close(false, mode.FullName, missing);
                //    app.Workbooks.Close();
                //    app.Quit();
                //}
                #endregion

                string modelPath = Server.MapPath(".") + @"\Model\";
                //string newPath = bll.CreateExcel(dt, modelPath, filePath, reportType);
                DataTable dtSource = bll.SetExcelRangeData(dt);

                ExcelUtility.ExportExcel(modelPath, reportType.ToString("F"), dtSource);
            }
        }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            int status = -1, outerCorp = -1;
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty;

            string contractNo = context.Request["cn"];

            DateTime beginDate = NFMT.Common.DefaultValue.DefaultTime;
            DateTime endDate = NFMT.Common.DefaultValue.DefaultTime;

            if (!string.IsNullOrEmpty(context.Request["db"]))
            {
                if(!DateTime.TryParse(context.Request["db"],out beginDate))
                    beginDate = NFMT.Common.DefaultValue.DefaultTime;
            }
            if (!string.IsNullOrEmpty(context.Request["de"]))
            {
                if (!DateTime.TryParse(context.Request["de"], out endDate))
                    endDate = NFMT.Common.DefaultValue.DefaultTime;
                else
                    endDate.AddDays(1);
            }

            if (!string.IsNullOrEmpty(context.Request["s"]))
                int.TryParse(context.Request["s"], out status);

            if (!string.IsNullOrEmpty(context.Request["ci"]))
                int.TryParse(context.Request["ci"], out outerCorp);//状态查询条件

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

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

                switch (sortDataField)
                {
                    case "ContractId":
                        sortDataField = "con.ContractId";
                        break;
                    case "ContractDate":
                        sortDataField = "con.ContractDate";
                        break;
                    case "ContractNo":
                        sortDataField = "con.ContractNo";
                        break;
                    case "OutContractNo":
                        sortDataField = "con.OutContractNo";
                        break;
                    case "TradeDirectionName":
                        sortDataField = "con.TradeDirection";
                        break;
                    case "InCorpName":
                        sortDataField = "inCorp.CorpName";
                        break;
                    case "OutCorpName":
                        sortDataField = "outCorp.CorpName";
                        break;
                    case "AssetName":
                        sortDataField = "con.AssetId";
                        break;
                    case "ContractWeight":
                        sortDataField = "con.SignAmount";
                        break;
                    case "PriceModeName":
                        sortDataField = "con.PriceMode";
                        break;
                    case "StatusName":
                        sortDataField = "con.ContractStatus";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            ContractBLL contractBLL = new ContractBLL();
            NFMT.Common.SelectModel select = contractBLL.GetSelectModel(pageIndex, pageSize, orderStr,beginDate,endDate,contractNo,outerCorp,status);
            NFMT.Common.ResultModel result = contractBLL.Load(user, select);

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

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

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

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

            context.Response.Write(postData);
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            VerificationUtility ver = new VerificationUtility();
            ver.JudgeOperate(this.Page, 52, new List<OperateEnum>() { OperateEnum.修改 });

            if (!IsPostBack)
            {
                UserModel user = UserUtility.CurrentUser;
                this.curUser = user;

                this.PayMatterStyle = (int)StyleEnum.付款事项;
                this.PayModeStyle = (int)StyleEnum.PayMode;

                string redirectUrl = "PayApplyList.aspx";

                this.navigation1.Routes.Add("付款申请列表", redirectUrl);
                this.navigation1.Routes.Add("付款申请明细", string.Empty);

                int applyId = 0, payApplyId = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["aid"]))
                    int.TryParse(Request.QueryString["aid"], out applyId);
                if (applyId <= 0 && (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out payApplyId)))
                    this.WarmAlert("付款申请序号错误", redirectUrl);

                ResultModel result = new ResultModel();

                //获取付款申请
                PayApplyBLL payApplyBLL = new PayApplyBLL();
                if (applyId > 0)
                    result = payApplyBLL.GetByApplyId(user, applyId);
                else
                    result = payApplyBLL.Get(user, payApplyId);

                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款申请失败", redirectUrl);

                PayApply payApply = result.ReturnValue as PayApply;
                if (payApply == null || payApply.PayApplyId <= 0)
                    this.WarmAlert("获取付款申请失败", redirectUrl);

                this.curPayApply = payApply;

                //获取主申请
                ApplyBLL applyBLL = new ApplyBLL();
                result = applyBLL.Get(user, payApply.ApplyId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取主申请失败", redirectUrl);

                Apply apply = result.ReturnValue as Apply;
                if (apply == null || apply.ApplyId <= 0)
                    this.WarmAlert("获取主申请失败", redirectUrl);

                this.curApply = apply;

                //获取合约付款申请
                ContractPayApplyBLL contractPayApplyBLL = new ContractPayApplyBLL();
                result = contractPayApplyBLL.GetByPayApplyId(user, payApply.PayApplyId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                ContractPayApply contractPayApply = result.ReturnValue as ContractPayApply;
                if (contractPayApply == null || contractPayApply.RefId <= 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

                //获取子合约
                ContractSubBLL subBll = new ContractSubBLL();
                result = subBll.Get(user, contractPayApply.ContractSubId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取子合约失败", redirectUrl);
                ContractSub sub = result.ReturnValue as ContractSub;
                if (sub == null || sub.ContractId == 0)
                    this.WarmAlert("获取子合约失败", redirectUrl);

                this.curSub = sub;

                //合约
                ContractBLL bll = new ContractBLL();
                result = bll.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取合约失败", redirectUrl);

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

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

                SelectModel select = payApplyBLL.GetPayApplyStocksSelect(1, 100, "spa.RefId desc", payApply.PayApplyId);
                result = payApplyBLL.Load(user, select, DefaultValue.ClearAuth);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款库存列表失败", redirectUrl);

                DataTable dt = result.ReturnValue as DataTable;
                if (dt == null)
                    this.WarmAlert("获取付款库存列表失败", redirectUrl);

                this.StockDetailsJson = JsonConvert.SerializeObject(dt, new DataTableConverter());

                //付款明细
                PaymentBLL paymentBLL = new PaymentBLL();
                select = paymentBLL.GetSelectModel(1, 100, "pay.PaymentId desc", DefaultValue.DefaultTime, DefaultValue.DefaultTime, 0, 0, (int)StatusEnum.已生效, payApply.PayApplyId);
                result = paymentBLL.Load(user, select, DefaultValue.ClearAuth);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款明细失败", redirectUrl);

                dt = result.ReturnValue as DataTable;
                if (dt == null)
                    this.WarmAlert("获取付款明细失败", redirectUrl);
                this.PaymentJson = JsonConvert.SerializeObject(dt, new DataTableConverter());

                //审核实体
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                string json = serializer.Serialize(apply);
                this.hidModel.Value = json;

                FundsStyleEnum fundsStyle = (FundsStyleEnum)payApply.PayApplySource;
                result = payApplyBLL.GetAuditInfo(user, payApply.ApplyId, fundsStyle);
                if (result.ResultStatus != 0)
                    this.WarmAlert("获取付款申请审核信息失败", redirectUrl);

                //this.txbAuditInfo.InnerHtml = result.ReturnValue.ToString();

                if (apply.ApplyStatus != StatusEnum.已录入 && apply.ApplyStatus != StatusEnum.待审核 && apply.ApplyStatus != StatusEnum.审核拒绝
                    && apply.ApplyStatus != StatusEnum.已撤返)
                {
                    //this.jqxAuditInfoExpander.Visible = false;
                }
                else if (apply.ApplyStatus == StatusEnum.已生效 || apply.ApplyStatus == StatusEnum.已完成)
                {

                }
            }
        }