private void HideUnpaidTimeControls() { PXLabel unpaidTimeLabel = (PXLabel)tab.FindControl("PXUnpaidTimeLabel"); if (unpaidTimeLabel != null) { unpaidTimeLabel.Visible = false; } PXLayoutRule layoutRule = (PXLayoutRule)tab.FindControl("PXUnpaidTimeLayoutRule"); if (layoutRule != null) { layoutRule.StartColumn = false; } }
private void AddControl(PXFieldSchema control, List <PXFieldSchema> lRequestControls) { string id = control.DataField.Replace("DataSource", string.Empty); if (id.StartsWith("Usr", StringComparison.OrdinalIgnoreCase)) { id = id.Insert(3, "Request"); } else { id = "Request" + id; } if (ContainsControl(id, lRequestControls)) { WebControl newDsCtrl = this.CreateControlForField(control); (newDsCtrl).ApplyStyleSheetSkin(this.Page); PXLayoutRule ruleMerge = new PXLayoutRule() { ID = "rule" + Guid.NewGuid().ToString(), Merge = true }; (ruleMerge).ApplyStyleSheetSkin(this.Page); PXLayoutRule ruleEndMerge = new PXLayoutRule() { ID = "rule" + Guid.NewGuid().ToString() }; (ruleEndMerge).ApplyStyleSheetSkin(this.Page); WebControl newRequestCtrl = CreateControlForField(GetControl(id, lRequestControls)); (newRequestCtrl).ApplyStyleSheetSkin(this.Page); form.TemplateContainer.Controls.AddAt(_insertIndex, ruleMerge); _insertIndex++; form.TemplateContainer.Controls.AddAt(_insertIndex, newDsCtrl); _insertIndex++; form.TemplateContainer.Controls.AddAt(_insertIndex, newRequestCtrl); SetProperty(newRequestCtrl, "SuppressLabel", true); SetProperty(newRequestCtrl, "Size", "xs"); _insertIndex++; form.TemplateContainer.Controls.AddAt(_insertIndex, ruleEndMerge); _insertIndex++; } }
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); }
private void AddControl(PXFieldSchema control, List<PXFieldSchema> lRequestControls) { string id = control.DataField.Replace("DataSource", string.Empty); if (id.StartsWith("Usr", StringComparison.OrdinalIgnoreCase)) { id = id.Insert(3, "Request"); } else { id = "Request" + id; } if (ContainsControl(id, lRequestControls)) { WebControl newDsCtrl = this.CreateControlForField(control); (newDsCtrl).ApplyStyleSheetSkin(this.Page); PXLayoutRule ruleMerge = new PXLayoutRule() { ID = "rule" + Guid.NewGuid().ToString(), Merge = true }; (ruleMerge).ApplyStyleSheetSkin(this.Page); PXLayoutRule ruleEndMerge = new PXLayoutRule() { ID = "rule" + Guid.NewGuid().ToString() }; (ruleEndMerge).ApplyStyleSheetSkin(this.Page); WebControl newRequestCtrl = CreateControlForField(GetControl(id, lRequestControls)); (newRequestCtrl).ApplyStyleSheetSkin(this.Page); form.TemplateContainer.Controls.AddAt(_insertIndex, ruleMerge); _insertIndex++; form.TemplateContainer.Controls.AddAt(_insertIndex, newDsCtrl); _insertIndex++; form.TemplateContainer.Controls.AddAt(_insertIndex, newRequestCtrl); SetProperty(newRequestCtrl, "SuppressLabel", true); SetProperty(newRequestCtrl, "Size", "xs"); _insertIndex++; form.TemplateContainer.Controls.AddAt(_insertIndex, ruleEndMerge); _insertIndex++; } }