2017-09-26 79 views

回答

1

对于ARInvoice输入屏幕,所有具体到顶层表单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) 
     { 
      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 
     { 
      ... 
     } 
     ... 
    } 
    ... 
} 

要在启用后的AR301000顶级窗体上的自定义字段ARInvoice被释放,应声明的扩展ARInvoiceEntry和订阅ARInvoice_RowSelected处理程序下面的示例如下:

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); 
     } 
    } 
} 

enter image description here

相关问题