FORMAT==100
SKIPCHECK;

#******************************************************
# Check if rules apply to this scenario
#******************************************************
[]=N:
  IF(ATTRS('Version', !Version, 'Link to Drivers') @= 'Y',
    CONTINUE,
    STET
  );

#********************************************
# Stets
#********************************************
['Actual']=STET;
['2006']=STET;
['2007']=STET;
['2008']=STET;
['2009']=STET;

#********************************************
# Monthly Salary
#********************************************
['Local','Monthly Salary']=N:
  IF(DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Department') @= !Department,
    IF((DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'StartMonth') @= ''
      % ATTRN('Period', DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'StartMonth'), 'Index')
      <= ATTRN('Period', !Period, 'Index'))
      &
      (DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'EndMonth') @= ''
      % ATTRN('Period', !Period, 'Index') <= ATTRN('Period',DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'EndMonth'),'Index')),
        DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Monthly Salary'),
        CONTINUE
    ),
  CONTINUE
  );

#********************************************
# FTE
#********************************************
['Local','FTE']=N:
  IF(DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Department') @= !Department,
    IF((DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'StartMonth') @= ''
      % ATTRN('Period', DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'StartMonth'), 'Index')
      <= ATTRN('Period', !Period, 'Index'))
      &
      (DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'EndMonth') @= ''
      % ATTRN('Period', !Period, 'Index') <= ATTRN('Period',DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'EndMonth'),'Index')),
        DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'FTE'),
        CONTINUE
    ),
  CONTINUE
  );

#********************************************
# Monthly Salary After Inc
#********************************************
['Local','Monthly Salary After Inc']=N:
  IF(DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'IncreaseMonth') @<> ''
  & (ATTRN('Period', !Period, 'Index')
  >= ATTRN('Period', DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'IncreaseMonth'), 'Index')),
    ['Monthly Salary']*(1+DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Increase %')),
    ['Monthly Salary']
  );

#********************************************
# Superannuation based off assumption cube
#********************************************
['Local','Superannuation', Region:{'HONG KONG','SINGAPORE'}]=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Superannuation %');

['Local','Superannuation']=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Superannuation %');

#********************************************
# Workcover based off assumption cube
#********************************************
['Local','Workcover', Region:{'HONG KONG','SINGAPORE'}]=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Workcover %');

['Local','Workcover']=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Workcover %');

#********************************************
# LSL based off assumption cube
#********************************************
['Local','LSL', Region:{'HONG KONG','SINGAPORE'}]=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'LSL %');

['Local','LSL']=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'LSL %');

#********************************************
# Payroll tax based off assumption cube
#********************************************
['Local','Payroll Tax', Region:{'HONG KONG','SINGAPORE'}]=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Payroll Tax %');

['Local','Payroll Tax']=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Payroll Tax %');

#********************************************
# Other based off assumption cube
#********************************************
['Local','Other', Region:{'HONG KONG','SINGAPORE'}]=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Other %');

['Local','Other']=N:
  ['Monthly Salary After Inc'] *
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Other %');

#********************************************
# Communication Costs based off assumption cube
#********************************************
['Local','Communication Costs', Region:{'HONG KONG','SINGAPORE'}]=N:
IF(['Monthly Salary After Inc'] <> 0,
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Comm Costs per Person'),
  STET
);

['Local','Communication Costs']=N:
IF(['Monthly Salary After Inc'] <> 0,
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Comm Costs per Person'),
  STET
);

#********************************************
# Motor Vehicle Costs based off assumption cube
#********************************************
['Local','Motor Vehicle Costs', Region:{'HONG KONG','SINGAPORE'}]=N:
IF(['Monthly Salary After Inc'] <> 0,
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Motor Vehicle Costs per Person'),
  STET
);

['Local','Motor Vehicle Costs']=N:
IF(['Monthly Salary After Inc'] <> 0,
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Motor Vehicle Costs per Person'),
  STET
);

#********************************************
# Staff Expenses based off assumption cube
#********************************************
['Local','Staff Expenses', Region:{'HONG KONG','SINGAPORE'}]=N:
IF(['Monthly Salary After Inc'] <> 0,
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  !Region,
  'Staff Expenses per Person'),
  STET
);

['Local','Staff Expenses']=N:
IF(['Monthly Salary After Inc'] <> 0,
  DB('LabourAssumptions',!Currency,!Version,!FiscalYear,
  DB('LabourExistingInputs',!Currency,!Version,!FiscalYear,!Region,!ExistingEmployees,'Position Grade'),
  ELPAR('Region', !Region, 1),
  'Staff Expenses per Person'),
  STET
);
