Advertisement
nicmackenzie

queries

Dec 31st, 2024 (edited)
916
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.97 KB | None | 0 0
  1. INSERT INTO `forms` (`id`, `form_name`, `module_name`, `module_id`, `path`, `menu_order`, `is_visible`) VALUES (NULL, 'expense reports', 'finance', '25', 'finance/reports/expense-reports', '35', '1'), (NULL, 'invoice reports', 'finance', '25', 'finance/reports/invoice-reports', '40', '1'), (NULL, 'income statement', 'finance', '25', 'finance/reports/income-statement', '70', '1'), (NULL, 'trial balance', 'finance', '25', 'finance/reports/trial-balance', '75', '1'), (NULL, 'balance sheet', 'finance', '25', 'finance/reports/balance-sheet', '80', '1');
  2.  
  3. DELIMITER $$
  4. CREATE PROCEDURE `sp_trial_balance`(IN `asofdate` DATE)
  5. BEGIN
  6.     SELECT
  7.         l.parent_account,
  8.         COALESCE(SUM(l.debit),0) AS debit,
  9.         COALESCE(SUM(l.credit),0) AS credit,
  10.         SUM(l.debit) - SUM(l.credit) AS balance
  11.     FROM
  12.         ledgers l
  13.     WHERE
  14.         (l.date <= asofdate) AND (l.deleted_at IS NULL)
  15.     GROUP BY
  16.         l.parent_account
  17.     ORDER BY
  18.         l.parent_account;
  19. END$$
  20. DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement