|
@@ -1637,6 +1637,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
page.SetCurrent(1)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
cond += ` AND b.contract_amount <> b.invoiced_amount AND b.is_deleted = 0 AND b.contract_amount <> b.payment_amount AND b.contract_status <> 4 `
|
|
|
registerList, total, e := fms.GetInvoiceCensusPageList(page, cond, pars)
|
|
|
if e != nil {
|
|
@@ -1675,6 +1676,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
defer wg.Done()
|
|
|
|
|
|
|
|
|
+
|
|
|
summaryCond := cond
|
|
|
summaryCond += ` AND a.register_id IN ?`
|
|
|
summaryPars := pars
|
|
@@ -1685,11 +1687,24 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
resp.FailMsg("获取失败", "获取商品到款汇总列表失败, Err: "+e.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
+ fmt.Println("len(summaryData)", len(summaryData))
|
|
|
+
|
|
|
+
|
|
|
notQueryRegisterIds := make([]int, 0)
|
|
|
for _, v := range summaryData {
|
|
|
notQueryRegisterIds = append(notQueryRegisterIds, v.ContractRegisterId)
|
|
|
}
|
|
|
|
|
|
+ summaryList = summaryData
|
|
|
+
|
|
|
+
|
|
|
+ NotInvoiceSummaryMap := make(map[int][]*fms.NotInvoicePaymentSummaryItem, 0)
|
|
|
+ for _, v := range summaryList {
|
|
|
+ fmt.Println("v2.ContractRegisterId", v.ContractRegisterId)
|
|
|
+ NotInvoiceSummaryMap[v.RegisterId] = append(NotInvoiceSummaryMap[v.RegisterId], v)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
noSummaryCond += ` AND b.is_deleted = 0 AND b.contract_status <> 4 `
|
|
|
if len(notQueryRegisterIds) >0 {
|
|
|
noSummaryCond += ` AND b.contract_register_id IN ? AND b.contract_register_id NOT IN ?`
|
|
@@ -1698,26 +1713,19 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
noSummaryCond += ` AND b.contract_register_id IN ? `
|
|
|
noSummaryPars = append(noSummaryPars, queryRegisterIds)
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
noSummaryData, e := fms.GetNoInvoicePaymentCensusData(noSummaryCond, noSummaryPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("获取失败", "GetNoInvoicePaymentCensusData, Err: "+e.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
- fmt.Println("len(summaryData)", len(summaryData))
|
|
|
fmt.Println("len(noSummaryData)", len(noSummaryData))
|
|
|
- summaryList = summaryData
|
|
|
- NotInvoiceSummaryMap := make(map[int][]*fms.NotInvoicePaymentSummaryItem, 0)
|
|
|
- for _, v := range summaryList {
|
|
|
- fmt.Println("v2.ContractRegisterId", v.ContractRegisterId)
|
|
|
- NotInvoiceSummaryMap[v.RegisterId] = append(NotInvoiceSummaryMap[v.RegisterId], v)
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
summaryList = append(summaryList, noSummaryData...)
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
for _, v := range summaryList {
|
|
|
|
|
|
|
|
@@ -1725,6 +1733,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
|
|
|
|
|
|
if (v.ProductIds == "1,2" || v.ProductIds == "2,1") && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 1 {
|
|
|
+
|
|
|
if v.ServiceProductId == 1 {
|
|
|
if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
|
|
|
item := fms.NotInvoicePaymentSummaryItem{
|
|
@@ -1738,7 +1747,6 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item)
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
|
|
|
item := fms.NotInvoicePaymentSummaryItem{
|
|
@@ -1755,6 +1763,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
|
|
|
}
|
|
|
} else if (v.ProductIds == "1,2" || v.ProductIds == "2,1") && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 0 {
|
|
|
+
|
|
|
if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
|
|
|
item1 := fms.NotInvoicePaymentSummaryItem{
|
|
|
NotInvoicedAmountTotal: serviceAmount[2].ServiceAmount,
|
|
@@ -1778,6 +1787,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
|
|
|
}
|
|
|
} else if v.ProductIds == "1" && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 0 {
|
|
|
+
|
|
|
if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
|
|
|
item1 := fms.NotInvoicePaymentSummaryItem{
|
|
|
NotInvoicedAmountTotal: serviceAmount[1].ServiceAmount,
|
|
@@ -1791,6 +1801,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
|
|
|
}
|
|
|
} else if v.ProductIds == "2" && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 0 {
|
|
|
+
|
|
|
if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
|
|
|
item2 := fms.NotInvoicePaymentSummaryItem{
|
|
|
NotInvoicedAmountTotal: serviceAmount[2].ServiceAmount,
|
|
@@ -1831,6 +1842,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
unitMap[currencyList[i].Code] = currencyList[i].UnitName
|
|
|
}
|
|
|
|
|
|
+
|
|
|
for registerId, list := range NotInvoiceSummaryMap {
|
|
|
for _, v := range list {
|
|
|
fmt.Println("v.ContractRegisterId", v.ContractRegisterId)
|
|
@@ -1843,6 +1855,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
|
|
|
v.NotInvoicedAmountTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if v.SellerId > 0 && v.RaiSellerId > 0 {
|
|
|
if v.ServiceProductId == 1 {
|
|
|
if seller, ok := sellerMap[v.SellerId]; ok {
|
|
@@ -2198,19 +2211,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
|
|
|
for i := range currencyList {
|
|
|
unitMap[currencyList[i].Code] = currencyList[i].UnitName
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
sellerList, e := crmService.GetSellerDepartmentListWithEnable()
|
|
|
if e != nil {
|
|
|
resp.FailData("获取销售失败", "Err:"+e.Error(), c)
|
|
@@ -2329,12 +2330,6 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
|
|
|
Code: currencyList[i].Code,
|
|
|
FlagImg: currencyList[i].FlagImg,
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if len(summaryIds) == 0 {
|
|
@@ -2378,23 +2373,6 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
|
|
|
notpaymentCurrencyTotals[i].Amount = a
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}()
|
|
|
|
|
|
wg.Wait()
|