fees.php
3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
require_once(__DIR__ . "/support.php");
require_once(__DIR__ . "/../ecommerce-adapters/AffinityEcommerceOrder.php");
require_once(__DIR__ . "/../model/AffinityProduct.php");
require_once(__DIR__ . "/../model/AffinityOrder.php");
require_once(__DIR__ . "/../service/AffinityBackendService.php");
$arrFees = AffinityBackendService::getSellerCosts();
if(!is_array($arrFees) || !is_array($arrFees['data']['AccountEntry'])) {
echo "No Entries Found";
exit();
}
?>
<div class="ebayaffinity-header">
<span>eBay Fees</span>
<em><?php print count($arrFees['data']['AccountEntry']) ?> entries</em>
</div>
<div class="ebayaffinity-inv-block">
<table class="ebayaffinity-inv-table">
<tbody><tr>
<th>Date</th>
<th class="ebayaffinity-not-mobile">Description</th>
<th class="ebayaffinity-not-mobile">Gross Amount</th>
<th class="ebayaffinity-not-mobile">Net Amount</th>
<th class="ebayaffinity-not-mobile">Related to</th>
</tr>
<?php
$arrFees['data']['AccountEntry'] = array_reverse($arrFees['data']['AccountEntry']);
foreach($arrFees['data']['AccountEntry'] as $arrAccountEntry):
?>
<tr>
<td>
<?php
print date("d/M/Y", $arrAccountEntry['Date'] / 1000);
?>
</td>
<td>
<?php
print $arrAccountEntry['Description'];
?>
</td>
<td>
<?php
echo $arrAccountEntry['GrossDetailAmount']['currencyID'] . " " . number_format((float) $arrAccountEntry['GrossDetailAmount']['value'], 2, '.', ',');
?>
</td>
<td>
<?php
echo $arrAccountEntry['NetDetailAmount']['currencyID'] . " " . number_format((float) $arrAccountEntry['NetDetailAmount']['value'], 2, '.', ',');
?>
</td>
<td>
<?php
$strLinkHtml = "";
if(!empty($arrAccountEntry['ItemID'])) {
$productId = AffinityProduct::getProductIdAssociatedToListing($arrAccountEntry['ItemID']);
if(!empty($productId)) {
$productUrl = admin_url() . "/admin.php?page=ebay-sync-inventory&id=$productId";
$strLinkHtml = "Generated by <a href='$productUrl' target='_blank'>Product $productId</a> ";
}
if(!empty($arrAccountEntry['TransactionID'])) {
$orderId = AffinityOrder::getOrderIdAssociatedWithItemAndTransactionID($arrAccountEntry['ItemID'], $arrAccountEntry['TransactionID']);
if(!empty($orderId)) {
$orderUrl = AffinityEcommerceOrder::getEditOrderLink($orderId);
$strLinkHtml .= "- <a href='$orderUrl' target='_blank'>Order $orderId</a>";
}
}
}
echo $strLinkHtml;
?>
</td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</div>
<?php
exit();
?>
<div class="ebayaffinity-fees">
<table>
<thead>
<tr>
<th class="feeDate">Date</th>
<th class="feeDescription">Description</th>
<th class="feeGrossAmount">Gross Amount</th>
<th class="feeNetAmount">Net Amount</th>
<th class="feeRelatedTo">Related To</th>
</tr>
</thead>
<tbody>
<?php
foreach($arrFees['data']['AccountEntry'] as $arrAccountEntry):
?>
<tr>
<td>
<?php
print date("d/M/Y", $arrAccountEntry['Date'] / 1000);
?>
</td>
<td>
<?php
print $arrAccountEntry['Description'];
?>
</td>
<td>
<?php
echo $arrAccountEntry['GrossDetailAmount']['value'] . " " . $arrAccountEntry['GrossDetailAmount']['currencyID'];
?>
</td>
<td>
<?php
echo $arrAccountEntry['NetDetailAmount']['value'] . " " . $arrAccountEntry['NetDetailAmount']['currencyID'];
?>
</td>
<td>
<?php
$productId = AffinityProduct::getProductIdAssociatedToListing($arrAccountEntry['ItemID']);
$productUrl = admin_url() . "/admin.php?page=ebay-sync-inventory&id=$productId";
if(!empty($productId)) {
echo "Related to <a href='$productUrl'>Product ID $productId</a>";
}
?>
</td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</div>