How to get the default value for the Transaction Period and Financial Period based on a date field entered and branch selector
Hello,
I have a customization form that I need to fill “Transaction Period” and company’s “Financial Period” by defult from a date field and the selected branch but I can not make it work. I reviewed a couple Acumatica’s owen screens and I’m doing exctly the same (at least I think so) but these two fields are not filled by default. Any help appreciated. Here is my little Graph, partial DAC and Partial ASPX.
namespace MyCustom
}
// Graph
public class PMCashflowProjectionEntry : PXGraph<PMCashflowProjectionEntry, PMCashflowProjection>
{
[PXViewName("Projects Cashflow Projections")]
public PXSelect<PMCashflowProjection> CashflowProjections;
public PXSelect<PMCashflowProjectionSchedule, Where<PMCashflowProjectionSchedule.projectID, Equal<Current<PMCashflowProjection.projectID>>>> CashflowProjectionSchedules;
}
//Partial Header DAC
public class PMCashflowProjection : IBqlTable
{
#region BranchID
public abstract class branchID : PX.Data.BQL.BqlInt.Field<branchID> { }
protected Int32? _BranchID;
[Branch()]
[PXForeignReference(typeof(Field<branchID>.IsRelatedTo<Branch.branchID>))]
[PXUIField(DisplayName = "Branch", Visibility = PXUIVisibility.SelectorVisible, Required = true, Enabled = true, Visible = true)]
public virtual Int32? BranchID
{
get
{
return this._BranchID;
}
set
{
this._BranchID = value;
}
}
#endregion
}
//Partial Detail DAC
public class PMCashflowProjectionSchedule : IBqlTable
{
#region Date
public abstract class date : PX.Data.BQL.BqlDateTime.Field<date> { }
protected DateTime? _Date;
[PXDBDate()]
[PXDefault(typeof(AccessInfo.businessDate), PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Date", Visibility = PXUIVisibility.SelectorVisible, Required = true, Enabled = true, Visible = true, IsReadOnly = false)]
public virtual DateTime? Date
{
get
{
return this._Date;
}
set
{
this._Date = value;
}
}
#endregion
#region TranPeriodID
public abstract class tranPeriodID : PX.Data.BQL.BqlString.Field<tranPeriodID> { }
protected String _TranPeriodID;
[PXDefault()]
[PeriodID(
searchType: null,
sourceType: typeof(date),
defaultType: null,
redefaultOnDateChanged: true)]
[PXUIField(DisplayName = "Tran. Period", Visibility = PXUIVisibility.SelectorVisible, Required = true, Enabled = true, Visible = true)]
public virtual String TranPeriodID
{
get
{
return this._TranPeriodID;
}
set
{
this._TranPeriodID = value;
}
}
#endregion
#region FinPeriodID
public abstract class finPeriodID : PX.Data.BQL.BqlString.Field<finPeriodID> { }
protected String _FinPeriodID;
[PXDefault()]
[FinPeriodID(
sourceType: typeof(date),
branchSourceType: typeof(PMCashflowProjection.branchID),
masterFinPeriodIDType: typeof(tranPeriodID),
headerMasterFinPeriodIDType: typeof(tranPeriodID),
redefaultOnDateChanged: true)]
[PXUIField(DisplayName = "Fin. Period", Visibility = PXUIVisibility.SelectorVisible, Required = true, Enabled = true, Visible = true)]
public virtual String FinPeriodID
{
get
{
return this._FinPeriodID;
}
set
{
this._FinPeriodID = value;
}
}
#endregion
}
}
{
//Partial ASPX
//Form
<px:PXSegmentMask runat="server" ID="edBranchID" DataField="BranchID" CommitChanges="True" AutoRefresh="True" />
//Grid Clumns
<px:PXGridColumn DataField="Date" Width="80" CommitChanges="True" ></px:PXGridColumn>
<px:PXGridColumn DataField="TranPeriodID" Width="80" CommitChanges="True" ></px:PXGridColumn>
<px:PXGridColumn DataField="FinPeriodID" Width="80" CommitChanges="True" ></px:PXGridColumn>
// Grid Row Template
<px:PXDateTimeEdit runat="server" ID="edDate" DataField="Date" CommitChanges="True" AutoRefresh="True" ></px:PXDateTimeEdit>
<px:PXMaskEdit runat="server" ID="edTranPeriodID" DataField="TranPeriodID" CommitChanges="True" Size="s" ></px:PXMaskEdit>
<px:PXMaskEdit runat="server" ID="edFinPeriodID" DataField="FinPeriodID" CommitChanges="True" Size="s" ></px:PXMaskEdit>
}
Best answer by aaghaei
View original