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
e23d5df3
Commit
e23d5df3
authored
Apr 18, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ho
parent
d0a7d335
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
GLSyncService.php
app/Modules/Accounting/Services/GLSyncService.php
+10
-10
Phase_36_002_seed_fiscal_year.php
database/seeds/Phase_36_002_seed_fiscal_year.php
+4
-4
No files found.
app/Modules/Accounting/Services/GLSyncService.php
View file @
e23d5df3
...
...
@@ -105,10 +105,10 @@ final class GLSyncService
];
$optionalTables
=
[
'fines'
=>
"SELECT MIN(
imposed_date) as min_date, MAX(imposed_date) as max_date FROM fines WHERE is_archived = 0
"
,
'fines'
=>
"SELECT MIN(
created_at) as min_date, MAX(created_at) as max_date FROM fines
"
,
'sales'
=>
"SELECT MIN(sale_date) as min_date, MAX(sale_date) as max_date FROM sales WHERE status = 'completed'"
,
'hr_payroll_runs'
=>
"SELECT MIN(pa
yment_date) as min_date, MAX(payment_date
) as max_date FROM hr_payroll_runs WHERE status = 'paid'"
,
'installment_plans'
=>
"SELECT MIN(created_at) as min_date, MAX(created_at) as max_date FROM installment_plans
WHERE is_archived = 0
"
,
'hr_payroll_runs'
=>
"SELECT MIN(pa
id_at) as min_date, MAX(paid_at
) as max_date FROM hr_payroll_runs WHERE status = 'paid'"
,
'installment_plans'
=>
"SELECT MIN(created_at) as min_date, MAX(created_at) as max_date FROM installment_plans"
,
];
foreach
(
$optionalTables
as
$table
=>
$query
)
{
...
...
@@ -218,15 +218,15 @@ final class GLSyncService
if
(
!
$tableExists
)
return
;
$fines
=
$db
->
select
(
"SELECT f.id, f.member_id, f.amount, f.
imposed_date, f.
status
"SELECT f.id, f.member_id, f.amount, f.status
FROM fines f
WHERE f.penalty_type = 'fine' AND f.amount > 0
AND f.is_archived = 0
WHERE f.penalty_type = 'fine' AND f.amount > 0
AND NOT EXISTS (
SELECT 1 FROM journal_entries je
WHERE je.reference_type = 'fine' AND je.reference_id = f.id
AND je.is_archived = 0 AND je.status != 'reversed'
)
ORDER BY f.
imposed_date
ASC, f.id ASC"
ORDER BY f.
created_at
ASC, f.id ASC"
);
foreach
(
$fines
as
$f
)
{
...
...
@@ -260,7 +260,7 @@ final class GLSyncService
$plans
=
$db
->
select
(
"SELECT ip.id, ip.member_id, ip.total_amount, ip.created_at
FROM installment_plans ip
WHERE ip.
is_archived = 0 AND ip.
total_amount > 0
WHERE ip.total_amount > 0
AND NOT EXISTS (
SELECT 1 FROM journal_entries je
WHERE je.reference_type = 'installment_plan' AND je.reference_id = ip.id
...
...
@@ -341,7 +341,7 @@ final class GLSyncService
if
(
!
$tableExists
)
return
;
$runs
=
$db
->
select
(
"SELECT pr.id, pr.period_id, pr.pa
yment_date
"SELECT pr.id, pr.period_id, pr.pa
id_at
FROM hr_payroll_runs pr
WHERE pr.status = 'paid'
AND NOT EXISTS (
...
...
@@ -349,7 +349,7 @@ final class GLSyncService
WHERE je.reference_type = 'payroll' AND je.reference_id = pr.id
AND je.is_archived = 0 AND je.status != 'reversed'
)
ORDER BY pr.pa
yment_date
ASC, pr.id ASC"
ORDER BY pr.pa
id_at
ASC, pr.id ASC"
);
foreach
(
$runs
as
$run
)
{
...
...
@@ -357,7 +357,7 @@ final class GLSyncService
AccountingIntegrationService
::
onPayrollPaid
([
'payroll_run_id'
=>
(
int
)
$run
[
'id'
],
'period_id'
=>
(
int
)
$run
[
'period_id'
],
'payment_date'
=>
$run
[
'pa
yment_date'
]
??
date
(
'Y-m-d'
),
'payment_date'
=>
$run
[
'pa
id_at'
]
?
substr
(
$run
[
'paid_at'
],
0
,
10
)
:
date
(
'Y-m-d'
),
]);
$result
[
'payroll'
]
++
;
}
catch
(
\Throwable
$e
)
{
...
...
database/seeds/Phase_36_002_seed_fiscal_year.php
View file @
e23d5df3
...
...
@@ -30,10 +30,10 @@ return function (Database $db): void {
// Optional tables — only query if they exist
$optionalTables
=
[
'fines'
=>
"SELECT MIN(
imposed_date) as min_date, MAX(imposed_date) as max_date FROM fines WHERE is_archived = 0
"
,
'fines'
=>
"SELECT MIN(
created_at) as min_date, MAX(created_at) as max_date FROM fines
"
,
'sales'
=>
"SELECT MIN(sale_date) as min_date, MAX(sale_date) as max_date FROM sales WHERE status = 'completed'"
,
'hr_payroll_runs'
=>
"SELECT MIN(pa
yment_date) as min_date, MAX(payment_date
) as max_date FROM hr_payroll_runs WHERE status = 'paid'"
,
'installment_plans'
=>
"SELECT MIN(created_at) as min_date, MAX(created_at) as max_date FROM installment_plans
WHERE is_archived = 0
"
,
'hr_payroll_runs'
=>
"SELECT MIN(pa
id_at) as min_date, MAX(paid_at
) as max_date FROM hr_payroll_runs WHERE status = 'paid'"
,
'installment_plans'
=>
"SELECT MIN(created_at) as min_date, MAX(created_at) as max_date FROM installment_plans"
,
];
foreach
(
$optionalTables
as
$table
=>
$query
)
{
...
...
@@ -70,7 +70,7 @@ return function (Database $db): void {
echo
" Fiscal year range needed:
{
$minYear
}
—
{
$maxYear
}
\n
"
;
// Clear stale is_current flags
$db
->
execute
(
"UPDATE fiscal_years SET is_current = 0 WHERE is_current = 1"
);
$db
->
query
(
"UPDATE fiscal_years SET is_current = 0 WHERE is_current = 1"
);
$created
=
0
;
for
(
$year
=
$minYear
;
$year
<=
$maxYear
;
$year
++
)
{
...
...
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