26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
|
|
import os, requests, pathlib
|
||
|
|
for line in pathlib.Path(r'C:\Users\SJ\.minimax-agent\projects\Workflow\.env.local').read_text().splitlines():
|
||
|
|
if line.strip() and '=' in line and not line.startswith('#'):
|
||
|
|
k, v = line.split('=', 1)
|
||
|
|
os.environ.setdefault(k.strip(), v.strip())
|
||
|
|
token = os.environ['PB_TOKEN']
|
||
|
|
h = {'Authorization': f'Bearer {token}'}
|
||
|
|
r = requests.get('https://pb.agent.apphub.co.za/api/collections/ysterbaard_SARS_EMP201_PAYE/records', headers=h, params={'perPage': 50}, timeout=15)
|
||
|
|
r.raise_for_status()
|
||
|
|
items = r.json()['items']
|
||
|
|
print(f'Total rows: {len(items)}')
|
||
|
|
print()
|
||
|
|
for it in items:
|
||
|
|
name = it.get('company_period_key', '?')
|
||
|
|
filed = it.get('Return_Filed')
|
||
|
|
paye = it.get('paye_amount')
|
||
|
|
sdl = it.get('sdl_amount')
|
||
|
|
uif = it.get('uif_amount')
|
||
|
|
total = it.get('total_payable')
|
||
|
|
ref = it.get('payment_reference')
|
||
|
|
status = it.get('status')
|
||
|
|
updated = it.get('last_updated')
|
||
|
|
print(f'{name:40} Return_Filed={filed} status={status:10} '
|
||
|
|
f'paye={paye:>10} sdl={sdl:>6} uif={uif:>8} total={total:>10}')
|
||
|
|
print(f'{"":40} payment_ref={ref} last_updated={updated}')
|