Friday, 11 July 2014

KwaMoja / webERP hospital extensions

I am pleased to announce that we have brought our hospital extensions in line with the latest code, and that it is now available for testing. It can be downloaded from my github site at

This code by itself can be used in small clinics where it is just necessary to track what treatment a patient has had, and do the financials, or it can be used together with Care2x (

On installation you should find that you have another module called "Hospitals" installed. 

This module contains all the options for billing patients, dealing with the insurance companies, and reporting on the hospitals activities.

Using these extensions will provide a great help in tightening up a hospitals financial activities, and considerably help to reduce fraud. A brief description of how this works is given below.

Each cashier has a petty cash account that is just for their use, and which can be restricted to just them and a senior accountant/cashier to use. 

The Hospitals module contains options to bill from various hospital departments.

When a patient presents themselves at the cashier for say, the Laboratory, the cashier just has to select the option for "Billing For Laboratory Tests". They will then see a screen for helping them find the patient:
This is the same for whichever billing option the cashier chooses. As can be seen the cashier can search on many different ways, including the name, address, phone number to establish the right patient. Once the patient has been selected the cashier will see the billing screen:
If the link to Care2x is active then all the unbilled laboratory tests for that patient
will be shown, together with the total amount to be paid, so that all the cashier has to do is to collect the cash from the patient, and click on "Make Payment".
If the Care2x link is not activated then the patient should present the cashier with a document to show what Laboratory test they have been prescribed. The cashier then selects this as follows.
When the lab test is selected the price for that test is automatically pulled from the system. This depends on what price list was selected for that patient. Any number of price lists can be setup and selected for the patient. The cashier can select as many tests as needed, and the total amount payable is automatically entered in the "Amount Received" box.

When the cashier clicks on the "Make Payment" button all accounting and stock transactions related to this payment are automatically done using pre determined parameters.

At the end of the shift the cashier prints out a transactions report for their cash account, and the total of that list must agree with the total amount of cash that the cashier has collected. This list together with the cash is then taken to the chief accountant/cashier who verifies that the cash agrees with the report, and then does a transfer of cash from the cashiers account to the main account, which makes the balance of the cashiers account zero, in preparation for their next shift.

The chief accountant, or other authorised person then produces a report of any laboratory tests that were prescribed but have not been billed, and any items shown on this report need to be analysed to see why they have not been billed.

 There are various other reports and configuration options available which there isn't space to go into right now, and I will try to publish another article on these.

Friday, 27 June 2014

A new partnership - Making your network more secure

I am pleased to announce that I have entered into a new partnership with a Ugandan company to deliver a variety of Network security services to Ugandan companies and organisations.

If you want to stop the government, or cyber criminals attacking your network - or just better manage your users' internet traffic, then drop me a line on and I will be pleased to get you a quote for your network.

Barely a day goes by without news of further security issues with our data. If it is not governments spying on us it is criminal gangs in search of our valuable data, or just to hold your data hostage.

The network security services we offer which include:
1.    Penetration tests, security risk assessments and audits tailored your needs, including:
•    Network security architecture review
•    Network penetration tests & assessments
•    Web application penetration tests & assessments
•    Wireless network penetration tests & assessments
•    Physical security assessments & penetration tests
•    Code review

2.    Threat Mitigation Services
•    Firewall deployment
•    IDS Roll-out
•    OS Hardening
•    Security Policy

3.    Rapid, effective, and discrete incident response services
•    Incident Response
•    Forensics
•    Expert Witness

4.    Supply of both virtual and hardware appliance Firewalls.  We deal with Barracuda and Check Point for:
•    Anti-phishing, Anti-spam, Anti-spoofing, Anti-spyware and Anti-virus
•    Cloud protection layer
•    Denial of Service (DoS) protection
•    Directory Harvest Attack protection
•    Email spooling and quarantine
•    Outbound email protection

Friday, 23 May 2014

Phil Daintree and

Ever since Phil Daintree fell out with me over keeping a history of purchase orders on the system I have grown used to the torrent of lies and abuse he has thrown at me, in an attempt to stop me developing webERP and KwaMoja. I have a thick skin, and anybody who knows me can see through his lies easily enough, so it hasn't unduly bothered me. He is after all well known for his lies and his bullying behaviour.

However his constant attacks on my African colleagues and our African projects do annoy me. His hijacking of the domain name in order to push his personal vendetta is typical of him. I was not even involved in the project when he purchased the domain. The full details of this pathetic saga can be read in a post by Martha here.

He has told my African colleagues on the project he does not believe they are real Africans as the work is too good for them to have done it. I have offered Phil their phone numbers so he can tell them in person that they don't exist, but curiously enough he doesn't want to do this!

Persuading African friends to work on open source projects has been a struggle, as I have documented elsewhere. When they do help on open source they shouldn't have to face attacks from people such as Phil.

When he first tried to ban me from the webERP project I set up a separate webERP repository so that I could continue to make my code available to others as the license requires. Phil Daintree launched numerous public attacks on me for this, and said I should call my branch something else. When I then started committing code to the KwaMoja repository he launched numerous public attacks on me for donating code to a "rival project". There is no such thing as rival projects in the open source world, all projects can take code from each other. Open source is about collaboration not rivalry. So Phil is basically going to attack me whatever I do. That is fine as I have said, but I would ask him to leave off our African projects and my African colleagues.

Tuesday, 6 May 2014

Looking for KwaMoja consultants in the Arusha area

I have the need to recruit several ERP consultants in the Arusha area. This will entail working closely with a Christian faith based organisation and applicants need to be sensitive to that.

Preferably some or all of the following would be nice:
1 An understanding and experience with ERP systems.
2 A Knowledge of bookkeeping and accountancy
3 Some knowledge of programming PHP/mysql
4 A desire to learn and to work hard to create a career in the ERP industry

If you feel you would qualify and are interested in working in the Arusha area then please send your resume/CV to with the words KwaMoja Consultant in the subject line of the email.


Sunday, 20 April 2014

Filing a bug report in KwaMoja

It appears from above that the administrator of webERP is shutting the project to new contributors, so it seems like a good time to run a series of articles on how to contribute to KwaMoja. Here is the first in that series:

image02Many people are nervous about reporting problems with open source projects. They fear that the developers will see it as a criticism. However all developers know that there is no such thing as "bug free" software. Any help they can get in tracking down and fixing these bugs is always appreciated.
KwaMoja uses a system called the bug genie to track any bugs in the software. We thought it waould be useful to write this short guide to filing bugs in KwaMoja using the bug genie.
Ok, so let's imagine that we have found a problem that we think may be a bug in the General Ledger Journal functionality (this will be an imaginary bug, I am not aware of any at the moment). The first thing we will need to do is to create an account for ourselves on the bug tracker. This is necessary firstly as it prevents spammers, secondly it enables you to track your bug, and for the developers to discuss the issue with you, enabling a dialog between you. Click here to enter the bug reporting section. You should see something like this:
If you already have a login, or you want to use one of the openid methods then
you can login from here. If you wish to create a new account then click on the tab marked "Register new account". You should now see a screen looking something like the one on the left.
image02Filling out this information and submitting it should give you a new randomised password. You should now login with the user and password combination that you have. You should consider changing the password at this point to one that you will remember.
You should now be taken to your dashboard page, giving you a summary of all your activity on bug genie. Obviously at the moment there won't be much on it!! If you are not taken to your dashboard, then click on your name in the top right hand corner and you should be taken there.
You should now see a menu bar at the top of the window looking like the picture
on the right. To enter a bug report select the "Bug Report" option and you will be taken to the main bug reporting screen. This has been kept deliberately simple. There are just three sections that you need to fill in.
  • Short Description
  • Description
  • Reproduction Steps
The short description should be brief but sufficient so that a developer browsing a list can quickly identify what it is about. Compare "KwaMoja doesn't work properly" with "General Ledger Journal gives the wrong total amount". Clearly the second is going to be easier for a developer to immediately understand the issue being reported.
The main description should contain as much information as you can about the issue being reported. You should include what version of KwaMoja you are using, what operating system and version you are using, a description of your server, and what browser you are using to view KwaMoja. Include any further information that you feel may be of use to the developers.
Finally there is the steps to reproduce the issue. Make sure you put everything no matter how obvious it may seem to you. Also include the results of what happens for each step.
Once you have submitted the report you should keep an eye out for feedback from the developer. It is likely you will get asked for more info, or be given a fix to test. Please reply to this feedback to help improve KwaMoja.

Tuesday, 15 April 2014

Med-e-Tel in Luxembourg

Thanks to the sponsorship of Advanz of Luxembourg we had a great time at Med-e-Tel 2014.
The major aim of our presence was to promote the use of our open source solutions in developing countries. It was great to see other open source health systems present as well to help promote the concept of open source in hospitals.

There was  stand devoted to open source solutions, which was very well attended all week.

We had a lot of interest all week from all corners of the globe. We presented a paper on an implementation of Care2x in a large tertiary hospital. You can read the full paper here.

The presentation was part of the open source in health care session of the conference, and was very well attended with much interest in the various open source solutions for health care being presented.

I came away from the conference with the belief that we are on the right track with our solutions, and that open source really is the future for ICT in health care.

I have come away with renewed vigour to push forward with Project Mtuha and KwaMoja/Care2x solutions, despite the attempts by some to wreck the projects.

Again, much thanks to Advanz for their sponsorship and support without which our presence at the conference would not have been possible.

Friday, 21 March 2014

Some properties of Automorphic numbers

This post is a complete change from my usual subjects.

Many years ago a man named Mike Mudge wrote a monthly column for Personal Computer World called "Numbers Count". There seems to be very little about him on the web, except for other fans like me. One such column inspired the following paper written jointly by my father[1] and I.

This work has just come to light during a recent house move that caused me to search through old papers, and despite it being 20 years ago, a quick search of the web shows that it still contains some original stuff, so I thought it would be interesting to publish it here. I am publishing it here unaltered, though obviously computing power has improved a lot over the years. I have tried to reproduce it exactly, but I may have made some transcribing errors, and if you see any please let me know.

Nb 20 years ago this work was unique to the best of our knowledge, but I can't promise that is still so.

Some properties of Automorphic numbers


An automorphic number is is a number whose square ends in the same digits as number itself. Automorphic numbers form two series ending respectively in the digits 5 and 6. Successive members of each series have the same sequence of trailing digits and are formed simply by appending a new leading digit to their predecessor. Corresponding numbers in the two series bear a simple numerical relation to one another and are co-prime. Consequently, the sequence of one series uniquely determines the sequence of the other series. Some properties of automorphic numbers are discussed and these properties used to develop rapid and efficient methods for the generation of automorphic numbers. One such method generates numbers of up to 32,000 digits in length in a run time of 75 minutes[2]. n-Automorphic numbers to bases other than 10 are briefly discussed.


The computer generation of automorphic numbers using a simple trial and error process soon indicates that there are only three n-digit automorphic numbers for any value of n. One of these consists of the digit 1 with a string of leading zeros and may be regarded as trivial. In the case of the other two, it is found that with the exception of the leading digit, each n-digit automorphic number is identical with the corresponding n-1-digit number, and it is therefore only necessary to determine the leading digit for any n-digit  automorphic number. The following describes some properties of automorphic numbers and which lead to more efficient methods for their generation.


The generation of automorphic numbers was carried out with a Packard-Bell 445 elite 486Ssx running at 33mHz using programmes implemented in turbo pascal.


Theorem 1 : 
For any value of n, there exists only two n-digit automorphic numbers and these end in the digits 5 or 6.
Proof: Let n= 10a+b represent a two digit number. If n is automorphic then 
 n^2=100a^2+20ab+b^2=1000z+100y+10a+b   .............................  (1)
and b^2=b+10x
where x is an integer. Only b=5 or b=6 satisfy this condition and therefore all 2 digit automorphic numbers must end in 5 or 6.

Substituting b=5 in equation (1) above gives
90a must end in the digits 80 and therefore a=2 and n=25.
Substituting b=6 in equation (1) above gives
110a must end in the digits 70 and therefore a=7 and n=76.

Let n=100a+10b+c represent a 3 digit number. If n is automorphic then 
n^2=10^4*a^2+2ab*10^3+b^2*10^2+2ac*10^2+20bc+c^2=10^5z+10^4y+10^3x+100a+10b+c ........ (2)
and c^2=c+10j where j is an integer, therefore the digit c must be either 5 or 6.
Substituting c=5 in equation (2) gives us 
10^4*a^2+2ab*10^3+b^2*10^2+10^3a+10^2b+25=10^5*z+10^4*y+10^3*x+100a+10b+5 ...... (3)
and 90b must end in the digits 80, therefore b must have the value 2.
By the same procedure substituting b=2 into equation (3) gives the value a=6. Substitution of c=6 in equation (2) and repetition of the same procedure gives values of 7 and 3 for b and a respectively.
Therefore to digit automorphic numbers can only be 25 and 76, and 3 digit automorphic numbers can only be 625 and 376.

Conjecture A

If p and q are any pair of n-digit automorphic numbers then p+q=10^n+1

Conjecture B

If p and q are any pair of n-digit automorphic numbers then p and q are co-prime.

Theorem 2

If p is an n-digit automorphic number and q=p-1 then pq=100s where s is an integer.
Proof: Let pq=1000a+100b+10c +d and p^2=1000f+100g+p
Then p^2-pq=1000f+100g+p-1000a-100b-10c-e=p
Therefore c and d must be zero, and a=f, b=g, and pq=100s where s is an integer.

Theorem 3

If p is an n-digit automorphic number and 10^nA+p is the corresponding n+1-digit automorphic number, then A(2p-1)+x=k*10^n-1 where k is an integer and 100x=p^2-p
Proof: Let p=10a+b. If p is automorphic then 
Let x=10l+m then p^2=100x+p and 100x=p^2-p
Let the 3 digit number be 100A+p, then if this number is automorphic
10^4A^2+200pA+p^2=10^5*z+10^4*y+10^3*x+100A+p and 200pA-100A=p-p^2+1000k
Therefore A(2p-1)+x=10k
By the same procedure it can be shown that for the 4-digit number 1000B+100A+10a+b the leading digit B is given by the expression
B(2p-1)+j=k*10^2 where p=100A+10a+b, j*10^3=p^2-p, and k is an integer.

Theorem 4

If k is the square of an n-digit automorphic number j ending with the digit 6, then the le4ading digit in the corresponding (n+1)-digit automorphic number is 10-m where m is the coefficient of 10^n in k. For the corresponding n-digit number ending with the digit 5, the leading digit in the corresponding (n+1)-digit number is m where m is the coefficient of 10^n.
Proof: Let p=10a+b where p is a 2-digit automorphic number, then p^2=1000l+100m+10a+b
Let the corresponding 3-digit automorphic number 100A+p
From Theorem 3 above we know
A(2p-1)+10l+m=10k where k is an integer
Substituting p=76 we get 151A+10l+m=10k and A*l+m=10
Therefore A=10-m
Substituting p=25 we get 49A+10l+m=10k and A*9+m=10k
Therefore A=m

Theorem 5

For any value of n there exists only three-n-digit tri-automorphic numbers and these end in the digits 2, 5 or 7.
Proof: Let n=10a+b then 3n^2=300a^2+60ab+3b^2
If n is tri-automorphic then:
300a^2+60ab+3b^2=1000z+100y+10a+b  ..................  (4)
and 3b^2-b=10x   ............................  (5)
where x is an integer. This condition is only satisfied by b=2, b=5, or b=7
Substituting b=2 in equation (4), it follows that a=9
Substituting b=5 in equation (4), it follows that a=7
Substituting b=7 in equation (4), it follows that a=6
For di-automorphic numbers, equation (5) becomes
2b^2-b=10x and b=8
For tetra-automorphic numbers, equation (5) becomes
4b^2-b=10x and b=4
For penta-automorphic numbers, equation (5) becomes
5b^2-b=10x and b=5


Initial computer studies were carried out by testing numbers in sequence for automorphic character. The programme listing is shown in Appendix 1 [3]. As might be expected run times were very long and only 16 automorphic numbers were generated in a run time of 3 hours [4]. These studies did however demonstrate two important properties of automorphic numbers.
1. Only two n-digit automorphic numbers exist for each value of n
2. Such numbers form two series in which successive members differ from their predecessors only in the leading digit.

The first 8 members are shown for example below
Series 1525625062590625890625289062512890625
Series 2676376937609376109376710937687109376
In order to convert an n-digit automorphic number into the corresponding (n+1)-digit automorphic number it is necessary only to test the digits 0 to 9 for suitability as the leading digit of the next number. This obviously facilitates the computer generation of automorphic numbers. Furthermore it appears from the above table that the sum of a pair of n-digit automorphic numbers is equal to 10^n+1 (see Conjecture A above), and therefore a sequence of automorphic numbers is uniquely determined by the corresponding pairing sequence.
Theorem 3 allows the calculation of the leading digit of the next automorphic number in the series. If for example p=625 then A*1249+390=10k implies A=0 giving 0625 as the next automorphic number in the sequence. If p=0625 then A*1249+39=10k gives A=9 making the next automorphic number in the sequence 90625.
Theorem 4 provides a simple alternative method for the calculation of the next leading digit in automorphic numbers terminating in the digit 6. If p=376 then p^2=141376 and m, the coefficient of 10^3 is equal to 1. Therefore A=10-1=9 giving 9376 as the 4 digit number.If p=9376 then p^2=87909376 and m the coefficient of 10^4 is equal to zero. Therefore A=10-0=10 giving 09376 as the 5-digit number. If p=625 then p^2=390625 and m, the coefficient of 10^3 is equal to zero giving 0625 as the 4-digit number.The same procedure gives 90625 as the 5-digit number in the sequence.

The programme listing for this procedure is shown in Appendix 2 [5]. Using this procedure, the series of automorphic numbers up to 20,000 digits in length was generated in a run time of 54 minutes. Repetition of the procedure using an AST 486DX running at 50Mhz generated automorphic numbers of up to 32,000 digits in length in a run time of 75 minutes. As a point of interest it may be noted that the leading ten digits and the trailing ten digits of the two 32,000-digit automorphic numbers are as follows:

Appendix 3 lists all the n-automorphic numbers to base b where b=2 to 10 and n=1 to b-1 [6]. The following points may be noted:
1. No base 2 automorphic numbers are apparent.
2. It is conjectured that an (n+1)-automorphic number to the base (n+2) is of the form:
.......nnn(n+1). For the cases n=5, b=6 and n=9, b=10 there are two accompanying numbers while single numbers only occur for all the other cases.

      and others................... 
[2] Note the timings given in this paper were from the initial work carried out approximately 20 years ago, and obviously would be very different if repeated these days.
[3] Unfortunately this appendix has been lost, if I find it I will add it here later for the sake of completeness.
[4] I have just run a very simple python script and using a brute force method it generated the first 16 in 128.222 seconds!
[5] Again this programme listing was not found, sparing people from seeing my lack of coding skills from 20 years ago!!
[6] The loss of this appendix is a great shame as this gives some interesting information. I will try to recreate this data at some time.