package models import ( "hongze/fms_api/global" ) // 收入统计图表数据 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 `+cond+` ) AS a, (SELECT SUM(amount) arrival_money FROM contract_invoice WHERE is_deleted = 0 AND invoice_type = 2 `+cond+` ) AS b WHERE 1=1 ` err = global.DEFAULT_MYSQL.Raw(sql).First(&results).Error return }