{"id":3465,"date":"2025-10-11T10:44:09","date_gmt":"2025-10-11T14:44:09","guid":{"rendered":"https:\/\/www.nytechnologist.com\/beyondthebasics\/?page_id=3465"},"modified":"2025-10-11T10:48:11","modified_gmt":"2025-10-11T14:48:11","slug":"the-mechanics-of-accounting","status":"publish","type":"page","link":"https:\/\/www.nytechnologist.com\/beyondthebasics\/the-mechanics-of-accounting\/","title":{"rendered":"The Mechanics of Accounting"},"content":{"rendered":"\n<p><strong>The Journal<\/strong><\/p>\n\n\n\n<p><br>The journal is the book of original entry where every transaction is first recorded in chronological order. Each entry shows which accounts are affected, the amounts, and whether they are debited or credited.<\/p>\n\n\n\n<p><strong>Rules of Debit and Credit<\/strong><\/p>\n\n\n\n<p><br>Every transaction affects at least two accounts.<\/p>\n\n\n\n<p>Debits increase Assets and Expenses; decrease Liabilities, Equity, and Revenue.<\/p>\n\n\n\n<p>Credits increase Liabilities, Equity, and Revenue; decrease Assets and Expenses.<\/p>\n\n\n\n<p><strong>Journalizing Transactions<\/strong><\/p>\n\n\n\n<p><br>This is the process of analyzing each transaction and writing it as a journal entry with dates, account titles, debit and credit amounts, and a brief description.<\/p>\n\n\n\n<p><strong>Ledger<\/strong><\/p>\n\n\n\n<p><br>The ledger is the book of final entry. It contains all accounts grouped by type (Assets, Liabilities, Equity, Revenue, Expenses) showing their cumulative balances.<\/p>\n\n\n\n<p><strong>Posting<\/strong><\/p>\n\n\n\n<p><br>Posting transfers each journal entry from the journal into the appropriate ledger accounts so that each account shows its running total balance.<\/p>\n\n\n\n<p><strong>Normal Balance<\/strong><\/p>\n\n\n\n<p><br>Every account has a side\u2014debit or credit\u2014where it normally increases. This is its normal balance. For example:<\/p>\n\n\n\n<p>Assets, Expenses \u2192 Debit<\/p>\n\n\n\n<p>Liabilities, Equity, Revenue \u2192 Credit<\/p>\n\n\n\n<p><strong>Trial Balance<\/strong><\/p>\n\n\n\n<p><br>After posting, the ledger balances are listed in a trial balance to verify that total debits equal total credits. This ensures mathematical accuracy before preparing financial statements.<\/p>\n\n\n\n<p><strong>Connection to the Accounting Model<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>In the Accounting Model System, each step is implemented through database tables and views:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Accounting Step<\/th><th>Model Component<\/th><th>Description<\/th><th><strong>Sample SQL\/PLSQL Template Code<\/strong><\/th><\/tr><\/thead><tbody><tr><td><strong>1. Journal<\/strong><\/td><td><code>JS_JOURNAL_ENTRIES<\/code> table<\/td><td>Stores each transaction with date, debit, credit, and description.<\/td><td><code>sql\\n-- Insert a new journal entry\\nINSERT INTO JS_JOURNAL_ENTRIES (entry_id, entry_date, account_id, debit_amt, credit_amt, description)\\nVALUES (JS_JOURNAL_SEQ.NEXTVAL, SYSDATE, :account_id, :debit_amt, :credit_amt, 'Sale of goods');\\n\\nCOMMIT;<\/code><\/td><\/tr><tr><td><strong>2. Rules of Debit &amp; Credit<\/strong><\/td><td>PL\/SQL trigger or constraint<\/td><td>Ensures double-entry rule: total debits = total credits for each journal batch.<\/td><td><code>sql\\n-- Trigger to enforce double-entry balance\\nCREATE OR REPLACE TRIGGER trg_check_balance\\nAFTER INSERT OR UPDATE ON JS_JOURNAL_ENTRIES\\nDECLARE\\n v_total_debit NUMBER;\\n v_total_credit NUMBER;\\nBEGIN\\n SELECT SUM(debit_amt), SUM(credit_amt)\\n INTO v_total_debit, v_total_credit\\n FROM JS_JOURNAL_ENTRIES\\n WHERE entry_batch_id = :NEW.entry_batch_id;\\n\\n IF v_total_debit != v_total_credit THEN\\n RAISE_APPLICATION_ERROR(-20001, 'Debits and Credits must balance!');\\n END IF;\\nEND;<\/code><\/td><\/tr><tr><td><strong>3. Journalizing Transactions<\/strong><\/td><td>APEX form or SQL insert<\/td><td>Users enter transactions that automatically post to journal table.<\/td><td><code>sql\\n-- Example form submission or manual insert\\nINSERT INTO JS_JOURNAL_ENTRIES (entry_date, account_id, debit_amt, credit_amt, description)\\nVALUES (TO_DATE('2025-10-11','YYYY-MM-DD'), 101, 0, 500, 'Service Revenue');\\n\\nCOMMIT;<\/code><\/td><\/tr><tr><td><strong>4. Ledger<\/strong><\/td><td><code>JS_LEDGER_ACCOUNTS<\/code> view<\/td><td>Summarizes transactions by account showing running balances.<\/td><td><code>sql\\n-- Create Ledger View\\nCREATE OR REPLACE VIEW JS_LEDGER_ACCOUNTS AS\\nSELECT a.account_id,\\n a.account_name,\\n SUM(j.debit_amt - j.credit_amt) AS balance\\nFROM JS_ACCOUNTS a\\nLEFT JOIN JS_JOURNAL_ENTRIES j ON a.account_id = j.account_id\\nGROUP BY a.account_id, a.account_name;<\/code><\/td><\/tr><tr><td><strong>5. Posting<\/strong><\/td><td>SQL procedure or job<\/td><td>Transfers journal entries to ledger by updating balances.<\/td><td><code>sql\\n-- Example Posting Procedure\\nCREATE OR REPLACE PROCEDURE JS_POST_JOURNAL AS\\nBEGIN\\n UPDATE JS_ACCOUNTS a\\n SET a.account_balance = (\\n SELECT NVL(SUM(j.debit_amt - j.credit_amt),0)\\n FROM JS_JOURNAL_ENTRIES j\\n WHERE j.account_id = a.account_id\\n );\\n\\n COMMIT;\\nEND JS_POST_JOURNAL;\\n\/\\n\\n-- Run posting\\nEXEC JS_POST_JOURNAL;<\/code><\/td><\/tr><tr><td><strong>6. Normal Balance<\/strong><\/td><td><code>account_type<\/code> field in <code>JS_ACCOUNTS<\/code><\/td><td>Defines which side (Debit or Credit) increases the account\u2019s balance.<\/td><td><code>sql\\n-- Sample Account Table with Normal Balance\\nCREATE TABLE JS_ACCOUNTS (\\n account_id NUMBER PRIMARY KEY,\\n account_name VARCHAR2(100),\\n account_type VARCHAR2(20) CHECK (account_type IN ('Asset','Liability','Equity','Revenue','Expense')),\\n normal_balance VARCHAR2(6) CHECK (normal_balance IN ('Debit','Credit')),\\n account_balance NUMBER DEFAULT 0\\n);\\n\\n-- Example Insert\\nINSERT INTO JS_ACCOUNTS VALUES (101, 'Cash', 'Asset', 'Debit', 0);<\/code><\/td><\/tr><tr><td><strong>7. Trial Balance<\/strong><\/td><td><code>V_TRIAL_BALANCE<\/code> view<\/td><td>Aggregates ledger balances and verifies equality of total debits and credits.<\/td><td><code>sql\\n-- Create Trial Balance View\\nCREATE OR REPLACE VIEW V_TRIAL_BALANCE AS\\nSELECT a.account_name,\\n CASE WHEN a.normal_balance = 'Debit' THEN balance ELSE 0 END AS debit,\\n CASE WHEN a.normal_balance = 'Credit' THEN ABS(balance) ELSE 0 END AS credit\\nFROM JS_LEDGER_ACCOUNTS a;\\n\\n-- View Trial Balance\\nSELECT * FROM V_TRIAL_BALANCE;\\n\\n-- Verify totals\\nSELECT SUM(debit) AS total_debits, SUM(credit) AS total_credits\\nFROM V_TRIAL_BALANCE;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Summary:<br>The manual accounting cycle\u2019s flow<\/p>\n\n\n\n<p><strong>Journal \u2192 Ledger \u2192 Trial Balance \u2192 Financial Statements<\/strong><\/p>\n\n\n\n<p>is mirrored digitally in the Accounting Model, where tables record transactions, constraints enforce debit\/credit rules, and views produce automated financial summaries (like the Trial Balance, Income Statement, and Balance Sheet).<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Journal The journal is the book of original entry where every transaction is first recorded in chronological order. Each entry shows which accounts are affected, the amounts, and whether they are debited or credited. Rules of Debit and Credit Every transaction affects at least two accounts. Debits increase Assets and Expenses; decrease Liabilities, Equity, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-3465","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P2Cll0-TT","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/pages\/3465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/comments?post=3465"}],"version-history":[{"count":2,"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/pages\/3465\/revisions"}],"predecessor-version":[{"id":3469,"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/pages\/3465\/revisions\/3469"}],"wp:attachment":[{"href":"https:\/\/www.nytechnologist.com\/beyondthebasics\/wp-json\/wp\/v2\/media?parent=3465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}