sre

Tag datasource methods

public void delete()
{
super();
eamTag_ds.executeQuery();
}

public void create(boolean _append = false)
{
EmplTable emplTable;
SysCompanyUserInfo sysCompanyUserInfo;
Args args;
;
if(EAMBelowLevels::maxLevels() <=1)
normalLevelId.visible(false);

safety.visible(false);

args = new Args();
args.name(formstr(EAMTagCreate));
args.caller(this);
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();

eamTag_ds.executeQuery();
select firstonly emplTable join sysCompanyUserInfo
where sysCompanyUserInfo.EmplId == emplTable.EmplId &&
sysCompanyUserInfo.UserId==curuserid();

eamTag.Department=emplTable.eamMaintenanceSection;
}

public int active()
{
int ret;

EAMEquipmentSafety equipmentSafety;
EAMParameters eamParameters;

ret = super();

levelDisplay.text(EAMDisplayLevel::GetLevel(eamTag.Levelid));

if(eamTag.NextLevel==NoYes::No)
{

eamTag_EquipmentType.visible(true);

if(strltrim(strrtrim(eamEquipment.EquipmentType))!=’’)
{
eamEquipment_EAMTagEquipmentType.allowEdit(false);
eamTag_EquipmentType.allowEdit(false);
}
else
{
eamEquipment_EAMTagEquipmentType.allowEdit(true);
eamTag_EquipmentType.allowEdit(true);
}
if (strltrim(strrtrim(eamEquipment.EquipmentSubType)) != ‘’)
{
subtype.visible(true);
eamTag_EquipmentSubType.visible(false);
eamEquipment_EAMTagEquipmentSubType.allowEdit(false);
subtype.allowEdit(false);
}
else
{
subtype.visible(false);
eamTag_EquipmentSubType.visible(true);
eamEquipment_EAMTagEquipmentSubType.allowEdit(true);
eamTag_EquipmentSubType.allowEdit(true);
}
if (strltrim(strrtrim(eamEquipment.System)) != ‘’)
{
eamEquipment_System.allowEdit(false);
}
else
eamEquipment_System.allowEdit(true);
}
if (eamtag.Number)
{
eamTag_NextLevel1.enabled(false);
eamTag_NextLevel.enabled(false);
eamTag_TagNumber.allowEdit(false);
}
else
{
eamTag_NextLevel1.enabled(true);
eamTag_NextLevel.enabled(true);
eamTag_TagNumber.allowEdit(true);
}

if(eamTag.NextLevel==NoYes::Yes)
{
eamTag_EquipmentType.visible(false);
eamTag_EquipmentSubType.visible(false);
subtype.visible(false);
tagDetails.visible(false);
material.visible(false);
warranty.visible(false);
safety.visible(false);
components.visible(false);
designer.enabled(false);
categorise.visible(false);
paramters.enabled(false);
specifications.enabled(false);
eamEquipmentEvents.enabled(false);
meters.enabled(false);
historyFeedback.enabled(false);
eamEquipmentDrawings.enabled(false);
designer.enabled(false);
emergencyProcedure.enabled(false);
eamEquipmentInsurance.enabled(false);
eamEquipmentItems.enabled(false);
eamHypothecationTable.enabled(false);
eamEquipmentCriticality.enabled(false);
groupMaterial.visible(false);
eamEquipmentTaxation.enabled(false);
workRequestCreate.enabled(false);
meterValue.enabled(false);
time.enabled(false);
equipmentserial.enabled(false);
}
else
{
tagDetails.visible(true);
material.visible(false);
warranty.visible(true);
if(eamEquipment.SafetyRequired==NoYes::Yes)
{
select count(Number) from equipmentSafety
where equipmentSafety.Number==eamEquipment.Number;
if(str2int(equipmentSafety.Number)>0)
eamEquipment_SafetyRequired.allowEdit(false);
else
eamEquipment_SafetyRequired.allowEdit(true);

safety.visible(true);
}
else
{
eamEquipment_SafetyRequired.allowEdit(true);
safety.visible(false);
}

categorise.visible(true);
paramters.enabled(true);
specifications.enabled(true);
eamEquipmentEvents.enabled(true);
meters.enabled(true);
historyFeedback.enabled(true);
eamEquipmentDrawings.enabled(true);
designer.enabled(true);
emergencyProcedure.enabled(true);
eamEquipmentInsurance.enabled(true);
eamEquipmentItems.enabled(true);
components.visible(true);
eamHypothecationTable.enabled(true);
eamEquipmentCriticality.enabled(true);
groupMaterial.visible(true);
eamEquipmentTaxation.enabled(true);
workRequestCreate.enabled(true);
meterValue.enabled(true);
time.enabled(true);
equipmentserial.enabled(true);

}
if(strltrim(strrtrim(eamEquipment.Number))!=’’)
{
if(eamEquipment.SafetyRequired==NoYes::Yes)
{
if(eaMtag.NextLevel==NoYes::Yes)
safety.visible(false);
else
safety.visible(true);

}
else
safety.visible(false);

}

select firstonly eamParameters;
if(eamParameters.Criticality==NoYes::Yes)
{
if(eamTag.NextLevel==NoYes::No)
{
eamTagCriticality.visible(false);
eamEquipmentCriticality.visible(true);
}
else
{
eamTagCriticality.visible(true);
eamEquipmentCriticality.visible(false);
}
}
else
{
eamTagCriticality.visible(false);
eamEquipmentCriticality.visible(false);

}

return ret;

}