只想问下面编码中可能出现的问题,我想在用户从技术上选择税号时自动更新税率列。我成功为ATC创建了一个选择器,但在选择后它没有更新税率。以下是我的DAC,提前谢谢。
#region Atc
public abstract class atc : PX.Data.IBqlField
{
}
protected String _Atc;
[PXDBString(15, IsUnicode = true)]
[PXUIField(DisplayName = "ATC")]
//[PXSelector(typeof(Search<Tax.taxID, Where<Tax.taxType, Equal<CSTaxType.withholding>>>),
// new Type[] {typeof(Tax.descr)})]
[PXSelector(typeof(Search<Tax.taxID, Where<Tax.taxType, Equal<CSTaxType.withholding>>>))]
public virtual String Atc
{
get
{
return this._Atc;
}
set
{
this._Atc = value;
}
}
#endregion
#region Atcrate
public abstract class atcrate : PX.Data.IBqlField
{
}
protected Decimal? _Atcrate;
[PXDBDecimal()]
[PXFormula(typeof(Selector<IISI_ARAdjust_Ext.atc, TaxRev.taxRate>))]
[PXUIField(DisplayName = "ATC Rate")]
public virtual Decimal? Atcrate
{
get
{
return this._Atcrate;
}
set
{
this._Atcrate = value;
}
}
#endregion
答案 0 :(得分:0)
添加CommitChanges =&#34; True&#34;到选择器&#34; Atc&#34;在选择器中如下
<px:PXSelector CommitChanges="True" ID="edAtc" runat="server" AutoRefresh="True" DataField="ATC"/>
然后更新字段更新事件中的税率,如下所示:
public virtual void YourDAC_Atc_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
YourDAC var = (YourDAC)e.Row;
if (var == null)
{
return;
}
TaxRate = Formula to get the tax Rate based on the current Atc }