| Server IP : 216.92.14.13 / Your IP : 216.73.217.126 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/home/rmlac2fmr/ |
Upload File : |
import json
from datetime import datetime
db = json.load(open("/home/rmlac2fmr/public_html/jn.com/ops/data/db.json"))
now = datetime.now().isoformat()
ts = str(int(datetime.now().timestamp() * 1000))
names = [("guerrero", "david"), ("scears", "gary")]
created = 0
for last, first in names:
person = next((p for p in db["persons"] if last in p.get("lastName","").lower() and first in p.get("firstName","").lower()), None)
if not person:
print(f" Person not found: {first} {last}")
continue
pid = person["id"]
name = f"{person.get('firstName','')} {person.get('lastName','')}"
# Check if TR already exists
existing_tr = next((r for r in db["travelRequests"] if r.get("personId") == pid and r.get("showId") == "S3"), None)
if existing_tr:
print(f" {name}: already has ACF TR ({existing_tr['id']}) — skipping")
continue
# Create TR
tr_id = f"R{ts}{pid[-4:]}"
tr = {
"id": tr_id,
"personId": pid,
"showId": "S3",
"submittedName": name,
"firstName": person.get("firstName",""),
"lastName": person.get("lastName",""),
"travelMethod": "local",
"status": "purchased",
"depDate": "",
"retDate": "",
"submittedDate": now[:10],
"source": "manual",
"bookingDetails": {},
"checklist": {},
}
db["travelRequests"].append(tr)
# Create PD record
pd_id = f"PD{tr_id}"
# Find their hotel booking for dates
hb = next((h for h in db["hotelBookings"] if h.get("personId") == pid and h.get("showId") == "S3"), None)
pd = {
"id": pd_id,
"reqId": tr_id,
"showId": "S3",
"personId": pid,
"checkIn": hb.get("checkIn","") if hb else "",
"checkOut": hb.get("checkOut","") if hb else "",
"autoDays": 0,
"autoRate": 50,
"manualDays": None,
"manualRate": None,
"delivery": "Through Payroll",
"eligible": True,
}
db["perDiems"].append(pd)
# Create assignment if not exists
existing_assign = next((a for a in db["assignments"] if a.get("personId") == pid and a.get("showId") == "S3"), None)
if not existing_assign:
db["assignments"].append({"personId": pid, "showId": "S3"})
print(f" {name}: created TR ({tr_id}), PD ({pd_id}), assignment")
created += 1
print(f"\nCreated {created} TR+PD records")
json.dump(db, open("/home/rmlac2fmr/public_html/jn.com/ops/data/db.json", "w"), indent=2)
print("Done!")