using OASystem.Domain.Entities.Financial;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OASystem.Domain.ViewModels.Statistics
{
    public class CorporateProfitViews
    {
    }


    public class CorporateProfitInfosView
    {
        public CorporateProfitInfo[] GroupItems { get; set; }
        public DailyInfo[] DailyItems { get; set; }
    }

    public class DailyInfo
    {
        public int Id { get; set; }
        public int CompanyId { get; set; }
        public string CompanyName { get; set; }
        /// <summary>
        /// 部门
        /// </summary>
        public string Branch { get; set; }
        /// <summary>
        /// 申请人
        /// </summary>
        public string Applicant { get; set; }
        public int PriceParentTypeId { get; set; }
        public string PriceParentTypeName { get; set; }
        public int PriceTypeId { get; set; }
        public string PriceTypeName { get; set; }
        public string Instructions { get; set; }
        public decimal CNYTotal { get; set; }
        public string PriceName { get; set; }
        public decimal Quantity { get; set; }
        public decimal Price { get; set; }
        public decimal ItemTotal { get; set; }
        public string Remark { get; set; }
        public DateTime CreateTime { get; set; }
    }

    public class CorporateProfitInfo
    {
        public int RowIndex { get; set; }
        public int Id { get; set; }
        public string ClientName { get; set; }
        public string TeamName { get; set; }
        public int TeamDid { get; set; }
        public string GroupTypeName { get; set; }
        public DateTime VisitDate { get; set; }
        public int VisitPNumber { get; set; }
        /// <summary>
        /// 应收金额
        /// </summary>
        public decimal ReceivableAmount { get; set; }
        /// <summary>
        /// 已收金额
        /// </summary>
        public decimal ReceivedAmount { get; set; }
        /// <summary>
        /// 收款退还金额
        /// </summary>
        public decimal RefundedAmount { get; set; }
        /// <summary>
        /// 酒店金额
        /// </summary>
        public decimal HotelAmount { get; set; }
        /// <summary>
        /// 地接金额
        /// </summary>
        public decimal LocalGuideAmount { get; set; }
        /// <summary>
        /// 机票金额
        /// </summary>
        public decimal AirTicketAmount { get; set; }
        /// <summary>
        /// 签证金额
        /// </summary>
        public decimal VisaAmount { get; set; }
        /// <summary>
        /// 商邀金额
        /// </summary>
        public decimal OAAmount { get; set; }
        /// <summary>
        /// 保险金额
        /// </summary>
        public decimal InsureAmount { get; set; }
        /// <summary>
        /// 其他金额
        /// </summary>
        public decimal OtherAmount { get; set; }
        /// <summary>
        /// 收款合计
        /// </summary>
        public decimal CollectionTotal
        {
            get
            {
                return ReceivedAmount - RefundedAmount; 
            }
        }
        /// <summary>
        /// 成本合计
        /// </summary>
        public decimal CostTotal
        {
            get
            {
                return HotelAmount + LocalGuideAmount + AirTicketAmount + VisaAmount + OAAmount + InsureAmount + OtherAmount;
            }
        }
        /// <summary>
        /// 利润合计/已收-成本
        /// </summary>
        public decimal ProfitTotal
        {
            get
            {
                return CollectionTotal - CostTotal;
            }
        }
        /// <summary>
        /// 应收利润合计/已收-成本
        /// </summary>
        public decimal ReceivableProfitTotal
        {
            get
            {
                return ReceivableAmount - CostTotal;
            }
        }
    }

    public class CorporateProfitItem
    {
        public int RowIndex { get; set; }
        public int Id { get; set; }
        public string ClientName { get; set; }
        public string TeamName { get; set; }
        public DateTime VisitDate { get; set; }
      
        /// <summary>
        /// 收款合计(已收金额)
        /// </summary>
        public decimal CollectionTotal { get; set; }
        
        /// <summary>
        /// 应收 
        /// </summary>
        public decimal ReceivableAmount { get; set; }

        /// <summary>
        /// 成本合计
        /// </summary>
        public decimal CostTotal { get; set; }
        /// <summary>
        /// 利润合计/已收-成本
        /// </summary>
        public decimal ProfitTotal { get; set; }

        /// <summary>
        /// 应收利润合计/已收-成本
        /// </summary>
        public decimal ReceivableProfitTotal { get; set; }
    }

    public class CorporateProfitItemView
    {
        public CorporateProfitItem[] Items { get; set; }

        public string Label { get; set; }

    }


    public class CorporateProfitDailyView
    {
        public string No { get; set; }
        public string PriceName { get; set; }

        public decimal ThisMonthAmount { get; set; }
        public decimal ThisYearAmount { get; set; }
        public string Remark { get; set; }
    }

    public class CorporateProfitDailyCommentView
    {
        public string MonthComment { get; set; }
        public string YearComment { get; set; }
    }
}