|
@@ -1569,9 +1569,9 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
case "开票金额":
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
+ condition += ` AND a.seller_id IN (` + sellerId + `) `
|
|
|
}
|
|
|
- condition += " AND a.is_deleted = 0 AND a.invoiced_amount > 0 AND b.invoice_type = 1 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
+ condition += " AND b.is_deleted = 0 AND a.invoice_type IN (1,3) AND a.invoice_time >= ? AND a.invoice_time <= ? "
|
|
|
pars = append(pars, startDate, endDate)
|
|
|
total, err := fms.GetContractInvoiceCount(condition, pars)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1580,7 +1580,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
return
|
|
|
}
|
|
|
trialTotal = total
|
|
|
- condition += " GROUP BY b.contract_invoice_id ORDER BY invoice_time DESC "
|
|
|
+ condition += " GROUP BY a.contract_invoice_id ORDER BY a.invoice_time DESC "
|
|
|
listFmsData, err := fms.GetContractRegisterList(condition, pars, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|
|
@@ -1601,9 +1601,9 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
case "到款金额":
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
+ condition += ` AND a.seller_id IN (` + sellerId + `) `
|
|
|
}
|
|
|
- condition += " AND a.is_deleted = 0 AND a.payment_amount > 0 AND b.invoice_type = 2 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
+ condition += " AND b.is_deleted = 0 AND a.invoice_type IN (2,4) AND a.invoice_time >= ? AND a.invoice_time <= ? "
|
|
|
pars = append(pars, startDate, endDate)
|
|
|
total, err := fms.GetContractInvoiceCount(condition, pars)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1612,7 +1612,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
return
|
|
|
}
|
|
|
trialTotal = total
|
|
|
- condition += " GROUP BY b.contract_invoice_id ORDER BY invoice_time DESC "
|
|
|
+ condition += " GROUP BY a.contract_invoice_id ORDER BY invoice_time DESC "
|
|
|
listFmsData, err := fms.GetContractRegisterList(condition, pars, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|
|
@@ -1633,14 +1633,14 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
case "未到款比例":
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
+ condition += ` AND a.seller_id IN (` + sellerId + `) `
|
|
|
}
|
|
|
var condition2 string
|
|
|
var pars2 []interface{}
|
|
|
- condition2 = condition + " AND a.is_deleted = 0 AND a.payment_amount > 0 AND b.invoice_type = 2 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
+ condition2 = condition + " AND b.is_deleted = 0 AND a.invoice_type IN (2,4) AND a.invoice_time >= ? AND a.invoice_time <= ? "
|
|
|
pars2 = append(pars2, startDate, endDate)
|
|
|
|
|
|
- condition += " AND a.is_deleted = 0 AND a.invoiced_amount > 0 AND b.invoice_type = 1 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
+ condition += " AND b.is_deleted = 0 AND a.invoice_type IN (1,3) AND a.invoice_time >= ? AND a.invoice_time <= ? "
|
|
|
pars = append(pars, startDate, endDate)
|
|
|
amount1, err := fms.GetContractInvoiceAmountCount(condition, pars) //开票金额总计
|
|
|
if err != nil {
|
|
@@ -1664,9 +1664,9 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
case "新客开票":
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
+ condition += ` AND a.seller_id IN (` + sellerId + `) `
|
|
|
}
|
|
|
- condition += " AND a.is_deleted = 0 AND a.contract_type = 1 AND a.invoiced_amount > 0 AND b.invoice_type = 1 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
+ condition += ` AND b.is_deleted = 0 AND b.contract_type = 1 AND a.invoice_type IN (1,3) AND a.invoice_time >= ? AND a.invoice_time <= ? `
|
|
|
pars = append(pars, startDate, endDate)
|
|
|
total, err := fms.GetContractInvoiceCount(condition, pars)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1675,8 +1675,9 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
return
|
|
|
}
|
|
|
trialTotal = total
|
|
|
- condition += " GROUP BY b.contract_invoice_id ORDER BY invoice_time DESC "
|
|
|
+ condition += " GROUP BY a.contract_invoice_id ORDER BY a.invoice_time DESC "
|
|
|
listFmsData, err := fms.GetContractRegisterList(condition, pars, startSize, pageSize)
|
|
|
+
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|
|
|
br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
|
|
@@ -1695,10 +1696,14 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "新客到款":
|
|
|
+ //if sellerId != "" {
|
|
|
+ // condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
+ //}
|
|
|
+ //condition += " AND a.is_deleted = 0 AND a.contract_type = 1 AND a.payment_amount > 0 AND b.invoice_type = 2 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
+ condition += ` AND a.seller_id IN (` + sellerId + `) `
|
|
|
}
|
|
|
- condition += " AND a.is_deleted = 0 AND a.contract_type = 1 AND a.payment_amount > 0 AND b.invoice_type = 2 AND b.invoice_time >= ? AND b.invoice_time <= ? "
|
|
|
+ condition += ` AND b.is_deleted = 0 AND b.contract_type = 1 AND a.invoice_type IN (2,4) AND a.invoice_time >= ? AND a.invoice_time <= ? `
|
|
|
pars = append(pars, startDate, endDate)
|
|
|
total, err := fms.GetContractInvoiceCount(condition, pars)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1707,7 +1712,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
return
|
|
|
}
|
|
|
trialTotal = total
|
|
|
- condition += " GROUP BY b.contract_invoice_id ORDER BY invoice_time DESC "
|
|
|
+ condition += ` GROUP BY a.contract_invoice_id ORDER BY a.invoice_time DESC `
|
|
|
listFmsData, err := fms.GetContractRegisterList(condition, pars, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|