A Forms tab on each person fills in TM.7, STM.2, STM.9, STM.11 and STM.1 for an extension of stay, TM.47 for a 90-day report and TM.8 for a re-entry permit. The Bureau's blank pages (forms/, with their sources and checksums) go unchanged into a new PDF, and the values are written on the dotted lines in Sarabun; boxes are ticked and the title circled where a form asks. scripts/gen_layout.py measures the blanks into src/papers/layout.rs. The tab says what would stay blank and links to where it is added. What only the application says (the date, the office, the reason, the days, a trip) is carried in the links and never stored. The extension's five forms also come in one PDF. Opening or downloading a form is audited as entity "form" with the forms' codes, never their values. Migration 0005 adds what STM.1 and STM.11 ask of the company (capital, revenue, equity, staff, a coordinator), a work permit's salary and contract dates, and where an arrival came from. The Nix package now takes forms/.
32 lines
1.4 KiB
SQL
32 lines
1.4 KiB
SQL
-- Phase 5, the filled-in forms: what STM.1 (the employer's certificate)
|
|
-- asks of the company and of the employment, the coordinator STM.11 names,
|
|
-- where an arrival came from (TM.7), and the audit entity "form" for a
|
|
-- filled-in form opened or downloaded. Amounts are whole baht.
|
|
|
|
ALTER TABLE companies
|
|
ADD COLUMN capital_thb BIGINT CHECK (capital_thb >= 0),
|
|
ADD COLUMN paid_up_thb BIGINT CHECK (paid_up_thb >= 0),
|
|
ADD COLUMN figures_year INTEGER CHECK (figures_year BETWEEN 1900 AND 2100),
|
|
ADD COLUMN revenue_thb BIGINT CHECK (revenue_thb >= 0),
|
|
ADD COLUMN equity_thb BIGINT,
|
|
ADD COLUMN foreign_costs_thb BIGINT CHECK (foreign_costs_thb >= 0),
|
|
ADD COLUMN thai_staff INTEGER CHECK (thai_staff >= 0),
|
|
ADD COLUMN foreign_staff INTEGER CHECK (foreign_staff >= 0),
|
|
ADD COLUMN coordinator TEXT NOT NULL DEFAULT '',
|
|
ADD COLUMN coordinator_phone TEXT NOT NULL DEFAULT '';
|
|
|
|
ALTER TABLE work_permits
|
|
ADD COLUMN monthly_salary_thb INTEGER CHECK (monthly_salary_thb >= 0),
|
|
ADD COLUMN contract_from DATE,
|
|
ADD COLUMN contract_until DATE;
|
|
|
|
ALTER TABLE arrivals ADD COLUMN came_from TEXT NOT NULL DEFAULT '';
|
|
|
|
ALTER TABLE audit_log DROP CONSTRAINT audit_log_entity_check;
|
|
ALTER TABLE audit_log ADD CONSTRAINT audit_log_entity_check CHECK (
|
|
entity IN (
|
|
'person', 'passport', 'address', 'session', 'company', 'visa', 'arrival',
|
|
'extension', 'reentry-permit', 'report', 'work-permit', 'document', 'form'
|
|
)
|
|
);
|