收入合同计算与供应商变更
This commit is contained in:
		
							parent
							
								
									d597a997da
								
							
						
					
					
						commit
						9be2440b6d
					
				|  | @ -8,6 +8,7 @@ import kd.bos.entity.datamodel.events.PropertyChangedArgs; | |||
| import kd.bos.entity.operate.result.OperationResult; | ||||
| import kd.bos.form.control.Control; | ||||
| import kd.bos.form.control.events.BeforeClickEvent; | ||||
| import kd.bos.form.control.events.BeforeItemClickEvent; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.operation.SaveServiceHelper; | ||||
|  | @ -39,14 +40,26 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug | |||
|     public void registerListener(EventObject e) { | ||||
|         super.registerListener(e); | ||||
|         // 注册按钮点击事件 | ||||
|         this.addClickListeners("bar_save"); | ||||
|         this.addClickListeners("bar_audit"); | ||||
|         this.addItemClickListeners("bar_audit"); | ||||
|             } | ||||
| 
 | ||||
|     @Override | ||||
|     public void beforeClick(BeforeClickEvent evt) { | ||||
|         super.beforeClick(evt); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void click(EventObject evt) { | ||||
|         super.click(evt); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void beforeItemClick(BeforeItemClickEvent evt) { | ||||
|         super.beforeItemClick(evt); | ||||
|         Control source = (Control) evt.getSource(); | ||||
|         if (StringUtils.equals("bar_save", source.getKey())) { | ||||
|         if (StringUtils.equals("bar_audit", source.getKey())) { | ||||
|             // 在此添加业务逻辑 | ||||
|             Object changetype = this.getModel().getValue("changetype"); | ||||
|             if (changetype != null) { | ||||
|  | @ -78,7 +91,6 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug | |||
|                 } | ||||
|             } | ||||
|             evt.setCancel(true);  // 取消后续处理,将不会再触发click事件 | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,8 +1,12 @@ | |||
| package zcgj.zcdev.zcdev.pr.plugin.form; | ||||
| 
 | ||||
| import kd.bos.bill.AbstractBillPlugIn; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.entity.datamodel.events.ChangeData; | ||||
| import kd.bos.entity.datamodel.events.PropertyChangedArgs; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.EventObject; | ||||
| 
 | ||||
| /** | ||||
|  | @ -15,4 +19,88 @@ public class EcContractFromPlugin extends AbstractBillPlugIn implements Plugin { | |||
|         super.afterCreateNewData(e); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void propertyChanged(PropertyChangedArgs e) { | ||||
|         super.propertyChanged(e); | ||||
|         String name = e.getProperty().getName(); | ||||
|         ChangeData changeData = e.getChangeSet()[0]; | ||||
| 
 | ||||
|         Object taxrate = this.getModel().getValue("taxrate"); | ||||
|         if (taxrate != null) { | ||||
|             DynamicObject taxrateInfo = (DynamicObject) taxrate; | ||||
|             BigDecimal trate = taxrateInfo.getBigDecimal("taxrate"); | ||||
|             BigDecimal pRate = trate.divide(new BigDecimal(100)).add(new BigDecimal(1)); | ||||
|             BigDecimal amount = new BigDecimal(0); | ||||
|             BigDecimal ofamount = new BigDecimal(0); | ||||
|             BigDecimal rate = new BigDecimal(0); | ||||
|             DynamicObject dataEntity = this.getModel().getDataEntity(true); | ||||
|             if (name.equals("zcgj_pjnhhshte")) { | ||||
|                 Object zcgjPjnhbhshte = this.getModel().getValue("zcgj_pjnhhshte"); | ||||
|                 System.out.println(); | ||||
|                 if (zcgjPjnhbhshte != null) { | ||||
|                     ofamount = new BigDecimal(zcgjPjnhbhshte.toString()); | ||||
|                 } | ||||
|                 amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP); | ||||
|                 rate = ofamount.subtract(amount); | ||||
|                 dataEntity.set("zcgj_pjnhbhshte", amount); | ||||
|                 dataEntity.set("zcgj_pjnhse", rate); | ||||
| //                this.getModel().setValue("zcgj_pjnhbhshte", amount); | ||||
| //                this.getModel().setValue("zcgj_pjnhse", rate); | ||||
|             } else if (name.equals("zcgj_pjnhbhshte")) { | ||||
|                 Object zcgjPjnhhshte = this.getModel().getValue("zcgj_pjnhbhshte"); | ||||
|                 System.out.println(); | ||||
|                 if (zcgjPjnhhshte != null) { | ||||
|                     amount = new BigDecimal(zcgjPjnhhshte.toString()); | ||||
|                 } | ||||
|                 ofamount = amount.multiply(pRate); | ||||
|                 rate = ofamount.subtract(amount); | ||||
| //                this.getModel().setValue("zcgj_pjnhhshte", ofamount); | ||||
| //                this.getModel().setValue("zcgj_pjnhse", rate); | ||||
|                 dataEntity.set("zcgj_pjnhhshte", ofamount); | ||||
|                 dataEntity.set("zcgj_pjnhse", rate); | ||||
|             }else if (name.equals("zcgj_yjhshtsr")) { | ||||
|                 Object zcgjyjhshtsr = this.getModel().getValue("zcgj_yjhshtsr"); | ||||
|                 System.out.println(); | ||||
|                 if (zcgjyjhshtsr != null) { | ||||
|                     ofamount = new BigDecimal(zcgjyjhshtsr.toString()); | ||||
|                 } | ||||
|                 amount = ofamount.divide(pRate, 6, BigDecimal.ROUND_HALF_UP); | ||||
|                 rate = ofamount.subtract(amount); | ||||
| //                this.getModel().setValue("zcgj_yjbhshtsr", amount); | ||||
| //                this.getModel().setValue("zcgj_yjzse", rate); | ||||
|                 dataEntity.set("zcgj_yjbhshtsr", amount); | ||||
|                 dataEntity.set("zcgj_yjzse", rate); | ||||
|             } else if (name.equals("zcgj_yjbhshtsr")) { | ||||
|                 Object zcgjyjbhshtsr = this.getModel().getValue("zcgj_yjbhshtsr"); | ||||
|                 System.out.println(); | ||||
|                 if (zcgjyjbhshtsr != null) { | ||||
|                     amount = new BigDecimal(zcgjyjbhshtsr.toString()); | ||||
|                 } | ||||
|                 ofamount = amount.multiply(pRate); | ||||
|                 rate = ofamount.subtract(amount); | ||||
| //                this.getModel().setValue("zcgj_yjhshtsr", ofamount); | ||||
| //                this.getModel().setValue("zcgj_yjzse", rate); | ||||
|                 dataEntity.set("zcgj_yjhshtsr", ofamount); | ||||
|                 dataEntity.set("zcgj_yjzse", rate); | ||||
|             }else if (name.equals("zcgj_hshtdj")) { | ||||
|                 Object zcgjhshtdj = this.getModel().getValue("zcgj_hshtdj"); | ||||
|                 if (zcgjhshtdj != null) { | ||||
|                     ofamount = new BigDecimal(zcgjhshtdj.toString()); | ||||
|                 } | ||||
|                 amount = ofamount.divide(pRate,6, BigDecimal.ROUND_HALF_UP); | ||||
|                 dataEntity.set("zcgj_bhshtdj", amount); | ||||
| //                this.getModel().setValue("zcgj_bhshtdj", ofamount); | ||||
|             }else if (name.equals("zcgj_bhshtdj")) { | ||||
|                 Object zcgjbhshtdj = this.getModel().getValue("zcgj_bhshtdj"); | ||||
|                 if (zcgjbhshtdj != null) { | ||||
|                     amount = new BigDecimal(zcgjbhshtdj.toString()); | ||||
|                 } | ||||
|                 ofamount = amount.multiply(pRate); | ||||
|                 dataEntity.set("zcgj_hshtdj", ofamount); | ||||
| //                this.getModel().setValue("zcgj_hshtdj", ofamount); | ||||
|             } | ||||
|             this.getView().updateView(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue