I'm trying to extend the AccountByPeriodEnq business logic, yet i'm facing the following problem :
I can't seem to fire the GLTranR_RowUpdated or GLTranR_Selected_FieldUpdated events. (Unless I click the refresh button, then the events are fired)
Here's my code :
#region EventHandler
protected void GLTranR_Selected_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
{
del?.Invoke(cache, e);
var row = (GLTranR)e.Row;
}
protected void GLTranR_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
{
var row = (GLTranR)e.Row;
}
#endregion
When I put a breakpoint on any of those methods, it never actually break.
It seems the original event is never fired as well (Located in AccountByPeriodEnq.cs graph) since I never see the Reclassify button being disabled.
protected virtual void GLTranR_Selected_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
reclassify.SetEnabled(GetSelectedTrans().Any());
}
I have checked in the aspx and the commitchanges=true is set for the "Selected" field.
Here's the aspx :
<%@ Page Language="C#" MasterPageFile="~/MasterPages/FormDetail.master" AutoEventWireup="true"
ValidateRequest="false" CodeFile="GL404000.aspx.cs" Inherits="Page_GL404000"
Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPages/FormDetail.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phDS" runat="Server">
<px:PXDataSource ID="ds" runat="server" Visible="True" Width="100%" TypeName="PX.Objects.GL.AccountByPeriodEnq"
PrimaryView="Filter" PageLoadBehavior="PopulateSavedValues">
<CallbackCommands>
<px:PXDSCallbackCommand CommitChanges="True" Name="previousperiod" HideText="True"/>
<px:PXDSCallbackCommand CommitChanges="True" Name="nextperiod" HideText="True"/>
<px:PXDSCallbackCommand DependOnGrid="grid" Name="Reclassify" CommitChanges="True"/>
<px:PXDSCallbackCommand DependOnGrid="grid" Name="ReclassifyAll"/>
<px:PXDSCallbackCommand DependOnGrid="grid" Name="ReclassificationHistory" StateColumn="IncludedInReclassHistory"/>
</CallbackCommands>
</px:PXDataSource>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phF" runat="Server">
<px:PXFormView ID="form" runat="server" Width="100%"
Caption="Selection" DataMember="Filter" DefaultControlID="edFinPeriodID" DataSourceID="ds" TabIndex="100">
<Template>
<px:PXLayoutRule runat="server" StartColumn="True" LabelsWidth="SM" ControlSize="M" ></px:PXLayoutRule>
<px:PXSelector CommitChanges="True" ID="edOrganizationID" runat="server" DataField="OrganizationID"></px:PXSelector>
<px:PXSegmentMask CommitChanges="True" ID="edBranchID" runat="server" DataField="BranchID" Autorefresh="true"></px:PXSegmentMask>
<px:PXSelector CommitChanges="True" ID="edLedgerID" runat="server" DataField="LedgerID" Autorefresh="true"></px:PXSelector>
<px:PXSelector CommitChanges="True" ID="edStartPeriodID" runat="server" DataField="StartPeriodID"></px:PXSelector>
<px:PXSelector CommitChanges="True" ID="edEndPeriodID" runat="server" DataField="EndPeriodID" Autorefresh="True"></px:PXSelector>
<px:PXSegmentMask CommitChanges="True" ID="edAccountID" runat="server" DataField="AccountID"></px:PXSegmentMask>
<px:PXSegmentMask CommitChanges="True" ID="edSubID" runat="server" DataField="SubID" SelectMode="Segment" ></px:PXSegmentMask>
<px:PXLayoutRule runat="server" StartColumn="True" LabelsWidth="SM" ControlSize="S" ></px:PXLayoutRule>
<px:PXDateTimeEdit CommitChanges="True" ID="edStartDateUI" runat="server" DataField="StartDateUI" ></px:PXDateTimeEdit>
<px:PXDateTimeEdit CommitChanges="True" ID="edPeriodStartDate" runat="server" DataField="PeriodStartDateUI" ></px:PXDateTimeEdit>
<px:PXDateTimeEdit CommitChanges="True" ID="edEndDateUI" runat="server" DataField="EndDateUI" ></px:PXDateTimeEdit>
<px:PXDateTimeEdit CommitChanges="True" ID="edPeriodEndDateUI" runat="server" DataField="PeriodEndDateUI" ></px:PXDateTimeEdit>
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit1" DataField="UsrCreditTotal" CommitChanges="True" />
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit2" DataField="UsrDebitTotal" CommitChanges="True" />
<px:PXNumberEdit runat="server" ID="CstPXNumberEdit14" DataField="UsrSolde" CommitChanges="True" />
<px:PXLayoutRule runat="server" StartColumn="True" SuppressLabel="True" ></px:PXLayoutRule>
<px:PXCheckBox CommitChanges="True" ID="chkShowSummary" runat="server" DataField="ShowSummary" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkIncludeUnposted" runat="server" DataField="IncludeUnposted" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkIncludeUnreleased" runat="server" DataField="IncludeUnreleased" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkIncludeReclassified" runat="server" DataField="IncludeReclassified" ></px:PXCheckBox>
<px:PXCheckBox CommitChanges="True" ID="chkShowCuryDetail" runat="server" DataField="ShowCuryDetail" ></px:PXCheckBox>
<px:PXLayoutRule runat="server" StartColumn="True">
</px:PXLayoutRule>
<px:PXNumberEdit ID="edBegBal" runat="server" DataField="BegBal">
</px:PXNumberEdit>
<px:PXNumberEdit ID="edTurnOver" runat="server" DataField="TurnOver">
</px:PXNumberEdit>
<px:PXNumberEdit ID="edEndBal" runat="server" DataField="EndBal">
</px:PXNumberEdit>
<px:PXGroupBox runat="server" ID="groupAffichage" Caption="Afficher" CommitChanges="True" DataField="UsrAffichage" RenderSimple="True" RenderStyle="RoundBorder">
<ContentLayout Layout="Stack" />
<Template>
<px:PXRadioButton runat="server" ID="CstRadioButton15" Text="Tous" Value="0" Checked="False" GroupName="groupAffichage" />
<px:PXRadioButton runat="server" ID="CstRadioButton16" Value="1" Text="Lettres" GroupName="groupAffichage" Checked="False" />
<px:PXRadioButton runat="server" ID="CstRadioButton17" GroupName="groupAffichage" Value="2" Text="Non lettres" Checked="True" /></Template></px:PXGroupBox></Template>
</px:PXFormView></asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="phG" runat="Server">
<px:PXGrid ID="grid" runat="server" Height="150px"
Width="100%" AllowPaging="True" AdjustPageSize="Auto" Caption="Summary By Period" SyncPosition ="True" FastFilterFields="TranDesc,RefNbr,"
BatchUpdate="True" AllowSearch="True" SkinID="PrimaryInquire" RestrictFields="True" DataSourceID="ds" TabIndex="100" PreserveSortsAndFilters="False">
<CallbackCommands>
<Refresh RepaintControlsIDs="form"/>
</CallbackCommands>
<AutoSize Container="Window" Enabled="True" />
<Mode AllowAddNew="False" AllowDelete="False" />
<Levels>
<px:PXGridLevel DataMember="GLTranEnq">
<Columns>
<px:PXGridColumn DataField="Selected" TextAlign="Center" Type="CheckBox" Width="30px" AllowCheckAll="True" AllowShowHide="Server" CommitChanges="True"></px:PXGridColumn>
<px:PXGridColumn DataField="Module" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="BatchNbr" Width="100px" LinkCommand="ViewBatch" ></px:PXGridColumn>
<px:PXGridColumn DataField="TranDate" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="FinPeriodID" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="TranDesc" Width="224px" ></px:PXGridColumn>
<px:PXGridColumn DataField="RefNbr" Width="100px" LinkCommand="ViewDocument" ></px:PXGridColumn>
<px:PXGridColumn DataField="LineNbr" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="BranchID" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="AccountID" Width="108px" ></px:PXGridColumn>
<px:PXGridColumn DataField="SubID" Width="198px" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignBegBalance" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="DebitAmt" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="CreditAmt" TextAlign="Right" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignEndBalance" TextAlign="Right" MatrixMode="True" Width="100px" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryID" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignCuryBegBalance" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryDebitAmt" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="CuryCreditAmt" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="SignCuryEndBalance" TextAlign="Right" Width="100px" AllowShowHide="Server" ></px:PXGridColumn>
<px:PXGridColumn DataField="InventoryID" Width="120px" ></px:PXGridColumn>
<px:PXGridColumn DataField="ReferenceID" Width="120px" ></px:PXGridColumn>
<px:PXGridColumn DataField="ReferenceID_BaccountR_AcctName" Width="200px" ></px:PXGridColumn>
<px:PXGridColumn DataField="ReclassBatchNbr" TextAlign="Right" Width="120px" AllowShowHide="Server" LinkCommand="ViewReclassBatch" ></px:PXGridColumn>
<px:PXGridColumn DataField="IncludedInReclassHistory" AllowShowHide="False" Visible="false" SyncVisible="false" ></px:PXGridColumn>
<px:PXGridColumn DataField="UsrLettrageNbr" Width="70" CommitChanges="True" /></Columns>
</px:PXGridLevel>
</Levels>
<AutoSize Container="Window" Enabled="True" MinHeight="400" />
<ActionBar DefaultAction="DoubleClick" />
</px:PXGrid>
</asp:Content>
What am I missing ? I spent a few hours on it already and I've ran out of ideas.
Edit:
My end goal is to calculate the sum of the credit and debit for the selected lines on filter view. If you have any workaround to update these values everytime I select a new line, i'll take it.
Maybe with some javascript and a callback command ?
I opened a support ticket on this matter on the acumatica partner center.
Edit 2 :
So, I created my own custom selector :
#region UsrletSel
[PXBool]
[PXUIField(DisplayName = "Lettrer")]
public virtual bool? UsrletSel { get; set; }
public abstract class usrletSel : IBqlField { }
#endregion
Then I hid the base selector in aspx, and to keep the original logic I bound the new selector to the base one :
protected