@ bsuite/ 充电- calc
用于澳大利亚GTO和劳动力雇用经营者的共享电荷率计算和BOOT评估引擎.
用于 风险管理7 (收费率建模)和 第80.3号公路 (公谊协委会授予工资比较).
特征
| 能力 | 入境点 | 主要出口 |
|---|---|---|
| 费率计算 | @bsuite/charge-calc | calculateChargeRate, (中文(简体) ), buildCalcConfig |
| 账单回收 | @bsuite/charge-calc | calculateBilling, (中文(简体) ), calculateRecovery |
| FWC 取景奖 | @bsuite/charge-calc/awards | AwardRegistry, (中文(简体) ), fetchAward, (中文(简体) ), AwardScheduleZ |
| BOOT 评估引擎 | @bsuite/charge-calc/boot | compareBOOT, (中文(简体) ), compareGTOBOOT, (中文(简体) ), detectFailurePatterns, (中文(简体) ), generateRecommendations, (中文(简体) ), generateF17Data |
| 共享类型 | @bsuite/charge-calc/types | 所有 Zod 策略和类型脚本 |
安装
pnpm add @bsuite/charge-calc
要求数 zod ^4.0.0 作为同伴的依赖.
费率计算
import { calculateChargeRate, buildCalcConfig } from '@bsuite/charge-calc';
const config = buildCalcConfig({
baseHourlyRate: 28.50,
casualLoading: 0.25,
superRate: 0.12,
workersCompRate: 0.021,
publicLiabilityRate: 0.005,
margin: 0.18,
});
const result = calculateChargeRate(config);
// result.chargeRate — all-up hourly charge rate
// result.breakdown — itemised cost components
命名的付费项目组ID
calculate() 接受CRM7自有软件 pay_item_groups.id 价值观使消费者能够
键速率,由命名的付费项目组 UUID 而不是类似 enum 字符串。 遗产
键在迁移时仍然可用.
import { calculate, DEFAULT_CONFIG } from '@bsuite/charge-calc';
const ordinaryPayItemGroupId = crm7PayItemGroups.ordinary.id;
const overtimePayItemGroupId = crm7PayItemGroups.overtime15.id;
const result = calculate({
...DEFAULT_CONFIG,
ordinaryPayItemGroup: {
id: ordinaryPayItemGroupId,
name: 'Ordinary Time',
code: 'ORD',
category: 'ordinary_time',
sortPriority: 10,
},
penalties: DEFAULT_CONFIG.penalties.map((penalty) =>
penalty.id === 'ot15'
? {
...penalty,
payItemGroup: {
id: overtimePayItemGroupId,
name: 'Overtime 1.5x',
code: 'OT1.5',
category: 'overtime_1_5',
sortPriority: 20,
},
}
: penalty,
),
});
result.rates[ordinaryPayItemGroupId]; // canonical named-group lookup
result.rates['ord']; // legacy compatibility alias
result.ratesByPayItemGroupId[overtimePayItemGroupId];
BOOT 评估引擎
BOOT( 更好的全面测试) 引擎执行在 2009年《公平工作法》第193和193A条 由公平工作委员会批准企业协议.
法律免责声明:引擎仅是一个决策支持工具. 它不构成法律咨询。 每一个结果都带着
humanReviewRequired: true并且必须在依赖之前由合格的劳资关系专业人员审查。 见F17_DISCLAIMER全文.
建筑
src/boot/
├── types.ts — Zod schemas: EATerms, AwardSchedule, RosterScenario, BOOTResult, GTOBOOTResult
├── compare.ts — compareBOOT() — core BOOT comparator (ss.193A algorithm)
├── annual-value.ts — computeAnnualEmployeeValue() — monetary value per scenario
├── non-monetary.ts — compareNonMonetary() — span, rostering, leave entitlements
├── failure-detector.ts — detectFailurePatterns() — 8 known EA failure pattern codes
├── recommender.ts — generateRecommendations() — prioritised remediation steps
├── f17-export.ts — generateF17Data() — structured JSON for FWC Form F17
└── gto.ts — compareGTOBOOT() — multi-placement GTO variant (s.193)
核心参照系统
import { compareBOOT } from '@bsuite/charge-calc/boot';
import type { AwardSchedule, EATerms, RosterScenario } from '@bsuite/charge-calc/boot';
const result = compareBOOT(
[awardSchedule], // AwardSchedule[] — modern award classification data
eaTerms, // EATerms — enterprise agreement to assess
[typicalScenario, worstCaseScenario], // RosterScenario[]
{ marginalThreshold: 0.05 }, // optional MarginalConfig
);
// result.overallVerdict — 'pass' | 'fail' | 'marginal' | 'indeterminate'
// result.classResults — per-classification breakdown with scenario-level detail
// result.warnings — critical / warning / info diagnostics
// result.humanReviewRequired — always true (legally mandated)
判决规则:
pass——所有情况下的EA年值 裁决额,超过边际阈值(违约5%)marginal- EA通过但不超过5%的门槛值——建议调节条款fail——任何情况下EA年度价值 < 裁决indeterminate——缺少授标分类数据
失败模式检测器
import { detectFailurePatterns } from '@bsuite/charge-calc/boot';
const patterns = detectFailurePatterns(bootResult, awards, ea, scenarios);
// patterns[].code — one of 8 known failure codes:
// 'higher_base_no_penalties' | 'loaded_rate_insufficient' | 'casual_overlooked'
// 'allowances_absorbed_unproven' | 'award_entitlements_omitted' | 'stale_modelling'
// 'vague_all_inclusive' | 'non_monetary_offset_claimed'
建议者
import { generateRecommendations } from '@bsuite/charge-calc/boot';
const recs = generateRecommendations(bootResult, patterns);
// Sorted by priority: critical → high → medium → low
// recs[].action — human-readable action description
// recs[].estimatedCost — dollar amount where calculable
FWC 表格F17出口
生成结构化的JSON数据,与FWC的F17比较电子表格格式相匹配,准备由演示文稿层进行PDF/XLSX渲染.
import { generateF17Data } from '@bsuite/charge-calc/boot';
const f17 = generateF17Data(bootResult, ea, 'IR Consultant Name');
// f17.header — agreement metadata + mandatory disclaimer
// f17.classifications — per-classification sheets with scenario matrix
// f17.scenarioMatrix — rows × columns overview grid
// f17.summary — pass/fail/marginal counts + totalDelta
// f17.qualitativeAssessment — non-monetary terms and notes
GTO 多位变量
由多个雇主主办的学徒集体培训组织。 第193条, 每个职位都必须通过 脚.
import { compareGTOBOOT } from '@bsuite/charge-calc/boot';
const gtoResult = compareGTOBOOT(
{
apprenticeId: 'abn-12345',
currentYear: 2,
placements: [
{
hostEmployerId: 'host-a',
hostEmployerName: 'Acme Manufacturing',
applicableAwards: [awardSchedule],
scenarios: [typicalScenario],
timeAllocation: 0.6, // 60% of year at this host
},
{
hostEmployerId: 'host-b',
hostEmployerName: 'Beta Logistics',
applicableAwards: [awardSchedule],
scenarios: [typicalScenario],
timeAllocation: 0.4,
},
],
},
ea,
);
// gtoResult.overallVerdict — fails if ANY placement fails
// gtoResult.weakestPlacement — placement with worst delta
// gtoResult.weightedAggregateDelta — Σ(delta × timeAllocation)
测试覆盖率
在节点24上进行639个测试,TypeScript 6.0,Vite 8.
| 套间 | 文件 |
|---|---|
| 核心计算 | src/__tests__/calculate.test.ts |
| 计费 | src/__tests__/billing.test.ts |
| 公用事业 | src/__tests__/utils.test.ts |
| 类型 | src/__tests__/types.test.ts |
| 一体化(第一阶段) | src/__tests__/integration.test.ts |
| 一体化(第二阶段) | src/__tests__/integration-phase2.test.ts |
| 黄金案件 | src/__tests__/golden.test.ts |
| 变化因素 | src/__tests__/invariants.test.ts |
| BOOT——核心项目 | src/__tests__/boot/compare.test.ts |
| BOOT——年度价值 | src/__tests__/boot/annual-value.test.ts |
| BOOT-故障探测器 | src/__tests__/boot/failure-detector.test.ts |
| BOOT——建议者 | src/__tests__/boot/recommender.test.ts |
| BOOT — F17 导出 | src/__tests__/boot/f17-export.test.ts |
| BOTO — GTO (英语) | src/__tests__/boot/gto.test.ts |
| BOOT——类型 | src/__tests__/boot/types.test.ts |
| BOOT——黄金案件 | src/__tests__/boot/golden-boot.test.ts |
| BOOT——变化无常 | src/__tests__/boot/invariants-boot.test.ts |
pnpm test # run all tests
pnpm test:coverage # generate coverage report
软件包出口
{
".": "dist/index.js", // charge-rate calc + billing + awards + boot
"./types": "dist/types.js", // shared types only
"./awards": "dist/awards/index.js", // FWC award registry
"./boot": "dist/boot/index.js" // BOOT assessment engine
}
构建
pnpm build # tsc -p tsconfig.build.json → dist/
pnpm typecheck # type-check only, no emit
捐款
修改此软件包时: 建出 + 凸起版本 package.json 将软件包释放的 PR 合并到 main 这样 .github/workflows/publish-charge-calc.yml 通过 npm 信任出版商出版(GitHub Actions OIDC, no) NPM_TOKEN• 更新消费者资料 package.json 文件 – 每页重生成锁文件 锁定文件生成 规则在CLAUDE.MD.