using Edu.Model.Entity.Course;
using System;
using System.Collections.Generic;

namespace Edu.Model.ViewModel.Course
{
    /// <summary>
    /// 教育合同视图实体类
    /// </summary>
    public class RB_Education_Contract_ViewModel : RB_Education_Contract
    {
        #region 财务相关

        /// <summary>
        /// 财务单据
        /// </summary>
        public int FinanceId { get; set; }

        /// <summary>
        /// 交易方式
        /// </summary>
        public int TradeWay { get; set; }

        /// <summary>
        /// 账户id
        /// </summary>
        public int AccountId { get; set; }

        #endregion

        #region 统计相关

        /// <summary>
        /// 下单开始时间
        /// </summary>
        public string StartTime { get; set; }

        /// <summary>
        /// 下单结束时间
        /// </summary>
        public string EndTime { get; set; }

        /// <summary>
        /// 消费课时开始时间
        /// </summary>
        public string XFStartTime { get; set; }

        /// <summary>
        /// 消费课时结束时间
        /// </summary>
        public string XFEndTime { get; set; }

        /// <summary>
        /// 业务员id
        /// </summary>
        public int SaleId { get; set; }

        /// <summary>
        /// 班级名称
        /// </summary>
        public string ClassName { get; set; }

        /// <summary>
        /// 班级编号
        /// </summary>
        public string ClassNo { get; set; }

        /// <summary>
        /// 调整金额
        /// </summary>
        public decimal AdjustPrice { get; set; }

        /// <summary>
        /// 财务单据列表
        /// </summary>
        public List<Model.ViewModel.Finance.RB_Finance_Extend> FinanceList { get; set; }

        /// <summary>
        /// 客人已交金额（出纳已审核）
        /// </summary>
        public decimal Income { get; set; }

        /// <summary>
        /// 支出金额
        /// </summary>
        public decimal Expend { get; set; }

        /// <summary>
        /// 已使用课时
        /// </summary>
        public int UseClassHours { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal Unit_Price { get; set; }

        /// <summary>
        /// 已使用课程费
        /// </summary>
        public decimal UseCourseFee { get; set; }

        /// <summary>
        /// 使用教材费
        /// </summary>
        public decimal UseBookFee { get; set; }

        /// <summary>
        /// 使用课件费
        /// </summary>
        public decimal UseCoursewareFee { get; set; }
        #endregion

        /// <summary>
        /// 是否审核(1-是)
        /// </summary>
        public int IsAduit { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateByName { get; set; }

        /// <summary>
        /// 创建人头像
        /// </summary>
        public string CreateByPhoto { get; set; }

        /// <summary>
        /// 学生名单ids
        /// </summary>
        public string GuestIds { get; set; }

        /// <summary>
        /// 订单ids
        /// </summary>
        public string OrderIds { get; set; }

        /// <summary>
        /// 合同状态
        /// </summary>
        public string StatusStr
        {
            get
            {
                //状态(0-草稿，1-提交审核，2-审核通过，3-驳回)
                string str = "";
                switch (this.Status)
                {
                    case 0: str = "草稿"; break;
                    case 1: str = "提交审核"; break;
                    case 2: str = "审核通过"; break;
                    case 3: str = "驳回"; break;
                    case 4: str = "取消"; break;
                }
                return str;
            }
        }

        /// <summary>
        /// 学员生日字符串
        /// </summary>
        public string StuBirthStr
        {
            get { return Common.ConvertHelper.FormatDate2(this.StuBirth); }
        }

        /// <summary>
        /// 性别字符串
        /// </summary>
        public string StuSexStr
        {
            get
            {
                string str = "男";
                if (this.StuSex == 1)
                {
                    str = "女";
                }
                return str;
            }
        }

        /// <summary>
        /// 第一期-支付日期字符串
        /// </summary>
        public string FirstPayDateStr
        {
            get
            {
                return Common.ConvertHelper.FormatDate(this.FirstPayDate);
            }
        }


        /// <summary>
        /// 第二期-支付日期
        /// </summary>
        public string SecondPayDateStr
        {
            get
            {
                return Common.ConvertHelper.FormatDate(this.SecondPayDate);
            }
        }

        /// <summary>
        /// 第三期-支付日期
        /// </summary>
        public string ThirdPayDateStr
        {
            get
            {
                return Common.ConvertHelper.FormatDate(this.ThirdPayDate);
            }
        }

        /// <summary>
        /// 总课时数
        /// </summary>
        public int TotalClassHours
        {
            get
            {
                Int32.TryParse(this.FirstClassHours.ToString(), out int FirstClassHours);
                Int32.TryParse(this.SecondClassHours.ToString(), out int SecondClassHours);
                Int32.TryParse(this.ThirdClassHours.ToString(), out int ThirdClassHours);
                return FirstClassHours + SecondClassHours + ThirdClassHours;
            }
        }

        /// <summary>
        /// 总课时费
        /// </summary>
        public decimal TotalCourseFee
        {
            get
            {
                decimal.TryParse(this.FirstCourseFee.ToString(), out decimal FirstCourseFee);
                decimal.TryParse(this.SecondCourseFee.ToString(), out decimal SecondCourseFee);
                decimal.TryParse(this.ThirdCourseFee.ToString(), out decimal ThirdCourseFee);
                return FirstCourseFee + SecondCourseFee + ThirdCourseFee;
            }
        }

        /// <summary>
        /// 总教材费
        /// </summary>
        public decimal TotalBookFee
        {
            get
            {
                decimal.TryParse(this.FirstBookFee.ToString(), out decimal FirstBookFee);
                decimal.TryParse(this.SecondBookFee.ToString(), out decimal SecondBookFee);
                decimal.TryParse(this.ThirdBookFee.ToString(), out decimal ThirdBookFee);
                return FirstBookFee + SecondBookFee + ThirdBookFee;
            }
        }

        /// <summary>
        /// 总课件费
        /// </summary>
        public decimal TotalClassFee
        {
            get
            {
                decimal.TryParse(this.FirstClassFee.ToString(), out decimal FirstClassFee);
                decimal.TryParse(this.SecondClassFee.ToString(), out decimal SecondClassFee);
                decimal.TryParse(this.ThirdClassFee.ToString(), out decimal ThirdClassFee);
                return FirstClassFee + SecondClassFee + ThirdClassFee;
            }
        }

        /// <summary>
        /// 第一期费用小计
        /// </summary>
        public decimal FirstSubTotal
        {
            get
            {
                return this.FirstCourseFee + this.FirstBookFee + this.FirstClassFee;
            }
        }

        /// <summary>
        /// 第二期费用小计
        /// </summary>
        public decimal SecondSubTotal
        {
            get { return this.SecondCourseFee + this.SecondBookFee + this.SecondClassFee; }
        }

        /// <summary>
        /// 第三期费用小计
        /// </summary>
        public decimal ThirdSubTotal
        {
            get { return this.ThirdCourseFee + this.ThirdBookFee + this.ThirdClassFee; }
        }

        /// <summary>
        /// 总费用小计
        /// </summary>
        public decimal TotalSub
        {
            get { return this.FirstSubTotal + this.SecondSubTotal + this.ThirdSubTotal; }
        }

        /// <summary>
        /// 总优惠金额
        /// </summary>
        public decimal TotalDiscountMoney
        {
            get
            {
                decimal.TryParse(this.FirstDiscountMoney.ToString(), out decimal FirstDiscountMoney);
                decimal.TryParse(this.SecondDiscountMoney.ToString(), out decimal SecondDiscountMoney);
                decimal.TryParse(this.ThirdDiscountMoney.ToString(), out decimal ThirdDiscountMoney);
                return FirstDiscountMoney + SecondDiscountMoney + ThirdDiscountMoney;
            }
        }

        /// <summary>
        /// 总金额
        /// </summary>
        public decimal TotalMoney
        {
            get
            {
                decimal.TryParse(this.FirstMoney.ToString(), out decimal FirstMoney);
                decimal.TryParse(this.SecondMoney.ToString(), out decimal SecondMoney);
                decimal.TryParse(this.ThirdMoney.ToString(), out decimal ThirdMoney);
                return FirstMoney + SecondMoney + ThirdMoney;
            }
        }

        /// <summary>
        /// 公司合同章图片
        /// </summary>
        public string GroupSealImg { get; set; }

        /// <summary>
        /// 学员签字年份
        /// </summary>
        public string StuSignYear
        {
            get
            {
                string yearStr = "";
                string signDate = Common.ConvertHelper.FormatDate(this.SignDate);
                if (!string.IsNullOrEmpty(signDate))
                {
                    var signDateArray = signDate.Split('-');
                    if (signDateArray != null && signDateArray.Length > 0)
                    {
                        yearStr = signDateArray[0];
                    }
                }
                return yearStr;
            }
        }

        /// <summary>
        /// 学员签字月份
        /// </summary>
        public string StuSignMonth
        {
            get
            {
                string monthStr = "";
                string signDate = Common.ConvertHelper.FormatDate(this.SignDate);
                if (!string.IsNullOrEmpty(signDate))
                {
                    var signDateArray = signDate.Split('-');
                    if (signDateArray != null && signDateArray.Length > 1)
                    {
                        monthStr = signDateArray[1];
                    }
                }
                return monthStr;
            }
        }

        /// <summary>
        /// 学员签字天
        /// </summary>
        public string StuSignDay
        {
            get
            {
                string dayStr = "";
                string signDate = Common.ConvertHelper.FormatDate(this.SignDate);
                if (!string.IsNullOrEmpty(signDate))
                {
                    var signDateArray = signDate.Split('-');
                    if (signDateArray != null && signDateArray.Length > 2)
                    {
                        dayStr = signDateArray[2];
                    }
                }
                return dayStr;
            }
        }


        /// <summary>
        /// 公司签字年份
        /// </summary>
        public string SealDateYear
        {
            get
            {
                string yearStr = "";
                string signDate = Common.ConvertHelper.FormatDate(this.SealDate);
                if (!string.IsNullOrEmpty(signDate))
                {
                    var signDateArray = signDate.Split('-');
                    if (signDateArray != null && signDateArray.Length > 0)
                    {
                        yearStr = signDateArray[0];
                    }
                }
                return yearStr;
            }
        }

        /// <summary>
        /// 公司签字月份
        /// </summary>
        public string SealDateMonth
        {
            get
            {
                string monthStr = "";
                string signDate = Common.ConvertHelper.FormatDate(this.SealDate);
                if (!string.IsNullOrEmpty(signDate))
                {
                    var signDateArray = signDate.Split('-');
                    if (signDateArray != null && signDateArray.Length > 1)
                    {
                        monthStr = signDateArray[1];
                    }
                }
                return monthStr;
            }
        }

        /// <summary>
        /// 公司签字天
        /// </summary>
        public string SealDateDay
        {
            get
            {
                string dayStr = "";
                string signDate = Common.ConvertHelper.FormatDate(this.SealDate);
                if (!string.IsNullOrEmpty(signDate))
                {
                    var signDateArray = signDate.Split('-');
                    if (signDateArray != null && signDateArray.Length > 2)
                    {
                        dayStr = signDateArray[2];
                    }
                }
                return dayStr;
            }
        }
    }
}
