优化客户和供应商的对账单
This commit is contained in:
@@ -99,7 +99,9 @@ public class AccountHeadService {
|
||||
if(ah.getTotalPrice() != null) {
|
||||
ah.setTotalPrice(ah.getTotalPrice().abs());
|
||||
}
|
||||
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
||||
if(ah.getBillTime() !=null) {
|
||||
ah.setBillTimeStr(getCenternTime(ah.getBillTime()));
|
||||
}
|
||||
resList.add(ah);
|
||||
}
|
||||
}
|
||||
@@ -308,9 +310,9 @@ public class AccountHeadService {
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
String getS = supplierId.toString();
|
||||
int i = 1;
|
||||
if (("customer").equals(supType)) { //客户
|
||||
if (("客户").equals(supType)) { //客户
|
||||
i = 1;
|
||||
} else if (("vendor").equals(supType)) { //供应商
|
||||
} else if (("供应商").equals(supType)) { //供应商
|
||||
i = -1;
|
||||
}
|
||||
//收付款部分
|
||||
|
||||
@@ -40,6 +40,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -422,8 +423,62 @@ public class DepotHeadService {
|
||||
public List<DepotHeadVo4StatementAccount> findStatementAccount(String beginTime, String endTime, Integer organId, String supType, Integer offset, Integer rows)throws Exception {
|
||||
List<DepotHeadVo4StatementAccount> list = null;
|
||||
try{
|
||||
int j = 1;
|
||||
if (supType.equals("客户")) { //客户
|
||||
j = 1;
|
||||
} else if (supType.equals("供应商")) { //供应商
|
||||
j = -1;
|
||||
}
|
||||
list =depotHeadMapperEx.findStatementAccount(beginTime, endTime, organId, supType, offset, rows);
|
||||
}catch(Exception e){
|
||||
if (null != list) {
|
||||
for (DepotHeadVo4StatementAccount dha : list) {
|
||||
dha.setNumber(dha.getNumber()); //单据编号
|
||||
dha.setType(dha.getType()); //类型
|
||||
String type = dha.getType();
|
||||
BigDecimal p1 = BigDecimal.ZERO ;
|
||||
BigDecimal p2 = BigDecimal.ZERO;
|
||||
if (dha.getDiscountLastMoney() != null) {
|
||||
p1 = dha.getDiscountLastMoney();
|
||||
}
|
||||
if (dha.getChangeAmount() != null) {
|
||||
p2 = dha.getChangeAmount();
|
||||
}
|
||||
BigDecimal allPrice = BigDecimal.ZERO;
|
||||
if ((p1.compareTo(BigDecimal.ZERO))==-1) {
|
||||
p1 = p1.abs();
|
||||
}
|
||||
if(dha.getOtherMoney()!=null) {
|
||||
p1 = p1.add(dha.getOtherMoney()); //与其它费用相加
|
||||
}
|
||||
if ((p2 .compareTo(BigDecimal.ZERO))==-1) {
|
||||
p2 = p2.abs();
|
||||
}
|
||||
if (type.equals("采购入库")) {
|
||||
allPrice = p2.subtract(p1);
|
||||
} else if (type.equals("销售退货入库")) {
|
||||
allPrice = p2.subtract(p1);
|
||||
} else if (type.equals("销售出库")) {
|
||||
allPrice = p1.subtract(p2);
|
||||
} else if (type.equals("采购退货出库")) {
|
||||
allPrice = p1.subtract(p2);
|
||||
} else if (type.equals("收款")) {
|
||||
allPrice = BigDecimal.ZERO.subtract(p1);
|
||||
} else if (type.equals("付款")) {
|
||||
allPrice = p1;
|
||||
} else if (type.equals("收入")) {
|
||||
allPrice = p1.subtract(p2);
|
||||
} else if (type.equals("支出")) {
|
||||
allPrice = p2.subtract(p1);
|
||||
}
|
||||
dha.setBillMoney(p1); //单据金额
|
||||
dha.setChangeAmount(p2); //实际支付
|
||||
DecimalFormat df = new DecimalFormat(".##");
|
||||
dha.setAllPrice(new BigDecimal(df.format(allPrice.multiply(new BigDecimal(j))))); //本期变化
|
||||
dha.setSupplierName(dha.getSupplierName()); //单位名称
|
||||
dha.setoTime(dha.getoTime()); //单据日期
|
||||
}
|
||||
}
|
||||
} catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
@@ -497,9 +552,9 @@ public class DepotHeadService {
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
String getS = supplierId.toString();
|
||||
int i = 1;
|
||||
if (("customer").equals(supType)) { //客户
|
||||
if (("客户").equals(supType)) { //客户
|
||||
i = 1;
|
||||
} else if (("vendor").equals(supType)) { //供应商
|
||||
} else if (("供应商").equals(supType)) { //供应商
|
||||
i = -1;
|
||||
}
|
||||
//进销部分
|
||||
|
||||
@@ -462,7 +462,9 @@ public class MaterialService {
|
||||
m.setModel(model);
|
||||
m.setColor(color);
|
||||
Long categoryId = materialCategoryService.getCategoryIdByName(categoryName);
|
||||
m.setCategoryId(categoryId);
|
||||
if(null!=categoryId){
|
||||
m.setCategoryId(categoryId);
|
||||
}
|
||||
m.setSafetyStock(parseBigDecimalEx(safetyStock));
|
||||
String manyUnit = ExcelUtils.getContent(src, i, 7); //副单位
|
||||
String barCode = ExcelUtils.getContent(src, i, 8); //基础条码
|
||||
|
||||
@@ -362,7 +362,7 @@ public class MaterialCategoryService {
|
||||
* @param name
|
||||
*/
|
||||
public Long getCategoryIdByName(String name){
|
||||
Long categoryId = 0L;
|
||||
Long categoryId = null;
|
||||
MaterialCategoryExample example = new MaterialCategoryExample();
|
||||
example.createCriteria().andNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
List<MaterialCategory> list = materialCategoryMapper.selectByExample(example);
|
||||
|
||||
@@ -95,12 +95,7 @@ public class SupplierService {
|
||||
for(Supplier s : list) {
|
||||
Integer supplierId = s.getId().intValue();
|
||||
String endTime = getNow3();
|
||||
String supType = null;
|
||||
if(("客户").equals(s.getType())) {
|
||||
supType = "customer";
|
||||
} else if(("供应商").equals(s.getType())) {
|
||||
supType = "vendor";
|
||||
}
|
||||
String supType = s.getType();
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
BigDecimal beginNeedGet = s.getBeginNeedGet();
|
||||
if(beginNeedGet==null) {
|
||||
|
||||
Reference in New Issue
Block a user