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

Fixes Accounting

parent c0419dbd
......@@ -21,7 +21,7 @@ class CostCenterController extends Controller
// Fetch branch names
$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', [
'centers' => $centers,
......@@ -34,7 +34,7 @@ class CostCenterController extends Controller
$this->authorize('accounting.cost_center.manage');
$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()
->where('is_archived', '=', 0)
......@@ -87,7 +87,7 @@ class CostCenterController extends Controller
$center = CostCenter::findOrFail($id);
$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()
->where('is_archived', '=', 0)
......
......@@ -55,7 +55,7 @@ class JournalEntryController extends Controller
$currentFY = FiscalYear::current();
$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', [
'accounts' => $accounts,
......
......@@ -63,7 +63,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive();
$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', [
'result' => $result,
......@@ -96,7 +96,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive();
$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', [
'ledger' => $ledger,
......@@ -126,7 +126,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive();
$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', [
'result' => $result,
......@@ -153,7 +153,7 @@ class ReportController extends Controller
$costCenters = CostCenter::getActive();
$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', [
'result' => $result,
......
......@@ -30,7 +30,7 @@ class AccountPayable extends Model
}
return $db->select(
"SELECT ap.*, s.name as supplier_name
"SELECT ap.*, s.name_ar as supplier_name
FROM accounts_payable ap
LEFT JOIN suppliers s ON s.id = ap.supplier_id
WHERE {$where}
......
......@@ -211,7 +211,7 @@ final class FinancialReportService
public static function getConsolidatedBalanceSheet(string $asOfDate): array
{
$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 = [];
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