Export:
[ExtensionOf(classStr(PcModelVisitorExport))]
final class PCModelVisitorExport_Extension
{
public void visitStart(Common _record)
{
next visitStart(_record);
if (_record is EcoResAttribute)
{
if ( this.writeComponent() )
{
EcoResAttribute ecoResAttribute = _record;
this.writeFieldValueInt(ecoResAttribute, fieldId2name(ecoResAttribute.TableId, fieldNum(EcoResAttribute, NoPrint)), ecoResAttribute.NoPrint);
}
}
if (_record is PCPriceExpressionValue)
{
PCPriceExpressionValue priceExpressionValue = _record;
this.writeFieldValue(priceExpressionValue, fieldId2name(priceExpressionValue.TableId, fieldNum(PCPriceExpressionValue, SalesOptionId)), priceExpressionValue.SalesOptionId);
}
if (_record is PCPriceExpressionRule)
{
PCPriceExpressionRule priceExpressionRule = _record;
this.writeFieldValue(priceExpressionRule, fieldId2name(priceExpressionRule.TableId, fieldNum(PCPriceExpressionRule, SalesOptionId)), priceExpressionRule.SalesOptionId);
}
}
}
Import:
[ExtensionOf(classStr(PCImportComponentAttributeHandler))]
final class PCImportComponentAttributeHandler_Extension
{
protected void importData()
{
#define.NoPrint('NoPrint')
next importData();
ttsbegin;
attribute.Selectforupdate(true);
attribute.NoPrint = this.getIntFieldByName(#NoPrint);
attribute.update();
ttscommit;
}
}
[ExtensionOf(classStr(PCImportPriceExpressionRuleHandler))]
final class PCImportPriceExpressionRuleHandler_Extension
{
protected void importData()
{
#define.SalesOptionId('SalesOptionId')
next importData();
ttsbegin;
expressionRule.Selectforupdate(true);
expressionRule.SalesOptionId = this.getFieldByName(#SalesOptionId);
expressionRule.update();
ttscommit;
}
}
Wednesday, October 24, 2018
Time and attendance-Clock-in/out(punch clock) to filter the Indirect Activities based on the Resource group attached.
[ExtensionOf(formStr(JmgRegistration))]
final class JmgRegistration_Extension
{
public QueryBuildDataSource qbdsJmgIpcActivityIndirectactivity;
public container containerActivityId, conResourceGroup;
public void showIPC()
{
WrkCtrTable selectedWrkCtrTable;
WrkCtrResourceGroup wrkCtrResourceGroup;
next showIPC();
containerActivityId = conNull();
conResourceGroup = conNull();
//Filter the data based on the resource group
if (curWrkCtrId)
{
conResourceGroup += curWrkCtrId;
selectedWrkCtrTable = WrkCtrTable::find(curWrkCtrId);
//Checking for only resource groups but not resources in the WrkCtrTable.
if (selectedWrkCtrTable.IsIndividualResource == NoYes::No)
{
this.JmgIpcActivityIndirectactivityRange();
}
}
//Filter the data based on the production unit with no resource group
if(curProdUnitId && !curWrkCtrId)
{
//Fetching the list of resource group that are attached to a production unit.
while select wrkCtrId from wrkCtrResourceGroup
where wrkCtrResourceGroup.ProdUnitId == curProdUnitId
{
conResourceGroup += wrkCtrResourceGroup.WrkCtrId;
}
this.JmgIpcActivityIndirectactivityRange();
}
jmgJobTable_DS.executeQuery();
}
//Filter the form datasource JmgJobTable_ds based on the activityID list.
public void JmgIpcActivityIndirectactivityRange()
{
Query queryJmgIpResourceGroup, queryJmgIpActivity;
QueryBuildDataSource qbdsJmgIpResourceGroup, qbdsJmgIpActivity;
QueryBuildRange qbrJmgIpResourceGroup, qbrJmgIpActivity;
QueryRun qrJmgIpResourceGroup, qrJmgIpActivity;
WrkCtrResourceGroup wrkCtrResourceGroup;
JmgIpcActivity jmgIpActivity;
JmgIpActivityResourceGroup jmgIpResourceGroup;
//Query to fetch the list of activityID's with the resource groups attached.
queryJmgIpResourceGroup = new Query();
qbdsJmgIpResourceGroup = queryJmgIpResourceGroup.addDataSource(tableNum(JmgIpActivityResourceGroup));
qbdsJmgIpResourceGroup.addGroupByField(fieldNum(JmgIpActivityResourceGroup, Activity));
qbdsJmgIpResourceGroup.addGroupByField(fieldNum(JmgIpActivityResourceGroup, WrkCtrId));
qbrJmgIpResourceGroup = qbdsJmgIpResourceGroup.addRang e(fieldNum(JmgIpActivityResourceGroup, WrkCtrId));
qbrJmgIpResourceGroup.value(con2Str(conResourceGroup));
qbdsJmgIpActivity = qbdsJmgIpResourceGroup.addDataSource(tableNum(JmgIpcActivity));
qbdsJmgIpActivity.joinMode(JoinMode::ExistsJoin);
qbdsJmgIpActivity.addLink(fieldNum(JmgIpActivityResourceGroup, Activity),fieldNum(JmgIpcActivity, Activity));
qrJmgIpResourceGroup = new QueryRun(queryJmgIpResourceGroup);
while (qrJmgIpResourceGroup.next())
{
jmgIpResourceGroup = qrJmgIpResourceGroup.get(tableNum(JmgIpActivityResourceGroup));
containerActivityId += jmgIpResourceGroup.Activity;
}
//Query to fetch the list of activityID's without the resource group
queryJmgIpActivity = new Query();
qbdsJmgIpActivity = queryJmgIpActivity.addDataSource(tableNum(JmgIpcActivity));
qbdsJmgIpResourceGroup = qbdsJmgIpActivity.addDataSource(tableNum(JmgIpActivityResourceGroup));
qbdsJmgIpResourceGroup.joinMode(JoinMode::NoExistsJoin);
qbdsJmgIpResourceGroup.addLink(fieldNum(JmgIpcActivity, Activity),fieldNum(JmgIpActivityResourceGroup, Activity));
qrJmgIpActivity = new QueryRun(queryJmgIpActivity);
while (qrJmgIpActivity.next())
{
jmgIpActivity = qrJmgIpActivity.get(tableNum(JmgIpcActivity));
containerActivityId += jmgIpActivity.Activity;
}
//Final query to filter the data in the JmgJobTable_ds based on the activityID list.
qbdsJmgIpcActivityIndirectactivity = qbdsJmgJobTable.addDataSource(tableNum(JmgIpcActivity));
qbdsJmgIpcActivityIndirectactivity.joinMode(JoinMode::ExistsJoin);
qbdsJmgIpcActivityIndirectactivity.addLink(fieldNum(JmgJobTable, JobId),fieldNum(JmgIpcActivity, JobId));
qbdsJmgIpcActivityIndirectactivity.addRange(fieldNum(JmgIpcActivity, Activity)).value(con2Str(containerActivityId));
}
public void removeJmgIpcActivityIndirectactivityRange()
{
if (qbdsJmgIpcActivityIndirectactivity)
{
qbdsJmgIpcActivityIndirectactivity.enabled(false);
}
}
}
// To remove the newly build query when standard query being executed and thus making the datasource to work based on the standard behaviour.
class JmgRegistrationsEventHandlers
{
[PreHandlerFor(formStr(JmgRegistration), formMethodStr(JmgRegistration, showProductionJobs))]
public static void JmgRegistration_Pre_showProductionJobs(XppPrePostArgs args)
{
FormRun jmgRegistration = args.getThis();
jmgRegistration.removeJmgIpcActivityIndirectactivityRange();
}
[PreHandlerFor(formStr(JmgRegistration), formMethodStr(JmgRegistration, showProject))]
public static void JmgRegistration_Pre_showProject(XppPrePostArgs args)
{
FormRun jmgRegistration = args.getThis();
jmgRegistration.removeJmgIpcActivityIndirectactivityRange();
}
[PreHandlerFor(formStr(JmgRegistration), formMethodStr(JmgRegistration, showIPC))]
public static void JmgRegistration_Pre_showIPC(XppPrePostArgs args)
{
FormRun jmgRegistration = args.getThis();
jmgRegistration.removeJmgIpcActivityIndirectactivityRange();
}
}
final class JmgRegistration_Extension
{
public QueryBuildDataSource qbdsJmgIpcActivityIndirectactivity;
public container containerActivityId, conResourceGroup;
public void showIPC()
{
WrkCtrTable selectedWrkCtrTable;
WrkCtrResourceGroup wrkCtrResourceGroup;
next showIPC();
containerActivityId = conNull();
conResourceGroup = conNull();
//Filter the data based on the resource group
if (curWrkCtrId)
{
conResourceGroup += curWrkCtrId;
selectedWrkCtrTable = WrkCtrTable::find(curWrkCtrId);
//Checking for only resource groups but not resources in the WrkCtrTable.
if (selectedWrkCtrTable.IsIndividualResource == NoYes::No)
{
this.JmgIpcActivityIndirectactivityRange();
}
}
//Filter the data based on the production unit with no resource group
if(curProdUnitId && !curWrkCtrId)
{
//Fetching the list of resource group that are attached to a production unit.
while select wrkCtrId from wrkCtrResourceGroup
where wrkCtrResourceGroup.ProdUnitId == curProdUnitId
{
conResourceGroup += wrkCtrResourceGroup.WrkCtrId;
}
this.JmgIpcActivityIndirectactivityRange();
}
jmgJobTable_DS.executeQuery();
}
//Filter the form datasource JmgJobTable_ds based on the activityID list.
public void JmgIpcActivityIndirectactivityRange()
{
Query queryJmgIpResourceGroup, queryJmgIpActivity;
QueryBuildDataSource qbdsJmgIpResourceGroup, qbdsJmgIpActivity;
QueryBuildRange qbrJmgIpResourceGroup, qbrJmgIpActivity;
QueryRun qrJmgIpResourceGroup, qrJmgIpActivity;
WrkCtrResourceGroup wrkCtrResourceGroup;
JmgIpcActivity jmgIpActivity;
JmgIpActivityResourceGroup jmgIpResourceGroup;
//Query to fetch the list of activityID's with the resource groups attached.
queryJmgIpResourceGroup = new Query();
qbdsJmgIpResourceGroup = queryJmgIpResourceGroup.addDataSource(tableNum(JmgIpActivityResourceGroup));
qbdsJmgIpResourceGroup.addGroupByField(fieldNum(JmgIpActivityResourceGroup, Activity));
qbdsJmgIpResourceGroup.addGroupByField(fieldNum(JmgIpActivityResourceGroup, WrkCtrId));
qbrJmgIpResourceGroup = qbdsJmgIpResourceGroup.addRang e(fieldNum(JmgIpActivityResourceGroup, WrkCtrId));
qbrJmgIpResourceGroup.value(con2Str(conResourceGroup));
qbdsJmgIpActivity = qbdsJmgIpResourceGroup.addDataSource(tableNum(JmgIpcActivity));
qbdsJmgIpActivity.joinMode(JoinMode::ExistsJoin);
qbdsJmgIpActivity.addLink(fieldNum(JmgIpActivityResourceGroup, Activity),fieldNum(JmgIpcActivity, Activity));
qrJmgIpResourceGroup = new QueryRun(queryJmgIpResourceGroup);
while (qrJmgIpResourceGroup.next())
{
jmgIpResourceGroup = qrJmgIpResourceGroup.get(tableNum(JmgIpActivityResourceGroup));
containerActivityId += jmgIpResourceGroup.Activity;
}
//Query to fetch the list of activityID's without the resource group
queryJmgIpActivity = new Query();
qbdsJmgIpActivity = queryJmgIpActivity.addDataSource(tableNum(JmgIpcActivity));
qbdsJmgIpResourceGroup = qbdsJmgIpActivity.addDataSource(tableNum(JmgIpActivityResourceGroup));
qbdsJmgIpResourceGroup.joinMode(JoinMode::NoExistsJoin);
qbdsJmgIpResourceGroup.addLink(fieldNum(JmgIpcActivity, Activity),fieldNum(JmgIpActivityResourceGroup, Activity));
qrJmgIpActivity = new QueryRun(queryJmgIpActivity);
while (qrJmgIpActivity.next())
{
jmgIpActivity = qrJmgIpActivity.get(tableNum(JmgIpcActivity));
containerActivityId += jmgIpActivity.Activity;
}
//Final query to filter the data in the JmgJobTable_ds based on the activityID list.
qbdsJmgIpcActivityIndirectactivity = qbdsJmgJobTable.addDataSource(tableNum(JmgIpcActivity));
qbdsJmgIpcActivityIndirectactivity.joinMode(JoinMode::ExistsJoin);
qbdsJmgIpcActivityIndirectactivity.addLink(fieldNum(JmgJobTable, JobId),fieldNum(JmgIpcActivity, JobId));
qbdsJmgIpcActivityIndirectactivity.addRange(fieldNum(JmgIpcActivity, Activity)).value(con2Str(containerActivityId));
}
public void removeJmgIpcActivityIndirectactivityRange()
{
if (qbdsJmgIpcActivityIndirectactivity)
{
qbdsJmgIpcActivityIndirectactivity.enabled(false);
}
}
}
// To remove the newly build query when standard query being executed and thus making the datasource to work based on the standard behaviour.
class JmgRegistrationsEventHandlers
{
[PreHandlerFor(formStr(JmgRegistration), formMethodStr(JmgRegistration, showProductionJobs))]
public static void JmgRegistration_Pre_showProductionJobs(XppPrePostArgs args)
{
FormRun jmgRegistration = args.getThis();
jmgRegistration.removeJmgIpcActivityIndirectactivityRange();
}
[PreHandlerFor(formStr(JmgRegistration), formMethodStr(JmgRegistration, showProject))]
public static void JmgRegistration_Pre_showProject(XppPrePostArgs args)
{
FormRun jmgRegistration = args.getThis();
jmgRegistration.removeJmgIpcActivityIndirectactivityRange();
}
[PreHandlerFor(formStr(JmgRegistration), formMethodStr(JmgRegistration, showIPC))]
public static void JmgRegistration_Pre_showIPC(XppPrePostArgs args)
{
FormRun jmgRegistration = args.getThis();
jmgRegistration.removeJmgIpcActivityIndirectactivityRange();
}
}
Subscribe to:
Posts (Atom)