2017-08-17 145 views
0

我是Acumatica的新手,嘗試探索一些自定義功能。在acumatica中添加自定義按鈕

我已經創建了2個標籤銷售訂單屏幕上 - CstLabeltotal和CstLabelqty

我試圖找出一種方法,其中除了總的標籤會顯示從文檔詳細信息選項卡和數量總數交易(第1列)標籤顯示來自「文檔詳細信息」選項卡(第9列)的總數量

任何人都可以幫助我嗎?

回答

1

使用自定義未綁定字段(NonPersistedField)作爲佔位符來顯示總計。

首先添加這些自定義字段SOOrder DAC擴展: enter image description here

總數量的自定義字段: enter image description here

總交易自定義字段: enter image description here

創建SOOrderEntry圖形擴展運算/更新彙總: enter image description here

添加自定義字段,以銷售訂單屏幕上,無需使用標籤控件,DAC DisplayName屬性將作爲字段標籤: enter image description here

找到基本圖交易數據視圖含有所需的(僅用於信息)計算總計詳細數據: enter image description here

在你SOOrderEntry分機使用交易數據視圖從基本圖來計算總計:

namespace PX.Objects.SO 
{ 
  public class SOOrderEntry_Extension:PXGraphExtension<SOOrderEntry> 
  { 
      // Initialize unbound values in FieldSelecting events 
      public void SOOrder_UsrTotalQty_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) 
      { 
          e.ReturnValue = GetTotalQty(sender); 
      } 

      public void SOOrder_UsrTotalTransactions_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) 
      { 
          e.ReturnValue = GetTotalTransactions(sender); 
      } 

      // Update values 
      public void SOLine_RowDeleted(PXCache sender, PXRowDeletedEventArgs e) 
      { 
          UpdateTotals(sender, e.Row as SOOrder, true, true); 
      } 

      public void SOLine_RowInserted(PXCache sender, PXRowInsertedEventArgs e) 
      { 
          UpdateTotals(sender, e.Row as SOOrder, true, true); 
      } 

      public void SOLine_OrderQty_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) 
      { 
          UpdateTotals(sender, e.Row as SOOrder, true, false); 
      } 

      public void UpdateTotals(PXCache sender, SOOrder soOrder, bool isUpdateQty, bool isUpdateTranCount) 
      { 
          // Get SOOrder DAC extension 
          if (soOrder != null) 
          { 
              SOOrderExt soOrderExt = sender.GetExtension<SOOrderExt>(soOrder); 
               
              if (soOrderExt != null) 
              { 
                   // Update values 
                   if (isUpdateQty) 
                   { 
                       soOrderExt.UsrTotalQty = GetTotalQty(sender); 
                   } 
                
                   if (isUpdateTranCount) 
                   { 
                       soOrderExt.UsrTotalTransactions= GetTotalTransactions(sender); 
                   } 
              } 
          } 
      } 
             
      // Compute totals 
      public decimal? GetTotalQty(PXCache sender) 
      { 
          decimal? totalQty = 0M; 

          // Compute quantity from SOOrderEntry base graph Transactions DataView 
          foreach (SOLine soLine in Base.Transactions.Select()) 
          { 
              totalQty += soLine.OrderQty; 
          } 

          return totalQty; 
      } 

      public int? GetTotalTransactions(PXCache sender) 
      { 
          return Base.Transactions.Select().Count(); 
      } 
  } 
} 

彙總顯示在銷售訂單屏幕上,他們將在插入時/刪除交易行和修改訂單數量更新: enter image description here

+0

如果由於分頁(僅事務網格的第一頁結果)總計僅顯示屏幕上的內容,則必須在自定義中複製事務數據視圖。 –

相關問題