Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
shared
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Heddi Heryadi
shared
Commits
40ecc67e
Commit
40ecc67e
authored
Dec 09, 2019
by
Heddi Heryadi
💪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whmcs report
parent
25001dc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
index.php
index.php
+93
-0
No files found.
index.php
0 → 100644
View file @
40ecc67e
<?php
mysql_connect
(
"localhost"
,
"root"
,
""
)
or
die
(
"Could not connect: "
.
mysql_error
());
mysql_select_db
(
"devmanage_whmcs"
);
?>
<?php
$date
=
isset
(
$_GET
[
"date"
])
?
$_GET
[
"date"
]
:
"2019-09-06"
;
// date("Y-m-d");
$result
=
mysql_query
(
"SELECT i.*, it.*,
SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '-', 2), '-', 1) kategori,
IF(LENGTH(SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '.', -1), ' ', 1)) < 4,
CONCAT(REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '.', 1), ' ', -1), '(', ''), '.',
IF(LENGTH(SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '.', -1), ' ', 1)) >= 3 || LENGTH(SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '.', -2), '.', 1)) > 3,
SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '.', -1), ' ', 1), SUBSTRING_INDEX(SUBSTRING_INDEX(it.description, '.', -2), ' ', 1))), '') domain
FROM devmanage_whmcs.tblinvoices i
LEFT JOIN tblinvoiceitems it ON it.invoiceid = i.id
WHERE i.status = 'PAID' AND DATE(i.datepaid) = '"
.
$date
.
"'
ORDER BY i.datepaid DESC"
);
$datas
=
array
();
$categories
=
array
();
while
(
$d
=
mysql_fetch_array
(
$result
))
{
$datas
[]
=
$d
;
if
(
!
isset
(
$categories
[
$d
[
'kategori'
]][
$d
[
'paymentmethod'
]]))
$categories
[
$d
[
'kategori'
]][
$d
[
'paymentmethod'
]]
=
0
;
$categories
[
$d
[
'kategori'
]][
$d
[
'paymentmethod'
]]
=
$categories
[
$d
[
'kategori'
]][
$d
[
'paymentmethod'
]]
+
$d
[
'total'
];
}
$qMethod
=
mysql_query
(
"SELECT paymentmethod FROM tblinvoiceitems group by paymentmethod"
);
$method
=
array
();
while
(
$d2
=
mysql_fetch_array
(
$qMethod
))
{
if
(
$d2
[
'paymentmethod'
])
$method
[]
=
$d2
[
'paymentmethod'
];
}
// print_r($method);
$no
=
1
;
?>
<form
method=
"get"
>
<input
name=
"date"
value=
"
<?=
$date
?>
"
/>
<input
type=
"submit"
value=
"show"
>
</form>
<table
border=
"1"
>
<tr>
<th>
No
</th>
<th>
Method
</th>
<th>
Amount
</th>
<th>
Category
</th>
<th>
Sub Category 1
</th>
<th>
Sub Category 2
</th>
<th>
IN
</th>
<th>
OUT
</th>
<th>
PPN
</th>
<th>
Harga Modal
</th>
</tr>
<?php
foreach
(
$datas
as
$d
)
{
// print_r($row); ?>
<
tr
>
<
td
><?=
$no
?>
</td>
<td>
<?=
$d
[
"paymentmethod"
]
?>
</td>
<td>
<?=
$d
[
"total"
]
?>
</td>
<td>
<?=
$d
[
"kategori"
]
?>
</td>
<td>
<?=
$d
[
"domain"
]
?>
</td>
<td></td>
<td>
<?=
$d
[
"amount"
]
?>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<?php
$no
++
;
}
?>
</table>
<hr/>
<?php
$no
=
1
;
?>
<table
border=
"1"
>
<tr>
<th>
No
</th>
<th>
Category
</th>
<?php
foreach
(
$method
as
$m
)
{
?>
<th>
<?=
$m
?>
</th>
<?php
}
?>
</tr>
<?php
foreach
(
$categories
as
$k
=>
$d
)
{
?>
<tr>
<td>
<?=
$no
?>
</td>
<td>
<?=
$k
?>
</td>
<?php
foreach
(
$method
as
$m
)
{
?>
<td>
<?=
isset
(
$d
[
$m
])
?
$d
[
$m
]
:
0
?>
</td>
<?php
}
?>
</tr>
<?php
$no
++
;
}
?>
</table>
\ No newline at end of file
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