Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
07025a38
Commit
07025a38
authored
Jul 09, 2021
by
季圣华
Browse files
优化供应商客户金额统计
parent
d72baacf
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotHeadController.java
View file @
07025a38
...
@@ -211,9 +211,9 @@ public class DepotHeadController {
...
@@ -211,9 +211,9 @@ public class DepotHeadController {
beginNeed
=
supplier
.
getBeginNeedPay
();
beginNeed
=
supplier
.
getBeginNeedPay
();
}
}
BigDecimal
firstMoney
=
depotHeadService
.
findTotalPay
(
organId
,
beginTime
,
supType
)
BigDecimal
firstMoney
=
depotHeadService
.
findTotalPay
(
organId
,
beginTime
,
supType
)
.
add
(
accountHeadService
.
findTotalPay
(
organId
,
beginTime
,
supType
)).
add
(
beginNeed
);
.
subtract
(
accountHeadService
.
findTotalPay
(
organId
,
beginTime
,
supType
)).
add
(
beginNeed
);
BigDecimal
lastMoney
=
depotHeadService
.
findTotalPay
(
organId
,
endTime
,
supType
)
BigDecimal
lastMoney
=
depotHeadService
.
findTotalPay
(
organId
,
endTime
,
supType
)
.
add
(
accountHeadService
.
findTotalPay
(
organId
,
endTime
,
supType
)).
add
(
beginNeed
);
.
subtract
(
accountHeadService
.
findTotalPay
(
organId
,
endTime
,
supType
)).
add
(
beginNeed
);
map
.
put
(
"firstMoney"
,
firstMoney
);
//期初
map
.
put
(
"firstMoney"
,
firstMoney
);
//期初
map
.
put
(
"lastMoney"
,
lastMoney
);
//期末
map
.
put
(
"lastMoney"
,
lastMoney
);
//期末
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/accountHead/AccountHeadService.java
View file @
07025a38
...
@@ -313,7 +313,7 @@ public class AccountHeadService {
...
@@ -313,7 +313,7 @@ public class AccountHeadService {
}
}
/**
/**
* 查询单位的累计应收和累计应付,
收预付款不计入此处
* 查询
往来
单位的累计应收和累计应付,
只计入收款或付款
* @param supplierId
* @param supplierId
* @param endTime
* @param endTime
* @param supType
* @param supType
...
@@ -322,17 +322,11 @@ public class AccountHeadService {
...
@@ -322,17 +322,11 @@ public class AccountHeadService {
public
BigDecimal
findTotalPay
(
Integer
supplierId
,
String
endTime
,
String
supType
)
{
public
BigDecimal
findTotalPay
(
Integer
supplierId
,
String
endTime
,
String
supType
)
{
BigDecimal
sum
=
BigDecimal
.
ZERO
;
BigDecimal
sum
=
BigDecimal
.
ZERO
;
String
getS
=
supplierId
.
toString
();
String
getS
=
supplierId
.
toString
();
int
i
=
1
;
if
((
"客户"
).
equals
(
supType
))
{
//客户
if
((
"客户"
).
equals
(
supType
))
{
//客户
i
=
1
;
sum
=
allMoney
(
getS
,
"收款"
,
"合计"
,
endTime
)
;
}
else
if
((
"供应商"
).
equals
(
supType
))
{
//供应商
}
else
if
((
"供应商"
).
equals
(
supType
))
{
//供应商
i
=
-
1
;
sum
=
allMoney
(
getS
,
"付款"
,
"合计"
,
endTime
)
;
}
}
//收付款部分
sum
=
sum
.
subtract
((
allMoney
(
getS
,
"收款"
,
"合计"
,
endTime
)).
multiply
(
new
BigDecimal
(
i
)));
sum
=
sum
.
add
((
allMoney
(
getS
,
"付款"
,
"合计"
,
endTime
)).
multiply
(
new
BigDecimal
(
i
)));
sum
=
sum
.
add
((
allMoney
(
getS
,
"收入"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"收入"
,
"实际"
,
endTime
))).
multiply
(
new
BigDecimal
(
i
)));
sum
=
sum
.
subtract
((
allMoney
(
getS
,
"支出"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"支出"
,
"实际"
,
endTime
))).
multiply
(
new
BigDecimal
(
i
)));
return
sum
;
return
sum
;
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
07025a38
...
@@ -551,17 +551,11 @@ public class DepotHeadService {
...
@@ -551,17 +551,11 @@ public class DepotHeadService {
public
BigDecimal
findTotalPay
(
Integer
supplierId
,
String
endTime
,
String
supType
)
{
public
BigDecimal
findTotalPay
(
Integer
supplierId
,
String
endTime
,
String
supType
)
{
BigDecimal
sum
=
BigDecimal
.
ZERO
;
BigDecimal
sum
=
BigDecimal
.
ZERO
;
String
getS
=
supplierId
.
toString
();
String
getS
=
supplierId
.
toString
();
int
i
=
1
;
if
((
"客户"
).
equals
(
supType
))
{
//客户
if
((
"客户"
).
equals
(
supType
))
{
//客户
i
=
1
;
sum
=
allMoney
(
getS
,
"出库"
,
"销售"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"出库"
,
"销售"
,
"实际"
,
endTime
))
;
}
else
if
((
"供应商"
).
equals
(
supType
))
{
//供应商
}
else
if
((
"供应商"
).
equals
(
supType
))
{
//供应商
i
=
-
1
;
sum
=
allMoney
(
getS
,
"入库"
,
"采购"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"入库"
,
"采购"
,
"实际"
,
endTime
))
;
}
}
//进销部分
sum
=
sum
.
subtract
((
allMoney
(
getS
,
"入库"
,
"采购"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"入库"
,
"采购"
,
"实际"
,
endTime
))).
multiply
(
new
BigDecimal
(
i
)));
sum
=
sum
.
subtract
((
allMoney
(
getS
,
"入库"
,
"销售退货"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"入库"
,
"销售退货"
,
"实际"
,
endTime
))).
multiply
(
new
BigDecimal
(
i
)));
sum
=
sum
.
add
((
allMoney
(
getS
,
"出库"
,
"销售"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"出库"
,
"销售"
,
"实际"
,
endTime
))).
multiply
(
new
BigDecimal
(
i
)));
sum
=
sum
.
add
((
allMoney
(
getS
,
"出库"
,
"采购退货"
,
"合计"
,
endTime
).
subtract
(
allMoney
(
getS
,
"出库"
,
"采购退货"
,
"实际"
,
endTime
))).
multiply
(
new
BigDecimal
(
i
)));
return
sum
;
return
sum
;
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/supplier/SupplierService.java
View file @
07025a38
...
@@ -105,15 +105,13 @@ public class SupplierService {
...
@@ -105,15 +105,13 @@ public class SupplierService {
if
(
beginNeedPay
==
null
)
{
if
(
beginNeedPay
==
null
)
{
beginNeedPay
=
BigDecimal
.
ZERO
;
beginNeedPay
=
BigDecimal
.
ZERO
;
}
}
sum
=
sum
.
add
(
depotHeadService
.
findTotalPay
(
supplierId
,
endTime
,
supType
))
;
sum
=
sum
.
add
(
depotHeadService
.
findTotalPay
(
supplierId
,
endTime
,
supType
))
sum
=
sum
.
add
(
accountHeadService
.
findTotalPay
(
supplierId
,
endTime
,
supType
));
.
subtract
(
accountHeadService
.
findTotalPay
(
supplierId
,
endTime
,
supType
));
if
((
"客户"
).
equals
(
s
.
getType
()))
{
if
((
"客户"
).
equals
(
s
.
getType
()))
{
sum
=
sum
.
add
(
beginNeedGet
)
.
subtract
(
beginNeedPay
)
;
sum
=
sum
.
add
(
beginNeedGet
);
s
.
setAllNeedGet
(
sum
);
s
.
setAllNeedGet
(
sum
);
s
.
setAllNeedPay
(
BigDecimal
.
ZERO
);
}
else
if
((
"供应商"
).
equals
(
s
.
getType
()))
{
}
else
if
((
"供应商"
).
equals
(
s
.
getType
()))
{
sum
=
sum
.
add
(
beginNeedPay
).
subtract
(
beginNeedGet
);
sum
=
sum
.
add
(
beginNeedPay
);
s
.
setAllNeedGet
(
BigDecimal
.
ZERO
);
s
.
setAllNeedPay
(
sum
);
s
.
setAllNeedPay
(
sum
);
}
}
resList
.
add
(
s
);
resList
.
add
(
s
);
...
...
jshERP-boot/src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
07025a38
...
@@ -187,8 +187,8 @@
...
@@ -187,8 +187,8 @@
and dh.oper_time
<
= #{endTime}
and dh.oper_time
<
= #{endTime}
</if>
</if>
and ifnull(m.delete_flag,'0') !='1'
and ifnull(m.delete_flag,'0') !='1'
group by m.id
,m.name, m.model, m.unit, m.color, u.name
group by m.id
order by m.
name, m.model a
sc
order by m.
id de
sc
<if
test=
"offset != null and rows != null"
>
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
limit #{offset},#{rows}
</if>
</if>
...
@@ -265,12 +265,12 @@
...
@@ -265,12 +265,12 @@
<select
id=
"getStockByParam"
resultMap=
"StockMap"
>
<select
id=
"getStockByParam"
resultMap=
"StockMap"
>
select ifnull((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal),0) as in_stock,
select ifnull((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal),0) as in_stock,
ifnull((curep.
transfO
utTotal+curep.
o
utTotal+curep.assemOutTotal+curep.disAssemOutTotal),0) out_stock
ifnull((curep.
o
utTotal+curep.
transfO
utTotal+curep.assemOutTotal+curep.disAssemOutTotal),0) out_stock
from
from
(select sum(if(dh.type='入库'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
, di.basic_number,0)) as inTotal,
(select sum(if(dh.type='入库'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
, di.basic_number,0)) as inTotal,
sum(if(dh.type='出库' and dh.sub_type!='调拨'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as outTotal,
sum(if(dh.sub_type='调拨'
<if
test=
"depotId != null"
>
and di.another_depot_id=#{depotId}
</if>
,di.basic_number,0)) as transfInTotal,
sum(if(dh.sub_type='调拨'
<if
test=
"depotId != null"
>
and di.another_depot_id=#{depotId}
</if>
,di.basic_number,0)) as transfInTotal,
sum(if(dh.sub_type='调拨'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as transfOutTotal,
sum(if(dh.sub_type='调拨'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as transfOutTotal,
sum(if(dh.type='出库' and dh.sub_type!='调拨'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as outTotal,
sum(if(dh.sub_type='组装单' and di.material_type='组合件'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as assemInTotal,
sum(if(dh.sub_type='组装单' and di.material_type='组合件'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as assemInTotal,
sum(if(dh.sub_type='组装单' and di.material_type='普通子件'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as assemOutTotal,
sum(if(dh.sub_type='组装单' and di.material_type='普通子件'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as assemOutTotal,
sum(if(dh.sub_type='拆卸单' and di.material_type='普通子件'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as disAssemInTotal,
sum(if(dh.sub_type='拆卸单' and di.material_type='普通子件'
<if
test=
"depotId != null"
>
and di.depot_id=#{depotId}
</if>
,di.basic_number,0)) as disAssemInTotal,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment