The Purchase Order Processing System (POPS) is a web-based application designed to interface with MYOB Exo to produce and track purchase orders throughout the approval process, culminating in the production of creditor invoices in the Exo database.
Although technically a public project, POPS is being developed for a specific Not-For-Profit organisation and is unlikely to be useful in other contexts. However, if any of the code is useful to anyone, feel free to use it!
POPS is built on the Ruby on Rails web framework and uses Twitter Bootstrap as the UI framework.
-
Ruby 2 (latest port 2.1.2)
-
Rails 4 (latest port 4.1.1)
-
Twitter Bootstrap 3.0
-
Run bundle install to update third-party gems.
-
Run rake db:setup
-
To allow initial access to the system, running rake db:seed which will create an admin user with the password password. (Note db:seed will be run automatically as part of db:setup) This user should be used to set up another admin user, then deleted.
-
Test data for the master tables is available in <table_name>.csv files in the db/MYOB data directory. To import the data into the sqlite3 development database, open the development database with sqlite3 then use the .import command. eg. .import /tmp/brianc/tax_rates.csv tax_rates
-
Once users, suppliers, programs, accounts and tax rates have been setup or loaded, test data may be created by running random_load.rb from the db directory. The script requires two arguments - the first being the order status being created (D,S,A or P) and the second the number of records of the provided status to be created. Respective defaults are D and 1.
MYOB Exo uses an SQL Server database which POPS accesses to:
-
create creditor invoices in Exo using POPS data
-
update POPS subsets of Exo tables (suppliers, programs etc.)
Remote access to SQL Server is usually not enabled by default. These links contain useful set up information for SQL Server 2008 and 2012 Express.
SQL Server access is achieved through FreeTDS libraries (freetds.org). To install these libraries on ubuntu:
-
sudo apt-get freetds-dev freetds-bin
-
tsql -C to test the installation
-
edit /etc/freetds/freetds.conf to setup server configuration
-
tsql -S server -U user -P password to connect to SQL Server. More information on testing is available here.
The tiny_tds gem provides low-level connection to SQL Server. Run gem install tiny_tds to install it. If it works, terrific! If not, you’ll have to build your own by using git to clone the repository, and the MiniPortile instructions in the {gem}[https://github.com/rails-sqlserver/tiny_tds]‘s README to roll your own.
The deploy script relies on a staging repository being present on the server machine which would normally be used as a test region. The POPS_DESTINATION environment variable must be set and the destination directory must exist. The POPS_OWNER environment variable should be set to the owner of the web server. Initial deployment steps:
-
cd pops_repository_root_directory in staging repository
-
sudo mkdir /etc/opt/pops
-
sudo cp config/*.yml /etc/opt/pops
-
from pops directory in staging repository, sudo -E deploy
-
cd $POPS_DEST
-
sudo -u $POPS_OWNER rake db:setup RAILS_ENV=production