README.txt | 22
TODO.txt | 5
system/application/assets/css/admin-style.css | 17
system/application/assets/css/custom.css | 92
system/application/assets/css/style.css | 22
system/application/assets/css/tables.css | 205 ++
system/application/assets/css/tufte-graph.css | 41
system/application/assets/images/buttons/navlink.png |binary
system/application/assets/images/icons/delete.png |binary
system/application/assets/images/icons/email.png |binary
system/application/assets/images/icons/match.png |binary
system/application/assets/images/icons/nomatch.png |binary
system/application/assets/js/custom.js | 1
system/application/assets/js/jquery.enumerable.js | 102 +
system/application/assets/js/jquery.tufte-graph.js | 233 ++
system/application/assets/js/raphael.js | 1690 ++++++++++++++++++
system/application/config/config.php | 16
system/application/controllers/admin/carryforward.sql | 5
system/application/controllers/admin/create.php | 36
system/application/controllers/admin/database.sql | 5
system/application/controllers/admin/manage.php | 158 +
system/application/controllers/admin/welcome.php | 1
system/application/controllers/report.php | 516 +++++
system/application/controllers/setting.php | 84
system/application/controllers/tag.php | 12
system/application/controllers/voucher.php | 111 -
system/application/controllers/welcome.php | 44
system/application/helpers/MY_date_helper.php | 116 +
system/application/helpers/csv_helper.php | 101 +
system/application/helpers/custom_helper.php | 28
system/application/libraries/Accountlist.php | 196 +-
system/application/libraries/MY_Form_validation.php | 18
system/application/models/tag_model.php | 31
system/application/views/account/index.php | 4
system/application/views/admin/create.php | 20
system/application/views/admin/manage/edit.php | 47
system/application/views/admin/manage/index.php | 17
system/application/views/admin_template.php | 4
system/application/views/report/balancesheet.php | 12
system/application/views/report/ledgerst.php | 65
system/application/views/report/profitandloss.php | 26
system/application/views/report/trialbalance.php | 9
system/application/views/setting/account.php | 16
system/application/views/sidebar/tag.php | 18
system/application/views/tag/index.php | 10
system/application/views/template.php | 28
system/application/views/voucher/add.php | 10
system/application/views/voucher/edit.php | 8
system/application/views/voucher/index.php | 5
system/application/views/voucher/view.php | 15
system/application/views/welcome_message.php | 158 +
todo.txt | 5
webzash-agpl-3.0.txt | 661 +++++++
webzash-copyright.txt | 24
54 files changed, 4785 insertions(+), 285 deletions(-)
New commits:
commit d6d0926f1897c673cb4572826b280bdff8804dc9
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 15:17:13 2010 +0530
Voucher date now is display in full months name
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 6d2ef11..d165dc4 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -157,7 +157,7 @@ class Voucher extends Controller {
$html .= ($row->draft == 1) ? " tr-draft " : "";
$html .= "\">";
- $html .= "<td>" . date_mysql_to_php($row->date) .
"</td>";
+ $html .= "<td>" . date_mysql_to_php_display($row->date) .
"</td>";
$html .= "<td>" . anchor('voucher/view/' .
strtolower($html_voucher_type) . "/" . $row->id, $row->number,
array('title' => 'View ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => 'blue-link')) . "</td>";
$html .= "<td>";
@@ -769,7 +769,7 @@ class Voucher extends Controller {
echo "<p><b>" . $account->name .
"</b></p>";
echo "<p>" . $account->address . "</p>";
echo "<p>Voucher Number : " . $cur_voucher->number .
"</p>";
- echo "<p>Voucher Date : " . date_mysql_to_php($cur_voucher->date) .
"</p>";
+ echo "<p>Voucher Date : " .
date_mysql_to_php_display($cur_voucher->date) . "</p>";
echo "<table border=1>";
echo "<thead><tr><th>Ledger A/C</th><th>Dr
Amount</th><th>Cr Amount</th></tr></thead>";
@@ -848,7 +848,7 @@ class Voucher extends Controller {
$message .= "<p><b>" .
$this->config->item('account_name') . "</b></p>";
$message .= "<p>" .
$this->config->item('account_address') . "</p>";
$message .= "<p>Voucher Number : " . $cur_voucher->number .
"</p>";
- $message .= "<p>Voucher Date : " .
date_mysql_to_php($cur_voucher->date) . "</p>";
+ $message .= "<p>Voucher Date : " .
date_mysql_to_php_display($cur_voucher->date) . "</p>";
$message .= "<table border=1>";
$message .= "<thead><tr><th>Ledger A/C</th><th>Dr
Amount</th><th>Cr Amount</th></tr></thead>";
diff --git a/system/application/helpers/MY_date_helper.php
b/system/application/helpers/MY_date_helper.php
index 06e6e62..cfb9674 100644
--- a/system/application/helpers/MY_date_helper.php
+++ b/system/application/helpers/MY_date_helper.php
@@ -80,6 +80,32 @@ if ( ! function_exists('date_mysql_to_php'))
}
}
+if ( ! function_exists('date_mysql_to_php_display'))
+{
+ function date_mysql_to_php_display($dt)
+ {
+ $ts = human_to_unix($dt);
+ $CI =& get_instance();
+ $current_date_format = $CI->config->item('account_date_format');
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ return date('d M Y', $ts);
+ break;
+ case 'mm/dd/yyyy':
+ return date('M d Y', $ts);
+ break;
+ case 'yyyy/mm/dd':
+ return date('Y M d', $ts);
+ break;
+ default:
+ $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
+ return;
+ }
+}
+
if ( ! function_exists('date_today_php'))
{
function date_today_php()
diff --git a/system/application/views/report/ledgerst.php
b/system/application/views/report/ledgerst.php
index bf113e9..78054ab 100644
--- a/system/application/views/report/ledgerst.php
+++ b/system/application/views/report/ledgerst.php
@@ -118,7 +118,7 @@
echo ($row->vdraft == 1) ? " tr-draft " : "";
echo "\">";
echo "<td>";
- echo date_mysql_to_php($row->vdate);
+ echo date_mysql_to_php_display($row->vdate);
echo "</td>";
echo "<td>";
echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, $row->vnumber, array('title' => 'View ' . '
Voucher', 'style' => 'color:#000000'));
diff --git a/system/application/views/voucher/view.php
b/system/application/views/voucher/view.php
index f85e5ba..2857822 100644
--- a/system/application/views/voucher/view.php
+++ b/system/application/views/voucher/view.php
@@ -1,6 +1,6 @@
<p>Voucher Number : <span class="bold"><?php echo
$cur_voucher->number; ?></span>
-Voucher Date : <span class="bold"><?php echo
date_mysql_to_php($cur_voucher->date); ?></span>
+Voucher Date : <span class="bold"><?php echo
date_mysql_to_php_display($cur_voucher->date); ?></span>
</p>
<table border=0 cellpadding=5 class="simple-table voucher-view-table">
commit 11b03279bc6d6ef317eda4653b9c4ea1b2eaf995
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 15:10:49 2010 +0530
Creating company will store the end time as end of day
Assessment Year End time is stored as 23 hrs 59 minutes 59 seconds
that marks the end of the day
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/create.php
b/system/application/controllers/admin/create.php
index 3c78750..8d3a036 100644
--- a/system/application/controllers/admin/create.php
+++ b/system/application/controllers/admin/create.php
@@ -179,7 +179,7 @@ class Create extends Controller {
$data_account_address = $this->input->post('account_address', TRUE);
$data_account_email = $this->input->post('account_email', TRUE);
$data_assy_start = date_php_to_mysql($this->input->post('assy_start',
TRUE));
- $data_assy_end = date_php_to_mysql($this->input->post('assy_end',
TRUE));
+ $data_assy_end =
date_php_to_mysql_end_time($this->input->post('assy_end', TRUE));
$data_account_currency = $this->input->post('account_currency', TRUE);
$data_account_date_form = $this->input->post('account_date', TRUE);
/* Checking for valid format */
commit 0e01c9506c806253fc835b20312b119f63d9e047
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 15:01:44 2010 +0530
Updated CF to calculate the start and end time
Calculating start and end time as per the current year
end time whatever the month and day may be
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 2b60bfa..44ee141 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -140,42 +140,13 @@ class Setting extends Controller {
$this->template->set('page_title', 'Carry forward account');
/* Form fields */
- $default_start_str = $this->config->item('account_ay_end');
- $default_start_year = date('Y', strtotime($default_start_str));
-
- $current_date_format = $this->config->item('account_date_format');
- switch ($current_date_format)
- {
- case 'dd/mm/yyyy':
- $default_start = date('d/m/Y', strtotime($default_start_str));
- break;
- case 'mm/dd/yyyy':
- $default_start = date('m/d/Y', strtotime($default_start_str));
- break;
- case 'yyyy/mm/dd':
- $default_start = date('Y/m/d', strtotime($default_start_str));
- break;
- default:
- $this->messages->add('Invalid date format. Please check your account
settings', 'error');
- return "";
- }
-
- $default_end_year = $default_start_year + 1;
- switch ($current_date_format)
- {
- case 'dd/mm/yyyy':
- $default_end = '31/03/' . $default_end_year;
- break;
- case 'mm/dd/yyyy':
- $default_end = '03/31/' . $default_end_year;
- break;
- case 'yyyy/mm/dd':
- $default_end = $default_end_year . '03/31';
- break;
- default:
- $this->messages->add('Invalid date format. Please check your account
settings', 'error');
- return "";
- }
+ $last_year_end = $this->config->item('account_ay_end');
+ list($last_year_end_date, $last_year_end_time) = explode(' ', $last_year_end);
+ list($last_year_end_year, $last_year_end_month, $last_year_end_day) =
explode('-', $last_year_end_date);
+ $last_year_end_ts = strtotime($last_year_end);
+ $default_start_ts = $last_year_end_ts + (60 * 60 * 24); /* Adding 24 hours */
+ $default_start = date("Y-m-d 00:00:00", $default_start_ts);
+ $default_end = ($last_year_end_year + 1) . "-" . $last_year_end_month .
"-" . $last_year_end_day . " 00:00:00";
/* Form fields */
$data['account_label'] = array(
@@ -197,14 +168,14 @@ class Setting extends Controller {
'id' => 'assy_start',
'maxlength' => '11',
'size' => '11',
- 'value' => $default_start,
+ 'value' => date_mysql_to_php($default_start),
);
$data['assy_end'] = array(
'name' => 'assy_end',
'id' => 'assy_end',
'maxlength' => '11',
'size' => '11',
- 'value' => $default_end,
+ 'value' => date_mysql_to_php($default_end),
);
$data['database_name'] = array(
@@ -289,7 +260,7 @@ class Setting extends Controller {
$data_account_address = $this->config->item('account_address');
$data_account_email = $this->config->item('account_email');
$data_assy_start = date_php_to_mysql($this->input->post('assy_start',
TRUE));
- $data_assy_end = date_php_to_mysql($this->input->post('assy_end',
TRUE));
+ $data_assy_end =
date_php_to_mysql_end_time($this->input->post('assy_end', TRUE));
$data_account_currency =
$this->config->item('account_currency_symbol');
$data_account_date = $this->config->item('account_date_format');
$data_account_timezone = $this->config->item('account_timezone');
diff --git a/system/application/helpers/MY_date_helper.php
b/system/application/helpers/MY_date_helper.php
index ea40c07..06e6e62 100644
--- a/system/application/helpers/MY_date_helper.php
+++ b/system/application/helpers/MY_date_helper.php
@@ -27,6 +27,33 @@ if ( ! function_exists('date_php_to_mysql'))
}
}
+if ( ! function_exists('date_php_to_mysql_end_time'))
+{
+ function date_php_to_mysql_end_time($dt)
+ {
+ $CI =& get_instance();
+ $current_date_format = $CI->config->item('account_date_format');
+ list($d, $m, $y) = array(0, 0, 0);
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ list($d, $m, $y) = explode('/', $dt);
+ break;
+ case 'mm/dd/yyyy':
+ list($m, $d, $y) = explode('/', $dt);
+ break;
+ case 'yyyy/mm/dd':
+ list($y, $m, $d) = explode('/', $dt);
+ break;
+ default:
+ $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
+ $ts = mktime("23", "59", "59", $m, $d, $y);
+ return date('Y-m-d H:i:s', $ts);
+ }
+}
+
if ( ! function_exists('date_mysql_to_php'))
{
function date_mysql_to_php($dt)
commit 74d345eb4e7d38cb7189a3ff0dd81c03355d92f0
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 14:25:01 2010 +0530
Updated CF account to use the current date format
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 48bfdd2..2b60bfa 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -142,10 +142,40 @@ class Setting extends Controller {
/* Form fields */
$default_start_str = $this->config->item('account_ay_end');
$default_start_year = date('Y', strtotime($default_start_str));
- $default_start = date('d/m/Y', strtotime($default_start_str));
+
+ $current_date_format = $this->config->item('account_date_format');
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ $default_start = date('d/m/Y', strtotime($default_start_str));
+ break;
+ case 'mm/dd/yyyy':
+ $default_start = date('m/d/Y', strtotime($default_start_str));
+ break;
+ case 'yyyy/mm/dd':
+ $default_start = date('Y/m/d', strtotime($default_start_str));
+ break;
+ default:
+ $this->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
$default_end_year = $default_start_year + 1;
- $default_end = '31/03/' . $default_end_year;
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ $default_end = '31/03/' . $default_end_year;
+ break;
+ case 'mm/dd/yyyy':
+ $default_end = '03/31/' . $default_end_year;
+ break;
+ case 'yyyy/mm/dd':
+ $default_end = $default_end_year . '03/31';
+ break;
+ default:
+ $this->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
/* Form fields */
$data['account_label'] = array(
commit f875949795f552a0f36808b115754a46f3ea5974
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 14:13:34 2010 +0530
Updated date formats
- Removed change of date from account settings
- Added notice that cannot change date in account creation
- Moved date picker js code to template
- Dynamic date validation when creating account as per date format
- No need to check account settings in update settings code
- Moved Date format before assessment year when creating account
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/js/custom.js
b/system/application/assets/js/custom.js
index d10ab05..64dfbad 100644
--- a/system/application/assets/js/custom.js
+++ b/system/application/assets/js/custom.js
@@ -13,7 +13,6 @@ $(document).ready(function() {
return false;
}
});
- $('.datepicker').datepick({dateFormat: 'dd/mm/yyyy'});
})
diff --git a/system/application/controllers/admin/create.php
b/system/application/controllers/admin/create.php
index 800103f..3c78750 100644
--- a/system/application/controllers/admin/create.php
+++ b/system/application/controllers/admin/create.php
@@ -129,8 +129,12 @@ class Create extends Controller {
$this->form_validation->set_rules('account_name', 'Account Name',
'trim|required|min_length[2]|max_length[100]');
$this->form_validation->set_rules('account_address', 'Account
Address', 'trim|max_length[255]');
$this->form_validation->set_rules('account_email', 'Account
Email', 'trim|valid_email');
- $this->form_validation->set_rules('assy_start', 'Assessment Year
Start', 'trim|required|is_date');
- $this->form_validation->set_rules('assy_end', 'Assessment Year
End', 'trim|required|is_date');
+ if ($_POST)
+ {
+ $this->config->set_item('account_date_format',
$this->input->post('account_date', TRUE));
+ $this->form_validation->set_rules('assy_start', 'Assessment Year
Start', 'trim|required|is_date');
+ $this->form_validation->set_rules('assy_end', 'Assessment Year
End', 'trim|required|is_date');
+ }
$this->form_validation->set_rules('account_currency', 'Currency',
'trim|max_length[10]');
$this->form_validation->set_rules('account_date', 'Date',
'trim|max_length[10]');
$this->form_validation->set_rules('account_timezone', 'Timezone',
'trim|max_length[6]');
diff --git a/system/application/controllers/admin/welcome.php
b/system/application/controllers/admin/welcome.php
index d279695..87004dd 100644
--- a/system/application/controllers/admin/welcome.php
+++ b/system/application/controllers/admin/welcome.php
@@ -119,6 +119,7 @@ class Welcome extends Controller {
$account_q = $this->db->query('SELECT * FROM settings WHERE id =
1');
if ($account_d = $account_q->row())
{
+ $this->config->set_item('account_date_format',
$account_d->date_format);
$data['current_account'] .= "Currently active account is ";
$data['current_account'] .= "<b>" . $account_d->name .
"</b>";
$data['current_account'] .= " from " . "<b>" .
date_mysql_to_php($account_d->ay_start) . "</b>";
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index fdcf151..48bfdd2 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -54,20 +54,10 @@ class Setting extends Controller {
'size' => '40',
'value' => ($account_data) ? echo_value($account_data->email) :
'',
);
- $data['assy_start'] = array(
- 'name' => 'assy_start',
- 'id' => 'assy_start',
- 'maxlength' => '11',
- 'size' => '11',
- 'value' => ($account_data) ?
date_mysql_to_php(echo_value($account_data->ay_start)) : $default_start,
- );
- $data['assy_end'] = array(
- 'name' => 'assy_end',
- 'id' => 'assy_end',
- 'maxlength' => '11',
- 'size' => '11',
- 'value' => ($account_data) ?
date_mysql_to_php(echo_value($account_data->ay_end)) : $default_end,
- );
+
+ $data['assy_start'] = ($account_data) ?
date_mysql_to_php(echo_value($account_data->ay_start)) : "error";
+ $data['assy_end'] = ($account_data) ?
date_mysql_to_php(echo_value($account_data->ay_end)) : "error";
+
$data['account_currency'] = array(
'name' => 'account_currency',
'id' => 'account_currency',
@@ -87,8 +77,6 @@ class Setting extends Controller {
$this->form_validation->set_rules('account_name', 'Account Name',
'trim|required|min_length[2]|max_length[100]');
$this->form_validation->set_rules('account_address', 'Account
Address', 'trim|max_length[255]');
$this->form_validation->set_rules('account_email', 'Account
Email', 'trim|valid_email');
- $this->form_validation->set_rules('assy_start', 'Assessment Year
Start', 'trim|required|is_date');
- $this->form_validation->set_rules('assy_end', 'Assessment Year
End', 'trim|required|is_date');
$this->form_validation->set_rules('account_currency', 'Currency',
'trim|max_length[10]');
$this->form_validation->set_rules('account_date', 'Date',
'trim|max_length[10]');
$this->form_validation->set_rules('account_timezone', 'Timezone',
'trim|max_length[6]');
@@ -99,8 +87,6 @@ class Setting extends Controller {
$data['account_name']['value'] =
$this->input->post('account_name', TRUE);
$data['account_address']['value'] =
$this->input->post('account_address', TRUE);
$data['account_email']['value'] =
$this->input->post('account_email', TRUE);
- $data['assy_start']['value'] =
$this->input->post('assy_start', TRUE);
- $data['assy_end']['value'] =
$this->input->post('assy_end', TRUE);
$data['account_currency']['value'] =
$this->input->post('account_currency', TRUE);
$data['account_date'] = $this->input->post('account_date',
TRUE);
$data['account_timezone'] =
$this->input->post('account_timezone', TRUE);
@@ -118,8 +104,6 @@ class Setting extends Controller {
$data_account_name = $this->input->post('account_name', TRUE);
$data_account_address = $this->input->post('account_address', TRUE);
$data_account_email = $this->input->post('account_email', TRUE);
- $data_assy_start = date_php_to_mysql($this->input->post('assy_start',
TRUE));
- $data_assy_end = date_php_to_mysql($this->input->post('assy_end',
TRUE));
$data_account_currency = $this->input->post('account_currency', TRUE);
$data_account_date_form = $this->input->post('account_date', TRUE);
/* Checking for valid format */
@@ -133,21 +117,8 @@ class Setting extends Controller {
$data_account_date = "dd/mm/yyyy";
$data_account_timezone = $this->input->post('timezones', TRUE);
- /* Verify if current settings exist. If not add new settings */
- $current = $this->Setting_model->get_current();
- if ( ! $current)
- {
- $this->messages->add('Current settings were not valid',
'message');
- if ( ! $this->db->query("INSERT INTO settings (id, name, address, email,
ay_start, ay_end, currency_symbol, date_format, timezone) VALUES (1, ?, ?, ?, ?, ?, ?, ?,
?)", array($data_account_name, $data_account_address, $data_account_email,
$data_assy_start, $data_assy_end, $data_account_currency, $data_account_date,
$data_account_timezone)))
- {
- $this->messages->add('Error adding new settings', 'error');
- $this->template->load('template', 'setting/account', $data);
- return;
- }
- }
-
/* Update settings */
- if ( ! $this->db->query("UPDATE settings SET name = ?, address = ?, email =
?, ay_start = ?, ay_end = ?, currency_symbol = ?, date_format = ?, timezone = ? WHERE id =
1", array($data_account_name, $data_account_address, $data_account_email,
$data_assy_start, $data_assy_end, $data_account_currency, $data_account_date,
$data_account_timezone)))
+ if ( ! $this->db->query("UPDATE settings SET name = ?, address = ?, email =
?, currency_symbol = ?, date_format = ?, timezone = ? WHERE id = 1",
array($data_account_name, $data_account_address, $data_account_email,
$data_account_currency, $data_account_date, $data_account_timezone)))
{
$this->messages->add('Error updating settings', 'error');
$this->template->load('template', 'setting/account', $data);
diff --git a/system/application/views/admin/create.php
b/system/application/views/admin/create.php
index f8e548f..983faf7 100644
--- a/system/application/views/admin/create.php
+++ b/system/application/views/admin/create.php
@@ -28,27 +28,31 @@
echo "</p>";
echo "<p>";
- echo form_label('Assessment Year Start', 'assy_start');
+ echo form_label('Currency', 'account_currency');
echo "<br />";
- echo form_input_date($assy_start);
+ echo form_input($account_currency);
echo "</p>";
echo "<p>";
- echo form_label('Assessment Year End', 'assy_end');
+ echo form_label('Date Format', 'account_date');
echo "<br />";
- echo form_input_date($assy_end);
+ echo form_dropdown('account_date', $account_date_options, $account_date);
echo "</p>";
echo "<p>";
- echo form_label('Currency', 'account_currency');
+ echo form_label('Assessment Year Start', 'assy_start');
echo "<br />";
- echo form_input($account_currency);
+ echo form_input_date($assy_start);
+ echo "<br />";
+ echo "<span class=\"form-help-text\">Warning : Assessment Year
Start cannot be changed later</span>";
echo "</p>";
echo "<p>";
- echo form_label('Date Format', 'account_date');
+ echo form_label('Assessment Year End', 'assy_end');
echo "<br />";
- echo form_dropdown('account_date', $account_date_options, $account_date);
+ echo form_input_date($assy_end);
+ echo "<br />";
+ echo "<span class=\"form-help-text\">Warning : Assessment Year End
cannot be changed later</span>";
echo "</p>";
echo "<p>";
diff --git a/system/application/views/setting/account.php
b/system/application/views/setting/account.php
index d9783bb..a4a5647 100644
--- a/system/application/views/setting/account.php
+++ b/system/application/views/setting/account.php
@@ -20,27 +20,27 @@
echo "</p>";
echo "<p>";
- echo form_label('Assessment Year Start', 'assy_start');
+ echo form_label('Currency', 'account_currency');
echo "<br />";
- echo form_input_date($assy_start);
+ echo form_input($account_currency);
echo "</p>";
echo "<p>";
- echo form_label('Assessment Year End', 'assy_end');
+ echo form_label('Date Format', 'account_date');
echo "<br />";
- echo form_input_date($assy_end);
+ echo form_dropdown('account_date', $account_date_options, $account_date);
echo "</p>";
echo "<p>";
- echo form_label('Currency', 'account_currency');
+ echo form_label('Assessment Year Start', 'assy_start');
echo "<br />";
- echo form_input($account_currency);
+ echo $assy_start;
echo "</p>";
echo "<p>";
- echo form_label('Date Format', 'account_date');
+ echo form_label('Assessment Year End', 'assy_end');
echo "<br />";
- echo form_dropdown('account_date', $account_date_options, $account_date);
+ echo $assy_end;
echo "</p>";
echo "<p>";
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 51a5aa8..52cb6a5 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -46,6 +46,7 @@ $(document).ready(function() {
maxWidth:27,
extraWidth: 1
}).superfish(); // call supersubs first, then superfish, so that subs are
+ $('.datepicker').datepick({dateFormat: '<?php echo
$this->config->item('account_date_format'); ?>'});
});
</script>
commit 6657fce62702d92a46c577597795798b6fe9a5dc
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 13:36:55 2010 +0530
Date Validation now uses date formats
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/libraries/MY_Form_validation.php
b/system/application/libraries/MY_Form_validation.php
index f28ff7e..b06eef2 100644
--- a/system/application/libraries/MY_Form_validation.php
+++ b/system/application/libraries/MY_Form_validation.php
@@ -95,7 +95,23 @@ class MY_Form_validation extends CI_Form_validation {
$CI->form_validation->set_message('is_date', 'The %s is a invalid
date');
- list($d, $m, $y) = explode('/', $str);
+ $current_date_format = $CI->config->item('account_date_format');
+ list($d, $m, $y) = array(0, 0, 0);
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ list($d, $m, $y) = explode('/', $str);
+ break;
+ case 'mm/dd/yyyy':
+ list($m, $d, $y) = explode('/', $str);
+ break;
+ case 'yyyy/mm/dd':
+ list($y, $m, $d) = explode('/', $str);
+ break;
+ default:
+ $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
return checkdate($m , $d, $y) ? TRUE : FALSE;
}
commit 054e55cfe9a6c3f7ad2f54683beeb1cab2152770
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 12:29:39 2010 +0530
Updated date helper to support the date formats
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/helpers/MY_date_helper.php
b/system/application/helpers/MY_date_helper.php
index 0bbdfb2..ea40c07 100644
--- a/system/application/helpers/MY_date_helper.php
+++ b/system/application/helpers/MY_date_helper.php
@@ -4,20 +4,77 @@ if ( ! function_exists('date_php_to_mysql'))
{
function date_php_to_mysql($dt)
{
- list($d, $m, $y) = explode('/', $dt);
+ $CI =& get_instance();
+ $current_date_format = $CI->config->item('account_date_format');
+ list($d, $m, $y) = array(0, 0, 0);
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ list($d, $m, $y) = explode('/', $dt);
+ break;
+ case 'mm/dd/yyyy':
+ list($m, $d, $y) = explode('/', $dt);
+ break;
+ case 'yyyy/mm/dd':
+ list($y, $m, $d) = explode('/', $dt);
+ break;
+ default:
+ $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
$ts = mktime(0, 0, 0, $m, $d, $y);
return date('Y-m-d H:i:s', $ts);
}
+}
+if ( ! function_exists('date_mysql_to_php'))
+{
function date_mysql_to_php($dt)
{
$ts = human_to_unix($dt);
- return date('d/m/Y', $ts);
+ $CI =& get_instance();
+ $current_date_format = $CI->config->item('account_date_format');
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ return date('d/m/Y', $ts);
+ break;
+ case 'mm/dd/yyyy':
+ return date('m/d/Y', $ts);
+ break;
+ case 'yyyy/mm/dd':
+ return date('Y/m/d', $ts);
+ break;
+ default:
+ $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
+ return;
}
+}
+if ( ! function_exists('date_today_php'))
+{
function date_today_php()
{
- return date('d/m/Y');
+ $CI =& get_instance();
+ $current_date_format = $CI->config->item('account_date_format');
+ switch ($current_date_format)
+ {
+ case 'dd/mm/yyyy':
+ return date('d/m/Y');
+ break;
+ case 'mm/dd/yyyy':
+ return date('m/d/Y');
+ break;
+ case 'yyyy/mm/dd':
+ return date('Y/m/d');
+ break;
+ default:
+ $CI->messages->add('Invalid date format. Please check your account
settings', 'error');
+ return "";
+ }
+ return;
}
}
commit 578c7db6ac70c4b9f5d0eba881d09820bceac44c
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Sat Dec 11 12:14:28 2010 +0530
Added date selection option when creating and updating account
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/create.php
b/system/application/controllers/admin/create.php
index 456a742..800103f 100644
--- a/system/application/controllers/admin/create.php
+++ b/system/application/controllers/admin/create.php
@@ -75,13 +75,12 @@ class Create extends Controller {
'size' => '10',
'value' => '',
);
- $data['account_date'] = array(
- 'name' => 'account_date',
- 'id' => 'account_date',
- 'maxlength' => '20',
- 'size' => '10',
- 'value' => '',
+ $data['account_date_options'] = array(
+ 'dd/mm/yyyy' => 'Day / Month / Year',
+ 'mm/dd/yyyy' => 'Month / Day / Year',
+ 'yyyy/mm/dd' => 'Year / Month / Day',
);
+ $data['account_date'] = 'dd/mm/yyyy';
$data['account_timezone'] = 'UTC';
$data['database_name'] = array(
@@ -133,7 +132,7 @@ class Create extends Controller {
$this->form_validation->set_rules('assy_start', 'Assessment Year
Start', 'trim|required|is_date');
$this->form_validation->set_rules('assy_end', 'Assessment Year
End', 'trim|required|is_date');
$this->form_validation->set_rules('account_currency', 'Currency',
'trim|max_length[10]');
- $this->form_validation->set_rules('account_date', 'Date',
'trim|max_length[30]');
+ $this->form_validation->set_rules('account_date', 'Date',
'trim|max_length[10]');
$this->form_validation->set_rules('account_timezone', 'Timezone',
'trim|max_length[6]');
@@ -150,7 +149,7 @@ class Create extends Controller {
$data['assy_start']['value'] =
$this->input->post('assy_start', TRUE);
$data['assy_end']['value'] =
$this->input->post('assy_end', TRUE);
$data['account_currency']['value'] =
$this->input->post('account_currency', TRUE);
- $data['account_date']['value'] =
$this->input->post('account_date', TRUE);
+ $data['account_date'] = $this->input->post('account_date',
TRUE);
$data['account_timezone'] =
$this->input->post('account_timezone', TRUE);
$data['create_database'] = $this->input->post('create_database',
TRUE);
@@ -178,7 +177,16 @@ class Create extends Controller {
$data_assy_start = date_php_to_mysql($this->input->post('assy_start',
TRUE));
$data_assy_end = date_php_to_mysql($this->input->post('assy_end',
TRUE));
$data_account_currency = $this->input->post('account_currency', TRUE);
- $data_account_date = $this->input->post('account_date', TRUE);
+ $data_account_date_form = $this->input->post('account_date', TRUE);
+ /* Checking for valid format */
+ if ($data_account_date_form == "dd/mm/yyyy")
+ $data_account_date = "dd/mm/yyyy";
+ else if ($data_account_date_form == "mm/dd/yyyy")
+ $data_account_date = "mm/dd/yyyy";
+ else if ($data_account_date_form == "yyyy/mm/dd")
+ $data_account_date = "yyyy/mm/dd";
+ else
+ $data_account_date = "dd/mm/yyyy";
$data_account_timezone = $this->input->post('timezones', TRUE);
$data_database_host = $this->input->post('database_host', TRUE);
diff --git a/system/application/controllers/setting.php
b/system/application/controllers/setting.php
index 347e334..fdcf151 100644
--- a/system/application/controllers/setting.php
+++ b/system/application/controllers/setting.php
@@ -75,13 +75,12 @@ class Setting extends Controller {
'size' => '10',
'value' => ($account_data) ? echo_value($account_data->currency_symbol)
: '',
);
- $data['account_date'] = array(
- 'name' => 'account_date',
- 'id' => 'account_date',
- 'maxlength' => '20',
- 'size' => '10',
- 'value' => ($account_data) ? echo_value($account_data->date_format) :
'',
+ $data['account_date_options'] = array(
+ 'dd/mm/yyyy' => 'Day / Month / Year',
+ 'mm/dd/yyyy' => 'Month / Day / Year',
+ 'yyyy/mm/dd' => 'Year / Month / Day',
);
+ $data['account_date'] = ($account_data) ?
echo_value($account_data->date_format) : 'dd/mm/yyyy';
$data['account_timezone'] = ($account_data) ?
echo_value($account_data->timezone) : 'UTC';
/* Form validations */
@@ -91,7 +90,7 @@ class Setting extends Controller {
$this->form_validation->set_rules('assy_start', 'Assessment Year
Start', 'trim|required|is_date');
$this->form_validation->set_rules('assy_end', 'Assessment Year
End', 'trim|required|is_date');
$this->form_validation->set_rules('account_currency', 'Currency',
'trim|max_length[10]');
- $this->form_validation->set_rules('account_date', 'Date',
'trim|max_length[30]');
+ $this->form_validation->set_rules('account_date', 'Date',
'trim|max_length[10]');
$this->form_validation->set_rules('account_timezone', 'Timezone',
'trim|max_length[6]');
/* Repopulating form */
@@ -103,7 +102,7 @@ class Setting extends Controller {
$data['assy_start']['value'] =
$this->input->post('assy_start', TRUE);
$data['assy_end']['value'] =
$this->input->post('assy_end', TRUE);
$data['account_currency']['value'] =
$this->input->post('account_currency', TRUE);
- $data['account_date']['value'] =
$this->input->post('account_date', TRUE);
+ $data['account_date'] = $this->input->post('account_date',
TRUE);
$data['account_timezone'] =
$this->input->post('account_timezone', TRUE);
}
@@ -122,7 +121,16 @@ class Setting extends Controller {
$data_assy_start = date_php_to_mysql($this->input->post('assy_start',
TRUE));
$data_assy_end = date_php_to_mysql($this->input->post('assy_end',
TRUE));
$data_account_currency = $this->input->post('account_currency', TRUE);
- $data_account_date = $this->input->post('account_date', TRUE);
+ $data_account_date_form = $this->input->post('account_date', TRUE);
+ /* Checking for valid format */
+ if ($data_account_date_form == "dd/mm/yyyy")
+ $data_account_date = "dd/mm/yyyy";
+ else if ($data_account_date_form == "mm/dd/yyyy")
+ $data_account_date = "mm/dd/yyyy";
+ else if ($data_account_date_form == "yyyy/mm/dd")
+ $data_account_date = "yyyy/mm/dd";
+ else
+ $data_account_date = "dd/mm/yyyy";
$data_account_timezone = $this->input->post('timezones', TRUE);
/* Verify if current settings exist. If not add new settings */
diff --git a/system/application/helpers/custom_helper.php
b/system/application/helpers/custom_helper.php
index d16070b..07ace36 100644
--- a/system/application/helpers/custom_helper.php
+++ b/system/application/helpers/custom_helper.php
@@ -52,34 +52,6 @@ if ( ! function_exists('echo_value'))
}
/**
- * Return Account Information
- *
- * Return the account information
- *
- * @access public
- * @param a varaible
- * @return string value
- */
-if ( ! function_exists('account_info_str'))
-{
- function account_info_str()
- {
- $html = "";
- $CI =& get_instance();
- $company_q = $CI->db->query('SELECT * FROM settings WHERE id = 1');
- if ($company_info = $company_q->row())
- {
- $html .= $company_info->name;
- $html .= "<br />";
- $html .= date_mysql_to_php($company_info->ay_start);
- $html .= " - ";
- $html .= date_mysql_to_php($company_info->ay_end);
- }
- return $html;
- }
-}
-
-/**
* Return Voucher Type String from Number
*
* Return the account information
diff --git a/system/application/views/admin/create.php
b/system/application/views/admin/create.php
index 8d93454..f8e548f 100644
--- a/system/application/views/admin/create.php
+++ b/system/application/views/admin/create.php
@@ -48,7 +48,7 @@
echo "<p>";
echo form_label('Date Format', 'account_date');
echo "<br />";
- echo form_input($account_date);
+ echo form_dropdown('account_date', $account_date_options, $account_date);
echo "</p>";
echo "<p>";
diff --git a/system/application/views/setting/account.php
b/system/application/views/setting/account.php
index 70687b4..d9783bb 100644
--- a/system/application/views/setting/account.php
+++ b/system/application/views/setting/account.php
@@ -40,7 +40,7 @@
echo "<p>";
echo form_label('Date Format', 'account_date');
echo "<br />";
- echo form_input($account_date);
+ echo form_dropdown('account_date', $account_date_options, $account_date);
echo "</p>";
echo "<p>";
commit a8a3d10dcc0d2431028eba9a9f9ad768a0276d23
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 9 22:04:34 2010 +0530
Added beta tag
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 51953b2..51a5aa8 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -54,7 +54,7 @@ $(document).ready(function() {
<div id="container">
<div id="header">
<div id="logo">
- Webzash
+ Webzash <span
style="font-size:18px;color:#00000;">(beta)</span>
</div>
<div id="admin">
<?php echo anchor('admin', 'Administer', array('title'
=> "Administer", 'style' => 'color:#000000;
text-decoration:none')); ?>
commit f16eb0895d3450f12de376ad6b2ccc2cfaa67025
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 9 21:44:38 2010 +0530
Added Profit and Loss Statment Download CSV
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/report.php
b/system/application/controllers/report.php
index 4326bc2..158b366 100644
--- a/system/application/controllers/report.php
+++ b/system/application/controllers/report.php
@@ -28,6 +28,7 @@ class Report extends Controller {
function profitandloss($period = NULL)
{
$this->template->set('page_title', 'Profit And Loss Statement');
+ $this->template->set('nav_links',
array('report/download/profitandloss' => 'Download CSV'));
$this->template->load('template', 'report/profitandloss');
return;
}
@@ -417,6 +418,152 @@ class Report extends Controller {
return;
}
+ /********************** PROFIT AND LOSS ***********************/
+ if ($statement == "profitandloss")
+ {
+ $this->load->library('accountlist');
+ $this->load->model('Ledger_model');
+
+ /***************** GROSS CALCULATION ******************/
+
+ /* Gross P/L : Expenses */
+ $gross_expense_total = 0;
+ $gross_expense_list_q = $this->db->query("SELECT * FROM groups WHERE
parent_id = 4 AND affects_gross = 1");
+ foreach ($gross_expense_list_q->result() as $row)
+ {
+ $gross_expense = new Accountlist();
+ $gross_expense->init($row->id);
+ $gross_expense_total += $gross_expense->total;
+ $gross_exp_array = $gross_expense->build_array();
+ $gross_expense->to_csv($gross_exp_array);
+ }
+ Accountlist::add_blank_csv();
+
+ /* Gross P/L : Incomes */
+ $gross_income_total = 0;
+ $gross_income_list_q = $this->db->query("SELECT * FROM groups WHERE
parent_id = 3 AND affects_gross = 1");
+ foreach ($gross_income_list_q->result() as $row)
+ {
+ $gross_income = new Accountlist();
+ $gross_income->init($row->id);
+ $gross_income_total += $gross_income->total;
+ $gross_inc_array = $gross_income->build_array();
+ $gross_income->to_csv($gross_inc_array);
+ }
+
+ Accountlist::add_blank_csv();
+ Accountlist::add_blank_csv();
+
+ /* Converting to positive value since Cr */
+ $gross_income_total = -$gross_income_total;
+
+ /* Calculating Gross P/L */
+ $grosspl = $gross_income_total - $gross_expense_total;
+
+ /* Showing Gross P/L : Expenses */
+ $grosstotal = $gross_expense_total;
+ Accountlist::add_row_csv(array("Total Gross Expenses",
convert_cur($gross_expense_total)));
+ if ($grosspl > 0)
+ {
+ $grosstotal += $grosspl;
+ Accountlist::add_row_csv(array("Gross Profit C/O",
convert_cur($grosspl)));
+ }
+ Accountlist::add_row_csv(array("Total Expenses - Gross",
convert_cur($grosstotal)));
+
+ /* Showing Gross P/L : Incomes */
+ $grosstotal = $gross_income_total;
+ Accountlist::add_row_csv(array("Total Gross Incomes",
convert_cur($gross_income_total)));
+
+ if ($grosspl > 0)
+ {
+
+ } else if ($grosspl < 0) {
+ $grosstotal += -$grosspl;
+ Accountlist::add_row_csv(array("Gross Loss C/O", convert_cur(-$grosspl)));
+ }
+ Accountlist::add_row_csv(array("Total Incomes - Gross",
convert_cur($grosstotal)));
+
+ /************************* NET CALCULATIONS ***************************/
+
+ Accountlist::add_blank_csv();
+ Accountlist::add_blank_csv();
+
+ /* Net P/L : Expenses */
+ $net_expense_total = 0;
+ $net_expense_list_q = $this->db->query("SELECT * FROM groups WHERE
parent_id = 4 AND affects_gross != 1");
+
+ foreach ($net_expense_list_q->result() as $row)
+ {
+ $net_expense = new Accountlist();
+ $net_expense->init($row->id);
+ $net_expense_total += $net_expense->total;
+ $net_exp_array = $net_expense->build_array();
+ $net_expense->to_csv($net_exp_array);
+ }
+ Accountlist::add_blank_csv();
+
+ /* Net P/L : Incomes */
+ $net_income_total = 0;
+ $net_income_list_q = $this->db->query("SELECT * FROM groups WHERE parent_id
= 3 AND affects_gross != 1");
+ foreach ($net_income_list_q->result() as $row)
+ {
+ $net_income = new Accountlist();
+ $net_income->init($row->id);
+ $net_income_total += $net_income->total;
+ $net_inc_array = $net_income->build_array();
+ $net_income->to_csv($net_inc_array);
+ }
+
+ Accountlist::add_blank_csv();
+ Accountlist::add_blank_csv();
+
+ /* Converting to positive value since Cr */
+ $net_income_total = -$net_income_total;
+
+ /* Calculating Net P/L */
+ $netpl = $net_income_total - $net_expense_total + $grosspl;
+
+ /* Showing Net P/L : Expenses */
+ $nettotal = $net_expense_total;
+ Accountlist::add_row_csv(array("Total Expenses", convert_cur($nettotal)));
+
+ if ($grosspl > 0)
+ {
+ } else if ($grosspl < 0) {
+ $nettotal += -$grosspl;
+ Accountlist::add_row_csv(array("Gross Loss B/F", convert_cur(-$grosspl)));
+ }
+ if ($netpl > 0)
+ {
+ $nettotal += $netpl;
+ Accountlist::add_row_csv(array("Net Profit", convert_cur($netpl)));
+ }
+ Accountlist::add_row_csv(array("Total - Net Expenses",
convert_cur($nettotal)));
+
+ /* Showing Net P/L : Incomes */
+ $nettotal = $net_income_total;
+ Accountlist::add_row_csv(array("Total Incomes", convert_cur($nettotal)));
+
+ if ($grosspl > 0)
+ {
+ $nettotal += $grosspl;
+ Accountlist::add_row_csv(array("Gross Profit B/F",
convert_cur($grosspl)));
+ }
+
+ if ($netpl > 0)
+ {
+
+ } else if ($netpl < 0) {
+ $nettotal += -$netpl;
+ Accountlist::add_row_csv(array("Net Loss", convert_cur(-$netpl)));
+ }
+ Accountlist::add_row_csv(array("Total - Net Incomes",
convert_cur($nettotal)));
+
+ $balancesheet = Accountlist::get_csv();
+ $this->load->helper('csv');
+ echo array_to_csv($balancesheet, "profitandloss.csv");
+ return;
+ }
return;
}
}
commit b733db9d8195cb38a4d6bbb86cdcb650c88dfed5
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 9 19:46:41 2010 +0530
Added Balance Sheet Download CSV
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/report.php
b/system/application/controllers/report.php
index eb0ea64..4326bc2 100644
--- a/system/application/controllers/report.php
+++ b/system/application/controllers/report.php
@@ -20,6 +20,7 @@ class Report extends Controller {
function balancesheet($period = NULL)
{
$this->template->set('page_title', 'Balance Sheet');
+ $this->template->set('nav_links',
array('report/download/balancesheet' => 'Download CSV'));
$this->template->load('template', 'report/balancesheet');
return;
}
@@ -323,6 +324,99 @@ class Report extends Controller {
echo array_to_csv($ledgerst, "ledgerst.csv");
return;
}
+
+ /************************ BALANCE SHEET ***********************/
+ if ($statement == "balancesheet")
+ {
+ $this->load->library('accountlist');
+ $this->load->model('Ledger_model');
+
+ $liability = new Accountlist();
+ $liability->init(2);
+ $liability_array = $liability->build_array();
+ $liability_depth = Accountlist::$max_depth;
+ $liability_total = -$liability->total;
+
+ Accountlist::reset_max_depth();
+
+ $asset = new Accountlist();
+ $asset->init(1);
+ $asset_array = $asset->build_array();
+ $asset_depth = Accountlist::$max_depth;
+ $asset_total = $asset->total;
+
+ $liability->to_csv($liability_array);
+ Accountlist::add_blank_csv();
+ $asset->to_csv($asset_array);
+
+ $income = new Accountlist();
+ $income->init(3);
+ $expense = new Accountlist();
+ $expense->init(4);
+ $income_total = -$income->total;
+ $expense_total = $expense->total;
+ $pandl = $income_total - $expense_total;
+ $diffop = $this->Ledger_model->get_diff_op_balance();
+
+ Accountlist::add_blank_csv();
+ /* Liability side */
+ $total = $liability_total;
+ Accountlist::add_row_csv(array("Liability Total",
convert_cur($liability_total)));
+
+ /* If Profit then Liability side, If Loss then Asset side */
+ if ($pandl != 0)
+ {
+ if ($pandl > 0)
+ {
+ $total += $pandl;
+ Accountlist::add_row_csv(array("Profit & Loss A/C (Net Profit)",
convert_cur($pandl)));
+ }
+ }
+
+ /* If Op balance Dr then Liability side, If Op balance Cr then Asset side */
+ if ($diffop != 0)
+ {
+ if ($diffop > 0)
+ {
+ $total += $diffop;
+ Accountlist::add_row_csv(array("Diff in O/P Balance", "Dr " .
convert_cur($diffop)));
+ }
+ }
+
+ Accountlist::add_row_csv(array("Total - Liabilities",
convert_cur($total)));
+
+ /* Asset side */
+ $total = $asset_total;
+ Accountlist::add_row_csv(array("Asset Total", convert_cur($asset_total)));
+
+ /* If Profit then Liability side, If Loss then Asset side */
+ if ($pandl != 0)
+ {
+ if ($pandl < 0)
+ {
+ $total += -$pandl;
+ Accountlist::add_row_csv(array("Profit & Loss A/C (Net Loss)",
convert_cur(-$pandl)));
+ }
+ }
+
+ /* If Op balance Dr then Liability side, If Op balance Cr then Asset side */
+ if ($diffop != 0)
+ {
+ if ($diffop < 0)
+ {
+ $total += -$diffop;
+ Accountlist::add_row_csv(array("Diff in O/P Balance", "Cr " .
convert_cur(-$diffop)));
+ }
+ }
+
+ Accountlist::add_row_csv(array("Total - Assets", convert_cur($total)));
+
+ $balancesheet = Accountlist::get_csv();
+ $this->load->helper('csv');
+ echo array_to_csv($balancesheet, "balancesheet.csv");
+ return;
+ }
+
return;
}
}
diff --git a/system/application/libraries/Accountlist.php
b/system/application/libraries/Accountlist.php
index 2540064..22bc6c2 100644
--- a/system/application/libraries/Accountlist.php
+++ b/system/application/libraries/Accountlist.php
@@ -10,6 +10,10 @@ class Accountlist
var $children_groups = array();
var $children_ledgers = array();
var $counter = 0;
+ public static $temp_max = 0;
+ public static $max_depth = 0;
+ public static $csv_data = array();
+ public static $csv_row = 0;
function Accountlist()
{
@@ -197,6 +201,7 @@ class Accountlist
$this->counter--;
}
}
+
function print_space($count)
{
$html = "";
@@ -206,5 +211,161 @@ class Accountlist
}
return $html;
}
+
+ /* Build a array of groups and ledgers */
+ function build_array()
+ {
+ $item = array(
+ 'id' => $this->id,
+ 'name' => $this->name,
+ 'type' => "G",
+ 'total' => $this->total,
+ 'child_groups' => array(),
+ 'child_ledgers' => array(),
+ 'depth' => self::$temp_max,
+ );
+ $local_counter = 0;
+ if (count($this->children_groups) > 0)
+ {
+ self::$temp_max++;
+ if (self::$temp_max > self::$max_depth)
+ self::$max_depth = self::$temp_max;
+ foreach ($this->children_groups as $id => $data)
+ {
+ $item['child_groups'][$local_counter] = $data->build_array();
+ $local_counter++;
+ }
+ self::$temp_max--;
+ }
+ $local_counter = 0;
+ if (count($this->children_ledgers) > 0)
+ {
+ self::$temp_max++;
+ foreach ($this->children_ledgers as $id => $data)
+ {
+ $item['child_ledgers'][$local_counter] = array(
+ 'id' => $data['id'],
+ 'name' => $data['name'],
+ 'type' => "L",
+ 'total' => $data['total'],
+ 'child_groups' => array(),
+ 'child_ledgers' => array(),
+ 'depth' => self::$temp_max,
+ );
+ $local_counter++;
+ }
+ self::$temp_max--;
+ }
+ return $item;
+ }
+
+ /* Show array of groups and ledgers as created by build_array() method */
+ function show_array($data)
+ {
+ echo "<tr>";
+ echo "<td>";
+ echo $this->print_space($data['depth']);
+ echo $data['depth'] . "-";
+ echo $data['id'];
+ echo $data['name'];
+ echo $data['type'];
+ echo $data['total'];
+ if ($data['child_ledgers'])
+ {
+ foreach ($data['child_ledgers'] as $id => $ledger_data)
+ {
+ $this->show_array($ledger_data);
+ }
+ }
+ if ($data['child_groups'])
+ {
+ foreach ($data['child_groups'] as $id => $group_data)
+ {
+ $this->show_array($group_data);
+ }
+ }
+ echo "</td>";
+ echo "</tr>";
+ }
+
+ function to_csv($data)
+ {
+ $counter = 0;
+ while ($counter < $data['depth'])
+ {
+ self::$csv_data[self::$csv_row][$counter] = "";
+ $counter++;
+ }
+
+ self::$csv_data[self::$csv_row][$counter] = $data['name'];
+ $counter++;
+
+ while ($counter < self::$max_depth + 3)
+ {
+ self::$csv_data[self::$csv_row][$counter] = "";
+ $counter++;
+ }
+ self::$csv_data[self::$csv_row][$counter] = $data['type'];
+ $counter++;
+
+ if ($data['total'] == 0)
+ {
+ self::$csv_data[self::$csv_row][$counter] = "";
+ $counter++;
+ self::$csv_data[self::$csv_row][$counter] = "";
+ } else if ($data['total'] < 0) {
+ self::$csv_data[self::$csv_row][$counter] = "Cr";
+ $counter++;
+ self::$csv_data[self::$csv_row][$counter] = -$data['total'];
+ } else {
+ self::$csv_data[self::$csv_row][$counter] = "Dr";
+ $counter++;
+ self::$csv_data[self::$csv_row][$counter] = $data['total'];
+ }
+
+ if ($data['child_ledgers'])
+ {
+ foreach ($data['child_ledgers'] as $id => $ledger_data)
+ {
+ self::$csv_row++;
+ $this->to_csv($ledger_data);
+ }
+ }
+ if ($data['child_groups'])
+ {
+ foreach ($data['child_groups'] as $id => $group_data)
+ {
+ self::$csv_row++;
+ $this->to_csv($group_data);
+ }
+ }
+ }
+
+ public static function get_csv()
+ {
+ return self::$csv_data;
+ }
+
+ public static function add_blank_csv()
+ {
+ self::$csv_row++;
+ self::$csv_data[self::$csv_row] = array("", "");
+ self::$csv_row++;
+ self::$csv_data[self::$csv_row] = array("", "");
+ return;
+ }
+
+ public static function add_row_csv($row = array(""))
+ {
+ self::$csv_row++;
+ self::$csv_data[self::$csv_row] = $row;
+ return;
+ }
+
+ public static function reset_max_depth()
+ {
+ self::$max_depth = 0;
+ self::$temp_max = 0;
+ }
}
commit e47e0d171baa478eeb7a2d66994d77874d98798e
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Thu Dec 9 14:40:10 2010 +0530
Added Voucher prefix database columns
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/admin/carryforward.sql
b/system/application/controllers/admin/carryforward.sql
index 06a53f6..deeaa2f 100644
--- a/system/application/controllers/admin/carryforward.sql
+++ b/system/application/controllers/admin/carryforward.sql
@@ -42,6 +42,11 @@ CREATE TABLE IF NOT EXISTS settings (
print_page_format varchar(1) NOT NULL,
print_page_layout text NOT NULL,
print_logo varchar(255) NOT NULL,
+ receipt_voucher_prefix varchar(10) NOT NULL,
+ payment_voucher_prefix varchar(10) NOT NULL,
+ contra_voucher_prefix varchar(10) NOT NULL,
+ journal_voucher_prefix varchar(10) NOT NULL,
+ voucher_number_padding int(5) NOT NULL,
database_version int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
diff --git a/system/application/controllers/admin/database.sql
b/system/application/controllers/admin/database.sql
index 7ae97d2..6e03ff0 100644
--- a/system/application/controllers/admin/database.sql
+++ b/system/application/controllers/admin/database.sql
@@ -42,6 +42,11 @@ CREATE TABLE IF NOT EXISTS settings (
print_page_format varchar(1) NOT NULL,
print_page_layout text NOT NULL,
print_logo varchar(255) NOT NULL,
+ receipt_voucher_prefix varchar(10) NOT NULL,
+ payment_voucher_prefix varchar(10) NOT NULL,
+ contra_voucher_prefix varchar(10) NOT NULL,
+ journal_voucher_prefix varchar(10) NOT NULL,
+ voucher_number_padding int(5) NOT NULL,
database_version int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
commit 0d8655deb3f5fa8d2d04e2062ab1704988651c4f
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 23:02:42 2010 +0530
Added Ledger Statment Download CSV
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/report.php
b/system/application/controllers/report.php
index 6c97fc6..eb0ea64 100644
--- a/system/application/controllers/report.php
+++ b/system/application/controllers/report.php
@@ -47,6 +47,9 @@ class Report extends Controller {
$this->load->library('pagination');
$this->template->set('page_title', 'Ledger Statement');
+ if ($ledger_id != 0)
+ $this->template->set('nav_links',
array('report/download/ledgerst/' . $ledger_id => 'Download CSV'));
+
if ($_POST)
{
$ledger_id = $this->input->post('ledger_id', TRUE);
@@ -59,6 +62,7 @@ class Report extends Controller {
function download($statement, $id = NULL)
{
+ /********************** TRIAL BALANCE *************************/
if ($statement == "trialbalance")
{
$this->load->model('Ledger_model');
@@ -68,6 +72,11 @@ class Report extends Controller {
$temp_dr_total = 0;
$temp_cr_total = 0;
+ $trialbalance[$counter] = array ("TRIAL BALANCE", "",
"", "", "", "", "", "",
"");
+ $counter++;
+ $trialbalance[$counter] = array ("AY " .
date_mysql_to_php($this->config->item('account_ay_start')) . " - "
. date_mysql_to_php($this->config->item('account_ay_end')), "",
"", "", "", "", "", "",
"");
+ $counter++;
+
$trialbalance[$counter][0]= "Ledger";
$trialbalance[$counter][1]= "";
$trialbalance[$counter][2]= "Opening";
@@ -158,6 +167,162 @@ class Report extends Controller {
echo array_to_csv($trialbalance, "trialbalance.csv");
return;
}
+
+ /********************** LEDGER STATEMENT **********************/
+ if ($statement == "ledgerst")
+ {
+ $ledger_id = (int)$this->uri->segment(4);
+ if ($ledger_id < 1)
+ return;
+
+ $this->load->model('Ledger_model');
+ $cur_balance = 0;
+ $counter = 0;
+ $ledgerst = array();
+
+ $ledgerst[$counter] = array ("", "", "LEDGER STATEMENT FOR
" . strtoupper($this->Ledger_model->get_name($ledger_id)), "",
"", "", "", "", "", "",
"");
+ $counter++;
+ $ledgerst[$counter] = array ("", "", "AY " .
date_mysql_to_php($this->config->item('account_ay_start')) . " - "
. date_mysql_to_php($this->config->item('account_ay_end')), "",
"", "", "", "", "", "",
"");
+ $counter++;
+
+ $ledgerst[$counter][0]= "Date";
+ $ledgerst[$counter][1]= "Number";
+ $ledgerst[$counter][2]= "Ledger Name";
+ $ledgerst[$counter][3]= "Status";
+ $ledgerst[$counter][4]= "Type";
+ $ledgerst[$counter][5]= "";
+ $ledgerst[$counter][6]= "Dr Amount";
+ $ledgerst[$counter][7]= "";
+ $ledgerst[$counter][8]= "Cr Amount";
+ $ledgerst[$counter][9]= "";
+ $ledgerst[$counter][10]= "Balance";
+ $counter++;
+
+ /* Opening Balance */
+ list ($opbalance, $optype) = $this->Ledger_model->get_op_balance($ledger_id);
+ $ledgerst[$counter] = array ("Opening Balance", "", "",
"", "", "", "", "", "",
convert_dc($optype), $opbalance);
+ if ($optype == "D")
+ $cur_balance += $opbalance;
+ else
+ $cur_balance -= $opbalance;
+ $counter++;
+
+ $ledgerst_q = $this->db->query("SELECT vouchers.id as vid, vouchers.number
as vnumber, vouchers.date as vdate, vouchers.draft as vdraft, vouchers.type as vtype,
voucher_items.amount as lamount, voucher_items.dc as ldc FROM vouchers join voucher_items
on vouchers.id = voucher_items.voucher_id WHERE voucher_items.ledger_id = ? ORDER BY
vouchers.date ASC, vouchers.number ASC", array($ledger_id));
+ foreach ($ledgerst_q->result() as $row)
+ {
+ $ledgerst[$counter][0] = date_mysql_to_php($row->vdate);
+ $ledgerst[$counter][1] = $row->vid;
+
+ /* Opposite voucher name */
+ if ($row->ldc == "D")
+ {
+
+ if ($opp_voucher_name_q = $this->db->query("SELECT * FROM voucher_items
WHERE voucher_id = ? AND dc = ?", array($row->vid, "C")))
+ {
+ $opp_voucher_name_d = $opp_voucher_name_q->row();
+ $opp_ledger_name =
$this->Ledger_model->get_name($opp_voucher_name_d->ledger_id);
+ if ($opp_voucher_name_q->num_rows() > 1)
+ {
+ $ledgerst[$counter][2] = "(" . $opp_ledger_name . ")";
+ } else {
+ $ledgerst[$counter][2] = $opp_ledger_name;
+ }
+ }
+ } else {
+ if ($opp_voucher_name_q = $this->db->query("SELECT * FROM voucher_items
WHERE voucher_id = ? AND dc = ?", array($row->vid, "D")))
+ {
+ $opp_voucher_name_d = $opp_voucher_name_q->row();
+ $opp_ledger_name =
$this->Ledger_model->get_name($opp_voucher_name_d->ledger_id);
+ if ($opp_voucher_name_q->num_rows() > 1)
+ {
+ $ledgerst[$counter][2] = "(" . $opp_ledger_name . ")";
+ } else {
+ $ledgerst[$counter][2] = $opp_ledger_name;
+ }
+ }
+
+ }
+
+ $ledgerst[$counter][3] = ($row->vdraft == 1) ? "Draft" :
"Active";
+ $ledgerst[$counter][4] = ucfirst(n_to_v($row->vtype));
+
+ if ($row->ldc == "D")
+ {
+ if ($row->vdraft == 0)
+ $cur_balance += $row->lamount;
+ $ledgerst[$counter][5] = convert_dc($row->ldc);
+ $ledgerst[$counter][6] = $row->lamount;
+ $ledgerst[$counter][7] = "";
+ $ledgerst[$counter][8] = "";
+
+ } else {
+ if ($row->vdraft == 0)
+ $cur_balance -= $row->lamount;
+ $ledgerst[$counter][5] = "";
+ $ledgerst[$counter][6] = "";
+ $ledgerst[$counter][7] = convert_dc($row->ldc);
+ $ledgerst[$counter][8] = $row->lamount;
+ }
+
+ if ($row->vdraft == 0)
+ {
+ if ($cur_balance == 0)
+ {
+ $ledgerst[$counter][9] = "";
+ $ledgerst[$counter][10] = 0;
+ } else if ($cur_balance < 0) {
+ $ledgerst[$counter][9] = "Cr";
+ $ledgerst[$counter][10] = convert_cur(-$cur_balance);
+ } else {
+ $ledgerst[$counter][9] = "Dr";
+ $ledgerst[$counter][10] = convert_cur($cur_balance);
+ }
+ } else {
+ $ledgerst[$counter][9] = "";
+ $ledgerst[$counter][10] = "";
+ }
+ $counter++;
+ }
+
+ $ledgerst[$counter][0]= "Closing Balance";
+ $ledgerst[$counter][1]= "";
+ $ledgerst[$counter][2]= "";
+ $ledgerst[$counter][3]= "";
+ $ledgerst[$counter][4]= "";
+ $ledgerst[$counter][5]= "";
+ $ledgerst[$counter][6]= "";
+ $ledgerst[$counter][7]= "";
+ $ledgerst[$counter][8]= "";
+ if ($cur_balance < 0)
+ {
+ $ledgerst[$counter][9]= "Cr";
+ $ledgerst[$counter][10]= convert_cur(-$cur_balance);
+ } else {
+ $ledgerst[$counter][9]= "Dr";
+ $ledgerst[$counter][10]= convert_cur($cur_balance);
+ }
+ $counter++;
+
+ $ledgerst[$counter] = array ("", "", "", "",
"", "", "", "", "", "",
"");
+ $counter++;
+
+ /* Final Opening and Closing Balance */
+ $clbalance = $this->Ledger_model->get_ledger_balance($ledger_id);
+
+ $ledgerst[$counter] = array ("Opening Balance", convert_dc($optype),
$opbalance, "", "", "", "", "",
"", "", "");
+ $counter++;
+
+ if ($clbalance == 0)
+ $ledgerst[$counter] = array ("Closing Balance", "", 0,
"", "", "", "", "", "",
"", "");
+ else if ($clbalance < 0)
+ $ledgerst[$counter] = array ("Closing Balance", "Cr",
convert_cur(-$clbalance), "", "", "", "",
"", "", "", "");
+ else
+ $ledgerst[$counter] = array ("Closing Balance", "Dr",
convert_cur($clbalance), "", "", "", "",
"", "", "", "");
+
+ $this->load->helper('csv');
+ echo array_to_csv($ledgerst, "ledgerst.csv");
+ return;
+ }
return;
}
}
commit 3c97d01daaf6ae25d520d8cb3a4662172247532a
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 21:58:16 2010 +0530
Added README.txt file
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..9e8d2a0
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,22 @@
+Webzash - Easy to use web based double entry accounting software
+================================================================
+
+http://webzash.org
+http://webzash.wordpress.com
+
+Webzash is a web based double entry accouting software written in PHP - CodeIgniter and
uses MySQL as database backend.
+
+It is licensed under GNU Affero General Public License, version 3.
+http://www.gnu.org/licenses/agpl-3.0.txt
+
+Features include
+- No setup required
+- Works on Shared Hosting environment
+- Very easy to use
+- Community driven
+- Support for multiple accounts
+- Support for DRAFT vouchers
+- Support for colored tags
+- Reports include balance sheet, profit and loss statement, trial balance, ledger
statement
+
+Note : Webzash includes works under other copyright notices and distributed according to
the terms of the GNU General Public License or a compatible license
commit ca1bf4c51091ebd5f99fbd93a6215b84646abcd8
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 21:43:10 2010 +0530
Added Trial Balance Download CSV
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/report.php
b/system/application/controllers/report.php
index 43e8269..6c97fc6 100644
--- a/system/application/controllers/report.php
+++ b/system/application/controllers/report.php
@@ -34,10 +34,10 @@ class Report extends Controller {
function trialbalance($period = NULL)
{
$this->template->set('page_title', 'Trial Balance');
+ $this->template->set('nav_links',
array('report/download/trialbalance' => 'Download CSV'));
+
$this->load->library('accountlist');
- $a = new Accountlist(0);
- $data['a'] = $a;
- $this->template->load('template', 'report/trialbalance', $data);
+ $this->template->load('template', 'report/trialbalance');
return;
}
@@ -56,6 +56,110 @@ class Report extends Controller {
$this->template->load('template', 'report/ledgerst', $data);
return;
}
+
+ function download($statement, $id = NULL)
+ {
+ if ($statement == "trialbalance")
+ {
+ $this->load->model('Ledger_model');
+ $all_ledgers = $this->Ledger_model->get_all_ledgers();
+ $counter = 0;
+ $trialbalance = array();
+ $temp_dr_total = 0;
+ $temp_cr_total = 0;
+
+ $trialbalance[$counter][0]= "Ledger";
+ $trialbalance[$counter][1]= "";
+ $trialbalance[$counter][2]= "Opening";
+ $trialbalance[$counter][3]= "";
+ $trialbalance[$counter][4]= "Closing";
+ $trialbalance[$counter][5]= "";
+ $trialbalance[$counter][6]= "Dr Total";
+ $trialbalance[$counter][7]= "";
+ $trialbalance[$counter][8]= "Cr Total";
+ $counter++;
+
+ foreach ($all_ledgers as $ledger_id => $ledger_name)
+ {
+ if ($ledger_id == 0) continue;
+
+ $trialbalance[$counter][0] = $ledger_name;
+
+ list ($opbal_amount, $opbal_type) =
$this->Ledger_model->get_op_balance($ledger_id);
+ if ($opbal_amount == 0)
+ {
+ $trialbalance[$counter][1] = "";
+ $trialbalance[$counter][2] = 0;
+ } else {
+ $trialbalance[$counter][1] = convert_dc($opbal_type);
+ $trialbalance[$counter][2] = $opbal_amount;
+ }
+
+ $clbal_amount = $this->Ledger_model->get_ledger_balance($ledger_id);
+
+ if ($clbal_amount == 0)
+ {
+ $trialbalance[$counter][3] = "";
+ $trialbalance[$counter][4] = 0;
+ } else if ($clbal_amount < 0) {
+ $trialbalance[$counter][3] = "Cr";
+ $trialbalance[$counter][4] = convert_cur(-$clbal_amount);
+ } else {
+ $trialbalance[$counter][3] = "Dr";
+ $trialbalance[$counter][4] = convert_cur($clbal_amount);
+ }
+
+ $dr_total = $this->Ledger_model->get_dr_total($ledger_id);
+ if ($dr_total)
+ {
+ $trialbalance[$counter][5] = "Dr";
+ $trialbalance[$counter][6] = convert_cur($dr_total);
+ $temp_dr_total += $dr_total;
+ } else {
+ $trialbalance[$counter][5] = "";
+ $trialbalance[$counter][6] = 0;
+ }
+
+ $cr_total = $this->Ledger_model->get_cr_total($ledger_id);
+ if ($cr_total)
+ {
+ $trialbalance[$counter][7] = "Cr";
+ $trialbalance[$counter][8] = convert_cur($cr_total);
+ $temp_cr_total += $cr_total;
+ } else {
+ $trialbalance[$counter][7] = "";
+ $trialbalance[$counter][8] = 0;
+ }
+ $counter++;
+ }
+
+ $trialbalance[$counter][0]= "";
+ $trialbalance[$counter][1]= "";
+ $trialbalance[$counter][2]= "";
+ $trialbalance[$counter][3]= "";
+ $trialbalance[$counter][4]= "";
+ $trialbalance[$counter][5]= "";
+ $trialbalance[$counter][6]= "";
+ $trialbalance[$counter][7]= "";
+ $trialbalance[$counter][8]= "";
+ $counter++;
+
+ $trialbalance[$counter][0]= "Total";
+ $trialbalance[$counter][1]= "";
+ $trialbalance[$counter][2]= "";
+ $trialbalance[$counter][3]= "";
+ $trialbalance[$counter][4]= "";
+ $trialbalance[$counter][5]= "Dr";
+ $trialbalance[$counter][6]= convert_cur($temp_dr_total);
+ $trialbalance[$counter][7]= "Cr";
+ $trialbalance[$counter][8]= convert_cur($temp_cr_total);
+
+ $this->load->helper('csv');
+ echo array_to_csv($trialbalance, "trialbalance.csv");
+ return;
+ }
+ return;
+ }
}
/* End of file report.php */
commit c31026df25ead5cd448dc960182ffc7587072c92
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 21:42:18 2010 +0530
Added CSV Helper
Downloaded from
http://maestric.com/doc/php/codeigniter_csv
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/helpers/csv_helper.php
b/system/application/helpers/csv_helper.php
new file mode 100755
index 0000000..70bafda
--- /dev/null
+++ b/system/application/helpers/csv_helper.php
@@ -0,0 +1,101 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access
allowed');
+
+// ------------------------------------------------------------------------
+
+/**
+ * CSV Helpers
+ * Inspiration from PHP Cookbook by David Sklar and Adam Trachtenberg
+ *
+ * @author Jérôme Jaglale
+ * @link
http://maestric.com/en/doc/php/codeigniter_csv
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Array to CSV
+ *
+ * download == "" -> return CSV string
+ * download == "toto.csv" -> download file toto.csv
+ */
+if ( ! function_exists('array_to_csv'))
+{
+ function array_to_csv($array, $download = "")
+ {
+ if ($download != "")
+ {
+ header('Content-Type: application/csv');
+ header('Content-Disposition: attachement; filename="' . $download .
'"');
+ }
+
+ ob_start();
+ $f = fopen('php://output', 'w') or show_error("Can't open
php://output");
+ $n = 0;
+ foreach ($array as $line)
+ {
+ $n++;
+ if ( ! fputcsv($f, $line))
+ {
+ show_error("Can't write line $n: $line");
+ }
+ }
+ fclose($f) or show_error("Can't close php://output");
+ $str = ob_get_contents();
+ ob_end_clean();
+
+ if ($download == "")
+ {
+ return $str;
+ }
+ else
+ {
+ echo $str;
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
+/**
+ * Query to CSV
+ *
+ * download == "" -> return CSV string
+ * download == "toto.csv" -> download file toto.csv
+ */
+if ( ! function_exists('query_to_csv'))
+{
+ function query_to_csv($query, $headers = TRUE, $download = "")
+ {
+ if ( ! is_object($query) OR ! method_exists($query, 'list_fields'))
+ {
+ show_error('invalid query');
+ }
+
+ $array = array();
+
+ if ($headers)
+ {
+ $line = array();
+ foreach ($query->list_fields() as $name)
+ {
+ $line[] = $name;
+ }
+ $array[] = $line;
+ }
+
+ foreach ($query->result_array() as $row)
+ {
+ $line = array();
+ foreach ($row as $item)
+ {
+ $line[] = $item;
+ }
+ $array[] = $line;
+ }
+
+ echo array_to_csv($array, $download);
+ }
+}
+
+/* End of file csv_helper.php */
+/* Location: ./system/helpers/csv_helper.php */
\ No newline at end of file
commit c4a1edae6f135fbac68b885187c29487113121c1
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 17:47:20 2010 +0530
Added Manage accounts edit and delete actions
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/admin-style.css
b/system/application/assets/css/admin-style.css
index a2647a1..a17a5e6 100644
--- a/system/application/assets/css/admin-style.css
+++ b/system/application/assets/css/admin-style.css
@@ -104,14 +104,15 @@ body {
margin:0 18px 0 0;
}
-#content #main ul#main-links-nav li a
-{
- color:#000000;
- font-size:100%;
- background-color:#EEE;
- border:1px solid;
- border-color: #696 #363 #363 #696;
- padding:3px;
+#content #main ul#main-links-nav li a {
+ -moz-border-radius:3px 3px 3px 3px;
+ border-radius:3px 3px 3px 3px;
+ background:repeat-x scroll 0 0 transparent;
+ color:#FFFFFF;
+ font-size:11px;
+ font-weight:bold;
+ padding:4px 10px;
+ text-shadow:-1px -1px 0 #333333;
text-decoration:none;
}
diff --git a/system/application/controllers/admin/manage.php
b/system/application/controllers/admin/manage.php
index 6045959..33c3cc1 100644
--- a/system/application/controllers/admin/manage.php
+++ b/system/application/controllers/admin/manage.php
@@ -148,6 +148,164 @@ class Manage extends Controller {
}
return;
}
+
+ function edit($database_label)
+ {
+ $this->template->set('page_title', 'Edit a webzash account');
+
+ $ini_file = "system/application/config/accounts/" . $database_label .
".ini";
+
+ /* Form fields */
+ $data['database_name'] = array(
+ 'name' => 'database_name',
+ 'id' => 'database_name',
+ 'maxlength' => '100',
+ 'size' => '40',
+ 'value' => '',
+ );
+
+ $data['database_username'] = array(
+ 'name' => 'database_username',
+ 'id' => 'database_username',
+ 'maxlength' => '100',
+ 'size' => '40',
+ 'value' => '',
+ );
+
+ $data['database_password'] = array(
+ 'name' => 'database_password',
+ 'id' => 'database_password',
+ 'maxlength' => '100',
+ 'size' => '40',
+ 'value' => '',
+ );
+
+ $data['database_host'] = array(
+ 'name' => 'database_host',
+ 'id' => 'database_host',
+ 'maxlength' => '100',
+ 'size' => '40',
+ 'value' => '',
+ );
+
+ $data['database_port'] = array(
+ 'name' => 'database_port',
+ 'id' => 'database_port',
+ 'maxlength' => '100',
+ 'size' => '40',
+ 'value' => '',
+ );
+ $data['database_label'] = $database_label;
+
+ /* Repopulating form */
+ if ($_POST)
+ {
+ $data['database_host']['value'] =
$this->input->post('database_host', TRUE);
+ $data['database_port']['value'] =
$this->input->post('database_port', TRUE);
+ $data['database_name']['value'] =
$this->input->post('database_name', TRUE);
+ $data['database_username']['value'] =
$this->input->post('database_username', TRUE);
+ $data['database_password']['value'] =
$this->input->post('database_password', TRUE);
+ } else {
+ /* Check if database ini file exists */
+ if ( ! get_file_info($ini_file))
+ {
+ $this->messages->add("Invalid account. Account setting file labeled "
. $database_label . " does not exists", 'error');
+ } else {
+ /* Parsing database ini file */
+ $active_accounts = parse_ini_file($ini_file);
+ if ( ! $active_accounts)
+ {
+ $CI->messages->add("Invalid account setting file",
'error');
+ } else {
+ /* Check if all needed variables are set in ini file */
+ if (isset($active_accounts['db_hostname']))
+ $data['database_host']['value'] =
$active_accounts['db_hostname'];
+ else
+ $CI->messages->add("Hostname missing from account setting file",
'error');
+
+ if (isset($active_accounts['db_port']))
+ $data['database_port']['value'] =
$active_accounts['db_port'];
+ else
+ $CI->messages->add("Port missing from account setting file. Default
MySQL port is 3306", 'error');
+
+ if (isset($active_accounts['db_name']))
+ $data['database_name']['value'] =
$active_accounts['db_name'];
+ else
+ $CI->messages->add("Database name missing from account setting
file", 'error');
+
+ if (isset($active_accounts['db_username']))
+ $data['database_username']['value'] =
$active_accounts['db_username'];
+ else
+ $CI->messages->add("Database username missing from account setting
file", 'error');
+
+ if ( ! isset($active_accounts['db_password']))
+ $CI->messages->add("Database password missing from account setting
file", 'error');
+ }
+ }
+ }
+
+ /* Form validations */
+ $this->form_validation->set_rules('database_name', 'Database
Name', 'trim|required');
+
+ /* Validating form */
+ if ($this->form_validation->run() == FALSE)
+ {
+ $this->messages->add(validation_errors(), 'error');
+ $this->template->load('admin_template', 'admin/manage/edit',
$data);
+ return;
+ }
+ else
+ {
+ $data_database_host = $this->input->post('database_host', TRUE);
+ $data_database_port = $this->input->post('database_port', TRUE);
+ $data_database_name = $this->input->post('database_name', TRUE);
+ $data_database_username = $this->input->post('database_username',
TRUE);
+ $data_database_password = $this->input->post('database_password',
TRUE);
+
+ $ini_file = "system/application/config/accounts/" . $database_label .
".ini";
+
+ $con_details = "[database]" . "\r\n" . "db_hostname =
\"" . $data_database_host . "\"" . "\r\n" .
"db_port = \"" . $data_database_port . "\"" .
"\r\n" . "db_name = \"" . $data_database_name .
"\"" . "\r\n" . "db_username = \"" .
$data_database_username . "\"" . "\r\n" . "db_password =
\"" . $data_database_password . "\"" . "\r\n";
+
+ $con_details_html = '[database]<br />db_hostname = "' .
$data_database_host . '"<br />db_port = "' . $data_database_port .
'"<br />db_name = "' . $data_database_name . '"<br
/>db_username = "' . $data_database_username . '"<br
/>db_password = "' . $data_database_password . '"<br />';
+
+ /* Writing the connection string to end of file - writing in 'a' append mode
*/
+ if ( ! write_file($ini_file, $con_details))
+ {
+ $this->messages->add("Failed to edit account settings file. Please check
if \"" . $ini_file . "\" file is writable", 'error');
+ $this->messages->add("You can manually update the text file \""
. $ini_file . "\" with the following content :<br /><br />" .
$con_details_html, 'error');
+ $this->template->load('admin_template', 'admin/manage/edit',
$data);
+ return;
+ } else {
+ $this->messages->add("Successfully updated webzash account settings",
'success');
+ redirect('admin/manage');
+ return;
+ }
+ }
+ return;
+ }
+
+ function delete($database_label)
+ {
+ $this->template->set('page_title', 'Delete a webzash account');
+
+ $ini_file = "system/application/config/accounts/" . $database_label .
".ini";
+ $this->messages->add("Please delete " . $ini_file . " file
manually", 'error');
+ $this->messages->add("Note that only the settings file will be delete.
Account database will have to be deleted manually", 'status');
+ /*
+ if ( ! get_file_info($ini_file))
+ {
+ $this->messages->add("Cannot delete account settings. Account setting file
labeled " . $database_label . " does not exists", 'error');
+ } else {
+ if (unlink($ini_file))
+ {
+ $this->messages->add("Account settings file delete",
'success');
+ } else {
+ $this->messages->add("Cannot delete account settings. Please delete "
. $ini_file . " file manually", 'error');
+ }
+ } */
+ redirect('admin/manage');
+ return;
+ }
}
/* End of file manage.php */
diff --git a/system/application/views/admin/manage/edit.php
b/system/application/views/admin/manage/edit.php
new file mode 100644
index 0000000..378062f
--- /dev/null
+++ b/system/application/views/admin/manage/edit.php
@@ -0,0 +1,47 @@
+<?php
+ echo form_open('admin/manage/edit/' . $database_label);
+
+ echo "<p>";
+ echo "Label";
+ echo "<br />";
+ echo $database_label;
+ echo "</p>";
+
+ echo "<p>";
+ echo form_label('Database Name', 'database_name');
+ echo "<br />";
+ echo form_input($database_name);
+ echo "</p>";
+
+ echo "<p>";
+ echo form_label('Database Username', 'database_username');
+ echo "<br />";
+ echo form_input($database_username);
+ echo "</p>";
+
+ echo "<p>";
+ echo form_label('Database Password', 'database_password');
+ echo "<br />";
+ echo form_password($database_password);
+ echo "</p>";
+
+ echo "<p>";
+ echo form_label('Database Host', 'database_host');
+ echo "<br />";
+ echo form_input($database_host);
+ echo "</p>";
+
+ echo "<p>";
+ echo form_label('Database Port', 'database_port');
+ echo "<br />";
+ echo form_input($database_port);
+ echo "</p>";
+
+ echo "<p>";
+ echo form_submit('submit', 'Edit');
+ echo " ";
+ echo anchor('admin/manage', 'Back', array('title' =>
'Back to active account list'));
+ echo "</p>";
+
+ echo form_close();
+
diff --git a/system/application/views/admin/manage/index.php
b/system/application/views/admin/manage/index.php
index 66ac375..23d07af 100644
--- a/system/application/views/admin/manage/index.php
+++ b/system/application/views/admin/manage/index.php
@@ -5,7 +5,7 @@ echo $this->session->userdata('db_active_label');
echo "</p>";
echo "<table border=0 cellpadding=5 class=\"simple-table
manage-account-table\">";
-echo
"<thead><tr><th>Label</th><th>Hostname</th><th>Port</th><th>Database</th><th>Username</th><th></th></tr></thead>";
+echo
"<thead><tr><th>Label</th><th>Hostname</th><th>Port</th><th>Database</th><th>Username</th><th></th><th></th></tr></thead>";
echo "<tbody>";
$odd_even = "odd";
foreach ($accounts as $label)
@@ -37,10 +37,18 @@ foreach ($accounts as $label)
echo "<td>" . $db_port . "</td>";
echo "<td>" . $db_name . "</td>";
echo "<td>" . $db_user . "</td>";
+
+ echo "<td>";
if ($this->session->userdata('db_active_label') == $label)
- echo "<td>Active</td>";
+ echo "Active";
else
- echo "<td>" . anchor("admin/active/index/" . $label,
"Activate", array('title' => 'Activate ' . ucfirst($label) .
' Account', 'class' => 'red-link')) . "</td>";
+ echo anchor("admin/active/index/" . $label, "Activate",
array('title' => 'Activate ' . ucfirst($label) . ' Account',
'class' => 'red-link'));
+ echo "</td>";
+ echo "<td>";
+ echo anchor("admin/manage/edit/" . $label, "Edit",
array('title' => 'Edit ' . ucfirst($label) . ' Account',
'class' => 'red-link'));
+ echo " " . anchor('admin/manage/delete/' . $label,
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete Account Settings',
'class' => "confirmClick", 'title' => "Delete Account
Settings")), array('title' => 'Delete Account Settings')) . "
";
+ echo "</td>";
+
echo "</tr>";
$odd_even = ($odd_even == "odd") ? "even" : "odd";
}
diff --git a/system/application/views/admin_template.php
b/system/application/views/admin_template.php
index 8449be7..6d69061 100644
--- a/system/application/views/admin_template.php
+++ b/system/application/views/admin_template.php
@@ -55,7 +55,7 @@ $(document).ready(function(){
<?php if (isset($nav_links)) {
echo "<ul id=\"main-links-nav\">";
foreach ($nav_links as $link => $title) {
- echo "<li>" . anchor($link, $title, array('title' =>
$title, 'class' => 'nav-links-item')) . "</li>";
+ echo "<li>" . anchor($link, $title, array('title' =>
$title, 'class' => 'nav-links-item', 'style' =>
'background-image:url(\'' . asset_url() .
'images/buttons/navlink.png\');')) . "</li>";
}
echo "</ul>";
} ?>
commit 7284c7fe4da8cb54b888d09e3d76fbf2f536cd0d
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 11:48:48 2010 +0530
Added Admin area message
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/admin_template.php
b/system/application/views/admin_template.php
index 89bb44d..8449be7 100644
--- a/system/application/views/admin_template.php
+++ b/system/application/views/admin_template.php
@@ -33,7 +33,7 @@ $(document).ready(function(){
<div id="container">
<div id="header">
<div id="logo">
- Webzash
+ Webzash <span style="font-size:18px;color:#FF0000;">Admin
area</span>
</div>
<div id="admin">
<?php echo anchor('', 'Back to accounts', array('title'
=> "Back to accounts", 'style' => 'color:#000000;
text-decoration:none')); ?>
commit 9759ae94297e57305c839e99c0d0d50b2a4a2e55
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 11:45:52 2010 +0530
Manage accounts now uses the simple table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index fedfd6a..0988cf2 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -145,7 +145,7 @@
.trial-balance-table td {
padding-right: 20px;
}
-
+
/* balance sheet */
.balance-sheet-table {
border:1px solid #BBBBBB;
@@ -235,3 +235,7 @@
.ledger-summary td {
padding: 8px 8px 8px 8px;
}
+
+.manage-account-table td {
+ padding-right: 20px;
+}
diff --git a/system/application/views/admin/manage/index.php
b/system/application/views/admin/manage/index.php
index aa95930..66ac375 100644
--- a/system/application/views/admin/manage/index.php
+++ b/system/application/views/admin/manage/index.php
@@ -4,8 +4,8 @@ echo "<b>Currently active account : </b>";
echo $this->session->userdata('db_active_label');
echo "</p>";
-echo "<table border=0 cellpadding=5 class=\"generaltable\">";
-echo
"<thead><tr><th>Label</th><th>Hostname</th><th>Port</th><th>Database</th><th>Username</th><th>Actions</th></tr></thead>";
+echo "<table border=0 cellpadding=5 class=\"simple-table
manage-account-table\">";
+echo
"<thead><tr><th>Label</th><th>Hostname</th><th>Port</th><th>Database</th><th>Username</th><th></th></tr></thead>";
echo "<tbody>";
$odd_even = "odd";
foreach ($accounts as $label)
@@ -37,7 +37,10 @@ foreach ($accounts as $label)
echo "<td>" . $db_port . "</td>";
echo "<td>" . $db_name . "</td>";
echo "<td>" . $db_user . "</td>";
- echo "<td>" . anchor("admin/active/index/" . $label,
"Activate", array('title' => 'Activate ' . ucfirst($label) .
' Account', 'style' => 'color:#000000;')) .
"</td>";
+ if ($this->session->userdata('db_active_label') == $label)
+ echo "<td>Active</td>";
+ else
+ echo "<td>" . anchor("admin/active/index/" . $label,
"Activate", array('title' => 'Activate ' . ucfirst($label) .
' Account', 'class' => 'red-link')) . "</td>";
echo "</tr>";
$odd_even = ($odd_even == "odd") ? "even" : "odd";
}
diff --git a/system/application/views/tag/index.php
b/system/application/views/tag/index.php
index a5ae0ad..bb3db1d 100644
--- a/system/application/views/tag/index.php
+++ b/system/application/views/tag/index.php
@@ -1,7 +1,7 @@
<?php
$tags_q = $this->db->get("tags");
echo "<table border=0 cellpadding=5 class=\"simple-table
tag-table\">";
- echo
"<thead><tr><th>Title</th><th>Color</th><th
colspan=5></th></tr></thead>";
+ echo
"<thead><tr><th>Title</th><th>Color</th><th></th></tr></thead>";
echo "<tbody>";
$odd_even = "odd";
foreach ($tags_q->result() as $row)
commit 5323b4c66af52ab6dc5eaee82ca65d5bc55e26d2
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 11:38:46 2010 +0530
Tag list now uses the simple table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/tag/index.php
b/system/application/views/tag/index.php
index 522b45f..a5ae0ad 100644
--- a/system/application/views/tag/index.php
+++ b/system/application/views/tag/index.php
@@ -1,7 +1,7 @@
<?php
$tags_q = $this->db->get("tags");
- echo "<table border=0 cellpadding=5 class=\"generaltable\">";
- echo
"<thead><tr><th>Title</th><th>Color</th><th
colspan=5>Actions</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
tag-table\">";
+ echo
"<thead><tr><th>Title</th><th>Color</th><th
colspan=5></th></tr></thead>";
echo "<tbody>";
$odd_even = "odd";
foreach ($tags_q->result() as $row)
@@ -10,9 +10,9 @@
echo "<td>" . $row->title . "</td>";
echo "<td>" . $this->Tag_model->show_voucher_tag($row->id) .
"</td>";
- echo "<td>" . anchor('tag/edit/' . $row->id ,
img(array('src' => asset_url() . "images/icons/edit.png",
'border' => '0', 'alt' => 'Edit Tag')),
array('title' => 'Edit Tag')) . "</td>";
-
- echo "<td>" . anchor('tag/delete/' . $row->id ,
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete Tag',
'class' => "confirmClick", 'title' => "Delete
Tag")), array('title' => 'Delete Tag')) .
"</td>";
+ echo "<td>" . anchor('tag/edit/' . $row->id ,
"Edit", array('title' => 'Edit Tag', 'class' =>
'red-link'));
+ echo " ";
+ echo anchor('tag/delete/' . $row->id , img(array('src' =>
asset_url() . "images/icons/delete.png", 'border' => '0',
'alt' => 'Delete Tag', 'class' => "confirmClick",
'title' => "Delete Tag")), array('title' => 'Delete
Tag')) . "</td>";
echo "</tr>";
$odd_even = ($odd_even == "odd") ? "even" : "odd";
}
commit e83434de115ecafef44c165d29f92468413834fd
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 11:24:45 2010 +0530
View Voucher now uses the simple table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index 0c0aeb6..fedfd6a 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -130,6 +130,18 @@
padding-right: 8px;
}
+.voucher-view-table td {
+ padding-right: 30px;
+}
+
+.voucher-view-table tr.voucher-total {
+ background-color:#FFFFE0;
+}
+
+.voucher-view-table tr.voucher-difference {
+ background-color:#FFE9E8;
+}
+
.trial-balance-table td {
padding-right: 20px;
}
@@ -140,7 +152,7 @@
}
.balance-sheet-table td {
- border:1px solid #EEEEEE;
+ border:1px solid #EEEEEE;
}
.balance-sheet-table tr.tr-group td {
diff --git a/system/application/views/voucher/edit.php
b/system/application/views/voucher/edit.php
index d9aa7c3..7022da2 100644
--- a/system/application/views/voucher/edit.php
+++ b/system/application/views/voucher/edit.php
@@ -232,9 +232,9 @@ $(document).ready(function() {
}
echo "<tr><td colspan=7></td></tr>";
- echo "<tr id=\"total\"><td colspan=2>TOTAL</td><td
id=\"dr-total\">0</td><td
id=\"cr-total\">0</td><td>" . img(array('src' =>
asset_url() . "images/icons/gear.png", 'border' => '0',
'alt' => 'Recalculate Total', 'class' =>
'recalculate', 'title' => 'Recalculate Total')) .
"</td><td></td><td></td></tr>";
+ echo "<tr id=\"total\"><td
colspan=2><strong>Total</strong></td><td
id=\"dr-total\">0</td><td
id=\"cr-total\">0</td><td>" . img(array('src' =>
asset_url() . "images/icons/gear.png", 'border' => '0',
'alt' => 'Recalculate Total', 'class' =>
'recalculate', 'title' => 'Recalculate Total')) .
"</td><td></td><td></td></tr>";
- echo "<tr id=\"difference\"><td
colspan=2>DIFFERENCE</td><td id=\"dr-diff\"></td><td
id=\"cr-diff\"></td><td></td><td></td><td></td></tr>";
+ echo "<tr id=\"difference\"><td
colspan=2><strong>Difference</strong></td><td
id=\"dr-diff\"></td><td
id=\"cr-diff\"></td><td></td><td></td><td></td></tr>";
echo "</table>";
echo "<p>";
diff --git a/system/application/views/voucher/view.php
b/system/application/views/voucher/view.php
index ebbeef2..f85e5ba 100644
--- a/system/application/views/voucher/view.php
+++ b/system/application/views/voucher/view.php
@@ -3,7 +3,7 @@
Voucher Date : <span class="bold"><?php echo
date_mysql_to_php($cur_voucher->date); ?></span>
</p>
-<table border=0 cellpadding=5 class="generaltable">
+<table border=0 cellpadding=5 class="simple-table voucher-view-table">
<thead><tr><th>Type</th><th>Ledger
A/C</th><th>Dr Amount</th><th>Cr
Amount</th></tr></thead>
<?php
$odd_even = "odd";
@@ -14,26 +14,25 @@ foreach ($cur_voucher_ledgers->result() as $row)
echo "<td>" . $this->Ledger_model->get_name($row->ledger_id) .
"</td>";
if ($row->dc == "D")
{
- echo "<td>" . $row->amount . "</td>";
+ echo "<td>Dr " . $row->amount . "</td>";
echo "<td></td>";
} else {
echo "<td></td>";
- echo "<td>" . $row->amount . "</td>";
+ echo "<td>Cr " . $row->amount . "</td>";
}
echo "</tr>";
$odd_even = ($odd_even == "odd") ? "even" : "odd";
}
?>
-<tr><td colspan=4><hr /></td></tr>
-<tr id="total"><td colspan=2>TOTAL</td><td
id=dr-total><?php echo $cur_voucher->dr_total; ?></td><td
id=cr-total"><?php echo $cur_voucher->cr_total; ?></td></tr>
+<tr class="voucher-total"><td
colspan=2><strong>Total</strong></td><td id=dr-total>Dr
<?php echo $cur_voucher->dr_total; ?></td><td id=cr-total">Cr
<?php echo $cur_voucher->cr_total; ?></td></tr>
<?php
if ($cur_voucher->dr_total != $cur_voucher->cr_total)
{
$difference = $cur_voucher->dr_total - $cur_voucher->cr_total;
if ($difference < 0)
- echo "<tr id=\"difference\"><td
colspan=2>DIFFERENCE</td><td id=\"dr-diff\"></td><td
id=\"cr-diff\">" . $cur_voucher->cr_total .
"</td></tr>";
+ echo "<tr class=\"voucher-difference\"><td
colspan=2><strong>Difference</strong></td><td
id=\"dr-diff\"></td><td id=\"cr-diff\">" .
$cur_voucher->cr_total . "</td></tr>";
else
- echo "<tr id=\"difference\"><td
colspan=2>DIFFERENCE</td><td id=\"dr-diff\">" .
$cur_voucher->dr_total . "</td><td
id=\"cr-diff\"></td></tr>";
+ echo "<tr class=\"voucher-difference\"><td
colspan=2><strong>Difference</strong></td><td
id=\"dr-diff\">" . $cur_voucher->dr_total . "</td><td
id=\"cr-diff\"></td></tr>";
}
?>
</table>
commit d1fbea37b08b2df1772ed3ddf260b636b37fc229
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 11:03:52 2010 +0530
Edit Voucher now uses the voucher table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/voucher/edit.php
b/system/application/views/voucher/edit.php
index 23c444a..d9aa7c3 100644
--- a/system/application/views/voucher/edit.php
+++ b/system/application/views/voucher/edit.php
@@ -194,7 +194,7 @@ $(document).ready(function() {
echo form_input_date($voucher_date);
echo "</p>";
- echo "<table class=\"vouchertable\">";
+ echo "<table class=\"voucher-table\">";
echo "<thead><tr><th>Type</th><th>Ledger
A/C</th><th>Dr Amount</th><th>Cr Amount</th><th
colspan=2>Actions</th><th colspan=2>Cur
Balance</th></tr></thead>";
foreach ($ledger_dc as $i => $ledger)
@@ -230,11 +230,11 @@ $(document).ready(function() {
echo "</tr>";
}
- echo "<tr><td colspan=4><hr
/></td><td></td></tr>";
+ echo "<tr><td colspan=7></td></tr>";
- echo "<tr id=\"total\"><td colspan=2>TOTAL</td><td
id=\"dr-total\">0</td><td
id=\"cr-total\">0</td><td>" . img(array('src' =>
asset_url() . "images/icons/gear.png", 'border' => '0',
'alt' => 'Recalculate Total', 'class' =>
'recalculate', 'title' => 'Recalculate Total')) .
"</tr>";
+ echo "<tr id=\"total\"><td colspan=2>TOTAL</td><td
id=\"dr-total\">0</td><td
id=\"cr-total\">0</td><td>" . img(array('src' =>
asset_url() . "images/icons/gear.png", 'border' => '0',
'alt' => 'Recalculate Total', 'class' =>
'recalculate', 'title' => 'Recalculate Total')) .
"</td><td></td><td></td></tr>";
- echo "<tr id=\"difference\"><td
colspan=2>DIFFERENCE</td><td id=\"dr-diff\"></td><td
id=\"cr-diff\"></td></tr>";
+ echo "<tr id=\"difference\"><td
colspan=2>DIFFERENCE</td><td id=\"dr-diff\"></td><td
id=\"cr-diff\"></td><td></td><td></td><td></td></tr>";
echo "</table>";
echo "<p>";
commit 4296603d57460c59646e5a6d1b106bed58cdb8ac
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 11:00:08 2010 +0530
New Voucher now uses the voucher table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index ffaa97b..0c0aeb6 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -92,6 +92,33 @@
}
/******************************************************************************/
+/****************************** VOUCHER TABLE *********************************/
+/******************************************************************************/
+
+.voucher-table {
+ font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
+ font-size:13px;
+ border-collapse:collapse;
+ text-align:left;
+}
+
+.voucher-table th {
+ font-weight:normal;
+ color:#000000;
+ padding:5px 8px;
+ background-color:#EEEEEE;
+}
+
+.voucher-table td {
+ color:#000000;
+ padding:8px 8px 8px 8px;
+}
+
+.voucher-table tr.new-row {
+ background-color:#FFFFE0;
+}
+
+/******************************************************************************/
/****************************** CUSTOM TABLES *********************************/
/******************************************************************************/
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index f66438b..6d2ef11 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -945,6 +945,8 @@ class Voucher extends Controller {
echo '<td>';
echo img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Remove Ledger',
'class' => 'deleterow'));
echo '</td>';
+ echo '<td class="ledger-balance"><div></div>';
+ echo '</td>';
echo '</tr>';
return;
}
diff --git a/system/application/views/voucher/add.php
b/system/application/views/voucher/add.php
index 004cc8a..c73c2bf 100644
--- a/system/application/views/voucher/add.php
+++ b/system/application/views/voucher/add.php
@@ -194,8 +194,8 @@ $(document).ready(function() {
echo form_input_date($voucher_date);
echo "</p>";
- echo "<table class=\"vouchertable\">";
- echo "<thead><tr><th>Type</th><th>Ledger
A/C</th><th>Dr Amount</th><th>Cr Amount</th><th
colspan=2>Actions</th><th colspan=2>Cur
Balance</th></tr></thead>";
+ echo "<table class=\"voucher-table\">";
+ echo "<thead><tr><th>Type</th><th>Ledger
A/C</th><th>Dr Amount</th><th>Cr Amount</th><th
colspan=2></th><th colspan=2>Cur
Balance</th></tr></thead>";
foreach ($ledger_dc as $i => $ledger)
{
@@ -230,11 +230,11 @@ $(document).ready(function() {
echo "</tr>";
}
- echo "<tr><td colspan=4><hr
/></td><td></td></tr>";
- echo "<tr id=\"total\"><td colspan=2>TOTAL</td><td
id=\"dr-total\">0</td><td
id=\"cr-total\">0</td><td>" . img(array('src' =>
asset_url() . "images/icons/gear.png", 'border' => '0',
'alt' => 'Recalculate Total', 'class' =>
'recalculate', 'title' => 'Recalculate Total')) .
"</tr>";
+ echo "<tr><td colspan=\"7\"></td></tr>";
+ echo "<tr id=\"voucher-total\"><td
colspan=2><strong>Total</strong></td><td
id=\"dr-total\">0</td><td
id=\"cr-total\">0</td><td>" . img(array('src' =>
asset_url() . "images/icons/gear.png", 'border' => '0',
'alt' => 'Recalculate Total', 'class' =>
'recalculate', 'title' => 'Recalculate Total')) .
"</td><td></td><td></td></tr>";
+ echo "<tr id=\"voucher-difference\"><td
colspan=2><strong>Difference</strong></td><td
id=\"dr-diff\"></td><td
id=\"cr-diff\"></td><td></td><td></td><td></td></tr>";
- echo "<tr id=\"difference\"><td
colspan=2>DIFFERENCE</td><td id=\"dr-diff\"></td><td
id=\"cr-diff\"></td></tr>";
echo "</table>";
echo "<p>";
commit 543cfac0115011df37e3380e64024099517f5e83
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 10:34:24 2010 +0530
Profit and Loss Statement now uses simple table
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index b4e6be6..ffaa97b 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -107,6 +107,7 @@
padding-right: 20px;
}
+/* balance sheet */
.balance-sheet-table {
border:1px solid #BBBBBB;
}
@@ -132,6 +133,32 @@
padding:8px 8px 8px 8px;
}
+/* profit and loss */
+.profit-loss-table {
+ border:1px solid #BBBBBB;
+}
+
+.profit-loss-table td {
+ border:1px solid #EEEEEE;
+}
+
+.profit-loss-table tr.tr-group td {
+ background-color:#FFFFF0;
+}
+
+.profit-loss-total-table {
+ font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
+ font-size:13px;
+ border-collapse:collapse;
+ text-align:left;
+}
+
+.profit-loss-total-table td {
+ border-bottom:1px solid #FFFFFF;
+ color:#000000;
+ padding:8px 8px 8px 8px;
+}
+
.dashboard-cashbank-table {
border-collapse: collapse;
text-align: left;
diff --git a/system/application/views/report/profitandloss.php
b/system/application/views/report/profitandloss.php
index cb03336..c134b7d 100644
--- a/system/application/views/report/profitandloss.php
+++ b/system/application/views/report/profitandloss.php
@@ -11,8 +11,8 @@
$gross_expense_total = 0;
$gross_expense_list_q = $this->db->query("SELECT * FROM groups WHERE
parent_id = 4 AND affects_gross = 1");
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"generaltable\"
width=\"450\">";
- echo "<thead><tr><th>Gross
Expenses</th><th>Amount</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-table\" width=\"450\">";
+ echo "<thead><tr><th>Expenses (Gross)</th><th
align=\"right\">Amount</th></tr></thead>";
foreach ($gross_expense_list_q->result() as $row)
{
$gross_expense = new Accountlist();
@@ -27,8 +27,8 @@
$gross_income_total = 0;
$gross_income_list_q = $this->db->query("SELECT * FROM groups WHERE parent_id
= 3 AND affects_gross = 1");
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"generaltable\"
width=\"450\">";
- echo "<thead><tr><th>Gross
Incomes</th><th>Amount</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-table\" width=\"450\">";
+ echo "<thead><tr><th>Incomes (Gross)</th><th
align=\"right\">Amount</th></tr></thead>";
foreach ($gross_income_list_q->result() as $row)
{
$gross_income = new Accountlist();
@@ -49,7 +49,7 @@
$grosstotal = $gross_expense_total;
echo "<tr style=\"background-color:#F8F8F8;\">";
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"vouchertable\"
width=\"450\">";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-total-table\" width=\"450\">";
echo "<tr valign=\"top\">";
echo "<td class=\"bold\">Total Gross Expenses</td>";
echo "<td align=\"right\" class=\"bold\">" .
convert_cur($gross_expense_total) . "</td>";
@@ -78,7 +78,7 @@
/* Showing Gross P/L : Incomes */
$grosstotal = $gross_income_total;
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"vouchertable\"
width=\"450\">";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-total-table\" width=\"450\">";
echo "<tr valign=\"top\">";
echo "<td class=\"bold\">Total Gross Incomes</td>";
echo "<td align=\"right\" class=\"bold\">" .
convert_cur($gross_income_total) . "</td>";
@@ -104,6 +104,8 @@
echo "</td>";
echo "</tr>";
+ echo
"<tr><td> </td><td> </td></tr>";
+
/**********************************************************************/
/************************* NET CALCULATIONS ***************************/
/**********************************************************************/
@@ -112,8 +114,8 @@
$net_expense_total = 0;
$net_expense_list_q = $this->db->query("SELECT * FROM groups WHERE parent_id
= 4 AND affects_gross != 1");
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"generaltable\"
width=\"450\">";
- echo
"<thead><tr><th>Expenses</th><th>Amount</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-table\" width=\"450\">";
+ echo "<thead><tr><th>Expenses (Net)</th><th
align=\"right\">Amount</th></tr></thead>";
foreach ($net_expense_list_q->result() as $row)
{
$net_expense = new Accountlist();
@@ -128,8 +130,8 @@
$net_income_total = 0;
$net_income_list_q = $this->db->query("SELECT * FROM groups WHERE parent_id =
3 AND affects_gross != 1");
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"generaltable\"
width=\"450\">";
- echo
"<thead><tr><th>Incomes</th><th>Amount</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-table\" width=\"450\">";
+ echo "<thead><tr><th>Incomes (Net)</th><th
align=\"right\">Amount</th></tr></thead>";
foreach ($net_income_list_q->result() as $row)
{
$net_income = new Accountlist();
@@ -150,7 +152,7 @@
$nettotal = $net_expense_total;
echo "<tr style=\"background-color:#F8F8F8;\">";
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"vouchertable\"
width=\"450\">";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-total-table\" width=\"450\">";
echo "<tr valign=\"top\">";
echo "<td class=\"bold\">Total Expenses</td>";
echo "<td align=\"right\" class=\"bold\">" .
convert_cur($nettotal) . "</td>";
@@ -192,7 +194,7 @@
/* Showing Net P/L : Incomes */
$nettotal = $net_income_total;
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"vouchertable\"
width=\"450\">";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
profit-loss-total-table\" width=\"450\">";
echo "<tr valign=\"top\">";
echo "<td class=\"bold\">Total Incomes</td>";
echo "<td align=\"right\" class=\"bold\">" .
convert_cur($nettotal) . "</td>";
commit baee436df83fac7c41bcafa5161e575085912cc6
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 10:17:27 2010 +0530
Balancesheet now styled with simple table
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index b0ba30e..b4e6be6 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -107,6 +107,31 @@
padding-right: 20px;
}
+.balance-sheet-table {
+ border:1px solid #BBBBBB;
+}
+
+.balance-sheet-table td {
+ border:1px solid #EEEEEE;
+}
+
+.balance-sheet-table tr.tr-group td {
+ background-color:#FFFFF0;
+}
+
+.balance-sheet-total-table {
+ font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
+ font-size:13px;
+ border-collapse:collapse;
+ text-align:left;
+}
+
+.balance-sheet-total-table td {
+ border-bottom:1px solid #FFFFFF;
+ color:#000000;
+ padding:8px 8px 8px 8px;
+}
+
.dashboard-cashbank-table {
border-collapse: collapse;
text-align: left;
diff --git a/system/application/libraries/Accountlist.php
b/system/application/libraries/Accountlist.php
index 74862a7..2540064 100644
--- a/system/application/libraries/Accountlist.php
+++ b/system/application/libraries/Accountlist.php
@@ -66,13 +66,14 @@ class Accountlist
}
}
+ /* Display Account list in Balance sheet and Profit and Loss st */
function account_st_short($c = 0)
{
$this->counter = $c;
if ($this->id != 0)
{
- echo "<tr class=\"group-tr\">";
- echo "<td class=\"group-td\">";
+ echo "<tr class=\"tr-group\">";
+ echo "<td class=\"td-group\">";
echo $this->print_space($this->counter);
echo " " . $this->name;
echo "</td>";
@@ -100,8 +101,8 @@ class Accountlist
$this->counter++;
foreach ($this->children_ledgers as $id => $data)
{
- echo "<tr class=\"ledger-tr\">";
- echo "<td class=\"ledger-td\">";
+ echo "<tr class=\"tr-ledger\">";
+ echo "<td class=\"td-ledger\">";
echo $this->print_space($this->counter);
echo " " . anchor('report/ledgerst/' .
$data['id'], $data['name'], array('title' =>
$data['name'] . ' Ledger Statement', 'style' =>
'color:#000000'));
echo "</td>";
diff --git a/system/application/views/report/balancesheet.php
b/system/application/views/report/balancesheet.php
index bd8e016..174c803 100644
--- a/system/application/views/report/balancesheet.php
+++ b/system/application/views/report/balancesheet.php
@@ -7,8 +7,8 @@
$liability = new Accountlist();
echo "<td>";
$liability->init(2);
- echo "<table border=0 cellpadding=5 class=\"generaltable\"
width=\"450\">";
- echo
"<thead><tr><th>Liabilities</th><th>Amount</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
balance-sheet-table\" width=\"450\">";
+ echo "<thead><tr><th>Liabilities</th><th
align=\"right\">Amount</th></tr></thead>";
$liability->account_st_short(0);
echo "</table>";
echo "</td>";
@@ -17,8 +17,8 @@
$asset = new Accountlist();
echo "<td>";
$asset->init(1);
- echo "<table border=0 cellpadding=5 class=\"generaltable\"
width=\"450\">";
- echo
"<thead><tr><th>Assets</th><th>Amount</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
balance-sheet-table\" width=\"450\">";
+ echo "<thead><tr><th>Assets</th><th
align=\"right\">Amount</th></tr></thead>";
$asset->account_st_short(0);
echo "</table>";
echo "</td>";
@@ -44,7 +44,7 @@
echo "<tr style=\"background-color:#F8F8F8;\">";
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"vouchertable\"
width=\"450\">";
+ echo "<table border=0 cellpadding=5
class=\"balance-sheet-total-table\" width=\"450\">";
echo "<tr valign=\"top\">";
echo "<td class=\"bold\">Liability Total</td>";
echo "<td align=\"right\" class=\"bold\">" .
convert_cur($liability_total) . "</td>";
@@ -98,7 +98,7 @@
$total = $asset_total;
echo "<td>";
- echo "<table border=0 cellpadding=5 class=\"vouchertable\"
width=\"450\">";
+ echo "<table border=0 cellpadding=5
class=\"balance-sheet-total-table\" width=\"450\">";
echo "<tr valign=\"top\">";
echo "<td class=\"bold\">Asset Total</td>";
echo "<td align=\"right\" class=\"bold\">" .
convert_cur($asset_total) . "</td>";
commit 40a9cd23f57612dce45b4bbee9ca25af2a260986
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Wed Dec 8 09:51:55 2010 +0530
Removed eidt and delete links for top level groups
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/libraries/Accountlist.php
b/system/application/libraries/Accountlist.php
index 28abd33..74862a7 100644
--- a/system/application/libraries/Accountlist.php
+++ b/system/application/libraries/Accountlist.php
@@ -140,8 +140,13 @@ class Accountlist
echo "<td>-</td>";
echo "<td>-</td>";
- echo "<td class=\"td-actions\">" .
anchor('group/edit/' . $this->id , "Edit", array('title'
=> 'Edit Group', 'class' => 'red-link'));
- echo " " . anchor('group/delete/' . $this->id,
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete group')),
array('class' => "confirmClick", 'title' => "Delete
Group")) . "</td>";
+ if ($this->id <= 4)
+ {
+ echo "<td class=\"td-actions\"></tr>";
+ } else {
+ echo "<td class=\"td-actions\">" .
anchor('group/edit/' . $this->id , "Edit", array('title'
=> 'Edit Group', 'class' => 'red-link'));
+ echo " " . anchor('group/delete/' . $this->id,
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete group')),
array('class' => "confirmClick", 'title' => "Delete
Group")) . "</td>";
+ }
echo "</tr>";
}
foreach ($this->children_groups as $id => $data)
diff --git a/system/application/views/welcome_message.php
b/system/application/views/welcome_message.php
index 530e7e1..b16ede9 100644
--- a/system/application/views/welcome_message.php
+++ b/system/application/views/welcome_message.php
@@ -87,7 +87,7 @@ jQuery(document).ready(function () {
<div class="dashboard-title">Account Summary</div>
<div class="dashboard-content">
<div>Welcome back, <strong><?php echo
$this->config->item('account_name');?> !</strong></div>
- <div id="dashboard-draft">You have <?php echo $draft_count;?>
draft voucher(s)</div>
+ <div id="dashboard-draft">You have <?php echo
anchor("voucher/show/draft", $draft_count . " draft",
array('class' => 'black-link')); ?> voucher(s)</div>
</div>
</div>
<div class="clear"></div>
commit 3f34cf90958ba606ae0dd1ea6cd72c31fa0a8962
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 21:52:21 2010 +0530
Added Tags sidebar
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index 192d0cf..7065075 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -162,3 +162,40 @@ ul#pagination-flickr {
.dashboard-log-content {
padding:8px;
}
+
+/******************************* TAGS *****************************************/
+#tag-sidebar {
+ float:right;
+ text-align:left;
+ width:120px;
+ border:1px solid #999999;
+}
+
+#tag-sidebar .tag-title {
+ background-color:#EEEEEE;
+ font-weight:bold;
+ border-bottom:1px solid #999999;
+ padding:8px 8px 2px 8px;
+}
+
+#tag-sidebar .tag-title a {
+ font-weight:normal;
+ text-decoration:none;
+ font-size:12px;
+ color:#FF0000;
+}
+
+#tag-sidebar ul {
+ list-style:none;
+ margin:0;
+ padding:10px 10px 10px 10px;
+}
+
+#tag-sidebar ul li {
+ padding-bottom:5px;
+}
+
+#tag-sidebar ul li a.tag-active {
+ color:#0000FF;
+ text-decoration:none;
+}
diff --git a/system/application/controllers/tag.php
b/system/application/controllers/tag.php
index 012fa73..66054c7 100644
--- a/system/application/controllers/tag.php
+++ b/system/application/controllers/tag.php
@@ -25,8 +25,8 @@ class Tag extends Controller {
$data['tag_title'] = array(
'name' => 'tag_title',
'id' => 'tag_title',
- 'maxlength' => '50',
- 'size' => '50',
+ 'maxlength' => '15',
+ 'size' => '15',
'value' => '',
);
$data['tag_color'] = array(
@@ -45,7 +45,7 @@ class Tag extends Controller {
);
/* Form validations */
- $this->form_validation->set_rules('tag_title', 'Tag title',
'trim|required|min_length[2]|max_length[50]|unique[tags.title]');
+ $this->form_validation->set_rules('tag_title', 'Tag title',
'trim|required|min_length[2]|max_length[15]|unique[tags.title]');
$this->form_validation->set_rules('tag_color', 'Tag color',
'trim|required|exact_length[6]|is_hex');
$this->form_validation->set_rules('tag_background', 'Background
color', 'trim|required|exact_length[6]|is_hex');
@@ -116,8 +116,8 @@ class Tag extends Controller {
$data['tag_title'] = array(
'name' => 'tag_title',
'id' => 'tag_title',
- 'maxlength' => '50',
- 'size' => '50',
+ 'maxlength' => '15',
+ 'size' => '15',
'value' => $tag_data->title,
);
$data['tag_color'] = array(
@@ -137,7 +137,7 @@ class Tag extends Controller {
$data['tag_id'] = $id;
/* Form validations */
- $this->form_validation->set_rules('tag_title', 'Tag title',
'trim|required|min_length[2]|max_length[50]|uniquewithid[tags.title.' . $id .
']');
+ $this->form_validation->set_rules('tag_title', 'Tag title',
'trim|required|min_length[2]|max_length[15]|uniquewithid[tags.title.' . $id .
']');
$this->form_validation->set_rules('tag_color', 'Tag color',
'trim|required|exact_length[6]|is_hex');
$this->form_validation->set_rules('tag_background', 'Background
color', 'trim|required|exact_length[6]|is_hex');
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 4434178..f66438b 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -19,10 +19,14 @@ class Voucher extends Controller {
function show($voucher_type)
{
+ $this->load->model('Tag_model');
+ $data['tag_id'] = 0;
if ($voucher_type == "tag")
{
- $tag_id = (int)$this->uri->segment(4);
+ $tag_id = (int)$this->uri->segment(4);
+ $data['tag_id'] = $tag_id;
}
+
switch ($voucher_type)
{
case 'all' :
@@ -54,7 +58,6 @@ class Voucher extends Controller {
$data['voucher_type'] = "";
break;
case 'tag' :
- $this->load->model('Tag_model');
$tag_name = $this->Tag_model->tag_name($tag_id);
$this->template->set('page_title', 'Vouchers Tagged "' .
$tag_name . '"');
$data['voucher_type'] = "";
diff --git a/system/application/models/tag_model.php
b/system/application/models/tag_model.php
index 0daabaf..7a75042 100644
--- a/system/application/models/tag_model.php
+++ b/system/application/models/tag_model.php
@@ -7,10 +7,11 @@ class Tag_model extends Model {
parent::Model();
}
- function get_all_tags()
+ function get_all_tags($allow_none = TRUE)
{
$options = array();
- $options[0] = "(None)";
+ if ($allow_none)
+ $options[0] = "(None)";
$tag_q = $this->db->query('SELECT * FROM tags ORDER BY title ASC');
foreach ($tag_q->result() as $row)
{
@@ -31,6 +32,18 @@ class Tag_model extends Model {
return "";
}
+ function show_voucher_tag_link($tag_id)
+ {
+ if ($tag_id < 1)
+ return "";
+ $tag_q = $this->db->get_where('tags', array('id' =>
$tag_id));
+ if ($tag = $tag_q->row())
+ {
+ return "<span class=\"tags\" style=\"color:#" .
$tag->color . "; background-color:#" . $tag->background .
"\">" . anchor("voucher/show/tag/" . $tag->id ,
$tag->title, array('style' => 'text-decoration:none;color:#' .
$tag->color . ';')) . "</span>";
+ }
+ return "";
+ }
+
function tag_name($tag_id)
{
if ($tag_id < 1)
diff --git a/system/application/views/sidebar/tag.php
b/system/application/views/sidebar/tag.php
new file mode 100644
index 0000000..027af49
--- /dev/null
+++ b/system/application/views/sidebar/tag.php
@@ -0,0 +1,18 @@
+<?php
+echo "<div class=\"tag-title\">Tags<span
style=\"float:right;\">" . anchor("tag", "Edit") .
"</span></div>";
+ echo "<div class=\"tag-content\">";
+ $tags = $this->Tag_model->get_all_tags($allow_none = FALSE);
+ echo "<ul id=\"tag-list\">";
+ if ($tags)
+ {
+ foreach ($tags as $id => $title)
+ {
+
+ echo "<li>" . $this->Tag_model->show_voucher_tag_link($id) .
"</li>";
+ }
+ } else {
+ echo "<li>No tags defined</li>";
+ echo "<li>" . anchor("tag/add", "Add one",
array('title' => 'Add tag', 'class' => 'blue-link'))
. "</li>";
+ }
+ echo "</ul>";
+ echo "</div>";
diff --git a/system/application/views/voucher/index.php
b/system/application/views/voucher/index.php
index 7d791ba..4c8496a 100644
--- a/system/application/views/voucher/index.php
+++ b/system/application/views/voucher/index.php
@@ -1,4 +1,7 @@
-<?php echo $voucher_table ?>
+<div id="tag-sidebar">
+ <?php $this->load->view('sidebar/tag', $tag_id); ?>
+</div>
+<?php echo $voucher_table ?>
<div id="pagination-container"><?php echo
$this->pagination->create_links(); ?></div>
commit da2f8d7726acba6d1dbf467fc703709b8f343507
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 20:42:20 2010 +0530
Added list of tagged vouchers
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index a403b74..4434178 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -19,6 +19,10 @@ class Voucher extends Controller {
function show($voucher_type)
{
+ if ($voucher_type == "tag")
+ {
+ $tag_id = (int)$this->uri->segment(4);
+ }
switch ($voucher_type)
{
case 'all' :
@@ -49,6 +53,12 @@ class Voucher extends Controller {
$this->template->set('page_title', 'Draft Vouchers');
$data['voucher_type'] = "";
break;
+ case 'tag' :
+ $this->load->model('Tag_model');
+ $tag_name = $this->Tag_model->tag_name($tag_id);
+ $this->template->set('page_title', 'Vouchers Tagged "' .
$tag_name . '"');
+ $data['voucher_type'] = "";
+ break;
default :
$this->messages->add('Invalid voucher type', 'error');
redirect('voucher/show/all');
@@ -62,17 +72,28 @@ class Voucher extends Controller {
/* Pagination setup */
$this->load->library('pagination');
- $page_count = (int)$this->uri->segment(4);
+
+ if ($voucher_type == "tag")
+ $page_count = (int)$this->uri->segment(5);
+ else
+ $page_count = (int)$this->uri->segment(4);
+
$page_count = $this->input->xss_clean($page_count);
if ( ! $page_count)
$page_count = "0";
/* Pagination configuration */
+ if ($voucher_type == "tag")
+ {
+ $config['base_url'] = site_url('voucher/show/' . $voucher_type.
"/" . $tag_id);
+ $config['uri_segment'] = 5;
+ } else {
+ $config['base_url'] = site_url('voucher/show/' . $voucher_type);
+ $config['uri_segment'] = 4;
+ }
$pagination_counter = $this->config->item('row_count');
- $config['base_url'] = site_url('voucher/show/' . $voucher_type);
$config['num_links'] = 10;
$config['per_page'] = $pagination_counter;
- $config['uri_segment'] = 4;
$config['full_tag_open'] = '<ul
id="pagination-flickr">';
$config['full_close_open'] = '</ul>';
$config['num_tag_open'] = '<li>';
@@ -100,6 +121,9 @@ class Voucher extends Controller {
} else if ($voucher_type == "draft") {
$voucher_q = $this->db->query("SELECT * FROM vouchers WHERE draft = 1 ORDER
BY date DESC, number DESC LIMIT ${page_count}, ${pagination_counter}");
$config['total_rows'] = $this->db->query("SELECT * FROM vouchers
WHERE draft = 1")->num_rows();
+ } else if ($voucher_type == "tag") {
+ $voucher_q = $this->db->query("SELECT * FROM vouchers WHERE tag_id = ?
ORDER BY date DESC, number DESC LIMIT ${page_count}, ${pagination_counter}",
array($tag_id));
+ $config['total_rows'] = $this->db->query("SELECT * FROM vouchers
WHERE tag_id = ?", array($tag_id))->num_rows();
} else if ($voucher_type_int > 0) {
$voucher_q = $this->db->query("SELECT * FROM vouchers WHERE type = ? ORDER
BY date DESC, number DESC LIMIT ${page_count}, ${pagination_counter}",
array($voucher_type_int));
$config['total_rows'] = $this->db->query("SELECT * FROM vouchers
WHERE type = ?", array($voucher_type_int))->num_rows();
diff --git a/system/application/models/tag_model.php
b/system/application/models/tag_model.php
index d1c63a3..0daabaf 100644
--- a/system/application/models/tag_model.php
+++ b/system/application/models/tag_model.php
@@ -23,11 +23,23 @@ class Tag_model extends Model {
{
if ($tag_id < 1)
return "";
- $tag_q = $this->db->query('SELECT * FROM tags WHERE id = ?', $tag_id);
+ $tag_q = $this->db->get_where('tags', array('id' =>
$tag_id));
if ($tag = $tag_q->row())
{
return "<span class=\"tags\" style=\"color:#" .
$tag->color . "; background-color:#" . $tag->background .
"\">" . $tag->title . "</span>";
}
return "";
}
+
+ function tag_name($tag_id)
+ {
+ if ($tag_id < 1)
+ return "";
+ $tag_q = $this->db->get_where('tags', array('id' =>
$tag_id));
+ if ($tag = $tag_q->row())
+ {
+ return $tag->title;
+ }
+ return "";
+ }
}
commit 9352a70c25a5ce5406edfa1862b7f10b15757844
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 19:26:12 2010 +0530
Added draft voucher list
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 1e5d9bb..a403b74 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -24,31 +24,30 @@ class Voucher extends Controller {
case 'all' :
$this->template->set('page_title', 'All Vouchers');
$data['voucher_type'] = "";
- $data['voucher_table'] = $this->_show_voucher();
break;
case 'receipt' :
$this->template->set('page_title', 'Receipt Vouchers');
$this->template->set('nav_links', array('voucher/add/receipt'
=> 'New Receipt Voucher'));
$data['voucher_type'] = "receipt";
- $data['voucher_table'] = $this->_show_voucher(1);
break;
case 'payment' :
$this->template->set('page_title', 'Payment Vouchers');
$this->template->set('nav_links', array('voucher/add/payment'
=> 'New Payment Voucher'));
$data['voucher_type'] = "payment";
- $data['voucher_table'] = $this->_show_voucher(2);
break;
case 'contra' :
$this->template->set('page_title', 'Contra Vouchers');
$this->template->set('nav_links', array('voucher/add/contra'
=> 'New Contra Voucher'));
$data['voucher_type'] = "contra";
- $data['voucher_table'] = $this->_show_voucher(3);
break;
case 'journal' :
$this->template->set('page_title', 'Journal Vouchers');
$this->template->set('nav_links', array('voucher/add/journal'
=> 'New Journal Voucher'));
$data['voucher_type'] = "journal";
- $data['voucher_table'] = $this->_show_voucher(4);
+ break;
+ case 'draft' :
+ $this->template->set('page_title', 'Draft Vouchers');
+ $data['voucher_type'] = "";
break;
default :
$this->messages->add('Invalid voucher type', 'error');
@@ -56,32 +55,21 @@ class Voucher extends Controller {
return;
break;
}
- $this->template->load('template', 'voucher/index', $data);
- return;
- }
- function _show_voucher($voucher_type = NULL)
- {
+ $voucher_type_int = v_to_n($voucher_type);
+
$voucher_q = NULL;
/* Pagination setup */
$this->load->library('pagination');
$page_count = (int)$this->uri->segment(4);
$page_count = $this->input->xss_clean($page_count);
- if ( ! $page_count) $page_count = "0";
- $voucher_type_link = "";
- switch ($voucher_type)
- {
- case 1: $voucher_type_link = "receipt"; break;
- case 2: $voucher_type_link = "payment"; break;
- case 3: $voucher_type_link = "contra"; break;
- case 4: $voucher_type_link = "journal"; break;
- default: $voucher_type_link = "all"; break;
- }
+ if ( ! $page_count)
+ $page_count = "0";
/* Pagination configuration */
$pagination_counter = $this->config->item('row_count');
- $config['base_url'] = site_url('voucher/show/' . $voucher_type_link);
+ $config['base_url'] = site_url('voucher/show/' . $voucher_type);
$config['num_links'] = 10;
$config['per_page'] = $pagination_counter;
$config['uri_segment'] = 4;
@@ -104,14 +92,17 @@ class Voucher extends Controller {
$config['last_tag_open'] = '<li class="last">';
$config['last_tag_close'] = '</li>';
- if ($voucher_type > 5)
+ if ($voucher_type_int > 5)
{
$this->messages->add('Invalid voucher type', 'error');
redirect('voucher/show/all');
return;
- } else if ($voucher_type > 0) {
- $voucher_q = $this->db->query("SELECT * FROM vouchers WHERE type = ? ORDER
BY date DESC, number DESC LIMIT ${page_count}, ${pagination_counter}",
array($voucher_type));
- $config['total_rows'] = $this->db->query("SELECT * FROM vouchers
WHERE type = ?", array($voucher_type))->num_rows();
+ } else if ($voucher_type == "draft") {
+ $voucher_q = $this->db->query("SELECT * FROM vouchers WHERE draft = 1 ORDER
BY date DESC, number DESC LIMIT ${page_count}, ${pagination_counter}");
+ $config['total_rows'] = $this->db->query("SELECT * FROM vouchers
WHERE draft = 1")->num_rows();
+ } else if ($voucher_type_int > 0) {
+ $voucher_q = $this->db->query("SELECT * FROM vouchers WHERE type = ? ORDER
BY date DESC, number DESC LIMIT ${page_count}, ${pagination_counter}",
array($voucher_type_int));
+ $config['total_rows'] = $this->db->query("SELECT * FROM vouchers
WHERE type = ?", array($voucher_type_int))->num_rows();
} else {
$voucher_q = $this->db->query("SELECT * FROM vouchers ORDER BY date DESC,
number DESC LIMIT ${page_count}, ${pagination_counter}");
$config['total_rows'] = $this->db->count_all('vouchers');
@@ -129,6 +120,7 @@ class Voucher extends Controller {
{
$html_voucher_type = n_to_v($row->type);
+ /* Showing the credit ledger name for payment and debit for other voucher types */
$ledger_type = ($row->type == 2) ? "C" : "D";
$ledger_q = $this->db->query("SELECT ledgers.name as name FROM
voucher_items join ledgers on voucher_items.ledger_id = ledgers.id WHERE
voucher_items.voucher_id = ? AND voucher_items.dc = ?", array($row->id,
$ledger_type));
$ledger_multiple = ($ledger_q->num_rows() > 1) ? TRUE : FALSE;
@@ -171,7 +163,11 @@ class Voucher extends Controller {
}
$html .= "</tbody>";
$html .= "</table>";
- return $html;
+ $data['voucher_table'] = $html;
+
+ $this->template->load('template', 'voucher/index', $data);
+ return;
+
}
function view($voucher_type, $voucher_id = 0)
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 9493e6b..51953b2 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -85,6 +85,7 @@ $(document).ready(function() {
<li><?php echo anchor('voucher/show/payment', 'Payment',
array('title' => 'Payment Vouchers')); ?></li>
<li><?php echo anchor('voucher/show/contra', 'Contra',
array('title' => 'Contra Vouchers')); ?></li>
<li><?php echo anchor('voucher/show/journal', 'Journal',
array('title' => 'Journal Vouchers')); ?></li>
+ <li><?php echo anchor('voucher/show/draft', 'Draft',
array('title' => 'Draft Vouchers')); ?></li>
</ul>
</li>
<li>
commit 9398f42371213f4cdee061a0935e35c978e5f28a
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 19:07:21 2010 +0530
Dynamically adding javascript and css from controllers
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 7b83f8b..1e5d9bb 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -145,7 +145,7 @@ class Voucher extends Controller {
$html .= $this->Tag_model->show_voucher_tag($row->tag_id);
if ($ledger)
if ($ledger_multiple)
- $html .= anchor('voucher/view/' . strtolower($html_voucher_type) .
"/" . $row->id, "( " . $ledger->name . " )",
array('title' => 'View ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => 'blue-link'));
+ $html .= anchor('voucher/view/' . strtolower($html_voucher_type) .
"/" . $row->id, "(" . $ledger->name . ")",
array('title' => 'View ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => 'blue-link'));
else
$html .= anchor('voucher/view/' . strtolower($html_voucher_type) .
"/" . $row->id, $ledger->name, array('title' => 'View '
. ucfirst($html_voucher_type) . ' Voucher', 'class' =>
'blue-link'));
$html .= "</td>";
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index 98bff48..bfb8a64 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -13,6 +13,8 @@ class Welcome extends Controller {
$this->load->model('Ledger_model');
$this->load->library('accountlist');
$this->template->set('page_title', 'Welcome to Webzash');
+ $this->template->set('add_css', array("tufte-graph.css"));
+ $this->template->set('add_javascript', array("raphael.js",
"jquery.enumerable.js", "jquery.tufte-graph.js"));
/* Draft voucher count */
$draft_q = $this->db->get_where('vouchers', array('draft' =>
1));
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 339f70e..9493e6b 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -10,7 +10,16 @@
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/custom.css">
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/menu.css">
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/jquery.datepick.css">
-<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/tufte-graph.css">
+<?php
+/* Dynamically adding css files from controllers */
+if (isset($add_css))
+{
+ foreach ($add_css as $id => $row)
+ {
+ echo "<link type=\"text/css\" rel=\"stylesheet\"
href=\"" . asset_url() . "css/" . $row ."\">";
+ }
+}
+?>
<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.datepick.js"></script>
@@ -18,9 +27,16 @@
<script type="text/javascript" src="<?php echo asset_url();
?>js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/superfish.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/supersubs.js"></script>
-<script type="text/javascript" src="<?php echo asset_url();
?>js/raphael.js"></script>
-<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.enumerable.js"></script>
-<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.tufte-graph.js"></script>
+<?php
+/* Dynamically adding javascript files from controllers */
+if (isset($add_javascript))
+{
+ foreach ($add_javascript as $id => $row)
+ {
+ echo "<script type=\"text/javascript\" src=\"" .
asset_url() . "js/" . $row ."\"></script>";
+ }
+}
+?>
<script type="text/javascript">
/* Loading JQuery Superfish menu */
commit a37501690f7dd22f7beec6c69c338001e948ac70
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 17:11:48 2010 +0530
Converted table heading to small caps
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/views/report/ledgerst.php
b/system/application/views/report/ledgerst.php
index da67538..bf113e9 100644
--- a/system/application/views/report/ledgerst.php
+++ b/system/application/views/report/ledgerst.php
@@ -65,7 +65,7 @@
echo "<table border=0 cellpadding=5 class=\"simple-table
ledgerst-table\">";
- echo
"<thead><tr><th>DATE</th><th>NO.</th><th>LEDGER
NAME</th><th>STATUS</th><th>TYPE</th><th>DR
AMOUNT</th><th>CR
AMOUNT</th><th>BALANCE</th></tr></thead>";
+ echo
"<thead><tr><th>Date</th><th>No.</th><th>Ledger
Name</th><th>Status</th><th>Type</th><th>Dr
Amount</th><th>Cr
Amount</th><th>Balance</th></tr></thead>";
$odd_even = "odd";
$cur_balance = 0;
commit 3e8b24beac37c48905c25d15e8a8b6c13bf0d795
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 17:09:26 2010 +0530
Added Ledger name to Ledger Statement
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index fc2caff..b0ba30e 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -121,7 +121,7 @@
}
.ledgerst-table td {
- padding-right: 20px;
+
}
.ledgerst-table .tr-balance {
diff --git a/system/application/views/report/ledgerst.php
b/system/application/views/report/ledgerst.php
index 479a2a9..da67538 100644
--- a/system/application/views/report/ledgerst.php
+++ b/system/application/views/report/ledgerst.php
@@ -65,7 +65,7 @@
echo "<table border=0 cellpadding=5 class=\"simple-table
ledgerst-table\">";
- echo
"<thead><tr><th>DATE</th><th>NUMBER</th><th>STATUS</th><th>TYPE</th><th>DR
AMOUNT</th><th>CR
AMOUNT</th><th>BALANCE</th></tr></thead>";
+ echo
"<thead><tr><th>DATE</th><th>NO.</th><th>LEDGER
NAME</th><th>STATUS</th><th>TYPE</th><th>DR
AMOUNT</th><th>CR
AMOUNT</th><th>BALANCE</th></tr></thead>";
$odd_even = "odd";
$cur_balance = 0;
@@ -75,10 +75,10 @@
/* Opening balance */
if ($optype == "D")
{
- echo "<tr class=\"tr-balance\"><td colspan=6>Opening
Balance</td><td>" . convert_dc($optype) . " " . $opbalance .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td colspan=7>Opening
Balance</td><td>" . convert_dc($optype) . " " . $opbalance .
"</td></tr>";
$cur_balance += $opbalance;
} else {
- echo "<tr class=\"tr-balance\"><td colspan=6>Opening
Balance</td><td>" . convert_dc($optype) . " " . $opbalance .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td colspan=7>Opening
Balance</td><td>" . convert_dc($optype) . " " . $opbalance .
"</td></tr>";
$cur_balance -= $opbalance;
}
} else {
@@ -106,9 +106,9 @@
/* Show new current total */
if ($cur_balance < 0)
{
- echo "<tr class=\"tr-balance\"><td
colspan=6>Opening</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=7>Opening</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
} else {
- echo "<tr class=\"tr-balance\"><td
colspan=6>Opening</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=7>Opening</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
}
}
@@ -123,6 +123,39 @@
echo "<td>";
echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, $row->vnumber, array('title' => 'View ' . '
Voucher', 'style' => 'color:#000000'));
echo "</td>";
+
+ /* Getting opposite Ledger name */
+ echo "<td>";
+ if ($row->ldc == "D")
+ {
+
+ if ($opp_voucher_name_q = $this->db->query("SELECT * FROM voucher_items
WHERE voucher_id = ? AND dc = ?", array($row->vid, "C")))
+ {
+ $opp_voucher_name_d = $opp_voucher_name_q->row();
+ $opp_ledger_name =
$this->Ledger_model->get_name($opp_voucher_name_d->ledger_id);
+ if ($opp_voucher_name_q->num_rows() > 1)
+ {
+ echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, "(" . $opp_ledger_name . ")", array('title'
=> 'View ' . ' Voucher', 'style' =>
'color:#000000'));
+ } else {
+ echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, $opp_ledger_name, array('title' => 'View ' . '
Voucher', 'style' => 'color:#000000'));
+ }
+ }
+ } else {
+ if ($opp_voucher_name_q = $this->db->query("SELECT * FROM voucher_items
WHERE voucher_id = ? AND dc = ?", array($row->vid, "D")))
+ {
+ $opp_voucher_name_d = $opp_voucher_name_q->row();
+ $opp_ledger_name =
$this->Ledger_model->get_name($opp_voucher_name_d->ledger_id);
+ if ($opp_voucher_name_q->num_rows() > 1)
+ {
+ echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, "(" . $opp_ledger_name . ")", array('title'
=> 'View ' . ' Voucher', 'style' =>
'color:#000000'));
+ } else {
+ echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, $opp_ledger_name, array('title' => 'View ' . '
Voucher', 'style' => 'color:#000000'));
+ }
+ }
+
+ }
+ echo "</td>";
+
echo "<td>";
echo ($row->vdraft == 1) ? "Draft" : "Active";
echo "</td>";
@@ -162,9 +195,9 @@
/* Current Page Closing Balance */
if ($cur_balance < 0)
{
- echo "<tr class=\"tr-balance\"><td
colspan=6>Closing</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=7>Closing</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
} else {
- echo "<tr class=\"tr-balance\"><td
colspan=6>Closing</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=7>Closing</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
}
echo "</table>";
commit c814a486ba947cc03bc4e19ba81ebbb4b5be6f8e
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 16:54:13 2010 +0530
Ledger Statement now uses simple table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index 9eb8061..fc2caff 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -49,27 +49,26 @@
/******************************* SIMPLE TABLE *********************************/
/******************************************************************************/
-.simple-table
-{
- font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
- font-size: 13px;
- border-collapse: collapse;
- text-align: left;
-}
-.simple-table th
-{
- font-weight: normal;
- color: #000000;
- padding: 5px 8px;
- border-bottom: 1px solid #999999;
- border-top: 1px solid #999999;
+.simple-table {
+ font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
+ font-size:13px;
+ border-collapse:collapse;
+ text-align:left;
+}
+
+.simple-table th {
+ font-weight:normal;
+ color:#000000;
+ padding:5px 8px;
+ border-bottom:1px solid #999999;
+ border-top:1px solid #999999;
background-color:#EEEEEE;
}
-.simple-table td
-{
- border-bottom: 1px solid #BBBBBB;
- color: #000000;
- padding: 8px 8px 8px 8px;
+
+.simple-table td {
+ border-bottom:1px solid #BBBBBB;
+ color:#000000;
+ padding:8px 8px 8px 8px;
}
.simple-table tr.tr-draft {
@@ -113,12 +112,35 @@
text-align: left;
}
-.dashboard-cashbank-table td
-{
+.dashboard-cashbank-table td {
padding: 8px 8px 8px 20px;
}
-.dashboard-cashbank-table td a
-{
+.dashboard-cashbank-table td a {
color: #000000;
}
+
+.ledgerst-table td {
+ padding-right: 20px;
+}
+
+.ledgerst-table .tr-balance {
+ font-weight:bold;
+}
+
+.ledger-summary {
+ font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
+ font-size: 13px;
+ border-collapse: collapse;
+ text-align: left;
+ border: 1px solid #BBBBBB;
+ background-color:#FFFFCC;
+}
+
+.ledger-summary tr {
+ border: 1px solid #BBBBBB;
+}
+
+.ledger-summary td {
+ padding: 8px 8px 8px 8px;
+}
diff --git a/system/application/views/report/ledgerst.php
b/system/application/views/report/ledgerst.php
index 3bd5cb2..479a2a9 100644
--- a/system/application/views/report/ledgerst.php
+++ b/system/application/views/report/ledgerst.php
@@ -45,21 +45,27 @@
$clbalance = $this->Ledger_model->get_ledger_balance($ledger_id); /* Final
Closing Balance */
/* Ledger Summary */
+ echo "<table class=\"ledger-summary\">";
+ echo "<tr>";
if ($optype == "D")
- echo "<b>Opening Balance : </b>Dr " . $opbalance . "<br
/>";
+ echo "<td><b>Opening Balance</b></td><td>Dr "
. $opbalance . "</td>";
else
- echo "<b>Opening Balance : </b>Cr " . $opbalance . "<br
/>";
+ echo "<td><b>Opening Balance</b></td><td>Cr "
. $opbalance . "</td>";
+ echo "</tr>";
+ echo "<tr>";
if ($clbalance < 0)
- echo "<b>Closing Balance : </b>Cr " .
convert_cur(-$clbalance) . "<br />";
+ echo "<td><b>Closing Balance</b></td><td>Cr "
. convert_cur(-$clbalance) . "</td>";
else
- echo "<b>Closing Balance : </b>Dr " .
convert_cur($clbalance) . "<br />";
+ echo "<td><b>Closing Balance</b></td><td>Dr "
. convert_cur($clbalance) . "</td>";
+ echo "</tr>";
+ echo "</table>";
echo "<br />";
$ledgerst_q = $this->db->query("SELECT vouchers.id as vid, vouchers.number
as vnumber, vouchers.date as vdate, vouchers.draft as vdraft, vouchers.type as vtype,
voucher_items.amount as lamount, voucher_items.dc as ldc FROM vouchers join voucher_items
on vouchers.id = voucher_items.voucher_id WHERE voucher_items.ledger_id = ? ORDER BY
vouchers.date ASC, vouchers.number ASC LIMIT ${page_count}, ${pagination_counter}",
array($ledger_id));
- echo "<table border=0 cellpadding=5
class=\"generaltable\">";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
ledgerst-table\">";
- echo
"<thead><tr><th>Date</th><th>Number</th><th>Status</th><th>Type</th><th>Dr
Amount</th><th>Cr Amount</th><th>
Balance</th></tr></thead>";
+ echo
"<thead><tr><th>DATE</th><th>NUMBER</th><th>STATUS</th><th>TYPE</th><th>DR
AMOUNT</th><th>CR
AMOUNT</th><th>BALANCE</th></tr></thead>";
$odd_even = "odd";
$cur_balance = 0;
@@ -100,9 +106,9 @@
/* Show new current total */
if ($cur_balance < 0)
{
- echo "<tr class=\"tr-balance\"><td colspan=6>Opening
Balance</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=6>Opening</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
} else {
- echo "<tr class=\"tr-balance\"><td colspan=6>Opening
Balance</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=6>Opening</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
}
}
@@ -156,9 +162,9 @@
/* Current Page Closing Balance */
if ($cur_balance < 0)
{
- echo "<tr class=\"tr-balance\"><td colspan=6>Closing
Balance</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=6>Closing</td><td>Cr " . convert_cur(-$cur_balance) .
"</td></tr>";
} else {
- echo "<tr class=\"tr-balance\"><td colspan=6>Closing
Balance</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
+ echo "<tr class=\"tr-balance\"><td
colspan=6>Closing</td><td>Dr " . convert_cur($cur_balance) .
"</td></tr>";
}
echo "</table>";
commit 04141aae329b85579eb036352255581dfd877445
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 16:15:54 2010 +0530
Trail balance uses the simple-table style
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index 705173a..9eb8061 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -80,6 +80,10 @@
background-color:#FFFFE6;
}
+.simple-table tr.tr-total {
+ background-color:#FFFFE6;
+}
+
.simple-table a.red-link {
color:#FF0000;
}
@@ -100,6 +104,10 @@
padding-right: 8px;
}
+.trial-balance-table td {
+ padding-right: 20px;
+}
+
.dashboard-cashbank-table {
border-collapse: collapse;
text-align: left;
diff --git a/system/application/views/report/trialbalance.php
b/system/application/views/report/trialbalance.php
index 3b924f9..e028a09 100644
--- a/system/application/views/report/trialbalance.php
+++ b/system/application/views/report/trialbalance.php
@@ -2,7 +2,7 @@
$temp_dr_total = 0;
$temp_cr_total = 0;
- echo "<table border=0 cellpadding=5 class=\"generaltable\">";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
trial-balance-table\">";
echo "<thead><tr><th>Ledger A/C</th><th>O/P
Balance</th><th>C/L Balance</th><th>Dr
Total</th><th>Cr Total</th></tr></thead>";
$this->load->model('Ledger_model');
$all_ledgers = $this->Ledger_model->get_all_ledgers();
@@ -57,6 +57,11 @@
echo "</tr>";
$odd_even = ($odd_even == "odd") ? "even" : "odd";
}
- echo "<tr style=\"background-color:#F8F8F8;\"><td
colspan=3>TOTAL</td><td>Dr " . convert_cur($temp_dr_total) .
"</td><td>Cr " . convert_cur($temp_cr_total) .
"</td></tr>";
+ echo "<tr class=\"tr-total\"><td colspan=3>TOTAL ";
+ if ($temp_dr_total == $temp_cr_total)
+ echo "<img src=\"" . asset_url() .
"images/icons/match.png\">";
+ else
+ echo "<img src=\"" . asset_url() .
"images/icons/nomatch.png\">";
+ echo "</td><td>Dr " . convert_cur($temp_dr_total) .
"</td><td>Cr " . convert_cur($temp_cr_total) .
"</td></tr>";
echo "</table>";
commit 4a1edfe7f6bbea613f5a5ae64bd2770b8cb38537
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 16:14:48 2010 +0530
Added images from GNOME Gion icon theme
ICON Theme :
http://art.gnome.org/themes/icon/1340
Licensed under GNU GPL
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/images/icons/match.png
b/system/application/assets/images/icons/match.png
new file mode 100644
index 0000000..2fd3819
Binary files /dev/null and b/system/application/assets/images/icons/match.png differ
diff --git a/system/application/assets/images/icons/nomatch.png
b/system/application/assets/images/icons/nomatch.png
new file mode 100644
index 0000000..ed750bd
Binary files /dev/null and b/system/application/assets/images/icons/nomatch.png differ
commit 7f981f2a9cca573176d77be09730f555cb10bc03
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 15:53:52 2010 +0530
Styled the Dashboard
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index d7d8919..192d0cf 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -110,3 +110,55 @@ ul#pagination-flickr {
font-weight:italic;
}
+/********************************* DASHBOARD **********************************/
+
+#dashboard-summary {
+ width:500px;
+ float:left;
+}
+
+.dashboard-item {
+ -moz-border-radius:3px 3px 3px 3px;
+ border-radius:3px 3px 3px 3px;
+ float:left;
+ border: 1px solid #BBBBBB;
+ margin-bottom:20px;
+ width:500px;
+}
+
+.dashboard-title {
+ color: #464646;
+ background-color:#EEEEEE;
+ padding:8px;
+ font-weight:bold;
+}
+
+.dashboard-content {
+ padding:8px;
+}
+
+#dashboard-log {
+ float:left;
+ width:450px;
+ margin-left:20px;
+}
+
+.dashboard-log-item {
+ -moz-border-radius:3px 3px 3px 3px;
+ border-radius:3px 3px 3px 3px;
+ float:left;
+ border: 1px solid #BBBBBB;
+ margin-bottom:20px;
+ width:440px;
+}
+
+.dashboard-log-title {
+ color: #464646;
+ background-color:#EEEEEE;
+ padding:8px;
+ font-weight:bold;
+}
+
+.dashboard-log-content {
+ padding:8px;
+}
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index f20a71c..705173a 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -99,3 +99,18 @@
.account-table .td-actions {
padding-right: 8px;
}
+
+.dashboard-cashbank-table {
+ border-collapse: collapse;
+ text-align: left;
+}
+
+.dashboard-cashbank-table td
+{
+ padding: 8px 8px 8px 20px;
+}
+
+.dashboard-cashbank-table td a
+{
+ color: #000000;
+}
diff --git a/system/application/views/welcome_message.php
b/system/application/views/welcome_message.php
index 59f8bd2..530e7e1 100644
--- a/system/application/views/welcome_message.php
+++ b/system/application/views/welcome_message.php
@@ -82,54 +82,73 @@ jQuery(document).ready(function () {
</script>
<h3><This is beta software not meant for production use
!></h3>
-<div>
- <div>Welcome back, <strong><?php echo
$this->config->item('account_name');?></strong></div>
- <br />
- <div>You have <?php echo $draft_count;?> draft voucher(s)</div>
- <br />
- <?php
- if ($bank_cash_account)
- {
- echo "<table>";
- echo "<tbody>";
- foreach ($bank_cash_account as $id => $row)
- {
- echo "<tr>";
- echo "<td>" . anchor('report/ledgerst/' . $row['id'],
$row['name'], array('title' => $row['name'] . '
Statement')) . "</td>";
- echo "<td>";
- if ($row['balance'] == 0)
- echo "0";
- else if ($row['balance'] > 0)
- echo "Dr " . $row['balance'];
- else
- echo "Cr " . -$row['balance'];
- echo "</td>";
- echo "</tr>";
- }
- echo "</tbody>";
- echo "</table>";
- } else {
- echo "You have not created any bank or cash account";
- }
- ?>
+<div id="dashboard-summary">
+ <div id="dashboard-welcome-back" class="dashboard-item">
+ <div class="dashboard-title">Account Summary</div>
+ <div class="dashboard-content">
+ <div>Welcome back, <strong><?php echo
$this->config->item('account_name');?> !</strong></div>
+ <div id="dashboard-draft">You have <?php echo $draft_count;?>
draft voucher(s)</div>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div id="dashboard-cash-bank" class="dashboard-item">
+ <div class="dashboard-title">Bank and Cash A/C's</div>
+ <div class="dashboard-content">
+ <?php
+ if ($bank_cash_account)
+ {
+ echo "<table class=\"dashboard-cashbank-table\">";
+ echo "<tbody>";
+ foreach ($bank_cash_account as $id => $row)
+ {
+ echo "<tr>";
+ echo "<td>" . anchor('report/ledgerst/' .
$row['id'], $row['name'], array('title' => $row['name']
. ' Statement')) . "</td>";
+ echo "<td>";
+ if ($row['balance'] == 0)
+ echo "0";
+ else if ($row['balance'] > 0)
+ echo "Dr " . $row['balance'];
+ else
+ echo "Cr " . -$row['balance'];
+ echo "</td>";
+ echo "</tr>";
+ }
+ echo "</tbody>";
+ echo "</table>";
+ } else {
+ echo "You have not created any bank or cash account";
+ }
+ ?>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div>
+ <table border="0">
+ <tbody>
+ <tr>
+ <td width="300">
+ <div id="income-expense" class="graph">
+ <div id="income-expense-graph-header"><h4>Incomes Vs
Expenses</h4></div>
+ <div id="income-expense-graph-data"></div>
+ </div>
+ </td>
+ <td width="300">
+ <div id="asset-liability" class="graph">
+ <div id="asset-liability-graph-header"><h4>Assets Vs
Liabilities</h4></div>
+ <div id="asset-liability-graph-data""></div>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div>
-<div>
- <table border="0">
- <tbody>
- <tr>
- <td width="300">
- <div id="income-expense" class="graph">
- <div id="income-expense-graph-header"><h4>Incomes Vs
Expenses</h4></div>
- <div id="income-expense-graph-data"></div>
- </div>
- </td>
- <td width="300">
- <div id="asset-liability" class="graph">
- <div id="asset-liability-graph-header"><h4>Assets Vs
Liabilities</h4></div>
- <div id="asset-liability-graph-data""></div>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
+<div id="dashboard-log">
+ <div id="dashboard-recent-log" class="dashboard-log-item">
+ <div class="dashboard-log-title">Recent Activity</div>
+ <div class="dashboard-log-content">
+ Hello World !
+ </div>
+ </div>
</div>
+<div class="clear"></div>
commit ef96ebb00be098c885fe903bc1787dbcd6de09a3
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 15:14:12 2010 +0530
Added nav-link buttons and simple-table style to account list
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index 721677d..d7d8919 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -109,3 +109,4 @@ ul#pagination-flickr {
font-size:12px;
font-weight:italic;
}
+
diff --git a/system/application/assets/css/style.css
b/system/application/assets/css/style.css
index a6c6153..36f8abd 100644
--- a/system/application/assets/css/style.css
+++ b/system/application/assets/css/style.css
@@ -108,22 +108,18 @@ body {
margin:0 18px 0 0;
}
-#content #main ul#main-links-nav li a
-{
- color:#000000;
- font-size:100%;
- background-color:#EEE;
- border:1px solid;
- border-color: #696 #363 #363 #696;
- padding:3px;
+#content #main ul#main-links-nav li a {
+ -moz-border-radius:3px 3px 3px 3px;
+ border-radius:3px 3px 3px 3px;
+ background:repeat-x scroll 0 0 transparent;
+ color:#FFFFFF;
+ font-size:11px;
+ font-weight:bold;
+ padding:4px 10px;
+ text-shadow:-1px -1px 0 #333333;
text-decoration:none;
}
-#content #main ul#main-links-nav li a:hover
-{
- color:#444444;
-}
-
/* COMMON */
.clear {
clear:both;
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index d15c9bd..f20a71c 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -52,13 +52,12 @@
.simple-table
{
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
- font-size: 12px;
+ font-size: 13px;
border-collapse: collapse;
text-align: left;
}
.simple-table th
{
- font-size: 12px;
font-weight: normal;
color: #000000;
padding: 5px 8px;
@@ -74,7 +73,11 @@
}
.simple-table tr.tr-draft {
- background-color:#FAF8CC;
+ background-color:#FFFFE6;
+}
+
+.simple-table tr.tr-group td {
+ background-color:#FFFFE6;
}
.simple-table a.red-link {
@@ -84,3 +87,15 @@
.simple-table a.blue-link {
color:#1A2745;
}
+
+/******************************************************************************/
+/****************************** CUSTOM TABLES *********************************/
+/******************************************************************************/
+
+.account-table td {
+ padding-right: 30px;
+}
+
+.account-table .td-actions {
+ padding-right: 8px;
+}
diff --git a/system/application/assets/images/buttons/navlink.png
b/system/application/assets/images/buttons/navlink.png
new file mode 100644
index 0000000..1b13e40
Binary files /dev/null and b/system/application/assets/images/buttons/navlink.png differ
diff --git a/system/application/libraries/Accountlist.php
b/system/application/libraries/Accountlist.php
index 4f2d054..28abd33 100644
--- a/system/application/libraries/Accountlist.php
+++ b/system/application/libraries/Accountlist.php
@@ -128,17 +128,20 @@ class Accountlist
$this->counter = $c;
if ($this->id != 0)
{
- echo "<tr class=\"group-tr\">";
- echo "<td class=\"group-td\">";
+ echo "<tr class=\"tr-group\">";
+ echo "<td class=\"td-group\">";
echo $this->print_space($this->counter);
- echo " " . $this->name;
+ if ($this->id <= 4)
+ echo " <strong>" . $this->name.
"</strong>";
+ else
+ echo " " . $this->name;
echo "</td>";
echo "<td>Group A/C</td>";
echo "<td>-</td>";
echo "<td>-</td>";
- echo "<td>" . anchor('group/edit/' . $this->id ,
img(array('src' => asset_url() . "images/icons/edit.png",
'border' => '0', 'alt' => 'Edit group')),
array('title' => "Edit Group")) . "</td>";
- echo "<td>" . anchor('group/delete/' . $this->id,
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete group')),
array('class' => "confirmClick", 'title' => "Delete
Group")) . "</td>";
+ echo "<td class=\"td-actions\">" .
anchor('group/edit/' . $this->id , "Edit", array('title'
=> 'Edit Group', 'class' => 'red-link'));
+ echo " " . anchor('group/delete/' . $this->id,
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete group')),
array('class' => "confirmClick", 'title' => "Delete
Group")) . "</td>";
echo "</tr>";
}
foreach ($this->children_groups as $id => $data)
@@ -152,8 +155,8 @@ class Accountlist
$this->counter++;
foreach ($this->children_ledgers as $id => $data)
{
- echo "<tr class=\"ledger-tr\">";
- echo "<td class=\"ledger-td\">";
+ echo "<tr class=\"tr-ledger\">";
+ echo "<td class=\"td-ledger\">";
echo $this->print_space($this->counter);
echo " " . anchor('report/ledgerst/' .
$data['id'], $data['name'], array('title' =>
$data['name'] . ' Ledger Statement', 'style' =>
'color:#000000'));
echo "</td>";
@@ -181,8 +184,8 @@ class Accountlist
}
echo "</td>";
- echo "<td>" . anchor('ledger/edit/' . $data['id'],
img(array('src' => asset_url() . "images/icons/edit.png",
'border' => '0', 'alt' => 'Edit Ledger')),
array('title' => "Edit Ledger")) . "</td>";
- echo "<td>" . anchor('ledger/delete/' . $data['id'],
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete Ledger')),
array('class' => "confirmClick", 'title' => "Delete
Ledger")) . "</td>";
+ echo "<td class=\"td-actions\">" .
anchor('ledger/edit/' . $data['id'], 'Edit', array('title'
=> "Edit Ledger", 'class' => 'red-link'));
+ echo " " . anchor('ledger/delete/' . $data['id'],
img(array('src' => asset_url() . "images/icons/delete.png",
'border' => '0', 'alt' => 'Delete Ledger')),
array('class' => "confirmClick", 'title' => "Delete
Ledger")) . "</td>";
echo "</tr>";
}
$this->counter--;
diff --git a/system/application/views/account/index.php
b/system/application/views/account/index.php
index 8799421..bcb50d7 100644
--- a/system/application/views/account/index.php
+++ b/system/application/views/account/index.php
@@ -5,8 +5,8 @@
$asset = new Accountlist();
echo "<td>";
$asset->init(0);
- echo "<table border=0 cellpadding=5 class=\"generaltable\">";
- echo "<thead><tr><th>Account
Name</th><th>Type</th><th>O/P Balance</th><th>C/L
Balance</th><th colspan=2>Actions</th></tr></thead>";
+ echo "<table border=0 cellpadding=5 class=\"simple-table
account-table\">";
+ echo "<thead><tr><th>Account
Name</th><th>Type</th><th>O/P Balance</th><th>C/L
Balance</th><th></th></tr></thead>";
$asset->account_st_main(-1);
echo "</table>";
echo "</td>";
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index c6e96de..339f70e 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -97,7 +97,7 @@ $(document).ready(function() {
<?php if (isset($nav_links)) {
echo "<ul id=\"main-links-nav\">";
foreach ($nav_links as $link => $title) {
- echo "<li>" . anchor($link, $title, array('title' =>
$title, 'class' => 'nav-links-item')) . "</li>";
+ echo "<li>" . anchor($link, $title, array('title' =>
$title, 'class' => 'nav-links-item', 'style' =>
'background-image:url(\'' . asset_url() .
'images/buttons/navlink.png\');')) . "</li>";
}
echo "</ul>";
} ?>
commit 75ecb62e10686c49a0295db5bd8d0ed37dba7877
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Tue Dec 7 14:09:00 2010 +0530
Added simple table styled voucher list
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/custom.css
b/system/application/assets/css/custom.css
index 3bc6707..721677d 100644
--- a/system/application/assets/css/custom.css
+++ b/system/application/assets/css/custom.css
@@ -64,7 +64,7 @@ ul#pagination-flickr {
border:solid 1px #FFFFFF;
}
#pagination-flickr .active{
- color:#ff0084;
+ color:#000000;
font-weight:bold;
display:block;
float:left;
diff --git a/system/application/assets/css/tables.css
b/system/application/assets/css/tables.css
index b614095..d15c9bd 100644
--- a/system/application/assets/css/tables.css
+++ b/system/application/assets/css/tables.css
@@ -19,23 +19,23 @@
background:none repeat scroll 0 0 #F8FBFC;
}
-tr.tr-odd {
+.generaltable tr.tr-odd {
background:none repeat scroll 0 0 #E5F1F4;
}
-tr.tr-even {
+.generaltable tr.tr-even {
background:none repeat scroll 0 0 #F8FBFC;
}
-tr.tr-balance {
+.generaltable tr.tr-balance {
background:none repeat scroll 0 0 #FFF8C6;
}
-tr.tr-draft {
+.generaltable tr.tr-draft {
background:none repeat scroll 0 0 #DDDDDD;
}
-tr.new-row {
+.generaltable tr.new-row {
background:none repeat scroll 0 0 #EEEEEE;
}
@@ -44,3 +44,43 @@ tr.new-row {
color:#FFFFFF;
font-weight:bold;
}
+
+/******************************************************************************/
+/******************************* SIMPLE TABLE *********************************/
+/******************************************************************************/
+
+.simple-table
+{
+ font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
+ font-size: 12px;
+ border-collapse: collapse;
+ text-align: left;
+}
+.simple-table th
+{
+ font-size: 12px;
+ font-weight: normal;
+ color: #000000;
+ padding: 5px 8px;
+ border-bottom: 1px solid #999999;
+ border-top: 1px solid #999999;
+ background-color:#EEEEEE;
+}
+.simple-table td
+{
+ border-bottom: 1px solid #BBBBBB;
+ color: #000000;
+ padding: 8px 8px 8px 8px;
+}
+
+.simple-table tr.tr-draft {
+ background-color:#FAF8CC;
+}
+
+.simple-table a.red-link {
+ color:#FF0000;
+}
+
+.simple-table a.blue-link {
+ color:#1A2745;
+}
diff --git a/system/application/assets/images/icons/delete.png
b/system/application/assets/images/icons/delete.png
index 6fc4d3b..8b0054a 100644
Binary files a/system/application/assets/images/icons/delete.png and
b/system/application/assets/images/icons/delete.png differ
diff --git a/system/application/assets/images/icons/email.png
b/system/application/assets/images/icons/email.png
index 63ac1a4..f328466 100644
Binary files a/system/application/assets/images/icons/email.png and
b/system/application/assets/images/icons/email.png differ
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 9a8d7c1..7b83f8b 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -120,13 +120,15 @@ class Voucher extends Controller {
/* Pagination initializing */
$this->pagination->initialize($config);
- $html = "<table border=0 cellpadding=5
class=\"generaltable\">";
- $html .=
"<thead><tr><th>Date</th><th>Number</th><th>Ledger
A/C</th><th>Type</th><th>Status</th><th>DR
Amount</th><th>CR Amount</th><th
colspan=5>Actions</th></tr></thead>";
+ $html = "<table border=0 cellpadding=5
class=\"simple-table\">";
+ $html .=
"<thead><tr><th>Date</th><th>No</th><th>Ledger
A/C</th><th>Type</th><th>Status</th><th>DR
Amount</th><th>CR
Amount</th><th></th></tr></thead>";
$html .= "<tbody>";
$odd_even = "odd";
foreach ($voucher_q->result() as $row)
{
+ $html_voucher_type = n_to_v($row->type);
+
$ledger_type = ($row->type == 2) ? "C" : "D";
$ledger_q = $this->db->query("SELECT ledgers.name as name FROM
voucher_items join ledgers on voucher_items.ledger_id = ledgers.id WHERE
voucher_items.voucher_id = ? AND voucher_items.dc = ?", array($row->id,
$ledger_type));
$ledger_multiple = ($ledger_q->num_rows() > 1) ? TRUE : FALSE;
@@ -137,18 +139,17 @@ class Voucher extends Controller {
$html .= "\">";
$html .= "<td>" . date_mysql_to_php($row->date) .
"</td>";
- $html .= "<td>" . $row->number . "</td>";
+ $html .= "<td>" . anchor('voucher/view/' .
strtolower($html_voucher_type) . "/" . $row->id, $row->number,
array('title' => 'View ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => 'blue-link')) . "</td>";
$html .= "<td>";
$html .= $this->Tag_model->show_voucher_tag($row->tag_id);
if ($ledger)
if ($ledger_multiple)
- $html .= "(" . $ledger->name . ")";
+ $html .= anchor('voucher/view/' . strtolower($html_voucher_type) .
"/" . $row->id, "( " . $ledger->name . " )",
array('title' => 'View ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => 'blue-link'));
else
- $html .= $ledger->name;
+ $html .= anchor('voucher/view/' . strtolower($html_voucher_type) .
"/" . $row->id, $ledger->name, array('title' => 'View '
. ucfirst($html_voucher_type) . ' Voucher', 'class' =>
'blue-link'));
$html .= "</td>";
- $html_voucher_type = n_to_v($row->type);
$html .= "<td>" . ucfirst($html_voucher_type) .
"</td>";
if ($row->draft == 0)
$html .= "<td>Active</td>";
@@ -157,15 +158,13 @@ class Voucher extends Controller {
$html .= "<td>" . $row->dr_total . "</td>";
$html .= "<td>" . $row->cr_total . "</td>";
- $html .= "<td>" . anchor('voucher/view/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/view.png", 'border' => '0',
'alt' => 'View ' . ucfirst($html_voucher_type) . ' Voucher')),
array('title' => 'View ' . ucfirst($html_voucher_type) . '
Voucher')) . "</td>";
-
- $html .= "<td>" . anchor('voucher/edit/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/edit.png", 'border' => '0',
'alt' => 'Edit ' . ucfirst($html_voucher_type) . ' Voucher')),
array('title' => 'Edit ' . ucfirst($html_voucher_type) . '
Voucher')) . "</td>";
+ $html .= "<td>" . anchor('voucher/edit/' .
strtolower($html_voucher_type) . "/" . $row->id , "Edit",
array('title' => 'Edit ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => 'red-link')) . " ";
- $html .= "<td>" . anchor('voucher/delete/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/delete.png", 'border' =>
'0', 'alt' => 'Delete ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => "confirmClick", 'title' =>
"Delete voucher")), array('title' => 'Delete ' .
ucfirst($html_voucher_type) . ' Voucher')) . "</td>";
+ $html .= " " . anchor('voucher/delete/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/delete.png", 'border' =>
'0', 'alt' => 'Delete ' . ucfirst($html_voucher_type) . '
Voucher', 'class' => "confirmClick", 'title' =>
"Delete voucher")), array('title' => 'Delete ' .
ucfirst($html_voucher_type) . ' Voucher')) . " ";
- $html .= "<td>" . anchor_popup('voucher/printhtml/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/print.png", 'border' =>
'0', 'alt' => 'Print ' . ucfirst($html_voucher_type) . '
Voucher')), array('title' => 'Print ' . ucfirst($html_voucher_type)
. ' Voucher')) . "</td>";
+ $html .= " " . anchor_popup('voucher/printhtml/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/print.png", 'border' =>
'0', 'alt' => 'Print ' . ucfirst($html_voucher_type) . '
Voucher')), array('title' => 'Print ' . ucfirst($html_voucher_type)
. ' Voucher')) . " ";
- $html .= "<td>" . anchor_popup('voucher/email/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/email.png", 'border' =>
'0', 'alt' => 'Email ' . ucfirst($html_voucher_type) . '
Voucher')), array('title' => 'Email ' . ucfirst($html_voucher_type)
. ' Voucher', 'width' => '500', 'height' =>
'300')) . "</td>";
+ $html .= " " . anchor_popup('voucher/email/' .
strtolower($html_voucher_type) . "/" . $row->id , img(array('src'
=> asset_url() . "images/icons/email.png", 'border' =>
'0', 'alt' => 'Email ' . ucfirst($html_voucher_type) . '
Voucher')), array('title' => 'Email ' . ucfirst($html_voucher_type)
. ' Voucher', 'width' => '500', 'height' =>
'300')) . "</td>";
$html .= "</tr>";
$odd_even = ($odd_even == "odd") ? "even" : "odd";
commit 27acf86e71e2debf23b2074016f9add99afaec59
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 21:50:18 2010 +0530
Auto configure base_url
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/config/config.php b/system/application/config/config.php
index 87bccd1..08e7d6d 100644
--- a/system/application/config/config.php
+++ b/system/application/config/config.php
@@ -11,7 +11,21 @@
|
http://example.com/
|
*/
-$config['base_url'] = "http://localhost/webzash/";
+// $config['base_url'] = "http://localhost/webzash/";
+
+/*
+|--------------------------------------------------------------------------
+| Base Site URL : Auto configuration
+|--------------------------------------------------------------------------
+|
+| Automatically configure base_url. Works with both http and https
+| Taken fom
http://codeigniter.com/wiki/Automatic_configbase_url/
+|
+*/
+
+$config['base_url'] = ((isset($_SERVER['HTTPS']) &&
$_SERVER['HTTPS'] == "on") ? "https" : "http");
+$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
+$config['base_url'] .=
str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
/*
|--------------------------------------------------------------------------
commit d4a99a7ead5f90ec3d56631f71b042da5a65f519
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 16:27:01 2010 +0530
Showing even one bank account
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index c9240d2..98bff48 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -20,7 +20,7 @@ class Welcome extends Controller {
/* Bank and Cash Ledger accounts */
$bank_q = $this->db->get_where('ledgers', array('type' =>
'B'));
- if ($bank_q->num_rows() > 1)
+ if ($bank_q->num_rows() > 0)
{
foreach ($bank_q->result() as $row)
{
commit cdb4226f474534ceaf9a29bb794d1f1bf5703fb7
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 16:02:30 2010 +0530
Show voucher date before voucher number
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/voucher.php
b/system/application/controllers/voucher.php
index 18301c7..9a8d7c1 100644
--- a/system/application/controllers/voucher.php
+++ b/system/application/controllers/voucher.php
@@ -121,7 +121,7 @@ class Voucher extends Controller {
$this->pagination->initialize($config);
$html = "<table border=0 cellpadding=5
class=\"generaltable\">";
- $html .=
"<thead><tr><th>Number</th><th>Date</th><th>Ledger
A/C</th><th>Type</th><th>Status</th><th>DR
Amount</th><th>CR Amount</th><th
colspan=5>Actions</th></tr></thead>";
+ $html .=
"<thead><tr><th>Date</th><th>Number</th><th>Ledger
A/C</th><th>Type</th><th>Status</th><th>DR
Amount</th><th>CR Amount</th><th
colspan=5>Actions</th></tr></thead>";
$html .= "<tbody>";
$odd_even = "odd";
@@ -135,8 +135,9 @@ class Voucher extends Controller {
$html .= "<tr class=\"tr-" . $odd_even;
$html .= ($row->draft == 1) ? " tr-draft " : "";
$html .= "\">";
- $html .= "<td>" . $row->number . "</td>";
+
$html .= "<td>" . date_mysql_to_php($row->date) .
"</td>";
+ $html .= "<td>" . $row->number . "</td>";
$html .= "<td>";
$html .= $this->Tag_model->show_voucher_tag($row->tag_id);
diff --git a/system/application/views/report/ledgerst.php
b/system/application/views/report/ledgerst.php
index 9c6fdf4..3bd5cb2 100644
--- a/system/application/views/report/ledgerst.php
+++ b/system/application/views/report/ledgerst.php
@@ -59,7 +59,7 @@
echo "<table border=0 cellpadding=5
class=\"generaltable\">";
- echo
"<thead><tr><th>Number</th><th>Date</th><th>Status</th><th>Type</th><th>Dr
Amount</th><th>Cr Amount</th><th>
Balance</th></tr></thead>";
+ echo
"<thead><tr><th>Date</th><th>Number</th><th>Status</th><th>Type</th><th>Dr
Amount</th><th>Cr Amount</th><th>
Balance</th></tr></thead>";
$odd_even = "odd";
$cur_balance = 0;
@@ -112,10 +112,10 @@
echo ($row->vdraft == 1) ? " tr-draft " : "";
echo "\">";
echo "<td>";
- echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, $row->vnumber, array('title' => 'View ' . '
Voucher', 'style' => 'color:#000000'));
+ echo date_mysql_to_php($row->vdate);
echo "</td>";
echo "<td>";
- echo date_mysql_to_php($row->vdate);
+ echo anchor('voucher/view/' . n_to_v($row->vtype) . '/' .
$row->vid, $row->vnumber, array('title' => 'View ' . '
Voucher', 'style' => 'color:#000000'));
echo "</td>";
echo "<td>";
echo ($row->vdraft == 1) ? "Draft" : "Active";
commit a0f966942f859c36ee474805b7b08c4452732e71
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 15:49:49 2010 +0530
Removed debugging data
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index 8629c4a..c9240d2 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -49,7 +49,7 @@ class Welcome extends Controller {
$expense = new Accountlist();
$expense->init(4);
- $data['expense_total'] = $expense->total; var_dump($data);
+ $data['expense_total'] = $expense->total;
$this->template->load('template', 'welcome_message', $data);
return;
commit 22d7024a897bdd0e2d53d4a546941a718d5e7b6d
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 15:47:12 2010 +0530
Updated Dashboard
- Added graph for assets vs liabilities
- Added graph for incomes vs expenses
- Added draft voucher count
- Added balance of cash and bank accounts
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/controllers/welcome.php
b/system/application/controllers/welcome.php
index c14fd24..8629c4a 100644
--- a/system/application/controllers/welcome.php
+++ b/system/application/controllers/welcome.php
@@ -10,8 +10,48 @@ class Welcome extends Controller {
function index()
{
+ $this->load->model('Ledger_model');
+ $this->load->library('accountlist');
$this->template->set('page_title', 'Welcome to Webzash');
- $this->template->load('template', 'welcome_message');
+
+ /* Draft voucher count */
+ $draft_q = $this->db->get_where('vouchers', array('draft' =>
1));
+ $data['draft_count'] = $draft_q->num_rows();
+
+ /* Bank and Cash Ledger accounts */
+ $bank_q = $this->db->get_where('ledgers', array('type' =>
'B'));
+ if ($bank_q->num_rows() > 1)
+ {
+ foreach ($bank_q->result() as $row)
+ {
+ $data['bank_cash_account'][] = array(
+ 'id' => $row->id,
+ 'name' => $row->name,
+ 'balance' => $this->Ledger_model->get_ledger_balance($row->id),
+ );
+ }
+ } else {
+ $data['bank_cash_account'] = array();
+ }
+
+ /* Calculating total of Assets, Liabilities, Incomes, Expenses */
+ $asset = new Accountlist();
+ $asset->init(1);
+ $data['asset_total'] = $asset->total;
+
+ $liability = new Accountlist();
+ $liability->init(2);
+ $data['liability_total'] = -$liability->total;
+
+ $income = new Accountlist();
+ $income->init(3);
+ $data['income_total'] = -$income->total;
+
+ $expense = new Accountlist();
+ $expense->init(4);
+ $data['expense_total'] = $expense->total; var_dump($data);
+
+ $this->template->load('template', 'welcome_message', $data);
return;
}
}
diff --git a/system/application/views/welcome_message.php
b/system/application/views/welcome_message.php
index e993b6d..59f8bd2 100644
--- a/system/application/views/welcome_message.php
+++ b/system/application/views/welcome_message.php
@@ -1,4 +1,135 @@
-<h3>This is beta software not meant to be used in production use.</h3>
-Enjoy !<br /><br />
-Send your feedback to : pshah.mumbai(a)gmail.com<br /><br />
-Any contribution is welcomed :)
+<style type="text/css">
+ #income-expense-graph-header {
+ width: 200px;
+ text-align: center;
+ padding-bottom:10px;
+ }
+ #income-expense-graph-data {
+ width: 200px;
+ height: 200px;
+ text-align: center;
+ }
+ #asset-liability-graph-header {
+ width: 200px;
+ text-align: center;
+ padding-bottom:10px;
+ }
+ #asset-liability-graph-data {
+ width: 200px;
+ height: 200px;
+ text-align: center;
+ }
+</style>
+
+<script type="text/javascript">
+jQuery(document).ready(function () {
+ jQuery('#income-expense-graph-data').tufteBar({
+ data: [
+ // First element is the y-value
+ // Other elements are arbitary - they are not used by the lib
+ // but are passed back into callback functions
+ [<?php echo $income_total; ?>, {label: 'Incomes'}],
+ [<?php echo $expense_total; ?>, {label: 'Expenses'}]
+ ],
+
+ // Bar width in arbitrary units, 1.0 means the bars will be snuggled
+ // up next to each other
+ barWidth: 0.5,
+
+ // The label on top of the bar - can contain HTML
+ // formatNumber inserts commas as thousands separators in a number
+ barLabel: function(index) {
+ return $.tufteBar.formatNumber(this[0])
+ },
+
+ // The label on the x-axis - can contain HTML
+ axisLabel: function(index) { return this[1].label },
+
+ // The color of the bar
+ color: function(index) {
+ return ['#33CC66', '#C00000'][index % 2]
+ },
+ });
+
+ jQuery('#asset-liability-graph-data').tufteBar({
+ data: [
+ // First element is the y-value
+ // Other elements are arbitary - they are not used by the lib
+ // but are passed back into callback functions
+ [<?php echo $asset_total; ?>, {label: 'Assets'}],
+ [<?php echo $liability_total; ?>, {label: 'Liabilities'}]
+ ],
+
+ // Bar width in arbitrary units, 1.0 means the bars will be snuggled
+ // up next to each other
+ barWidth: 0.5,
+
+ // The label on top of the bar - can contain HTML
+ // formatNumber inserts commas as thousands separators in a number
+ barLabel: function(index) {
+ return $.tufteBar.formatNumber(this[0])
+ },
+
+ // The label on the x-axis - can contain HTML
+ axisLabel: function(index) { return this[1].label },
+
+ // The color of the bar
+ color: function(index) {
+ return ['#33CC66', '#C00000'][index % 2]
+ },
+ });
+});
+</script>
+
+<h3><This is beta software not meant for production use
!></h3>
+<div>
+ <div>Welcome back, <strong><?php echo
$this->config->item('account_name');?></strong></div>
+ <br />
+ <div>You have <?php echo $draft_count;?> draft voucher(s)</div>
+ <br />
+ <?php
+ if ($bank_cash_account)
+ {
+ echo "<table>";
+ echo "<tbody>";
+ foreach ($bank_cash_account as $id => $row)
+ {
+ echo "<tr>";
+ echo "<td>" . anchor('report/ledgerst/' . $row['id'],
$row['name'], array('title' => $row['name'] . '
Statement')) . "</td>";
+ echo "<td>";
+ if ($row['balance'] == 0)
+ echo "0";
+ else if ($row['balance'] > 0)
+ echo "Dr " . $row['balance'];
+ else
+ echo "Cr " . -$row['balance'];
+ echo "</td>";
+ echo "</tr>";
+ }
+ echo "</tbody>";
+ echo "</table>";
+ } else {
+ echo "You have not created any bank or cash account";
+ }
+ ?>
+</div>
+<div>
+ <table border="0">
+ <tbody>
+ <tr>
+ <td width="300">
+ <div id="income-expense" class="graph">
+ <div id="income-expense-graph-header"><h4>Incomes Vs
Expenses</h4></div>
+ <div id="income-expense-graph-data"></div>
+ </div>
+ </td>
+ <td width="300">
+ <div id="asset-liability" class="graph">
+ <div id="asset-liability-graph-header"><h4>Assets Vs
Liabilities</h4></div>
+ <div id="asset-liability-graph-data""></div>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</div>
commit 0b0c140f76f67b7c4cbc3c8aebfd5fb92c8e628d
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 15:46:16 2010 +0530
Added jQuery TufteGraph javascript graph library
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/system/application/assets/css/tufte-graph.css
b/system/application/assets/css/tufte-graph.css
new file mode 100644
index 0000000..a868b4b
--- /dev/null
+++ b/system/application/assets/css/tufte-graph.css
@@ -0,0 +1,41 @@
+.graph {
+ margin-bottom: 50px;
+ margin-top: 30px;
+ clear: both;
+ font-family: georgia, serif;
+ font-size: 14px;
+}
+
+.graph .label {
+ text-align: center;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.graph-header h3 {
+ margin-bottom: 0px;
+}
+.graph-header {
+ text-align: center;
+}
+.graph-header p {
+ margin-top: 0px;
+}
+
+.graph .legend td, .graph .legend, .graph .legend tr {
+ padding: 0px;
+ margin: 0px;
+ border-collapse:collapse;
+}
+
+.graph .legend {
+ margin-left: 10px;
+}
+.graph .legend td {
+ padding-right: 5px;
+}
+
+.graph .legend .color-box {
+ width: 14px;
+ height: 10px;
+ overflow: hidden;
+}
diff --git a/system/application/assets/js/jquery.enumerable.js
b/system/application/assets/js/jquery.enumerable.js
new file mode 100644
index 0000000..c34d423
--- /dev/null
+++ b/system/application/assets/js/jquery.enumerable.js
@@ -0,0 +1,102 @@
+(function ( $ ) {
+ var methods = {
+ // $([1,2,3]).collect(function() { return this * this }) // => [1, 4, 9]
+ collect: function(enumerable, callback) {
+ var result = [];
+ $.each(enumerable, function(index) {
+ result.push(callback.call(this, index));
+ });
+ return result;
+ },
+
+ // $([1,2,3]).inject(0, function(a) { return a + this }) // => 6
+ inject: function(enumerable, initialValue, callback) {
+ var accumulator = initialValue;
+
+ $.each(enumerable, function (index) {
+ accumulator = callback.call(this, accumulator, index);
+ });
+ return accumulator;
+ },
+
+ // $([1,2,3]).select(function() { return this % 2 == 1 }) // => [1, 3]
+ select: function(enumerable, callback) {
+ var result = [];
+ $.each(enumerable, function(index) {
+ if (callback.call(this, index))
+ result.push(this);
+ });
+ return result;
+ },
+
+ // $([1,2,3]).reject(function() { return this % 2 == 1 }) // => [2]
+ reject: function(enumerable, callback) {
+ return $.select(enumerable, negate(callback));
+ },
+
+ // $([1,2]).any(function() { return this == 1 }) // => true
+ any: function(enumerable, callback) {
+ return $.inject(enumerable, false, function(accumulator, index) {
+ return accumulator || callback.call(this, index);
+ });
+ },
+
+ // $([1,1]).any(function() { return this == 1 }) // => true
+ all: function(enumerable, callback) {
+ return $.inject(enumerable, true, function(accumulator, index) {
+ return accumulator && callback.call(this, index);
+ });
+ },
+
+ // $([1,2,3]).sum() // => 6
+ sum: function(enumerable) {
+ return $.inject(enumerable, 0, function(accumulator) {
+ return accumulator + this;
+ });
+ }
+ };
+
+ var staticFunctions = {};
+ var iteratorFunctions = {};
+ $.each( methods, function(name, f){
+ staticFunctions[name] = makeStaticFunction(f);
+ iteratorFunctions[name] = makeIteratorFunction(staticFunctions[name]);
+ });
+ $.extend(staticFunctions);
+ $.fn.extend(iteratorFunctions);
+
+ // Private methods
+ function makeStaticFunction(f) {
+ return function() {
+ if (arguments.length > 1) // The first argument is the enumerable
+ validateCallback(arguments[arguments.length - 1]);
+
+ return f.apply(this, arguments);
+ }
+ }
+
+ function makeIteratorFunction(staticFunction) {
+ return function() {
+ // arguments isn't a real array, concat doesn't work
+ // unless you explicitly convert it
+ function toArray() {
+ var result = []
+ for (var i = 0; i < this.length; i++)
+ result.push(this[i])
+ return(result)
+ }
+ return staticFunction.apply(this, [this].concat(toArray.apply(arguments)))
+ }
+ }
+
+ function validateCallback(callback) {
+ if (!jQuery.isFunction(callback))
+ throw("callback needs to be a function, it was: " + callback);
+ }
+
+ function negate(f) {
+ return function() {
+ return !f.apply(this, arguments)
+ }
+ }
+})( jQuery );
diff --git a/system/application/assets/js/jquery.tufte-graph.js
b/system/application/assets/js/jquery.tufte-graph.js
new file mode 100644
index 0000000..37ad08f
--- /dev/null
+++ b/system/application/assets/js/jquery.tufte-graph.js
@@ -0,0 +1,233 @@
+(function($) {
+ //
+ // Public interface
+ //
+
+ // The main event - creates a pretty graph. See index.html for documentation.
+ $.fn.tufteBar = function(options) {
+ var defaultCopy = $.extend(true, {}, $.fn.tufteBar.defaults);
+ var options = $.extend(true, defaultCopy, options);
+
+ return this.each(function () {
+ draw(makePlot($(this), options), options);
+ });
+ }
+
+ // Defaults are exposed publically so you can reuse bits that you find
+ // handy (the colors, for instance)
+ $.fn.tufteBar.defaults = {
+ barWidth: 0.8,
+ colors: ['#07093D', '#0C0F66', '#476FB2'],
+ color: function(index, stackedIndex, options) { return
options.colors[stackedIndex % options.colors.length]; },
+ barLabel: function(index, stackedIndex) {
+ return $.tufteBar.formatNumber(totalValue(this[0]));
+ },
+ axisLabel: function(index, stackedIndex) { return index; },
+ legend: {
+ color: function(index, options) { return options.colors[index %
options.colors.length]; },
+ label: function(index) { return this; }
+ }
+ }
+
+ $.tufteBar = {
+ // Add thousands separators to a number to make it look pretty.
+ // 1000 -> 1,000
+ formatNumber: function(nStr) {
+ //
http://www.mredkj.com/javascript/nfbasic.html
+ nStr += '';
+ x = nStr.split('.');
+ x1 = x[0];
+ x2 = x.length > 1 ? '.' + x[1] : '';
+ var rgx = /(\d+)(\d{3})/;
+ while (rgx.test(x1)) {
+ x1 = x1.replace(rgx, '$1' + ',' + '$2');
+ }
+ return x1 + x2;
+ }
+ }
+
+ //
+ // Private functions
+ //
+
+ // This function should be applied to any option used from the options hash.
+ // It allows options to be provided as either static values or functions which are
+ // evaluated each time they are used
+ function resolveOption(option, element) {
+ // the @arguments@ special variable looks like an array, but really isn't, so we
+ // need to transform it in order to perform array function on it
+ function toArray() {
+ var result = []
+ for (var i = 0; i < this.length; i++)
+ result.push(this[i])
+ return(result)
+ }
+
+ return $.isFunction(option) ? option.apply(element, toArray.apply(arguments).slice(2,
arguments.length)) : option;
+ }
+
+ // Returns the total value of a bar, for labeling or plotting. Y values can either be
+ // a single number (for a normal graph), or an array of numbers (for a stacked graph)
+ function totalValue(value) {
+ if (value instanceof Array)
+ return $.sum(value);
+ else
+ return value;
+ }
+
+ function draw(plot, options) {
+ var ctx = plot.ctx;
+ var axis = plot.axis;
+
+ // Iterate over each bar
+ $(options.data).each(function (i) {
+ var element = this;
+ var x = i + 0.5;
+ var all_y = null;
+
+ if (element[0] instanceof Array) {
+ // This is a stacked bar, so the data is all good to go
+ all_y = element[0];
+ } else {
+ // This is a normal bar, wrap in an array to make it a stacked bar with one data
point
+ all_y = [element[0]];
+ }
+
+ if ($(all_y).any(function() { return isNaN(+this); })) {
+ throw("Non-numeric value provided for y: " + element[0]);
+ }
+
+ var lastY = 0;
+
+ pixel_scaling_function = function(axis) {
+ var scale = axis.pixelLength / (axis.max - axis.min);
+ return function (value) {
+ return (value - axis.min) * scale;
+ }
+ }
+
+ // These functions transform a value from plot coordinates to pixel coordinates
+ var t = {}
+ t.W = pixel_scaling_function(axis.x);
+ t.H = pixel_scaling_function(axis.y);
+ t.X = t.W;
+ // Y needs to invert the result since 0 in plot coords is bottom left, but 0 in
pixel coords is top left
+ t.Y = function(y) { return axis.y.pixelLength - t.H(y) };
+
+ // Iterate over each data point for this bar and render a rectangle for each
+ $(all_y).each(function(stackedIndex) {
+ var optionResolver = function(option) { // Curry resolveOption for convenience
+ return resolveOption(option, element, i, stackedIndex, options);
+ }
+
+ var y = all_y[stackedIndex];
+ var halfBar = optionResolver(options.barWidth) / 2;
+ var left = x - halfBar,
+ width = halfBar * 2,
+ top = lastY + y,
+ height = y;
+
+ // Need to both fill and stroke the rect to make sure the whole area is covered
+ // You get nasty artifacts otherwise
+ var color = optionResolver(options.color);
+ var coords = [t.X(left), t.Y(top), t.W(width), t.H(height)];
+
+ ctx.rect(coords[0], coords[1], coords[2], coords[3]).attr({stroke: color, fill:
color});
+
+ lastY = lastY + y;
+ });
+
+ addLabel = function(klass, text, pos) {
+ html = '<div style="position:absolute;" class="label '
+ klass + '">' + text + "</div>";
+ $(html).css(pos).appendTo( plot.target );
+ }
+
+ var optionResolver = function(option) { // Curry resolveOption for convenience
+ return resolveOption(option, element, i, options);
+ }
+ addLabel('bar-label', optionResolver(options.barLabel), {
+ left: t.X(x - 0.5),
+ bottom: t.H(lastY),
+ width: t.W(1)
+ });
+ addLabel('axis-label', optionResolver(options.axisLabel), {
+ left: t.X(x - 0.5),
+ top: t.Y(0),
+ width: t.W(1)
+ });
+ });
+ addLegend(plot, options);
+ }
+
+ // If legend data has been provided, transform it into an
+ // absolutely positioned table placed at the top right of the graph
+ function addLegend(plot, options) {
+ if (options.legend.data) {
+ elements = $(options.legend.data).collect(function(i) {
+ var optionResolver = (function (element) {
+ return function(option) { // Curry resolveOption for convenience
+ return resolveOption(option, element, i, options);
+ }
+ })(this);
+
+ var colorBox = '<div class="color-box"
style="background-color:' + optionResolver(options.legend.color) +
'"></div>';
+ var label = optionResolver(options.legend.label);
+
+ return "<tr><td>" + colorBox +
"</td><td>" + label + "</td></tr>";
+ });
+
+ $('<table class="legend">' +
elements.reverse().join("") + '</table>').css({
+ position: 'absolute',
+ top: '0px',
+ left: plot.width + 'px'
+ }).appendTo( plot.target );
+ }
+ }
+
+ // Calculates the range of the graph by looking for the
+ // maximum y-value
+ function makeAxis(options) {
+ var axis = {
+ x: {},
+ y: {}
+ }
+
+ axis.x.min = 0
+ axis.x.max = options.data.length;
+ axis.y.min = 0;
+ axis.y.max = 0;
+
+ $(options.data).each(function() {
+ var y = totalValue(this[0]);
+ if( y < axis.y.min ) throw("Negative values not supported");
+ if( y > axis.y.max ) axis.y.max = y;
+ });
+
+ if( axis.x.max <= 0) throw("You must have at least one data point");
+ if( axis.y.max <= 0) throw("You must have at least one y-value greater than
0");
+
+ return axis;
+ }
+
+ // Creates the canvas object to draw on, and set up the axes
+ function makePlot(target, options) {
+ var plot = {};
+ plot.target = target;
+ plot.width = target.width();
+ plot.height = target.height();
+ target.html( '' ).css( 'position', 'relative' );
+
+ if( plot.width <= 0 || plot.height <= 0 ) {
+ throw "Invalid dimensions for plot, width = " + plot.width + ",
height = " + plot.height;
+ }
+
+ // the canvas
+ plot.ctx = Raphael(target[0].id, plot.width, plot.height);
+
+ plot.axis = makeAxis(options);
+ plot.axis.x.pixelLength = plot.width;
+ plot.axis.y.pixelLength = plot.height;
+
+ return plot;
+ }
+} )( jQuery );
diff --git a/system/application/assets/js/raphael.js
b/system/application/assets/js/raphael.js
new file mode 100644
index 0000000..7d48370
--- /dev/null
+++ b/system/application/assets/js/raphael.js
@@ -0,0 +1,1690 @@
+/*
+ * Raphael 0.5.12 - JavaScript Vector Library
+ *
+ * Copyright (c) 2008 Dmitry Baranovskiy (
http://raphaeljs.com)
+ * Licensed under the MIT (
http://www.opensource.org/licenses/mit-license.php) license.
+ */
+var Raphael = (function (type) {
+ var r = function () {
+ return r._create.apply(r, arguments);
+ };
+ r.version = "0.5.12";
+ r.type = type;
+ var C = {};
+ function Matrix(m11, m12, m21, m22, dx, dy) {
+ this.m = [
+ [m11 || 1, m12 || 0, 0],
+ [m21 || 0, m22 || 1, 0],
+ [dx || 0, dy || 0, 1]
+ ];
+ }
+
+ C._getX = C._getY = C._getW = C._getH = function (x) { return x; };
+
+ if (type == "VML") {
+ Matrix.prototype.toString = function () {
+ return "progid:DXImageTransform.Microsoft.Matrix(M11=" +
this.m[0][0] +
+ ", M12=" + this.m[1][0] + ", M21=" + this.m[0][1]
+ ", M22=" + this.m[1][1] +
+ ", Dx=" + this.m[2][0] + ", Dy=" + this.m[2][1] +
", sizingmethod='auto expand', filtertype='bilinear')";
+ };
+ var thePath = function (params, pathString, VML) {
+ var g = document.createElement("rvml:group"), gl = g.style;
+ gl.position = "absolute";
+ gl.left = 0;
+ gl.top = 0;
+ gl.width = VML.width + "px";
+ gl.height = VML.height + "px";
+ var el = document.createElement("rvml:shape"), ol = el.style;
+ ol.width = VML.width + "px";
+ ol.height = VML.height + "px";
+ el.path = "";
+ if (params["class"]) {
+ el.className = params["class"];
+ }
+ el.coordsize = this.coordsize;
+ el.coordorigin = this.coordorigin;
+ g.appendChild(el);
+ VML.canvas.appendChild(g);
+ var p = new Element(el, g, VML);
+ setFillAndStroke(p, params);
+ if (params.gradient) {
+ addGrdientFill(p, params.gradient);
+ }
+ p.isAbsolute = true;
+ p.type = "path";
+ p.path = [];
+ p.last = {x: 0, y: 0, bx: 0, by: 0, isAbsolute: true};
+ p.Path = "";
+ p.absolutely = function () {
+ this.isAbsolute = true;
+ return this;
+ };
+ p.relatively = function () {
+ this.isAbsolute = false;
+ return this;
+ };
+ p.redraw = function () {
+ this.Path = "";
+ var oldPath = this.path;
+ this.path = [];
+ for (var i = 0, ii = oldPath.length; i < ii; i++) {
+ if (oldPath[i].type != "end") {
+ this[oldPath[i].type + "To"].apply(this,
oldPath[i].arg);
+ } else {
+ this.andClose();
+ }
+ }
+ return this;
+ };
+ p.moveTo = function (x, y) {
+ var d = this.isAbsolute?"m":"t";
+ var _getX = this.isAbsolute ? VML._getX : VML._getW;
+ var _getY = this.isAbsolute ? VML._getY : VML._getH;
+ d += Math.round(_getX(parseFloat(x, 10))) + " " +
Math.round(_getY(parseFloat(y, 10)));
+ this[0].path = this.Path += d;
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(x, 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(y, 10));
+ this.last.isAbsolute = this.isAbsolute;
+ this.path.push({type: "move", arg: [].slice.call(arguments,
0), pos: this.isAbsolute});
+ return this;
+ };
+ p.lineTo = function (x, y) {
+ var d = this.isAbsolute?"l":"r";
+ var _getX = this.isAbsolute ? VML._getX : VML._getW;
+ var _getY = this.isAbsolute ? VML._getY : VML._getH;
+ d += Math.round(_getX(parseFloat(x, 10))) + " " +
Math.round(_getY(parseFloat(y, 10)));
+ this[0].path = this.Path += d;
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(x, 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(y, 10));
+ this.last.isAbsolute = this.isAbsolute;
+ this.path.push({type: "line", arg: [].slice.call(arguments,
0), pos: this.isAbsolute});
+ return this;
+ };
+ p.arcTo = function (rx, ry, large_arc_flag, sweep_flag, x2, y2) {
+ // for more information of where this math came from visit:
+ //
http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
+ x2 = (this.isAbsolute ? 0 : this.last.x) + x2;
+ y2 = (this.isAbsolute ? 0 : this.last.y) + y2;
+ var x1 = this.last.x,
+ y1 = this.last.y,
+ x = (x1 - x2) / 2,
+ y = (y1 - y2) / 2,
+ k = (large_arc_flag == sweep_flag ? -1 : 1) *
+ Math.sqrt((rx * rx * ry * ry - rx * rx * y * y - ry * ry * x
* x) / (rx * rx * y * y + ry * ry * x * x)),
+ cx = k * rx * y / ry + (x1 + x2) / 2,
+ cy = k * -ry * x / rx + (y1 + y2) / 2,
+ d = sweep_flag ? (this.isAbsolute?"wa":"wr")
: (this.isAbsolute?"at":"ar"),
+ _getX = this.isAbsolute ? VML._getX : VML._getW,
+ _getY = this.isAbsolute ? VML._getY : VML._getH,
+ left = Math.round(cx - rx),
+ top = Math.round(cy - ry);
+ d += [left, top, Math.round(left + rx * 2), Math.round(top + ry * 2),
Math.round(x1), Math.round(y1), Math.round(_getX(parseFloat(x2, 10))),
Math.round(_getX(parseFloat(y2, 10)))].join(", ");
+ this[0].path = this.Path += d;
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(x2, 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(y2, 10));
+ this.last.isAbsolute = this.isAbsolute;
+ this.path.push({type: "arc", arg: [].slice.call(arguments,
0), pos: this.isAbsolute});
+ return this;
+ };
+ p.cplineTo = function (x1, y1, w1) {
+ if (!w1) {
+ return this.lineTo(x1, y1);
+ } else {
+ var p = {};
+ p._getX = this.isAbsolute ? VML._getX : VML._getW;
+ p._getY = this.isAbsolute ? VML._getY : VML._getH;
+ var x = Math.round(p._getX(Math.round(parseFloat(x1, 10) * 100) /
100));
+ var y = Math.round(p._getY(Math.round(parseFloat(y1, 10) * 100) /
100));
+ var w = Math.round(VML._getW(Math.round(parseFloat(w1, 10) * 100)
/ 100));
+ var d = this.isAbsolute?"c":"v";
+ var attr = [Math.round(this.last.x) + w, Math.round(this.last.y),
x - w, y, x, y];
+ d += attr.join(" ") + " ";
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) + attr[4];
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) + attr[5];
+ this.last.bx = attr[2];
+ this.last.by = attr[3];
+ this[0].path = this.Path += d;
+ this.path.push({type: "cpline", arg:
[].slice.call(arguments, 0), pos: this.isAbsolute});
+ return this;
+ }
+ };
+ p.curveTo = function () {
+ var d = this.isAbsolute?"c":"v";
+ var _getX = this.isAbsolute ? VML._getX : VML._getW;
+ var _getY = this.isAbsolute ? VML._getY : VML._getH;
+ if (arguments.length == 6) {
+ this.last.bx = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(arguments[2], 10));
+ this.last.by = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(arguments[3], 10));
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(arguments[4], 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(arguments[5], 10));
+ d += Math.round(_getX(parseFloat(arguments[0], 10))) + "
" +
+ Math.round(_getY(parseFloat(arguments[1], 10))) + "
" +
+ Math.round(_getX(parseFloat(arguments[2], 10))) + "
" +
+ Math.round(_getY(parseFloat(arguments[3], 10))) + "
" +
+ Math.round(_getX(parseFloat(arguments[4], 10))) + "
" +
+ Math.round(_getY(parseFloat(arguments[5], 10))) + "
";
+ this.last.isAbsolute = this.isAbsolute;
+ }
+ if (arguments.length == 4) {
+ var bx = this.last.x * 2 - this.last.bx;
+ var by = this.last.y * 2 - this.last.by;
+ this.last.bx = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(arguments[0], 10));
+ this.last.by = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(arguments[1], 10));
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
_getX(parseFloat(arguments[2], 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
_getY(parseFloat(arguments[3], 10));
+ d += [Math.round(bx), Math.round(by),
+ Math.round(_getX(parseFloat(arguments[0], 10))),
+ Math.round(_getY(parseFloat(arguments[1], 10))),
+ Math.round(_getX(parseFloat(arguments[2], 10))),
+ Math.round(_getY(parseFloat(arguments[3], 10)))].join("
");
+ }
+ this[0].path = this.Path += d;
+ this.path.push({type: "curve", arg:
[].slice.call(arguments, 0), pos: this.isAbsolute});
+ return this;
+ };
+ p.addRoundedCorner = function (r, dir) {
+ var R = .5522 * r, rollback = this.isAbsolute, o = this;
+ if (rollback) {
+ this.relatively();
+ rollback = function () {
+ o.absolutely();
+ };
+ } else {
+ rollback = function () {};
+ }
+ var actions = {
+ l: function () {
+ return {
+ u: function () {
+ o.curveTo(-R, 0, -r, -(r - R), -r, -r);
+ },
+ d: function () {
+ o.curveTo(-R, 0, -r, r - R, -r, r);
+ }
+ };
+ },
+ r: function () {
+ return {
+ u: function () {
+ o.curveTo(R, 0, r, -(r - R), r, -r);
+ },
+ d: function () {
+ o.curveTo(R, 0, r, r - R, r, r);
+ }
+ };
+ },
+ u: function () {
+ return {
+ r: function () {
+ o.curveTo(0, -R, -(R - r), -r, r, -r);
+ },
+ l: function () {
+ o.curveTo(0, -R, R - r, -r, -r, -r);
+ }
+ };
+ },
+ d: function () {
+ return {
+ r: function () {
+ o.curveTo(0, R, -(R - r), r, r, r);
+ },
+ l: function () {
+ o.curveTo(0, R, R - r, r, -r, r);
+ }
+ };
+ }
+ };
+ actions[dir.charAt(0)]()[dir.charAt(1)]();
+ rollback();
+ return o;
+ };
+ p.andClose = function () {
+ this[0].path = (this.Path += "x e");
+ return this;
+ };
+ if (typeof pathString == "string") {
+ p.absolutely();
+ C.pathfinder(p, pathString);
+ }
+ return p;
+ };
+ var setFillAndStroke = function (o, params) {
+ var s = o[0].style;
+ o.attrs = o.attrs || {};
+ for (var par in params) {
+ o.attrs[par] = params[par];
+ }
+ params["font-family"] && (s.fontFamily =
params["font-family"]);
+ params["font-size"] && (s.fontSize =
params["font-size"]);
+ params["font"] && (s.font = params["font"]);
+ params["font-weight"] && (s.fontWeight =
params["font-weight"]);
+ if (typeof params.opacity != "undefined" || typeof
params["stroke-width"] != "undefined" || typeof params.fill !=
"undefined" || typeof params.stroke != "undefined") {
+ o = o.shape || o[0];
+ var fill = (o.getElementsByTagName("fill") &&
o.getElementsByTagName("fill")[0]) ||
document.createElement("rvml:fill");
+ if ("fill-opacity" in params || "opacity" in
params) {
+ fill.opacity = ((params["fill-opacity"] + 1 || 2) - 1)
* ((params.opacity + 1 || 2) - 1);
+ }
+ if (params.fill) {
+ fill.on = true;
+ }
+ if (fill.on == undefined || params.fill == "none") {
+ fill.on = false;
+ }
+ if (fill.on && params.fill) {
+ var isURL = params.fill.match(/^url\(([^\)]+)\)$/i);
+ if (isURL) {
+ fill.src = isURL[1];
+ fill.type = "tile";
+ } else {
+ fill.color = params.fill;
+ fill.src = "";
+ fill.type = "solid";
+ }
+ }
+ o.appendChild(fill);
+ var stroke = (o.getElementsByTagName("stroke") &&
o.getElementsByTagName("stroke")[0]) ||
document.createElement("rvml:stroke");
+ if ((params.stroke && params.stroke != "none") ||
params["stroke-width"] || params["stroke-opacity"] ||
params["stroke-dasharray"]) {
+ stroke.on = true;
+ }
+ if (params.stroke == "none" || typeof stroke.on ==
"undefined") {
+ stroke.on = false;
+ }
+ if (stroke.on && params.stroke) {
+ stroke.color = params.stroke;
+ }
+ stroke.opacity = ((params["stroke-opacity"] + 1 || 2) - 1)
* ((params.opacity + 1 || 2) - 1);
+ params["stroke-linejoin"] && (stroke.joinstyle =
params["stroke-linejoin"] || "miter");
+ stroke.miterlimit = params["stroke-miterlimit"] || 8;
+ params["stroke-linecap"] && (stroke.endcap = {butt:
"flat", square: "square", round:
"round"}[params["stroke-linecap"]] || "miter");
+ params["stroke-width"] && (stroke.weight =
(parseFloat(params["stroke-width"], 10) || 1) * 12 / 16);
+ if (params["stroke-dasharray"]) {
+ var dasharray = {
+ "-": "shortdash",
+ ".": "shortdot",
+ "-.": "shortdashdot",
+ "-..": "shortdashdotdot",
+ ". ": "dot",
+ "- ": "dash",
+ "--": "longdash",
+ "- .": "dashdot",
+ "--.": "longdashdot",
+ "--..": "longdashdotdot"
+ };
+ stroke.dashstyle =
dasharray[params["stroke-dasharray"]] || "";
+ }
+ o.appendChild(stroke);
+ }
+ };
+ var addGrdientFill = function (o, gradient) {
+ o.attrs = o.attrs || {};
+ o.attrs.gradient = gradient;
+ o = o.shape || o[0];
+ var fill = o.getElementsByTagName("fill");
+ if (fill.length) {
+ fill = fill[0];
+ } else {
+ fill = document.createElement("rvml:fill");
+ }
+ if (gradient.dots.length) {
+ fill.on = true;
+ fill.method = "none";
+ fill.type = (gradient.type.toLowerCase() == "linear") ?
"gradient" : "gradientTitle";
+ if (typeof gradient.dots[0].color != "undefined") {
+ fill.color = gradient.dots[0].color || "#000";
+ }
+ if (typeof gradient.dots[gradient.dots.length - 1].color !=
"undefined") {
+ fill.color2 = gradient.dots[gradient.dots.length - 1].color ||
"#000";
+ }
+ var colors = [];
+ for (var i = 0, ii = gradient.dots.length; i < ii; i++) {
+ if (gradient.dots[i].offset) {
+ colors.push(gradient.dots[i].offset + " " +
gradient.dots[i].color);
+ }
+ };
+ var fillOpacity = gradient.dots[0].opacity || 1;
+ var fillOpacity2 = gradient.dots[gradient.dots.length - 1].opacity ||
1;
+ if (colors) {
+ fill.colors.value = colors.join(",");
+ fillOpacity2 += fillOpacity;
+ fillOpacity = fillOpacity2 - fillOpacity;
+ fillOpacity2 -= fillOpacity;
+ }
+ fill.setAttribute("opacity", fillOpacity);
+ fill.setAttribute("opacity2", fillOpacity2);
+ if (gradient.vector) {
+ var angle = Math.round(Math.atan((parseFloat(gradient.vector[3],
10) - parseFloat(gradient.vector[1], 10)) / (parseFloat(gradient.vector[2], 10) -
parseFloat(gradient.vector[0], 10))) * 57.29) || 0;
+ fill.angle = 270 - angle;
+ }
+ if (gradient.type.toLowerCase() == "radial") {
+ fill.focus = "100%";
+ fill.focusposition = "0.5 0.5";
+ }
+ }
+ };
+ var Element = function (node, group, vml) {
+ var Rotation = 0,
+ RotX = 0,
+ RotY = 0,
+ Scale = 1;
+ this[0] = node;
+ this.node = node;
+ this.X = 0;
+ this.Y = 0;
+ this.attrs = {};
+ this.Group = group;
+ this.vml = vml;
+ this.rotate = function (deg) {
+ if (deg == undefined) {
+ return Rotation;
+ }
+ Rotation += deg;
+ this.Group.style.rotation = Rotation;
+ return this;
+ };
+ };
+ Element.prototype.setBox = function (params) {
+ var gs = this.Group.style,
+ os = this[0].style;
+ for (var i in params) {
+ this.attrs[i] = params[i];
+ }
+ var attr = this.attrs, x, y, w, h;
+ switch (this.type) {
+ case "circle":
+ x = attr.cx - attr.r;
+ y = attr.cy - attr.r;
+ w = h = attr.r * 2;
+ break;
+ case "ellipse":
+ x = attr.cx - attr.rx;
+ y = attr.cy - attr.ry;
+ w = attr.rx * 2;
+ h = attr.ry * 2;
+ break;
+ case "rect":
+ case "image":
+ x = attr.x;
+ y = attr.y;
+ w = attr.w;
+ h = attr.h;
+ break;
+ case "text":
+ this.textpath.v = ["m", Math.round(attr.x), ",
", Math.round(attr.y - 2), "l", Math.round(attr.x) + 1, ", ",
Math.round(attr.y - 2)].join("");
+ return;
+ default:
+ return;
+ }
+ var left = this.vml.width / 2 - w / 2,
+ top = this.vml.height / 2 - h / 2;
+ gs.position = "absolute";
+ gs.left = x - left + "px";
+ gs.top = y - top + "px";
+ this.X = x - left;
+ this.Y = y - top;
+ this.W = w;
+ this.H = h;
+ gs.width = this.vml.width + "px";
+ gs.height = this.vml.height + "px";
+ os.position = "absolute";
+ os.top = top + "px";
+ os.left = left + "px";
+ os.width = w + "px";
+ os.height = h + "px";
+ };
+ Element.prototype.hide = function () {
+ this.Group.style.display = "none";
+ return this;
+ };
+ Element.prototype.show = function () {
+ this.Group.style.display = "block";
+ return this;
+ };
+ Element.prototype.translate = function (x, y) {
+ if (x == undefined && y == undefined) {
+ return {x: this.X, y: this.Y};
+ }
+ this.X += x;
+ this.Y += y;
+ this.Group.style.left = this.X + "px";
+ this.Group.style.top = this.Y + "px";
+ return this;
+ };
+ // depricated
+ Element.prototype.matrix = function (xx, xy, yx, yy, dx, dy) {
+ tMatrix = new Matrix(xx, xy, yx, yy, dx, dy);
+ this.Group.style.filter = tMatrix;
+ return this;
+ };
+ Element.prototype.scale = function (x, y) {
+ if (x == undefined && y == undefined) {
+ return ;
+ // TODO
+ }
+ y = y || x;
+ if (x != 0 && !(x == 1 && y == 1)) {
+ var dirx = Math.round(x / Math.abs(x)),
+ diry = Math.round(y / Math.abs(y)),
+ s = this[0].style;
+ if (dirx != 1 || diry != 1) {
+ s.filter = new Matrix(dirx, 0, 0, diry, 0, 0);
+ }
+ var width = parseInt(s.width, 10) * x * dirx;
+ var height = parseInt(s.height, 10) * y * diry;
+ var left = parseInt(s.left, 10);
+ var top = parseInt(s.top, 10);
+ s.left = this.X = left + this.W / 2 - width / 2;
+ s.top = this.Y = top + this.H / 2 - height / 2;
+ s.width = this.W = width;
+ s.height = this.H = height;
+ }
+ return this;
+ };
+ Element.prototype.getBBox = function () {
+ return {
+ x: this.Group.offsetLeft,
+ y: this.Group.offsetTop,
+ width: this.Group.offsetWidth,
+ height: this.Group.offsetHeight
+ };
+ };
+ Element.prototype.remove = function () {
+ this[0].parentNode.removeChild(this[0]);
+ this.Group.parentNode.removeChild(this.Group);
+ this.shape && this.shape.parentNode.removeChild(this.shape);
+ };
+ Element.prototype.attr = function () {
+ if (arguments.length == 1 && typeof arguments[0] ==
"string") {
+ return this.attrs[arguments[0]];
+ }
+ if (this.attrs && arguments.length == 1 && arguments[0]
instanceof Array) {
+ var values = {};
+ for (var i = 0, ii = arguments[0].length; i < ii; i++) {
+ values[arguments[0][i]] = this.attrs[arguments[0][i]];
+ };
+ return values;
+ }
+ if (this[0].tagName.toLowerCase() == "group") {
+ var children = this[0].childNodes;
+ this.attrs = this.attrs || {};
+ if (arguments.length == 2) {
+ this.attrs[arguments[0]] = arguments[1];
+ } else if (arguments.length == 1 || typeof arguments[0] ==
"object") {
+ for (var j in arguments[0]) {
+ this.attrs[j] = arguments[0][j];
+ }
+ }
+ for (var i = 0, ii = children.length; i < ii; i++) {
+ this.attr.apply(new item(children[i], this[0], this.vml),
arguments);
+ }
+ } else {
+ var params;
+ if (arguments.length == 2) {
+ params = {};
+ params[arguments[0]] = arguments[1];
+ }
+ if (arguments.length == 1 && typeof arguments[0] ==
"object") {
+ params = arguments[0];
+ }
+ if (params) {
+ setFillAndStroke(this, params);
+ this.setBox(params);
+ if (params.gradient) {
+ addGrdientFill(this, params.gradient);
+ }
+ if (params.text && this.type == "text") {
+ this[0].string = params.text;
+ }
+ if (params.id) {
+ this[0].id = params.id;
+ }
+ }
+ }
+ return this;
+ };
+ Element.prototype.toFront = function () {
+ this.Group.parentNode.appendChild(this.Group);
+ return this;
+ };
+ Element.prototype.toBack = function () {
+ if (this.Group.parentNode.firstChild != this.Group) {
+ this.Group.parentNode.insertBefore(this.Group,
this.Group.parentNode.firstChild);
+ }
+ return this;
+ };
+ var theCircle = function (vml, x, y, r) {
+ var g = document.createElement("rvml:group");
+ var o = document.createElement("rvml:oval");
+ g.appendChild(o);
+ vml.canvas.appendChild(g);
+ var res = new Element(o, g, vml);
+ setFillAndStroke(res, {stroke: "#000", fill:
"none"});
+ res.setBox({x: x - r, y: y - r, w: r * 2, h: r * 2});
+ res.attrs.cx = x;
+ res.attrs.cy = y;
+ res.attrs.r = r;
+ res.type = "circle";
+ return res;
+ };
+ var theRect = function (vml, x, y, w, h, r) {
+ var g = document.createElement("rvml:group");
+ var o = document.createElement(r ? "rvml:roundrect" :
"rvml:rect");
+ if (r) {
+ o.arcsize = r / (Math.min(w, h));
+ }
+ g.appendChild(o);
+ vml.canvas.appendChild(g);
+ var res = new Element(o, g, vml);
+ setFillAndStroke(res, {stroke: "#000"});
+ res.setBox({x: x, y: y, w: w, h: h});
+ res.attrs.x = x;
+ res.attrs.y = y;
+ res.attrs.w = w;
+ res.attrs.h = h;
+ res.attrs.r = r;
+ res.type = "rect";
+ return res;
+ };
+ var theEllipse = function (vml, x, y, rx, ry) {
+ var g = document.createElement("rvml:group");
+ var o = document.createElement("rvml:oval");
+ g.appendChild(o);
+ vml.canvas.appendChild(g);
+ var res = new Element(o, g, vml);
+ setFillAndStroke(res, {stroke: "#000"});
+ res.setBox({x: x - rx, y: y - ry, w: rx * 2, h: ry * 2});
+ res.attrs.cx = x;
+ res.attrs.cy = y;
+ res.attrs.rx = rx;
+ res.attrs.ry = ry;
+ res.type = "ellipse";
+ return res;
+ };
+ var theImage = function (vml, src, x, y, w, h) {
+ var g = document.createElement("rvml:group");
+ var o = document.createElement("rvml:image");
+ o.src = src;
+ g.appendChild(o);
+ vml.canvas.appendChild(g);
+ var res = new Element(o, g, vml);
+ res.type = "image";
+ res.setBox({x: x, y: y, w: w, h: h});
+ res.attrs.x = x;
+ res.attrs.y = y;
+ res.attrs.w = w;
+ res.attrs.h = h;
+ return res;
+ };
+ var theText = function (vml, x, y, text) {
+ // @TODO: setTheBox
+ var g = document.createElement("rvml:group"), gs = g.style;
+ var el = document.createElement("rvml:shape"), ol = el.style;
+ var path = document.createElement("rvml:path"), ps =
path.style;
+ path.v = ["m", Math.round(x), ", ", Math.round(y -
2), "l", Math.round(x) + 1, ", ", Math.round(y -
2)].join("");
+ path.textpathok = true;
+ ol.width = vml.width;
+ ol.height = vml.height;
+ gs.position = "absolute";
+ gs.left = 0;
+ gs.top = 0;
+ gs.width = vml.width;
+ gs.height = vml.height;
+ var o = document.createElement("rvml:textpath");
+ o.string = text;
+ o.on = true;
+ o.coordsize = vml.coordsize;
+ o.coordorigin = vml.coordorigin;
+ el.appendChild(o);
+ el.appendChild(path);
+ g.appendChild(el);
+ vml.canvas.appendChild(g);
+ var res = new Element(o, g, vml);
+ res.shape = el;
+ res.textpath = path;
+ res.type = "text";
+ res.attrs.x = x;
+ res.attrs.y = y;
+ res.attrs.w = 1;
+ res.attrs.h = 1;
+ return res;
+ };
+ var theGroup = function (vml) {
+ var el = document.createElement("rvml:group"), els = el.style;
+ els.position = "absolute";
+ els.left = 0;
+ els.top = 0;
+ els.width = vml.width;
+ els.height = vml.height;
+ if (vml.canvas) {
+ vml.canvas.appendChild(el);
+ }
+ var res = new Element(el, el, vml);
+ for (var f in vml) {
+ if (f.charAt(0) != "_" && typeof vml[f] ==
"function") {
+ res[f] = (function (f) {
+ return function () {
+ var e = vml[f].apply(vml, arguments);
+ el.appendChild(e[0].parentNode);
+ return e;
+ };
+ })(f);
+ }
+ }
+ res.type = "group";
+ return res;
+ };
+ r._create = function () {
+ // container, width, height
+ // x, y, width, height
+ var container, width, height;
+ if (typeof arguments[0] == "string") {
+ container = document.getElementById(arguments[0]);
+ width = arguments[1];
+ height = arguments[2];
+ }
+ if (typeof arguments[0] == "object") {
+ container = arguments[0];
+ width = arguments[1];
+ height = arguments[2];
+ }
+ if (typeof arguments[0] == "number") {
+ container = 1;
+ x = arguments[0];
+ y = arguments[1];
+ width = arguments[2];
+ height = arguments[3];
+ }
+ if (!container) {
+ throw new Error("VML container not found.");
+ }
+ if (!document.namespaces["rvml"]) {
+
document.namespaces.add("rvml","urn:schemas-microsoft-com:vml");
+ document.createStyleSheet().addRule("rvml\\:*",
"behavior:url(#default#VML)");
+ }
+ var c = document.createElement("div"),
+ r = C.canvas = document.createElement("rvml:group"),
+ cs = c.style, rs = r.style;
+ C.width = width;
+ C.height = height;
+ width = width || "320px";
+ height = height || "200px";
+ cs.clip = "rect(0 " + width + " " + height + "
0)";
+ cs.position = "absolute";
+ rs.width = width;
+ rs.height = height;
+ r.coordsize = (width == "100%" ? width : parseFloat(width)) +
" " + (height == "100%" ? height : parseFloat(height));
+ r.coordorigin = "0 0";
+
+ var b = document.createElement("rvml:rect"), bs = b.style;
+ bs.left = bs.top = 0;
+ bs.width = rs.width;
+ bs.height = rs.height;
+ b.filled = b.stroked = "f";
+
+ r.appendChild(b);
+ c.appendChild(r);
+ if (container == 1) {
+ document.body.appendChild(c);
+ cs.position = "absolute";
+ cs.left = x + "px";
+ cs.top = y + "px";
+ cs.width = width;
+ cs.height = height;
+ container = {
+ style: {
+ width: width,
+ height: height
+ }
+ };
+ } else {
+ cs.width = container.style.width = width;
+ cs.height = container.style.height = height;
+ if (container.firstChild) {
+ container.insertBefore(c, container.firstChild);
+ } else {
+ container.appendChild(c);
+ }
+ }
+ for (var prop in C) {
+ container[prop] = C[prop];
+ }
+ container.clear = function () {
+ var todel = [];
+ for (var i = 0, ii = r.childNodes.length; i < ii; i++) {
+ if (r.childNodes[i] != b) {
+ todel.push(r.childNodes[i]);
+ }
+ }
+ for (i = 0, ii = todel.length; i < ii; i++) {
+ r.removeChild(todel[i]);
+ }
+ };
+ return container;
+ };
+ C.remove = function () {
+ C.canvas.parentNode.parentNode.removeChild(C.canvas.parentNode);
+ };
+ }
+ if (type == "SVG") {
+ Matrix.prototype.toString = function () {
+ return "matrix(" + this.m[0][0] +
+ ", " + this.m[1][0] + ", " + this.m[0][1] +
", " + this.m[1][1] +
+ ", " + this.m[2][0] + ", " + this.m[2][1] +
")";
+ };
+ var thePath = function (params, pathString, SVG) {
+ var el = document.createElementNS(SVG.svgns, "path");
+ el.setAttribute("fill", "none");
+ if (SVG.canvas) {
+ SVG.canvas.appendChild(el);
+ }
+ var p = new Element(el, SVG);
+ if (params) {
+ setFillAndStroke(p, params);
+ }
+ p.isAbsolute = true;
+ p.path = [];
+ p.last = {x: 0, y: 0, bx: 0, by: 0};
+ p.absolutely = function () {
+ this.isAbsolute = true;
+ return this;
+ };
+ p.relatively = function () {
+ this.isAbsolute = false;
+ return this;
+ };
+ p.redraw = function () {
+ this[0].setAttribute("d", "M0 0");
+ var oldPath = this.path;
+ this.path = [];
+ for (var i = 0, ii = oldPath.length; i < ii; i++) {
+ if (oldPath[i].type != "end") {
+ this[oldPath[i].type + "To"].apply(this,
oldPath[i].arg);
+ } else {
+ this.andClose();
+ }
+ }
+ return this;
+ };
+ p.moveTo = function (x, y) {
+ var d = this.isAbsolute?"M":"m";
+ var _getX = this.isAbsolute ? SVG._getX : SVG._getW;
+ var _getY = this.isAbsolute ? SVG._getY : SVG._getH;
+ d += _getX(parseFloat(x, 10)) + " " + _getY(parseFloat(y,
10)) + " ";
+ var oldD = this[0].getAttribute("d") || "";
+ this[0].setAttribute("d", oldD + d);
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
SVG._getX(parseFloat(x, 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
SVG._getY(parseFloat(y, 10));
+ this.path.push({type: "move", arg: arguments, pos:
this.isAbsolute});
+ return this;
+ };
+ p.lineTo = function (x, y) {
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
SVG._getX(parseFloat(x, 10));
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
SVG._getY(parseFloat(y, 10));
+ var d = this.isAbsolute?"L":"l";
+ var _getX = this.isAbsolute ? SVG._getX : SVG._getW;
+ var _getY = this.isAbsolute ? SVG._getY : SVG._getH;
+ d += _getX(parseFloat(x, 10)) + " " + _getY(parseFloat(y,
10)) + " ";
+ var oldD = this[0].getAttribute("d") || "";
+ this[0].setAttribute("d", oldD + d);
+ this.path.push({type: "line", arg: arguments, pos:
this.isAbsolute});
+ return this;
+ };
+ p.arcTo = function (rx, ry, large_arc_flag, sweep_flag, x, y) {
+ var d = this.isAbsolute ? "A" : "a";
+ var _getX = this.isAbsolute ? SVG._getX : SVG._getW;
+ var _getY = this.isAbsolute ? SVG._getY : SVG._getH;
+ d += [SVG._getW(parseFloat(rx, 10)), SVG._getH(parseFloat(ry, 10)),
0, large_arc_flag, sweep_flag, _getX(parseFloat(x, 10)), _getY(parseFloat(y,
10))].join(" ");
+ var oldD = this[0].getAttribute("d") || "";
+ this[0].setAttribute("d", oldD + d);
+ this.last.x = SVG._getX(parseFloat(x, 10));
+ this.last.y = SVG._getY(parseFloat(y, 10));
+ this.path.push({type: "arc", arg: arguments, pos:
this.isAbsolute});
+ return this;
+ };
+ p.cplineTo = function (x1, y1, w1) {
+ if (!w1) {
+ return this.lineTo(x1, y1);
+ } else {
+ var p = {};
+ p._getX = this.isAbsolute ? SVG._getX : SVG._getW;
+ p._getY = this.isAbsolute ? SVG._getY : SVG._getH;
+ var x = p._getX(Math.round(parseFloat(x1, 10) * 100) / 100);
+ var y = p._getY(Math.round(parseFloat(y1, 10) * 100) / 100);
+ var w = SVG._getW(Math.round(parseFloat(w1, 10) * 100) / 100);
+ var d = this.isAbsolute?"C":"c";
+ var attr = [this.last.x + w, this.last.y, x - w, y, x, y];
+ for (var i = 0, ii = attr.length; i < ii; i++) {
+ d += attr[i] + " ";
+ }
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) + attr[4];
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) + attr[5];
+ this.last.bx = attr[2];
+ this.last.by = attr[3];
+ var oldD = this[0].getAttribute("d") || "";
+ this[0].setAttribute("d", oldD + d);
+ this.path.push({type: "cpline", arg: arguments, pos:
this.isAbsolute});
+ return this;
+ }
+ };
+ p.curveTo = function () {
+ var p = {};
+ p._getX = this.isAbsolute ? SVG._getX : SVG._getW;
+ p._getY = this.isAbsolute ? SVG._getY : SVG._getH;
+ if (arguments.length == 6) {
+ var d = this.isAbsolute?"C":"c";
+ for (var i = 0, ii = arguments.length; i < ii; i++) {
+ d += p[(i % 2 == 0) ? "_getX" :
"_getY"](Math.round(parseFloat(arguments[i], 10) * 100) / 100) + " ";
+ }
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
p._getX((parseFloat(arguments[4], 10) * 100) / 100);
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
p._getY((parseFloat(arguments[5], 10) * 100) / 100);
+ this.last.bx = p._getX((parseFloat(arguments[2], 10) * 100) /
100);
+ this.last.by = p._getY((parseFloat(arguments[3], 10) * 100) /
100);
+ } else {
+ if (arguments.length == 4) {
+ var d = this.isAbsolute?"S":"s";
+ for (var i = 0, ii = arguments.length; i < ii; i++) {
+ d += p[i % 2 == 0 ? "_getX" :
"_getY"]((parseFloat(arguments[i], 10) * 100) / 100) + " ";
+ }
+ }
+ this.last.x = (this.isAbsolute ? 0 : this.last.x) +
p._getX((parseFloat(arguments[2], 10) * 100) / 100);
+ this.last.y = (this.isAbsolute ? 0 : this.last.y) +
p._getY((parseFloat(arguments[3], 10) * 100) / 100);
+ this.last.bx = p._getX((parseFloat(arguments[0], 10) * 100) /
100);
+ this.last.by = p._getY((parseFloat(arguments[1], 10) * 100) /
100);
+ }
+ var oldD = this[0].getAttribute("d") || "";
+ this[0].setAttribute("d", oldD + d);
+ this.path.push({type: "curve", arg: arguments, pos:
this.isAbsolute});
+ return this;
+ };
+ p.addRoundedCorner = function (r, dir) {
+ var R = .5522 * r, rollback = this.isAbsolute, o = this;
+ if (rollback) {
+ this.relatively();
+ rollback = function () {
+ o.absolutely();
+ };
+ } else {
+ rollback = function () {};
+ }
+ var actions = {
+ l: function () {
+ return {
+ u: function () {
+ o.curveTo(-R, 0, -r, -(r - R), -r, -r);
+ },
+ d: function () {
+ o.curveTo(-R, 0, -r, r - R, -r, r);
+ }
+ };
+ },
+ r: function () {
+ return {
+ u: function () {
+ o.curveTo(R, 0, r, -(r - R), r, -r);
+ },
+ d: function () {
+ o.curveTo(R, 0, r, r - R, r, r);
+ }
+ };
+ },
+ u: function () {
+ return {
+ r: function () {
+ o.curveTo(0, -R, -(R - r), -r, r, -r);
+ },
+ l: function () {
+ o.curveTo(0, -R, R - r, -r, -r, -r);
+ }
+ };
+ },
+ d: function () {
+ return {
+ r: function () {
+ o.curveTo(0, R, -(R - r), r, r, r);
+ },
+ l: function () {
+ o.curveTo(0, R, R - r, r, -r, r);
+ }
+ };
+ }
+ };
+ actions[dir[0]]()[dir[1]]();
+ rollback();
+ return o;
+ };
+ p.andClose = function () {
+ var oldD = this[0].getAttribute("d") || "";
+ this[0].setAttribute("d", oldD + "Z ");
+ this.path.push({type: "end"});
+ return this;
+ };
+ if (typeof pathString == "string") {
+ p.absolutely();
+ C.pathfinder(p, pathString);
+ }
+ return p;
+ };
+ var addGrdientFill = function (o, gradient, SVG) {
+ var el = document.createElementNS(SVG.svgns, gradient.type +
"Gradient");
+ el.id = "raphael-gradient-" + SVG.gradients++;
+ if (gradient.vector && gradient.vector.length) {
+ el.setAttribute("x1", gradient.vector[0]);
+ el.setAttribute("y1", gradient.vector[1]);
+ el.setAttribute("x2", gradient.vector[2]);
+ el.setAttribute("y2", gradient.vector[3]);
+ }
+ SVG.defs.appendChild(el);
+ for (var i = 0, ii = gradient.dots.length; i < ii; i++) {
+ var stop = document.createElementNS(SVG.svgns, "stop");
+ stop.setAttribute("offset", gradient.dots[i].offset ?
gradient.dots[i].offset : (i == 0) ? "0%" : "100%");
+ stop.setAttribute("stop-color", gradient.dots[i].color ||
"#fff");
+ if (typeof gradient.dots[i].opacity != "undefined") {
+ stop.setAttribute("stop-opacity",
gradient.dots[i].opacity);
+ }
+ el.appendChild(stop);
+ };
+ o.setAttribute("fill", "url(#" + el.id +
")");
+ };
+ var updatePosition = function (o) {
+ if (o.pattern) {
+ var bbox = o.node.getBBox();
+ o.pattern.setAttribute("patternTransform",
"translate(" + [bbox.x, bbox.y].join(",") + ")");
+ }
+ };
+ var setFillAndStroke = function (o, params) {
+ var dasharray = {
+ "-": [3, 1],
+ ".": [1, 1],
+ "-.": [3, 1, 1, 1],
+ "-..": [3, 1, 1, 1, 1, 1],
+ ". ": [1, 3],
+ "- ": [4, 3],
+ "--": [8, 3],
+ "- .": [4, 3, 1, 3],
+ "--.": [8, 3, 1, 3],
+ "--..": [8, 3, 1, 3, 1, 3]
+ };
+ for (var att in params) {
+ var value = params[att];
+ o.attrs[att] = value;
+ switch (att) {
+ case "rx":
+ case "cx":
+ case "x":
+ o[0].setAttribute(att, o.svg._getX(value));
+ updatePosition(o);
+ break;
+ case "ry":
+ case "cy":
+ case "y":
+ o[0].setAttribute(att, o.svg._getY(value));
+ updatePosition(o);
+ break;
+ case "width":
+ o[0].setAttribute(att, o.svg._getW(value));
+ break;
+ case "height":
+ o[0].setAttribute(att, o.svg._getH(value));
+ break;
+ case "gradient":
+ addGrdientFill(o[0], value, o.svg);
+ break;
+ case "stroke-dasharray":
+ value = dasharray[value.toLowerCase()];
+ if (value) {
+ var width = params["stroke-width"] ||
o.attr("stroke-width") || "1",
+ butt = {round: width, square: width, butt:
0}[o.attr("stroke-linecap")] || 0,
+ dashes = [];
+ for (var i = 0, ii = value.length; i < ii; i++) {
+ dashes.push(value[i] * width + ((i % 2) ? 1 : -1) *
butt);
+ }
+ value = dashes.join(",");
+ o[0].setAttribute(att, value);
+ }
+ break;
+ case "text":
+ if (o.type == "text") {
+ o[0].childNodes.length &&
o[0].removeChild(o[0].firstChild);
+ o[0].appendChild(document.createTextNode(value));
+ }
+ break;
+ case "fill":
+ var isURL = value.match(/^url\(([^\)]+)\)$/i);
+ if (isURL) {
+ var el = document.createElementNS(o.svg.svgns,
"pattern");
+ var ig = document.createElementNS(o.svg.svgns,
"image");
+ el.id = "raphael-pattern-" +
o.svg.gradients++;
+ el.setAttribute("x", 0);
+ el.setAttribute("y", 0);
+ el.setAttribute("patternUnits",
"userSpaceOnUse");
+ ig.setAttribute("x", 0);
+ ig.setAttribute("y", 0);
+ ig.setAttributeNS(o.svg.xlink, "href",
isURL[1]);
+ el.appendChild(ig);
+
+ var img = document.createElement("img");
+ img.style.position = "absolute";
+ img.style.top = "-9999em";
+ img.style.left = "-9999em";
+ img.onload = function () {
+ el.setAttribute("width",
this.offsetWidth);
+ el.setAttribute("height",
this.offsetHeight);
+ ig.setAttribute("width",
this.offsetWidth);
+ ig.setAttribute("height",
this.offsetHeight);
+ document.body.removeChild(this);
+ C.safari();
+ };
+ document.body.appendChild(img);
+ img.src = isURL[1];
+ o.svg.defs.appendChild(el);
+ o[0].style.fill = "url(#" + el.id +
")";
+ o[0].setAttribute("fill", "url(#" +
el.id + ")");
+ o.pattern = el;
+ updatePosition(o);
+ break;
+ }
+ default :
+ var cssrule = att.replace(/(\-.)/g, function (w) {
+ return w.substring(1).toUpperCase();
+ });
+ o[0].style[cssrule] = value;
+ // Need following line for Firefox
+ o[0].setAttribute(att, value);
+ break;
+ }
+ }
+ };
+ var Element = function (node, svg) {
+ var X = 0,
+ Y = 0,
+ Rotation = {deg: 0, x: 0, y: 0},
+ ScaleX = 1,
+ ScaleY = 1,
+ tMatrix = null;
+ this[0] = node;
+ this.node = node;
+ this.svg = svg;
+ this.attrs = this.attrs || {};
+ this.transformations = []; // rotate, translate, scale, matrix
+ this.rotate = function (deg) {
+ if (deg == undefined) {
+ return Rotation.deg;
+ }
+ var bbox = this.getBBox();
+ Rotation.deg += deg;
+ if (Rotation.deg) {
+ this.transformations[0] = ("rotate(" + Rotation.deg +
" " + (bbox.x + bbox.width / 2) + " " + (bbox.y + bbox.height / 2) +
")");
+ } else {
+ this.transformations[0] = "";
+ }
+ this[0].setAttribute("transform",
this.transformations.join(" "));
+ return this;
+ };
+ this.translate = function (x, y) {
+ if (x == undefined && y == undefined) {
+ return {x: X, y: Y};
+ }
+ X += x;
+ Y += y;
+ if (X || Y) {
+ this.transformations[1] = "translate(" + X +
"," + Y + ")";
+ } else {
+ this.transformations[1] = "";
+ }
+ this[0].setAttribute("transform",
this.transformations.join(" "));
+ return this;
+ };
+ this.scale = function (x, y) {
+ if (x == undefined && y == undefined) {
+ return {x: ScaleX, y: ScaleY};
+ }
+ y = y || x;
+ if (x != 0 && !(x == 1 && y == 1)) {
+ ScaleX *= x;
+ ScaleY *= y;
+ if (!(ScaleX == 1 && ScaleY == 1)) {
+ var bbox = this.getBBox(),
+ dx = bbox.x * (1 - ScaleX) + (bbox.width / 2 - bbox.width
* ScaleX / 2),
+ dy = bbox.y * (1 - ScaleY) + (bbox.height / 2 -
bbox.height * ScaleY / 2);
+ this.transformations[2] = new Matrix(ScaleX, 0, 0, ScaleY,
dx, dy);
+ } else {
+ this.transformations[2] = "";
+ }
+ this[0].setAttribute("transform",
this.transformations.join(" "));
+ }
+ return this;
+ };
+ };
+ Element.prototype.hide = function () {
+ this[0].style.display = "none";
+ return this;
+ };
+ Element.prototype.show = function () {
+ this[0].style.display = "block";
+ return this;
+ };
+ // depricated
+ Element.prototype.matrix = function (xx, xy, yx, yy, dx, dy) {
+ this.transformations[3] = new Matrix(xx, xy, yx, yy, dx, dy);
+ this[0].setAttribute("transform",
this.transformations.join(" "));
+ return this;
+ };
+ Element.prototype.remove = function () {
+ this[0].parentNode.removeChild(this[0]);
+ };
+ Element.prototype.getBBox = function () {
+ return this[0].getBBox();
+ };
+ Element.prototype.attr = function () {
+ if (arguments.length == 1 && typeof arguments[0] ==
"string") {
+ return this[0].getAttribute(arguments[0]);
+ }
+ if (arguments.length == 1 && arguments[0] instanceof Array) {
+ var values = {};
+ for (var j in arguments[0]) {
+ values[arguments[0][j]] = this.attrs[arguments[0][j]];
+ }
+ return values;
+ }
+ if (arguments.length == 2) {
+ var params = {};
+ params[arguments[0]] = arguments[1];
+ setFillAndStroke(this, params);
+ } else if (arguments.length == 1 && typeof arguments[0] ==
"object") {
+ setFillAndStroke(this, arguments[0]);
+ }
+ return this;
+ };
+ Element.prototype.toFront = function () {
+ this[0].parentNode.appendChild(this[0]);
+ return this;
+ };
+ Element.prototype.toBack = function () {
+ if (this[0].parentNode.firstChild != this[0]) {
+ this[0].parentNode.insertBefore(this[0],
this[0].parentNode.firstChild);
+ }
+ return this;
+ };
+ var theCircle = function (svg, x, y, r) {
+ var el = document.createElementNS(svg.svgns, "circle");
+ el.setAttribute("cx", svg._getX(x));
+ el.setAttribute("cy", svg._getY(y));
+ el.setAttribute("r", r);
+ el.setAttribute("fill", "none");
+ el.setAttribute("stroke", "#000");
+ if (svg.canvas) {
+ svg.canvas.appendChild(el);
+ }
+ var res = new Element(el, svg);
+ res.attrs = res.attrs || {};
+ res.attrs.cx = x;
+ res.attrs.cy = y;
+ res.attrs.r = r;
+ res.attrs.stroke = "#000";
+ res.type = "circle";
+ return res;
+ };
+ var theRect = function (svg, x, y, w, h, r) {
+ var el = document.createElementNS(svg.svgns, "rect");
+ el.setAttribute("x", svg._getX(x));
+ el.setAttribute("y", svg._getY(y));
+ el.setAttribute("width", svg._getW(w));
+ el.setAttribute("height", svg._getH(h));
+ if (r) {
+ el.setAttribute("rx", r);
+ el.setAttribute("ry", r);
+ }
+ el.setAttribute("fill", "none");
+ el.setAttribute("stroke", "#000");
+ if (svg.canvas) {
+ svg.canvas.appendChild(el);
+ }
+ var res = new Element(el, svg);
+ res.attrs = res.attrs || {};
+ res.attrs.x = x;
+ res.attrs.y = y;
+ res.attrs.width = w;
+ res.attrs.height = h;
+ res.attrs.stroke = "#000";
+ if (r) {
+ res.attrs.rx = res.attrs.ry = r;
+ }
+ res.type = "rect";
+ return res;
+ };
+ var theEllipse = function (svg, x, y, rx, ry) {
+ var el = document.createElementNS(svg.svgns, "ellipse");
+ el.setAttribute("cx", svg._getX(x));
+ el.setAttribute("cy", svg._getY(y));
+ el.setAttribute("rx", svg._getW(rx));
+ el.setAttribute("ry", svg._getH(ry));
+ el.setAttribute("fill", "none");
+ el.setAttribute("stroke", "#000");
+ if (svg.canvas) {
+ svg.canvas.appendChild(el);
+ }
+ var res = new Element(el, svg);
+ res.attrs = res.attrs || {};
+ res.attrs.cx = x;
+ res.attrs.cy = y;
+ res.attrs.rx = rx;
+ res.attrs.ry = ry;
+ res.attrs.stroke = "#000";
+ res.type = "ellipse";
+ return res;
+ };
+ var theImage = function (svg, src, x, y, w, h) {
+ var el = document.createElementNS(svg.svgns, "image");
+ el.setAttribute("x", svg._getX(x));
+ el.setAttribute("y", svg._getY(y));
+ el.setAttribute("width", svg._getW(w));
+ el.setAttribute("height", svg._getH(h));
+ el.setAttributeNS(svg.xlink, "href", src);
+ if (svg.canvas) {
+ svg.canvas.appendChild(el);
+ }
+ var res = new Element(el, svg);
+ res.attrs = res.attrs || {};
+ res.attrs.x = x;
+ res.attrs.y = y;
+ res.attrs.width = w;
+ res.attrs.height = h;
+ res.type = "image";
+ return res;
+ };
+ var theText = function (svg, x, y, text) {
+ var el = document.createElementNS(svg.svgns, "text");
+ el.setAttribute("x", x);
+ el.setAttribute("y", y);
+ el.setAttribute("text-anchor", "middle");
+ el.setAttribute("fill", "#000");
+ if (text) {
+ el.appendChild(document.createTextNode(text));
+ }
+ if (svg.canvas) {
+ svg.canvas.appendChild(el);
+ }
+ var res = new Element(el, svg);
+ res.attrs = res.attrs || {};
+ res.attrs.x = x;
+ res.attrs.y = y;
+ res.attrs.fill = "#000";
+ res.type = "text";
+ return res;
+ };
+ var theGroup = function (svg) {
+ var el = document.createElementNS(svg.svgns, "g");
+ if (svg.canvas) {
+ svg.canvas.appendChild(el);
+ }
+ var i = new Element(el, svg);
+ for (var f in svg) {
+ if (f[0] != "_" && typeof svg[f] ==
"function") {
+ i[f] = (function (f) {
+ return function () {
+ var e = svg[f].apply(svg, arguments);
+ el.appendChild(e[0]);
+ return e;
+ };
+ })(f);
+ }
+ }
+ i.type = "group";
+ return i;
+ };
+ r._create = function () {
+ // container, width, height
+ // x, y, width, height
+ if (typeof arguments[0] == "string") {
+ var container = document.getElementById(arguments[0]);
+ var width = arguments[1];
+ var height = arguments[2];
+ }
+ if (typeof arguments[0] == "object") {
+ var container = arguments[0];
+ var width = arguments[1];
+ var height = arguments[2];
+ }
+ if (typeof arguments[0] == "number") {
+ var container = 1,
+ x = arguments[0],
+ y = arguments[1],
+ width = arguments[2],
+ height = arguments[3];
+ }
+ if (!container) {
+ throw new Error("SVG container not found.");
+ }
+ C.canvas = document.createElementNS(C.svgns, "svg");
+ C.canvas.setAttribute("width", width || 320);
+ C.width = width || 320;
+ C.canvas.setAttribute("height", height || 200);
+ C.height = height || 200;
+ if (container == 1) {
+ document.body.appendChild(C.canvas);
+ C.canvas.style.position = "absolute";
+ C.canvas.style.left = x + "px";
+ C.canvas.style.top = y + "px";
+ } else {
+ if (container.firstChild) {
+ container.insertBefore(C.canvas, container.firstChild);
+ } else {
+ container.appendChild(C.canvas);
+ }
+ }
+ container = {
+ canvas: C.canvas,
+ clear: function () {
+ while (this.canvas.firstChild) {
+ this.canvas.removeChild(this.canvas.firstChild);
+ }
+ this.defs = document.createElementNS(C.svgns, "defs");
+ this.gradients = 0;
+ this.canvas.appendChild(this.defs);
+ }
+ };
+ for (var prop in C) {
+ if (prop != "create") {
+ container[prop] = C[prop];
+ }
+ }
+ container.clear();
+ return container;
+ };
+ C.remove = function () {
+ C.canvas.parentNode.removeChild(C.canvas);
+ };
+ C.svgns = "http://www.w3.org/2000/svg";
+ C.xlink = "http://www.w3.org/1999/xlink";
+ }
+ if (type == "VML" || type == "SVG") {
+ C.circle = function (x, y, r) {
+ return theCircle(this, x, y, r);
+ };
+ C.rect = function (x, y, w, h, r) {
+ return theRect(this, x, y, w, h, r);
+ };
+ C.ellipse = function (x, y, rx, ry) {
+ return theEllipse(this, x, y, rx, ry);
+ };
+ C.path = function (params, pathString) {
+ return thePath(params, pathString, this);
+ };
+ C.image = function (src, x, y, w, h) {
+ return theImage(this, src, x, y, w, h);
+ };
+ C.text = function (x, y, text) {
+ return theText(this, x, y, text);
+ };
+ C.group = function () {
+ return theGroup(this);
+ };
+ C.linerect = function (x, y, w, h, r) {
+ if (r && parseInt(r, 10)) {
+ return this.path({stroke: "#000"}).moveTo(x + r,
y).lineTo(x + w - r, y).addRoundedCorner(r, "rd").lineTo(x + w, y + h -
r).addRoundedCorner(r, "dl").lineTo(x + r, y + h).addRoundedCorner(r,
"lu").lineTo(x, y + r).addRoundedCorner(r, "ur").andClose();
+ }
+ return this.path({stroke: "#000"}).moveTo(x, y).lineTo(x + w,
y).lineTo(x + w, y + h).lineTo(x, y + h).andClose();
+ };
+ C.drawGrid = function (x, y, w, h, wv, hv, color) {
+ color = color || "#000";
+ var p = this.path({stroke: color, "stroke-width": 1})
+ .moveTo(x, y).lineTo(x + w, y).lineTo(x + w, y + h).lineTo(x, y +
h).lineTo(x, y),
+ rowHeight = h / hv,
+ columnWidth = w / wv;
+ for (var i = 1; i < hv; i++) {
+ p.moveTo(x, y + i * rowHeight).lineTo(x + w, y + i * rowHeight);
+ }
+ for (var i = 1; i < wv; i++) {
+ p.moveTo(x + i * columnWidth, y).lineTo(x + i * columnWidth, y + h);
+ }
+ return p;
+ };
+ C.setGrid = function (xmin, ymin, xmax, ymax, w, h) {
+ var xc = (xmax - xmin) / w;
+ var yc = (ymax - ymin) / h;
+ this._getX = function (x) {
+ return xmin + x * xc;
+ };
+ this._getY = function (y) {
+ return ymin + y * yc;
+ };
+ this._getW = function (w) {
+ return w * xc;
+ };
+ this._getH = function (h) {
+ return h * yc;
+ };
+ };
+ C.clearGrid = function () {
+ this._getX = this._getY = this._getW = this._getH = function (x) { return
x; };
+ };
+ C.safari = function () {
+ if (r.type == "SVG") {
+ var rect = C.rect(-C.width, -C.height, C.width * 3, C.height *
3).attr({stroke: "none"});
+ setTimeout(function () {rect.remove();}, 0);
+ }
+ };
+ Element.prototype.animateTo = function (x, y, ms, callback) {
+ clearTimeout(this.animation_in_progress);
+ if ("cx" in this.attrs || "x" in this.attrs) {
+ var is_round = ("cx" in this.attrs),
+ X = this.attrs.cx || this.attrs.x,
+ Y = this.attrs.cy || this.attrs.y;
+ if (x == X && y == Y) {
+ return this;
+ }
+ var dy = y - Y,
+ dx = x - X,
+ coeff = dy / dx,
+ plus = Y - coeff * X,
+ alpha = Math.atan(this.coeff);
+ this.xs = this.step * Math.cos(alpha);
+ if (x < X) {
+ this.xs = -this.xs;
+ }
+ var start = new Date(),
+ that = this;
+ (function () {
+ var time = (new Date()).getTime() - start.getTime();
+ if (time < ms) {
+ var x1 = X + time * dx / ms;
+ var y1 = x1 * coeff + plus;
+ that.attr(is_round ? {cx: x1, cy: y1} : {x: x1, y: y1});
+ that.animation_in_progress = setTimeout(arguments.callee,
1);
+ C.safari();
+ } else {
+ that.attr(is_round ? {cx: x, cy: y} : {x: x, y: y});
+ C.safari();
+ callback && callback.call(that);
+ }
+ })();
+ }
+ return this;
+ };
+ C.pathfinder = function (p, path) {
+ var commands = {
+ M: function (x, y) {
+ this.moveTo(x, y);
+ },
+ m: function (x, y) {
+ this.moveTo(this.last.x + x, this.last.y + y);
+ },
+ C: function (x1, y1, x2, y2, x3, y3) {
+ this.curveTo(x1, y1, x2, y2, x3, y3);
+ },
+ c: function (x1, y1, x2, y2, x3, y3) {
+ this.curveTo(this.last.x + x1, this.last.y + y1, this.last.x +
x2, this.last.y + y2, this.last.x + x3, this.last.y + y3);
+ },
+ S: function (x1, y1, x2, y2) {
+ p.curveTo(x1, y1, x2, y2);
+ },
+ s: function (x1, y1, x2, y2) {
+ this.curveTo(this.last.x + x1, this.last.y + y1, this.last.x +
x2, this.last.y + y2);
+ },
+ L: function (x, y) {
+ p.lineTo(x, y);
+ },
+ l: function (x, y) {
+ this.lineTo(this.last.x + x, this.last.y + y);
+ },
+ H: function (x) {
+ this.lineTo(x, this.last.y);
+ },
+ h: function (x) {
+ this.lineTo(this.last.x + x, this.last.y);
+ },
+ V: function (y) {
+ this.lineTo(this.last.x, y);
+ },
+ v: function (y) {
+ this.lineTo(this.last.x, this.last.y + y);
+ },
+ A: function (rx, ry, xaxisrotation, largearcflag, sweepflag, x, y) {
+ this.arcTo(rx, ry, largearcflag, sweepflag, x, y);
+ },
+ a: function (rx, ry, xaxisrotation, largearcflag, sweepflag, x, y) {
+ this.arcTo(this.last.x + rx, this.last.y + ry, largearcflag,
sweethisflag, this.last.x + x, this.last.y + y);
+ },
+ z: function () {
+ this.andClose();
+ }
+ };
+ path.replace(/([mzlhvcsqta])\s*((-?\d*\.?\d*\s*,?\s*)+)/ig, function (a,
b, c) {
+ var params = [];
+ c.replace(/(-?\d*\.?\d*)\s*,?\s*/ig, function (a, b) {
+ b && params.push(+b);
+ });
+ while (params.length >= commands[b].length) {
+ commands[b].apply(p, params.splice(0, commands[b].length));
+ if (!commands[b].length) {
+ break;
+ };
+ }
+ });
+ };
+ return r;
+ } else {
+ return function () {};
+ }
+ })((!(window.SVGPreserveAspectRatio &&
window.SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMIN == 2)) ? "VML" :
"SVG");
+
+
+Raphael.vml = !(Raphael.svg = (Raphael.type == "SVG"));
+if (Raphael.vml && window.CanvasRenderingContext2D) {
+ Raphael.type = "Canvas only";
+ Raphael.vml = Raphael.svg = false;
+}
+Raphael.toString = function () {
+ return "Your browser supports " + this.type + ".\nYou are running
" + unescape("Rapha%EBl%20") + this.version;
+};
+// generic utilities
+Raphael.hsb2rgb = function (hue, saturation, brightness) {
+ if (typeof hue == "object" && "h" in hue &&
"s" in hue && "b" in hue) {
+ brightness = hue.b;
+ saturation = hue.s;
+ hue = hue.h;
+ }
+ var red,
+ green,
+ blue;
+ if (brightness == 0) {
+ return {r: 0, g: 0, b: 0, hex: "#000"};
+ } else {
+ var i = Math.floor(hue * 6),
+ f = (hue * 6) - i,
+ p = brightness * (1 - saturation),
+ q = brightness * (1 - (saturation * f)),
+ t = brightness * (1 - (saturation * (1 - f)));
+ [
+ function () {red = brightness; green = t; blue = p;},
+ function () {red = q; green = brightness; blue = p;},
+ function () {red = p; green = brightness; blue = t;},
+ function () {red = p; green = q; blue = brightness;},
+ function () {red = t; green = p; blue = brightness;},
+ function () {red = brightness; green = p; blue = q;},
+ function () {red = brightness; green = t; blue = p;}
+ ][i]();
+ }
+ var rgb = {r: red, g: green, b: blue};
+ red *= 255;
+ green *= 255;
+ blue *= 255;
+ var r = Math.round(red).toString(16);
+ if (r.length == 1) {
+ r = "0" + r;
+ }
+ var g = Math.round(green).toString(16);
+ if (g.length == 1) {
+ g = "0" + g;
+ }
+ var b = Math.round(blue).toString(16);
+ if (b.length == 1) {
+ b = "0" + b;
+ }
+ rgb.hex = "#" + r + g + b;
+ return rgb;
+};
+Raphael.rgb2hsb = function (red, green, blue) {
+ if (typeof red == "object" && "r" in red &&
"g" in red && "b" in red) {
+ blue = red.b;
+ green = red.g;
+ red = red.r;
+ }
+ if (typeof red == "string" && red.charAt(0) == "#") {
+ if (red.length == 4) {
+ blue = parseInt(red.substring(3), 16);
+ green = parseInt(red.substring(2, 3), 16);
+ red = parseInt(red.substring(1, 2), 16);
+ } else {
+ blue = parseInt(red.substring(5), 16);
+ green = parseInt(red.substring(3, 5), 16);
+ red = parseInt(red.substring(1, 3), 16);
+ }
+ }
+ if (red > 1 || green > 1 || blue > 1) {
+ red /= 255;
+ green /= 255;
+ blue /= 255;
+ }
+ var max = Math.max(red, green, blue),
+ min = Math.min(red, green, blue),
+ hue,
+ saturation,
+ brightness = max;
+ if (min == max) {
+ return {h: 0, s: 0, b: max};
+ } else {
+ var delta = (max - min);
+ saturation = delta / max;
+ if (red == max) {
+ hue = (green - blue) / delta;
+ } else if (green == max) {
+ hue = 2 + ((blue - red) / delta);
+ } else {
+ hue = 4 + ((red - green) / delta);
+ }
+ hue /= 6;
+ if (hue < 0) {
+ hue += 1;
+ }
+ if (hue > 1) {
+ hue -= 1;
+ }
+ }
+ return {h: hue, s: saturation, b: brightness};
+};
+Raphael.getColor = function (value) {
+ var start = arguments.callee.start = arguments.callee.start || {h: 0, s: 1, b: value
|| .75};
+ var rgb = this.hsb2rgb(start.h, start.s, start.b);
+ start.h += .075;
+ if (start.h > 1) {
+ start.h = 0;
+ start.s -= .2;
+ if (start.s <= 0) {
+ arguments.callee.start = {h: 0, s: 1, b: start.b};
+ }
+ }
+ return rgb.hex;
+};
+Raphael.getColor.reset = function () {
+ this.start = undefined;
+};
\ No newline at end of file
diff --git a/system/application/views/template.php
b/system/application/views/template.php
index 5beed8e..c6e96de 100644
--- a/system/application/views/template.php
+++ b/system/application/views/template.php
@@ -10,6 +10,7 @@
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/custom.css">
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/menu.css">
<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/jquery.datepick.css">
+<link type="text/css" rel="stylesheet" href="<?php echo
asset_url(); ?>css/tufte-graph.css">
<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.datepick.js"></script>
@@ -17,10 +18,13 @@
<script type="text/javascript" src="<?php echo asset_url();
?>js/hoverIntent.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/superfish.js"></script>
<script type="text/javascript" src="<?php echo asset_url();
?>js/supersubs.js"></script>
+<script type="text/javascript" src="<?php echo asset_url();
?>js/raphael.js"></script>
+<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.enumerable.js"></script>
+<script type="text/javascript" src="<?php echo asset_url();
?>js/jquery.tufte-graph.js"></script>
<script type="text/javascript">
/* Loading JQuery Superfish menu */
-$(document).ready(function(){
+$(document).ready(function() {
$("ul.sf-menu").supersubs({
minWidth:12,
maxWidth:27,
commit 7f2bd4aa3cb8938b849bff90bc78ad5b78846d81
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 12:26:22 2010 +0530
Renamed TODO.txt file
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/TODO.txt b/TODO.txt
deleted file mode 100644
index 0cb0a0c..0000000
--- a/TODO.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Priority - Task - Person responsible
-
-It is now available online at
-
-http://codaset.com/pshahmumbai/webzash/wiki/Project-Plan
diff --git a/todo.txt b/todo.txt
new file mode 100644
index 0000000..0cb0a0c
--- /dev/null
+++ b/todo.txt
@@ -0,0 +1,5 @@
+Priority - Task - Person responsible
+
+It is now available online at
+
+http://codaset.com/pshahmumbai/webzash/wiki/Project-Plan
commit edaba04ca040938d29c3565a96656ae06788b56b
Author: Prashant P Shah <pshah.mumbai(a)gmail.com>
Date: Mon Dec 6 12:25:28 2010 +0530
Added AGPL License to the project
Signed-off-by: Prashant P Shah <pshah.mumbai(a)gmail.com>
diff --git a/webzash-agpl-3.0.txt b/webzash-agpl-3.0.txt
new file mode 100644
index 0000000..dba13ed
--- /dev/null
+++ b/webzash-agpl-3.0.txt
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <
http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means
any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <
http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
diff --git a/webzash-copyright.txt b/webzash-copyright.txt
new file mode 100644
index 0000000..f032899
--- /dev/null
+++ b/webzash-copyright.txt
@@ -0,0 +1,24 @@
+Webzash - easy to use web based double entry accounting software
+
+Copyright (c) 2010 - 2011 Prashant P Shah <pshah.mumbai(a)gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <
http://www.gnu.org/licenses/>.
+
+Webzash includes works under other copyright notices and distributed
+according to the terms of the GNU General Public License or a compatible
+license, including:
+
+- jQuery Javascript Library
+- jQuery Javascript Library Plugins
+- Codeignitor PHP Based Web Development Framework