package models

import "time"

type SoftInfo struct {
	ReqNo         string `json:"reqNo"`
	ComName       string `json:"comName"`
	ComNsrsbh     string `json:"comNsrsbh"`
	SoftWareName  string `json:"softWareName"`
	Period        string `json:"period"`
	ZtBeginPeriod string
	UserName      string `json:"userName"`
	Password      string `json:"password"`
	OrgCode       string `json:"orgCode"`
	OldParam      string `json:"oldParam"` //是否采集停报客户 是/否
	Result        Result
}

type HisSubject struct {
	Period         string  `json:"period"`         // 账期
	Type           int     `json:"type"`           // 类型:1-月度,2-年度
	SubjectCode    string  `json:"subjectCode"`    // 科目编码
	SubjectName    string  `json:"subjectName"`    // 科目名称
	PeriodBeginIn  float64 `json:"periodBeginIn"`  // 期初余额-借方
	PeriodBeginOut float64 `json:"periodBeginOut"` // 期初余额-贷方
	PeriodInt      float64 `json:"periodInt"`      // 本期发生额-借方
	PeriodOut      float64 `json:"periodOut"`      // 本期发生额-贷方
	PeriodEndIn    float64 `json:"periodEndIn"`    // 期末余额-借方
	PeriodEndOut   float64 `json:"periodEndOut"`   // 期末余额-贷方
	YearInt        float64 `json:"yearInt"`        // 本期发生额-借方
	YearOut        float64 `json:"yearOut"`        // 本期发生额-贷方
	Status         int     `json:"status"`         // 状态: 2-未启用,1-启用
	Remark         string  `json:"remark"`         // 备注说明

	PeriodBeginInWb  float64 `json:"periodBeginInWb"`  // 期初余额-借方
	PeriodBeginOutWb float64 `json:"periodBeginOutWb"` // 期初余额-贷方
	PeriodIntWb      float64 `json:"periodIntWb"`      // 本期发生额-借方
	PeriodOutWb      float64 `json:"periodOutWb"`      // 本期发生额-贷方
	PeriodEndInWb    float64 `json:"periodEndInWb"`    // 期末余额-借方
	PeriodEndOutWb   float64 `json:"periodEndOutWb"`   // 期末余额-贷方
	YearIntWb        float64 `json:"yearIntWb"`        // 本年累计-借方
	YearOutWb        float64 `json:"yearOutWb"`        // 本年累计-贷方

	BeginCount float64 `json:"beginCount"` // 期初数量
	InCount    float64 `json:"inCount"`    // 本期发生额借方数量
	OutCount   float64 `json:"outCount"`   // 本期发生额贷方数量
	EndCount   float64 `json:"endCount"`   // 期末数量

	Unit    string `json:"unit"`    // 单位
	Spec    string `json:"spec"`    // 型号
	IsStock bool   `json:"IsStock"` //是否是存货
}

type HisGdzczj struct {
	Period     string    `json:"period"`      // 账期,eg:201810
	Xh         string    `json:"xh"`          //序号
	Type       string    `json:"type"`        // 1 固定 2 无形 3待摊 -
	Zcmc       string    `json:"zcmc"`        //资产名称 -
	Zclb       string    `json:"zclb"`        //资产类别 -
	Sl         string    `json:"sl"`          //数量 -默认1
	Rzrq       string    `json:"rzrq"`        //入账日期 -
	Yz         string    `json:"yz"`          //原值 -
	Yjsyyf     string    `json:"yjsyyf"`      //预计使用月份 -
	Czl        string    `json:"czl"`         //残值率 -
	Cz         string    `json:"cz"`          //残值(元) 原值*残值率 -
	Byzj       string    `json:"byzj"`        //本月折旧(元) 可不采集
	Bnzj       string    `json:"bnzj"`        //本年折旧(元) 可不采集
	Ljzj       string    `json:"ljzj"`        //累计折旧(元) -期末累计折旧
	Jz         string    `json:"jz"`          //净值(元) -
	Cbfykm     string    `json:"cbfykm"`      //成本费用科目 折旧费用科目 -
	Zt         string    `json:"zt"`          //状态 -
	Ljzjkm     string    `json:"subjectCode"` //subject_code累计折旧科目 -
	Created_at time.Time `json:"createdAt"`   // 可不采集
	Created_by string    `json:"createdBy"`   // 可不采集
	Updated_at time.Time `json:"updatedAt"`   // 可不采集
	Updated_by string    `json:"updatedBy"`   // 可不采集
	Ggxh       string    `json:"ggxh"`        // 规格型号

}

// 暂估冲销
type HisZgcx struct {
	Period string `json:"period"` // 账期,eg:201810
	//Bh     string `json:"bh"`     //编号
	Chmc string `json:"chmc"` //存货名称
	Gg   string `json:"gg"`   // 规格
	Dw   string `json:"dw"`   //单位

	//Fx   string `json:"fx"`   //方向 -
	//Qcsl string `json:"qcsl"` //期初数量
	//Qcje string `json:"qcje"` //期初金额
	//
	//Bqsl  string `json:"bqsl"`  //本期数量
	//Bqdj  string `json:"bqdj"`  //本期单价
	//Bqckj string `json:"bqckj"` //本期参考价
	//Bqje  string `json:"bqje"`  //本期金额
	//
	//Bqcxsl string `json:"bqcxsl"` //本期冲销数量
	//Bqcxdj string `json:"bqcxdj"` //本期冲销单价
	//Bqcxje string `json:"bqcxje"` //本期冲销金额

	Qmsl string `json:"qmsl"` //期末数量
	Qmje string `json:"qmje"` //期末金额 -
	Gsmc string `json:"gsmc"` //公司名称

}

type HisVoucher struct {
	Type         int              `json:"type"`
	CreatedAt    time.Time        `json:"createdAt"`    // 可不采集
	CreatedBy    uint             `json:"createdBy"`    // 可不采集
	UpdatedAt    time.Time        `json:"updatedAt"`    // 可不采集
	UpdatedBy    uint             `json:"updatedBy"`    // 可不采集
	FromType     string           `json:"fromType"`     //凭证来源  // 可不采集
	FromId       uint             `json:"fromId"`       //凭证来源id  // 可不采集
	FromIds      string           `json:"fromIds"`      //凭证来源id  // 可不采集
	Period       string           `json:"period"`       // 账期,eg:201810
	VoucherNo    string           `json:"voucherNo"`    // 凭证号:记-1
	InSumAmount  float64          `json:"inSumAmount"`  // 借方金额合计
	OutSumAmount float64          `json:"outSumAmount"` // 贷方金额合计
	CheckUserID  uint             `json:"checkUserId"`  // 审核人ID  // 可不采集
	CheckDate    time.Time        `json:"checkDate"`    // 审核日期  // 可不采集
	VoucherDate  time.Time        `json:"voucherDate"`  // 日期
	CheckStatus  int              `json:"checkStatus"`  // 审核状态:1-未审核,2-已审核  // 可不采集
	BillCount    int              `json:"billCount"`    // 附单据张数
	Status       int              `json:"status"`       // 状态:1-  // 可不采集
	Remark       string           `json:"remark"`       // 备注说明
	HisBz        int              `json:"hisBz"`        //历史的历史标志  // 可不采集
	Items        []HisVoucherItem `json:"items" gorm:"foreignKey:voucher_id"`
}

type HisVoucherItem struct {
	VoucherID       uint    `json:"voucherId"`       // 凭证ID  // 可不采集
	Type            int     `json:"type"`            // 类型:1-收入(借), 2-支出(贷)  // 可不采集
	Summary         string  `json:"summary"`         // 摘要
	SubjectCode     string  `json:"subjectCode"`     // 会计科目编号
	SubjectName     string  `json:"subjectName"`     // 会计科目名称
	InAmount        float64 `json:"inAmount"`        // 借方金额
	OutAmount       float64 `json:"outAmount"`       // 贷方金额
	AffectInventory int     `json:"affectInventory"` // 是否关联存货出入库:0-否,1-是  // 可不采集
	Price           float64 `json:"price"`           // 存货平均单价 关联存货时有值  // 可不采集
	Count           float64 `json:"count"`           // 存货数量 关联存货时有值
	Remark          string  `json:"remark"`          // 备注说明
	Seq             int     `json:"seq"`             // 排序  // 可不采集
	Status          int     `json:"status"`          // 状态:1-  // 可不采集
	Wb              string  `json:"wb"`              //币种
	Rate            float64 `json:"rate"`            //汇率
	InAmountWb      float64 `json:"inAmountWb"`      //借方
	OutAmountWb     float64 `json:"outAmountWb"`     //贷方
	InventoryStrIds string  `json:"inventoryStrIds"` //  // 可不采集
}

type Employee struct {
	Xm       string `json:"xm"`       //姓名
	Zjlx     string `json:"zjlx"`     //证件类型
	Zjhm     string `json:"zjhm"`     //证件号码
	Xb       string `json:"xb"`       //性别
	Csrq     string `json:"csrq"`     //出生日期
	Rzsgcylx string `json:"rzsgcylx"` //任职受雇成员类型
	Rzsgcyrq string `json:"rzsgcyrq"` //任职受雇成员日期
	Lzrq     string `json:"lzrq"`     //离职日期
	Sfgd     string `json:"sfgd"`     //是否股东
	Gj       string `json:"gj"`       //国籍
	Ryzt     string `json:"ryzt"`     //人员状态
	Sfkcjcfy string `json:"sfkcjcfy"` //是否扣除减除费用 "1"是"0"否
	Tel      string `json:"tel"`      //电话
}

// 存货
type Stock struct {
	Bm string `json:"bm"` //编码
	Mc string `json:"mc"` //名称
	Dw string `json:"dw"` //单位
	Xh string `json:"xh"` //型号
	Lb string `json:"lb"` //类别
	Km string `json:"km"` //科目
	Sl string `json:"sl"` //数量
	Je string `json:"je"` //金额
}
type EmInfo1 struct {
	Data struct {
		DepartmentList []struct {
			Id       int    `json:"id"`
			Name     string `json:"name"`
			Category int    `json:"category"`
			Attr     struct {
				Standard string `json:"standard"`
				Unit     string `json:"unit"`
				Type     string `json:"type"`
			} `json:"attr"`
			Code     string `json:"code"`
			IsSystem int    `json:"is_system"`
			Sort     int    `json:"sort"`
		} `json:"departmentList"`
		StaffList map[string][]struct {
			StaffId              int    `json:"staff_id"`
			StaffName            string `json:"staff_name"`
			CustomerId           int    `json:"customer_id"`
			DepartmentId         int    `json:"department_id"`
			Sex                  int    `json:"sex"`
			Position             string `json:"position"`
			Mobile               string `json:"mobile"`
			Email                string `json:"email"`
			RegisteredResidence  int    `json:"registered_residence"`
			IdCard               string `json:"id_card"`
			StaffStatus          int    `json:"staff_status"`
			InductionTime        string `json:"induction_time"`
			DepartureTime        string `json:"departure_time"`
			TrialStartTime       string `json:"trial_start_time"`
			TrialEndTime         string `json:"trial_end_time"`
			WagesCardBank        int    `json:"wages_card_bank"`
			WagesCardBankName    string `json:"wages_card_bank_name"`
			WagesCardNumber      string `json:"wages_card_number"`
			AuxId                int    `json:"aux_id"`
			DelFlag              int    `json:"del_flag"`
			IsAssistant          int    `json:"is_assistant"`
			UpUser               int    `json:"up_user"`
			IdentityType         int    `json:"identity_type"`
			IdentityNumber       string `json:"identity_number"`
			IsDisability         int    `json:"is_disability"`
			IsMartyr             int    `json:"is_martyr"`
			IsChildless          int    `json:"is_childless"`
			DisabilityNumber     string `json:"disability_number"`
			MartyrNumber         string `json:"martyr_number"`
			Passport             string `json:"passport"`
			EmployeeNumber       string `json:"employee_number"`
			EmploymentType       int    `json:"employment_type"`
			Nationality          int    `json:"nationality"`
			EntryTime            string `json:"entry_time"`
			LeaveTime            string `json:"leave_time"`
			PermanentAddress     string `json:"permanent_address"`
			ContactAddress       string `json:"contact_address"`
			BirthAddress         string `json:"birth_address"`
			TaxpayerIdNumber     string `json:"taxpayer_id_number"`
			PayWagesUnit         string `json:"pay_wages_unit"`
			PayWagesUnitCode     string `json:"pay_wages_unit_code"`
			SpouseSituation      int    `json:"spouse_situation"`
			SpouseName           string `json:"spouse_name"`
			SpouseIdType         int    `json:"spouse_id_type"`
			SpouseIdNumber       string `json:"spouse_id_number"`
			SpecialDeductionYear any    `json:"special_deduction_year"`
			DepartmentName       string `json:"department_name"`
			PositionName         string `json:"position_name"`
			DeleteStaff          int    `json:"deleteStaff"`
		} `json:"staffList"`
		FeeType      []string `json:"feeType"`
		CompanyName  string   `json:"companyName"`
		PositionList []any    `json:"positionList"`
	} `json:"data"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}
type EmInfo struct {
	Data struct {
		DepartmentList []any `json:"departmentList"`
		StaffList      [][]struct {
			StaffId              int    `json:"staff_id"`
			StaffName            string `json:"staff_name"`
			CustomerId           int    `json:"customer_id"`
			DepartmentId         int    `json:"department_id"`
			Sex                  int    `json:"sex"`
			Position             string `json:"position"`
			Mobile               string `json:"mobile"`
			Email                string `json:"email"`
			RegisteredResidence  int    `json:"registered_residence"`
			IdCard               string `json:"id_card"`
			StaffStatus          int    `json:"staff_status"`
			InductionTime        string `json:"induction_time"`
			DepartureTime        string `json:"departure_time"`
			TrialStartTime       string `json:"trial_start_time"`
			TrialEndTime         string `json:"trial_end_time"`
			WagesCardBank        int    `json:"wages_card_bank"`
			WagesCardBankName    string `json:"wages_card_bank_name"`
			WagesCardNumber      string `json:"wages_card_number"`
			AuxId                int    `json:"aux_id"`
			DelFlag              int    `json:"del_flag"`
			IsAssistant          int    `json:"is_assistant"`
			UpUser               int    `json:"up_user"`
			IdentityType         int    `json:"identity_type"`
			IdentityNumber       string `json:"identity_number"`
			IsDisability         int    `json:"is_disability"`
			IsMartyr             int    `json:"is_martyr"`
			IsChildless          int    `json:"is_childless"`
			DisabilityNumber     string `json:"disability_number"`
			MartyrNumber         string `json:"martyr_number"`
			Passport             string `json:"passport"`
			EmployeeNumber       string `json:"employee_number"`
			EmploymentType       int    `json:"employment_type"`
			Nationality          int    `json:"nationality"`
			EntryTime            string `json:"entry_time"`
			LeaveTime            string `json:"leave_time"`
			PermanentAddress     string `json:"permanent_address"`
			ContactAddress       string `json:"contact_address"`
			BirthAddress         string `json:"birth_address"`
			TaxpayerIdNumber     string `json:"taxpayer_id_number"`
			PayWagesUnit         string `json:"pay_wages_unit"`
			PayWagesUnitCode     string `json:"pay_wages_unit_code"`
			SpouseSituation      int    `json:"spouse_situation"`
			SpouseName           string `json:"spouse_name"`
			SpouseIdType         int    `json:"spouse_id_type"`
			SpouseIdNumber       string `json:"spouse_id_number"`
			SpecialDeductionYear any    `json:"special_deduction_year"`
			DepartmentName       string `json:"department_name"`
			PositionName         string `json:"position_name"`
			DeleteStaff          int    `json:"deleteStaff"`
		} `json:"staffList"`
		FeeType      []string `json:"feeType"`
		CompanyName  string   `json:"companyName"`
		PositionList any      `json:"positionList"`
	} `json:"data"`
	Code    int    `json:"code"`
	Message string `json:"message"`
}

// 个税工资表
type Gssalary struct {
	Name                    string  `json:"name"`                   // 姓名
	FeeType                 string  `json:"fee_type"`               // 费用类型
	Salary                  float64 `json:"salary"`                 // 应发工资
	Subsidy                 float64 `json:"subsidy"`                // 补助(其中:通讯费)
	Mssr                    string  `json:"mssr"`                   // 免税收入
	DeductSbPension         float64 `json:"deduct_sb_pension"`      //代扣社保-养老保险
	DeductSbMedical         float64 `json:"deduct_sb_medical"`      // 代扣社保-医疗保险
	DeductSbUnemployment    float64 `json:"deduct_sb_unemployment"` // 代扣社保-失业保险
	DeductSbIllness         float64 `json:"deduct_sb_illness"`      // 代扣社保-大病医疗
	DeductSbOther           float64 `json:"deduct_sb_other"`        // 代扣社保-其它
	DeductSbTotal           float64 `json:"deduct_sb_total"`        // 代扣社保-合计
	DeductHouseFund         float64 `json:"deduct_house_fund"`      // 代扣公积金
	DeductOther             float64 `json:"deduct_other"`           // 其他扣除
	DeductIncomeTax         float64 `json:"deduct_income_tax"`      // 代扣个税
	ActualSalary            float64 `json:"actual_salary"`          // 实发工资
	Remark                  string  `json:"remark"`                 // 备注说明
	Seq                     string  `json:"seq"`                    // 排序
	CreatedAt               string  `json:"created_at"`
	CreatedBy               string  `json:"created_by"`
	UpdatedAt               string  `json:"updated_at"`
	UpdatedBy               string  `json:"updated_by"`
	DeletedAt               string  `json:"deleted_at"`
	ChildrenEducation       float64 `json:"children_education"`          // 子女教育
	ContinuingEducation     float64 `json:"continuing_education"`        // 继续教育
	SeriousIllness          float64 `json:"serious_illness"`             // 大病医疗
	HousingLoan             float64 `json:"housing_loan"`                // 住房贷款信息
	HousingRent             float64 `json:"housing_rent"`                // 住房租金
	Support                 float64 `json:"support"`                     // 赡养老人
	BabyReduction           float64 `json:"baby_reduction"`              // 不满3岁
	CostReduction           float64 `json:"cost_reduction"`              // 减除费用每月5000
	IncomeTaxYear           float64 `json:"income_tax_year"`             // 代扣个税累计
	IncomeTaxLastPeriodYear float64 `json:"income_tax_last_period_year"` //代扣个税累计上月前
}

// 个税人员
type GsRyxx struct {
	Name                string  `json:"name"`                 // 姓名
	IdType              string  `json:"id_type"`              // 证件类型
	IdNo                string  `json:"id_no"`                // 证件号码
	Sex                 int     `json:"sex"`                  // 性别:1-男,2-女
	Country             string  `json:"country"`              // 国籍(地区)
	Birthday            string  `json:"birthday"`             // 出生日期
	Tel                 string  `json:"tel"`                  // 手机号
	Disability          int     `json:"disability"`           // 是否残疾:1-是,2-否
	Martyred            int     `json:"martyred"`             // 是否烈属:1-是,2-否
	Elderly             int     `json:"elderly"`              // 是否孤老:1-是,2-否
	DisabilityNo        string  `json:"disability_no"`        // 残疾证号
	MartyredNo          string  `json:"martyred_no"`          // 烈属证号
	IsEmployee          int     `json:"is_employee"`          // 是否雇员:1-是,2-否
	Status              int     `json:"status"`               // 人员状态:1-正常,2-非正常(非正常需要填任职受雇日期和离职日期)
	JoinDate            string  `json:"join_date"`            // 入职日期/任职受雇日期
	DepartureDate       string  `json:"departure_date"`       // 离职日期
	Stockholder         int     `json:"stockholder"`          // 是否股东:0-否,1-是
	TotalStock          float64 `json:"total_stock"`          // 公司股本总额
	PersonalStock       float64 `json:"personal_stock"`       // 个人股本(投资)额
	StockPercent        float64 `json:"stock_percent"`        // 分配比例%
	PersonLoginPwd      string  `json:"person_login_pwd"`     // 自然人登录密码
	Department          string  `json:"department"`           // 部门-冗余
	Remark              string  `json:"remark"`               // 备注说明
	ChildrenEducation   float64 `json:"children_education"`   // 子女教育
	ContinuingEducation float64 `json:"continuing_education"` // 继续教育
	SeriousIllness      float64 `json:"serious_illness"`      // 大病医疗
	HousingLoan         float64 `json:"housing_loan"`         // 住房贷款信息
	HousingRent         float64 `json:"housing_rent"`         // 住房租金
	Support             float64 `json:"support"`              // 赡养老人
	Time1               string  `json:"time1"`                // 子女教育
	Time2               string  `json:"time2"`                // 继续教育
	Time3               string  `json:"time3"`                // 大病医疗
	Time4               string  `json:"time4"`                // 住房贷款信息
	Time5               string  `json:"time5"`                // 住房租金
	Time6               string  `json:"time6"`                // '赡养老人
	TimeEnd1            string  `json:"time_end1"`            // 子女教育
	TimeEnd2            string  `json:"time_end2"`            // 继续教育
	TimeEnd3            string  `json:"time_end3"`            // 大病医疗
	TimeEnd4            string  `json:"time_end4"`            // 住房贷款信息
	TimeEnd5            string  `json:"time_end5"`            // 住房租金
	TimeEnd6            string  `json:"time_end6"`            // 赡养老人
	JcStatus            int     `json:"jc_status"`            // 减除费用 1打开减除6w
	BabyReduction       float64 `json:"baby_reduction"`       // 婴幼儿减免
	Time7               string  `json:"time7"`
	TimeEnd7            string  `json:"time_end7"`
}

// // 历史软件发票信息
type HisInvoice struct {
	TypeName string       `json:"typeName"` //发票类型
	Summarys []HisSummary `json:"summarys"`
}

type HisSummary struct {
	TaxRate string `json:"taxRate"` //税率
	Tax     string `json:"tax"`     //税额
	Amount  string `json:"amount"`  //不含税金额
	Sm      string `json:"sm"`      //税目
}

// 采集规则,采集起始账期前至季度报账期间的销项发票
// 起始账期认定规则,若最大末账期为202411 则起始账期为 202412,若凭证出现最后一账期为202411 则起始账期为202412
// 采集账期规则,若为季度报账期则不采集,否则采集其至上个季度报账期之间的账期