Some user fields were added to the top-level form of the ARInvoice entry screen (AR301000). A user wishes to modify a particular user text field after the invoice is released - what would be the best way to achieve this?
问问题
153 次
1 回答
1
For the ARInvoice entry screen, all UI presentation logic specific to the top-level form is only implemented within the 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)
{
bool isUnreleasedWO = doc.Released != true && doc.DocType == ARDocType.SmallCreditWO;
bool isUnreleasedPPD = doc.Released != true && doc.PendingPPD == true;
PXUIFieldAttribute.SetEnabled(cache, doc, false);
PXUIFieldAttribute.SetEnabled<ARInvoice.dueDate>(cache, doc, (doc.DocType != ARDocType.CreditMemo && doc.DocType != ARDocType.SmallCreditWO && doc.DocType != ARDocType.FinCharge) && doc.OpenDoc == true && doc.PendingPPD != true);
PXUIFieldAttribute.SetEnabled<ARInvoice.discDate>(cache, doc, (doc.DocType != ARDocType.CreditMemo && doc.DocType != ARDocType.SmallCreditWO && doc.DocType != ARDocType.FinCharge) && doc.OpenDoc == true && doc.PendingPPD != true);
PXUIFieldAttribute.SetEnabled<ARInvoice.emailed>(cache, doc, true);
cache.AllowDelete = isUnreleasedWO || isUnreleasedPPD;
cache.AllowUpdate = true;
Transactions.Cache.AllowDelete = false;
Transactions.Cache.AllowUpdate = false;
Transactions.Cache.AllowInsert = false;
..
}
else
{
...
}
...
}
...
}
To enable a custom field on the AR301000 top-level form after the ARInvoice is released, you should declare an extension for ARInvoiceEntry and subscribe to ARInvoice_RowSelected handler following the sample below:
public class ARInvoiceEntryExt : PXGraphExtension<ARInvoiceEntry>
{
public void ARInvoice_RowSelected(PXCache sender, 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
&& !Base.IsProcessingMode && sender.GetStatus(doc) == PXEntryStatus.Inserted;
if (shouldDisable)
{
PXUIFieldAttribute.SetEnabled<ARInvoiceExt.usrCustomTextField>(sender, doc, true);
}
}
}
于 2017-09-26T21:24:59.050 回答