4 include_once
'./Services/Payment/classes/class.ilShopBaseGUI.php';
6 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
34 $cmd = $this->ctrl->getCmd();
35 switch ($this->ctrl->getNextClass($this))
37 case 'showBillHistory':
43 if(!
$cmd = $this->ctrl->getCmd())
56 $ilTabs->addSubTabTarget(
'paya_buyed_objects', $this->ctrl->getLinkTarget($this,
'showItems'),
'',
'',
'',
'showItems');
57 $ilTabs->addSubTabTarget(
'paya_bill_history', $this->ctrl->getLinkTarget($this,
'showBillHistory'),
'',
'',
'',
'showBillHistory');
64 include_once
"./Services/Repository/classes/class.ilRepositoryExplorer.php";
66 $ilTabs->setSubTabActive(
'paya_bill_history');
69 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
71 $bookings = $this->bookings_obj->getDistinctTransactions($this->user_obj->getId());
81 foreach($bookings as $booking)
84 $f_result[$counter][
'transaction'] =
"<a href=\"".$this->ctrl->getLinkTarget($this,
"createBill").
"&transaction=".$booking[
'transaction'].
"\">".$booking[
'transaction'].
".pdf</a>";
95 $this->ctrl->setParameter($this,
'cmd',
'showBillHistory');
97 $tbl->setId(
'tbl_bill_history');
98 $tbl->setTitle($this->lng->txt(
"paya_bill_history"));
99 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
101 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
102 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
104 $tbl->setData($a_result_set);
106 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
112 global
$tpl,$ilObjDataCache;
115 $transaction =
$_GET[
'transaction'];
121 include_once
'./Services/UICore/classes/class.ilTemplate.php';
122 include_once
'./Services/Utilities/classes/class.ilUtil.php';
123 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
126 $currency = $genSet->get(
'currency_unit');
128 $user_id = $this->user_obj->getId();
131 if($bookings[$i][
'street'] == NULL) $bookings[$i][
'street'] = nl2br(utf8_decode($customer->getStreet()));
132 if($bookings[$i][
'zipcode'] == NULL) $bookings[$i][
'zipcode'] = nl2br(utf8_decode($customer->getZipcode()));
133 if($bookings[$i][
'city'] == NULL) $bookings[$i][
'city'] = nl2br(utf8_decode($customer->getCity()));
134 if($bookings[$i][
'country'] == NULL)
136 $bookings[$i][
'country'] = nl2br(utf8_decode($customer->getCountry()));
139 if(2 == strlen($bookings[$i][
'country']))
141 $this->lng->loadLanguageModule(
'meta');
142 $bookings[$i][
'country'] = utf8_decode($this->lng->txt(
'meta_c_'.strtoupper($bookings[$i][
'country'])));
145 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill.html',
'Services/Payment');
146 $tpl =
new ilTemplate(
'tpl.pay_bill.html',
true,
true,
'Services/Payment');
148 if($tpl->placeholderExists(
'HTTP_PATH'))
151 $tpl->setVariable(
'HTTP_PATH', $http_path);
155 $tpl->setVariable(
'TXT_CREDIT', utf8_decode($this->lng->txt(
'credit')));
156 $tpl->setVariable(
'TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt(
'day_of_service_provision'));
157 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
159 if(strlen(trim($bookings[$i][
'transaction_extern'])))
161 $tpl->setVariable(
'TXT_EXTERNAL_BILL_NO', str_replace(
'%s',$str_paymethod,utf8_decode($this->lng->txt(
'external_bill_no'))));
162 $tpl->setVariable(
'EXTERNAL_BILL_NO', $bookings[$i][
'transaction_extern']);
164 $tpl->setVariable(
'TXT_POSITION',$this->lng->txt(
'position'));
165 $tpl->setVariable(
'TXT_AMOUNT',$this->lng->txt(
'amount'));
166 $tpl->setVariable(
'TXT_UNIT_PRICE', utf8_decode($this->lng->txt(
'unit_price')));
168 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
169 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
170 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
171 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
174 $tpl->setVariable(
'CUSTOMER_FIRSTNAME',utf8_decode($customer->getFirstName()));
175 $tpl->setVariable(
'CUSTOMER_LASTNAME', utf8_decode($customer->getLastName()));
176 if($bookings[
'po_box']==
'')
178 $tpl->setVariable(
'CUSTOMER_STREET',utf8_decode( $bookings[$i][
'street']));
182 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode($bookings[$i][
'po_box']));
184 $tpl->setVariable(
'CUSTOMER_ZIPCODE', utf8_decode($bookings[$i][
'zipcode']));
185 $tpl->setVariable(
'CUSTOMER_CITY', utf8_decode($bookings[$i][
'city']));
186 $tpl->setVariable(
'CUSTOMER_COUNTRY', utf8_decode($bookings[$i][
'country']));
188 $tpl->setVariable(
'BILL_NO', $transaction);
190 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
191 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
192 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
194 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
195 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
196 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
197 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
199 for ($i = 0; $i < count($bookings[$i]); $i++)
201 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[$i][
'pobject_id']);
203 $obj_id = $ilObjDataCache->lookupObjId($bookings[$i][
'ref_id']);
204 $obj_type = $ilObjDataCache->lookupType($obj_id);
206 $tpl->setCurrentBlock(
'loop');
207 $tpl->setVariable(
'LOOP_POSITION', $i+1);
208 $tpl->setVariable(
'LOOP_AMOUNT',
'1');
209 $tpl->setVariable(
'LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt(
'period_of_service_provision')));
211 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($obj_type)));
212 $tpl->setVariable(
'LOOP_TITLE', utf8_decode($bookings[$i][
'object_title']) . $assigned_coupons);
213 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
215 if( $bookings[$i][
'duration'] == 0 && $bookings[$i][
'access_enddate'] == NULL)
217 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
224 $tpl->setVariable(
'LOOP_DURATION',
225 $access_startdate.
' - '.$access_enddate.
' / '.
226 $bookings[$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months')));
229 $tpl->setVariable(
'LOOP_VAT_RATE',number_format($bookings[$i][
'vat_rate'], 2,
',',
'.').
' %');
230 $tpl->setVariable(
'LOOP_VAT_UNIT', number_format($bookings[$i][
'vat_unit'], 2,
',',
'.').
' '.$currency);
231 $tpl->setVariable(
'LOOP_UNIT_PRICE',number_format($bookings[$i][
'price'], 2,
',',
'.').
' '.$currency);
232 $tpl->setVariable(
'LOOP_PRICE',number_format($bookings[$i][
'price'], 2,
',',
'.').
' '.$currency);
233 $tpl->parseCurrentBlock(
'loop');
249 $bookings[
'total'] += (float)$bookings[$i][
'price'];
250 $bookings[
'total_vat']+= (float)$bookings[$i][
'vat_unit'];
251 $bookings[
'total_discount'] +=(float) $bookings[$i][
'discount'];
254 $sub_total_amount = $bookings[
'total'];
257 $bookings[
'total'] += $bookings[
'total_discount'];
258 if($bookings[
'total_discount'] < 0)
260 $tpl->setCurrentBlock(
'cloop');
262 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
263 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $currency);
265 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon') .
' ' . $coupon[
'pcc_code']));
266 $tpl->setVariable(
'BONUS', number_format($bookings[
'total_discount'], 2,
',',
'.') .
' ' . $currency);
267 $tpl->parseCurrentBlock();
270 if ($bookings[
'total'] < 0)
272 $bookings[
'total'] = 0.00;
275 $total_net_price = $sub_total_amount-$bookings[
'total_vat'];
277 $tpl->setVariable(
'TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt(
'total_netprice')));
278 $tpl->setVariable(
'TOTAL_NETPRICE', number_format($total_net_price, 2,
',',
'.') .
' ' . $currency);
280 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
281 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $currency);
282 if ($bookings[
'total_vat'] > 0)
284 $tpl->setVariable(
'TOTAL_VAT',number_format( $bookings[
'total_vat'], 2,
',',
'.') .
' ' .$currency);
285 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'plus_vat')));
287 if(1 == $bookings[0][
'b_pay_method'])
289 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_unpayed_bill')));
293 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
296 if (!@file_exists($genSet->get(
'pdf_path')))
302 if (@file_exists($genSet->get(
'pdf_path')))
304 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
307 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf'))
310 $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf',
311 $transaction .
'.pdf',
312 $a_mime =
'application/pdf'
316 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.html');
317 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
326 $ilTabs->setTabActive(
'paya_buyed_objects');
327 $ilTabs->setSubTabActive(
'paya_buyed_objects');
331 include_once
"./Services/Repository/classes/class.ilRepositoryExplorer.php";
335 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
346 foreach($bookings as $booking)
352 $transaction = $booking[
'transaction'];
354 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
356 $transaction .=
" (" . $str_paymethod .
")";
357 $f_result[$counter][
'transaction'] = $transaction;
363 $f_result[$counter][
'object_title'] =
"<a href=\"".$obj_link.
"\" target=\"".$obj_target.
"\">".$tmp_obj->getTitle().
"</a>";
369 $f_result[$counter][
'object_title'] = $booking[
'object_title'].
'<br> ('.$this->lng->txt(
'object_deleted').
')';
371 $f_result[$counter][
'vendor'] =
'['.$tmp_vendor->getLogin().
']';
372 $f_result[$counter][
'customer'] =
'['.$tmp_purchaser->getLogin().
']';
375 if($booking[
'duration'] == 0 && $booking[
'access_enddate'] == NULL)
377 $f_result[$counter][
'duration'] = $this->lng->txt(
"unlimited_duration");
381 if($booking[
'duration'] > 0)
383 $f_result[$counter][
'duration'] = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
388 $f_result[$counter][
'price'] = $booking[
'price'].
' '.$booking[
'currency_unit'];
389 $f_result[$counter][
'discount'] = ($booking[
'discount'] !=
'' ? (round($booking[
'discount'], 2).
' '.$booking[
'currency_unit']) :
' ');
391 $payed_access = $booking[
'payed'] ?
392 $this->lng->txt(
'yes') :
393 $this->lng->txt(
'no');
395 $payed_access .=
'/';
396 $payed_access .= $booking[
'access_granted'] ?
397 $this->lng->txt(
'yes') :
398 $this->lng->txt(
'no');
400 $f_result[$counter][
'payed_access'] = $payed_access;
404 unset($tmp_purchaser);
414 $tbl->setTitle($this->lng->txt(
"paya_buyed_objects"));
415 $tbl->setId(
'tbl_bought_objects');
416 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
418 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
419 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
420 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
421 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
422 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
423 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
424 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
425 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
426 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
428 $tbl->setData($a_result_set);
430 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
437 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';