Compare commits
4 Commits
59e3fc65fd
...
e128b0c883
| Author | SHA1 | Date |
|---|---|---|
|
|
e128b0c883 | |
|
|
3c6d06f4af | |
|
|
873f71b53d | |
|
|
a3211d97f6 |
|
|
@ -19,10 +19,7 @@ import kd.bos.form.control.AttachmentPanel;
|
|||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.form.events.*;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.field.ComboEdit;
|
||||
import kd.bos.form.field.ComboItem;
|
||||
import kd.bos.form.field.RefBillEdit;
|
||||
import kd.bos.form.field.*;
|
||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
|
|
@ -34,6 +31,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.operation.DeleteServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.ec.basedata.common.utils.OpenPageUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -42,7 +40,7 @@ import java.util.*;
|
|||
/**
|
||||
* 对公报销单无合同列表插件
|
||||
*/
|
||||
public class PublicreimbursebillNoContractPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener {
|
||||
public class PublicreimbursebillNoContractPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener,HyperLinkClickListener {
|
||||
|
||||
private static boolean editTitle = false;
|
||||
|
||||
|
|
@ -408,6 +406,23 @@ public class PublicreimbursebillNoContractPlugin extends AbstractBillPlugIn impl
|
|||
|
||||
this.addItemClickListeners("receiveentrytoolbar");//收款信息 增行
|
||||
|
||||
EntryGrid entryGrid = this.getView().getControl("zcgj_materialinbillentry");//入库单分录
|
||||
if (entryGrid != null) {
|
||||
entryGrid.addHyperClickListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) {
|
||||
String fieldName = hyperLinkClickEvent.getFieldName();
|
||||
if (StringUtils.equals(fieldName, "zcgj_materialinbill") || StringUtils.equals(fieldName, "zcgj_materialinbillname")) {
|
||||
int rowIndex = hyperLinkClickEvent.getRowIndex();
|
||||
DynamicObjectCollection materialInBillEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_materialinbillentry");//入库单分录
|
||||
DynamicObject materialInBillEntry = materialInBillEntryCollection.get(rowIndex);
|
||||
Object zcgj_purchaseapply_f7 = materialInBillEntry.getDynamicObject("zcgj_materialinbill").getPkValue();
|
||||
BillShowParameter billShowParameter = OpenPageUtils.buildBillShowParam(zcgj_purchaseapply_f7, "ecma_materialinbill");//入库单
|
||||
this.getView().showForm(billShowParameter);//打开入库单
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 企业成本核算表单插件
|
||||
|
|
@ -180,9 +178,31 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn {
|
|||
}
|
||||
}
|
||||
|
||||
// 清空原集合并添加汇总后的数据
|
||||
// 在添加数据前进行排序
|
||||
entryCollection.clear();
|
||||
for (DynamicObject entry : summaryMap.values()) {
|
||||
// 将summaryMap转换为List并按成本项数值排序
|
||||
List<DynamicObject> sortedEntries = new ArrayList<>(summaryMap.values());
|
||||
sortedEntries.sort((entry1, entry2) -> {
|
||||
Object costType1 = entry1.get("costtype");
|
||||
Object costType2 = entry2.get("costtype");
|
||||
|
||||
// 处理null值情况 - 将null值放在最后
|
||||
if (costType1 == null && costType2 == null) return 0;
|
||||
if (costType1 == null) return 1; // null值排在后面
|
||||
if (costType2 == null) return -1; // null值排在后面
|
||||
|
||||
// 提取数值部分进行比较
|
||||
String value1 = costType1.toString().replaceAll("[^0-9]", "");
|
||||
String value2 = costType2.toString().replaceAll("[^0-9]", "");
|
||||
|
||||
int num1 = value1.isEmpty() ? 0 : Integer.parseInt(value1);
|
||||
int num2 = value2.isEmpty() ? 0 : Integer.parseInt(value2);
|
||||
|
||||
return Integer.compare(num1, num2);
|
||||
});
|
||||
|
||||
// 按排序后的顺序添加数据
|
||||
for (DynamicObject entry : sortedEntries) {
|
||||
entryCollection.add(entry);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,29 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
if (newValue == null || !newValue.equals(oldValue)) {
|
||||
this.getModel().setValue("zcgj_purchaseapply", null);//清空采购申请
|
||||
}
|
||||
if (newValue != null && !newValue.equals(oldValue)) {
|
||||
DynamicObject fiaccountorg = (DynamicObject) newValue;//财务记账组织新值
|
||||
QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, fiaccountorg.getPkValue());
|
||||
filter.and(new QFilter("number", QCP.equals, "001"));
|
||||
filter.and(new QFilter("zcgj_companyblentry.zcgj_rateway", QCP.equals, true));
|
||||
DynamicObject zcgj_companybelong = QueryServiceHelper.queryOne("zcgj_companybelong", "number,zcgj_companyblentry.zcgj_wareunit", new QFilter[]{filter});
|
||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
||||
if (zcgj_companybelong != null) {
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
entryEntity.set("zcgj_invoicetax", BigDecimal.ZERO);//税额
|
||||
entryEntity.set("zcgj_invoiceamount", entryEntity.get("zcgj_oftaxinvoiceamount"));//价税合计赋值给金额
|
||||
}
|
||||
} else {
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
DynamicObject zcgj_invoice = entryEntity.getDynamicObject("zcgj_invoice");//发票号码
|
||||
entryEntity.set("zcgj_invoicetax", zcgj_invoice.getBigDecimal("totaltax"));//税额
|
||||
entryEntity.set("zcgj_invoiceamount", zcgj_invoice.getBigDecimal("totalamount"));//金额
|
||||
}
|
||||
}
|
||||
this.getView().updateView("zcgj_entryentity");//刷新分录
|
||||
}
|
||||
updateMeasureUnitEnableState();
|
||||
setNewExpenseSummary();
|
||||
} else if ("zcgj_reqperson".equals(key)) {
|
||||
//物资申请人
|
||||
ChangeData[] changeSet = e.getChangeSet();
|
||||
|
|
@ -423,6 +445,18 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
if (!invoiceTypeIdName.contains("专")) {
|
||||
this.getModel().setValue("zcgj_invoicetax", BigDecimal.ZERO, rowIndex);
|
||||
this.getModel().setValue("zcgj_invoiceamount", dataEntity.get("zcgj_oftaxinvoiceamount"), rowIndex);
|
||||
} else {
|
||||
DynamicObject fiaccountorg = (DynamicObject) this.getModel().getValue("fiaccountorg");//财务记账组织
|
||||
if (fiaccountorg != null) {
|
||||
QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, fiaccountorg.getPkValue());
|
||||
filter.and(new QFilter("number", QCP.equals, "001"));
|
||||
filter.and(new QFilter("zcgj_companyblentry.zcgj_rateway", QCP.equals, true));
|
||||
DynamicObject zcgj_companybelong = QueryServiceHelper.queryOne("zcgj_companybelong", "number,zcgj_companyblentry.zcgj_wareunit", new QFilter[]{filter});
|
||||
if (zcgj_companybelong != null) {
|
||||
this.getModel().setValue("zcgj_invoicetax", BigDecimal.ZERO, rowIndex);
|
||||
this.getModel().setValue("zcgj_invoiceamount", dataEntity.get("zcgj_oftaxinvoiceamount"), rowIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -848,31 +882,33 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
// 运费行 - 设置运费发票号码
|
||||
if (!freightInvoiceNumbers.isEmpty()) {
|
||||
String invoiceNumbersStr = String.join(",", freightInvoiceNumbers);
|
||||
line.set("zcgj_invoicenoentry", invoiceNumbersStr);
|
||||
line.set("zcgj_invoicenoentry", invoiceNumbersStr);// 发票号码
|
||||
|
||||
// 设置专票和抵扣字段
|
||||
boolean isSpecialInvoice = checkIfSpecialInvoice(freightInvoiceNumbers, invoiceTypeMap);
|
||||
line.set("zcgj_isspecialinvoice", isSpecialInvoice);
|
||||
line.set("zcgj_offset", isSpecialInvoice);
|
||||
line.set("zcgj_isspecialinvoice", isSpecialInvoice);// 专票
|
||||
boolean isSpecialInvoice2 = checkIfSpecialInvoice2(freightInvoiceNumbers, invoiceTypeMap);
|
||||
line.set("zcgj_offset", isSpecialInvoice2);// 是否抵扣
|
||||
} else {
|
||||
line.set("zcgj_invoicenoentry", null);
|
||||
line.set("zcgj_isspecialinvoice", false);
|
||||
line.set("zcgj_offset", false);
|
||||
line.set("zcgj_invoicenoentry", null);// 发票号码
|
||||
line.set("zcgj_isspecialinvoice", false);// 专票
|
||||
line.set("zcgj_offset", false);// 是否抵扣
|
||||
}
|
||||
} else {
|
||||
// 非运费行 - 设置非运费发票号码
|
||||
if (!nonFreightInvoiceNumbers.isEmpty()) {
|
||||
String invoiceNumbersStr = String.join(",", nonFreightInvoiceNumbers);
|
||||
line.set("zcgj_invoicenoentry", invoiceNumbersStr);
|
||||
line.set("zcgj_invoicenoentry", invoiceNumbersStr);// 发票号码
|
||||
|
||||
// 设置专票和抵扣字段
|
||||
boolean isSpecialInvoice = checkIfSpecialInvoice(nonFreightInvoiceNumbers, invoiceTypeMap);
|
||||
line.set("zcgj_isspecialinvoice", isSpecialInvoice);
|
||||
line.set("zcgj_offset", isSpecialInvoice);
|
||||
line.set("zcgj_isspecialinvoice", isSpecialInvoice);// 专票
|
||||
boolean isSpecialInvoice2 = checkIfSpecialInvoice2(nonFreightInvoiceNumbers, invoiceTypeMap);
|
||||
line.set("zcgj_offset", isSpecialInvoice2);// 是否抵扣
|
||||
} else {
|
||||
line.set("zcgj_invoicenoentry", null);
|
||||
line.set("zcgj_isspecialinvoice", false);
|
||||
line.set("zcgj_offset", false);
|
||||
line.set("zcgj_invoicenoentry", null);// 发票号码
|
||||
line.set("zcgj_isspecialinvoice", false);// 专票
|
||||
line.set("zcgj_offset", false);// 是否抵扣
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -903,6 +939,41 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查发票列表中是否包含专票类型的发票
|
||||
*
|
||||
* @param invoiceNumbers 发票号码列表
|
||||
* @param invoiceTypeMap 发票号码到发票对象的映射
|
||||
* @return 是否包含专票
|
||||
*/
|
||||
private boolean checkIfSpecialInvoice2(List<String> invoiceNumbers, Map<String, DynamicObject> invoiceTypeMap) {
|
||||
//财务记账组织存在公司归属对应数据中,是否抵扣就全是false
|
||||
DynamicObject fiaccountorg = (DynamicObject) this.getModel().getValue("fiaccountorg");//财务记账组织
|
||||
if (fiaccountorg != null) {
|
||||
QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, fiaccountorg.getPkValue());
|
||||
filter.and(new QFilter("number", QCP.equals, "001"));
|
||||
filter.and(new QFilter("zcgj_companyblentry.zcgj_rateway", QCP.equals, true));
|
||||
DynamicObject zcgj_companybelong = QueryServiceHelper.queryOne("zcgj_companybelong", "number,zcgj_companyblentry.zcgj_wareunit", new QFilter[]{filter});
|
||||
if (zcgj_companybelong != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (String invoiceNumber : invoiceNumbers) {
|
||||
DynamicObject invoice = invoiceTypeMap.get(invoiceNumber);
|
||||
if (invoice != null) {
|
||||
DynamicObject invoiceType = invoice.getDynamicObject("invoicetypeid"); // 发票类型字段
|
||||
if (invoiceType != null) {
|
||||
String invoiceTypeName = invoiceType.getString("name"); // 发票类型名称
|
||||
// 当发票类型为"数电发票(增值税专用发票)"或"电子发票专票"时,认为是专票
|
||||
if ("数电发票(增值税专用发票)".equals(invoiceTypeName) || "电子发票专票".equals(invoiceTypeName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按费用项目和税率组合合并费用汇总条目
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ import java.math.BigDecimal;
|
|||
|
||||
/**
|
||||
* 入库单提交操作校验插件
|
||||
* 说明:校验存在发票时,看无运费发票按钮是否开启,不开启校验含运费金额,开启只校验金额
|
||||
* 说明:1:校验存在发票时,看无运费发票按钮是否开启,不开启校验含运费金额,开启只校验金额
|
||||
* 2:上传的发票中含有普票时,提交时校验入库单明细中必须有“增值税0%”的税率
|
||||
*/
|
||||
public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlugIn {
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
|
|
@ -35,6 +36,8 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
|||
e.getFieldKeys().add("mataxamount");
|
||||
e.getFieldKeys().add("zcgj_freight_invoice");
|
||||
e.getFieldKeys().add("zcgj_no_invoice");
|
||||
e.getFieldKeys().add("zcgj_invoice");
|
||||
e.getFieldKeys().add("entrytaxrate");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,6 +55,31 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
|||
boolean zcgj_no_invoice = ecma_MaterialInBill.getBoolean("zcgj_no_invoice");//无物资发票
|
||||
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
||||
DynamicObjectCollection entryEntity2Collection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||
|
||||
int zeroTaxRateEntryCount = 0;
|
||||
boolean hasNonSpecialInvoice = false;
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
DynamicObject invoice = entryEntity.getDynamicObject("zcgj_invoice"); // 发票号码
|
||||
if (invoice == null) continue;
|
||||
DynamicObject invoiceTypeId = invoice.getDynamicObject("invoicetypeid"); // 发票类型
|
||||
if (invoiceTypeId == null) continue;
|
||||
String invoiceTypeIdName = invoiceTypeId.getString("name");
|
||||
if (!invoiceTypeIdName.contains("专")) {
|
||||
hasNonSpecialInvoice = true;
|
||||
for (DynamicObject entryEntity2 : entryEntity2Collection) {
|
||||
DynamicObject entryTaxRate = entryEntity2.getDynamicObject("entrytaxrate"); // 税率名称
|
||||
if (entryTaxRate != null && "增值税0%".equals(entryTaxRate.getString("name"))) {
|
||||
zeroTaxRateEntryCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasNonSpecialInvoice && zeroTaxRateEntryCount == 0) {
|
||||
this.addFatalErrorMessage(extendedDataEntity, "系统检测到上传的发票中存在普通发票,入库单明细中凡是涉及普票的物资,”税率名称“请选择”增值税0%”!!");
|
||||
}
|
||||
|
||||
|
||||
if (!zcgj_no_invoice && entryEntity2Collection != null && entryEntity2Collection.size() > 0) {
|
||||
String invoice_type = ecma_MaterialInBill.getString("zcgj_invoice_type");//发票类型
|
||||
boolean zcgj_notraninvoice = ecma_MaterialInBill.getBoolean("zcgj_notraninvoice");//无运费发票
|
||||
|
|
@ -103,7 +131,7 @@ public class MaterialInBillSubmitValidatorOp extends AbstractOperationServicePlu
|
|||
BigDecimal invoiceTax = entryEntity.getBigDecimal("zcgj_invoicetax"); // 合同进项发票信息-税额
|
||||
boolean zcgj_freight_invoice = entryEntity.getBoolean("zcgj_freight_invoice"); //运费发票
|
||||
if (zcgj_freight_invoice) {
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
if (invoiceTotal != null) {
|
||||
totalInvoiceTotal = totalInvoiceTotal.add(invoiceTotal);
|
||||
|
|
|
|||
Loading…
Reference in New Issue