Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Clubphp
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Clubphp
Commits
89449302
Commit
89449302
authored
May 10, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
csv export
parent
e9995b96
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
0 deletions
+52
-0
ReportController.php
app/Modules/Accounting/Controllers/ReportController.php
+50
-0
Routes.php
app/Modules/Accounting/Routes.php
+1
-0
balance_sheet.php
app/Modules/Accounting/Views/reports/balance_sheet.php
+1
-0
No files found.
app/Modules/Accounting/Controllers/ReportController.php
View file @
89449302
...
@@ -369,6 +369,56 @@ class ReportController extends Controller
...
@@ -369,6 +369,56 @@ class ReportController extends Controller
]);
]);
}
}
public
function
balanceSheetExportCsv
()
:
Response
{
$this
->
authorize
(
'accounting.reports.balance_sheet'
);
$asOfDate
=
$_GET
[
'as_of_date'
]
??
date
(
'Y-m-d'
);
$costCenterId
=
!
empty
(
$_GET
[
'cost_center_id'
])
?
(
int
)
$_GET
[
'cost_center_id'
]
:
null
;
$branchId
=
!
empty
(
$_GET
[
'branch_id'
])
?
(
int
)
$_GET
[
'branch_id'
]
:
null
;
$result
=
FinancialReportService
::
getBalanceSheet
(
$asOfDate
,
$costCenterId
,
$branchId
);
$filename
=
'balance_sheet_'
.
$asOfDate
.
'.csv'
;
header
(
'Content-Type: text/csv; charset=UTF-8'
);
header
(
'Content-Disposition: attachment; filename="'
.
$filename
.
'"'
);
$output
=
fopen
(
'php://output'
,
'w'
);
fwrite
(
$output
,
"
\xEF\xBB\xBF
"
);
fputcsv
(
$output
,
[
'الميزانية العمومية حتى تاريخ '
.
$asOfDate
]);
fputcsv
(
$output
,
[]);
fputcsv
(
$output
,
[
'كود الحساب'
,
'اسم الحساب'
,
'الرصيد'
]);
fputcsv
(
$output
,
[
'--- الأصول ---'
,
''
,
''
]);
foreach
(
$result
[
'assets'
]
as
$acc
)
{
fputcsv
(
$output
,
[
$acc
[
'account_code'
],
$acc
[
'name_ar'
],
$acc
[
'balance'
]]);
}
fputcsv
(
$output
,
[
''
,
'إجمالي الأصول'
,
$result
[
'total_assets'
]]);
fputcsv
(
$output
,
[]);
fputcsv
(
$output
,
[
'--- الخصوم ---'
,
''
,
''
]);
foreach
(
$result
[
'liabilities'
]
as
$acc
)
{
fputcsv
(
$output
,
[
$acc
[
'account_code'
],
$acc
[
'name_ar'
],
$acc
[
'balance'
]]);
}
fputcsv
(
$output
,
[
''
,
'إجمالي الخصوم'
,
$result
[
'total_liabilities'
]]);
fputcsv
(
$output
,
[]);
fputcsv
(
$output
,
[
'--- حقوق الملكية ---'
,
''
,
''
]);
foreach
(
$result
[
'equity'
]
as
$acc
)
{
fputcsv
(
$output
,
[
$acc
[
'account_code'
],
$acc
[
'name_ar'
],
$acc
[
'balance'
]]);
}
fputcsv
(
$output
,
[
''
,
'إجمالي حقوق الملكية'
,
$result
[
'total_equity'
]]);
fputcsv
(
$output
,
[]);
fputcsv
(
$output
,
[
''
,
'إجمالي الخصوم + حقوق الملكية'
,
$result
[
'total_liabilities_and_equity'
]]);
fputcsv
(
$output
,
[
''
,
'متوازنة؟'
,
$result
[
'is_balanced'
]
?
'نعم'
:
'لا'
]);
fclose
(
$output
);
exit
;
}
public
function
consolidatedBalanceSheet
()
:
Response
public
function
consolidatedBalanceSheet
()
:
Response
{
{
$this
->
authorize
(
'accounting.reports.consolidated'
);
$this
->
authorize
(
'accounting.reports.consolidated'
);
...
...
app/Modules/Accounting/Routes.php
View file @
89449302
...
@@ -65,6 +65,7 @@ return [
...
@@ -65,6 +65,7 @@ return [
[
'GET'
,
'/accounting/reports/general-ledger'
,
'Accounting\Controllers\ReportController@generalLedger'
,
[
'auth'
],
'accounting.reports.general_ledger'
],
[
'GET'
,
'/accounting/reports/general-ledger'
,
'Accounting\Controllers\ReportController@generalLedger'
,
[
'auth'
],
'accounting.reports.general_ledger'
],
[
'GET'
,
'/accounting/reports/income-statement'
,
'Accounting\Controllers\ReportController@incomeStatement'
,
[
'auth'
],
'accounting.reports.income_statement'
],
[
'GET'
,
'/accounting/reports/income-statement'
,
'Accounting\Controllers\ReportController@incomeStatement'
,
[
'auth'
],
'accounting.reports.income_statement'
],
[
'GET'
,
'/accounting/reports/balance-sheet'
,
'Accounting\Controllers\ReportController@balanceSheet'
,
[
'auth'
],
'accounting.reports.balance_sheet'
],
[
'GET'
,
'/accounting/reports/balance-sheet'
,
'Accounting\Controllers\ReportController@balanceSheet'
,
[
'auth'
],
'accounting.reports.balance_sheet'
],
[
'GET'
,
'/accounting/reports/balance-sheet/export-csv'
,
'Accounting\Controllers\ReportController@balanceSheetExportCsv'
,
[
'auth'
],
'accounting.reports.balance_sheet'
],
[
'GET'
,
'/accounting/reports/consolidated-balance-sheet'
,
'Accounting\Controllers\ReportController@consolidatedBalanceSheet'
,
[
'auth'
],
'accounting.reports.consolidated'
],
[
'GET'
,
'/accounting/reports/consolidated-balance-sheet'
,
'Accounting\Controllers\ReportController@consolidatedBalanceSheet'
,
[
'auth'
],
'accounting.reports.consolidated'
],
[
'GET'
,
'/accounting/reports/accounts-receivable'
,
'Accounting\Controllers\ReportController@accountsReceivable'
,
[
'auth'
],
'accounting.reports.ar'
],
[
'GET'
,
'/accounting/reports/accounts-receivable'
,
'Accounting\Controllers\ReportController@accountsReceivable'
,
[
'auth'
],
'accounting.reports.ar'
],
[
'GET'
,
'/accounting/reports/accounts-payable'
,
'Accounting\Controllers\ReportController@accountsPayable'
,
[
'auth'
],
'accounting.reports.ap'
],
[
'GET'
,
'/accounting/reports/accounts-payable'
,
'Accounting\Controllers\ReportController@accountsPayable'
,
[
'auth'
],
'accounting.reports.ap'
],
...
...
app/Modules/Accounting/Views/reports/balance_sheet.php
View file @
89449302
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
</select>
</select>
</div>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
عرض
</button>
<button
type=
"submit"
class=
"btn btn-primary"
>
عرض
</button>
<a
href=
"/accounting/reports/balance-sheet/export-csv?as_of_date=
<?=
e
(
$as_of_date
)
?>
&branch_id=
<?=
(
int
)(
$filters
[
'branch_id'
]
??
0
)
?>
&cost_center_id=
<?=
(
int
)(
$filters
[
'cost_center_id'
]
??
0
)
?>
"
class=
"btn btn-secondary"
style=
"margin-right:5px;"
>
تصدير CSV
</a>
</form>
</form>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment