Question

Problem with Adding new tab and grid to PMCostProjection

  • 2 November 2021
  • 0 replies
  • 189 views

Userlevel 7
Badge +8

I’m trying to add a tab to Cost Projection (PM.30.50.00) that will keep the details of changes for each Projection Line in the Details Tab. The Details DAC is “PMCostProjectionLine”. I have two problems:


1) The Revision Log grid is read only even though the Add/delete buttons are enabled, when I click on Add for example, it inserts a record to the grid, but it is read only, and I can not modify the record. I tried to override the system behaviour in all of row Inserting/Inserted/Selected events as follows but didn’t work.
cache.AllowSelect = true;
cache.AllowInsert = true;
cache.AllowUpdate = true;
cache.AllowDelete = true;
When I click on the primary form save, also the inserted record wont be saved.


2) I would like to push Task and Cost Code from the Details (PMCostProjectionLine) grid to Revision Log grid (PMCostProjectionRevisionLog) as default by using the “Current” but it doesn’t work. I do the same for document header (PMCostProjection) for Date and Description fields and it works. It seems the Revision Log grid doesn’t read the cache. Both of these tabs grids CommitChanges=true and Syncposition=true.

The funny part is if in the Details tab I click on a row and try to add a note for example, then hit the escape and go to Revision Log tab and add new record, it reads the correct defaults. Here is my GraphExt, DAC and Screen Shot from Cost Projection Screen.

using PX.Data;
using PX.Data.ReferentialIntegrity.Attributes;
using PX.Objects.PM;
using System;
using System.Windows.Forms;

namespace PX.Objects.CN.ProjectAccounting

{
public class CostProjectionEntry_Extension : PXGraphExtension
{
#region Event Handlers

protected void PMCostProjectionRevisionLog_RowInserting(PXCache cache, PXRowInsertingEventArgs e)
{
var logRow = e.Row as PMCostProjectionRevisionLog;
var lineRow = Base.Details.Current;
var docRow = Base.Document.Current;
if (logRow == null) return;
if (lineRow == null) return;
if (docRow == null) return;

logRow.LineNbr = lineRow.LineNbr;
logRow.ProjectID = lineRow.ProjectID;
logRow.RevisionID = docRow.RevisionID;
logRow.TaskID = lineRow.TaskID;
logRow.CostCodeID = lineRow.CostCodeID;
logRow.Date = docRow.Date;
logRow.Description = docRow.Description;
logRow.UnitCost = lineRow.Amount;
}

protected void PMCostProjectionRevisionLog_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
cache.AllowSelect = true;
cache.AllowInsert = true;
cache.AllowUpdate = true;
cache.AllowDelete = true;
}

public PXSelect RevisionLog;

public class PMCostProjectionRevisionLog : IBqlTable
{
#region LogNbr
[PXDBIdentity(IsKey = true)]
public virtual int? LogNbr { get; set; }
public abstract class logNbr : PX.Data.BQL.BqlInt.Field { }
#endregion

#region LineNbr
[PXDBInt]
[PXForeignReference(typeof(Field.IsRelatedTo))]
[PXParent(typeof(Select))]
public virtual int? LineNbr { get; set; }
public abstract class lineNbr : PX.Data.BQL.BqlInt.Field { }
#endregion

#region ProjectID
[ActiveProjectOrContractBase(Required = true)]
[PXForeignReference(typeof(Field.IsRelatedTo))]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Project")]
public virtual int? ProjectID { get; set; }
public abstract class projectID : PX.Data.BQL.BqlInt.Field { }
#endregion

#region RevisionID
[PXDBString(30, IsUnicode = true, InputMask = ">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")]
[PXUIField(DisplayName = "Revision", Required = true, Enabled = true, Visibility = PXUIVisibility.SelectorVisible)]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
[PXForeignReference(typeof(Field.IsRelatedTo))]
[PXSelector(typeof(Search), DescriptionField = typeof(PMCostProjection.description))]
[PXRestrictor(typeof(Where), "Revision does not exist for the selected project.")]
public virtual string RevisionID { get; set; }
public abstract class revisionID : PX.Data.BQL.BqlString.Field { }
#endregion

#region TaskID
[BaseProjectTaskAttribute(typeof(projectID), AllowInactive = false, AllowCanceled = false, AllowCompleted = false, Required = true)]
[PXForeignReference(typeof(Field.IsRelatedTo))]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Task")]
public virtual int? TaskID { get; set; }
public abstract class taskID : PX.Data.BQL.BqlInt.Field { }
#endregion

#region CostCodeID
[CostCode(null, typeof(taskID), AllowNullValue = false, Required = true)]
[PXForeignReference(typeof(Field.IsRelatedTo))]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Cost Code")]
public virtual int? CostCodeID { get; set; }
public abstract class costCodeID : PX.Data.BQL.BqlInt.Field { }
#endregion

#region Date
[PXDBDate]
[PXUIField(DisplayName = "Date", Required = true, Enabled = true)]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
//[PXDefault(typeof(AccessInfo.businessDate), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual DateTime? Date { get; set; }
public abstract class date : PX.Data.BQL.BqlDateTime.Field { }
#endregion

#region Description
[PXDBString(500, IsUnicode = true, InputMask = "")]
[PXUIField(DisplayName = "Description", Required = true, Enabled = true)]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual string Description { get; set; }
public abstract class description : PX.Data.BQL.BqlString.Field { }
#endregion

#region TotalCost
[PXDBDecimal()]
[PXUIField(DisplayName = "Total Cost", Required = true, Enabled = true)]
[PXDefault(typeof(Current), PersistingCheck = PXPersistingCheck.Nothing)]
public virtual Decimal? TotalCost { get; set; }
public abstract class totalCost : PX.Data.BQL.BqlDecimal.Field { }
#endregion
}
#endregion
}
}


0 replies

Be the first to reply!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved