|
@@ -811,29 +811,6 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
historyCond += ` AND new_company = 0 `
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if req.ServiceTypes != "" {
|
|
|
- serviceTypes := strings.Split(req.ServiceTypes, ",")
|
|
|
- registerIds, e := fms.GetContractRegisterIdsByTempId(serviceTypes)
|
|
|
- if e != nil {
|
|
|
- err = fmt.Errorf("获取合同登记IDs失败, Err: %s", e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- if len(registerIds) > 0 {
|
|
|
- cond += ` AND b.contract_register_id IN ?`
|
|
|
- pars = append(pars, registerIds)
|
|
|
- } else {
|
|
|
- cond += ` AND 1 = 2`
|
|
|
- }
|
|
|
-
|
|
|
- if req.StartDate == "" {
|
|
|
- req.StartDate = "2023-04"
|
|
|
- req.EndDate = "3023-04"
|
|
|
- } else {
|
|
|
- req.StartDate = "2023-04"
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
var latestTime time.Time
|
|
|
|
|
|
invoiceItem, err := fms.GetLatestIncome(cond, pars)
|
|
@@ -865,6 +842,32 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
var reqStartDate, reqEndDate time.Time
|
|
|
historyTime, _ := time.Parse(utils.FormatDate, "2023-04-01")
|
|
|
|
|
|
+
|
|
|
+ if req.ServiceTypes != "" {
|
|
|
+ serviceTypes := strings.Split(req.ServiceTypes, ",")
|
|
|
+ registerIds, e := fms.GetContractRegisterIdsByTempId(serviceTypes)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("获取合同登记IDs失败, Err: %s", e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(registerIds) > 0 {
|
|
|
+ cond += ` AND b.contract_register_id IN ?`
|
|
|
+ pars = append(pars, registerIds)
|
|
|
+ } else {
|
|
|
+ cond += ` AND 1 = 2`
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.StartDate == "" {
|
|
|
+ req.StartDate = "2023-04"
|
|
|
+ req.EndDate = "3023-04"
|
|
|
+ } else {
|
|
|
+ startDateTime, _ := time.Parse(utils.FormatMonth, req.StartDate)
|
|
|
+ if startDateTime.Before(historyTime) {
|
|
|
+ req.StartDate = "2023-04"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if req.StartDate != "" && req.EndDate != "" {
|
|
|
st := fmt.Sprint(req.StartDate, "-01 00:00:00")
|
|
|
ed := fmt.Sprint(req.EndDate, "-01 23:59:59")
|
|
@@ -1604,6 +1607,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
item.SellerName = v.SellerName
|
|
|
item.RaiSellerId = v.RaiSellerId
|
|
|
item.RaiSellerName = v.RaiSellerName
|
|
|
+ item.RMBRate = v.RMBRate
|
|
|
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item)
|
|
|
}
|
|
@@ -1617,6 +1621,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
item.SellerName = v.SellerName
|
|
|
item.RaiSellerId = v.RaiSellerId
|
|
|
item.RaiSellerName = v.RaiSellerName
|
|
|
+ item.RMBRate = v.RMBRate
|
|
|
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item)
|
|
|
}
|
|
@@ -1633,6 +1638,8 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
item1.SellerName = v.SellerName
|
|
|
item1.RaiSellerId = v.RaiSellerId
|
|
|
item1.RaiSellerName = v.RaiSellerName
|
|
|
+ item1.RMBRate = v.RMBRate
|
|
|
+
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
|
|
|
|
|
|
item2 := fms.NotInvoicePaymentSummaryItem{
|
|
@@ -1643,6 +1650,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
item2.SellerName = v.SellerName
|
|
|
item2.RaiSellerId = v.RaiSellerId
|
|
|
item2.RaiSellerName = v.RaiSellerName
|
|
|
+ item2.RMBRate = v.RMBRate
|
|
|
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
|
|
|
}
|
|
@@ -1657,6 +1665,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
item1.SellerName = v.SellerName
|
|
|
item1.RaiSellerId = v.RaiSellerId
|
|
|
item1.RaiSellerName = v.RaiSellerName
|
|
|
+ item1.RMBRate = v.RMBRate
|
|
|
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
|
|
|
}
|
|
@@ -1671,6 +1680,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
item2.SellerName = v.SellerName
|
|
|
item2.RaiSellerId = v.RaiSellerId
|
|
|
item2.RaiSellerName = v.RaiSellerName
|
|
|
+ item2.RMBRate = v.RMBRate
|
|
|
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
|
|
|
}
|
|
@@ -1703,7 +1713,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
for registerId, list := range NotInvoiceSummaryMap {
|
|
|
- for _, v := range list {
|
|
|
+ for i, v := range list {
|
|
|
|
|
|
|
|
|
|
|
@@ -1713,26 +1723,27 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
|
|
|
if _, ok := serviceAmountMap[registerId]; ok {
|
|
|
if _, ok2 := serviceAmountMap[registerId][v.ServiceProductId]; ok2 {
|
|
|
- v.NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
|
|
|
+ list[i].NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- v.NotInvoicedAmountOriginTotal = v.InvoiceAmountTotal - v.PaymentAmountTotal
|
|
|
+ list[i].NotInvoicedAmountOriginTotal = v.InvoiceAmountTotal - v.PaymentAmountTotal
|
|
|
}
|
|
|
} else {
|
|
|
if _, ok := serviceAmountMap[registerId]; ok {
|
|
|
|
|
|
if _, ok2 := serviceAmountMap[registerId][v.ServiceProductId]; ok2 {
|
|
|
- v.NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
|
|
|
+ list[i].NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
|
|
|
}
|
|
|
} else {
|
|
|
|
|
|
- v.NotInvoicedAmountOriginTotal = v.PaymentAmountTotal - v.InvoiceAmountTotal
|
|
|
+ list[i].NotInvoicedAmountOriginTotal = v.PaymentAmountTotal - v.InvoiceAmountTotal
|
|
|
}
|
|
|
}
|
|
|
- v.NotInvoicedAmountTotal = v.NotInvoicedAmountOriginTotal / v.RMBRate
|
|
|
- v.NotInvoicedAmountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", v.NotInvoicedAmountTotal), 64)
|
|
|
}
|
|
|
+ list[i].NotInvoicedAmountTotal = v.NotInvoicedAmountOriginTotal / v.RMBRate
|
|
|
+ list[i].NotInvoicedAmountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", v.NotInvoicedAmountTotal), 64)
|
|
|
+
|
|
|
|
|
|
if v.SellerId > 0 && v.RaiSellerId > 0 {
|
|
|
if v.ServiceProductId == 1 {
|
|
@@ -2439,7 +2450,7 @@ func ExportNotInvoiceCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
|
|
|
} else {
|
|
|
|
|
|
dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountOriginTotal))
|
|
|
- dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal))
|
|
|
+ dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal))
|
|
|
|
|
|
dataRow.AddCell().SetString(serviceProductIdMap[item.ServiceProductId])
|
|
|
|