Info-Tech AUTO-CLAIM

Automate Infotech CloudHR expense claim submission with Microsoft login, Claim Template creation, and Add More Claims handling.

Github Project:
Chw41/Info-Tech-AUTO-CLAIM

This project provides:

  • A CLI workflow powered by Playwright.
  • A local Chromium-based UI launcher for non-technical users.
  • Filename-based parsing for claim category, receipt date, amount, remarks, attachment, and optional receipt number.

One-Click Launchers

For the local UI:

  • macOS: double-click MAC-Start.command.
  • Windows: double-click WINDOWS-Start.cmd.

Open Source Notice

Before publishing this repository, make sure you do not commit real company or personal data:

  • .env
  • .auth/
  • artifacts/
  • monthly claim folders such as 202604/
  • real receipt PDFs, screenshots, logs, or exported browser state
  • .DS_Store

The default .gitignore is configured to exclude these common local files, but you should still review the final git status before pushing.

Requirements

  • Node.js 18 or newer
  • npm
  • Playwright Chromium
  • A Microsoft account that can log in to the target Infotech CloudHR tenant

The setup scripts can install Node.js and Playwright Chromium on macOS and Windows.

Filename Format

Put claim files in a folder named with the claim period, for example 202604.

Each claim attachment should use this format:

[type]date-amount remarks#receipt-number.ext

Examples:

[TAXI]04:01-666 TEST conference.pdf
[TaXi] 04 : 01 - 666 TEST conference.pdf
[taxi]04_01-666 TEST conference.pdf
[taxi]0401-666 TEST conference.pdf
[grab]04-01-666 TEST conference.jpg
[mob]599.pdf
[health]04-15-217 health screening#R12345.pdf

Rules:

  • type: claim type token inside square brackets, such as [taxi].
  • date: supports MM-DD, MM:DD, MM/DD, MM_DD, or MMDD.
  • amount: integer or decimal, such as 666 or 666.50.
  • remarks: optional free text.
  • #receipt-number: optional for most categories. The script only fills Receipt No. when # exists in the filename.
  • CLOTHING ALLOWANCE and HEALTH SCREENING require Receipt No.; files in those categories must include #receipt-number before the extension.

Windows filenames cannot contain : or /. Use Windows-safe formats such as:

[taxi]04-19-127 airport.pdf
[health]04-15-217 health screening#R12345.pdf

Quick Start

macOS Command Line

Mac users can double-click MAC-Start.command.

If you prefer the command line:

cd ~/Info-Tech-AUTO-CLAIM
bash setup.sh
cp .env.example .env
npm run auto-claim -- 202604

Windows PowerShell

Windows users can double-click WINDOWS-Start.cmd.

If you prefer the command line:

cd .\Info-Tech-AUTO-CLAIM
powershell -ExecutionPolicy Bypass -File .\setup.ps1
Copy-Item .\.env.example .\.env
npm run auto-claim -- 202604

If PowerShell reports running scripts is disabled on this system, use the bypass command above or launch through WINDOWS-Start.cmd.

CLI Usage

Basic usage:

npm run auto-claim -- 202604

The folder argument can also be an absolute path:

npm run auto-claim -- /Users/you/Claims/202604

Supported options:

OptionDescription
--dry-runParse files only. Does not log in or submit claims. Writes artifacts/claim-run-preview.json.
--liveSubmit claims for real. Overrides DRY_RUN=true from .env.
--headfulShow the Chromium browser window. Useful for login and troubleshooting.
--headlessRun Chromium without a visible browser window.
--force-loginIgnore .auth/storage-state.json and perform Microsoft login again.
--reuse-sessionReuse .auth/storage-state.json when possible; login again if the session is invalid.

Examples:

# Parse filenames and category mapping only
npm run auto-claim -- 202604 --dry-run

# Run in the background and reuse an existing login session
npm run auto-claim -- 202604 --headless --reuse-session

# Show the browser and force a fresh login
npm run auto-claim -- 202604 --headful --force-login

Dry-run shortcut:

npm run auto-claim:dry-run -- 202604

Local UI

The UI is a local HTML page opened by Playwright Chromium. It lists claim folders, accepts login credentials for the run, streams CLI output, and shows run artifacts.

Start it directly:

node src/auto-claim-ui.js

Or use the platform launchers:

  • macOS: double-click MAC-Start.command
  • Windows: double-click WINDOWS-Start.cmd

The launchers check Node.js, npm dependencies, and Playwright Chromium before opening the UI.

What the Automation Does

For npm run auto-claim -- 202604, the script:

  1. Reads claim attachments from the 202604 folder.
  2. Parses category, date, amount, remarks, and optional receipt number from each filename.
  3. Builds the Claim Template Name, such as April 2026 CLAIM.
  4. Logs in to Infotech CloudHR through Microsoft authentication.
  5. Opens the Claim Apply page and creates a new claim.
  6. Fills Claim Group Name, Claim Name, Receipt Amount, Remarks, Claimable Amount, Attachment, Receipt Date, and Receipt No. when available.
  7. Saves each claim item and uses Add More Claims for the next item.

CloudHR performs server-side partial refreshes after Claim Template Name, Claim Group Name, and Claim Name changes. The script waits for the page to stop loading before it fills later fields.

Future receipt dates are automatically clamped to today to avoid CloudHR validation errors such as Receipt date must be less than or equal to the current date.

Output Files

Runtime files are written to artifacts/:

FilePurpose
claim-run-preview.jsonParsed dry-run or pre-submit claim data.
claim-run-result.jsonSummary after a successful submission.
claim-run-error.jsonFailure message, current URL, and stack trace.
claim-run-error.pngScreenshot captured at failure time.
claim-submission-final.pngFinal screenshot after successful completion.

Login state is saved in .auth/storage-state.json. Use --force-login if the saved session expires.

Claim Type Mapping

Use one of the filename tokens in the first column, for example [taxi]04-14-212.pdf.

Filename tokenClaim Group NameClaim Name
mob, mobile, phoneMOBILE PHONE REIMBURSEMENTMOBILE
clothing, cloth, allowance, cloalwCLOTHING ALLOWANCECLOTHIN
health, medical, screening, emphsHEALTH SCREENINGHEALTH SCREENING
hardware, hw, hardwaIT RELATEDHARDWARE
software, sw, softwa, it, itrelatedIT RELATEDSOFTWARE
mileage, miles, mile, carMILEAGE CLAIMCAR
motorcycle, motorbike, bike, mcycleMILEAGE CLAIMMOTOR CYCLE
courier, dispatch, couriedispatchMISCELLANEOUS CLAIMCOURIER / DISPATCH SERVICES
dinner, annualdinnerMISCELLANEOUS CLAIMANNUAL DINNER
lunch, fridaylunchMISCELLANEOUS CLAIMFRIDAY LUNCH
pantry, pantryitemsMISCELLANEOUS CLAIMPANTRY ITEMS
misc, miscellaneous, other, sundryMISCELLANEOUS CLAIMMISC - OTHER MISCELLANEOUS
marketing, mktg, ads, advertisingMARKETING COSTMARKETING COST
office, stationery, accessoriesOFFICE ACCESSORIESOFFICE ACCESSORIES
overseas, oversea, travelallowance, ota, taOVERSEAS TRAVEL ALLOWANCEOVERSEAS TRAVEL ALLOWANCE
airticket, air, flight, ticketOVERSEAS / BUSINESS TRAVEL CLAIMAIR TICKET
winterclothing, winterclothOVERSEAS / BUSINESS TRAVEL CLAIMWINTER CLOTHING
data, sim, simcard, dataplanOVERSEAS / BUSINESS TRAVEL CLAIMSIM CARD, DATA PLAN
ent, entertainment, overseasentertainmentOVERSEAS / BUSINESS TRAVEL CLAIMOVERSEAS ENTERTAINMENT
hotelOVERSEAS / BUSINESS TRAVEL CLAIMHOTEL
insure, insurance, travelins, travelinsuranceOVERSEAS / BUSINESS TRAVEL CLAIMTRAVEL INSURANCE
laundry, laundrOVERSEAS / BUSINESS TRAVEL CLAIMLAUNDRY
meal, meals, overseasmealOVERSEAS / BUSINESS TRAVEL CLAIMMEAL OVERSEAS
transport, overseastransport, transOVERSEAS / BUSINESS TRAVEL CLAIMTRANSPORT
visa, visaapplicationOVERSEAS / BUSINESS TRAVEL CLAIMVISA APPLICATION
parking, parkPARKINGPARKING
petrol, gasoline, fuel, gasGASOLINE / PETROLGASOLINE / PETROL
recruit, recruitment, hiringRECRUITMENT COSTRECRUITMENT COST
training, course, seminar, workshopTRAININGTRAINING
busTAXI / GRAB CLAIMBUS
cashcard, cash, cardTAXI / GRAB CLAIMCASH CARD
erp, erpchargesTAXI / GRAB CLAIMERP CHARGES
parkingcoupon, parkcoupon, couponTAXI / GRAB CLAIMPARKING COUPON
parkingcharges, parkingcharge, parkcharge, parkchargesTAXI / GRAB CLAIMPARKING CHARGES
taxi, grabTAXI / GRAB CLAIMTAXI
train, mrtTAXI / GRAB CLAIMTRAIN
welfare, benefitEMPLOYEE WELFAREEMPLOYEE WELFARE

Notes:

  • parking / park maps to the standalone PARKING category.
  • Taxi / Grab parking items should use parkingcoupon or parkingcharges.
  • it / itrelated maps to SOFTWARE by default. Use hardware for hardware claims.
  • If your tenant uses different CloudHR claim names, update CLAIM_RULES in src/auto-claim-upload.js.

Development Notes

This repository intentionally does not include automated tests yet. At minimum, verify filename parsing with --dry-run before any CloudHR submission.

Useful local checks:

node --check src/auto-claim-upload.js
node --check src/auto-claim-ui.js
npm run auto-claim -- 202604 --dry-run