优化预付款的功能
This commit is contained in:
parent
f8f61c64db
commit
a9377a0669
@ -423,6 +423,7 @@ public class AccountAction extends BaseAction<AccountModel>
|
||||
*/
|
||||
Map<String,Object> condition = new HashMap<String,Object>();
|
||||
condition.put("AccountId_n_eq", id);
|
||||
condition.put("PayType_s_neq", "预付款");
|
||||
if(!monthTime.equals("")){
|
||||
condition.put("OperTime_s_gteq", monthTime + "-01 00:00:00");
|
||||
condition.put("OperTime_s_lteq", monthTime + "-31 00:00:00");
|
||||
|
||||
@ -421,6 +421,7 @@ public class SupplierAction extends BaseAction<SupplierModel>
|
||||
item.put("id", supplier.getId());
|
||||
//客户名称
|
||||
item.put("supplier", supplier.getSupplier());
|
||||
item.put("advanceIn", supplier.getAdvanceIn()); //预付款金额
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,6 +282,7 @@ public class DepotHeadAction extends BaseAction<DepotHeadModel>
|
||||
item.put("AllocationProjectId", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getId());
|
||||
item.put("AllocationProjectName", depotHead.getAllocationProjectId()==null?"":depotHead.getAllocationProjectId().getName());
|
||||
item.put("TotalPrice", depotHead.getTotalPrice()==null?"":Math.abs(depotHead.getTotalPrice()));
|
||||
item.put("payType", depotHead.getPayType()==null?"":depotHead.getPayType());
|
||||
item.put("Remark", depotHead.getRemark());
|
||||
item.put("op", 1);
|
||||
dataArray.add(item);
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
var listTitle = ""; //单据标题
|
||||
var payTypeTitle = "";//收入 支出
|
||||
var organUrl = ""; //组织数据接口地址
|
||||
var amountNum = ""; //单据编号开头字符
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = true; //隐藏当前列
|
||||
var inOrOut = ""; //链接类型为收入或者支出
|
||||
@ -45,6 +46,7 @@
|
||||
payTypeTitle = "收入项目";
|
||||
inOrOut = "in";
|
||||
organUrl = cusUrl;
|
||||
amountNum = "SR";
|
||||
}
|
||||
else if(listTitle === "支出单列表"){
|
||||
listType = "支出";
|
||||
@ -53,6 +55,7 @@
|
||||
payTypeTitle = "支出项目";
|
||||
inOrOut = "out";
|
||||
organUrl = supUrl;
|
||||
amountNum = "ZC";
|
||||
}
|
||||
else if(listTitle === "收款单列表"){
|
||||
listType = "收款";
|
||||
@ -61,6 +64,7 @@
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = cusUrl;
|
||||
amountNum = "SK";
|
||||
}
|
||||
else if(listTitle === "付款单列表"){
|
||||
listType = "付款";
|
||||
@ -69,6 +73,7 @@
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = supUrl;
|
||||
amountNum = "FK";
|
||||
}
|
||||
else if(listTitle === "转账单列表"){
|
||||
listType = "转账";
|
||||
@ -77,6 +82,7 @@
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = supUrl;
|
||||
amountNum = "ZZ";
|
||||
}
|
||||
else if(listTitle === "收预付款列表"){
|
||||
listType = "收预付款";
|
||||
@ -85,6 +91,7 @@
|
||||
payTypeTitle = "无标题";
|
||||
inOrOut = "";
|
||||
organUrl = retailUrl;
|
||||
amountNum = "SYF";
|
||||
}
|
||||
}
|
||||
//获取账户信息
|
||||
@ -599,10 +606,13 @@
|
||||
function addAccountHead(){
|
||||
$("#clientIp").val(clientIp);
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDate = getNowFormatDate(); //当前日期
|
||||
$("#BillTime").val(thisDate);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#BillNo").val("").focus();
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
var accepId=null; //保存的主表id
|
||||
var url;
|
||||
var depotHeadID = 0;
|
||||
var preTotalPrice = 0; //前一次加载的金额
|
||||
var orgDepotHead = "";
|
||||
var editIndex = undefined;
|
||||
var listTitle = ""; //单据标题
|
||||
@ -58,7 +59,7 @@
|
||||
}
|
||||
else if(listTitle === "零售退货列表"){
|
||||
listType = "入库";
|
||||
listSubType = "零售退货";
|
||||
listSubType = "零售退货"; //注:用预付款购买的产品不能退货
|
||||
payTypeTitle = "付款";
|
||||
organUrl = retailUrl;
|
||||
amountNum = "LSTH";
|
||||
@ -219,6 +220,19 @@
|
||||
orgDefaultId = data[i].id;
|
||||
}
|
||||
}
|
||||
},
|
||||
onSelect: function(rec){
|
||||
if(listSubType === "零售"){
|
||||
var option = "";
|
||||
if(rec.supplier !== "非会员" && rec.advanceIn >0){
|
||||
option = '<option value="预付款">预付款(' + rec.advanceIn + ')</option>';
|
||||
option += '<option value="现付">现付</option>';
|
||||
}
|
||||
else {
|
||||
option += '<option value="现付">现付</option>';
|
||||
}
|
||||
$("#payType").empty().append(option);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -337,6 +351,7 @@
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{field: 'OrganId',width:5, hidden:true},
|
||||
{ title: '单据编号',field: 'Number',width:100},
|
||||
{ title: '单据日期 ',field: 'OperTime',width:100},
|
||||
{ title: '创建时间',field: 'CreateTime',width:100},
|
||||
@ -351,12 +366,13 @@
|
||||
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
|
||||
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.ChangeAmount+ 'AaBb' + rec.Remark
|
||||
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName
|
||||
+ 'AaBb' + rec.AccountName + 'AaBb' + rec.TotalPrice + 'AaBb' + rec.AllocationProjectId + 'AaBb' + rec.AllocationProjectName;
|
||||
+ 'AaBb' + rec.AccountName + 'AaBb' + rec.TotalPrice + 'AaBb' + rec.AllocationProjectId
|
||||
+ 'AaBb' + rec.AllocationProjectName + 'AaBb' + rec.payType;
|
||||
if(1 == value)
|
||||
{
|
||||
str += '<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-show">查看</span></a>';
|
||||
str += '<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-edit">编辑</span></a>';
|
||||
str += '<a onclick="deleteDepotHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-delete">删除</span></a>';
|
||||
str += '<a onclick="deleteDepotHead('+ rec.Id +',' + rec.OrganId +',' + rec.TotalPrice+ ');" style="text-decoration:none;color:black;" href="javascript:void(0)"><span class="action-delete">删除</span></a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ -621,9 +637,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
//删除采购入库信息
|
||||
function deleteDepotHead(depotHeadID){
|
||||
$.messager.confirm('删除确认','确定要删除此采购入库信息吗?',function(r)
|
||||
//删除单据信息
|
||||
function deleteDepotHead(depotHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此单据信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
@ -644,20 +660,42 @@
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除采购入库信息失败,请稍后再试!','error');
|
||||
$.messager.alert('删除提示','删除单据信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除采购入库信息异常,请稍后再试!','error');
|
||||
$.messager.alert('删除提示','删除单据信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
//更新会员的预收款信息
|
||||
if(listSubType === "零售") {
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: path + "/supplier/updateAdvanceIn.action",
|
||||
dataType: "json",
|
||||
data:{
|
||||
SupplierID: thisOrganId, //会员id
|
||||
AdvanceIn: totalPrice //删除时同时返还用户的预付款
|
||||
},
|
||||
success: function(res){
|
||||
if(res) {
|
||||
//保存会员预收款成功
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除采购入库
|
||||
//批量删除单据信息
|
||||
function batDeleteDepotHead(){
|
||||
var row = $('#tableData').datagrid('getChecked');
|
||||
if(row.length == 0)
|
||||
@ -667,7 +705,7 @@
|
||||
}
|
||||
if(row.length > 0)
|
||||
{
|
||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条采购入库信息吗?',function(r)
|
||||
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条单据信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
@ -682,6 +720,30 @@
|
||||
//alert(row[i].id);
|
||||
ids += row[i].Id + ",";
|
||||
}
|
||||
//批量更新会员的预收款信息
|
||||
for(var i = 0;i < row.length; i ++) {
|
||||
if(listSubType === "零售") {
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: path + "/supplier/updateAdvanceIn.action",
|
||||
dataType: "json",
|
||||
data:{
|
||||
SupplierID: row[i].OrganId, //会员id
|
||||
AdvanceIn: row[i].TotalPrice //删除时同时返还用户的预付款
|
||||
},
|
||||
success: function(res){
|
||||
if(res) {
|
||||
//保存会员预收款成功
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: path + "/depotHead/batchDelete.action",
|
||||
@ -701,12 +763,12 @@
|
||||
$(":checkbox").attr("checked",false);
|
||||
}
|
||||
else
|
||||
$.messager.alert('删除提示','删除采购入库信息失败,请稍后再试!','error');
|
||||
$.messager.alert('删除提示','删除单据信息失败,请稍后再试!','error');
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function()
|
||||
{
|
||||
$.messager.alert('删除提示','删除采购入库信息异常,请稍后再试!','error');
|
||||
$.messager.alert('删除提示','删除单据信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
@ -768,6 +830,7 @@
|
||||
$("#ChangeAmount").attr("data-changeamount", depotHeadInfo[8]);
|
||||
$("#Remark").val(depotHeadInfo[9]);
|
||||
var TotalPrice = depotHeadInfo[14];
|
||||
preTotalPrice = depotHeadInfo[14]; //记录前一次合计金额,用于扣预付款
|
||||
$("#AllocationProjectId").val(depotHeadInfo[15]);
|
||||
//orgDepotHead = depotHeadInfo[1];
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
@ -775,6 +838,18 @@
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
depotHeadID = depotHeadInfo[0];
|
||||
|
||||
if(listSubType === "零售" ){
|
||||
var option = "";
|
||||
if(depotHeadInfo[17] === "预付款"){
|
||||
option = '<option value="预付款">预付款</option>';
|
||||
option += '<option value="现付">现付</option>';
|
||||
}
|
||||
else {
|
||||
option += '<option value="现付">现付</option>';
|
||||
}
|
||||
$("#payType").empty().append(option);
|
||||
}
|
||||
|
||||
initTableData_material("edit",TotalPrice); //商品列表
|
||||
reject(); //撤销下、刷新商品列表
|
||||
url = path + '/depotHead/update.action?depotHeadID=' + depotHeadInfo[0];
|
||||
@ -791,6 +866,7 @@
|
||||
$("#AccountIdShow").text(depotHeadInfo[13]);
|
||||
$("#ChangeAmountShow").text(depotHeadInfo[8]);
|
||||
$("#RemarkShow").text(depotHeadInfo[9]);
|
||||
$("#payTypeShow").text(depotHeadInfo[17]);
|
||||
var TotalPrice = depotHeadInfo[14];
|
||||
$("#AllocationProjectIdShow").text(depotHeadInfo[16]);
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
@ -860,7 +936,7 @@
|
||||
}
|
||||
//零售时候,可以从会员预付款中扣款
|
||||
var thisPayType = "现付";
|
||||
if(listSubType === "零售" || listSubType === "零售退货") {
|
||||
if(listSubType === "零售") {
|
||||
if($("#payType").val() ==="预付款") {
|
||||
thisPayType = "预付款";
|
||||
}
|
||||
@ -895,34 +971,41 @@
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
|
||||
}
|
||||
|
||||
if(thisPayType === "预付款") {
|
||||
//更新用户信息-预付款
|
||||
var advanceIn = 0; //预付款金额
|
||||
if(depotHeadID){
|
||||
advanceIn = TotalPrice - preTotalPrice; //修改时,预付款=合计金额-加载金额
|
||||
}
|
||||
else{
|
||||
advanceIn = TotalPrice; //新增时,预付款=合计金额
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: path + "/supplier/updateAdvanceIn.action",
|
||||
dataType: "json",
|
||||
data:{
|
||||
SupplierID: OrganId, //会员id
|
||||
AdvanceIn: 0 - advanceIn //保存的同时扣掉用户的预付款
|
||||
},
|
||||
success: function(res){
|
||||
if(res) {
|
||||
//保存会员预收款成功
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//保存明细记录
|
||||
if(depotHeadID ==0)
|
||||
{
|
||||
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
|
||||
|
||||
@ -123,10 +123,6 @@
|
||||
<label id="descriptionLabel">描 述 </label>
|
||||
<textarea name="description" id="description" rows="2" cols="2" style="width: 230px;"></textarea>
|
||||
</div>
|
||||
<div class="fitem" style="padding:5px">
|
||||
<label id="enabledLabel">启 动 </label>
|
||||
<input name="enabled" id="enabled" type="checkbox" style="width: 230px;height: 20px"/>
|
||||
</div>
|
||||
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
|
||||
</form>
|
||||
</div>
|
||||
@ -207,13 +203,10 @@
|
||||
{ title: '期初应收',field: 'BeginNeedGet',width:70,align:"center"},
|
||||
{ title: '期初应付',field: 'BeginNeedPay',width:70,align:"center"},
|
||||
{ title: '类型',field: 'type',width:50},
|
||||
{ title: '启动',field: 'enabled',width:40,formatter:function(value){
|
||||
return value? "开":"关";
|
||||
}},
|
||||
{ title: '操作',field: 'op',align:"center",width:130,formatter:function(value,rec)
|
||||
{
|
||||
var str = '';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.BeginNeedGet + 'AaBb'+ rec.BeginNeedPay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type+ 'AaBb' + rec.enabled;
|
||||
var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.BeginNeedGet + 'AaBb'+ rec.BeginNeedPay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type;
|
||||
if(1 == value)
|
||||
{
|
||||
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + rowInfo + '\');"/> <a onclick="editSupplier(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
@ -480,7 +473,6 @@
|
||||
BeginNeedPay : supplierInfo[6],
|
||||
description : supplierInfo[8],
|
||||
type : supplierInfo[9],
|
||||
enabled : supplierInfo[10],
|
||||
clientIp:'<%=clientIp %>'
|
||||
};
|
||||
orgSupplier = supplierInfo[1];
|
||||
|
||||
@ -94,7 +94,6 @@
|
||||
<td style="padding:5px">
|
||||
<select name="payType" id="payType" style="width:130px;">
|
||||
<option value="现付">现付</option>
|
||||
<option value="预付款">预付款</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@ -175,9 +174,13 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>单据备注:</td>
|
||||
<td style="padding:5px;width:292px;" colspan="5">
|
||||
<td style="padding:5px;width:292px;" colspan="3">
|
||||
<span id="RemarkShow"></span>
|
||||
</td>
|
||||
<td>付款类型:</td>
|
||||
<td style="padding:5px">
|
||||
<span id="payTypeShow"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user