4 include_once
'./Services/Payment/classes/class.ilShopBaseGUI.php';
5 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
6 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
35 if(ANONYMOUS_USER_ID == $ilUser->getId() && !isset(
$_SESSION[
'download_links']));
40 $cmd = $this->ctrl->getCmd();
41 switch ($this->ctrl->getNextClass($this))
43 case 'showBillHistory':
49 if(!
$cmd = $this->ctrl->getCmd())
61 global $ilTabs, $ilUser, $rbacreview;
63 $ilTabs->addSubTabTarget(
'paya_buyed_objects', $this->ctrl->getLinkTarget($this,
'showItems'),
'',
'',
'',
'showItems');
64 $ilTabs->addSubTabTarget(
'paya_bill_history', $this->ctrl->getLinkTarget($this,
'showBillHistory'),
'',
'',
'',
'showBillHistory');
71 include_once
"./Services/Repository/classes/class.ilRepositoryExplorer.php";
73 $ilTabs->setSubTabActive(
'paya_bill_history');
76 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
78 $bookings = $this->bookings_obj->getDistinctTransactions($this->user_obj->getId());
88 foreach($bookings as $booking)
91 $f_result[$counter][
'transaction'] =
"<a href=\"".$this->ctrl->getLinkTarget($this,
"createBill").
"&transaction=".$booking[
'transaction'].
"\">".$booking[
'transaction'].
".pdf</a>";
102 $this->ctrl->setParameter($this,
'cmd',
'showBillHistory');
104 $tbl->setId(
'tbl_bill_history');
105 $tbl->setTitle($this->lng->txt(
"paya_bill_history"));
106 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
108 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
109 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
111 $tbl->setData($a_result_set);
113 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
122 $transaction =
$_GET[
'transaction'];
128 include_once
'./classes/class.ilTemplate.php';
129 include_once
'./Services/Utilities/classes/class.ilUtil.php';
130 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
133 $currency = $genSet->get(
'currency_unit');
135 $user_id = $this->user_obj->getId();
138 if($bookings[$i][
'street'] == NULL) $bookings[$i][
'street'] = nl2br(utf8_decode($customer->getStreet()));
139 if($bookings[$i][
'zipcode'] == NULL) $bookings[$i][
'zipcode'] = nl2br(utf8_decode($customer->getZipcode()));
140 if($bookings[$i][
'city'] == NULL) $bookings[$i][
'city'] = nl2br(utf8_decode($customer->getCity()));
141 if($bookings[$i][
'country'] == NULL) $bookings[$i][
'country'] = nl2br(utf8_decode($customer->getCountry()));
144 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill.html',
'Services/Payment');
145 $tpl =
new ilTemplate(
'./Services/Payment/templates/default/tpl.pay_bill.html',
true,
true,
true);
147 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
148 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
149 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
150 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
153 $tpl->setVariable(
'CUSTOMER_FIRSTNAME',$customer->getFirstName());
154 $tpl->setVariable(
'CUSTOMER_LASTNAME', $customer->getLastName());
155 if($bookings[
'po_box']==
'')
157 $tpl->setVariable(
'CUSTOMER_STREET',utf8_decode( $bookings[$i][
'street']));
161 $tpl->setVariable(
'CUSTOMER_STREET', $bookings[$i][
'po_box']);
163 $tpl->setVariable(
'CUSTOMER_ZIPCODE', $bookings[$i][
'zipcode']);
164 $tpl->setVariable(
'CUSTOMER_CITY', $bookings[$i][
'city']);
165 $tpl->setVariable(
'CUSTOMER_COUNTRY', $bookings[$i][
'country']);
167 $tpl->setVariable(
'BILL_NO', $transaction);
170 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
171 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
172 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
174 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
175 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
176 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
177 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
179 for ($i = 0; $i < count($bookings[$i]); $i++)
181 $tmp_pobject =
new ilPaymentObject($this->user_obj, $booking[$i][
'pobject_id']);
183 $obj_id = $ilObjDataCache->lookupObjId($bookings[$i][
'ref_id']);
184 $obj_type = $ilObjDataCache->lookupType($obj_id);
186 $tpl->setCurrentBlock(
'loop');
187 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($obj_type)));
188 $tpl->setVariable(
'LOOP_TITLE', utf8_decode($bookings[$i][
'object_title']) . $assigned_coupons);
189 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
191 if( $bookings[$i][
'duration'] == 0)
193 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
197 $tpl->setVariable(
'LOOP_DURATION', $bookings[$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months')));
201 $tpl->setVariable(
'LOOP_VAT_RATE',number_format($bookings[$i][
'vat_rate'], 2,
',',
'.').
' %');
202 $tpl->setVariable(
'LOOP_VAT_UNIT', number_format($bookings[$i][
'vat_unit'], 2,
',',
'.').
' '.$currency);
203 $tpl->setVariable(
'LOOP_PRICE',number_format($bookings[$i][
'price'], 2,
',',
'.').
' '.$currency);
204 $tpl->parseCurrentBlock(
'loop');
220 $bookings[
'total'] += (float)$bookings[$i][
'price'];
221 $bookings[
'total_vat']+= (float)$bookings[$i][
'vat_unit'];
222 $bookings[
'total_discount'] +=(float) $bookings[$i][
'discount'];
225 $sub_total_amount = $bookings[
'total'];
228 if($bookings[
'total_discount'] < 0)
230 $tpl->setCurrentBlock(
'cloop');
231 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon') .
' ' . $coupon[
'pcc_code']));
232 $tpl->setVariable(
'BONUS', number_format($bookings[
'total_discount'], 2,
',',
'.') .
' ' . $currency);
234 $tpl->parseCurrentBlock();
237 $bookings[
'total'] += $bookings[
'total_discount'];
238 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
239 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $currency);
242 if ($bookings[
'total'] < 0)
244 $bookings[
'total'] = 0.00;
248 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
249 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $currency);
251 if ($bookings[
'total_vat'] > 0)
253 $tpl->setVariable(
'TOTAL_VAT',number_format( $bookings[
'total_vat'], 2,
',',
'.') .
' ' .$currency);
255 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'pay_bmf_vat_included')));
258 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
260 if (!@file_exists($genSet->get(
'pdf_path')))
266 if (@file_exists($genSet->get(
'pdf_path')))
268 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf');
271 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf'))
274 $genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf',
275 $transaction .
'.pdf',
276 $a_mime =
'application/pdf'
280 @unlink($genSet->get(
'pdf_path') .
'/' . $transaction .
'.html');
281 @unlink($genSet->get(
'pdf_path') .
'/' . $transaction .
'.pdf');
291 $ilTabs->setTabActive(
'paya_buyed_objects');
292 $ilTabs->setSubTabActive(
'paya_buyed_objects');
296 include_once
"./Services/Repository/classes/class.ilRepositoryExplorer.php";
300 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
302 if(!count($bookings = $this->bookings_obj->getBookingsOfCustomer($this->user_obj->getId())))
311 foreach($bookings as $booking)
318 $transaction = $booking[
'transaction'];
320 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
322 $transaction .=
" (" . $str_paymethod .
")";
323 $f_result[$counter][
'transaction'] = $transaction;
329 $f_result[$counter][
'object_title'] =
"<a href=\"".$obj_link.
"\" target=\"".$obj_target.
"\">".$tmp_obj->getTitle().
"</a>";
335 $f_result[$counter][
'object_title'] = $booking[
'object_title'].
'<br> ('.$this->lng->txt(
'object_deleted').
')';
353 $f_result[$counter][
'vendor'] =
'['.$tmp_vendor->getLogin().
']';
354 $f_result[$counter][
'customer'] =
'['.$tmp_purchaser->getLogin().
']';
357 if($booking[
'duration'] != 0)
359 $f_result[$counter][
'duration'] = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
363 $f_result[$counter][
'duration'] = $this->lng->txt(
"unlimited_duration");
365 $f_result[$counter][
'price'] = $booking[
'price'].
' '.$booking[
'currency_unit'];
366 $f_result[$counter][
'discount'] = ($booking[
'discount'] !=
'' ? ($booking[
'discount'].
' '.$booking[
'currency_unit']) :
' ');
373 $payed_access = $booking[
'payed'] ?
374 $this->lng->txt(
'yes') :
375 $this->lng->txt(
'no');
377 $payed_access .=
'/';
378 $payed_access .= $booking[
'access_granted'] ?
379 $this->lng->txt(
'yes') :
380 $this->lng->txt(
'no');
382 $f_result[$counter][
'payed_access'] = $payed_access;
386 unset($tmp_purchaser);
396 $tbl->setTitle($this->lng->txt(
"paya_buyed_objects"));
397 $tbl->setId(
'tbl_bought_objects');
398 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
400 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
401 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
402 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
403 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
404 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
405 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
406 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
407 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
408 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
410 $tbl->setData($a_result_set);
412 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
419 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';