增加复制凭证功能

This commit is contained in:
liuyifan 2018-07-23 14:35:18 +08:00
parent f87edc0c48
commit e2afc43722
2 changed files with 91 additions and 0 deletions

View File

@ -17,6 +17,7 @@
{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""},
{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""},
{"true","","Button","复制凭证","复制凭证","if(confirm('确定复制凭证?'))copyVoucher()","","","","btn_icon_detail",""}
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
@ -33,5 +34,18 @@
}
AsControl.OpenView(sUrl,'id=' +sPara ,'_self','');
}
// 复制凭证
function copyVoucher(){
var voucherId = getItemValue(0,getRow(0),'id');
var modularnumber=getItemValue(0,getRow(0),'MODULAR_NUMBER');
var sReturnInfo = RunJavaMethodTrans("com.tenwa.voucher.serviceImp.CreateVoucherServiceImpl","copyVoucherConfig","voucherConfigId="+voucherId+",modularnumber="+modularnumber);
if(sReturnInfo == "success"){
alert("复制成功!");
reloadSelf();
}else{
alert("复制失败!");
}
return;
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -13,6 +13,7 @@ import jbo.voucher.LV_AUXILIARY_ACCOUNT;
import jbo.voucher.LV_BASIC_PARAM;
import jbo.voucher.LV_DEFAULT_ATTRIBUTE;
import jbo.voucher.LV_STACTS_CONFIG;
import jbo.voucher.LV_VOUCHER_CONFIG;
import jbo.voucher.LV_VOUCHER_LOAN;
import com.amarsoft.are.ARE;
@ -23,6 +24,7 @@ import com.amarsoft.are.jbo.JBOTransaction;
import com.amarsoft.are.log.Log;
import com.amarsoft.awe.Configure;
import com.tenwa.comm.exception.BusinessException;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.quartz.StringUtil;
import com.tenwa.reckon.util.DateUtil;
import com.tenwa.voucher.service.InitVoucherService;
@ -32,7 +34,45 @@ import com.tenwa.voucher.service.VoucherService;
public class CreateVoucherServiceImpl {
private static Log logger=ARE.getLog();
public String userid;
public String voucherid;
public String voucherConfigId;
public String modularnumber;
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getVoucherid() {
return voucherid;
}
public void setVoucherid(String voucherid) {
this.voucherid = voucherid;
}
public String getVoucherConfigId() {
return voucherConfigId;
}
public void setVoucherConfigId(String voucherConfigId) {
this.voucherConfigId = voucherConfigId;
}
public String getModularnumber() {
return modularnumber;
}
public void setModularnumber(String modularnumber) {
this.modularnumber = modularnumber;
}
public void test(JBOTransaction tx) throws Exception{
//ʾÀý
@ -297,4 +337,41 @@ public class CreateVoucherServiceImpl {
return data;
}
//¸´ÖÆÆ¾Ö¤
public String copyVoucherConfig(JBOTransaction tx){
String result = "false";
Map<String,String> fromCondtion = new HashMap<String, String>();
Map<String,String> otherProperty = new HashMap<String, String>();
try {
fromCondtion.clear();
otherProperty.clear();
fromCondtion.put("id", voucherConfigId);
otherProperty.put("MODULAR_NUMBER", "¸´ÖÆ--"+modularnumber);
String newID = "";
newID = DataOperatorUtil.copySingleJBO(LV_VOUCHER_CONFIG.CLASS_NAME, fromCondtion, LV_VOUCHER_CONFIG.CLASS_NAME, null, otherProperty, tx);
String sql = "select id from lv_voucher_loan where voucher_id=" + "'" + voucherConfigId + "'";
Map<String,String> param = new HashMap<String, String>();
List<Map<String,String>> list = DataOperatorUtil.getDataBySql(tx, sql, param);
for(Map ma:list){
fromCondtion.clear();
otherProperty.clear();
fromCondtion = ma;
otherProperty.put("voucher_id", newID);
DataOperatorUtil.copySingleJBO(LV_VOUCHER_LOAN.CLASS_NAME, fromCondtion, LV_VOUCHER_LOAN.CLASS_NAME, null, otherProperty, tx);
}
} catch (Exception e) {
try {
tx.rollback();
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}
e.printStackTrace();
result = "error";
return result;
}
result = "success";
return result;
}
}