package models import ( "hongze/fms_api/global" "hongze/fms_api/models/fms" ) // 收入统计图表数据 type IncomeChartResp struct { Title string `description:"图表名称"` Date []string `description:"月份"` ContractMoney []float64 `description:"开票金额"` ArrivalMoney []float64 `description:"到款金额"` } type IncomeItem struct { ContractMoney float64 `description:"开票金额"` ArrivalMoney float64 `description:"到款金额"` } func GetIncomeListCount(cond string) (results *IncomeItem, err error) { sql := `SELECT a.contract_money, b.arrival_money FROM ( SELECT SUM(amount) contract_money FROM contract_invoice WHERE is_deleted = 0 AND (invoice_type = 1 OR invoice_type = 3) ` + cond + ` ) AS a, (SELECT SUM(amount) arrival_money FROM contract_invoice WHERE is_deleted = 0 AND (invoice_type = 2 OR invoice_type = 4) ` + cond + ` ) AS b WHERE 1=1 ` err = global.DEFAULT_MYSQL.Raw(sql).First(&results).Error return } // 收入统计图表数据 type CensusIncomeChartResp struct { Title string `description:"图表名称"` Date []string `description:"月份"` TotalMoney []float64 `description:"总金额"` PrevTotalMoney []float64 `description:"历史总金额"` Yoy []string `description:"同比值"` DataList []*fms.IncomeSummaryItem ` json:"-"` }