Man hours uses subtotal
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
# New App Checklist (Vite + Bun + PM2)
|
||||||
|
|
||||||
|
## 1) Local Repo Changes
|
||||||
|
- Add `serve` script:
|
||||||
|
- `"serve": "serve -s dist -l tcp://0.0.0.0:$PORT"`
|
||||||
|
- Add dependency:
|
||||||
|
- `serve` (run `bun add serve`)
|
||||||
|
|
||||||
|
## 2) CI Workflow
|
||||||
|
- Use the template file in `ci-template.yaml`.
|
||||||
|
- Replace placeholders:
|
||||||
|
- `<APP_NAME>`
|
||||||
|
- `<APP_PORT>`
|
||||||
|
- `<DEPLOY_PATH>`
|
||||||
|
|
||||||
|
## 3) Server One-Time Setup
|
||||||
|
- Create deploy directory:
|
||||||
|
- `mkdir -p <DEPLOY_PATH>`
|
||||||
|
- First PM2 start:
|
||||||
|
- `cd <DEPLOY_PATH>`
|
||||||
|
- `PORT=<APP_PORT> pm2 start "bun run serve" --name <APP_NAME>`
|
||||||
|
- `pm2 save`
|
||||||
|
|
||||||
|
## 4) Deploy + Restart (CI will do this)
|
||||||
|
- Files copied to server:
|
||||||
|
- `dist/`, `package.json`, `bun.lock` (or `bun.lockb`)
|
||||||
|
- On server:
|
||||||
|
- `bun install --production`
|
||||||
|
- `PORT=<APP_PORT> pm2 restart <APP_NAME> --update-env`
|
||||||
|
|
||||||
|
## 5) Verification
|
||||||
|
- PM2 process:
|
||||||
|
- `pm2 show <APP_NAME>`
|
||||||
|
- Port:
|
||||||
|
- `pm2 env <ID> | grep PORT`
|
||||||
|
- Bind:
|
||||||
|
- `pm2 logs <APP_NAME> --lines 20`
|
||||||
|
- Expect: `Accepting connections at http://0.0.0.0:<APP_PORT>`
|
||||||
|
- Files:
|
||||||
|
- `ls -la <DEPLOY_PATH>`
|
||||||
|
- `ls -la <DEPLOY_PATH>/dist | head -20`
|
||||||
|
- HTTP:
|
||||||
|
- `curl -I http://<SERVER_IP>:<APP_PORT>`
|
||||||
@@ -12,6 +12,10 @@ export interface ModifierModule {
|
|||||||
calculateDisplay?: (modifier: Modifier, subScopeTotalWithMarkup: number, subScopeItems: EstimateItem[]) => number;
|
calculateDisplay?: (modifier: Modifier, subScopeTotalWithMarkup: number, subScopeItems: EstimateItem[]) => number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPreMarkupSubtotal = (items: EstimateItem[]) => {
|
||||||
|
return items.reduce((sum, item) => sum + item.quantity * item.unitPrice, 0);
|
||||||
|
};
|
||||||
|
|
||||||
const TaxModule: ModifierModule = {
|
const TaxModule: ModifierModule = {
|
||||||
id: 'tax',
|
id: 'tax',
|
||||||
name: 'Tax',
|
name: 'Tax',
|
||||||
@@ -34,9 +38,11 @@ const ManHoursModule: ModifierModule = {
|
|||||||
defaultValueType: 'unit',
|
defaultValueType: 'unit',
|
||||||
defaultUnitLabel: 'factor',
|
defaultUnitLabel: 'factor',
|
||||||
calculate: () => 0,
|
calculate: () => 0,
|
||||||
calculateDisplay: (m, base) => {
|
calculateDisplay: (m, _, items) => {
|
||||||
const factor = m.value || 1;
|
const factor = m.value || 1;
|
||||||
return base / factor;
|
if (factor === 0) return 0;
|
||||||
|
const subtotal = getPreMarkupSubtotal(items);
|
||||||
|
return subtotal / factor;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user