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
1c230fd3
Commit
1c230fd3
authored
May 10, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dfhgkftgjuyl
parent
89449302
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
5 deletions
+165
-5
FinancialReportService.php
app/Modules/Accounting/Services/FinancialReportService.php
+3
-3
LedgerService.php
app/Modules/Accounting/Services/LedgerService.php
+21
-2
trial_balance_2026-01-01_to_2026-05-10.csv
trial_balance_2026-01-01_to_2026-05-10.csv
+141
-0
No files found.
app/Modules/Accounting/Services/FinancialReportService.php
View file @
1c230fd3
...
@@ -46,7 +46,7 @@ final class FinancialReportService
...
@@ -46,7 +46,7 @@ final class FinancialReportService
WHERE status = 'posted' AND entry_date >= ? AND entry_date <= ? AND is_archived = 0
WHERE status = 'posted' AND entry_date >= ? AND entry_date <= ? AND is_archived = 0
)
)
{
$extraWhere
}
{
$extraWhere
}
WHERE coa.account_type = 'revenue' AND coa.is_archived = 0
AND coa.is_header = 0
WHERE coa.account_type = 'revenue' AND coa.is_archived = 0
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en
HAVING balance != 0
HAVING balance != 0
ORDER BY coa.account_code ASC"
,
ORDER BY coa.account_code ASC"
,
...
@@ -64,7 +64,7 @@ final class FinancialReportService
...
@@ -64,7 +64,7 @@ final class FinancialReportService
WHERE status = 'posted' AND entry_date >= ? AND entry_date <= ? AND is_archived = 0
WHERE status = 'posted' AND entry_date >= ? AND entry_date <= ? AND is_archived = 0
)
)
{
$extraWhere
}
{
$extraWhere
}
WHERE coa.account_type = 'expense' AND coa.is_archived = 0
AND coa.is_header = 0
WHERE coa.account_type = 'expense' AND coa.is_archived = 0
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en
HAVING balance != 0
HAVING balance != 0
ORDER BY coa.account_code ASC"
,
ORDER BY coa.account_code ASC"
,
...
@@ -130,7 +130,7 @@ final class FinancialReportService
...
@@ -130,7 +130,7 @@ final class FinancialReportService
WHERE status = 'posted' AND entry_date <= ? AND is_archived = 0
WHERE status = 'posted' AND entry_date <= ? AND is_archived = 0
)
)
{
$extraWhere
}
{
$extraWhere
}
WHERE coa.is_archived = 0
AND coa.is_header = 0
WHERE coa.is_archived = 0
AND coa.account_type IN ('asset','liability','equity')
AND coa.account_type IN ('asset','liability','equity')
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en,
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en,
coa.account_type, coa.account_nature, coa.opening_balance
coa.account_type, coa.account_nature, coa.opening_balance
...
...
app/Modules/Accounting/Services/LedgerService.php
View file @
1c230fd3
...
@@ -149,7 +149,7 @@ final class LedgerService
...
@@ -149,7 +149,7 @@ final class LedgerService
WHERE status = 'posted' AND entry_date >= ? AND entry_date <= ? AND is_archived = 0
WHERE status = 'posted' AND entry_date >= ? AND entry_date <= ? AND is_archived = 0
)
)
{
$extraWhere
}
{
$extraWhere
}
WHERE coa.is_archived = 0
AND coa.is_header = 0
WHERE coa.is_archived = 0
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en,
GROUP BY coa.id, coa.account_code, coa.name_ar, coa.name_en,
coa.account_type, coa.account_nature, coa.level, coa.is_header,
coa.account_type, coa.account_nature, coa.level, coa.is_header,
coa.opening_balance, coa.current_balance
coa.opening_balance, coa.current_balance
...
@@ -192,9 +192,28 @@ final class LedgerService
...
@@ -192,9 +192,28 @@ final class LedgerService
$balance
=
bcadd
(
$opening
,
bcsub
(
$creditMovement
,
$debitMovement
,
2
),
2
);
$balance
=
bcadd
(
$opening
,
bcsub
(
$creditMovement
,
$debitMovement
,
2
),
2
);
}
}
// If no journal movements, use current_balance from DB
// If no journal movements, use current_balance from DB
and restore opening from stored value
if
(
bccomp
(
$debitMovement
,
'0.00'
,
2
)
===
0
&&
bccomp
(
$creditMovement
,
'0.00'
,
2
)
===
0
)
{
if
(
bccomp
(
$debitMovement
,
'0.00'
,
2
)
===
0
&&
bccomp
(
$creditMovement
,
'0.00'
,
2
)
===
0
)
{
$balance
=
(
string
)
$acc
[
'current_balance'
];
$balance
=
(
string
)
$acc
[
'current_balance'
];
$opening
=
(
string
)
$acc
[
'opening_balance'
];
if
(
bccomp
(
$opening
,
'0.00'
,
2
)
>=
0
)
{
$acc
[
'opening_debit'
]
=
$opening
;
$acc
[
'opening_credit'
]
=
'0.00'
;
}
else
{
$acc
[
'opening_debit'
]
=
'0.00'
;
$acc
[
'opening_credit'
]
=
bcmul
(
$opening
,
'-1'
,
2
);
}
// Derive period movement as difference between closing and opening
$closingNet
=
(
string
)
$acc
[
'current_balance'
];
$periodNet
=
bcsub
(
$closingNet
,
$opening
,
2
);
if
(
bccomp
(
$periodNet
,
'0.00'
,
2
)
>=
0
)
{
$acc
[
'period_debit'
]
=
$periodNet
;
$acc
[
'period_credit'
]
=
'0.00'
;
}
else
{
$acc
[
'period_debit'
]
=
'0.00'
;
$acc
[
'period_credit'
]
=
bcmul
(
$periodNet
,
'-1'
,
2
);
}
}
}
// Closing debit/credit split
// Closing debit/credit split
...
...
trial_balance_2026-01-01_to_2026-05-10.csv
0 → 100644
View file @
1c230fd3
This diff is collapsed.
Click to expand it.
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