Commit 8b2afbf2 authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fixes Accounting

parent c0419dbd
...@@ -21,7 +21,7 @@ class CostCenterController extends Controller ...@@ -21,7 +21,7 @@ class CostCenterController extends Controller
// Fetch branch names // Fetch branch names
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar FROM branches WHERE is_active = 1 ORDER BY name_ar");
return $this->view('Accounting/Views/cost_centers/index', [ return $this->view('Accounting/Views/cost_centers/index', [
'centers' => $centers, 'centers' => $centers,
...@@ -34,7 +34,7 @@ class CostCenterController extends Controller ...@@ -34,7 +34,7 @@ class CostCenterController extends Controller
$this->authorize('accounting.cost_center.manage'); $this->authorize('accounting.cost_center.manage');
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar, name_en FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar, name_en FROM branches WHERE is_active = 1 ORDER BY name_ar");
$parents = CostCenter::query() $parents = CostCenter::query()
->where('is_archived', '=', 0) ->where('is_archived', '=', 0)
...@@ -87,7 +87,7 @@ class CostCenterController extends Controller ...@@ -87,7 +87,7 @@ class CostCenterController extends Controller
$center = CostCenter::findOrFail($id); $center = CostCenter::findOrFail($id);
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar, name_en FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar, name_en FROM branches WHERE is_active = 1 ORDER BY name_ar");
$parents = CostCenter::query() $parents = CostCenter::query()
->where('is_archived', '=', 0) ->where('is_archived', '=', 0)
......
...@@ -55,7 +55,7 @@ class JournalEntryController extends Controller ...@@ -55,7 +55,7 @@ class JournalEntryController extends Controller
$currentFY = FiscalYear::current(); $currentFY = FiscalYear::current();
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar FROM branches WHERE is_active = 1 ORDER BY name_ar");
return $this->view('Accounting/Views/journal_entries/create', [ return $this->view('Accounting/Views/journal_entries/create', [
'accounts' => $accounts, 'accounts' => $accounts,
......
...@@ -63,7 +63,7 @@ class ReportController extends Controller ...@@ -63,7 +63,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive(); $costCenters = CostCenter::getActive();
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar FROM branches WHERE is_active = 1 ORDER BY name_ar");
return $this->view('Accounting/Views/reports/trial_balance', [ return $this->view('Accounting/Views/reports/trial_balance', [
'result' => $result, 'result' => $result,
...@@ -96,7 +96,7 @@ class ReportController extends Controller ...@@ -96,7 +96,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive(); $costCenters = CostCenter::getActive();
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar FROM branches WHERE is_active = 1 ORDER BY name_ar");
return $this->view('Accounting/Views/reports/general_ledger', [ return $this->view('Accounting/Views/reports/general_ledger', [
'ledger' => $ledger, 'ledger' => $ledger,
...@@ -126,7 +126,7 @@ class ReportController extends Controller ...@@ -126,7 +126,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive(); $costCenters = CostCenter::getActive();
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar FROM branches WHERE is_active = 1 ORDER BY name_ar");
return $this->view('Accounting/Views/reports/income_statement', [ return $this->view('Accounting/Views/reports/income_statement', [
'result' => $result, 'result' => $result,
...@@ -153,7 +153,7 @@ class ReportController extends Controller ...@@ -153,7 +153,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive(); $costCenters = CostCenter::getActive();
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar FROM branches WHERE is_archived = 0 ORDER BY name_ar"); $branches = $db->select("SELECT id, name_ar FROM branches WHERE is_active = 1 ORDER BY name_ar");
return $this->view('Accounting/Views/reports/balance_sheet', [ return $this->view('Accounting/Views/reports/balance_sheet', [
'result' => $result, 'result' => $result,
......
...@@ -30,7 +30,7 @@ class AccountPayable extends Model ...@@ -30,7 +30,7 @@ class AccountPayable extends Model
} }
return $db->select( return $db->select(
"SELECT ap.*, s.name as supplier_name "SELECT ap.*, s.name_ar as supplier_name
FROM accounts_payable ap FROM accounts_payable ap
LEFT JOIN suppliers s ON s.id = ap.supplier_id LEFT JOIN suppliers s ON s.id = ap.supplier_id
WHERE {$where} WHERE {$where}
......
...@@ -211,7 +211,7 @@ final class FinancialReportService ...@@ -211,7 +211,7 @@ final class FinancialReportService
public static function getConsolidatedBalanceSheet(string $asOfDate): array public static function getConsolidatedBalanceSheet(string $asOfDate): array
{ {
$db = App::getInstance()->db(); $db = App::getInstance()->db();
$branches = $db->select("SELECT id, name_ar, name_en FROM branches WHERE is_archived = 0 ORDER BY id"); $branches = $db->select("SELECT id, name_ar, name_en FROM branches WHERE is_active = 1 ORDER BY id");
$branchSheets = []; $branchSheets = [];
foreach ($branches as $branch) { foreach ($branches as $branch) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment