|
@@ -192,17 +192,24 @@ func GetInvoicePaymentSummaryByRegisterIdAndInvoiceId(registerId, invocieId int)
|
|
|
}
|
|
|
|
|
|
type IncomeSummaryItem struct {
|
|
|
- CompanyName string `json:"company_name" description:"客户名称"`
|
|
|
- ContractType int `json:"contract_type" description:"是否为新客户: 2-否; 1-是"`
|
|
|
- InvoiceDate time.Time `json:"invoice_time" description:"开票日期"`
|
|
|
- Amount float64 `json:"amount" description:"金额"`
|
|
|
- SellerName string `json:"seller_name" description:"销售名称"`
|
|
|
+ CompanyName string `json:"company_name" description:"客户名称"`
|
|
|
+ ContractType int `json:"contract_type" description:"是否为新客户: 2-否; 1-是"`
|
|
|
+ InvoiceDate time.Time `json:"invoice_time" description:"开票日期"`
|
|
|
+ Amount float64 `json:"amount" description:"金额"`
|
|
|
+ SellerName string `json:"seller_name" description:"销售名称"`
|
|
|
+ FinalSellerId int `json:"final_seller_id" description:"最终销售ID"`
|
|
|
+ SellerGroupId int `json:"seller_group_id" description:"销售分组ID"`
|
|
|
+ SellerGroupName int `json:"seller_group_name" description:"销售分组名称"`
|
|
|
}
|
|
|
|
|
|
// GetContractSummaryIncomeAmount 获取汇总金额合计信息
|
|
|
func GetContractSummaryIncomeAmount(condition string, pars []interface{}) (results []*IncomeSummaryItem, err error) {
|
|
|
query := global.DEFAULT_MYSQL.Table("invoice_payment_summary AS a").
|
|
|
- Select("IF(a.invoice_id=0,d.amount, b.amount) AS amount,IF(a.invoice_id=0,d.invoice_time, b.invoice_time) AS invoice_date, c.contract_type,c.company_name,IF(a.invoice_id=0,d.seller_name, b.seller_name) AS seller_name,IF(a.invoice_id=0,d.seller_id, b.seller_id) AS final_seller_id").
|
|
|
+ Select("IF(a.invoice_id=0,d.amount, b.amount) AS amount,IF(a.invoice_id=0,d.invoice_time, b.invoice_time) AS invoice_date,"+
|
|
|
+ " c.contract_type,c.company_name," +
|
|
|
+ "IF(a.invoice_id=0,d.seller_name, b.seller_name) AS seller_name,"+
|
|
|
+ "IF(a.invoice_id=0,d.seller_id, b.seller_id) AS final_seller_id,"+
|
|
|
+ "IF(a.invoice_id=0,d.seller_group_id, b.seller_group_id) AS seller_group_id").
|
|
|
Joins("LEFT JOIN contract_invoice AS b ON a.invoice_id = b.contract_invoice_id AND b.is_deleted = 0 ").
|
|
|
Joins("LEFT JOIN contract_invoice AS d ON a.payment_id = d.contract_invoice_id AND d.is_deleted = 0").
|
|
|
Joins("JOIN contract_register AS c ON a.register_id = c.contract_register_id AND c.is_deleted = 0").
|
|
@@ -373,4 +380,3 @@ func UpdateInvoicePaymentSummaryByRegisterId(newId int, registerIds []int) (err
|
|
|
err = global.DEFAULT_MYSQL.Exec(sql, newId, registerIds).Error
|
|
|
return
|
|
|
}
|
|
|
-
|