|
@@ -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).
|
|
@@ -721,3 +721,19 @@ type NotPaymentCensusInfo struct {
|
|
|
ServiceProductId int `json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
|
|
|
UnitName string `json:"unit_name" description:"单位名称"`
|
|
|
}
|
|
|
+
|
|
|
+// 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
|
|
|
+}
|