This commit is contained in:
Raju Shrestha 2024-08-08 18:27:34 +05:45
commit 114e7aa4c2
11 changed files with 132 additions and 19 deletions

View File

@ -65,6 +65,8 @@ class Reports extends CI_Controller
loadView("accounts/trialbalance", $data); loadView("accounts/trialbalance", $data);
break; break;
case 'trialbalance': case 'trialbalance':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Trial Balance"; $data['pageTitle'] = "Trial Balance";
loadView("accounts/trialbalance_new", $data); loadView("accounts/trialbalance_new", $data);
break; break;
@ -130,6 +132,8 @@ class Reports extends CI_Controller
loadView("accounts/pl", $data); loadView("accounts/pl", $data);
break; break;
case 'pl': case 'pl':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Profit & Loss Statement"; $data['pageTitle'] = "Profit & Loss Statement";
loadView("accounts/pl_new", $data); loadView("accounts/pl_new", $data);
break; break;
@ -143,6 +147,8 @@ class Reports extends CI_Controller
loadView("accounts/balancesheet", $data); loadView("accounts/balancesheet", $data);
break; break;
case 'balance_sheet': case 'balance_sheet':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Balance Sheet"; $data['pageTitle'] = "Balance Sheet";
loadView("accounts/balancesheet_new", $data); loadView("accounts/balancesheet_new", $data);
break; break;
@ -151,6 +157,8 @@ class Reports extends CI_Controller
loadView("accounts/balance_sheet_vertical", $data); loadView("accounts/balance_sheet_vertical", $data);
break; break;
case 'cash_flow': case 'cash_flow':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Flow"; $data['pageTitle'] = "Cash Flow";
loadView("accounts/cash_flow", $data); loadView("accounts/cash_flow", $data);
break; break;
@ -163,6 +171,8 @@ class Reports extends CI_Controller
loadView("accounts/incomes_expenses", $data); loadView("accounts/incomes_expenses", $data);
break; break;
case 'receipt_and_payment': case 'receipt_and_payment':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Flow"; $data['pageTitle'] = "Cash Flow";
loadView("accounts/receipt_and_payment", $data); loadView("accounts/receipt_and_payment", $data);
break; break;

View File

@ -205,7 +205,7 @@ class myaccounts
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td><a href=" . $Account->account_id . ">" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>"; $html .= "<tr><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
if ($full==""){ if ($full==""){
@ -982,7 +982,9 @@ class myaccounts
<?php foreach ($TableRow->Transactions as $Transaction) : ?> <?php foreach ($TableRow->Transactions as $Transaction) : ?>
<div><?php echo (($Transaction->cr) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $this->getAccountDetails($Transaction->account_id)->account_name; ?></div> <div><?php echo (($Transaction->cr) ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "") . $this->getAccountDetails($Transaction->account_id)->account_name; ?></div>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($TableRow->narration): ?>
(<span class="narration_display"><?php echo $TableRow->narration; ?></span>) (<span class="narration_display"><?php echo $TableRow->narration; ?></span>)
<?php endif; ?>
</td> </td>
<?php if ($showVoucherTypes) : ?> <?php if ($showVoucherTypes) : ?>
<td> <td>

View File

@ -103,11 +103,11 @@ $BIBAccounts = new BIBAccounts();
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -454,5 +454,22 @@ function footerfunctions()
link.click(); link.click();
} }
</script> </script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php <?php
} }

View File

@ -121,13 +121,13 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -399,4 +399,24 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions()
{ ?>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php } ?>

View File

@ -116,7 +116,7 @@
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td>" . $Account->account_name . "</td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>"; $html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";

View File

@ -117,7 +117,7 @@
$balance = getBalance($Account->account_id); $balance = getBalance($Account->account_id);
$BalanceTotal += $balance; $BalanceTotal += $balance;
// pre($Account); // pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td>" . $Account->account_name . "</td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>"; $html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-2 text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach; endforeach;
$html .= "</tbody><tfoot>"; $html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>"; $html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th><th></th></tr>";

View File

@ -108,11 +108,11 @@ $BIBAccounts = new BIBAccounts();
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -400,5 +400,23 @@ function footerfunctions()
link.click(); link.click();
} }
</script> </script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php <?php
} }
?>

View File

@ -125,13 +125,13 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -385,4 +385,24 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div><!-- /.container-fluid --> </div><!-- /.container-fluid -->
</section> </section>
<?php function footerFunctions()
{ ?>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php } ?>

View File

@ -111,13 +111,13 @@ $BIBAccounts = new BIBAccounts();
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label> <label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> <input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label> <label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period"> <input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart;?>" data-end="<?php echo $fiscalEnd;?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div> </div>
</div> </div>
<div class="dropdown-divider"></div> <div class="dropdown-divider"></div>
@ -360,6 +360,23 @@ function footerfunctions()
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
} }
</script> </script>
<script>
$("#fromDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#fromDate').data('start'),
maxDate: $('#fromDate').data('end'),
});
</script>
<script>
$("#toDate").nepaliDatePicker({
dateFormat: "%y-%m-%d",
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
});
</script>
<?php <?php
} }
?>

View File

@ -126,17 +126,19 @@
<th rowspan="2" width="30" valign="middle"><?php myLang('S.No.'); ?></th> <th rowspan="2" width="30" valign="middle"><?php myLang('S.No.'); ?></th>
<th rowspan="2"><?php myLang('Item'); ?></th> <th rowspan="2"><?php myLang('Item'); ?></th>
<th rowspan="2"><?php myLang('Units'); ?></th> <th rowspan="2"><?php myLang('Units'); ?></th>
<th colspan="2" class="text-center"><?php myLang('Opening Stock'); ?></th> <th colspan="3" class="text-center"><?php myLang('Opening Stock'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Purchase'); ?></th> <th colspan="3" class="text-center"><?php myLang('Purchase'); ?></th>
<th colspan="3" class="text-center"><?php myLang('Sales'); ?></th> <th colspan="3" class="text-center"><?php myLang('Sales'); ?></th>
<th rowspan="2" class="text-center"><?php myLang('Sold Inventory %'); ?></th> <th rowspan="2" class="text-center"><?php myLang('Sold Inventory %'); ?></th>
<th rowspan="2" class="text-center"><?php myLang('Remaining Inventory %'); ?></th> <th rowspan="2" class="text-center"><?php myLang('Remaining Inventory %'); ?></th>
<th colspan="2" class="text-center"><?php myLang('Remaining Inventory'); ?></th> <th colspan="2" class="text-center"><?php myLang('Remaining Inventory'); ?></th>
<th rowspan="2" class="text-right"><?php myLang('Cost of Goods Sold'); ?></th> <th rowspan="2" class="text-right"><?php myLang('Cost of Goods Sold'); ?></th>
<th rowspan="2" class="text-center"><?php myLang('Gross Profit'); ?></th>
<th rowspan="2" class="text-center"><?php myLang('Gross Profit Margin'); ?></th> <th rowspan="2" class="text-center"><?php myLang('Gross Profit Margin'); ?></th>
</tr> </tr>
<tr> <tr>
<th class="text-right"><?php myLang('Qty'); ?></th> <th class="text-right"><?php myLang('Qty'); ?></th>
<th class="text-right"><?php myLang('Rate'); ?></th>
<th class="text-right"><?php myLang('Value'); ?></th> <th class="text-right"><?php myLang('Value'); ?></th>
<th class="text-right"><?php myLang('Qty'); ?></th> <th class="text-right"><?php myLang('Qty'); ?></th>
<th class="text-right"><?php myLang('Avg. Rate'); ?></th> <th class="text-right"><?php myLang('Avg. Rate'); ?></th>
@ -177,6 +179,7 @@
$sumoamount = 0; $sumoamount = 0;
$sumclamount = 0; $sumclamount = 0;
$sumcogs = 0; $sumcogs = 0;
$sumgp = 0;
?> ?>
<?php $a = 0; <?php $a = 0;
foreach ($StockItems as $Stock) : $a++; ?> foreach ($StockItems as $Stock) : $a++; ?>
@ -185,6 +188,7 @@
<td><?php echo $Stock->Item->title; ?></td> <td><?php echo $Stock->Item->title; ?></td>
<td><?php echo $Stock->Summary->Unit->title; ?></td> <td><?php echo $Stock->Summary->Unit->title; ?></td>
<td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td> <td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td>
<td class="text-right"><?php echo myCurrency($orate = $Stock->Summary->Opening->rate); ?></td>
<td class="text-right"><?php echo myCurrency($oamount = $Stock->Summary->Opening->amount); ?></td> <td class="text-right"><?php echo myCurrency($oamount = $Stock->Summary->Opening->amount); ?></td>
<td class="text-right"><?php echo $Stock->Summary->Purchase->qty; ?></td> <td class="text-right"><?php echo $Stock->Summary->Purchase->qty; ?></td>
<td class="text-right"><?php echo myCurrency($Stock->Summary->Purchase->rate); ?></td> <td class="text-right"><?php echo myCurrency($Stock->Summary->Purchase->rate); ?></td>
@ -200,8 +204,10 @@
<td class="text-right"><?php echo myCurrency($clamount = $Stock->Summary->Closing->amount); ?></td> <td class="text-right"><?php echo myCurrency($clamount = $Stock->Summary->Closing->amount); ?></td>
<?php $cogs = ($Stock->Summary->Sales->qty) * ($Stock->Summary->Purchase->rate); ?> <?php $cogs = ($Stock->Summary->Sales->qty) * ($Stock->Summary->Purchase->rate); ?>
<td class="text-right"><?php echo myCurrency($cogs); ?></td> <td class="text-right"><?php echo myCurrency($cogs); ?></td>
<?php $gp=($Stock->Summary->Sales->qty) - $cogs; ?> <?php $gp=($Stock->Summary->Sales->amount) - $cogs; ?>
<?php $gpm = ($Stock->Summary->Sales->amount > 0) ? (($Stock->Summary->Sales->amount - $cogs) / $Stock->Summary->Sales->amount) * 100 : 0; ?> <td class="text-right"><?php echo myCurrency($gp); ?></td>
<?php $gpm = ($Stock->Summary->Sales->amount > 0) ? ($gp/ $Stock->Summary->Sales->amount) * 100 : 0; ?>
<td class="text-center"><?php echo number_format($gpm, 2) . "%"; ?></td> <td class="text-center"><?php echo number_format($gpm, 2) . "%"; ?></td>
<td></td> <td></td>
<?php <?php
@ -213,6 +219,7 @@
$sumclqty += $clqty; $sumclqty += $clqty;
$sumclamount += $clamount; $sumclamount += $clamount;
$sumcogs += $cogs; $sumcogs += $cogs;
$sumgp += $gp;
?> ?>
</tr> </tr>
@ -223,6 +230,7 @@
<tr> <tr>
<td colspan="3" class="text-right text-bold">Grand Total</td> <td colspan="3" class="text-right text-bold">Grand Total</td>
<td class="text-right text-bold"><?php echo $sumoqty ?></td> <td class="text-right text-bold"><?php echo $sumoqty ?></td>
<td class="text-right text-bold"></td>
<td class="text-right text-bold"><?php echo number_format($sumoamount, 2) ?></td> <td class="text-right text-bold"><?php echo number_format($sumoamount, 2) ?></td>
<td class="text-right text-bold"></td> <td class="text-right text-bold"></td>
<td class="text-right text-bold"></td> <td class="text-right text-bold"></td>
@ -235,6 +243,7 @@
<td class="text-right text-bold"><?php echo $sumclqty ?></td> <td class="text-right text-bold"><?php echo $sumclqty ?></td>
<td class="text-right text-bold"><?php echo number_format($sumclamount, 2) ?></td> <td class="text-right text-bold"><?php echo number_format($sumclamount, 2) ?></td>
<td class="text-right text-bold"><?php echo number_format($sumcogs, 2) ?></td> <td class="text-right text-bold"><?php echo number_format($sumcogs, 2) ?></td>
<td class="text-right text-bold"><?php echo number_format($sumgp, 2) ?></td>
<td class="text-right text-bold"></td> <td class="text-right text-bold"></td>
</tr> </tr>

Binary file not shown.