0
某些用戶字段已添加到ARInvoice輸入屏幕(AR301000)。用戶字段存在於交易網格中。它們只是文本字段。沒有關聯的自定義邏輯,並綁定到數據庫表。ARInvoice發佈後如何在AR301000上啓用自定義字段?
用戶希望在發票發佈後修改特定的用戶文本字段 - 實現此目的的最佳方法是什麼?
某些用戶字段已添加到ARInvoice輸入屏幕(AR301000)。用戶字段存在於交易網格中。它們只是文本字段。沒有關聯的自定義邏輯,並綁定到數據庫表。ARInvoice發佈後如何在AR301000上啓用自定義字段?
用戶希望在發票發佈後修改特定的用戶文本字段 - 實現此目的的最佳方法是什麼?
謝天謝地,ARInvoces輸入屏幕上的事務網格從未被自動化步驟禁用。所有的交易格UI演示邏輯是隻有ARInvoiceEntry BLC中定義:
public class ARInvoiceEntry : ARDataEntryGraph<ARInvoiceEntry, ARInvoice>, PXImportAttribute.IPXPrepareItems
{
...
protected virtual void ARInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
ARInvoice doc = e.Row as ARInvoice;
if (doc == null) return;
...
bool shouldDisable = doc.Released == true
|| doc.Voided == true
|| doc.DocType == ARDocType.SmallCreditWO
|| doc.PendingPPD == true
|| doc.DocType == ARDocType.FinCharge && !IsProcessingMode && cache.GetStatus(doc) == PXEntryStatus.Inserted;
if (shouldDisable)
{
...
Transactions.Cache.AllowDelete = false;
Transactions.Cache.AllowUpdate = false;
Transactions.Cache.AllowInsert = false;
...
}
else
{
...
Transactions.Cache.AllowDelete = true;
Transactions.Cache.AllowUpdate = true;
Transactions.Cache.AllowInsert =
doc.CustomerID != null &&
doc.CustomerLocationID != null &&
doc.DocType != ARDocType.FinCharge &&
(doc.ProjectID != null || !PM.ProjectAttribute.IsPMVisible(this, BatchModule.AR));
...
}
...
}
protected virtual void ARTran_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
ARTran row = e.Row as ARTran;
if (row != null)
{
PXUIFieldAttribute.SetEnabled<ARTran.defScheduleID>(sender, row, row.TranType == ARInvoiceType.CreditMemo || row.TranType == ARInvoiceType.DebitMemo);
PXUIFieldAttribute.SetEnabled<ARTran.deferredCode>(sender, row, row.DefScheduleID == null);
}
}
...
}
要在AR301000啓用自定義字段中的ARInvoice發佈後,您應完成以下relatevely簡單的步驟:
設置AllowUpdate到真正爲ARInvoice_RowSelected事件處理程序中的ARTran緩存
調用靜態PXUIFieldAttribute.SetEnabled方法來禁用所有ARTran領域,除了特定的自定義文本字段,用戶要修改
完整的代碼片段如下:
public class ARInvoiceEntryExt : PXGraphExtension<ARInvoiceEntry>
{
private bool IsDisabled(ARInvoice doc)
{
return doc.Released == true
|| doc.Voided == true
|| doc.DocType == ARDocType.SmallCreditWO
|| doc.PendingPPD == true
|| doc.DocType == ARDocType.FinCharge
&& !Base.IsProcessingMode
&& Base.Document.Cache.GetStatus(doc) == PXEntryStatus.Inserted;
}
public void ARInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
ARInvoice doc = e.Row as ARInvoice;
if (doc == null) return;
if (IsDisabled(doc))
{
Base.Transactions.Cache.AllowUpdate = true;
}
}
public void ARTran_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
var doc = Base.Document.Current;
ARTran row = e.Row as ARTran;
if (row != null && doc != null && IsDisabled(doc))
{
PXUIFieldAttribute.SetEnabled(sender, row, false);
PXUIFieldAttribute.SetEnabled<ARTranExt.usrCustomTextField>(sender, row, true);
}
}
}