edit profti and loss

This commit is contained in:
Raju Shrestha
2024-08-26 12:29:38 +05:45
parent 161703be17
commit 759b97e1f0
9 changed files with 575 additions and 134 deletions

View File

@ -88,6 +88,30 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.table1 {
border: 0px !important;
padding: 0;
margin: 10 !important;
width: 100%;
vertical-align: middle;
}
.table-responsive {
overflow-x: auto;
}
.card-body {
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
</style>
<div class="content-wrapper">
<div class="content">
@ -178,33 +202,31 @@ $BIBAccounts = new BIBAccounts();
<div class="row">
<div class="col">
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<div class="card card-primary card-outline ">
<div class="card-body p-0">
<?php
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
'showOB' => false,
'showClosing' => true,
'showPeriod' => false,
);
// die;
?>
<table class="table table-bordered">
<thead>
<tr>
<th class="group-name" width="85%">Particulars</th>
<th class="group-total text-center" width="10%">Amount</th>
<th class="group-name" width="85%">Particulars</th>
<th class="group-total text-center" width="15%">Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="p-0">
<div class="card card-primary card-outline">
<div class="card-body pl-2 pr-2">
<div class="row">
<?php
// echo $_POST['showClosing'];
$ReportOptions = array(
'showZeroBalances' => false,
'showOB' => false,
'showClosing' => true,
'showPeriod' => false,
);
// die;
?>
<div class="col-6 p-0">
<div class="table-responsive">
<table class="table ">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
<th class="group-total text-center col-1">Amount</th>
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
$incomes_totalOpeningCr = 0;
@ -214,36 +236,53 @@ $BIBAccounts = new BIBAccounts();
$incomes_totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name"><b><?php //echo $group->acgroup_name;
?></b></td>
<td class="group-total text-right"><?php //echo myCurrency(($group->posting_side == "CR") ? $group->closing_balance : 0);
?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0" width="85%">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<tr>
<td colspan="2" class="p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</div>
</td>
</tr>
<?php
// Update column totals
$incomes_totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$incomes_totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
$incomes_totalThisYearDr += ($group->posting_side == "DR") ? $group->regular_balance : 0;
$incomes_totalThisYearCr += ($group->posting_side == "CR") ? $group->regular_balance : 0;
$incomes_totalClosingDr += ($group->posting_side == "DR") ? $group->closing_balance : 0;
$incomes_totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</table>
</td>
<td colspan="2" class="p-0">
</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<th class="pl-1">Total Loss</th>
<th class="text-right pr-1"></th>
</tr>
<tr>
<th class="p-1">Total Incomes</th>
<th class="cr closing-cr">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($incomes_totalClosingCr); ?>
<?php else : ?>
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-6 p-0">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
<th class="group-total text-center col-1">Amount</th>
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<?php
<?php
// Initialize variables for column totals
$totalOpeningDr = 0;
$totalOpeningCr = 0;
@ -253,22 +292,16 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr = 0;
?>
<?php foreach ($AccountGroups as $group) : ?>
<tr class="group-heading" data-toggle="collapse" data-target="#group_<?php echo $group->acgroup_id; ?>">
<td class="group-name" width="85%"> <?php //echo $group->acgroup_name;
?></td>
<td class="group-total" width="15%"><?php //echo myCurrency(($group->posting_side == "DR") ? $group->closing_balance : 0);
?></td>
</tr>
<tr>
<td colspan="7" class="group-details p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<tr>
<td colspan="2" class="p-0">
<div id="group_<?php echo $group->acgroup_id; ?>" class="">
<i> <?php $Accountcategories = $BIBAccounts->getRootCategoriesWithBalances($group->acgroup_id); ?>
<?php $BIBAccounts->renderAccountCategoriesTable($Accountcategories, $ReportOptions, false, array()); ?>
</i>
</div>
</td>
</tr>
<?php
</td>
</tr>
<?php
// Update column totals
$totalOpeningDr += ($group->posting_side == "DR") ? $group->opening_balance : 0;
$totalOpeningCr += ($group->posting_side == "CR") ? $group->opening_balance : 0;
@ -278,70 +311,37 @@ $BIBAccounts = new BIBAccounts();
$totalClosingCr += ($group->posting_side == "CR") ? $group->closing_balance : 0;
?>
<?php endforeach; ?>
</table>
</td>
</tr>
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
<?php $PL = $incomes_totalClosingCr - $totalClosingDr; ?>
<?php if ($incomes_totalClosingCr > $totalClosingDr) : ?>
<tr>
<td colspan="2" width="15%">
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Profit</th>
<th class="cr closing-cr text-right"><?php echo myCurrency($PL); ?></th>
</tr>
</table>
</td>
</tr>
<?php else : ?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Loss</th>
<th class="cr closing-cr"><?php echo myCurrency(abs($PL)); ?></th>
</tr>
</table>
</td>
<td colspan="2">
</td>
<th></th>
<th></th>
<th class="pl-1">Total Profit</th>
<th class="cr closing-cr text-right"><?php echo myCurrency($PL); ?></th>
</tr>
<?php endif; ?>
<tr>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Incomes</th>
<th class="cr closing-cr">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($incomes_totalClosingCr); ?>
<?php else : ?>
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</th>
</tr>
</table>
</td>
<td colspan="2" class="p-0">
<table class="table table-bordered">
<tr>
<th>Total Expenses</th>
</tbody>
<tfoot>
<th class="pl-1">Total Expenses</th>
<th class="dr closing-dr">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
<?php echo myCurrency($totalClosingDr + abs($PL)); ?>
<?php else : ?>
<?php echo myCurrency($totalClosingDr); ?>
<?php endif; ?>
</th>
</tr>
</table>
</td>
</tr>
</table>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>