增加-预付款充值和消费的功能

This commit is contained in:
季圣华
2017-06-27 23:43:38 +08:00
parent 882f32ceac
commit a571968393
16 changed files with 262 additions and 23 deletions

View File

@@ -158,6 +158,56 @@ public class SupplierAction extends BaseAction<SupplierModel>
new Timestamp(System.currentTimeMillis())
, tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "", "更新供应商" + tipMsg));
}
/**
* 更新供应商-只更新预付款,其余用原来的值
* @return
*/
public void updateAdvanceIn()
{
Boolean flag = false;
try
{
Supplier supplier = supplierService.get(model.getSupplierID());
supplier.setContacts(supplier.getContacts());
supplier.setType(supplier.getType());
supplier.setDescription(supplier.getDescription());
supplier.setEmail(supplier.getEmail());
supplier.setAdvanceIn(supplier.getAdvanceIn() + model.getAdvanceIn()); //增加预收款的金额,可能增加的是负值
supplier.setBeginNeedGet(supplier.getBeginNeedGet());
supplier.setBeginNeedPay(supplier.getBeginNeedPay());
supplier.setIsystem((short)1);
supplier.setPhonenum(supplier.getPhonenum());
supplier.setSupplier(supplier.getSupplier());
supplier.setEnabled(supplier.getEnabled());
supplierService.update(supplier);
flag = true;
tipMsg = "成功";
tipType = 0;
}
catch (DataAccessException e)
{
Log.errorFileSync(">>>>>>>>>>>>>修改供应商ID为 " + model.getSupplierID() + "信息失败", e);
flag = false;
tipMsg = "失败";
tipType = 1;
}
finally
{
try
{
toClient(flag.toString());
}
catch (IOException e)
{
Log.errorFileSync(">>>>>>>>>>>>修改供应商回写客户端结果异常", e);
}
}
logService.create(new Logdetails(getUser(), "更新供应商预付款", model.getClientIp(),
new Timestamp(System.currentTimeMillis())
, tipType, "更新供应商ID为 "+ model.getSupplierID() + " " + tipMsg + "", "更新供应商" + tipMsg));
}
/**
* 批量删除指定ID供应商
@@ -244,6 +294,7 @@ public class SupplierAction extends BaseAction<SupplierModel>
item.put("contacts",supplier.getContacts());
item.put("phonenum", supplier.getPhonenum());
item.put("email", supplier.getEmail());
item.put("AdvanceIn",supplier.getAdvanceIn());
item.put("BeginNeedGet",supplier.getBeginNeedGet());
item.put("BeginNeedPay",supplier.getBeginNeedPay());
item.put("isystem", supplier.getIsystem() == (short)0?"":"");

View File

@@ -92,6 +92,7 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
depotHead.setChangeAmount(model.getChangeAmount());
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
depotHead.setTotalPrice(model.getTotalPrice());
depotHead.setPayType(model.getPayType());
depotHead.setRemark(model.getRemark());
depotHeadService.create(depotHead);
@@ -181,7 +182,8 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
if(model.getAccountId()!=null){depotHead.setAccountId(new Account(model.getAccountId()));}
depotHead.setChangeAmount(model.getChangeAmount());
if(model.getAllocationProjectId()!=null){depotHead.setAllocationProjectId(new Depot(model.getAllocationProjectId()));}
depotHead.setTotalPrice(model.getTotalPrice());
depotHead.setTotalPrice(model.getTotalPrice());
depotHead.setPayType(model.getPayType());
depotHead.setRemark(model.getRemark());
depotHeadService.update(depotHead);

View File

@@ -2,6 +2,9 @@ package com.jsh.dao.basic;
import com.jsh.base.BaseDAO;
import com.jsh.model.po.Supplier;
import com.jsh.util.PageUtil;
import com.jsh.util.SearchConditionUtil;
import org.hibernate.Query;
public class SupplierDAO extends BaseDAO<Supplier> implements SupplierIDAO
{
@@ -14,6 +17,5 @@ public class SupplierDAO extends BaseDAO<Supplier> implements SupplierIDAO
{
return Supplier.class;
}
}

View File

@@ -5,5 +5,4 @@ import com.jsh.model.po.Supplier;
public interface SupplierIDAO extends BaseIDAO<Supplier>
{
}

View File

@@ -19,6 +19,7 @@ public class DepotHead implements java.io.Serializable
private Double ChangeAmount;
private Depot AllocationProjectId;
private Double TotalPrice;
private String PayType;
private String Remark;
public DepotHead()
@@ -34,7 +35,7 @@ public class DepotHead implements java.io.Serializable
public DepotHead(String type, String subType, Depot projectId,
String number, String operPersonName, Timestamp createTime,
Timestamp operTime, Supplier organId, Person handsPersonId,
Account accountId, Double changeAmount, Depot allocationProjectId, Double totalPrice, String remark) {
Account accountId, Double changeAmount, Depot allocationProjectId, Double totalPrice,String payType, String remark) {
super();
Type = type;
SubType = subType;
@@ -49,6 +50,7 @@ public class DepotHead implements java.io.Serializable
ChangeAmount = changeAmount;
AllocationProjectId = allocationProjectId;
TotalPrice = totalPrice;
PayType = payType;
Remark = remark;
}
@@ -164,6 +166,14 @@ public class DepotHead implements java.io.Serializable
TotalPrice = totalPrice;
}
public String getPayType() {
return PayType;
}
public void setPayType(String payType) {
PayType = payType;
}
public String getRemark() {
return Remark;
}

View File

@@ -9,6 +9,7 @@ public class Supplier implements java.io.Serializable
private String contacts;
private String phonenum;
private String email;
private Double advanceIn;
private Double BeginNeedGet;
private Double BeginNeedPay;
private Double AllNeedGet;
@@ -28,7 +29,7 @@ public class Supplier implements java.io.Serializable
}
public Supplier(String supplier, String type, String contacts, String phonenum,
String email, Short isystem, String description, Boolean enabled,
String email, Short isystem, String description, Boolean enabled, Double advanceIn,
Double beginNeedGet,Double beginNeedPay,Double allNeedGet,Double allNeedPay) {
super();
this.supplier = supplier;
@@ -43,6 +44,7 @@ public class Supplier implements java.io.Serializable
this.isystem = isystem;
this.description = description;
this.enabled = enabled;
this.advanceIn = advanceIn;
}
public Long getId()
@@ -158,6 +160,13 @@ public class Supplier implements java.io.Serializable
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
}
public Double getAdvanceIn() {
return advanceIn;
}
public void setAdvanceIn(Double advanceIn) {
this.advanceIn = advanceIn;
}
}

View File

@@ -31,12 +31,17 @@ public class SupplierModel implements Serializable
/**
* 电子邮箱
*/
private String email = "";
/**
* 期初应收
private String email = "";
/**
* 预付款
*/
private Double BeginNeedGet;
private Double AdvanceIn;
/**
* 期初应收
*/
private Double BeginNeedGet;
/**
* 期初应付
@@ -135,6 +140,14 @@ public class SupplierModel implements Serializable
public void setEmail(String email) {
this.email = email;
}
public Double getAdvanceIn() {
return AdvanceIn;
}
public void setAdvanceIn(Double advanceIn) {
AdvanceIn = advanceIn;
}
public void setBeginNeedGet(Double beginNeedGet)
{

View File

@@ -21,6 +21,7 @@ public class DepotHeadModel implements Serializable
private Double ChangeAmount;
private Long AllocationProjectId;
private Double TotalPrice;
private String PayType = "";
private String Remark = "";
private String BeginTime; //查询开始时间
@@ -158,6 +159,14 @@ public class DepotHeadModel implements Serializable
TotalPrice = totalPrice;
}
public String getPayType() {
return PayType;
}
public void setPayType(String payType) {
PayType = payType;
}
public String getRemark() {
return Remark;
}

View File

@@ -5,5 +5,5 @@ import com.jsh.model.po.Supplier;
public interface SupplierIService extends BaseIService<Supplier>
{
}

View File

@@ -3,6 +3,7 @@ package com.jsh.service.basic;
import com.jsh.base.BaseService;
import com.jsh.dao.basic.SupplierIDAO;
import com.jsh.model.po.Supplier;
import com.jsh.util.JshException;
public class SupplierService extends BaseService<Supplier> implements SupplierIService
{
@@ -22,4 +23,5 @@ public class SupplierService extends BaseService<Supplier> implements SupplierIS
{
return Supplier.class;
}
}

View File

@@ -72,6 +72,11 @@
<comment>合计金额</comment>
</column>
</property>
<property generated="never" lazy="false" name="PayType" type="java.lang.String">
<column length="50" name="PayType">
<comment>付款类型</comment>
</column>
</property>
<property generated="never" lazy="false" name="Remark" type="java.lang.String">
<column length="1000" name="Remark">
<comment>备注</comment>

View File

@@ -32,6 +32,11 @@
<comment>电子邮箱</comment>
</column>
</property>
<property generated="never" lazy="false" name="AdvanceIn" type="java.lang.Double">
<column name="AdvanceIn" precision="22" scale="3">
<comment>预收款</comment>
</column>
</property>
<property generated="never" lazy="false" name="BeginNeedGet" type="java.lang.Double">
<column name="BeginNeedGet" precision="22" scale="3">
<comment>期初应收</comment>

View File

@@ -10,7 +10,8 @@
var accountHeadMaxId = null; //获取最大的Id
var accepId = null; //保存的主表id
var url;
var accountHeadID = 0;
var accountHeadID = 0;
var preTotalPrice = 0; //前一次加载的金额
var orgAccountHead = ""; //保存编辑前的名称
var editIndex = undefined;
var listTitle = ""; //单据标题
@@ -36,6 +37,7 @@
listTitle = $("#tablePanel").prev().text();
var supUrl = path + "/supplier/findBySelect_sup.action"; //供应商接口
var cusUrl = path + "/supplier/findBySelect_cus.action"; //客户接口
var retailUrl = path + "/supplier/findBySelect_retail.action"; //散户接口
if(listTitle === "收入单列表"){
listType = "收入";
itemType = false; //显示当前列
@@ -76,6 +78,14 @@
inOrOut = "";
organUrl = supUrl;
}
else if(listTitle === "收预付款列表"){
listType = "收预付款";
itemType = true; //隐藏当前列
moneyType = false; //显示当前列
payTypeTitle = "无标题";
inOrOut = "";
organUrl = retailUrl;
}
}
//获取账户信息
function initSystemData_account(){
@@ -117,7 +127,13 @@
$('#OrganId').combobox({
url: organUrl,
valueField:'id',
textField:'supplier'
textField:'supplier',
formatter: function(row){
var opts = $(this).combobox('options');
if(row[opts.textField]!=="非会员") {
return row[opts.textField];
}
}
});
}
@@ -199,6 +215,7 @@
pageList: initPageNum,
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{field: 'OrganId',width:5, hidden:true},
{ title: '单据编号',field: 'BillNo',width:100},
{ title: '单据时间 ',field: 'BillTime',width:100},
{ title: '合计',field: 'TotalPrice',width:80},
@@ -213,7 +230,7 @@
{
str += '<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
str += '<img src="' + path + '/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editAccountHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="' + path + '/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.Id +');"/>&nbsp;<a onclick="deleteAccountHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
str += '<img src="' + path + '/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.Id +',' + rec.OrganId +',' + rec.TotalPrice+ ');"/>&nbsp;<a onclick="deleteAccountHead('+ rec.Id +',' + rec.OrganId +',' + rec.TotalPrice +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
}
return str;
}
@@ -441,7 +458,7 @@
}
//删除财务信息
function deleteAccountHead(accountHeadID){
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
{
if (r)
@@ -471,7 +488,29 @@
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
return;
}
});
});
//更新会员的预收款信息
if(listType === "收预付款"){
$.ajax({
type:"post",
url: path + "/supplier/updateAdvanceIn.action",
dataType: "json",
data:{
SupplierID: thisOrganId, //会员id
AdvanceIn: 0-totalPrice //删除时同时删除用户的预付款信息
},
success: function(res){
if(res) {
//保存会员预收款成功
}
},
error: function(){
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
return;
}
});
}
}
});
}
@@ -491,16 +530,38 @@
if (r)
{
var ids = "";
for(var i = 0;i < row.length; i ++)
{
for(var i = 0;i < row.length; i ++) {
if(i == row.length-1)
{
ids += row[i].Id;
break;
}
//alert(row[i].id);
ids += row[i].Id + ",";
}
//批量更新会员的预收款信息
for(var i = 0;i < row.length; i ++) {
if(listType === "收预付款"){
$.ajax({
type:"post",
url: path + "/supplier/updateAdvanceIn.action",
dataType: "json",
data:{
SupplierID: row[i].OrganId, //会员id
AdvanceIn: 0 - row[i].TotalPrice //删除时同时删除用户的预付款信息
},
success: function(res){
if(res) {
//保存会员预收款成功
}
},
error: function(){
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
return;
}
});
}
}
//批量删除
$.ajax({
type:"post",
url: path + "/accountHead/batchDelete.action",
@@ -562,6 +623,7 @@
$("#HandsPersonId").val(accountHeadInfo[8]);
$("#ChangeAmount").val(accountHeadInfo[10]);
var TotalPrice = accountHeadInfo[11];
preTotalPrice = accountHeadInfo[11]; //记录前一次合计金额,用于收预付款
var editTitle = listTitle.replace("列表","信息");
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑' + editTitle);
$(".window-mask").css({ width: webW ,height: webH});
@@ -643,6 +705,36 @@
//支出和付款为负数
TotalPrice = 0 - TotalPrice;
}
//更新会员的预收款信息
if(listType === "收预付款"){
var advanceIn = 0; //预付款金额
if(accountHeadID){
advanceIn = TotalPrice - preTotalPrice; //修改时,预付款=合计金额-加载金额
}
else{
advanceIn = TotalPrice; //新增时,预付款=合计金额
}
$.ajax({
type:"post",
url: path + "/supplier/updateAdvanceIn.action",
dataType: "json",
data:{
SupplierID: OrganId,
AdvanceIn: advanceIn
},
success: function(res){
if(res) {
//保存会员预收款成功
}
},
error: function(){
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
return;
}
});
}
//保存单位信息
$.ajax({
type:"post",
url: url,

View File

@@ -734,6 +734,7 @@
//零售单据修改收款时,自动计算找零
if(listSubType == "零售" || listSubType == "零售退货") {
$("#payType").val("现付");
$("#OrganId").combobox("setValue", orgDefaultId);
var getAmount = $("#depotHeadFM .get-amount");
var changeAmount = $("#depotHeadFM .change-amount");
@@ -857,6 +858,13 @@
ChangeAmount = 0 - ChangeAmount;
TotalPrice = 0 - TotalPrice;
}
//零售时候,可以从会员预付款中扣款
var thisPayType = "现付";
if(listSubType === "零售" || listSubType === "零售退货") {
if($("#payType").val() ==="预付款") {
thisPayType = "预付款";
}
}
$.ajax({
type:"post",
url: url,
@@ -874,6 +882,7 @@
AccountId: $.trim($("#AccountId").val()),
ChangeAmount: ChangeAmount, //付款/收款
TotalPrice: TotalPrice, //合计
PayType: thisPayType, //现付/预付款
Remark: $.trim($("#Remark").val()),
clientIp: clientIp
}),
@@ -891,6 +900,29 @@
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
if(thisPayType === "预付款") {
//更新用户信息-预付款
$.ajax({
type:"post",
url: path + "/supplier/updateAdvanceIn.action",
dataType: "json",
data:{
SupplierID: OrganId, //会员id
AdvanceIn: 0 - ChangeAmount //保存的同时扣掉用户的预付款
},
success: function(res){
if(res) {
//保存会员预收款成功
}
},
error: function(){
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
return;
}
});
}
closeDialog();
}
else

View File

@@ -203,6 +203,7 @@
{ title: '联系人', field: 'contacts',width:50,align:"center"},
{ title: '联系电话', field: 'phonenum',width:60,align:"center"},
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
{ title: '预付款',field: 'AdvanceIn',width:70,align:"center"},
{ title: '期初应收',field: 'BeginNeedGet',width:70,align:"center"},
{ title: '期初应付',field: 'BeginNeedPay',width:70,align:"center"},
{ title: '类型',field: 'type',width:50},

View File

@@ -87,9 +87,16 @@
</tr>
<tr>
<td>单据备注:</td>
<td style="padding:5px" colspan="5">
<td style="padding:5px" colspan="3">
<input name="Remark" id="Remark" class="easyui-validatebox" style="width: 292px;"/>
</td>
<td>付款类型:</td>
<td style="padding:5px">
<select name="payType" id="payType" style="width:130px;">
<option value="现付">现付</option>
<option value="预付款">预付款</option>
</select>
</td>
</tr>
<tr>
<td colspan="6">