機械翻訳について

個別報酬プロセスのビジネス・ルールの構成

次に、デフォルト・ルールと複数の検証ルールの例を示します。

次の四半期の1日より後に従業員のみが報奨を作成できるように「時期」の日付をデフォルト設定します

拡張式

let effectiveDate = new Date();
let currentQuarter = Math.floor((effectiveDate.getMonth() + 3) / 3);
 
// Get first date of current quarter
effectiveDate.setDate(1);
effectiveDate.setMonth((currentQuarter - 1) * 3);
 
// Use this technique for year rollover
effectiveDate.setMonth(effectiveDate.getMonth() + 3);
return effectiveDate.toISOString().slice(0, 10);

現在の会計年度(4月1日から3月31日)になるように「時期」の日付を検証します

拡張式

let effectiveDate = $fields.individualCompensationDetails.EffectiveDate.$value();
if (effectiveDate) {
  // Fetch current financial year start date
  let currentDate = new Date();
  let fyStartDate = null, fyEndDate = null;
  if (currentDate.getMonth() + 1 <= 3) {
    fyStartDate = new Date(currentDate.getFullYear() - 1, 3, 1);
    fyEndDate = new Date(currentDate.getFullYear(), 2, 31);
  } else {
    fyStartDate = new Date(currentDate.getFullYear(), 3, 1);;
    fyEndDate = new Date(currentDate.getFullYear() + 1, 2, 31);
  }
  return (new Date(effectiveDate) < fyStartDate || new Date(effectiveDate) > fyEndDate);
}
return false;

新規採用賞与が$3000を超えないことを検証します

拡張式

if ($fields.individualCompensationDetails.PlanId.$value() === '100000018708168'
  && Number($fields.individualCompensationDetails.ValueString.$value()) > 3000) {
  return true;
}
     
return false;

車両手当増加が10%以下であることを検証します

拡張式

if ($fields.individualCompensationDetails.ComponentId.$numberValue() === 300100010424490
  && $fields.individualCompensationDetails.Mode.$initialValue() === 'EDIT') {
  let proposedValue = Number($fields.individualCompensationDetails.ValueString.$value());
  let currentValue = Number($fields.individualCompensationDetails.ValueString.$initialValue());
 
  if (proposedValue > (1.1 * currentValue))
    return true;
}
 
return false;

この例では、ModeのinitialValueを使用して、有効日更新シナリオを処理します。

有効日更新の場合、新しいレコードは新しく生成された分割であるため、モードは「CREATE」になります。

月の17日以前に開始する新規交付の検証

拡張式

if ($fields.individualCompensationDetails.Mode.$value() == 'CREATE'
  && $fields.individualCompensationDetails.EffectiveStartDate.$value()) {
 
  let planSD = new Date($fields.individualCompensationDetails.EffectiveStartDate.$value());
  return (planSD.getDate() > 17)
}
return false;

報奨提示が一度に1つのみ送信されることを検証します

拡張式

let currentAllocations = $fields.individualCompensationDetails.CurrentAllocations.$value();
if (currentAllocations && currentAllocations.length) {
  let newAllocationCount = 0;
 
  for (let allocation of currentAllocations) {
    if (allocation.Mode == 'CREATE')
      newAllocationCount++;
  }
 
  if(newAllocationCount > 1)
    return true;
}
return false;

バスとタクシーの払戻が一緒に請求されていないことを検証します

拡張式

let currentAllocations = $fields.individualCompensationDetails.CurrentAllocations.$value();
if (currentAllocations && currentAllocations.length) {
  let busBonusPresent = false;
  let taxiBonusPresent = false;
 
  for (let allocation of currentAllocations) {
    if (allocation.PlanId == '300100113565911')
      busBonusPresent = true;
 
    else if (allocation.PlanId == '300100113565893')
      taxiBonusPresent = true;
  }
 
  return (busBonusPresent && taxiBonusPresent);
}
return false;

ボーナスが6か月に1回のみ割り当てられていることの検証

if ($fields.individualCompensationDetails.PlanId.$numberValue() === 300100090079227
    && $fields.individualCompensationDetails.Mode.$value() === 'CREATE') {
    let startDate = new Date($fields.individualCompensationDetails.EffectiveStartDate.$value());
    let minusSixMonth = new Date(startDate.getFullYear(), startDate.getMonth() - 6, startDate.getDay());
    minusSixMonth = minusSixMonth.toISOString().slice(0, 10);
 
    let priorAllocations = $fields.individualCompensationDetails.PriorAllocations.$value();
    if (priorAllocations?.length) {
        let priorSpotBonus = priorAllocations.find(record => record.PlanId == '300100004468561');
        if (priorSpotBonus?.EffectiveStartDate > minusSixMonth) {
            return true;
        }
    }
}
return false;