|
@@ -11,7 +11,9 @@ import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
|
|
|
import nc.impl.pubapp.pattern.rule.IRule;
|
|
|
import nc.impl.so.m30.action.main.InsertSaleOrderAction;
|
|
|
import nc.impl.so.m30.action.main.UpdateSaleOrderAction;
|
|
|
+import nc.itf.uap.IUAPQueryBS;
|
|
|
import nc.itf.uap.pf.IPFBusiAction;
|
|
|
+import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
import nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin;
|
|
|
import nc.pubimpl.so.pfxx.check.BillFreeStatusCheckRule;
|
|
|
import nc.pubimpl.so.pfxx.check.MnyTaxCheckRule;
|
|
@@ -28,6 +30,8 @@ import nc.vo.so.m30.entity.SaleOrderVO;
|
|
|
import nc.vo.wfengine.pub.WFTask;
|
|
|
|
|
|
public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
|
|
|
+
|
|
|
+ IUAPQueryBS iuap= (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
|
|
|
|
|
|
@Override
|
|
|
public List<IRule<AggregatedValueObject>> getCheckers() {
|
|
@@ -93,6 +97,16 @@ public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
|
|
|
SaleOrderHVO headvo=(SaleOrderHVO) vo.getParentVO();
|
|
|
// if( headvo.getNexchangerate().compareTo(UFDouble.ONE_DBL)!=0){
|
|
|
String corigcurrencyid= headvo.getCorigcurrencyid();
|
|
|
+ String ccustomerid = headvo.getCcustomerid();//客户
|
|
|
+ String tempcpaytermid = headvo.getCpaytermid();
|
|
|
+ try {
|
|
|
+ String cpaytermid = SqlexecuteQuery(ccustomerid,tempcpaytermid);//收款协议
|
|
|
+ headvo.setCpaytermid(cpaytermid);
|
|
|
+ } catch (Exception e2) {
|
|
|
+ // TODO 自动生成的 catch 块
|
|
|
+ e2.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
CurrencyRateUtil currRateUtil = CurrencyRateUtil
|
|
|
.getInstanceByOrg(headvo.getPk_org());
|
|
|
try {
|
|
@@ -101,82 +115,88 @@ public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
|
|
|
String ccurrencyid= bodyvo.getCcurrencyid();
|
|
|
|
|
|
if(corigcurrencyid.equals(ccurrencyid)){
|
|
|
+ UFDouble nnum = bodyvo.getNnum();//主数量
|
|
|
+ UFDouble nastnum = bodyvo.getNastnum();//辅数量
|
|
|
+ UFDouble vchangerate = nastnum.div(nnum);//主辅单位换算率
|
|
|
UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
|
|
|
UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
|
|
|
- UFDouble norigmny = bodyvo.getNorigmny();//无税金额
|
|
|
UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
|
|
|
- bodyvo.setNcaltaxmny(norigtaxmny);//计税金额
|
|
|
- bodyvo.setNqttaxprice(nqtorigtaxprice);//本币含税单价
|
|
|
- bodyvo.setNqtprice(nqtorigprice);//本币无税单价
|
|
|
- bodyvo.setNqttaxnetprice(nqtorigtaxprice);//本币含税净价
|
|
|
-// bodyvo.setNorigtaxnetprice(nqtorigtaxprice);//本含税净价
|
|
|
-// bodyvo.setNorignetprice(nqtorigprice);//本无税净价
|
|
|
- bodyvo.setNqtnetprice(nqtorigprice);//本币无税净价
|
|
|
-// bodyvo.setNtaxprice(nqtorigtaxprice);//主本币含税单价
|
|
|
- bodyvo.setNpiece(nqtorigprice);//主本币无税单价
|
|
|
-// bodyvo.setNtaxnetprice(nqtorigtaxprice);//主本币含税净价
|
|
|
- bodyvo.setNnetprice(nqtorigprice);//主本币无税净价
|
|
|
- bodyvo.setNmny(norigmny);//本币无税金额
|
|
|
- bodyvo.setNtaxmny(norigtaxmny);//本币价税合计
|
|
|
- bodyvo.setNqtorigtaxnetprc(nqtorigtaxprice);//含税净价
|
|
|
- bodyvo.setNqtorignetprice(nqtorigprice);//无税净价
|
|
|
-
|
|
|
-
|
|
|
- bodyvo.setNorignetprice(bodyvo.getNorigprice());//本无税净价
|
|
|
- bodyvo.setNorigtaxnetprice(bodyvo.getNorigtaxprice());//主含税净价
|
|
|
- bodyvo.setNtaxnetprice(bodyvo.getNorigtaxprice());//主本币含税净价
|
|
|
- bodyvo.setNtaxprice(bodyvo.getNorigtaxprice());//主本币含税单价
|
|
|
+ UFDouble norigtaxprice = vchangerate.multiply(nqtorigtaxprice);//主含税单价
|
|
|
+ UFDouble norigprice = vchangerate.multiply(nqtorigprice);//主无税单价
|
|
|
+ bodyvo.setNqtunitnum(nnum);//报价数量
|
|
|
+ bodyvo.setVqtunitrate("1.00000000/1.00000000");//报价换算率
|
|
|
+ bodyvo.setNqtorigtaxprice(nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//含税单价
|
|
|
+ bodyvo.setNqtorigprice(nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP));//无税单价
|
|
|
+ bodyvo.setNqtorigtaxnetprc(nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//含税净价
|
|
|
+ bodyvo.setNqtorignetprice(nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP));//无税净价
|
|
|
+ bodyvo.setNorigtaxprice(norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主含税单价
|
|
|
+ bodyvo.setNorigprice(norigprice.setScale(4, UFDouble.ROUND_HALF_UP));//主无税单价
|
|
|
+ bodyvo.setNorigtaxnetprice(norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主含税净价
|
|
|
+ bodyvo.setNorignetprice(norigprice.setScale(4, UFDouble.ROUND_HALF_UP));//主无税净价
|
|
|
+ bodyvo.setNcaltaxmny(nastnum.multiply(nqtorigprice).setScale(2, UFDouble.ROUND_HALF_UP));//计税金额
|
|
|
+ bodyvo.setNorigmny(nastnum.multiply(nqtorigprice).setScale(2, UFDouble.ROUND_HALF_UP));//无税金额
|
|
|
+ bodyvo.setNorigtaxmny(norigtaxmny.setScale(2, UFDouble.ROUND_HALF_UP));//价税合计
|
|
|
+ bodyvo.setNqttaxprice(nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币含税单价
|
|
|
+ bodyvo.setNqtprice(nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币无税单价
|
|
|
+ bodyvo.setNqttaxnetprice(nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币含税净价
|
|
|
+ bodyvo.setNqtnetprice(nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币无税净价
|
|
|
+ bodyvo.setNtaxprice(norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币含税单价
|
|
|
+ bodyvo.setNprice(norigprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币无税单价
|
|
|
+ bodyvo.setNtaxnetprice(norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币含税净价
|
|
|
+ bodyvo.setNnetprice(norigprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币无税净价
|
|
|
+ bodyvo.setNmny(nastnum.multiply(nqtorigprice).setScale(2, UFDouble.ROUND_HALF_UP));//本币无税金额
|
|
|
+ bodyvo.setNtaxmny(nastnum.multiply(nqtorigtaxprice).setScale(2, UFDouble.ROUND_HALF_UP));//本币价税合计
|
|
|
+ //税额放最后
|
|
|
+ bodyvo.setNtax(bodyvo.getNtaxmny().sub(bodyvo.getNmny()));//税额
|
|
|
+
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
|
|
|
- ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
|
|
|
- bodyvo.setNexchangerate(foreignrate);
|
|
|
- //norigprice 原币无税单价
|
|
|
- UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
|
|
|
- UFDouble foreignAmount= currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
- ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
|
|
|
-// bodyvo.setNtaxprice(foreignAmount);//主本币含税单价
|
|
|
-
|
|
|
- UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
- ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
|
|
|
-
|
|
|
- bodyvo.setNprice(ngprice); // 主本币无税单价
|
|
|
-
|
|
|
- bodyvo.setNqtprice(ngprice); //报价本币无税单价
|
|
|
-
|
|
|
- bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
|
|
|
-
|
|
|
-
|
|
|
- UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
- ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
|
|
|
-
|
|
|
- bodyvo.setNmny(nmny);//本币无税金额
|
|
|
-
|
|
|
- UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
- ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
|
|
|
-
|
|
|
- bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
|
|
|
-
|
|
|
- bodyvo.setNcaltaxmny(ntaxmny);//计税金额
|
|
|
- bodyvo.setNqtnetprice(ngprice);//本币无税净价
|
|
|
- bodyvo.setNnetprice(ngprice);//主本币无税净价
|
|
|
-
|
|
|
- bodyvo.setNqttaxnetprice(foreignAmount);//本币含税净价
|
|
|
-// bodyvo.setNorigtaxnetprice(foreignAmount);//本含税净价
|
|
|
-// bodyvo.setNorignetprice(ngprice);//本无税净价
|
|
|
-// bodyvo.setNtaxnetprice(foreignAmount);//主本币含税净价
|
|
|
- bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
|
|
|
- bodyvo.setNqtorigtaxnetprc(foreignAmount);//含税净价
|
|
|
- bodyvo.setNqtorignetprice(ngprice);//无税净价
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- bodyvo.setNorignetprice(bodyvo.getNorigprice());//本无税净价
|
|
|
- bodyvo.setNorigtaxnetprice(bodyvo.getNorigtaxprice());//主含税净价
|
|
|
- bodyvo.setNtaxnetprice(bodyvo.getNorigtaxprice());//主本币含税净价
|
|
|
- bodyvo.setNtaxprice(bodyvo.getNorigtaxprice());//主本币含税单价
|
|
|
+ else{
|
|
|
+ UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
|
|
|
+ ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
|
|
|
+ bodyvo.setNexchangerate(foreignrate);//折本汇率
|
|
|
+ UFDouble nnum = bodyvo.getNnum();//主数量
|
|
|
+ UFDouble nastnum = bodyvo.getNastnum();//辅数量
|
|
|
+ UFDouble vchangerate = nastnum.div(nnum);//主辅单位换算率
|
|
|
+ UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
|
|
|
+ UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
|
|
|
+ UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
|
|
|
+ UFDouble norigtaxprice = vchangerate.multiply(nqtorigtaxprice);//主含税单价
|
|
|
+ UFDouble norigprice = vchangerate.multiply(nqtorigprice);//主无税单价
|
|
|
+ UFDouble nqtprice = currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
+ ccurrencyid, nqtorigprice, foreignrate, headvo.getDbilldate());//本币无税单价
|
|
|
+ UFDouble nqttaxprice = currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
+ ccurrencyid, nqtorigtaxprice, foreignrate, headvo.getDbilldate());//本币含税单价
|
|
|
+ UFDouble ntaxprice = currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
+ ccurrencyid, norigtaxprice, foreignrate, headvo.getDbilldate());//主本币含税单价
|
|
|
+ UFDouble nprice = currRateUtil.getAmountByOpp(corigcurrencyid,
|
|
|
+ ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());//主本币无税单价
|
|
|
+ bodyvo.setNqtunitnum(nnum);//报价数量
|
|
|
+ bodyvo.setVqtunitrate("1.00000000/1.00000000");//报价换算率
|
|
|
+ bodyvo.setNqtorigtaxprice(nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//含税单价
|
|
|
+ bodyvo.setNqtorigprice(nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP));//无税单价
|
|
|
+ bodyvo.setNqtorigtaxnetprc(nqtorigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//含税净价
|
|
|
+ bodyvo.setNqtorignetprice(nqtorigprice.setScale(4, UFDouble.ROUND_HALF_UP));//无税净价
|
|
|
+ bodyvo.setNorigtaxprice(norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主含税单价
|
|
|
+ bodyvo.setNorigprice(norigprice.setScale(4, UFDouble.ROUND_HALF_UP));//主无税单价
|
|
|
+ bodyvo.setNorigtaxnetprice(norigtaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主含税净价
|
|
|
+ bodyvo.setNorignetprice(norigprice.setScale(4, UFDouble.ROUND_HALF_UP));//主无税净价
|
|
|
+ bodyvo.setNcaltaxmny(nastnum.multiply(nqtprice).setScale(2, UFDouble.ROUND_HALF_UP));//计税金额
|
|
|
+ bodyvo.setNorigmny(nastnum.multiply(nqtorigprice).setScale(2, UFDouble.ROUND_HALF_UP));//无税金额
|
|
|
+ bodyvo.setNorigtaxmny(norigtaxmny.setScale(2, UFDouble.ROUND_HALF_UP));//价税合计
|
|
|
+ bodyvo.setNqttaxprice(nqttaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币含税单价
|
|
|
+ bodyvo.setNqtprice(nqtprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币无税单价
|
|
|
+ bodyvo.setNqttaxnetprice(nqttaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币含税净价
|
|
|
+ bodyvo.setNqtnetprice(nqtprice.setScale(4, UFDouble.ROUND_HALF_UP));//本币无税净价
|
|
|
+ bodyvo.setNtaxprice(ntaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币含税单价
|
|
|
+ bodyvo.setNprice(nprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币无税单价
|
|
|
+ bodyvo.setNtaxnetprice(ntaxprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币含税净价
|
|
|
+ bodyvo.setNnetprice(nprice.setScale(4, UFDouble.ROUND_HALF_UP));//主本币无税净价
|
|
|
+ bodyvo.setNmny(nastnum.multiply(nqtprice).setScale(2, UFDouble.ROUND_HALF_UP));//本币无税金额
|
|
|
+ bodyvo.setNtaxmny(nastnum.multiply(nqttaxprice).setScale(2, UFDouble.ROUND_HALF_UP));//本币价税合计
|
|
|
+ //税额放最后
|
|
|
+ bodyvo.setNtax(bodyvo.getNtaxmny().sub(bodyvo.getNmny()));//税额
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
} catch (BusinessException e1) {
|
|
@@ -237,5 +257,31 @@ public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
|
|
|
}
|
|
|
return retvos[0];
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param ccustomerid
|
|
|
+ * @param pk_org
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private String SqlexecuteQuery(String ccustomerid,String pk_org) throws Exception {
|
|
|
+
|
|
|
+ String sql = "select pk_payterm from bd_custfinance where pk_customer = '"+ccustomerid+"' and pk_org = '"+pk_org+"' and nvl(dr,0)=0";
|
|
|
+
|
|
|
+ Object object;
|
|
|
+ try {
|
|
|
+ object = iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ if (object==null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ return object.toString();
|
|
|
+ } catch (BusinessException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ return e.getMessage();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|