apzl_leasing/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcDistributorMarginCompensation.jsp

256 lines
8.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="com.tenwa.comm.util.date.DateAssistant"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
/*
Author: undefined 2017-09-20
Content:
History Log:
*/
String plan_date = DateAssistant.getToday();
ASObjectModel doTemp = new ASObjectModel("ViLcReviewAuditRentPlanListRepay");
// doTemp.setJboWhere(" O.AUDIT_STATE = 'N'");
//默认预查询
//只有计划日期未收款的都可以收款
doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE <= '"+plan_date+"' and O.COLLECT_STATUS in ('未收款','部分收款')");
// doTemp.setJboWhereWhenNoFilter(" and O.COLLECT_STATUS in ('未收款','部分收款') ");
// doTemp.setJboWhere("O.PLAN_DATE <= '"+plan_date+"'");
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1"; //--设置为Grid风格--
dwTemp.MultiSelect = true; //多选
dwTemp.ReadOnly = "0"; //只读模式
dwTemp.ShowSummary = "1"; //显示小计
dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize));
dwTemp.genHTMLObjectWindow("");
//0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标CSS层叠样式 10、风格
String sButtons[][] = {
// {"true","All","Button","批量扣款及核销","批量扣款","batchCollect()","","","","btn_icon_add",""},
//{"true","All","Button","实时扣款","实时扣款","timelyCollect()","","","","btn_icon_add",""},
{"true","All","Button","经销商代偿","经销商代偿","afterCollectManage()","","","","btn_icon_add",""},
// {"true","All","Button","手动刷新","手动刷新","queryBatchCollect()","","","","btn_icon_add",""},
//{"true","","Button","退回","审核未通过,退回初审","i f(confirm('确定要退回吗?')){viewAndEdit()}","","","","btn_icon_detail",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
window.onload=function(){
initFilter();
setItemReadOnly(0, 0, "penalty_0", false);
}
function initFilter(){
//filterValues["myiframe0"][TableFactory.getTableColIndexFromDZ("myiframe0",getColIndex(0,"COLLECT_STATUS"))] = "未收款||部分收款";
setFilterAreaValue(0,"plan_date","<%=plan_date%>");
setFilterAreaOption(0,"plan_date","Equals");
//submitFilterArea();
}
function timelyCollect(){
if(confirm('确实要执行实时扣款操作吗?')){
var sParm = getItemValueArray(0, "id");
var fileSavePath = "<%=CurConfig.getConfigure("InterfaceFileSavePath")%>";
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请至少选择一条记录!");
return;
}
var ids = "";
for(var i = 0;i < sParm.length; i++){
if(ids.length == 0){
ids += sParm[i] +"@";
}else{
ids += sParm[i] +"@";
}
}
//扣款前提校验
var result = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "checkRentIsIncome", "id="+ids);
var value = result.split("@");
if (value[0] == "error") {
alert(value[1]);
return;
}
var parm = "id="+ids+",fileSavePath="+fileSavePath+",inputuserid="+"<%=CurUser.getUserID()%>"+",inputorgid="+"<%=CurUser.getOrgID()%>";
var res = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "barchCollectManage", parm);
alert(res);
location.reload();
}
}
//批量代收
function batchCollect(){
if(confirm('确实要执行代收操作吗?')){
var sParm = getItemValueArray(0,"id");
var fileSavePath = "<%=CurConfig.getConfigure("InterfaceFileSavePath")%>";
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请至少选择一条记录!");
return;
}
var ids = "";
for(var i = 0;i < sParm.length; i++){
if(ids.length == 0){
ids += sParm[i] +"@";
}else{
ids += sParm[i] +"@";
}
}
//扣款前提校验
var result = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "checkRentIsIncome", "id="+ids);
var value = result.split("@");
if (value[0] == "error") {
alert(value[1]);
return;
}
var parm = "id="+ids+",fileSavePath="+fileSavePath+",inputuserid="+"<%=CurUser.getUserID()%>"+",inputorgid="+"<%=CurUser.getOrgID()%>";
var res = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "batchCollectManage", parm);
alert(res);
location.reload();
}
}
function queryBatchCollect(){
if(confirm('确实要执行代收操作吗?')){
var sParm = getItemValueArray(0, "id");
var fileSavePath = "<%=CurConfig.getConfigure("InterfaceFileSavePath")%>";
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请至少选择一条记录!");
return;
}
var ids = "";
for(var i = 0;i < sParm.length; i++){
if(ids.length == 0){
ids += sParm[i] +"@";
}else{
ids += sParm[i] +"@";
}
}
var parm = "id="+ids+",fileSavePath="+fileSavePath+",inputuserid="+"<%=CurUser.getUserID()%>"+",inputorgid="+"<%=CurUser.getOrgID()%>";
var res = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "queryBatchCollectStatus",parm);
console.log(res);
// reloadSelf();
location.reload();
}
}
function afterCollectManage(){
if(confirm('确实要执行经销商保证金代偿操作吗?')){
var sParm = getItemValueArray(0, "id");
var sParm_rent = getItemValueArray(0, "rent");
var penalty = getItemValueArray(0, "penalty");
var sParm_penalty = getItemValueArray(0, "penalty_0");
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请至少选择一条记录!");
return;
}
var distributorIds = getItemValueArray(0, "DISTRIBUTOR_ID");
for(var i=1;i<distributorIds.length;i++){
if(distributorIds[0]!=distributorIds[i]){
alert("请选择同一经销商进行代偿!");
return;
}
}
for(var i=0;i<sParm.length;i++){
if(isNaN(Number(sParm_penalty[i]))||Number(sParm_penalty[i])==""){
alert("输入核销罚息金额不能为空或者包含非法字符!");
return;
}
if(Number(sParm_penalty[i])>Number(penalty[i])){
alert("核销罚息不能大于罚息金额!");
return;
}
}
// var dis = distributorIds.join("@");
//暂时只能选一个经销商,以后如果有多个经销商需求再打开下面代码
/* var distributorArray = [];
for(var i = 0; i < distributorIds.length; i++){
if(distributorArray.indexOf(distributorIds[i]) == -1){
distributorArray.push(distributorIds[i]);
}
}
for(var i=0;i<distributorArray.length;i++){
var DISTRIBUTOR_ID = distributorArray[i];
} */
var ids = sParm.join("@");
var penaltys = sParm_penalty.join("@");
//简化为上面形式
/* for(var i = 0;i < sParm.length; i++){
if(ids.length == 0){
ids += sParm[i] +"@";
penaltys += sParm_penalty[i];
}else{
ids += sParm[i] +"@";
penaltys += "@"+sParm_penalty[i];
}
} */
//扣款前提校验
var result = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "checkRentIsIncome", "id="+ids);
var value = result.split("@");
if (value[0] == "error") {
alert(value[1]);
return;
}
//验证余额是否足够
var distributor_id=distributorIds[0];
var money = 0;
for(var i=0;i<sParm_rent.length;i++){
money+=Number(sParm_rent[i]);
}
var sReturn=AsControl.RunJavaMethodTrans("com.tenwa.flow.action.comm.SelectBalance","runs","distributor_no="+distributor_id+",caution_money="+money);
sReturn = sReturn.split("@");
if("SUCCESS"!=sReturn[0]){
alert(sReturn[1]);
return;
}
//核销
var parm = "id="+ids+",inputuserid="+"<%=CurUser.getUserID()%>"+",inputorgid="+"<%=CurUser.getOrgID()%>"+",distributor_id="+distributor_id+",penaltys="+penaltys;
var res = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "afterCollectManageDistributor", parm);
// 代偿成功后生成经销商代偿凭证
RunJavaMethodTrans("com.tenwa.voucher.CreateVoucherProcess.InsertVoucherRentCompensatory", "execute", "");
alert(res);
//location.reload(); IE浏览器用这个方法报错
reloadSelf()
}
}
function viewAndEdit(){
var sParm = getItemValueArray(0, "id");
if(typeof(sParm) == "undefined" || sParm.length == 0 )
{
alert("请至少选择一条记录!");
return;
}
var ids = "";
for(var i = 0;i < sParm.length; i++){
if(ids.length == 0){
ids += sParm[i] +"@";
}else{
ids += sParm[i] +"@";
}
}
var result = RunJavaMethodTrans("com.tenwa.collectaudit.cache.CollectAuditInfoCache", "rebackCollectAudit", "id="+ids);
var value = result.split("@");
if (value[0] == "error") {
alert(value[1]);
return;
}else{
alert("退回初审成功!");
location.reload();
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>