Skip to content
Tim Schofield edited this page Sep 21, 2024 · 3 revisions

Table of Contents

Synopsis

Most companies make regular payments out, either by standing order, or by direct debit. What is needed is a system to set up these payments, and to process them as they become due.

Database Updates

We need a new table called regularpayments to store the regular payments.

 CreateTable('regularpayments', "CREATE TABLE IF NOT EXISTS `regularpayments` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `frequency` char(1) NOT NULL default 'M',
   `days` tinyint(3) NOT NULL DEFAULT 0,
   `glcode` varchar(20) NOT NULL DEFAULT '1',
   `bankaccountcode` varchar(20) NOT NULL DEFAULT '0',
   `tag` varchar(255) NOT NULL DEFAULT '',
   `amount` double NOT NULL default 0,
   `currabrev` char(3) NOT NULL DEFAULT '',
   `narrative` varchar(255) default '',
   `firstpayment` date NOT NULL default '0000-00-00',
   `finalpayment` date NOT NULL default '0000-00-00',
   `nextpayment` date NOT NULL default '0000-00-00',
   `completed` tinyint(1) NOT NULL DEFAULT 0,
   PRIMARY KEY  (`id`)
 )

We also need to register the new scripts

  NewScript('RegularPaymentsSetup.php', 5);
  NewScript('RegularPaymentsProcess.php', 5);

New Scripts

RegularPaymentsSetup.php

A new script that allows us to setup new regular payments

  1. Frequency: Payments can be setup to occur Daily, Weekly, Fortnightly, Monthly, Quarterly or Annually.
  2. Days: The number of days after the start of the period that the payments will happen. For example if the payment happens on the 3rd of each month, this parameter would be 3.
  3. First and Last Payment Dates: These are the dates when the DD or SO start and finish. You won't be prompted to make any further payments after the last date.
  4. Bank Account: Select which account the payments will come out of it.
  5. Currency of Payment: What currency should the payment be made in
  6. GL Tag: Select any number of tags for this payment
  7. Select GL Account: Choose the GL Account to post this payment against
  8. GL Narrative: This narrative will appear on any GL inquiries and reports
  9. Amount: The amount of the payment

RegularPaymentsProcess.php

This script shows a list of all payments that are due. Tick those that you wish to process, click on process, and all the transactions will be posted.

Clone this wiki locally