Accounts and expense module for MyClientBase
March 5, 2010 by: RanjithMyClientBase is a simple, intuitive, free and open source web based invoice management system.
Accounts and expense module is very simple module for MyClientBase, that adds capabilities to track your expenses and view the account status. It will be very helpful for small companies where you need not have any complex software to track your account.
Features List:
- Total payment received: Option to view sum of all payments received till date.
- Total pending payment: View summary amount of your pending invoices.
- Total expenses: View list of all expenses and summary of that.
- Account Balance: Calculated using expenses and received invoices.
- Add expense: Option where you can add detail of amount debited from your account.
Screen shots:

MyClientBase Accounts and expense module menu options

Account details view

Expense details

Add expense details
Install:
Download extract to the ./system/myclientbase/modules_custom/ folder and then go to System -> Modules and choose install action for Accounts and expense module module.
Download:
Accounts and expense module version 1.3
Released 10/10/2010
Change log:
BUGFIXES
- Fixed the issue with MyClientBase 0.8.6
ENHANCEMENTS
- Added from date and to date search option to Account details.
Accounts and expense module version 1.2
Released 31/03/2010
Change log:
BUGFIXES
- Fixed the issue with MyClientBase 0.7.2
ENHANCEMENTS
- Added links to Total Payment, Total Pending Payment, Total Expense in accounts view page
Accounts and expense module version 1.1
Released 06/03/2010
Change log:
BUGFIXES
- Fixed the issue with Add expense button
- Fixed the issue with cancel button in add expense page
ENHANCEMENTS
- Added currency symbol in accounts page
Accounts and expense module version 1.0
Released 06/03/2010


Thank you so much for this! It is simply perfect. Did you have to use codeignitor to build this?
Hi, Does it have a function to show the account and expense on the dashboard ?
Support for new versions..? (0.7.6 …..
Just wanted to share this error with your module upload to myclient 7.6.1
A Database Error Occurred
Error Number: 1054
Unknown column ‘unit_price’ in ‘field list’
SELECT SUM(unit_price) AS unit_price FROM (mcb_invoice_items)
Hi,
Looks promising but I am unable to get working on 0.8.1 version.
message reads “0.2.6 – Upgrade (1.2)” in modules page.
Also pre installed Task module disappears ??
Thank you.
i was just waiting for this module update.. thanks for updating……..JAI HO!
Just installed on MCB Ver 0.8.7. When you pick a date range under the “Reports View” the “Total Pending Payment” is zero despite the fact that there are some pending payments. Is this a bug or there is something that i am missing?
Hi,
i just installed mycb, and the expenses module.
i got this:
A PHP Error was encountered
Severity: Warning
Message: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Sao_Paulo’ for ‘BRST/-2.0/DST’ instead
Filename: helpers/mcb_date_helper.php
Line Number: 9
well, congrats all envolved, seems to be a really nice initiative.
i have some question, like internationalization and future features (possibility of import .ofx files), , but i need dig a little to have a better feel, anyway seems really a nice.
Best regards,
Hi,
it is really useful plugin. I am hving bit of problem with report section.. I am using MCB 0.8.8. it is not showing report and I think so display is not right either. can you have a look and suggest some solution for this. it will be much appriciated.
Thanks
Hello and thanks for sharing your module.
Does it work with MCB 0.9 version? I got only database errors and distorted menu. Reports doesn’t seem to come up at all.
Thanks
Hello,
It is due to change in database schema in the latest release of myclientbase that this module is not working.
If you are technical, go in the modules’ model and change the column names. It will work as expected.
You would also have to fix the names & links of the module as lang file doesn’t have all the values.
————————–
To Creator,
This is lovely module to have. But as the name suggested, it should have both accounts & expenses but it only has expenses.
Please share the accounts code too (even if it is broken) I might be able to fix it.
Thanks
Hardeep
MyClientBase is a total stuff-up.
It causes your database to crash
It causes shuffling your invoices around, distributing bits and pieces among clients
It gives you PHP error results all over your screen … and
It gives you arrogant replies like “that must have been an unpleasant experience to you and you client, huh?” –
form its “looser” creator “Jesse” ( a self-proclaimed Zweistein … double as smart as Einstein)
You want to make sure to stuff up your business, too? Then use his bug-driven software!
It’s free!
Hi everybody
As descript by Hardeep Singh, just replace some fieldnames in the accounts.php file: system/myclientbase/modules_custom/accounts/models/mdl_accounts.php
Please replace the whole text by this (make a copy before and don’t copy the number-sign):
######################################
table_name = ‘mcb_expenses’;
/* Define the primary key of the table. */
$this->primary_key = ‘mcb_expenses.expense_id’;
/* Define SQL_CALC_FOUND_ROWS * as a minimum for pagination. */
$this->select_fields = ”
SQL_CALC_FOUND_ROWS mcb_expenses.*”;
$this->order_by = ‘mcb_expenses.expense_date, mcb_expenses.expense_id DESC’;
}
function validate() {
$this->form_validation->set_rules(‘expense_date’, $this->lang->line(‘expense_date’), ‘required’);
$this->form_validation->set_rules(‘amount’, $this->lang->line(‘amount’), ‘required’);
$this->form_validation->set_rules(‘expense_for’, $this->lang->line(‘expense_for’), ‘required’);
return parent::validate();
}
function save() {
/* Prepare the default $db_array */
$db_array = parent::db_array();
if (isset($db_array['expense_date']) and $db_array['expense_date']) {
$db_array['expense_date'] = strtotime(standardize_date($db_array['expense_date']));
}
parent::save($db_array, uri_assoc(‘expense_id’, 3));
}
function prep_validation($key) {
/* First prepare the default validation */
parent::prep_validation($key);
if (!$_POST) {
if ($this->due_date) {
/* Convert to a human readable date if the unix timestamp exists. */
$this->due_date = format_date($this->due_date);
}
if ($this->complete_date) {
/* Convert to a human readable date if the unix timestamp exists. */
$this->complete_date = format_date($this->complete_date);
}
if ($this->expense_date) {
/* Convert to a human readable date if the unix timestamp exists. */
$this->expense_date = format_date($this->expense_date);
}
}
}
function delete($params) {
/* Run the standard delete function. */
parent::delete($params);
/*
* And delete records from mcb_expenses_invoices as well.
* This does NOT delete the actual invoices.
*/
}
function report(){
}
function total_payment($from_date=”,$to_date=”){
$this->db->select_sum(‘payment_amount’);
if($from_date!=”) $this->db->where(‘payment_date >=’,$from_date);
if($to_date!=”) $this->db->where(‘payment_date db->get(‘mcb_payments’);
$row = $query->row();
return $row->payment_amount;
}
function total_expense($from_date=”,$to_date=”){
$this->db->select_sum(‘amount’);
if($from_date!=”) $this->db->where(‘expense_date >=’,$from_date);
if($to_date!=”) $this->db->where(‘expense_date db->get(‘mcb_expenses’);
$row = $query->row();
return ”.$row->amount;
}
function total_expanse5($from_date,$to_date){
$this->db->select_sum(‘amount’);
if(($from_date!=FALSE)&&($to_date!=FALSE))
{
$this->db->where(‘expense_date >=’,strtotime(standardize_date($from_date)));
$this->db->where(‘expense_date db->get(‘mcb_expenses’);
$row = $query->row();
return ”.$row->amount;
}
function total_pending(){
$this->db->select_sum(‘invoice_balance_amount’);
$query = $this->db->get(‘invoice_balance’);
$row = $query->row();
return $row->invoice_balance_amount;
}
function balance($from_date,$to_date){
$amount = $this->total_payment($from_date,$to_date) – $this->total_expanse($from_date,$to_date);
return $amount;
}
function custome_total_pending($from_date=”,$to_date=”){
$amount_balance=0;
$this->db->select(‘invoice_id’);
//if($from_date!=”) $this->db->where(‘invoice_date_entered >=’,strtotime(standardize_date($from_date)));
if($to_date!=”) $this->db->where(‘invoice_date_entered db->get(‘mcb_invoices’);
foreach ($query->result() as $row)
{
$this->db->select(‘invoice_balance_amount’);
$this->db->where(‘invoice_id’,$row->invoice_id);
$query2 = $this->db->get(‘mcb_invoice_amounts’);
$row2 = $query2->row();
$amount_balance=$amount_balance+$row2->invoice_balance_amount ;
}
return $amount_balance;
}
}
?>
################################
Hope it helps some of you with this great extension (thank you Hardeep)!!!
@hedge: please don’t abuse this forum for such destructive sh.. MCB is a great free tool and nobody cares about your cynicism.
Hope it helps
Alex
I installed MCB about a week ago and thoroughly enjoy it. After discovering your module, I was very impressed with how much more it allowed me to track.
One question, though: I upgraded to the newest version of MCB this morning and ever since, am receiving a slew of PHP errors. Any hope for an updated version?
Thanks, again for an awesome addition to a great interface.
I’m testing out MyClientBase and also this module, but I belive there are some incompatiblity with MyClientBase 0.9.3 and module version 1.3. Getting a whole bunch of PHP errors.
We need more reports? Where is the beef?