protected void Page_Load(object sender, EventArgs e)
        {
            string         GUID        = Request.QueryString["guid"];
            var            temp        = ChargeBackGuaranteeTemp.GetChargeBackGuaranteeTempListByGUID(GUID);
            List <decimal> RealPayList = new List <decimal>();
            List <string>  RemarkList  = new List <string>();

            this.tdWidth.Value  = "210";
            this.tdHeight.Value = "99";
            List <int> IDList = temp.Select(p => p.HistoryID).ToList();

            if (IDList.Count == 0)
            {
                Response.End();
                return;
            }
            if (!IsPostBack)
            {
                int RoomID             = 0;
                int DefaultChargeManID = 0;
                var list = ViewRoomFeeHistory.GetViewRoomFeeHistoryListByIDs(IDList);
                if (list.Length == 0)
                {
                    Response.End();
                    return;
                }
                RoomID             = list[0].RoomID;
                DefaultChargeManID = list[0].DefaultChargeManID;
                var historyfees = list;
                var newlist     = new List <RoomFeeModule>();
                foreach (var item in temp)
                {
                    var roomFeeModule      = new RoomFeeModule();
                    var viewRoomFeeHistory = list.FirstOrDefault(p => p.HistoryID == item.HistoryID);
                    if (viewRoomFeeHistory != null)
                    {
                        roomFeeModule.HistoryID   = viewRoomFeeHistory.HistoryID;
                        roomFeeModule.ChargeTime  = viewRoomFeeHistory.ChargeTime;
                        roomFeeModule.RealCost    = item.RealPay;
                        roomFeeModule.ChargeName  = viewRoomFeeHistory.ChargeName;
                        roomFeeModule.PrintNumber = viewRoomFeeHistory.PrintNumber;
                        roomFeeModule.Remark      = item.Remark;
                        roomFeeModule.ChargeMan   = viewRoomFeeHistory.ChargeMan;
                        this.money += roomFeeModule.RealCost;
                        newlist.Add(roomFeeModule);
                    }
                }
                this.rptProject.DataSource = newlist;
                this.rptProject.DataBind();
                var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: 0);
                if (project != null)
                {
                    this.tdRemark.Value = project.PrintCancelNote;
                    if (project.IsDefinePrintSize)
                    {
                        this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                        this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                    }
                    else
                    {
                        this.tdWidth.Value  = "210";
                        this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                    }
                    this.FirstTitle = project.PayPrintTitle;
                    this.SubTitle   = project.PayPrintSubTitle;
                    if (string.IsNullOrEmpty(this.FirstTitle))
                    {
                        this.FirstTitle = WebUtil.GetCompany(this.Context).CompanyName;
                    }
                    this.tdFirstTitle.InnerHtml = this.FirstTitle;
                    if (string.IsNullOrEmpty(this.SubTitle))
                    {
                        this.SubTitle = "付款单据";
                    }
                    this.tdSubTitle.InnerText = this.SubTitle;
                    this.FullName             = project.FullName + "-" + project.Name;
                }
                RoomPhoneRelation relation = null;
                if (DefaultChargeManID > 0)
                {
                    relation = RoomPhoneRelation.GetRoomPhoneRelation(DefaultChargeManID);
                }
                if (relation == null)
                {
                    relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID: 0);
                }
                if (relation != null)
                {
                    this.OwnerName = relation.RelationName;
                }
                GetInfo(RoomID);
                SetInfo();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int.TryParse(Request.QueryString["TempID"], out TempHistoryID);
                int.TryParse(Request.QueryString["PayServiceID"], out PayServiceID);
                int.TryParse(Request.QueryString["PrintID"], out PrintID);
                this.tdWidth.Value  = "210";
                this.tdHeight.Value = "99";
                var newlist = new List <RoomFeeModule>();
                if (PrintID > 0)
                {
                    var payservice = Foresight.DataAccess.PayService.GetPayServiceByPrintID(PrintID);
                    PayServiceID        = payservice != null ? payservice.ID : PayServiceID;
                    printRoomFeeHistory = PrintRoomFeeHistory.GetPrintRoomFeeHistory(PrintID);
                    var historys = Foresight.DataAccess.RoomFeeHistory.GetRoomFeeHistoryByPrintID(PrintID);
                    int RoomID   = 0;
                    if (historys.Length > 0)
                    {
                        foreach (var item in historys)
                        {
                            var roomFeeModule = new RoomFeeModule();
                            roomFeeModule.HistoryID   = item.HistoryID;
                            roomFeeModule.ChargeTime  = item.ChargeTime;
                            roomFeeModule.RealCost    = item.RealCost;
                            roomFeeModule.ChargeName  = item.ChargeFeeSummaryName;
                            roomFeeModule.PrintNumber = item.PrintNumber;
                            roomFeeModule.Remark      = item.BackGuaranteeRemark;
                            roomFeeModule.ChargeMan   = item.ChargeMan;
                            this.money += roomFeeModule.RealCost;
                            newlist.Add(roomFeeModule);
                        }
                        RoomID = historys[0].RoomID;
                    }
                    else
                    {
                        var temhistorys = Foresight.DataAccess.TempRoomFeeHistory.GetTempRoomFeeHistorysByPrintID(PrintID);
                        if (temhistorys.Length > 0)
                        {
                            foreach (var item in temhistorys)
                            {
                                var roomFeeModule = new RoomFeeModule();
                                roomFeeModule.HistoryID   = item.TempHistoryID;
                                roomFeeModule.ChargeTime  = item.ChargeTime;
                                roomFeeModule.RealCost    = item.RealCost;
                                roomFeeModule.ChargeName  = item.ChargeFeeSummaryName;
                                roomFeeModule.PrintNumber = item.PrintNumber;
                                roomFeeModule.Remark      = item.BackGuaranteeRemark;
                                roomFeeModule.ChargeMan   = item.ChargeMan;
                                this.money += roomFeeModule.RealCost;
                                newlist.Add(roomFeeModule);
                            }
                            RoomID = temhistorys[0].RoomID;
                        }
                    }
                    var project = Foresight.DataAccess.Project.GetProject(RoomID);
                    if (project != null)
                    {
                        if (project.IsDefinePrintSize)
                        {
                            this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                            this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                        }
                        else
                        {
                            this.tdWidth.Value  = "210";
                            this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                        }
                        this.FirstTitle = project.PayPrintTitle;
                        this.SubTitle   = project.PayPrintSubTitle;
                    }
                    if (string.IsNullOrEmpty(this.FirstTitle))
                    {
                        this.FirstTitle = WebUtil.GetCompany(this.Context).CompanyName;
                    }
                    this.tdFirstTitle.InnerHtml = this.FirstTitle;
                    if (string.IsNullOrEmpty(this.SubTitle))
                    {
                        this.SubTitle = "付款单据";
                    }
                    this.tdSubTitle.InnerText = this.SubTitle;
                }
                else
                {
                    var temphistory = Foresight.DataAccess.TempRoomFeeHistory.GetTempRoomFeeHistory(TempHistoryID);
                    if (temphistory == null)
                    {
                        Response.End();
                        return;
                    }
                    List <decimal> RealPayList = new List <decimal>();
                    List <string>  RemarkList  = new List <string>();

                    TempRoomFeeHistory[] list = new TempRoomFeeHistory[] { temphistory };
                    foreach (var item in list)
                    {
                        var roomFeeModule = new RoomFeeModule();
                        roomFeeModule.HistoryID   = item.TempHistoryID;
                        roomFeeModule.ChargeTime  = item.ChargeTime;
                        roomFeeModule.RealCost    = item.RealCost;
                        roomFeeModule.ChargeName  = item.ChargeFeeSummaryName;
                        roomFeeModule.PrintNumber = item.PrintNumber;
                        roomFeeModule.Remark      = item.BackGuaranteeRemark;
                        roomFeeModule.ChargeMan   = item.ChargeMan;
                        this.money += roomFeeModule.RealCost;
                        newlist.Add(roomFeeModule);
                    }

                    var project = Foresight.DataAccess.Project.GetProject(list[0].RoomID);
                    if (project != null)
                    {
                        printRoomFeeHistory.Remark       = project.PrintCancelNote;
                        printRoomFeeHistory.RoomFullName = project.FullName;
                        var basic = Foresight.DataAccess.ViewRoomBasic.GetViewRoomBasicByRoomID(list[0].RoomID);
                        if (basic != null)
                        {
                            printRoomFeeHistory.RoomFullName  = printRoomFeeHistory.RoomFullName + "-" + project.Name;
                            printRoomFeeHistory.RoomOwnerName = basic.RelationName;
                            this.OwnerName = basic.RelationName;
                        }
                        if (project.IsDefinePrintSize)
                        {
                            this.tdWidth.Value  = project.PrintWidth > 0 ? project.PrintWidth.ToString() : "210";
                            this.tdHeight.Value = project.PrintHeight > 0 ? project.PrintHeight.ToString() : WebUtil.GetPrintHeight().ToString();
                        }
                        else
                        {
                            this.tdWidth.Value  = "210";
                            this.tdHeight.Value = WebUtil.GetPrintHeight(project.PrintType).ToString();
                        }
                        this.FirstTitle = project.PayPrintTitle;
                        this.SubTitle   = project.PayPrintSubTitle;
                    }
                    if (string.IsNullOrEmpty(this.FirstTitle))
                    {
                        this.FirstTitle = WebUtil.GetCompany(this.Context).CompanyName;
                    }
                    this.tdFirstTitle.InnerHtml = this.FirstTitle;
                    if (string.IsNullOrEmpty(this.SubTitle))
                    {
                        this.SubTitle = "付款单据";
                    }
                    this.tdSubTitle.InnerText = this.SubTitle;
                    GetInfo(list[0].RoomID);
                }
                this.rptProject.DataSource = newlist;
                this.rptProject.DataBind();
                SetInfo();
            }
        }