我正在根据详细信息标签中所选项目的税种来实际更改货运税种
protected virtual void SOOrder_CustomerLocationID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
{
if (del != null)
del(sender, e);
var row = (SOOrder)e.Row;
Location location = PXSelect<Location, Where<Location.locationID, Equal<Required<Location.locationID>>>>.Select(Base, Base.Document.Current.CustomerLocationID);
if (location != null)
{
string custtaxzone = location.CTaxZoneID;
bool taxableitem = false;
if (custtaxzone == "TAXABLE")
{
foreach (SOLine line in Base.Transactions.Select())
{
if (line.TaxCategoryID == "PATAX")
{
taxableitem = true;
break;
}
}
if (taxableitem)
Base.Document.Current.FreightTaxCategoryID = "PATAX";
else
Base.Document.Current.FreightTaxCategoryID = null;
}
}
}
该值已正确更新,但未计算运费税。
答案 0 :(得分:0)
在RowUpdated事件中,更改值后更新DataView并调用tax属性的计算:
FormData
调用默认属性以清除运费税:
public void SOOrder_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
{
SOOrder row = e.Row as SOOrder;
if (!sender.ObjectsEqual<SOOrder.customerLocationID, SOOrder.customerLocationID>(e.OldRow, e.Row))
{
Base.Document.Current.FreightTaxCategoryID = "PATAX";
Base.Document.Update(Document.Current);
SOOrderTaxAttribute.Calculate<SOOrder.freightTaxCategoryID>(sender, e);
}
}