回租-电子发票
This commit is contained in:
parent
ea58737db8
commit
8d328243af
@ -34,12 +34,15 @@
|
||||
|
||||
var planIds = "";
|
||||
for(var i = 0;i < sParm.length; i++){
|
||||
if(planIds.length == 0){
|
||||
//if(planIds.length == 0){
|
||||
//planIds += sParm[i] +"@";
|
||||
//}else{
|
||||
planIds += sParm[i] +"@";
|
||||
}else{
|
||||
planIds += sParm[i] +"@";
|
||||
}
|
||||
//}
|
||||
}
|
||||
alert(planIds);
|
||||
planIds = planIds.substr(0,planIds.length-1);
|
||||
alert(planIds);
|
||||
spara = "planIds="+planIds+",CurUserID=<%=CurUser.getUserID()%>";
|
||||
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.apzl.invoicemanager.rentplaninvoice.rentPlanInvoiceManager","selectApplyConfirm",spara);
|
||||
alert(returnValue);
|
||||
|
||||
@ -34,12 +34,15 @@
|
||||
|
||||
var ids = "";
|
||||
for(var i = 0;i < sParm.length; i++){
|
||||
if(ids.length == 0){
|
||||
//if(ids.length == 0){
|
||||
//ids += sParm[i] +"@";
|
||||
//}else{
|
||||
ids += sParm[i] +"@";
|
||||
}else{
|
||||
ids += sParm[i] +"@";
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
ids = ids.substr(0,ids.length-1);
|
||||
|
||||
spara = "ids="+ids+",CurUserID=<%=CurUser.getUserID()%>";
|
||||
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.apzl.invoicemanager.rentplaninvoice.rentPlanInvoiceManager","invoiceConfirmSubmit",spara);
|
||||
alert(returnValue);
|
||||
|
||||
@ -46,9 +46,9 @@
|
||||
return ;
|
||||
} */
|
||||
spara = "sid="+sid+",CurUserID=<%=CurUser.getUserID()%>";
|
||||
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.lease.app.invoicemanager.InvoiceManagerController","selectConfirm",spara);
|
||||
//var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.lease.app.invoicemanager.InvoiceManagerController","selectConfirm",spara);
|
||||
|
||||
//var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.apzl.invoicemanager.rentplaninvoice.rentPlanInvoiceManager","selectConfirm",spara);
|
||||
var returnValue = AsControl.RunJavaMethodTrans("com.tenwa.apzl.invoicemanager.rentplaninvoice.rentPlanInvoiceManager","selectConfirm",spara);
|
||||
|
||||
alert(returnValue);
|
||||
reloadSelf();
|
||||
|
||||
@ -29,6 +29,7 @@ import jbo.app.tenwa.calc.VI_INVOICE_RENT_PLAN_CONFIRM;
|
||||
import jbo.app.tenwa.calc.VI_LI_INVOICE_OTHERS;
|
||||
import jbo.app.tenwa.calc.VI_LI_INVOICE_RENT;
|
||||
import jbo.app.tenwa.customer.CUSTOMER_COMPANY;
|
||||
import jbo.app.tenwa.customer.CUSTOMER_FAMILY;
|
||||
import jbo.app.tenwa.customer.CUSTOMER_PERSON;
|
||||
import jbo.awe.USER_INFO;
|
||||
import jbo.com.tenwa.entity.comm.invoice.LI_RENT_INVOICE_INFO;
|
||||
@ -117,53 +118,70 @@ public class rentPlanInvoiceManager extends BaseTable{
|
||||
String contract_id="";
|
||||
|
||||
for(int i=0;i<planIds.length;i++){
|
||||
String id=UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String planId = planIds[i];
|
||||
BizObject viInvoiceRent = viInvoiceRentManager.createQuery("plan_id=:plan_id").setParameter("plan_id", planId).getSingleResult(false);
|
||||
invoice_money = viInvoiceRent.getAttribute("plan_money").toString();
|
||||
plan_id = viInvoiceRent.getAttribute("plan_id").toString();
|
||||
PAYMENT_NUMBER = viInvoiceRent.getAttribute("payment_number").toString();
|
||||
TAX_REG_CODE = viInvoiceRent.getAttribute("cert_id").toString();
|
||||
TAX_BANK = viInvoiceRent.getAttribute("bank_name").toString();
|
||||
TAX_ACC = viInvoiceRent.getAttribute("acc_number").toString();
|
||||
contract_id = viInvoiceRent.getAttribute("contract_id").toString();
|
||||
|
||||
tax_type = viInvoiceRent.getAttribute("tax_type").toString();
|
||||
|
||||
|
||||
BizObject lriiObject = lriiManager.createQuery("plan_id=:plan_id").setParameter("plan_id", planId).getSingleResult(false);
|
||||
if(lriiObject!=null){
|
||||
lriiManager.createQuery("update o set invoice_status='1' where plan_id=:plan_id").setParameter("plan_id", planId).executeUpdate();
|
||||
}else{
|
||||
//BizObject viInvoiceRent = viInvoiceRentManager.createQuery("plan_id=:plan_id").setParameter("plan_id", planId).getSingleResult(false);
|
||||
List<BizObject> viInvoiceRent = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.VI_LI_INVOICE_RENT", "plan_id=:plan_id").setParameter("plan_id", planId).getResultList(false);
|
||||
for (BizObject bizObject : viInvoiceRent) {
|
||||
String id=UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
||||
BizObject rentInvoiceInfo = lriiManager.newObject();
|
||||
rentInvoiceInfo.setAttributeValue("id", id);
|
||||
rentInvoiceInfo.setAttributeValue("invoice_status", invoice_status);
|
||||
rentInvoiceInfo.setAttributeValue("bill_type", bill_type);
|
||||
rentInvoiceInfo.setAttributeValue("invoice_money", invoice_money);
|
||||
invoice_money = bizObject.getAttribute("plan_money").toString();
|
||||
plan_id = bizObject.getAttribute("plan_id").toString();
|
||||
PAYMENT_NUMBER = bizObject.getAttribute("payment_number").toString();
|
||||
TAX_REG_CODE = bizObject.getAttribute("cert_id").toString();
|
||||
TAX_BANK = bizObject.getAttribute("bank_name").toString();
|
||||
TAX_ACC = bizObject.getAttribute("acc_number").toString();
|
||||
contract_id = bizObject.getAttribute("contract_id").toString();
|
||||
tax_type = bizObject.getAttribute("tax_type").toString();
|
||||
|
||||
if("利息".equals(tax_type)){
|
||||
rentInvoiceInfo.setAttributeValue("tax_type", "interest");
|
||||
tax_type = "interest";
|
||||
}else if("逾期利息".equals(tax_type)){
|
||||
rentInvoiceInfo.setAttributeValue("tax_type", "overinterest");
|
||||
|
||||
}else{
|
||||
return "金额类型为空!";
|
||||
tax_type = "overinterest";
|
||||
}
|
||||
|
||||
rentInvoiceInfo.setAttributeValue("TEMPORARY_NOINVOICE", "0.00");
|
||||
rentInvoiceInfo.setAttributeValue("NOINVOICE", "0.00");
|
||||
rentInvoiceInfo.setAttributeValue("plan_id", plan_id);
|
||||
rentInvoiceInfo.setAttributeValue("PAYMENT_NUMBER", PAYMENT_NUMBER);
|
||||
rentInvoiceInfo.setAttributeValue("TAX_REG_CODE", TAX_REG_CODE);// 纳税人识别号
|
||||
rentInvoiceInfo.setAttributeValue("TAX_BANK", TAX_BANK);//开户行
|
||||
rentInvoiceInfo.setAttributeValue("TAX_ACC", TAX_ACC);//开户账号
|
||||
rentInvoiceInfo.setAttributeValue("contract_id", contract_id);
|
||||
|
||||
rentInvoiceInfo = this.initTabeUserInfo(rentInvoiceInfo);
|
||||
lriiManager.saveObject(rentInvoiceInfo);
|
||||
BizObject lriiObject = lriiManager.createQuery("plan_id=:plan_id and tax_type=:tax_type").setParameter("plan_id", planId).setParameter("tax_type", tax_type).getSingleResult(false);
|
||||
if(lriiObject!=null){
|
||||
lriiManager.createQuery("update o set invoice_status='1' where plan_id=:plan_id").setParameter("plan_id", planId).executeUpdate();
|
||||
}else{
|
||||
|
||||
BizObject rentInvoiceInfo = lriiManager.newObject();
|
||||
rentInvoiceInfo.setAttributeValue("id", id);
|
||||
rentInvoiceInfo.setAttributeValue("invoice_status", invoice_status);
|
||||
rentInvoiceInfo.setAttributeValue("bill_type", bill_type);
|
||||
rentInvoiceInfo.setAttributeValue("invoice_money", invoice_money);
|
||||
|
||||
/*if("利息".equals(tax_type)){
|
||||
rentInvoiceInfo.setAttributeValue("tax_type", "interest");
|
||||
}else if("逾期利息".equals(tax_type)){
|
||||
rentInvoiceInfo.setAttributeValue("tax_type", "overinterest");
|
||||
|
||||
}else{
|
||||
return "金额类型为空!";
|
||||
}*/
|
||||
|
||||
if("".equals(tax_type) || tax_type==null){
|
||||
return "金额类型为空!";
|
||||
}else{
|
||||
rentInvoiceInfo.setAttributeValue("tax_type", tax_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
rentInvoiceInfo.setAttributeValue("TEMPORARY_NOINVOICE", "0.00");
|
||||
rentInvoiceInfo.setAttributeValue("NOINVOICE", "0.00");
|
||||
rentInvoiceInfo.setAttributeValue("plan_id", plan_id);
|
||||
rentInvoiceInfo.setAttributeValue("PAYMENT_NUMBER", PAYMENT_NUMBER);
|
||||
rentInvoiceInfo.setAttributeValue("TAX_REG_CODE", TAX_REG_CODE);// 纳税人识别号
|
||||
rentInvoiceInfo.setAttributeValue("TAX_BANK", TAX_BANK);//开户行
|
||||
rentInvoiceInfo.setAttributeValue("TAX_ACC", TAX_ACC);//开户账号
|
||||
rentInvoiceInfo.setAttributeValue("contract_id", contract_id);
|
||||
|
||||
rentInvoiceInfo = this.initTabeUserInfo(rentInvoiceInfo);
|
||||
lriiManager.saveObject(rentInvoiceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return "开票成功";
|
||||
@ -259,11 +277,11 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
if(ownAccount==null || "".equals(ownAccount)){
|
||||
return "您的本方银行账户为空!";
|
||||
}
|
||||
String[] rentPlanids = this.getIds().split("@");
|
||||
String[] rentInvoiceids = this.getIds().split("@");
|
||||
List<String> rentPlanIdList = new ArrayList<String>();
|
||||
|
||||
for(int i=0;i<rentPlanids.length;i++){
|
||||
rentPlanIdList.add("'"+rentPlanids[i]+"'");
|
||||
for(int i=0;i<rentInvoiceids.length;i++){
|
||||
rentPlanIdList.add("'"+rentInvoiceids[i]+"'");
|
||||
}
|
||||
|
||||
String customerid="";
|
||||
@ -293,8 +311,8 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
|
||||
BizObjectManager invoiceRentManager = JBOFactory.getBizObjectManager(LI_RENT_INVOICE_INFO.CLASS_NAME);
|
||||
Double sl = 0.06;
|
||||
for(int i=0;i<rentPlanids.length;i++){
|
||||
String invoiceId = rentPlanids[i];
|
||||
for(int i=0;i<rentInvoiceids.length;i++){
|
||||
String invoiceId = rentInvoiceids[i];//li_rent_invoice_info的id
|
||||
|
||||
BizObjectManager confirmDetailManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM_DETAIL.CLASS_NAME);
|
||||
tx.join(confirmDetailManager);
|
||||
@ -304,12 +322,14 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
String planid="";
|
||||
String planList="";
|
||||
String TAX_TYPE ="";
|
||||
String spbm = "";
|
||||
String spmc = "";
|
||||
|
||||
BizObject invoiceRentBizObject = invoiceRentManager.createQuery("ID=:id ").setParameter("id",invoiceId).getSingleResult(false);
|
||||
invoiceMoney = new BigDecimal(invoiceRentBizObject.getAttribute("INVOICE_MONEY").getString()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
TAX_TYPE = invoiceRentBizObject.getAttribute("TAX_TYPE").getString();
|
||||
planid = invoiceRentBizObject.getAttribute("plan_id").toString();
|
||||
if(planid !=null || !"".equals(planid)){
|
||||
if(planid !=null && !"".equals(planid)){
|
||||
BizObjectManager rentPlanManager = JBOFactory.getBizObjectManager(LC_RENT_PLAN.CLASS_NAME);
|
||||
|
||||
BizObject rentPlan = rentPlanManager.createQuery("id=:plan_id").setParameter("plan_id", planid).getSingleResult(false);
|
||||
@ -318,6 +338,21 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
if("overinterest".equals(TAX_TYPE)){
|
||||
planList += " "+"逾期利息";
|
||||
}
|
||||
spmc = "租赁利息";
|
||||
}else{
|
||||
if ("myhj".equals(TAX_TYPE)) {
|
||||
//planList = "名义货价";
|
||||
spmc = "名义货价";
|
||||
}else if("sxf".equals(TAX_TYPE)){
|
||||
//planList = "手续费";
|
||||
spmc = "手续费";
|
||||
}else if("gps".equals(TAX_TYPE)){
|
||||
//planList = "GPS安装服务费";
|
||||
spmc = "GPS安装服务费";
|
||||
}else{
|
||||
return "金额类型不存在!";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Double se = Double.valueOf( df2.format(invoiceMoney*sl ));
|
||||
@ -333,21 +368,7 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
confirmDetailBizObject.setAttributeValue("spsl","");
|
||||
confirmDetailBizObject.setAttributeValue("dw","");
|
||||
confirmDetailBizObject.setAttributeValue("fphxz","0");
|
||||
|
||||
/*if("sxf".equals(TAX_TYPE)){
|
||||
confirmDetailBizObject.setAttributeValue("spmc","手续费");
|
||||
}else if("myhj".equals(TAX_TYPE)){
|
||||
confirmDetailBizObject.setAttributeValue("spmc","名义货价");
|
||||
}else if("gps".equals(TAX_TYPE)){
|
||||
confirmDetailBizObject.setAttributeValue("spmc","GPS安装服务费");
|
||||
}else{
|
||||
confirmDetailBizObject.setAttributeValue("spmc","租赁利息");
|
||||
}*/
|
||||
if("overinterest".equals(TAX_TYPE) || "interest".equals(TAX_TYPE)){
|
||||
confirmDetailBizObject.setAttributeValue("spmc","租赁利息");
|
||||
}else{
|
||||
confirmDetailBizObject.setAttributeValue("spmc","其他费用");
|
||||
}
|
||||
confirmDetailBizObject.setAttributeValue("spmc",spmc);
|
||||
|
||||
confirmDetailBizObject.setAttributeValue("spsm","");
|
||||
confirmDetailBizObject.setAttributeValue("ggxh",planList);
|
||||
@ -355,7 +376,16 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
confirmDetailBizObject.setAttributeValue("sl",sl);
|
||||
confirmDetailBizObject.setAttributeValue("se",se);
|
||||
confirmDetailBizObject.setAttributeValue("hsbz","0");
|
||||
confirmDetailBizObject.setAttributeValue("spbm","3060109010000000000");
|
||||
|
||||
Configure config = Configure.getInstance();
|
||||
try {
|
||||
spbm = config.getConfigure("INVOICE_SPBM") ;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "读取a3web的开票接口配置文件失败";
|
||||
}
|
||||
|
||||
confirmDetailBizObject.setAttributeValue("spbm",spbm);
|
||||
confirmDetailBizObject.setAttributeValue("zxbm","");
|
||||
confirmDetailBizObject.setAttributeValue("yhzcbs","0");
|
||||
confirmDetailBizObject.setAttributeValue("slbs","");
|
||||
@ -379,15 +409,15 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
String xhdwdzdh = ownInfo.getAttribute("LEASE_TEL").toString();//销货单位地址电话
|
||||
|
||||
BizObjectManager customerPersonManager = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME);
|
||||
BizObjectManager customerCompanyManager = JBOFactory.getBizObjectManager(CUSTOMER_COMPANY.CLASS_NAME);
|
||||
BizObjectManager customerFamilyManager = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME);
|
||||
|
||||
BizObject customerPerson = customerPersonManager.createQuery("SELECT o.certid,caa.fulladdress,o.mobile,ca.acc_number,ca.bank_name from o JOIN jbo.app.tenwa.customer.CUSTOMER_ACCOUNT ca ON ca.customerid=o.customerid JOIN jbo.app.tenwa.customer.CUSTOMER_ADDRESS caa ON caa.customerid=ca.customerid where o.customerid=:customerid")
|
||||
.setParameter("customerid", customerid).getSingleResult(false);
|
||||
|
||||
BizObject customerCompany = customerCompanyManager.createQuery("customerid=:customerid").setParameter("customerid", customerid).getSingleResult(false);
|
||||
String companyTel="";
|
||||
if(customerCompany!=null){
|
||||
companyTel = customerCompany.getAttribute("company_tel").toString();
|
||||
BizObject customerFamily = customerFamilyManager.createQuery("customerid=:customerid").setParameter("customerid", customerid).getSingleResult(false);
|
||||
String familyTel="";
|
||||
if(customerFamily!=null){
|
||||
familyTel = customerFamily.getAttribute("tel").toString();
|
||||
}
|
||||
String certid="";
|
||||
String fulladdress="";
|
||||
@ -442,8 +472,8 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
confirmBizObject.setAttributeValue("yfpdm", "");
|
||||
confirmBizObject.setAttributeValue("yfphm", "");
|
||||
confirmBizObject.setAttributeValue("GMF_DZYX", "");
|
||||
if(customertype=="01"){
|
||||
confirmBizObject.setAttributeValue("GMF_SJHM", companyTel);
|
||||
if("01".equals(customertype)){
|
||||
confirmBizObject.setAttributeValue("GMF_SJHM", familyTel);
|
||||
}else{
|
||||
confirmBizObject.setAttributeValue("GMF_SJHM", mobile);
|
||||
}
|
||||
@ -537,10 +567,12 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
|
||||
String xml = JaxbUtil.convertToXml(invoiceRequestBase);
|
||||
ResultPojo result = doPost(xml);
|
||||
|
||||
|
||||
//根据sid拿到LI_INVOICE_CONFIRM表的id(租金发票表的id和此表id都保存在LI_INVOICE_CONFIRM_Detail表中)
|
||||
BizObjectManager confirmManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM.CLASS_NAME);
|
||||
BizObject confirm = confirmManager.createQuery("sid=:sid").setParameter("sid", sid).getSingleResult(false);
|
||||
String invoice_confirm_id = confirm.getAttribute("id").toString();
|
||||
|
||||
String id=UUID.randomUUID().toString().replaceAll("-", "");
|
||||
if(result.getCode()==0){
|
||||
InvoiceRequestBase responseBase = (InvoiceRequestBase) result.getData();
|
||||
@ -612,6 +644,7 @@ public String selectApplyOtherConfirm(JBOTransaction tx) throws Exception{
|
||||
System.out.println("[OK][returnmsg]=>>>"+returnmsg);
|
||||
if("0".equals(returncode)){
|
||||
//System.out.println("[OK][SUCCESS]");
|
||||
//修改租金发票信息表的状态
|
||||
BizObjectManager confirmDetailManager = JBOFactory.getBizObjectManager(LI_INVOICE_CONFIRM_DETAIL.CLASS_NAME);
|
||||
BizObject confirmDetail = confirmDetailManager.createQuery("invoice_confirm_id=:invoice_confirm_id").setParameter("invoice_confirm_id", invoice_confirm_id).getSingleResult(false);
|
||||
String invoiceId = confirmDetail.getAttribute("invoice_id").toString();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user