费用报销和对公报销费用项目和会计科目关联
This commit is contained in:
parent
f229e5b383
commit
5db8d9ce0c
|
@ -27,6 +27,7 @@ import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.QueryServiceHelper;
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
@ -304,6 +305,7 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
|
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
|
||||||
fieldEdit.addBeforeF7SelectListener(this);
|
fieldEdit.addBeforeF7SelectListener(this);
|
||||||
|
fieldEdit.addAfterF7SelectListener(this);
|
||||||
|
|
||||||
BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
|
BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
|
||||||
fieldEditExpense.addBeforeF7SelectListener(this);
|
fieldEditExpense.addBeforeF7SelectListener(this);
|
||||||
|
@ -315,33 +317,46 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
public void afterF7Select(AfterF7SelectEvent afterF7SelectEvent) {
|
public void afterF7Select(AfterF7SelectEvent afterF7SelectEvent) {
|
||||||
String name = ((BasedataEdit) afterF7SelectEvent.getSource()).getKey();
|
String name = ((BasedataEdit) afterF7SelectEvent.getSource()).getKey();
|
||||||
if(ACCOUNT_ITEM.equals(name)){
|
if(ACCOUNT_ITEM.equals(name)){
|
||||||
String id = (String) afterF7SelectEvent.getInputValue();
|
Long id = null;
|
||||||
QFilter nameQFilter = new QFilter(prefix+"_accounts",QCP.equals,Long.valueOf(id));
|
// 获取选中行
|
||||||
DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter});
|
ListSelectedRow selectRowList = afterF7SelectEvent.getListSelectedRow();
|
||||||
Object value = this.getModel().getValue(EXPENSE_ITEM, selectRow);
|
Object inputValue = afterF7SelectEvent.getInputValue();
|
||||||
if(value == null && dynamicObject1!=null&&selectRow!=null){
|
if(selectRowList != null){//弹框选择
|
||||||
DynamicObjectCollection zcgjEntryentity = (DynamicObjectCollection) dynamicObject1.get(MAP_ENTRY_ENTITY);
|
id = (Long) selectRowList.getPrimaryKeyValue();
|
||||||
if(zcgjEntryentity!=null){
|
}else if(inputValue != null){//模糊查询
|
||||||
DynamicObject dynamicObject = zcgjEntryentity.get(0);
|
id=Long.valueOf(inputValue.toString());
|
||||||
DynamicObject itemDynamicObject= dynamicObject.getDynamicObject(prefix+"_entity_items");
|
}
|
||||||
long aLong = itemDynamicObject.getLong("id");
|
if(id!=null){
|
||||||
System.out.println();
|
QFilter nameQFilter = new QFilter(prefix+"_accounts",QCP.equals,id);
|
||||||
this.getModel().setValue(EXPENSE_ITEM,aLong,selectRow);
|
DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter});
|
||||||
}else{
|
DynamicObject dynamicObject2 = this.getModel().getDataEntity(true).getDynamicObjectCollection(EXPENSE_ENTRY_ENTITY).get(selectRow);
|
||||||
// this.getModel().setValue(EXPENSE_ITEM,null,index);
|
boolean isEx = false;
|
||||||
|
if(dynamicObject2!=null){
|
||||||
|
isEx = dynamicObject2.get(EXPENSE_ITEM) == null;
|
||||||
|
}
|
||||||
|
if(isEx && dynamicObject1!=null&&selectRow!=null){
|
||||||
|
DynamicObjectCollection zcgjEntryentity = (DynamicObjectCollection) dynamicObject1.get(MAP_ENTRY_ENTITY);
|
||||||
|
if(zcgjEntryentity!=null){
|
||||||
|
DynamicObject dynamicObject = zcgjEntryentity.get(0);
|
||||||
|
DynamicObject itemDynamicObject= dynamicObject.getDynamicObject(prefix+"_entity_items");
|
||||||
|
long aLong = itemDynamicObject.getLong("id");
|
||||||
|
System.out.println();
|
||||||
|
this.getModel().setValue(EXPENSE_ITEM,aLong,selectRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
//this.getModel().setValue(EXPENSE_ITEM,null,index);
|
|
||||||
}
|
}
|
||||||
}else if(EXPENSE_ITEM.equals(name)){
|
}else if(EXPENSE_ITEM.equals(name)){
|
||||||
String id = (String) afterF7SelectEvent.getInputValue();
|
Object inputValue = afterF7SelectEvent.getInputValue();
|
||||||
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
|
if(inputValue!=null){
|
||||||
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
String id = String.valueOf(inputValue) ;
|
||||||
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
|
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
|
||||||
if(value==null && load!=null && load.length>0){
|
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
||||||
DynamicObject dynamicObject = load[0];
|
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
|
||||||
long aLong = dynamicObject.getLong("zcgj_accounts_id");
|
if(value==null && load!=null && load.length>0){
|
||||||
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
|
DynamicObject dynamicObject = load[0];
|
||||||
|
long aLong = dynamicObject.getLong("zcgj_accounts_id");
|
||||||
|
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,12 +367,21 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
public void beforeF7Select(BeforeF7SelectEvent arg0) {
|
public void beforeF7Select(BeforeF7SelectEvent arg0) {
|
||||||
String name = arg0.getProperty().getName();
|
String name = arg0.getProperty().getName();
|
||||||
if(name.equals(ACCOUNT_ITEM)){
|
if(name.equals(ACCOUNT_ITEM)){
|
||||||
if("click".equals(arg0.getSourceMethod())){
|
selectRow = arg0.getRow();
|
||||||
|
/* List<QFilter> qFilterList = new ArrayList<QFilter>();
|
||||||
|
qFilterList.add(new QFilter("number", QCP.like,"Sups%"));
|
||||||
|
arg0.setCustomQFilters(qFilterList);*/
|
||||||
|
|
||||||
|
/*if("click".equals(arg0.getSourceMethod())){
|
||||||
arg0.setCancel(true);
|
arg0.setCancel(true);
|
||||||
Object value = this.getModel().getValue("zcgj_accounttable_number");
|
Object value = this.getModel().getValue("zcgj_accounttable_number");
|
||||||
|
DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
|
||||||
|
long costcompanyId = costcompany.getLong("id");
|
||||||
//设置自定义F7弹框,增加过滤条件
|
//设置自定义F7弹框,增加过滤条件
|
||||||
List<QFilter> qFilterList = new ArrayList<QFilter>();
|
List<QFilter> qFilterList = new ArrayList<QFilter>();
|
||||||
qFilterList.add(new QFilter("accounttable.number", QCP.equals,value));
|
qFilterList.add(new QFilter("accounttable.number", QCP.equals,value));
|
||||||
|
//qFilterList.add(new QFilter("createorg", QCP.equals,Long.parseLong(costcompanyId+"")));
|
||||||
|
|
||||||
ListFilterParameter listFilterParameter =new ListFilterParameter(qFilterList,null);
|
ListFilterParameter listFilterParameter =new ListFilterParameter(qFilterList,null);
|
||||||
ListShowParameter showParameter = ShowFormHelper.createShowListForm("bd_accountview", true);
|
ListShowParameter showParameter = ShowFormHelper.createShowListForm("bd_accountview", true);
|
||||||
showParameter.setCloseCallBack(new CloseCallBack(this,ACTION_ID));
|
showParameter.setCloseCallBack(new CloseCallBack(this,ACTION_ID));
|
||||||
|
@ -366,6 +390,10 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
}else if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){
|
}else if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){
|
||||||
selectRow = arg0.getRow();
|
selectRow = arg0.getRow();
|
||||||
((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this);
|
((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this);
|
||||||
|
}*/
|
||||||
|
if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){
|
||||||
|
selectRow = arg0.getRow();
|
||||||
|
((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this);
|
||||||
}
|
}
|
||||||
}else if(name.equals(EXPENSE_ITEM)){
|
}else if(name.equals(EXPENSE_ITEM)){
|
||||||
if("click".equals(arg0.getSourceMethod())){
|
if("click".equals(arg0.getSourceMethod())){
|
||||||
|
@ -388,7 +416,7 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
Object returnData = closedCallBackEvent.getReturnData();
|
Object returnData = closedCallBackEvent.getReturnData();
|
||||||
boolean current= true;
|
boolean current= true;
|
||||||
|
|
||||||
if(returnData!=null && actionId.equals(ACTION_ID)){
|
/*if(returnData!=null && actionId.equals(ACTION_ID)){
|
||||||
//获取选中的索引
|
//获取选中的索引
|
||||||
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
||||||
//操作的行数据,获取之前的数据
|
//操作的行数据,获取之前的数据
|
||||||
|
@ -445,7 +473,8 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
this.getModel().createNewEntryRow(EXPENSE_ENTRY_ENTITY,insertRow);
|
this.getModel().createNewEntryRow(EXPENSE_ENTRY_ENTITY,insertRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(returnData!=null && actionId.equals(ACTION_ID_EXPENSE)){
|
}else */
|
||||||
|
if(returnData!=null && actionId.equals(ACTION_ID_EXPENSE)){
|
||||||
//获取选中的索引
|
//获取选中的索引
|
||||||
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
||||||
//操作的行数据,获取之前的数据
|
//操作的行数据,获取之前的数据
|
||||||
|
@ -473,26 +502,27 @@ public class DailyreimbursPlugin extends AbstractBillPlugIn implements Plugin,
|
||||||
}
|
}
|
||||||
current = false;
|
current = false;
|
||||||
}else{
|
}else{
|
||||||
Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index);
|
//Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index);
|
||||||
if(accountItem==null){
|
//if(accountItem == null){
|
||||||
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
||||||
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
||||||
if(load!=null && load.length>0){
|
if(load!=null && load.length>0){
|
||||||
DynamicObject dynamicObject = load[0];
|
DynamicObject dynamicObject = load[0];
|
||||||
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
|
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
|
||||||
if(zcgjAccounts!=null){
|
if(zcgjAccounts!=null){
|
||||||
//会计科目
|
//会计科目
|
||||||
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);
|
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);
|
||||||
}
|
|
||||||
}else{
|
|
||||||
insertRow.set(ACCOUNT_ITEM,null);
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
insertRow.set(ACCOUNT_ITEM,null);
|
||||||
}
|
}
|
||||||
|
//}
|
||||||
//费用项目科目
|
//费用项目科目
|
||||||
QFilter nameQFilterAccItem = new QFilter("id",QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
QFilter nameQFilterAccItem = new QFilter("id",QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
||||||
DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
|
DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
|
||||||
insertRow.set(EXPENSE_ITEM,dynamicObjectAccItem);
|
insertRow.set(EXPENSE_ITEM,dynamicObjectAccItem);
|
||||||
this.getModel().createNewEntryRow(EXPENSE_ENTRY_ENTITY,insertRow);
|
this.getModel().createNewEntryRow(EXPENSE_ENTRY_ENTITY,insertRow);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.CloseCallBack;
|
import kd.bos.form.CloseCallBack;
|
||||||
import kd.bos.form.ShowFormHelper;
|
import kd.bos.form.ShowFormHelper;
|
||||||
import kd.bos.form.events.ClosedCallBackEvent;
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
|
@ -21,7 +23,9 @@ import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.tree.TreeFilterParameter;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
@ -68,38 +72,65 @@ public class PublicreimbursebillPlugin extends AbstractBillPlugIn implements Plu
|
||||||
fieldEditExpense.addAfterF7SelectListener(this);
|
fieldEditExpense.addAfterF7SelectListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
if(name.equals(ACCOUNT_ITEM)){
|
||||||
|
ChangeData[] changeSet = e.getChangeSet();
|
||||||
|
DynamicObject dynamicObject = (DynamicObject)changeSet[0].getNewValue();
|
||||||
|
System.out.println();
|
||||||
|
//Object fh = String.valueOf(dynamicObject.get(8));
|
||||||
|
//this.getModel().setValue("ooo0_remark",fh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterF7Select(AfterF7SelectEvent afterF7SelectEvent) {
|
public void afterF7Select(AfterF7SelectEvent afterF7SelectEvent) {
|
||||||
String name = ((BasedataEdit) afterF7SelectEvent.getSource()).getKey();
|
String name = ((BasedataEdit) afterF7SelectEvent.getSource()).getKey();
|
||||||
if(ACCOUNT_ITEM.equals(name)){
|
if(ACCOUNT_ITEM.equals(name)){
|
||||||
String id = (String) afterF7SelectEvent.getInputValue();
|
Long id = null;
|
||||||
QFilter nameQFilter = new QFilter(prefix+"_accounts",QCP.equals,Long.valueOf(id));
|
// 获取选中行
|
||||||
DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter});
|
ListSelectedRow selectRowList = afterF7SelectEvent.getListSelectedRow();
|
||||||
Object value = this.getModel().getValue(EXPENSE_ITEM, selectRow);
|
Object inputValue = afterF7SelectEvent.getInputValue();
|
||||||
if(value == null && dynamicObject1!=null&&selectRow!=null){
|
if(selectRowList != null){//弹框选择
|
||||||
DynamicObjectCollection zcgjEntryentity = (DynamicObjectCollection) dynamicObject1.get(MAP_ENTRY_ENTITY);
|
id = (Long) selectRowList.getPrimaryKeyValue();
|
||||||
if(zcgjEntryentity!=null){
|
}else if(inputValue != null){//模糊查询
|
||||||
DynamicObject dynamicObject = zcgjEntryentity.get(0);
|
id=Long.valueOf(inputValue.toString());
|
||||||
DynamicObject itemDynamicObject= dynamicObject.getDynamicObject(prefix+"_entity_items");
|
}
|
||||||
long aLong = itemDynamicObject.getLong("id");
|
if(id!=null){
|
||||||
System.out.println();
|
QFilter nameQFilter = new QFilter(prefix+"_accounts",QCP.equals,id);
|
||||||
this.getModel().setValue(EXPENSE_ITEM,aLong,selectRow);
|
DynamicObject dynamicObject1 = BusinessDataServiceHelper.loadSingle(MAP_TABLE, "createorg,zcgj_entryentity,zcgj_entryentity.zcgj_entity_items", new QFilter[]{nameQFilter});
|
||||||
}else{
|
DynamicObject dynamicObject2 = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity").get(selectRow);
|
||||||
// this.getModel().setValue(EXPENSE_ITEM,null,index);
|
boolean isEx = false;
|
||||||
|
if(dynamicObject2!=null){
|
||||||
|
isEx = dynamicObject2.get(EXPENSE_ITEM) == null;
|
||||||
|
}
|
||||||
|
if(isEx && dynamicObject1!=null&&selectRow!=null){
|
||||||
|
DynamicObjectCollection zcgjEntryentity = (DynamicObjectCollection) dynamicObject1.get(MAP_ENTRY_ENTITY);
|
||||||
|
if(zcgjEntryentity!=null){
|
||||||
|
DynamicObject dynamicObject = zcgjEntryentity.get(0);
|
||||||
|
DynamicObject itemDynamicObject= dynamicObject.getDynamicObject(prefix+"_entity_items");
|
||||||
|
long aLong = itemDynamicObject.getLong("id");
|
||||||
|
System.out.println();
|
||||||
|
this.getModel().setValue(EXPENSE_ITEM,aLong,selectRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
//this.getModel().setValue(EXPENSE_ITEM,null,index);
|
|
||||||
}
|
}
|
||||||
}else if(EXPENSE_ITEM.equals(name)){
|
}else if(EXPENSE_ITEM.equals(name)){
|
||||||
String id = (String) afterF7SelectEvent.getInputValue();
|
Object inputValue = afterF7SelectEvent.getInputValue();
|
||||||
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
|
if(inputValue!=null){
|
||||||
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
String id = String.valueOf(inputValue) ;
|
||||||
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
|
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,Long.valueOf(id));
|
||||||
if(value==null && load!=null && load.length>0){
|
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
||||||
DynamicObject dynamicObject = load[0];
|
Object value = this.getModel().getValue(ACCOUNT_ITEM, selectRow);
|
||||||
long aLong = dynamicObject.getLong("zcgj_accounts_id");
|
if(value==null && load!=null && load.length>0){
|
||||||
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
|
DynamicObject dynamicObject = load[0];
|
||||||
|
long aLong = dynamicObject.getLong("zcgj_accounts_id");
|
||||||
|
this.getModel().setValue(ACCOUNT_ITEM,aLong,selectRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -108,20 +139,36 @@ public class PublicreimbursebillPlugin extends AbstractBillPlugIn implements Plu
|
||||||
public void beforeF7Select(BeforeF7SelectEvent arg0) {
|
public void beforeF7Select(BeforeF7SelectEvent arg0) {
|
||||||
String name = arg0.getProperty().getName();
|
String name = arg0.getProperty().getName();
|
||||||
if(name.equals(ACCOUNT_ITEM)){
|
if(name.equals(ACCOUNT_ITEM)){
|
||||||
if("click".equals(arg0.getSourceMethod())){
|
selectRow = arg0.getRow();
|
||||||
|
/*if("click".equals(arg0.getSourceMethod())){
|
||||||
arg0.setCancel(true);
|
arg0.setCancel(true);
|
||||||
Object value = this.getModel().getValue("zcgj_accounttable_number");
|
Object value = this.getModel().getValue("zcgj_accounttable_number");
|
||||||
|
DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
|
||||||
|
long costcompanyId = costcompany.getLong("id");
|
||||||
|
//((ListShowParameter)beforeF7SelectEvent.getFormShowParameter()).getTreeFilterParameter().getQFilters().add(new QFilter("name", "=", "长度"))
|
||||||
//设置自定义F7弹框,增加过滤条件
|
//设置自定义F7弹框,增加过滤条件
|
||||||
List<QFilter> qFilterList = new ArrayList<QFilter>();
|
List<QFilter> qFilterList = new ArrayList<QFilter>();
|
||||||
qFilterList.add(new QFilter("accounttable.number", QCP.equals,value));
|
qFilterList.add(new QFilter("accounttable.number", QCP.equals,value));
|
||||||
|
//qFilterList.add(new QFilter("createorg", QCP.equals,Long.parseLong(costcompanyId+"")));
|
||||||
ListFilterParameter listFilterParameter =new ListFilterParameter(qFilterList,null);
|
ListFilterParameter listFilterParameter =new ListFilterParameter(qFilterList,null);
|
||||||
ListShowParameter showParameter = ShowFormHelper.createShowListForm("bd_accountview", true);
|
ListShowParameter showParameter = ShowFormHelper.createShowListForm("bd_accountview", true);
|
||||||
showParameter.setCloseCallBack(new CloseCallBack(this,ACTION_ID));
|
showParameter.setCloseCallBack(new CloseCallBack(this,ACTION_ID));
|
||||||
showParameter.setListFilterParameter(listFilterParameter);
|
showParameter.setListFilterParameter(listFilterParameter);
|
||||||
|
|
||||||
|
List<QFilter> qFilterList1 = new ArrayList<QFilter>();
|
||||||
|
qFilterList1.add(new QFilter("accounttable.number", QCP.equals,value));
|
||||||
|
TreeFilterParameter treeFilterParameter = new TreeFilterParameter();
|
||||||
|
treeFilterParameter.setQFilters(qFilterList1);
|
||||||
|
showParameter.setTreeFilterParameter(treeFilterParameter);
|
||||||
|
|
||||||
this.getView().showForm(showParameter);
|
this.getView().showForm(showParameter);
|
||||||
}else if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){
|
}else if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){
|
||||||
selectRow = arg0.getRow();
|
selectRow = arg0.getRow();
|
||||||
((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this);
|
((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this);
|
||||||
|
}*/
|
||||||
|
if("setItemByIdFromClient".equals(arg0.getSourceMethod()) ){
|
||||||
|
selectRow = arg0.getRow();
|
||||||
|
((BasedataEdit) arg0.getSource()).addAfterF7SelectListener(this);
|
||||||
}
|
}
|
||||||
}else if(name.equals(EXPENSE_ITEM)){
|
}else if(name.equals(EXPENSE_ITEM)){
|
||||||
if("click".equals(arg0.getSourceMethod())){
|
if("click".equals(arg0.getSourceMethod())){
|
||||||
|
@ -143,7 +190,7 @@ public class PublicreimbursebillPlugin extends AbstractBillPlugIn implements Plu
|
||||||
Object returnData = closedCallBackEvent.getReturnData();
|
Object returnData = closedCallBackEvent.getReturnData();
|
||||||
boolean current= true;
|
boolean current= true;
|
||||||
|
|
||||||
if(returnData!=null && actionId.equals(ACTION_ID)){
|
/*if(returnData!=null && actionId.equals(ACTION_ID)){
|
||||||
//获取选中的索引
|
//获取选中的索引
|
||||||
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
||||||
//操作的行数据,获取之前的数据
|
//操作的行数据,获取之前的数据
|
||||||
|
@ -202,7 +249,8 @@ public class PublicreimbursebillPlugin extends AbstractBillPlugIn implements Plu
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(returnData!=null && actionId.equals(ACTION_ID_EXPENSE)){
|
}else*/
|
||||||
|
if(returnData!=null && actionId.equals(ACTION_ID_EXPENSE)){
|
||||||
//获取选中的索引
|
//获取选中的索引
|
||||||
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
int index = this.getModel().getEntryCurrentRowIndex(EXPENSE_ENTRY_ENTITY);
|
||||||
//操作的行数据,获取之前的数据
|
//操作的行数据,获取之前的数据
|
||||||
|
@ -230,21 +278,21 @@ public class PublicreimbursebillPlugin extends AbstractBillPlugIn implements Plu
|
||||||
}
|
}
|
||||||
current = false;
|
current = false;
|
||||||
}else{
|
}else{
|
||||||
Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index);
|
//Object accountItem = this.getModel().getValue(ACCOUNT_ITEM, index);
|
||||||
if(accountItem == null){
|
//if(accountItem == null){
|
||||||
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
QFilter nameQFilter = new QFilter(prefix+"_entryentity.zcgj_entity_items.id", QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
||||||
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
DynamicObject[] load = BusinessDataServiceHelper.load(MAP_TABLE, "createorg,zcgj_accounts", new QFilter[]{nameQFilter});
|
||||||
if(load!=null && load.length>0){
|
if(load!=null && load.length>0){
|
||||||
DynamicObject dynamicObject = load[0];
|
DynamicObject dynamicObject = load[0];
|
||||||
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
|
DynamicObject zcgjAccounts = dynamicObject.getDynamicObject("zcgj_accounts");
|
||||||
if(zcgjAccounts!=null){
|
if(zcgjAccounts!=null){
|
||||||
//会计科目
|
//会计科目
|
||||||
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);
|
insertRow.set(ACCOUNT_ITEM,zcgjAccounts);
|
||||||
}
|
|
||||||
}else{
|
|
||||||
insertRow.set(ACCOUNT_ITEM,null);
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
insertRow.set(ACCOUNT_ITEM,null);
|
||||||
}
|
}
|
||||||
|
//}
|
||||||
//费用项目科目
|
//费用项目科目
|
||||||
QFilter nameQFilterAccItem = new QFilter("id",QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
QFilter nameQFilterAccItem = new QFilter("id",QCP.equals,listSelectedRow.getPrimaryKeyValue());
|
||||||
DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
|
DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.entity.operate.Submit;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差旅报销单插件
|
||||||
|
*/
|
||||||
|
public class TripreimbursebillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class);
|
||||||
|
//开发商标识
|
||||||
|
private static final String prefix ="zcgj";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
if((args.getSource() instanceof Submit) ){
|
||||||
|
Submit source = (Submit)args.getSource();
|
||||||
|
if(source.getOperateKey().equals("submit") ){
|
||||||
|
//highseasontripstdshow
|
||||||
|
//提交时校验附件是否必填
|
||||||
|
IDataModel model = this.getModel();
|
||||||
|
String zsKey = String.valueOf(model.getValue("zcgj_zs_key"));
|
||||||
|
boolean isfloating20 = Boolean.parseBoolean(model.getValue("zcgj_isfloating20")+"");
|
||||||
|
|
||||||
|
//获取当前费用为住宿的
|
||||||
|
DynamicObjectCollection tripentryCollection = model.getEntryEntity("tripentry");
|
||||||
|
//tripentry.get(0).getDynamicObjectCollection("entryentity").get(2).getDynamicObject("expenseitem").getString("number");
|
||||||
|
for (DynamicObject tripentry : tripentryCollection) {
|
||||||
|
DynamicObjectCollection entryentityCollection = tripentry.getDynamicObjectCollection("entryentity");
|
||||||
|
for (DynamicObject entryentity : entryentityCollection) {
|
||||||
|
DynamicObject expenseitem = entryentity.getDynamicObject("expenseitem");
|
||||||
|
String zsNumber = expenseitem.getString("number");
|
||||||
|
if(zsKey.equals(zsNumber)){
|
||||||
|
BigDecimal orientryamount = entryentity.getBigDecimal("orientryamount");//报销金额
|
||||||
|
BigDecimal tripstandardamount = entryentity.getBigDecimal("tripstandardamount");//差旅标准金额
|
||||||
|
Integer caldaycount = entryentity.getInt("caldaycount");//标准天数
|
||||||
|
//如果选择了上浮20%,则按照上浮20%进行判断
|
||||||
|
if(isfloating20){
|
||||||
|
BigDecimal multiply = tripstandardamount.multiply(new BigDecimal("1.2")).multiply(new BigDecimal(caldaycount));
|
||||||
|
//-1表示小于,0是等于,1是大于
|
||||||
|
if(orientryamount.compareTo(multiply) > 0){
|
||||||
|
this.getView().showTipNotification("报销住宿超出标准!(上浮20%)");
|
||||||
|
//取消提交操作
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
BigDecimal multiply = tripstandardamount.multiply(new BigDecimal(caldaycount));
|
||||||
|
//-1表示小于,0是等于,1是大于
|
||||||
|
if(orientryamount.compareTo(multiply) > 0){
|
||||||
|
this.getView().showTipNotification("报销住宿超出标准!");
|
||||||
|
//取消提交操作
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取当前差旅标准
|
||||||
|
/* Object value = model.getValue("tripstandardamount");
|
||||||
|
this.getView().showTipNotification(value+"");*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue