[英]How to setvalue on fieldupdate
您好,我的自定義項目仍有問題,我正在使用 acumatica,我需要在 pxselect 或字段更新上獲取相應的字段,您能告訴我一種方法嗎?我已經嘗試了我在這里學到的所有內容。
所以這是我創建的代碼
public class APTranExt : PXCacheExtension<PX.Objects.AP.APTran>
{
#region UsrWholdingATC
[PXDBString(10)]
[PXUIField(DisplayName = "WholdingATC")]
[PXSelector(
typeof(Search<withholdingtaxx.atc>),
typeof(withholdingtaxx.taxRate))]
public virtual string UsrWholdingATC { get; set; }
public abstract class usrWholdingATC : PX.Data.BQL.BqlString.Field<usrWholdingATC> { }
#endregion
#region UsrWholdingrate
[PXDBDecimal]
[PXUIField(DisplayName = "Wholdingrate")]
public virtual Decimal? UsrWholdingrate { get; set; }
public abstract class usrWholdingrate : PX.Data.BQL.BqlDecimal.Field<usrWholdingrate> { }
#endregion
#region UsrWholdingamount
[PXDBDecimal]
[PXUIField(DisplayName = "WholdingAmount")]
public virtual Decimal? UsrWholdingamount { get; set; }
public abstract class usrWholdingamount : PX.Data.BQL.BqlDecimal.Field<usrWholdingamount> { }
#endregion
[Serializable]
public class withholdingtaxx : IBqlTable
{
#region IDNbr
[PXDBInt(IsKey = true)]
[PXUIField(DisplayName = "IDNbr")]
public virtual int? IDNbr { get; set; }
public abstract class idNbr : PX.Data.BQL.BqlInt.Field<idNbr> { }
#endregion
#region Atc
[PXDBString(50, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Atc")]
public virtual string Atc { get; set; }
public abstract class atc : PX.Data.BQL.BqlString.Field<atc> { }
#endregion
#region Type
[PXDBString(50, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Type")]
public virtual string Type { get; set; }
public abstract class type : PX.Data.BQL.BqlString.Field<type> { }
#endregion
#region Description
[PXDBString(400, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Description")]
public virtual string Description { get; set; }
public abstract class description : PX.Data.BQL.BqlString.Field<description> { }
#endregion
#region TaxRate
[PXDBString(50, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Tax Rate")]
public virtual string TaxRate { get; set; }
public abstract class taxRate : PX.Data.BQL.BqlString.Field<taxRate> { }
#endregion
#region Bir_form
[PXDBString(50, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Bir_form")]
public virtual string Bir_form { get; set; }
public abstract class bir_form : PX.Data.BQL.BqlString.Field<bir_form> { }
#endregion
}
}
一切從這里工作得很好我成功地創建了一個自定義表來自 pxselector 的顯示表
所以我需要的是當我選擇 atc 值時,我還需要提取稅率並將其放在 wholdingrate 字段中,謝謝您的幫助
順便說一下,我試圖在這里放一些代碼,但是當我在調試模式下運行時它沒有命中 fieldupdate
protected void APTran_UsrWholdingATC_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (APTran)e.Row;
}
當我在調試模式下運行時,它不會命中 fieldupdate
通常發生這種情況是因為字段編輯器控件沒有將CommitChanges
屬性設置為True
:
當CommitChanges
在編輯器控件上設置為True
時,當用戶更改值后控件失去焦點時,將調用FieldUpdated
事件:
protected void APTran_UsrWholdingATC_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
APTran tran = e.Row as APTran;
if (tran != null)
{
APTranExt tranExt = tran.GetExtension<APTranExt>();
if (tranExt != null)
{
decimal? value = [...];
cache.SetValue<APTranExt.usrWholdingrate>(tran, value);
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.