コード例 #1
0
        private void GetInfo(int RoomID)
        {
            if (printRoomFeeHistory == null)
            {
                printRoomFeeHistory = new PrintRoomFeeHistory();
            }
            int    OrderNumberID = 0;
            string PrintNumber   = Foresight.DataAccess.PrintRoomFeeHistory.GetLastestPrintNumber(Foresight.DataAccess.OrderTypeNameDefine.chargebackfee.ToString(), RoomID, out OrderNumberID);

            printRoomFeeHistory.PrintNumber     = PrintNumber;
            printRoomFeeHistory.OrderNumberID   = OrderNumberID;
            printRoomFeeHistory.Cost            = money;
            printRoomFeeHistory.CostCapital     = Tools.CmycurD(money);
            printRoomFeeHistory.RealCost        = money;
            printRoomFeeHistory.PreChargeMoney  = 0;
            printRoomFeeHistory.ChargeBackMoney = 0;
            printRoomFeeHistory.ChargeMan       = WebUtil.GetUser(this.Context).RealName;
            printRoomFeeHistory.ChargeTime      = DateTime.Now;
            printRoomFeeHistory.RealMoneyCost1  = money;
            printRoomFeeHistory.RealMoneyCost2  = 0;
            printRoomFeeHistory.DiscountMoney   = 0;
            printRoomFeeHistory.AddMan          = WebUtil.GetUser(this.Context).RealName;
            printRoomFeeHistory.AddTime         = DateTime.Now;
            printRoomFeeHistory.ChageType1      = 0;
        }
コード例 #2
0
        private void SetInfo(int RoomID, bool isCouZhengOn)
        {
            this.hdWeiShu.Value     = "0.00";
            this.tdWeiShu.InnerHtml = "0.00";
            decimal finalweishu = PrintRoomFeeHistory.GetRoomWeiShuBalance(printRoomFeeHistory.ID, RoomID);

            if (printRoomFeeHistory.ID > 0)
            {
                this.tdWeiShu.InnerHtml = (finalweishu > 0 ? finalweishu : 0).ToString("F2");
                this.hdWeiShu.Value     = (finalweishu - (printRoomFeeHistory.WeiShuMore - printRoomFeeHistory.WeiShuConsume)).ToString();
            }
            else
            {
                decimal weishumore = printRoomFeeHistory.RealCost - money;
                if (finalweishu >= (1 - weishumore))
                {
                    printRoomFeeHistory.WeiShuMore    = 0;
                    printRoomFeeHistory.WeiShuConsume = (1 - weishumore);
                    if (isCouZhengOn)
                    {
                        printRoomFeeHistory.RealCost       = (Math.Ceiling(money) - 1);
                        printRoomFeeHistory.RealMoneyCost1 = printRoomFeeHistory.RealCost;
                        this.hdWeiShu.Value = finalweishu.ToString("F2");
                        var final = finalweishu + (printRoomFeeHistory.WeiShuMore - printRoomFeeHistory.WeiShuConsume);
                        this.tdWeiShu.InnerHtml = final.ToString("F2");
                    }
                }
                else
                {
                    printRoomFeeHistory.WeiShuMore    = weishumore;
                    printRoomFeeHistory.WeiShuConsume = 0;
                    if (isCouZhengOn)
                    {
                        printRoomFeeHistory.RealCost       = Math.Ceiling(money);
                        printRoomFeeHistory.RealMoneyCost1 = printRoomFeeHistory.RealCost;
                        this.hdWeiShu.Value = finalweishu.ToString("F2");
                        var final = finalweishu + (printRoomFeeHistory.WeiShuMore - printRoomFeeHistory.WeiShuConsume);
                        this.tdWeiShu.InnerHtml = final.ToString("F2");
                    }
                }
            }

            this.tdPrintNumber.Value      = printRoomFeeHistory.PrintNumber;
            this.MoneyDaXie               = printRoomFeeHistory.CostCapital;
            this.TotalCost                = printRoomFeeHistory.Cost;
            this.RealCost                 = printRoomFeeHistory.RealCost;
            this.tdRealCost.InnerHtml     = printRoomFeeHistory.RealCost.ToString("F2");
            this.formatRealCost.InnerHtml = WebUtil.FormatMoney(printRoomFeeHistory.RealCost);
            this.tdPreChargeMoney.Value   = printRoomFeeHistory.PreChargeMoney.ToString();
            this.tdChargeBackMoney.Value  = printRoomFeeHistory.ChargeBackMoney.ToString();
            this.tdChargeMan.Value        = printRoomFeeHistory.ChargeMan;
            this.tdChargeTime.Value       = printRoomFeeHistory.ChargeTime.ToString("yyyy-MM-dd HH:mm:ss");
            this.tdRealMoneyCost1.Value   = printRoomFeeHistory.RealMoneyCost1 == decimal.MinValue ? "0.00" : printRoomFeeHistory.RealMoneyCost1.ToString("F2");
            this.tdRealMoneyCost2.Value   = printRoomFeeHistory.RealMoneyCost2 == decimal.MinValue ? "0.00" : printRoomFeeHistory.RealMoneyCost2.ToString("F2");
            this.tdDiscountMoney.Value    = printRoomFeeHistory.DiscountMoney.ToString();
            this.tdRemark.Value           = printRoomFeeHistory.Remark;
            this.hdOrderNumberID.Value    = printRoomFeeHistory.OrderNumberID < 0 ? "0" : printRoomFeeHistory.OrderNumberID.ToString();
        }
コード例 #3
0
        private void SaveRoomHistoryFee(ImportFee importFee, int SummaryID, SqlHelper helper, string AddMan)
        {
            PrintRoomFeeHistory printRoomFeeHistory = new PrintRoomFeeHistory();

            printRoomFeeHistory.Cost           = importFee.TotalPrice;
            printRoomFeeHistory.CostCapital    = Tools.CmycurD(printRoomFeeHistory.Cost);
            printRoomFeeHistory.RealCost       = printRoomFeeHistory.Cost;
            printRoomFeeHistory.PreChargeMoney = 0;
            printRoomFeeHistory.DiscountMoney  = 0;
            printRoomFeeHistory.RealMoneyCost1 = printRoomFeeHistory.Cost;
            printRoomFeeHistory.RealMoneyCost2 = 0;
            printRoomFeeHistory.AddMan         = AddMan;
            printRoomFeeHistory.AddTime        = DateTime.Now;
            int    OrderNumberID = 0;
            string PrintNumber   = Foresight.DataAccess.PrintRoomFeeHistory.GetLastestPrintNumber(importFee.RoomID, helper, out OrderNumberID);

            printRoomFeeHistory.PrintNumber     = PrintNumber;
            printRoomFeeHistory.OrderNumberID   = OrderNumberID;
            printRoomFeeHistory.ChargeBackMoney = 0;
            printRoomFeeHistory.ChargeTime      = DateTime.Now;
            printRoomFeeHistory.ChageType1      = 0;
            printRoomFeeHistory.IsCancel        = false;
            printRoomFeeHistory.Save(helper);
            RoomFeeHistory roomFee = new RoomFeeHistory();

            roomFee.ID                = importFee.ID;
            roomFee.RoomID            = importFee.RoomID;
            roomFee.UseCount          = importFee.TotalPoint;
            roomFee.StartTime         = importFee.StartTime;
            roomFee.EndTime           = importFee.EndTime;
            roomFee.Cost              = importFee.TotalPrice;
            roomFee.AddTime           = DateTime.Now;
            roomFee.AddUserName       = User.GetCurrentUserName();
            roomFee.IsCharged         = true;
            roomFee.ChargeID          = SummaryID;
            roomFee.IsStart           = true;
            roomFee.UnitPrice         = importFee.UnitPrice;
            roomFee.ImportFeeID       = importFee.ID;
            roomFee.ChargeFeeID       = 0;
            roomFee.ChargeFee         = 0;
            roomFee.RealCost          = roomFee.Cost;
            roomFee.Discount          = 0;
            roomFee.TotalRealCost     = roomFee.RealCost;
            roomFee.TotalDiscountCost = 0;
            roomFee.RestCost          = 0;
            roomFee.PrintID           = printRoomFeeHistory.ID;
            roomFee.ChargeTime        = DateTime.Now;
            roomFee.ChargeState       = 1;
            roomFee.IsImportFee       = true;
            roomFee.Save(helper);
        }
コード例 #4
0
        private static void SavePrintRoomFeeHistory(PrintRoomFeeHistory printRoomFeeHistory, int RoomID, decimal RealCost, string ChargeMan, SqlHelper helper, string RoomFullName, string RoomOwnerName, string Remark, string ChargeType, DateTime ChargeTime)
        {
            var    chargemoneytype = Foresight.DataAccess.ChargeMoneyType.GetChargeMoneyTypeByChargeName(ChargeType);
            int    ChargeType1     = chargemoneytype.ChargeTypeID;
            int    ChargeType2     = 0;
            int    OrderNumberID   = 0;
            string PrintNumber     = PrintRoomFeeHistory.GetLastestPrintNumber(OrderTypeNameDefine.chargefee.ToString(), RoomID, helper, out OrderNumberID);
            var    sys_ordernumber = Sys_OrderNumber.GetSys_OrderNumber(OrderNumberID, helper);

            printRoomFeeHistory.PrintNumber     = PrintNumber;
            printRoomFeeHistory.OrderNumberID   = sys_ordernumber != null ? sys_ordernumber.ID : 0;
            printRoomFeeHistory.OrderNumberType = sys_ordernumber != null ? sys_ordernumber.ChargeType : 1;
            decimal PreChargeMoney  = 0;
            decimal ChargeBackMoney = 0;
            decimal RealMoneyCost1  = RealCost;
            decimal RealMoneyCost2  = 0;
            decimal DiscountMoney   = 0;
            decimal money           = RealCost;
            string  MoneyDaXie      = Utility.Tools.CmycurD(RealCost);

            printRoomFeeHistory.Cost            = money;
            printRoomFeeHistory.CostCapital     = MoneyDaXie;
            printRoomFeeHistory.RealCost        = RealCost;
            printRoomFeeHistory.PreChargeMoney  = PreChargeMoney;
            printRoomFeeHistory.ChargeBackMoney = ChargeBackMoney;
            printRoomFeeHistory.RealMoneyCost1  = RealMoneyCost1;
            printRoomFeeHistory.RealMoneyCost2  = RealMoneyCost2;
            printRoomFeeHistory.DiscountMoney   = DiscountMoney;
            printRoomFeeHistory.ChargeMan       = ChargeMan;
            printRoomFeeHistory.ChargeTime      = ChargeTime;
            printRoomFeeHistory.Remark          = Remark;
            printRoomFeeHistory.ChageType1      = ChargeType1;
            printRoomFeeHistory.ChageType2      = ChargeType2;
            if (printRoomFeeHistory.AddTime == DateTime.MinValue)
            {
                printRoomFeeHistory.AddTime = DateTime.Now;
            }
            printRoomFeeHistory.WeiShuMore    = 0;
            printRoomFeeHistory.WeiShuConsume = 0;
            printRoomFeeHistory.RoomFullName  = RoomFullName;
            printRoomFeeHistory.RoomOwnerName = RoomOwnerName;
            printRoomFeeHistory.Save(helper);
        }
コード例 #5
0
ファイル: return.aspx.cs プロジェクト: sd009896/CustomerMall
        private void SavePrintRoomFeeHistory(PrintRoomFeeHistory printRoomFeeHistory, int RoomID, decimal RealCost, string ChargeMan, SqlHelper helper, string RoomFullName, string RoomOwnerName)
        {
            int      ChargeType1     = 7;
            int      ChargeType2     = 0;
            int      OrderNumberID   = 0;
            string   PrintNumber     = Foresight.DataAccess.PrintRoomFeeHistory.GetLastestPrintNumber(Foresight.DataAccess.OrderTypeNameDefine.chargefee.ToString(), RoomID, helper, out OrderNumberID);
            decimal  PreChargeMoney  = 0;
            decimal  ChargeBackMoney = 0;
            decimal  RealMoneyCost1  = RealCost;
            decimal  RealMoneyCost2  = 0;
            decimal  DiscountMoney   = 0;
            decimal  money           = RealCost;
            string   MoneyDaXie      = Tools.CmycurD(RealCost);
            DateTime ChargeTime      = DateTime.Now;
            string   Remark          = "汇收银支付";

            printRoomFeeHistory.PrintNumber     = PrintNumber;
            printRoomFeeHistory.OrderNumberID   = OrderNumberID;
            printRoomFeeHistory.Cost            = money;
            printRoomFeeHistory.CostCapital     = MoneyDaXie;
            printRoomFeeHistory.RealCost        = RealCost;
            printRoomFeeHistory.PreChargeMoney  = PreChargeMoney;
            printRoomFeeHistory.ChargeBackMoney = ChargeBackMoney;
            printRoomFeeHistory.RealMoneyCost1  = RealMoneyCost1;
            printRoomFeeHistory.RealMoneyCost2  = RealMoneyCost2;
            printRoomFeeHistory.DiscountMoney   = DiscountMoney;
            printRoomFeeHistory.ChargeMan       = ChargeMan;
            printRoomFeeHistory.ChargeTime      = ChargeTime;
            printRoomFeeHistory.Remark          = Remark;
            printRoomFeeHistory.ChageType1      = ChargeType1;
            printRoomFeeHistory.ChageType2      = ChargeType2;
            if (printRoomFeeHistory.AddTime == DateTime.MinValue)
            {
                printRoomFeeHistory.AddTime = DateTime.Now;
            }
            printRoomFeeHistory.WeiShuMore    = 0;
            printRoomFeeHistory.WeiShuConsume = 0;
            printRoomFeeHistory.RoomFullName  = RoomFullName;
            printRoomFeeHistory.RoomOwnerName = RoomOwnerName;
            printRoomFeeHistory.Save(helper);
        }
コード例 #6
0
        public static string SaveRoomFee(string tradeno, string Remark, string ChargeType, int OrderID = 0)
        {
            //var history_count = Foresight.DataAccess.RoomFeeHistory.GetRoomFeeHistoryCountByTradeNo(tradeno, OrderID: OrderID);
            //if (history_count > 0)
            //{
            //    return "历史账单已存在";
            //}
            List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
            var request_list = Foresight.DataAccess.Payment_Request.GetPayment_RequestByTradeNo(tradeno, OrderID: OrderID);

            if (request_list.Length == 0)
            {
                return("Payment_Request不存在");
            }
            RoomFeeAnalysis viewroomfee   = null;
            decimal         TotalCost     = 0;
            int             RoomID        = 0;
            string          RoomFullName  = string.Empty;
            string          RoomOwnerName = string.Empty;
            string          AllParentID   = string.Empty;

            foreach (var item in request_list)
            {
                viewroomfee = RoomFeeAnalysis.GetRoomFeeAnalysisByEndTime(item.RoomFeeID, item.EndTime, relatedRequire: true);
                if (viewroomfee == null)
                {
                    continue;
                }
                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic["ID"] = viewroomfee.ID;
                dic["CalculateStartTime"] = viewroomfee.CalculateStartTime;
                dic["CalculateEndTime"]   = viewroomfee.CalculateEndTime;
                dic["TotalCost"]          = viewroomfee.TotalCost;
                dic["CalculateUnitPrice"] = viewroomfee.CalculateUnitPrice;
                dic["CalculateUseCount"]  = viewroomfee.CalculateUseCount;
                list.Add(dic);
                TotalCost    += viewroomfee.TotalCost;
                RoomID        = viewroomfee.RoomID;
                RoomFullName  = viewroomfee.FullName + "-" + viewroomfee.RoomName;
                RoomOwnerName = viewroomfee.FinalCustomerName;
                AllParentID   = viewroomfee.AllParentID;
            }
            if (list.Count == 0)
            {
                return("ViewRoomFee不存在");
            }
            var    payment = Foresight.DataAccess.Payment.GetPaymentByTradeNo(tradeno);
            string OpenID  = payment.AddUser;
            var    wuser   = Foresight.DataAccess.Wechat_User.GetWechat_UserByUserOpenID(OpenID);
            string AddMan  = (wuser != null && !string.IsNullOrEmpty(wuser.NickName)) ? wuser.NickName : OpenID;
            PrintRoomFeeHistory printRoomFeeHistory = new PrintRoomFeeHistory();
            string ChargeMan            = AddMan;
            var    ConfigName           = SysConfigNameDefine.WeixinChargeMan;
            var    sysConfigList        = SysConfig.Get_SysConfigListByProjectIDList(MinProjectID: RoomID, MaxProjectID: RoomID, ConfigName: ConfigName);
            string defaultChargeManName = SysConfig.GetConfigValueByList(sysConfigList, ConfigName, AllParentID: AllParentID);

            if (!string.IsNullOrEmpty(defaultChargeManName))
            {
                ChargeMan = defaultChargeManName;
            }
            var ViewChargeSummaryList = ViewChargeSummary.GetViewChargeSummaries().ToArray();

            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    SavePrintRoomFeeHistory(printRoomFeeHistory, RoomID, TotalCost, ChargeMan, helper, RoomFullName, RoomOwnerName, Remark, ChargeType, payment.AddTime);
                    foreach (var field in list)
                    {
                        int FeeID   = WebUtil.GetIntByStr(field["ID"].ToString());
                        var roomFee = Foresight.DataAccess.RoomFee.GetRoomFee(FeeID, helper);
                        if (roomFee == null)
                        {
                            continue;
                        }
                        DateTime CalculateStartTime = WebUtil.GetDateTimeByStr(field["CalculateStartTime"].ToString());
                        roomFee.StartTime = CalculateStartTime > DateTime.MinValue ? CalculateStartTime : DateTime.MinValue;
                        DateTime CalculateEndTime = WebUtil.GetDateTimeByStr(field["CalculateEndTime"].ToString());
                        roomFee.EndTime = CalculateEndTime > DateTime.MinValue ? CalculateEndTime : DateTime.MinValue;
                        decimal CalculateUseCount = WebUtil.GetDecimalByStr(field["CalculateUseCount"].ToString());
                        roomFee.UseCount = CalculateUseCount;
                        decimal CalculateTotalCost = WebUtil.GetDecimalByStr(field["TotalCost"].ToString());
                        roomFee.Cost      = CalculateTotalCost > 0 ? CalculateTotalCost : 0;
                        roomFee.IsCharged = true;
                        decimal CalculateUnitPrice = WebUtil.GetDecimalByStr(field["CalculateUnitPrice"].ToString());
                        roomFee.UnitPrice         = CalculateUnitPrice > 0 ? CalculateUnitPrice : 0;
                        roomFee.ChargeFee         = roomFee.ChargeFee > 0 ? roomFee.ChargeFee : 0;
                        roomFee.RealCost          = roomFee.ChargeFee > 0 ? roomFee.ChargeFee : (roomFee.Cost > decimal.MinValue ? roomFee.Cost : 0);
                        roomFee.Discount          = roomFee.Discount > 0 ? roomFee.Discount : 0;
                        roomFee.TotalRealCost     = (roomFee.TotalRealCost < 0 ? 0 : roomFee.TotalRealCost) + roomFee.RealCost;
                        roomFee.TotalDiscountCost = (roomFee.TotalDiscountCost < 0 ? 0 : roomFee.TotalDiscountCost) + roomFee.Discount;
                        decimal restcost = roomFee.Cost - roomFee.TotalDiscountCost - roomFee.TotalRealCost;
                        if (restcost < 0)
                        {
                            restcost = 0;
                        }
                        roomFee.RestCost = restcost;
                        roomFee.Remark   = Remark;
                        roomFee.Save(helper);
                        #region 收费后续操作
                        LogHelper.WriteInfo("Web.APPCode.HandlerHelper.SaveRoomFee", "收费后续操作开始");
                        Web.APPCode.HandlerHelper.SaveRoomFee(roomFee, ChargeMan, helper, printRoomFeeHistory, ViewChargeSummaryList, OpenID: OpenID);
                        LogHelper.WriteInfo("Web.APPCode.HandlerHelper.SaveRoomFee", "收费后续操作完成");
                        #endregion
                    }
                    Payment.CompletePayment(helper, TradeNo: tradeno, payment: payment);
                    helper.Commit();
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    LogHelper.WriteError("PaymentHelper.SaveRoomFee", ChargeType, ex);
                    return(ex.Message);
                }
            }
            return("Success");
        }
コード例 #7
0
        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();
            }
        }
コード例 #8
0
        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];
                    }
                }
            }
        }
コード例 #9
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();
            }
        }
コード例 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.tdWidth.Value  = "210";
         this.tdHeight.Value = "99";
         int.TryParse(Request.QueryString["PrintID"], out PrintID);
         int.TryParse(Request.QueryString["ChargeID"], out ChargeID);
         this.RoomIDs = Request.QueryString["RoomIDs"];
         List <int> RoomIDList = new List <int>();
         var        newlist    = new List <Utility.RoomFeeModule>();
         if (!string.IsNullOrEmpty(RoomIDs))
         {
             RoomIDList = JsonConvert.DeserializeObject <List <int> >(RoomIDs);
         }
         if (PrintID > 0)
         {
             printRoomFeeHistory = PrintRoomFeeHistory.GetPrintRoomFeeHistory(PrintID);
             var list = ViewRoomFeeHistory.GetPreChargeViewRoomFeeHistoryList(PrintID);
             for (int i = 0; i < list.Length; i++)
             {
                 var roomFeeModule = new Utility.RoomFeeModule();
                 roomFeeModule.ChargeFeeSummaryName    = list[i].ChargeFeeSummaryName;
                 roomFeeModule.RealCost                = list[i].RealCost;
                 roomFeeModule.ChargeFeeCurrentBalance = list[i].ChargeFeeCurrentBalance;
                 roomFeeModule.TotalRestBalance        = list[i].ChargeFeeCurrentBalance - list[i].RealCost;
                 newlist.Add(roomFeeModule);
             }
             this.money = printRoomFeeHistory.RealCost;
         }
         else
         {
             string ChargeFeeSummaryName = "退预收款";
             if (ChargeID > 0)
             {
                 var chargesummary = Foresight.DataAccess.ChargeSummary.GetChargeSummary(ChargeID);
                 ChargeFeeSummaryName = chargesummary != null ? "退" + chargesummary.Name : "退预收款";
             }
             decimal ChargeFeeCurrentBalance = Foresight.DataAccess.ViewRoomBalance.GetPreChargeBalance(RoomIDList, ChargeID);
             var     roomFeeModule           = new Utility.RoomFeeModule();
             roomFeeModule.ChargeFeeSummaryName    = ChargeFeeSummaryName;
             roomFeeModule.RealCost                = ChargeFeeCurrentBalance;
             roomFeeModule.ChargeFeeCurrentBalance = ChargeFeeCurrentBalance;
             roomFeeModule.TotalRestBalance        = 0;
             newlist.Add(roomFeeModule);
             this.money = ChargeFeeCurrentBalance;
         }
         this.rptProject.DataSource = newlist;
         this.rptProject.DataBind();
         var project = Foresight.DataAccess.Project.GetProject(RoomIDList[0]);
         if (project != null)
         {
             this.tdRemark.Value = project.PrintNote;
             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 (relation == null)
         {
             relation = RoomPhoneRelation.GetDefaultInChargeFeeRoomPhoneRelation(RoomIDList[0], 0);
         }
         if (relation != null)
         {
             this.OwnerName = relation.RelationName;
         }
         if (printRoomFeeHistory == null)
         {
             GetInfo(RoomIDList[0]);
         }
         SetInfo();
     }
 }
コード例 #11
0
ファイル: return.aspx.cs プロジェクト: sd009896/CustomerMall
        private bool WxPayComplete(HuiShouYin.Domain.Pay_Option PayOption, out string errormsg)
        {
            errormsg = string.Empty;
            string OpenID = PayOption.openid;
            var    wuser  = Foresight.DataAccess.Wechat_User.GetWechat_UserByUserOpenID(OpenID);
            string AddMan = (wuser != null && !string.IsNullOrEmpty(wuser.NickName)) ? wuser.NickName : OpenID;
            PrintRoomFeeHistory printRoomFeeHistory = new PrintRoomFeeHistory();
            var ModelList = PayOption.idlist;

            if (ModelList.Count == 0)
            {
                errormsg = "需要支付的费项不存在";
                return(false);
            }
            int    RoomID      = 0;
            string AllParentID = string.Empty;
            var    list        = new List <RoomFeeAnalysis>();

            foreach (var item in ModelList)
            {
                var viewRoomFee = RoomFeeAnalysis.GetRoomFeeAnalysisByEndTime(item.ID, Convert.ToDateTime(item.EndTime));
                if (viewRoomFee == null)
                {
                    continue;
                }
                list.Add(viewRoomFee);
                RoomID      = viewRoomFee.RoomID;
                AllParentID = viewRoomFee.AllParentID;
            }
            if (list.Count == 0)
            {
                errormsg = "需要支付的费项不存在";
                return(false);
            }
            var     ConfigName            = SysConfigNameDefine.WeixinChargeMan;
            var     sysConfigList         = SysConfig.Get_SysConfigListByProjectIDList(MinProjectID: RoomID, MaxProjectID: RoomID, ConfigName: ConfigName);
            string  ChargeMan             = SysConfig.GetConfigValueByList(sysConfigList, ConfigName, AllParentID: AllParentID);
            decimal TotalCost             = list.Sum(p => p.TotalCost);
            var     ViewChargeSummaryList = ViewChargeSummary.GetViewChargeSummaries().ToArray();

            using (SqlHelper helper = new SqlHelper())
            {
                try
                {
                    helper.BeginTransaction();
                    SavePrintRoomFeeHistory(printRoomFeeHistory, list[0].RoomID, TotalCost, ChargeMan, helper, list[0].FullName + "-" + list[0].RoomName, list[0].FinalCustomerName);
                    foreach (var field in list)
                    {
                        var roomFee = Foresight.DataAccess.RoomFee.GetRoomFee(field.ID, helper);
                        if (roomFee == null)
                        {
                            continue;
                        }
                        roomFee.StartTime         = field.CalculateStartTime > DateTime.MinValue ? field.CalculateStartTime : DateTime.MinValue;
                        roomFee.EndTime           = field.CalculateEndTime > DateTime.MinValue ? field.CalculateEndTime : DateTime.MinValue;
                        roomFee.NewEndTime        = field.NewEndTime > DateTime.MinValue ? field.NewEndTime : DateTime.MinValue;
                        roomFee.OutDays           = roomFee.OutDays;
                        roomFee.UseCount          = field.UseCount;
                        roomFee.Cost              = field.TotalCost;
                        roomFee.Remark            = roomFee.Remark;
                        roomFee.IsCharged         = true;
                        roomFee.UnitPrice         = field.CalculateUnitPrice > decimal.MinValue ? field.CalculateUnitPrice : 0;
                        roomFee.ChargeFee         = roomFee.ChargeFee > decimal.MinValue ? roomFee.ChargeFee : 0;
                        roomFee.RealCost          = roomFee.ChargeFee > 0 ? roomFee.ChargeFee : (field.TotalCost > decimal.MinValue ? field.TotalCost : 0);
                        roomFee.Discount          = field.Discount > decimal.MinValue ? field.Discount : 0;
                        roomFee.TotalRealCost     = (roomFee.TotalRealCost < 0 ? 0 : roomFee.TotalRealCost) + roomFee.RealCost;
                        roomFee.TotalDiscountCost = (roomFee.TotalDiscountCost < 0 ? 0 : roomFee.TotalDiscountCost) + roomFee.Discount;
                        decimal restcost = roomFee.Cost - roomFee.TotalDiscountCost - roomFee.TotalRealCost;
                        if (restcost < 0)
                        {
                            restcost = 0;
                        }
                        roomFee.RestCost             = restcost;
                        roomFee.ContractID           = field.ContractID;
                        roomFee.DiscountID           = roomFee.DiscountID;
                        roomFee.CuiShouStartTime     = field.CuiShouStartTime > DateTime.MinValue ? field.CuiShouStartTime : DateTime.MinValue;
                        roomFee.CuiShouEndTime       = field.CuiShouEndTime > DateTime.MinValue ? field.CuiShouEndTime : DateTime.MinValue;
                        roomFee.RelatedFeeID         = field.RelatedFeeID;
                        roomFee.ChongDiChargeID      = roomFee.ChongDiChargeID;
                        roomFee.DefaultChargeManID   = roomFee.DefaultChargeManID;
                        roomFee.DefaultChargeManName = field.DefaultChargeManName;
                        roomFee.Remark = "汇收银支付";
                        roomFee.Save(helper);
                        #region 收费后续操作
                        Web.APPCode.HandlerHelper.SaveRoomFee(roomFee, ChargeMan, helper, printRoomFeeHistory, ViewChargeSummaryList);
                        #endregion
                    }
                    helper.Commit();
                    var items = new { status = true, PrintID = printRoomFeeHistory.ID };
                    return(true);
                }
                catch (Exception ex)
                {
                    helper.Rollback();
                    LogHelper.WriteError("WechatHandler", "visit: wxpayroomfeecomplete", ex);
                    errormsg = ex.Message;
                    return(false);
                }
            }
        }