$reconciliation_dr_total = 0; } /* Reconciliation Balance - Cr */ $this->db->select_sum('amount', 'crtotal')->from('entry_items')->join('entries', 'entries.id = entry_items.entry_id')->where('entry_items.ledger_id', $ledger_id)->where('entry_items.dc', 'C')->where('entry_items.reconciliation_date IS NOT NULL'); $cr_total_q = $this->db->get(); if ($cr_total = $cr_total_q->row()) { $reconciliation_cr_total = $cr_total->crtotal; } else { $reconciliation_cr_total = 0; } $reconciliation_total = $reconciliation_dr_total - $reconciliation_cr_total; $reconciliation_pending = $clbalance - $reconciliation_total; /* Ledger and Reconciliation Summary */ echo "<table class=\"reconciliation-summary\">"; echo "<tr>"; echo "<td><b>Opening Balance</b></td><td>" . convert_opening($opbalance, $optype) . "</td>"; echo "<td width=\"20px\"></td>"; echo "<td><b>Reconciliation Pending</b></td><td>" . convert_amount_dc($reconciliation_pending) . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Closing Balance</b></td><td>" . convert_amount_dc($clbalance) . "</td>"; echo "<td width=\"20px\"></td>"; echo "<td><b>Reconciliation Total</b></td><td>" . convert_amount_dc($reconciliation_total) . "</td>"; echo "</tr>"; echo "</table>"; echo "<br />"; if (!$print_preview) { $this->db->select('entries.id as entries_id, entries.number as entries_number, entries.date as entries_date, entries.narration as entries_narration, entries.entry_type as entries_entry_type, entry_items.id as entry_items_id, entry_items.amount as entry_items_amount, entry_items.dc as entry_items_dc, entry_items.reconciliation_date as entry_items_reconciliation_date'); if ($reconciliation_type == 'all') { $this->db->from('entries')->join('entry_items', 'entries.id = entry_items.entry_id')->where('entry_items.ledger_id', $ledger_id)->order_by('entries.date', 'asc')->order_by('entries.number', 'asc')->limit($pagination_counter, $page_count); } else {
echo "<table border=0 cellpadding=5 class=\"simple-table trial-balance-table\">"; echo "<thead><tr><th>Ledger Account</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(); $odd_even = "odd"; foreach ($all_ledgers as $ledger_id => $ledger_name) { if ($ledger_id == 0) { continue; } echo "<tr class=\"tr-" . $odd_even . "\">"; echo "<td>"; echo anchor('report/ledgerst/' . $ledger_id, $ledger_name, array('title' => $ledger_name . ' Ledger Statement', 'class' => 'anchor-link-a')); echo "</td>"; echo "<td>"; list($opbal_amount, $opbal_type) = $this->Ledger_model->get_op_balance($ledger_id); echo convert_opening($opbal_amount, $opbal_type); echo "</td>"; echo "<td>"; $clbal_amount = $this->Ledger_model->get_ledger_balance($ledger_id); echo convert_amount_dc($clbal_amount); echo "</td>"; echo "<td>"; $dr_total = $this->Ledger_model->get_dr_total($ledger_id); if ($dr_total) { echo $dr_total; $temp_dr_total += $dr_total; } else { echo "0"; } echo "</td>"; echo "<td>";
function account_st_main($c = 0) { $this->counter = $c; if ($this->id != 0) { echo "<tr class=\"tr-group\">"; echo "<td class=\"td-group\">"; echo $this->print_space($this->counter); if ($this->id <= 4) { echo " <strong>" . $this->name . "</strong>"; } else { echo " " . $this->name; } echo "</td>"; echo "<td>Group Account</td>"; echo "<td>-</td>"; echo "<td>-</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) { $this->counter++; $data->account_st_main($this->counter); $this->counter--; } if (count($this->children_ledgers) > 0) { $this->counter++; foreach ($this->children_ledgers as $id => $data) { 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>"; echo "<td>Ledger Account</td>"; echo "<td>" . convert_opening($data['opbalance'], $data['optype']) . "</td>"; echo "<td>" . convert_amount_dc($data['total']) . "</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--; } }
function print_tree($account_tree) { self::$counter++; foreach ($account_tree as $row) { if ($row['id'] > 0) { echo "<tr class=\"tr-group\">"; if ($row['id'] <= 4) { echo "<td><strong>" . self::print_spaces(self::$counter) . $row['name'] . "</strong></td>"; echo "<td>Group</td>"; echo "<td>-</td>"; echo "<td>-</td>"; echo "<td class=\"td-actions\">"; echo "</td>"; echo "</tr>"; } else { echo "<td>" . self::print_spaces(self::$counter) . $row['name'] . "</td>"; echo "<td>Group</td>"; echo "<td>-</td>"; echo "<td>-</td>"; echo "<td class=\"td-actions\">" . anchor('group/edit/' . $row['id'], "Edit", array('title' => 'Edit Group', 'class' => 'red-link')); echo " " . anchor('group/delete/' . $row['id'], img(array('src' => asset_url() . "images/icons/delete.png", 'border' => '0', 'alt' => 'Delete Group')), array('class' => "confirmClick", 'title' => "Delete Group")) . "</td>"; echo "</tr>"; } } if ($row['sub_ledgers']) { self::$counter++; foreach ($row['sub_ledgers'] as $row_item) { echo "<tr>"; echo "<td>" . self::print_spaces(self::$counter) . $row_item['name'] . "</td>"; echo "<td>Ledger</td>"; echo "<td>" . convert_opening($row_item['op_balance'], $row_item['op_balance_dc']) . "</td>"; echo "<td>" . convert_amount_dc($row_item['cl_balance']) . "</td>"; echo "<td class=\"td-actions\">" . anchor('ledger/edit/' . $row_item['id'], "Edit", array('title' => 'Edit Ledger', 'class' => 'red-link')); echo " " . anchor('ledger/delete/' . $row_item['id'], img(array('src' => asset_url() . "images/icons/delete.png", 'border' => '0', 'alt' => 'Delete Ledger')), array('class' => "confirmClick", 'title' => "Delete Ledger")) . "</td>"; echo "</tr>"; } self::$counter--; } if ($row['sub_groups']) { foreach ($row['sub_groups'] as $row_item) { self::print_tree($row_item); } } } self::$counter--; }
$page_count = 0; $this->db->select('entries.id as entries_id, entries.number as entries_number, entries.date as entries_date, entries.narration as entries_narration, entries.entry_type as entries_entry_type, entry_items.amount as entry_items_amount, entry_items.dc as entry_items_dc'); $this->db->from('entries')->join('entry_items', 'entries.id = entry_items.entry_id')->where('entry_items.ledger_id', $ledger_id)->order_by('entries.date', 'asc')->order_by('entries.number', 'asc'); $ledgerst_q = $this->db->get(); } 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>Type</th><th>Dr Amount</th><th>Cr Amount</th><th>Balance</th></tr></thead>"; $odd_even = "odd"; $cur_balance = 0; if ($page_count <= 0) { /* Opening balance */ if ($optype == "D") { echo "<tr class=\"tr-balance\"><td colspan=6>Opening Balance</td><td>" . convert_opening($opbalance, $optype) . "</td></tr>"; $cur_balance = float_ops($cur_balance, $opbalance, '+'); } else { echo "<tr class=\"tr-balance\"><td colspan=6>Opening Balance</td><td>" . convert_opening($opbalance, $optype) . "</td></tr>"; $cur_balance = float_ops($cur_balance, $opbalance, '-'); } } else { /* Opening balance */ if ($optype == "D") { $cur_balance = float_ops($cur_balance, $opbalance, '+'); } else { $cur_balance = float_ops($cur_balance, $opbalance, '-'); } /* Calculating previous balance */ $this->db->select('entries.id as entries_id, entries.number as entries_number, entries.date as entries_date, entries.entry_type as entries_entry_type, entry_items.amount as entry_items_amount, entry_items.dc as entry_items_dc'); $this->db->from('entries')->join('entry_items', 'entries.id = entry_items.entry_id')->where('entry_items.ledger_id', $ledger_id)->order_by('entries.date', 'asc')->order_by('entries.number', 'asc')->limit($page_count, 0); $prevbal_q = $this->db->get(); foreach ($prevbal_q->result() as $row) { if ($row->entry_items_dc == "D") {