public virtual bool IsFieldVisible(string field, RMReport report) { string reportType = report != null ? report.Type : null; if (field.Equals(typeof(RMDataSourceGL.useMasterCalendar).Name, StringComparison.InvariantCultureIgnoreCase)) { return(PXAccess.FeatureInstalled <FeaturesSet.multipleCalendarsSupport>()); } if (reportType == RMType.GL) { if ( field.Equals(typeof(RMDataSourcePM.startAccountGroup).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endAccountGroup).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.startProject).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endProject).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.startProjectTask).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endProjectTask).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.startInventory).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endInventory).Name, StringComparison.InvariantCultureIgnoreCase) ) { return(false); } } return(true); }
public virtual void dataSourceFieldSelecting(PXFieldSelectingEventArgs e, string field) { RMReport report = (RMReport)e.Row; if (report != null && report.Type == RMType.GL && field.Equals(typeof(RMDataSource.amountType).Name, StringComparison.InvariantCultureIgnoreCase)) { e.ReturnState = PXIntState.CreateInstance(e.ReturnValue, field, false, 0, null, null, new int[] { BalanceType.NotSet, BalanceType.Turnover, BalanceType.Credit, BalanceType.Debit, BalanceType.BeginningBalance, BalanceType.EndingBalance, BalanceType.CuryTurnover, BalanceType.CuryCredit, BalanceType.CuryDebit, BalanceType.CuryBeginningBalance, BalanceType.CuryEndingBalance }, new string[] { Messages.GetLocal(Messages.NotSet), Messages.GetLocal(Messages.Turnover), Messages.GetLocal(Messages.Credit), Messages.GetLocal(Messages.Debit), Messages.GetLocal(Messages.BegBalance), Messages.GetLocal(Messages.EndingBalance), Messages.GetLocal(Messages.CuryTurnover), Messages.GetLocal(Messages.CuryCredit), Messages.GetLocal(Messages.CuryDebit), Messages.GetLocal(Messages.CuryBegBalance), Messages.GetLocal(Messages.CuryEndingBalance), }, typeof(short), BalanceType.NotSet); ((PXFieldState)e.ReturnState).DisplayName = Messages.GetLocal(Messages.AmountType); } }
public virtual bool IsFieldVisible(string field, RMReport report, Func <string, RMReport, bool> baseMethod) { string reportType = report != null ? report.Type : null; if (reportType == RMType.PM) { if ( field.Equals(typeof(RMDataSourceGL.ledgerID).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.accountClassID).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.startAccount).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.endAccount).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.startSub).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.endSub).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.organizationID).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.useMasterCalendar).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.startBranch).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourceGL.endBranch).Name, StringComparison.InvariantCultureIgnoreCase) ) { return(false); } } return(baseMethod(field, report)); }
public virtual void dataSourceFieldSelecting(PXFieldSelectingEventArgs e, string field) { RMReport report = (RMReport)e.Row; RMDataSource dataSource = report != null?Base.DataSourceByID.Select(report.DataSourceID) : null; if (dataSource == null) { object defValue; if (Base.DataSourceByID.Cache.RaiseFieldDefaulting(field, null, out defValue)) { Base.DataSourceByID.Cache.RaiseFieldUpdating(field, null, ref defValue); } Base.DataSourceByID.Cache.RaiseFieldSelecting(field, null, ref defValue, true); e.ReturnState = defValue; } else { e.ReturnState = Base.DataSourceByID.Cache.GetStateExt(dataSource, field); } //Fix AmountType Combo for PM: if (report != null && report.Type == RMType.PM && field.Equals(typeof(RMDataSource.amountType).Name, StringComparison.InvariantCultureIgnoreCase)) { e.ReturnState = PXIntState.CreateInstance(e.ReturnValue, field, false, 0, null, null, new int[] { BalanceType.NotSet, BalanceType.Amount, BalanceType.Quantity, BalanceType.TurnoverAmount, BalanceType.TurnoverQuantity, BalanceType.BudgetAmount, BalanceType.BudgetQuantity, BalanceType.RevisedAmount, BalanceType.RevisedQuantity, BalanceType.OriginalCommittedAmount, BalanceType.OriginalCommittedQuantity, BalanceType.CommittedAmount, BalanceType.CommittedQuantity, BalanceType.CommittedOpenAmount, BalanceType.CommittedOpenQuantity, BalanceType.CommittedReceivedQuantity, BalanceType.CommittedInvoicedAmount, BalanceType.CommittedInvoicedQuantity }, new string[] { Messages.GetLocal(Messages.NotSet), Messages.GetLocal(Messages.ActualAmount), Messages.GetLocal(Messages.ActualQuantity), Messages.GetLocal(Messages.AmountTurnover), Messages.GetLocal(Messages.QuantityTurnover), Messages.GetLocal(Messages.BudgetAmount), Messages.GetLocal(Messages.BudgetQuantity), Messages.GetLocal(Messages.RevisedAmount), Messages.GetLocal(Messages.RevisedQuantity), Messages.GetLocal(Messages.OriginalCommittedAmount), Messages.GetLocal(Messages.OriginalCommittedQuantity), Messages.GetLocal(Messages.CommittedAmount), Messages.GetLocal(Messages.CommittedQuantity), Messages.GetLocal(Messages.CommittedOpenAmount), Messages.GetLocal(Messages.CommittedOpenQuantity), Messages.GetLocal(Messages.CommittedReceivedQuantity), Messages.GetLocal(Messages.CommittedInvoicedAmount), Messages.GetLocal(Messages.CommittedInvoicedQuantity) }, typeof(short), 0); ((PXFieldState)e.ReturnState).DisplayName = Messages.GetLocal(Messages.AmountType); } Base1.dataSourceFieldSelecting(e, field); if (e.ReturnState is PXFieldState) { ((PXFieldState)e.ReturnState).SetFieldName("DataSource" + field); ((PXFieldState)e.ReturnState).Visible = Base.IsFieldVisible(field, report); } }
public virtual bool IsFieldVisible(string field, RMReport report) { string reportType = report != null ? report.Type : null; if (reportType == RMType.GL) { if ( field.Equals(typeof(RMDataSourcePM.startAccountGroup).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endAccountGroup).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.startProject).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endProject).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.startProjectTask).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endProjectTask).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.startInventory).Name, StringComparison.InvariantCultureIgnoreCase) || field.Equals(typeof(RMDataSourcePM.endInventory).Name, StringComparison.InvariantCultureIgnoreCase) ) { return(false); } } return(true); }
public virtual void dataSourceFieldSelecting(PXFieldSelectingEventArgs e, string field) { RMReport report = (RMReport)e.Row; //Fix AmountType Combo for GL:[PXIntList("0;Not Set,1;Turnover,2;Credit,3;Debit,4;Beg. Balance,5;Ending Balance")] if (report != null && report.Type == RMType.GL && field.Equals(typeof(RMDataSource.amountType).Name, StringComparison.InvariantCultureIgnoreCase)) { e.ReturnState = PXIntState.CreateInstance(e.ReturnValue, field, false, 0, null, null, new int[6] { BalanceType.NotSet, BalanceType.Turnover, BalanceType.Credit, BalanceType.Debit, BalanceType.BeginningBalance, BalanceType.EndingBalance }, new string[6] { PXLocalizer.Localize(Messages.NotSet, typeof(Messages).FullName), PXLocalizer.Localize(Messages.Turnover, typeof(Messages).FullName), PXLocalizer.Localize(Messages.Credit, typeof(Messages).FullName), PXLocalizer.Localize(Messages.Debit, typeof(Messages).FullName), PXLocalizer.Localize(Messages.BegBalance, typeof(Messages).FullName), PXLocalizer.Localize(Messages.EndingBalance, typeof(Messages).FullName), }, typeof(short), BalanceType.NotSet); ((PXFieldState)e.ReturnState).DisplayName = PXLocalizer.Localize(Messages.AmountType, typeof(Messages).FullName); } }
protected void Page_Init(object sender, EventArgs e) { RMReportMaint graph = (RMReportMaint)ds.DataGraph; PXDataSourceViewSchema schema = ds.GetSchema("Report"); RMReport currentReport = graph.Report.Current; RMRowSet currentRowSet = (RMRowSet)graph.Caches[typeof(RMRowSet)].Current; RMColumnSet currentColumnSet = (RMColumnSet)graph.Caches[typeof(RMColumnSet)].Current; RMUnitSet currentUnitSet = (RMUnitSet)graph.Caches[typeof(RMUnitSet)].Current; string currentTypeReport = currentReport != null ? currentReport.Type : null; RMDataSource currentDataSource = graph.DataSourceByID.Current; if (currentTypeReport == null) { graph.Report.Current = currentReport = new RMReport(); } if (currentRowSet == null) { graph.Caches[typeof(RMRowSet)].Current = new RMRowSet(); } graph.Caches[typeof(RMColumnSet)].Current = null; graph.Caches[typeof(RMUnitSet)].Current = null; Dictionary <string, List <PXFieldSchema> > controls = new Dictionary <string, List <PXFieldSchema> >(); string[] arrTypes = ((PXStringState)graph.Report.Cache.GetStateExt <RMReport.type>(null)).AllowedValues; foreach (string type in arrTypes) { graph.Report.Current.Type = type; ((RMRowSet)graph.Caches[typeof(RMRowSet)].Current).Type = type; graph.Report.Current = currentReport; graph.DataSourceByID.Current = null; List <PXFieldSchema> lControls = new List <PXFieldSchema>(); List <PXFieldSchema> list = RefreshFieldsList(schema, graph); foreach (PXFieldSchema f in list) { if (f.DataType == TypeCode.Object) { continue; } if (!ContainsControlDictionary(f, controls)) { lControls.Add(f); } } controls.Add(type, lControls); } if (currentTypeReport == null) { graph.Report.Cache.Clear(); } else { graph.Report.Current.Type = currentTypeReport; } graph.DataSourceByID.Current = currentDataSource; graph.Caches[typeof(RMRowSet)].Current = currentRowSet; graph.Caches[typeof(RMColumnSet)].Current = currentColumnSet; graph.Caches[typeof(RMUnitSet)].Current = currentUnitSet; _insertIndex = 0; foreach (Control control in this.form.TemplateContainer.Controls) { if (!string.IsNullOrEmpty(control.ID)) { if (!control.ID.Equals("edStartUnitCode", StringComparison.OrdinalIgnoreCase)) { _insertIndex++; } else { break; } } else { _insertIndex++; } } _insertIndex++; PXLayoutRule rule1 = new PXLayoutRule() { ID = "rule1", StartGroup = true, GroupCaption = "Default Data Source Settings" }; (rule1).ApplyStyleSheetSkin(this.Page); this.form.TemplateContainer.Controls.AddAt(_insertIndex, rule1); _insertIndex++; for (int c = arrTypes.Length - 1; c >= 0; c--) { string type = arrTypes[c]; List <PXFieldSchema> lDsControls = new List <PXFieldSchema>(); for (int i = 0; i < controls[type].Count; i++) { if (controls[type][i].DataField.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceexpand", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceamounttype", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourcestartPeriodOffset", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceEndPeriodOffset", StringComparison.OrdinalIgnoreCase) //ContainsControl("Request" + controls[type][i].DataField.Replace("DataSource", string.Empty), controls[type]) ) { lDsControls.Add(controls[type][i]); } } int cntFirstColumn = lDsControls.Count / 2; if ((lDsControls.Count % 2) > 0) { cntFirstColumn++; } for (int i = 0; i < cntFirstColumn; i++) { AddControl(lDsControls[i], controls[type]); if ((lDsControls.Count - 1) >= (i + cntFirstColumn)) { AddControl(lDsControls[i + cntFirstColumn], controls[type]); } } } PXDropDown edDataSourceAmountType = new PXDropDown() { ID = "edDataSourceAmountType", AllowNull = false, DataField = "DataSourceAmountType" }; form.TemplateContainer.Controls.AddAt(_insertIndex, edDataSourceAmountType); (edDataSourceAmountType).ApplyStyleSheetSkin(this.Page); _insertIndex++; PXCheckBox chkApplyRestrictionGroups = new PXCheckBox() { ID = "chkApplyRestrictionGroups", DataField = "ApplyRestrictionGroups" }; form.TemplateContainer.Controls.AddAt(_insertIndex, chkApplyRestrictionGroups); (chkApplyRestrictionGroups).ApplyStyleSheetSkin(this.Page); }
protected void Page_Init(object sender, EventArgs e) { RMReportMaint graph = (RMReportMaint)ds.DataGraph; PXDataSourceViewSchema schema = ds.GetSchema("Report"); RMReport currentReport = graph.Report.Current; RMRowSet currentRowSet = (RMRowSet)graph.Caches[typeof(RMRowSet)].Current; RMColumnSet currentColumnSet = (RMColumnSet)graph.Caches[typeof(RMColumnSet)].Current; RMUnitSet currentUnitSet = (RMUnitSet)graph.Caches[typeof(RMUnitSet)].Current; string currentTypeReport = currentReport != null ? currentReport.Type : null; RMDataSource currentDataSource = graph.DataSourceByID.Current; if (currentTypeReport == null) { graph.Report.Current = currentReport = new RMReport(); } if (currentRowSet == null) { graph.Caches[typeof(RMRowSet)].Current = new RMRowSet(); } graph.Caches[typeof(RMColumnSet)].Current = null; graph.Caches[typeof(RMUnitSet)].Current = null; Dictionary<string, List<PXFieldSchema>> controls = new Dictionary<string, List<PXFieldSchema>>(); string[] arrTypes = ((PXStringState)graph.Report.Cache.GetStateExt<RMReport.type>(null)).AllowedValues; foreach (string type in arrTypes) { graph.Report.Current.Type = type; ((RMRowSet)graph.Caches[typeof(RMRowSet)].Current).Type = type; graph.Report.Current = currentReport; graph.DataSourceByID.Current = null; List<PXFieldSchema> lControls = new List<PXFieldSchema>(); List<PXFieldSchema> list = RefreshFieldsList(schema, graph); foreach (PXFieldSchema f in list) { if (f.DataType == TypeCode.Object) continue; if (!ContainsControlDictionary(f, controls)) { lControls.Add(f); } } controls.Add(type, lControls); } if (currentTypeReport == null) { graph.Report.Cache.Clear(); } else { graph.Report.Current.Type = currentTypeReport; } graph.DataSourceByID.Current = currentDataSource; graph.Caches[typeof(RMRowSet)].Current = currentRowSet; graph.Caches[typeof(RMColumnSet)].Current = currentColumnSet; graph.Caches[typeof(RMUnitSet)].Current = currentUnitSet; _insertIndex = 0; foreach (Control control in this.form.TemplateContainer.Controls) { if (!string.IsNullOrEmpty(control.ID)) { if (!control.ID.Equals("edStartUnitCode", StringComparison.OrdinalIgnoreCase)) _insertIndex++; else break; } else _insertIndex++; } _insertIndex++; PXLayoutRule rule1 = new PXLayoutRule() { ID = "rule1", StartGroup = true, GroupCaption = "Default Data Source Settings" }; (rule1).ApplyStyleSheetSkin(this.Page); this.form.TemplateContainer.Controls.AddAt(_insertIndex, rule1); _insertIndex++; for (int c = arrTypes.Length - 1; c >= 0; c--) { string type = arrTypes[c]; List<PXFieldSchema> lDsControls = new List<PXFieldSchema>(); for (int i = 0; i < controls[type].Count; i++) { if (controls[type][i].DataField.StartsWith("DataSource", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceexpand", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceamounttype", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourcestartPeriodOffset", StringComparison.OrdinalIgnoreCase) && !controls[type][i].DataField.Equals("datasourceEndPeriodOffset", StringComparison.OrdinalIgnoreCase) //ContainsControl("Request" + controls[type][i].DataField.Replace("DataSource", string.Empty), controls[type]) ) { lDsControls.Add(controls[type][i]); } } int cntFirstColumn = lDsControls.Count / 2; if ((lDsControls.Count % 2) > 0) cntFirstColumn++; for (int i = 0; i < cntFirstColumn; i++) { AddControl(lDsControls[i], controls[type]); if ((lDsControls.Count - 1) >= (i + cntFirstColumn)) AddControl(lDsControls[i + cntFirstColumn], controls[type]); } } PXDropDown edDataSourceAmountType = new PXDropDown() { ID = "edDataSourceAmountType", AllowNull = false, DataField = "DataSourceAmountType" }; form.TemplateContainer.Controls.AddAt(_insertIndex, edDataSourceAmountType); (edDataSourceAmountType).ApplyStyleSheetSkin(this.Page); _insertIndex++; PXCheckBox chkApplyRestrictionGroups = new PXCheckBox() { ID = "chkApplyRestrictionGroups", DataField = "ApplyRestrictionGroups" }; form.TemplateContainer.Controls.AddAt(_insertIndex, chkApplyRestrictionGroups); (chkApplyRestrictionGroups).ApplyStyleSheetSkin(this.Page); }