public virtual void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { GLSetup gLSetup = PXSelect <GLSetup> .Select(sender.Graph); decimal?result = 0m; object cashAccountID = sender.GetValue(e.Row, _CashAccount); object finPeriodID = null; if (string.IsNullOrEmpty(_FinPeriodID)) { object finDate = sender.GetValue(e.Row, _FinDate); var finPeriod = ""; if (finPeriod != null) { CashAccount cashaccount = PXSelect <CashAccount, Where <CashAccount.cashAccountID, Equal <Required <CashAccount.cashAccountID> > > > .Select(sender.Graph, cashAccountID); if (cashaccount != null) { finPeriodID = sender.Graph.GetService <IFinPeriodRepository>().FindFinPeriodByDate((DateTime?)sender.GetValue(e.Row, _FinDate), PXAccess.GetParentOrganizationID(cashaccount.BranchID))?.FinPeriodID; } } } else { finPeriodID = sender.GetValue(e.Row, _FinPeriodID); } if (cashAccountID != null && finPeriodID != null) { // clear glhistory cache for ReleasePayments longrun sender.Graph.Caches <GLHistory>().ClearQueryCache(); sender.Graph.Caches <GLHistory>().Clear(); GLHistory gLHistory = PXSelectJoin <GLHistory, InnerJoin <GLHistoryByPeriod, On <GLHistoryByPeriod.accountID, Equal <GLHistory.accountID>, And <GLHistoryByPeriod.branchID, Equal <GLHistory.branchID>, And <GLHistoryByPeriod.ledgerID, Equal <GLHistory.ledgerID>, And <GLHistoryByPeriod.subID, Equal <GLHistory.subID>, And <GLHistoryByPeriod.lastActivityPeriod, Equal <GLHistory.finPeriodID> > > > > >, InnerJoin <Branch, On <Branch.branchID, Equal <GLHistory.branchID>, And <Branch.ledgerID, Equal <GLHistory.ledgerID> > >, InnerJoin <CashAccount, On <GLHistoryByPeriod.branchID, Equal <CashAccount.branchID>, And <GLHistoryByPeriod.accountID, Equal <CashAccount.accountID>, And <GLHistoryByPeriod.subID, Equal <CashAccount.subID> > > >, InnerJoin <Account, On <GLHistoryByPeriod.accountID, Equal <Account.accountID>, And <Match <Account, Current <AccessInfo.userName> > > >, InnerJoin <Sub, On <GLHistoryByPeriod.subID, Equal <Sub.subID>, And <Match <Sub, Current <AccessInfo.userName> > > > > > > > >, Where <CashAccount.cashAccountID, Equal <Required <CashAccount.cashAccountID> >, And <GLHistoryByPeriod.finPeriodID, Equal <Required <GLHistoryByPeriod.finPeriodID> > > > > .Select(sender.Graph, cashAccountID, finPeriodID); if (gLHistory != null) { result = gLHistory.CuryFinYtdBalance; } } e.ReturnValue = result; e.Cancel = true; }
protected virtual void RevalueFilter_TotalRevalued_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { if (e.Row != null) { decimal val = 0m; foreach (RevaluedARHistory res in ARAccountList.Cache.Updated) { if ((bool)res.Selected) { val += (decimal)res.FinPtdRevalued; } } if (val == 0) { TimeSpan timespan; Exception ex; if (PXLongOperation.GetStatus(UID, out timespan, out ex) == PXLongRunStatus.Completed) { Filter.Cache.RaiseExceptionHandling <RevalueFilter.totalRevalued>(e.Row, val, new PXSetPropertyException(Messages.NoRevaluationEntryWasMade, PXErrorLevel.Warning)); } } else { e.ReturnValue = val; e.Cancel = true; } } }
public void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) => throw new PXSetupNotEnteredException("Setup is not entered", typeof(SOInvoice));
protected virtual void CATransfer_TranIDIn_CATran_BatchNbr_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) => TranID_CATran_BatchNbr_FieldSelectingHendler(sender, e);
protected virtual void EPRuleCondition_FieldName_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { EPRuleCondition row = e.Row as EPRuleCondition; if (row != null && row.Entity != null) { e.ReturnState = CreateFieldStateForFieldName(e.ReturnState, AssigmentMap.Current.EntityType, AssigmentMap.Current.GraphType, row.Entity); } }
protected virtual void PMTask_CompletedPercent_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { PMTask row = e.Row as PMTask; if (row != null && row.CompletedPctMethod != PMCompletedPctMethod.Manual) { PXSelectBase <PMCostBudget> select = new PXSelectGroupBy <PMCostBudget, Where <PMCostBudget.projectID, Equal <Required <PMTask.projectID> >, And <PMCostBudget.projectTaskID, Equal <Required <PMTask.taskID> >, And <PMCostBudget.isProduction, Equal <True> > > >, Aggregate < GroupBy <PMCostBudget.accountGroupID, GroupBy <PMCostBudget.inventoryID, GroupBy <PMCostBudget.uOM, Sum <PMCostBudget.amount, Sum <PMCostBudget.qty, Sum <PMCostBudget.revisedAmount, Sum <PMCostBudget.revisedQty, Sum <PMCostBudget.actualAmount, Sum <PMCostBudget.actualQty> > > > > > > > > > >(this); PXResultset <PMCostBudget> ps = select.Select(row.ProjectID, row.TaskID); if (ps != null) { double percentSum = 0; Int32 recordCount = 0; decimal actualAmount = 0; decimal revisedAmount = 0; foreach (PMCostBudget item in ps) { if (row.CompletedPctMethod == PMCompletedPctMethod.ByQuantity && item.RevisedQty > 0) { recordCount++; percentSum += Convert.ToDouble(100 * item.ActualQty / item.RevisedQty); } else if (row.CompletedPctMethod == PMCompletedPctMethod.ByAmount) { recordCount++; actualAmount += item.ActualAmount.GetValueOrDefault(0); revisedAmount += item.RevisedAmount.GetValueOrDefault(0); } } if (row.CompletedPctMethod == PMCompletedPctMethod.ByAmount) { e.ReturnValue = revisedAmount == 0 ? 0 : Convert.ToDecimal(100 * actualAmount / revisedAmount); } else { e.ReturnValue = Convert.ToDecimal(percentSum) == 0 ? 0 : Convert.ToDecimal(percentSum / recordCount); } e.ReturnState = PXFieldState.CreateInstance(e.ReturnValue, typeof(decimal?), false, false, 0, 2, 0, 0, nameof(PMTask.completedPercent), null, null, null, PXErrorLevel.Undefined, false, true, true, PXUIVisibility.Visible, null, null, null); } } }
private static void TranID_CATran_BatchNbr_FieldSelectingHendler(PXCache sender, PXFieldSelectingEventArgs e) { if (e.Row == null || e.IsAltered) { string ViewName = null; PXCache cache = sender.Graph.Caches[typeof(CATran)]; PXFieldState state = cache.GetStateExt <CATran.batchNbr>(null) as PXFieldState; if (state != null) { ViewName = state.ViewName; } e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, null, false, false, 0, 0, null, null, null, null, null, null, PXErrorLevel.Undefined, false, true, true, PXUIVisibility.Visible, ViewName, null, null); } }
protected virtual void CRFixedFilterRow_ValueSt2_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e) { Values_FieldSelecting_Handler(e, "ValueSt2", true); }
protected virtual void CRFixedFilterRow_Condition_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e) { string[] labels = null; int[] values = null; var row = e.Row as CRFixedFilterRow; if (row != null) { GetConditions(row.DataField, out values, out labels); } string[] localizedLabels = LocalizeFilterConditionLabels(labels); e.ReturnState = PXIntState.CreateInstance(row == null ? null : row.Condition, typeof(CRFixedFilterRow.condition).Name, false, null, null, null, values, localizedLabels, null, null); }
protected virtual void CRFixedFilterRow_OpenBrackets_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { CRFixedFilterRow row = e.Row as CRFixedFilterRow; if (IsImport && row != null) { if (row.OpenBrackets == null && FilterRow.OpenBracketsAttribute.Values != null) { row.OpenBrackets = FilterRow.OpenBracketsAttribute.Values.First(); } if (row.CloseBrackets == null && FilterRow.CloseBracketsAttribute.Values != null) { row.CloseBrackets = FilterRow.CloseBracketsAttribute.Values.First(); } } }
protected virtual void CRFixedFilterRow_DataField_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { e.ReturnState = PXStringState.CreateInstance(e.ReturnState, null, null, "DataField", null, null, null, PropertyNames, PropertyLabels, true, null); }
protected virtual void CCProcessingCenterDetail_Value_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { CCProcessingCenterDetail row = e.Row as CCProcessingCenterDetail; if (row != null) { string fieldName = typeof(CCProcessingCenterDetail.value).Name; switch (row.ControlType) { case ControlTypeDefintion.Combo: List <string> labels = new List <string>(); List <string> values = new List <string>(); foreach (KeyValuePair <string, string> kv in row.GetComboValues()) { values.Add(kv.Key); labels.Add(kv.Value); } e.ReturnState = PXStringState.CreateInstance(e.ReturnState, CCProcessingCenterDetail.ValueFieldLength, null, fieldName, false, 1, null, values.ToArray(), labels.ToArray(), true, null); break; case ControlTypeDefintion.CheckBox: e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(Boolean), false, null, -1, null, null, null, fieldName, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); break; case ControlTypeDefintion.Password: //handled by PXRSACryptStringWithConditional attribute break; default: break; } } }
public override void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { _AllowedValues = CostCodeAttribute.UseCostCode() ? new string[] { BudgetLevels.Task, BudgetLevels.CostCode, BudgetLevels.Item } : new string[] { BudgetLevels.Task, BudgetLevels.Item }; _AllowedLabels = CostCodeAttribute.UseCostCode() ? new string[] { Messages.Task, Messages.BudgetLevel_CostCode, Messages.BudgetLevel_Item } : new string[] { Messages.Task, Messages.BudgetLevel_Item }; base.FieldSelecting(sender, e); }
protected virtual void AddressValidatorPluginDetail_Value_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e) { AddressValidatorPluginDetail row = e.Row as AddressValidatorPluginDetail; if (row != null) { string fieldName = typeof(AddressValidatorPluginDetail.value).Name; switch (row.ControlTypeValue) { case AddressValidatorPluginDetail.Combo: List <string> labels = new List <string>(); List <string> values = new List <string>(); foreach (var kv in row.ComboValues) { values.Add(kv.Key); labels.Add(kv.Value); } e.ReturnState = PXStringState.CreateInstance(e.ReturnState, AddressValidatorPluginDetail.ValueFieldLength, null, fieldName, false, 1, null, values.ToArray(), labels.ToArray(), true, null); break; case AddressValidatorPluginDetail.CheckBox: e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(Boolean), false, null, -1, null, null, null, fieldName, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); break; case AddressValidatorPluginDetail.Password: if (e.ReturnState != null) { string strValue = e.ReturnState.ToString(); string encripted = new string('*', strValue.Length); e.ReturnState = PXFieldState.CreateInstance(encripted, typeof(string), false, null, -1, null, null, null, fieldName, null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null); } break; default: break; } } }