|
@@ -645,7 +645,7 @@ type DupInvoice struct {
|
|
|
// GetDuplicateContractInvoiceDetailItemList 预登记列表详情用-获取开票到款列表
|
|
|
func GetDuplicateContractInvoiceDetailItemList(companyName, startDate, endDate string, contractType, hasPayment int) (list []*DupInvoice, err error) {
|
|
|
err = global.DEFAULT_MYSQL.Table("contract_invoice as a ").
|
|
|
- Select(" a.*,GROUP_CONCAT(c.service_template_id ORDER BY c.service_template_id ) AS template_ids ").
|
|
|
+ Select(" a.*,GROUP_CONCAT(DISTINCT c.service_template_id ORDER BY c.service_template_id ) AS template_ids ").
|
|
|
Joins(" JOIN contract_register as b ON a.contract_register_id = b.contract_register_id ").
|
|
|
Joins("JOIN contract_service AS c ON a.contract_register_id = c.contract_register_id").
|
|
|
Where(fmt.Sprintf("a.is_deleted = 0 AND b.company_name = '%s' AND b.start_date= '%s' AND b.end_date= '%s' AND b.is_deleted=0 AND (a.invoice_type=3 OR a.invoice_type=4) AND b.contract_type=? AND b.has_payment=?", companyName, startDate, endDate), contractType, hasPayment).
|
|
@@ -790,4 +790,20 @@ func GetInvoiceListByFix() (results []*ContractInvoice, err error) {
|
|
|
sql := `SELECT * FROM contract_invoice WHERE invoice_type = 2 AND seller_id = 0 `
|
|
|
err = global.DEFAULT_MYSQL.Raw(sql).Find(&results).Error
|
|
|
return
|
|
|
+}
|
|
|
+
|
|
|
+// GetDuplicateContractInvoiceDetailItemList 补录合同用-获取开票到款列表
|
|
|
+func GetDuplicateContractInvoiceDetailItemListForSupplement(companyName, startDate, endDate string, contractType, hasPayment int) (list []*DupInvoice, err error) {
|
|
|
+ err = global.DEFAULT_MYSQL.Table("contract_invoice as a ").
|
|
|
+ Select(" a.*,GROUP_CONCAT(DISTINCT c.service_template_id ORDER BY c.service_template_id ) AS template_ids ").
|
|
|
+ Joins(" JOIN contract_register as b ON a.contract_register_id = b.contract_register_id ").
|
|
|
+ Joins("JOIN contract_service AS c ON a.contract_register_id = c.contract_register_id").
|
|
|
+ Where(fmt.Sprintf("a.is_deleted = 0 AND b.company_name = '%s' AND b.start_date= '%s' AND b.end_date= '%s' AND b.is_deleted=0 AND b.contract_type=? AND b.has_payment=?", companyName, startDate, endDate), contractType, hasPayment).
|
|
|
+ Group("a.contract_register_id").
|
|
|
+ Order("a.contract_invoice_id ASC").
|
|
|
+ Find(&list).Error
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return
|
|
|
}
|