|
@@ -191,11 +191,11 @@ 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:"销售名称"`
|
|
|
}
|
|
|
|
|
|
|
|
@@ -246,14 +246,14 @@ func GetInvoiceCensusPageList(page base.IPage, condition string, pars []interfac
|
|
|
func GetNoPaymentCensusPageList(page base.IPage, condition string, pars []interface{}) (results []*InvoiceSummary, count int64, err error) {
|
|
|
query := global.DEFAULT_MYSQL.Table("invoice_payment_summary AS a").
|
|
|
Select("b.*, a.id as summary_id, IF(a.invoice_id >0, 1,0) as sort_invoice_id, IF(a.payment_id >0, 1,0) as sort_payment_id, COALESCE(SUM( c.amount ),0) AS invoiced_amount_count,COALESCE(SUM( d.amount ),0) AS payment_amount_count "+
|
|
|
- " ,c.invoice_time ").
|
|
|
+ " ,c.invoice_time ","c.origin_amount AS summary_invoice_amount","d.origin_amount AS summary_payment_amount","a.invoice_id","a.payment_id").
|
|
|
Joins("JOIN contract_register AS b ON a.register_id = b.contract_register_id AND b.is_deleted = 0").
|
|
|
Joins("LEFT JOIN contract_invoice AS c ON a.invoice_id = c.contract_invoice_id AND c.is_deleted = 0").
|
|
|
Joins("LEFT JOIN contract_invoice AS d ON a.payment_id = d.contract_invoice_id AND d.is_deleted = 0").
|
|
|
- Where(condition, pars...).Group("contract_register_id")
|
|
|
+ Where(condition, pars...).Group("id")
|
|
|
|
|
|
nq := global.DEFAULT_MYSQL.Table("(?) AS e", query).
|
|
|
- Select("*")
|
|
|
+ Select("*").Where(" e.invoiced_amount_count <> 0 AND e.invoice_id <> 0 AND ( e.summary_invoice_amount > e.summary_payment_amount OR e.summary_payment_amount IS NULL ) ")
|
|
|
nq.Count(&count)
|
|
|
if len(page.GetOrderItemsString()) > 0 {
|
|
|
nq = nq.Order(page.GetOrderItemsString())
|
|
@@ -315,6 +315,7 @@ type NotInvoicePaymentSummaryItem struct {
|
|
|
PaymentAmountTotal float64 `gorm:"column:payment_amount_total" json:"payment_amount_total" description:"合同金额"`
|
|
|
InvoiceAmountTotal float64 `gorm:"column:invoice_amount_total" json:"invoice_amount_total" description:"开票金额"`
|
|
|
NotInvoicedAmountTotal float64 ` json:"not_invoiced_amount_total" description:"未开票金额"`
|
|
|
+ SellerType string `json:"seller_type" description:"销售类型"`
|
|
|
ContractRegister
|
|
|
}
|
|
|
|