correction of error for purchase and sales

This commit is contained in:
Roshan 2024-10-04 16:31:02 +05:45
parent ec6bfaf7ff
commit e3c8a3b5fe
5 changed files with 25 additions and 23 deletions

View File

@ -12,14 +12,17 @@ class Reports extends CI_Controller
}
public function _remap($alias = "", $params = array())
{
$data['dataValue'] = $this->session;
// dd($this->session);
$data['dataValue'] = $this->session;
$data['pageTitle'] = "Sales";
$datas['fiscalStart'] =NepaliDate($this->session->FiscalYear->fiscalyear_from);
$datas['fiscalEnd'] =NepaliDate($this->session->FiscalYear->fiscalyear_to);
switch ($alias) {
case 'purchase_vs_sales':
$data['StockRecords']=$this->MStocks->getStockRecords();
$data['PurchaseDetails'] = $this->MPurchases->getItemPurchases();
$data['SalesDetails'] = $this->MSales->getItemSales();
$data['StockItems'] = $this->MStocks->getStockSummary();
$data['StockItems'] = $this->MStocks->getStockSummary($datas);
loadview("inventory/reports/purchase_vs_sales", $data);
break;
default:

View File

@ -577,7 +577,7 @@ class bibaccounts
//////
function renderAccountCategoriesTable($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = [])
{
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?>
<table class="table table-sm">
<?php if ($displayHeadings) { ?>
@ -659,7 +659,7 @@ class bibaccounts
}
function renderAccountCategoriesTableForBS($accountCategories, $ReportOptions, $displayHeadings = true, $parentCategories = [])
{
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?>
<table class="table table-hover table-sm">
@ -667,7 +667,7 @@ class bibaccounts
<?php foreach ($accountCategories as $accountCategory) : ?>
<?php if ($ReportOptions['showZeroBalances']==false && $accountCategory->isZero == true) continue; ?>
<?php if ($ReportOptions['showZeroBalances'] == false && $accountCategory->isZero == true) continue; ?>
<tr class="<?php echo ($accountCategory->isParent) ? 'bg-darker parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
<td class="group-name"><?php echo $accountCategory->accategory_name; ?></td>
<?php if ($ReportOptions['showOB']) : ?>
@ -725,7 +725,7 @@ class bibaccounts
function renderAccountsTable($Accounts, $ReportOptions, $displayHeadings = false)
{
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?>
<table class="table table-hover table-gray">
<?php if ($displayHeadings) { ?>
@ -773,7 +773,7 @@ class bibaccounts
}
function renderAccountsTableForBS($Accounts, $ReportOptions, $displayHeadings = false)
{
if(!isset($ReportOptions['AmountColWidth']))$ReportOptions['AmountColWidth']=180;
if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?>
<table class="table table-hover table-gray">
@ -801,8 +801,4 @@ class bibaccounts
<?php
}
//////
}

View File

@ -153,7 +153,6 @@ class MStocks extends CI_Model
}
public function getStockSummary($data)
{
$stocklocation_id = $data['stocklocation_id'] ?? null;
$this->db->where("status", 1);
if ($stocklocation_id != 0) {

View File

@ -250,10 +250,10 @@ $BIBAccounts = new BIBAccounts();
<?php foreach ($AccountGroups as $group) : ?>
<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> -->
<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>
@ -272,6 +272,7 @@ $BIBAccounts = new BIBAccounts();
</tbody>
<tfoot>
<?php $PL = $incomes_totalClosingCr - $incomes_totalClosingDr; ?>
<tr>
@ -283,7 +284,7 @@ $BIBAccounts = new BIBAccounts();
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</tr>
</tfoot>
</table>
@ -312,11 +313,11 @@ $BIBAccounts = new BIBAccounts();
<?php foreach ($AccountGroups as $group) : ?>
<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> -->
<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

View File

@ -45,7 +45,9 @@
<?php $PTotal = 0;
$a = 0;
foreach ($PurchaseDetails as $Purchase) : $a++; ?>
<?php// var_dump($Purchase->Item->title);die(); ?>
<tr>
<td><?php echo $a; ?></td>
<td><?php echo $Purchase->Item->title; ?></td>
<td class="text-right"><?php echo $Purchase->total_qty; ?></td>
@ -185,7 +187,8 @@
foreach ($StockItems as $Stock) : $a++; ?>
<tr>
<td class="text-center"><?php echo $a; ?></td>
<td><?php echo $Stock->Item->title; ?></td>
<?php //echo "<pre>";print_r($Stock->Summary->Item->title); die() ;?>
<td><?php echo $Stock->Summary->Item->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 myCurrency($orate = $Stock->Summary->Opening->rate); ?></td>