1.税控补充
This commit is contained in:
parent
e4d467711c
commit
71a6703ed1
@ -37,7 +37,6 @@
|
||||
}
|
||||
|
||||
function createInvoice(){
|
||||
debugger;
|
||||
var ros = getCheckedRows(0);
|
||||
var jsonArr=[];
|
||||
var json={};
|
||||
@ -47,6 +46,7 @@
|
||||
json["customer_name"] =getItemValue(0, ros[i], "customer_name");
|
||||
json["invoice_money"] =getItemValue(0, ros[i], "invoice_money");
|
||||
json["tax_type"] =getItemValue(0, ros[i], "tax_type");
|
||||
json["tax_no"] =getItemValue(0, ros[i], "tax_no");
|
||||
json["acc_number"] =getItemValue(0, ros[i], "acc_number");
|
||||
json["telephone"] =getItemValue(0, ros[i], "telephone");
|
||||
json["cert_id"] =getItemValue(0, ros[i], "cert_id");
|
||||
@ -59,8 +59,9 @@
|
||||
var param = JSON.stringify(jsonArr);
|
||||
param = "InvoiceParam="+param.replace(/,/g,'@')+",fpzl=00,fpzf=00";
|
||||
// alert(param);
|
||||
return;
|
||||
var res = AsControl.RunJavaMethod("com.tenwa.invoice.IAutokpDo", "invoice", param);
|
||||
alert(res);
|
||||
reloadSelf();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<%@ page contentType="text/html; charset=GBK"%>
|
||||
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
|
||||
|
||||
ASObjectModel doTemp = new ASObjectModel("Invoice_TJ_Gps");
|
||||
ASObjectModel doTemp = new ASObjectModel("Invoice_TJ_Gps_had");
|
||||
doTemp.appendJboWhere("O.liti_id is not null");
|
||||
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
|
||||
dwTemp.Style="1"; //--ÉèÖÃΪGrid·ç¸ñ--
|
||||
@ -21,16 +21,36 @@
|
||||
};
|
||||
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
|
||||
<script type="text/javascript">
|
||||
function deleteIncoice(){
|
||||
var fpdm= getItemValue(0, ros[i], "fpdm");
|
||||
var fphm= getItemValue(0, ros[i], "fphm");
|
||||
function printInvoice(){
|
||||
var fpdm= getItemValue(0, getRow(), "fpdm");
|
||||
if(typeof(fpdm)=="undefined" || fpdm.length==0 ){
|
||||
alert("不能为空");
|
||||
return ;
|
||||
}
|
||||
var fphm= getItemValue(0, getRow(), "fphm");
|
||||
var param = "fpzl=00,fpdm="+fpdm+",fphm="+fphm;
|
||||
var res = AsControl.RunJavaMethod("com.tenwa.invoice.IAutokpDo", "invoice_pr", param);
|
||||
}
|
||||
function deleteInvoice(){
|
||||
debugger;
|
||||
var fpdm= getItemValue(0, getRow(), "fpdm");
|
||||
if(typeof(fpdm)=="undefined" || fpdm.length==0 ){
|
||||
alert("不能为空");
|
||||
return ;
|
||||
}
|
||||
var fphm= getItemValue(0, getRow(), "fphm");
|
||||
var param = "fpzl=00,fpdm="+fpdm+",fphm="+fphm;
|
||||
var res = AsControl.RunJavaMethod("com.tenwa.invoice.IAutokpDo", "invoice_fpzf", param);
|
||||
alert(res);
|
||||
reloadSelf();
|
||||
}
|
||||
function redInkInvoice(){
|
||||
debugger;
|
||||
var a = getItemValueArray(0,"contract_no");
|
||||
var ros = getCheckedRows(0);
|
||||
if(ros.length==0){
|
||||
alert("请选择");
|
||||
return ;
|
||||
}
|
||||
var jsonArr=[];
|
||||
var json={};
|
||||
for(var i = 0; i < ros.length; i++){
|
||||
|
||||
@ -41,9 +41,16 @@ public class IAutokpDo {
|
||||
String invoiceParam = this.invoiceParam.replaceAll("@", ",");
|
||||
String requestParam = "";
|
||||
Document doc;
|
||||
boolean flag = true;
|
||||
String flag_result = "";
|
||||
IAutokpXML ivoiceXML = new IAutokpXML();
|
||||
//¸ù¾ÝºÏͬºÅ½øÐзÖ×é
|
||||
Map<String,List<Map<String,String>>> map = ivoiceXML.getParam(invoiceParam,fpzf);
|
||||
|
||||
Map<String,List<Map<String,String>>> map = null;
|
||||
if("00".equals(fpzf)){
|
||||
map = ivoiceXML.getInvoiceParam(invoiceParam);
|
||||
}else{
|
||||
map = ivoiceXML.getRedbackInvoiceParam(invoiceParam);
|
||||
}
|
||||
for(Map.Entry<String, List<Map<String, String>>> lsm: map.entrySet()){
|
||||
String contract_no=lsm.getKey();
|
||||
String responseParam="";
|
||||
@ -71,14 +78,21 @@ public class IAutokpDo {
|
||||
IAutokpUtils.saveFile(responseParam, contract_no+"_rnt");
|
||||
Map<String,String> responseResult = IAutokpUtils.getResponseResult(responseParam);
|
||||
if("4011".equals(responseResult.get("fl"))){
|
||||
insertInvoiceTable(lsm,contract_no,doc,responseResult);
|
||||
insertInvoiceTable(lsm,doc,responseResult);
|
||||
|
||||
}else{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(flag){
|
||||
flag_result = "操作成功";
|
||||
}else{
|
||||
flag_result = "操作失败";
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
return flag_result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,10 +100,12 @@ public class IAutokpDo {
|
||||
* @return
|
||||
*/
|
||||
public String invoice_pr(){
|
||||
|
||||
String requestParam="";
|
||||
String responseParam="";
|
||||
String SID = "Invoice_getfph";
|
||||
String sid = "Invoice_getfph";
|
||||
IAutokpXML ivoiceXML = new IAutokpXML();
|
||||
requestParam = ivoiceXML.createInvoiceOthersXML(sid,fpzl,fpdm,fphm);
|
||||
try {
|
||||
IAutokpserviceLocator kpl = new IAutokpserviceLocator();
|
||||
IAutokp autoKP = kpl.getIAutokpPort();
|
||||
@ -101,7 +117,13 @@ public class IAutokpDo {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(!"".endsWith(responseParam)){
|
||||
IAutokpUtils.saveFile(responseParam, fpdm+"-"+fphm+"_rnt");
|
||||
Map<String,String> responseResult = IAutokpUtils.getResponseResult(responseParam);
|
||||
if("5011".equals(responseResult.get("fl"))){
|
||||
System.out.println("打印成功!");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
@ -109,6 +131,8 @@ public class IAutokpDo {
|
||||
* @return
|
||||
*/
|
||||
public String invoice_fpzf(){
|
||||
boolean flag = true;
|
||||
String flag_result = "";
|
||||
String requestParam="";
|
||||
String responseParam="";
|
||||
String sid = "Invoice_getfph";
|
||||
@ -130,9 +154,13 @@ public class IAutokpDo {
|
||||
Map<String,String> responseResult = IAutokpUtils.getResponseResult(responseParam);
|
||||
if("6011".equals(responseResult.get("fl"))){
|
||||
invalidInvoice();
|
||||
flag_result = "操作成功";
|
||||
}else{
|
||||
flag = false;
|
||||
flag_result = "操作失败";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return flag_result;
|
||||
}
|
||||
/**
|
||||
* 获取待开发票号
|
||||
@ -142,6 +170,8 @@ public class IAutokpDo {
|
||||
String requestParam="";
|
||||
String responseParam="";
|
||||
String SID = "Invoice_getfph";
|
||||
IAutokpXML ivoiceXML = new IAutokpXML();
|
||||
requestParam = ivoiceXML.createInvoiceOthersXML(sid,fpzl,fpdm,fphm);
|
||||
try {
|
||||
IAutokpserviceLocator kpl = new IAutokpserviceLocator();
|
||||
IAutokp autoKP = kpl.getIAutokpPort();
|
||||
@ -153,7 +183,13 @@ public class IAutokpDo {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(!"".endsWith(responseParam)){
|
||||
IAutokpUtils.saveFile(responseParam, fpdm+"-"+fphm+"_rnt");
|
||||
Map<String,String> responseResult = IAutokpUtils.getResponseResult(responseParam);
|
||||
if("3011".equals(responseResult.get("fl"))){
|
||||
System.out.println("获取待开发票清单成功");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
@ -215,9 +251,11 @@ public class IAutokpDo {
|
||||
public void setSid(String sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
public void insertInvoiceTable(Map.Entry<String, List<Map<String, String>>> lsm,String contractNo,Document doc,Map<String,String> responseResult){
|
||||
String insertSql = "insert into li_invoice_tj_info(id,contract_no,plan_list,fpzl,fpzf,invoice_money,tax_type,tax_ratio,tax_money,sw_spbm,fpdm,fphm,hztzdh,status,inputuserid,inputtime)values"
|
||||
+"(REPLACE(UUID(),'-',''),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
|
||||
public void insertInvoiceTable(Map.Entry<String, List<Map<String, String>>> lsm,Document doc,Map<String,String> responseResult){
|
||||
String contractNo = lsm.getKey();
|
||||
String insertSql = "insert into li_invoice_tj_info(id,contract_no,plan_list,fpzl,fpzf,invoice_money,tax_type,tax_ratio,tax_money,sw_spbm,fpdm,fphm,hztzdh,mxxh,status,payee,tax_creator,tax_checker,inputtime,rele_id)values"
|
||||
+"(REPLACE(UUID(),'-',''),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
PreparedStatement ps = null;
|
||||
Transaction Sqlca = null;
|
||||
Sqlca = Transaction.createTransaction(CacheLoaderFactory.getDataSource());
|
||||
@ -229,15 +267,20 @@ public class IAutokpDo {
|
||||
con.setAutoCommit(false);
|
||||
}
|
||||
ps = con.prepareStatement(insertSql);
|
||||
Element ele_order = doc.getRootElement().element("DataArea").element("Data").element("Order");
|
||||
Element ele_order = doc.getRootElement().element("Data").element("Order");
|
||||
Element ele_head = ele_order.element("Head");
|
||||
Element ele_items = ele_order.element("Items");
|
||||
String hztzdh = "N";
|
||||
|
||||
String payee = ele_head.element("SKR").getText();
|
||||
String tax_creator = ele_head.element("KJR").getText();
|
||||
String tax_checker = ele_head.element("FHR").getText();
|
||||
|
||||
String hztzdh = "";
|
||||
String status = "Y";
|
||||
String fpdm = responseResult.get("fpdm");
|
||||
String fphm = responseResult.get("fphm");
|
||||
if("01".equals(fpzf)){
|
||||
status = "R";
|
||||
status = "red";
|
||||
fpdm = ele_head.element("HCFPDM").getText();
|
||||
fphm = ele_head.element("HCFPHM").getText();
|
||||
hztzdh = ele_head.element("HZTZDH").getText();
|
||||
@ -246,20 +289,26 @@ public class IAutokpDo {
|
||||
for(Element item : listItems){
|
||||
String mxxh = item.element("MXXH").getText();
|
||||
String planList = "";
|
||||
String liti_id = "";
|
||||
String taxType = "";
|
||||
for(Map<String,String> map :lsm.getValue()){
|
||||
if(mxxh.equals(map.get("MXXH"))){
|
||||
planList = map.get("planList");
|
||||
planList = map.get("plan_list");
|
||||
taxType = map.get("tax_no");
|
||||
if("01".equals(fpzf)){
|
||||
liti_id = map.get("liti_id");
|
||||
String usql = "update li_invoice_tj_info O set O.status='R' where id='"+liti_id+"'";
|
||||
Sqlca.executeSQL(new SqlObject(usql));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String invoice_money = item.element("JE").getText();
|
||||
String taxType = item.element("GGXH").getText();
|
||||
String taxRatio = item.element("SLV").getText();
|
||||
String taxMoney = item.element("shuier").getText();
|
||||
String sw_spbm = item.element("sw_spbm").getText();
|
||||
String inputuserid = "system";
|
||||
String inputtime = StringFunction.getNow();
|
||||
String inputtime = StringFunction.getTodayNow();
|
||||
|
||||
ps.setString(1,contractNo);
|
||||
ps.setString(2,planList);
|
||||
@ -273,9 +322,13 @@ public class IAutokpDo {
|
||||
ps.setString(10,fpdm);
|
||||
ps.setString(11,fphm);
|
||||
ps.setString(12,hztzdh);
|
||||
ps.setString(13,status);
|
||||
ps.setString(14,inputuserid);
|
||||
ps.setString(15,inputtime);
|
||||
ps.setString(13,mxxh);
|
||||
ps.setString(14,status);
|
||||
ps.setString(15,payee);
|
||||
ps.setString(16,tax_creator);
|
||||
ps.setString(17,tax_checker);
|
||||
ps.setString(18,inputtime);
|
||||
ps.setString(19,liti_id);
|
||||
ps.addBatch();
|
||||
}
|
||||
ps.executeBatch();
|
||||
@ -287,6 +340,9 @@ public class IAutokpDo {
|
||||
} catch (SQLException e) {
|
||||
ARE.getLog().debug("插入天津发票信息表:"+contractNo+"出错,出错消息"+e.getMessage(),e);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(ps != null){
|
||||
try {
|
||||
|
||||
@ -41,10 +41,14 @@ public class IAutokpUtils {
|
||||
}*/
|
||||
String fl = rootElement.element("fl").getTextTrim();
|
||||
String mess = rootElement.element("mess").getTextTrim();
|
||||
String fpdm = rootElement.element("fpdm").getTextTrim();
|
||||
String fphm = rootElement.element("fphm").getTextTrim();
|
||||
System.out.println(fl + ": " + mess);
|
||||
|
||||
responseResult.put("fl", fl);
|
||||
responseResult.put("mess", mess);
|
||||
responseResult.put("fpdm", fpdm);
|
||||
responseResult.put("fphm", fphm);
|
||||
} catch (DocumentException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
@ -21,7 +21,7 @@ import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
||||
|
||||
public class IAutokpXML {
|
||||
|
||||
public Map<String,List<Map<String,String>>> getParam (String param,String fpzf){
|
||||
public Map<String,List<Map<String,String>>> getInvoiceParam (String param){
|
||||
JSONArray array =JSON.parseArray(param);
|
||||
|
||||
Map<String,List<Map<String,String>>> map = new HashMap<String,List<Map<String,String>>>();
|
||||
@ -33,6 +33,7 @@ public class IAutokpXML {
|
||||
Map<String,String> mapi = new HashMap<>();
|
||||
mapi.put("MXXH",i+1+"");
|
||||
mapi.put("tax_type", obj.getString("tax_type"));
|
||||
mapi.put("tax_no", obj.getString("tax_no"));
|
||||
mapi.put("invoice_money",obj.getString("invoice_money"));
|
||||
mapi.put("tax_ratio",obj.getString("tax_ratio"));
|
||||
mapi.put("customer_name",obj.getString("customer_name"));
|
||||
@ -41,12 +42,7 @@ public class IAutokpXML {
|
||||
mapi.put("cert_id",obj.getString("cert_id"));
|
||||
mapi.put("customer_type",obj.getString("customer_type"));
|
||||
mapi.put("plan_list",obj.getString("plan_list"));
|
||||
if("01".equals(fpzf)){
|
||||
mapi.put("HCFPDM",obj.getString("HCFPDM"));
|
||||
mapi.put("HCFPHM",obj.getString("HCFPHM"));
|
||||
mapi.put("HZTZDH",obj.getString("HZTZDH"));
|
||||
mapi.put("invoice_money","-"+obj.getString("invoice_money"));
|
||||
}
|
||||
|
||||
if(map.containsKey(contract_no)){
|
||||
map.get(contract_no).add(mapi);
|
||||
}else{
|
||||
@ -57,6 +53,45 @@ public class IAutokpXML {
|
||||
|
||||
return map;
|
||||
}
|
||||
public Map<String,List<Map<String,String>>> getRedbackInvoiceParam (String param){
|
||||
JSONArray array =JSON.parseArray(param);
|
||||
|
||||
Map<String,List<Map<String,String>>> map = new HashMap<String,List<Map<String,String>>>();
|
||||
List<Map<String,String>> ls = new ArrayList<Map<String,String>>();
|
||||
|
||||
for(int i=0;i<array.size();i++){
|
||||
JSONObject obj= (JSONObject) array.get(i);
|
||||
String HCFPDM= obj.getString("HCFPDM");
|
||||
String HCFPHM= obj.getString("HCFPHM");
|
||||
String mapKey = HCFPDM + "@" + HCFPHM;
|
||||
Map<String,String> mapi = new HashMap<>();
|
||||
mapi.put("MXXH",i+1+"");
|
||||
mapi.put("tax_type", obj.getString("tax_type"));
|
||||
mapi.put("tax_no", obj.getString("tax_no"));
|
||||
mapi.put("invoice_money","-"+obj.getString("invoice_money"));
|
||||
mapi.put("tax_ratio",obj.getString("tax_ratio"));
|
||||
mapi.put("customer_name",obj.getString("customer_name"));
|
||||
mapi.put("acc_number",obj.getString("acc_number"));
|
||||
mapi.put("telephone",obj.getString("telephone"));
|
||||
mapi.put("cert_id",obj.getString("cert_id"));
|
||||
mapi.put("customer_type",obj.getString("customer_type"));
|
||||
mapi.put("plan_list",obj.getString("plan_list"));
|
||||
|
||||
mapi.put("liti_id",obj.getString("liti_id"));
|
||||
mapi.put("HCFPDM",obj.getString("HCFPDM"));
|
||||
mapi.put("HCFPHM",obj.getString("HCFPHM"));
|
||||
mapi.put("HZTZDH",obj.getString("HZTZDH"));
|
||||
|
||||
if(map.containsKey(mapKey)){
|
||||
map.get(mapKey).add(mapi);
|
||||
}else{
|
||||
ls.add(mapi);
|
||||
map.put(mapKey, ls);
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
public Document createInvoiceXML(Map.Entry<String, List<Map<String, String>>> params,String fpzl,String fpzf){
|
||||
|
||||
Document doc = DocumentHelper.createDocument();
|
||||
@ -115,7 +150,7 @@ public class IAutokpXML {
|
||||
String curDate = formatter.format(date);
|
||||
Ele_KJRQ.setText(curDate);
|
||||
Element Ele_BZ = Ele_Head.addElement("BZ");
|
||||
String sql = "select tax_creator,tax_checker,Payee from tax_operator_info where is_use='Y'";
|
||||
String sql = "select tax_creator,tax_checker,payee from tax_operator_info where is_use='Y'";
|
||||
List<Map<String, String>> dataList;
|
||||
try {
|
||||
dataList = DataOperatorUtil.getDataBySql(sql);
|
||||
@ -127,7 +162,7 @@ public class IAutokpXML {
|
||||
}
|
||||
String KJR = dataList.get(0).get("tax_creator");
|
||||
String FHR = dataList.get(0).get("tax_checker");
|
||||
String SKR = dataList.get(0).get("Payee");
|
||||
String SKR = dataList.get(0).get("payee");
|
||||
Element Ele_KJR = Ele_Head.addElement("KJR");
|
||||
Ele_KJR.setText(KJR);
|
||||
Element Ele_XSDBMID = Ele_Head.addElement("XSDBMID");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user