Menu

JnlTemplates

Tim Schofield

Synopsis

To write a journal templating system that allows journals that
are frequently used to be saved, and then re-used as a template
for the next occasion.

Files

Files changed:

  • GLJournal.php

New Files:

  • sql/updates/205.php
  • GLJournalTemplates.php

Details

GLJournal.php

When a Journal balances, and is in a state to commit to the ledger then a new
button appears with the option to "Save as a template". This button is hidden
while the journal is still being prepared.
On pressing this button a new screen is shown which contains a summary of the
journal, an input box for a description of the template (which must contain
something), and two buttons, one to save the template, and one to cancel the
save and return to the standard journal input screen. Pressing the save button
saves the template to the database and returns the user to the standard journal
input screen.
When the user first enters the journal input screen, and before any lines have
been input, a new button is shown with the option to "Load from a template".
This button is hidden once a line of the journal has been entered. Once clicked
on this button reveals a list of all journal templates currently saved in the
database. This is in the form of a table, and the last field in the table is a
link. Once clicked that template will load up, and the user is returned to the
main journal input screen, with the details of that template loaded.

sql/updates/205.php

This contains the databse updates required for this functionality. Two new tables
will be created with the following specifications:

CREATE TABLE jnltmplheader (

templateid INT(11) NOT NULL DEFAULT 0,

templatedescription VARCHAR(50) NOT NULL DEFAULT '',

journaltype INT(1) NOT NULL DEFAULT 0,

PRIMARY KEY (templateid)

)

and

CREATE TABLE jnltmpldetails (

linenumber INT(11) NOT NULL DEFAULT 0,

templateid INT(11) NOT NULL DEFAULT 0,

tags VARCHAR(50) NOT NULL DEFAULT '0',

accountcode VARCHAR(20) NOT NULL DEFAULT '1',

amount DOUBLE NOT NULL DEFAULT 0,

narrative VARCHAR(200) NOT NULL DEFAULT '',

PRIMARY KEY (templateid, linenumber)

)

GLJournalTemplates.php

This is a new script to provide simple maintenance functionality for the journal
templates that have already been stored in the database. The user will be
presented with a list of the templates in a table format, with two links at the
end of each line, one to edit a template, and one to delete the template.
The delete link will remove that template from the database after first issuing an
"are you sure" warning.
The edit link will provide basic editing functionality of the lines of the template
enabling editing of the account, tags, narrative and amount fields. It is not
envisaged that lines will be able to be deleted or inserted by this script.


Related

Wiki: V5

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.