protected void Page_Load(object sender, EventArgs e) { this.tdWidth.Value = "210"; this.tdHeight.Value = "99"; int PrintID = 0; int.TryParse(Request.QueryString["PrintID"], out PrintID); string IDs = Request.QueryString["IDs"]; List <int> IDList = new List <int>(); List <int> RoomIDList = new List <int>(); if (PrintID == 0) { if (string.IsNullOrEmpty(IDs)) { Response.End(); return; } } if (!string.IsNullOrEmpty(IDs)) { IDList = JsonConvert.DeserializeObject <List <int> >(IDs); } if (!IsPostBack) { int RoomID = 0; int ContractID = 0; int DefaultChargeManID = 0; if (PrintID > 0) { var list = ViewRoomFeeHistory.GetViewRoomFeeHistoryListByIDs(0, IDList, PrintID); if (list.Length > 0) { RoomID = list[0].RoomID; ContractID = list[0].ContractID; DefaultChargeManID = list[0].DefaultChargeManID; } this.rptProject.DataSource = list; this.rptProject.DataBind(); printRoomFeeHistory = PrintRoomFeeHistory.GetPrintRoomFeeHistory(PrintID); } else { var list = ViewTempRoomFeeHistory.GetViewTempRoomFeeHistoryListByIDs(IDList); if (list.Length > 0) { RoomID = list[0].RoomID; } foreach (var item in list) { money += item.ChargeFee; TotalCost += item.Cost; } var historyfees = list; this.rptProject.DataSource = historyfees; this.rptProject.DataBind(); } var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: ContractID); if (project != null) { this.tdRemark.Value = project.PrintNote; this.tdFirstTitle.Value = project.PrintTitle; 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.FullName = project.FullName + "-" + project.Name; } RoomPhoneRelation relation = null; if (DefaultChargeManID > 0) { relation = RoomPhoneRelation.GetRoomPhoneRelation(DefaultChargeManID); } if (relation == null) { relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID); } if (relation != null) { this.OwnerName = relation.RelationName; } if (PrintID <= 0) { GetInfo(RoomID); } SetInfo(); } }
protected void Page_Load(object sender, EventArgs e) { CanPrintCheque = new Utility.SiteConfig().IsWriteChequeOn; this.tdWidth.Value = "210"; this.tdHeight.Value = "99"; int.TryParse(Request.QueryString["PrintID"], out PrintID); string IDs = Request.QueryString["IDs"]; List <int> IDList = new List <int>(); List <int> RoomIDList = new List <int>(); List <int> ContractIDList = new List <int>(); List <string> OwnerNameList = new List <string>(); if (PrintID == 0) { if (string.IsNullOrEmpty(IDs)) { Response.End(); return; } } if (!string.IsNullOrEmpty(IDs)) { IDList = JsonConvert.DeserializeObject <List <int> >(IDs); } if (!IsPostBack) { if (PrintID > 0) { var list = ViewRoomFeeHistory.GetViewRoomFeeHistoryListByIDs(0, IDList, PrintID); if (list.Length > 0) { RoomIDList = list.Select(p => p.RoomID).Distinct().ToList(); } else { Response.End(); return; } this.rptProject.DataSource = list; this.rptProject.DataBind(); OwnerNameList = list.Where(p => !string.IsNullOrEmpty(p.DefaultChargeManName)).Select(p => p.DefaultChargeManName).Distinct().ToList(); printRoomFeeHistory = PrintRoomFeeHistory.GetPrintRoomFeeHistory(PrintID); } else { var list = ViewTempRoomFeeHistory.GetViewTempRoomFeeHistoryListByIDs(IDList); if (list.Length > 0) { RoomIDList = list.Select(p => p.RoomID).Distinct().ToList(); ContractIDList = list.Where(p => p.ContractID > 0).Select(p => p.ContractID).Distinct().ToList(); } foreach (var item in list) { money += item.RealCost; TotalCost += item.Cost; } this.rptProject.DataSource = list; this.rptProject.DataBind(); OwnerNameList = list.Where(p => !string.IsNullOrEmpty(p.DefaultChargeManName)).Select(p => p.DefaultChargeManName).Distinct().ToList(); } RoomID = RoomIDList.Count > 0 ? RoomIDList[0] : 0; ContractID = ContractIDList.Count > 0 ? ContractIDList[0] : 0; if (RoomIDList.Count > 0) { RoomID = RoomIDList[0]; } var project = Foresight.DataAccess.Project.GetProjectByID(ID: RoomID, ContractID: ContractID); var relation = Foresight.DataAccess.RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomID, ContractID); DefaultRelationID = relation != null ? relation.ID : 0; string AllParentID = string.Empty; if (project != null) { AllParentID = project.AllParentID; this.tdRemark.Value = project.PrintNote; this.FirstTitle = project.PrintTitle; this.SubTitle = project.PrintSubTitle; this.PrintFont = project.PrintFont; this.IsPrintCount = project.IsPrintCount; this.IsPrintNote = project.IsPrintNote; this.IsPrintCost = project.IsPrintCost; this.IsPrintDiscount = project.IsPrintDiscount; this.IsPrintRoomNo = project.IsPrintRoomNo; this.IsPrintTotalRealCost = project.IsPrintTotalRealCost; this.IsPrintRealCost = project.IsPrintRealCost; this.IsPrintMonthCount = project.IsPrintMonthCount; this.LogoPath = project.LogoPath; this.LogoWidth = project.LogoWidth; this.LogoHeight = project.LogoHeight; this.IsPrintUnitPrice = project.IsPrintUnitPrice; 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.FullName = project.FullName + "-" + project.Name; this.PrintChargeTypeCount = project.PrintChargeTypeCount; } if (this.IsPrintCount) { this.ColumnCount++; } if (this.IsPrintNote) { this.ColumnCount++; } if (this.IsPrintCost) { this.ColumnCount++; } if (this.IsPrintDiscount) { this.ColumnCount++; } if (this.IsPrintRoomNo) { this.ColumnCount++; } if (this.IsPrintTotalRealCost) { this.ColumnCount++; } if (this.IsPrintRealCost) { this.ColumnCount++; } if (this.IsPrintMonthCount) { this.ColumnCount++; } if (this.IsPrintUnitPrice) { this.ColumnCount++; } if (string.IsNullOrEmpty(this.FirstTitle)) { this.FirstTitle = WebUtil.GetCompany(this.Context).CompanyName; } this.tdFirstTitle.Value = this.FirstTitle; if (string.IsNullOrEmpty(this.SubTitle)) { this.SubTitle = "收款单据"; } this.tdSubTitle.InnerText = this.SubTitle; var configList = SysConfig.Get_SysConfigListByProjectIDList(MinProjectID: RoomID, MaxProjectID: RoomID, ConfigName: SysConfigNameDefine.RealCostCouZhengOn); bool isCouZhengOn = SysConfig.IsCouZhengOn(configList, AllParentID); if (isCouZhengOn) { this.ShowWeiShu = true; } if (PrintID <= 0) { GetInfo(RoomID, isCouZhengOn); } SetInfo(RoomID, isCouZhengOn); if (OwnerNameList.Count > 0) { if (OwnerNameList.Count <= 3) { this.OwnerName = string.Join(",", OwnerNameList.ToArray()); } else { this.OwnerName = OwnerNameList[0]; } } } }