BEGIN; CREATE OR REPLACE FUNCTION _tmp_wo(p_name text, p_seq int, p_match text, p_acct int, p_tax int, p_label text) RETURNS void AS $$ DECLARE v_mid int; v_lid int; BEGIN INSERT INTO account_reconcile_model (name, sequence, company_id, trigger, match_label, match_label_param, active, can_be_proposed, create_uid, write_uid, create_date, write_date) VALUES (jsonb_build_object('en_US', p_name), p_seq, 1, 'auto_reconcile', 'contains', p_match, true, true, 2, 2, NOW(), NOW()) RETURNING id INTO v_mid; INSERT INTO account_reconcile_model_line (model_id, company_id, sequence, account_id, amount_type, amount, amount_string, label, create_uid, write_uid, create_date, write_date) VALUES (v_mid, 1, 10, p_acct, 'percentage', 100, '100', jsonb_build_object('en_US', p_label), 2, 2, NOW(), NOW()) RETURNING id INTO v_lid; INSERT INTO account_reconcile_model_line_account_tax_rel (account_reconcile_model_line_id, account_tax_id) VALUES (v_lid, p_tax); END; $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION _tmp_pm(p_name text, p_seq int, p_match text, p_pid int) RETURNS void AS $$ BEGIN INSERT INTO account_reconcile_model (name, sequence, company_id, trigger, match_label, match_label_param, mapped_partner_id, active, can_be_proposed, create_uid, write_uid, create_date, write_date) VALUES (jsonb_build_object('en_US', p_name), p_seq, 1, 'auto_reconcile', 'contains', p_match, p_pid, true, true, 2, 2, NOW(), NOW()); END; $$ LANGUAGE plpgsql; SELECT _tmp_wo('UPS Shipping', 400, 'UPS', 518, 20, 'UPS Shipping & Delivery'); SELECT _tmp_wo('Shopify Subscription', 401, 'SHOPIFY', 495, 20, 'Shopify E-Commerce Platform'); SELECT _tmp_wo('Canva Design', 402, 'CANVA', 495, 32, 'Canva Design Subscription'); SELECT _tmp_wo('Massive.com / Polygon.io', 403, 'MASSIVE.COM', 495, 32, 'Polygon.io Stock Data API'); SELECT _tmp_wo('Air Canada Travel', 404, 'AIR CAN', 525, 20, 'Air Canada Travel'); SELECT _tmp_wo('Enterprise Rent-A-Car', 405, 'ENTERPRISE RENT', 497, 20, 'Enterprise Car Rental'); SELECT _tmp_wo('Walmart Purchases', 406, 'WALMART', 507, 20, 'Walmart Office/Shop Supplies'); SELECT _tmp_wo('FlightHub Travel', 407, 'FLIGHTHUB', 525, 20, 'FlightHub Travel Booking'); SELECT _tmp_wo('G2A Software', 408, 'G2A.COM', 495, 32, 'G2A Software Licenses'); SELECT _tmp_wo('Ubiquiti Network Equipment', 409, 'UBIQUITI', 495, 20, 'Ubiquiti Network Hardware'); SELECT _tmp_wo('Facebook Ads (FACEBK)', 410, 'FACEBK', 496, 20, 'Facebook/Meta Advertising'); SELECT _tmp_wo('Eventbrite Events', 411, 'eventbrite', 496, 20, 'Eventbrite Event Registration'); SELECT _tmp_wo('WP Mail SMTP Plugin', 412, 'WPMAILSMTP', 495, 32, 'WP Mail SMTP Plugin'); SELECT _tmp_wo('Synthesia AI Video', 413, 'SYNTHESIA', 495, 32, 'Synthesia AI Video Platform'); SELECT _tmp_wo('E2PDF WordPress Plugin', 414, 'E2PDF', 495, 32, 'E2PDF WordPress Plugin'); SELECT _tmp_wo('Plugins For WP', 415, 'PLUGINSFORWP', 495, 32, 'WordPress Plugins'); SELECT _tmp_wo('Google Cloud Platform', 416, 'GOOGLE*CLOUD', 495, 20, 'Google Cloud Platform'); SELECT _tmp_wo('Best Buy Retail', 417, 'BEST BUY', 507, 20, 'Best Buy Electronics/Supplies'); SELECT _tmp_wo('Scotia Visa Annual Fee', 418, 'annual fee', 499, 32, 'Scotia Visa Annual Fee'); SELECT _tmp_wo('Corp Canada Registration', 419, 'CORP CANADA', 507, 20, 'Corporation Canada Registration'); SELECT _tmp_wo('NUANS Name Search', 420, 'NUANS', 507, 20, 'NUANS Business Name Search'); SELECT _tmp_wo('Wisprflow AI', 421, 'WISPRFLOW', 495, 32, 'Wisprflow AI Platform'); SELECT _tmp_wo('LawDepot Legal Docs', 422, 'lawdepot', 507, 20, 'LawDepot Legal Documents'); SELECT _tmp_wo('eBay Purchases', 423, 'eBay', 507, 20, 'eBay Online Purchases'); SELECT _tmp_wo('Ooma VoIP Phone', 424, 'OOMA', 523, 20, 'Ooma VoIP Phone Service'); SELECT _tmp_wo('Paddle / Synergy App', 425, 'PADDLE.NET', 495, 32, 'Paddle Software Subscription'); SELECT _tmp_pm('Power Plus Mobility', 500, 'POWER PLUS', 35); SELECT _tmp_pm('Best Buy Medical Supplies', 501, 'Best Buy Medical', 4939); SELECT _tmp_pm('Cheelcare Canada', 502, 'cheelcare', 11955); DROP FUNCTION _tmp_wo(text, int, text, int, int, text); DROP FUNCTION _tmp_pm(text, int, text, int); COMMIT;