4 include_once
'./Services/Payment/classes/class.ilShopBaseGUI.php';
6 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
27 parent::__construct();
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');
79 foreach($bookings as $booking)
82 $f_result[$counter][
'transaction'] =
"<a href=\"".$this->ctrl->getLinkTarget($this,
"createBill").
"&transaction=".$booking[
'transaction'].
"\">".$booking[
'transaction'].
".pdf</a>";
93 $this->ctrl->setParameter($this,
'cmd',
'showBillHistory');
95 $tbl->setId(
'tbl_bill_history');
96 $tbl->setTitle($this->lng->txt(
"paya_bill_history"));
97 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
99 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
100 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
102 $tbl->setData($a_result_set);
104 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
110 global
$tpl,$ilObjDataCache;
113 $transaction =
$_GET[
'transaction'];
119 include_once
'./Services/UICore/classes/class.ilTemplate.php';
120 include_once
'./Services/Utilities/classes/class.ilUtil.php';
121 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
124 $currency = $genSet->get(
'currency_unit');
126 $user_id = $this->user_obj->getId();
129 if($bookings[$i][
'street'] == NULL) $bookings[$i][
'street'] = nl2br(utf8_decode($customer->getStreet()));
130 if($bookings[$i][
'zipcode'] == NULL) $bookings[$i][
'zipcode'] = nl2br(utf8_decode($customer->getZipcode()));
131 if($bookings[$i][
'city'] == NULL) $bookings[$i][
'city'] = nl2br(utf8_decode($customer->getCity()));
132 if($bookings[$i][
'country'] == NULL)
134 $bookings[$i][
'country'] = nl2br(utf8_decode($customer->getCountry()));
137 if(2 == strlen($bookings[$i][
'country']))
139 $this->lng->loadLanguageModule(
'meta');
140 $bookings[$i][
'country'] = utf8_decode($this->lng->txt(
'meta_c_'.strtoupper($bookings[$i][
'country'])));
143 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_bill.html',
'Services/Payment');
144 $tpl =
new ilTemplate(
'tpl.pay_bill.html',
true,
true,
'Services/Payment');
146 if($tpl->placeholderExists(
'HTTP_PATH'))
149 $tpl->setVariable(
'HTTP_PATH', $http_path);
153 $tpl->setVariable(
'TXT_CREDIT', utf8_decode($this->lng->txt(
'credit')));
154 $tpl->setVariable(
'TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt(
'day_of_service_provision'));
155 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
157 if(strlen(trim($bookings[$i][
'transaction_extern'])))
159 $tpl->setVariable(
'TXT_EXTERNAL_BILL_NO', str_replace(
'%s',$str_paymethod,utf8_decode($this->lng->txt(
'external_bill_no'))));
160 $tpl->setVariable(
'EXTERNAL_BILL_NO', $bookings[$i][
'transaction_extern']);
162 $tpl->setVariable(
'TXT_POSITION',$this->lng->txt(
'position'));
163 $tpl->setVariable(
'TXT_AMOUNT',$this->lng->txt(
'amount'));
164 $tpl->setVariable(
'TXT_UNIT_PRICE', utf8_decode($this->lng->txt(
'unit_price')));
166 $tpl->setVariable(
'VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get(
'address'))));
167 $tpl->setVariable(
'VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get(
'add_info'))));
168 $tpl->setVariable(
'VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get(
'bank_data'))));
169 $tpl->setVariable(
'TXT_BANK_DATA', utf8_decode($this->lng->txt(
'pay_bank_data')));
172 $tpl->setVariable(
'CUSTOMER_FIRSTNAME',utf8_decode($customer->getFirstName()));
173 $tpl->setVariable(
'CUSTOMER_LASTNAME', utf8_decode($customer->getLastName()));
174 if($bookings[
'po_box']==
'')
176 $tpl->setVariable(
'CUSTOMER_STREET',utf8_decode( $bookings[$i][
'street']));
180 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode($bookings[$i][
'po_box']));
182 $tpl->setVariable(
'CUSTOMER_ZIPCODE', utf8_decode($bookings[$i][
'zipcode']));
183 $tpl->setVariable(
'CUSTOMER_CITY', utf8_decode($bookings[$i][
'city']));
184 $tpl->setVariable(
'CUSTOMER_COUNTRY', utf8_decode($bookings[$i][
'country']));
186 $tpl->setVariable(
'BILL_NO', $transaction);
188 $tpl->setVariable(
'TXT_BILL', utf8_decode($this->lng->txt(
'pays_bill')));
189 $tpl->setVariable(
'TXT_BILL_NO', utf8_decode($this->lng->txt(
'pay_bill_no')));
190 $tpl->setVariable(
'TXT_DATE', utf8_decode($this->lng->txt(
'date')));
192 $tpl->setVariable(
'TXT_ARTICLE', utf8_decode($this->lng->txt(
'pay_article')));
193 $tpl->setVariable(
'TXT_VAT_RATE', utf8_decode($this->lng->txt(
'vat_rate')));
194 $tpl->setVariable(
'TXT_VAT_UNIT', utf8_decode($this->lng->txt(
'vat_unit')));
195 $tpl->setVariable(
'TXT_PRICE', utf8_decode($this->lng->txt(
'price_a')));
197 for ($i = 0; $i < count($bookings[$i]); $i++)
199 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[$i][
'pobject_id']);
201 $obj_id = $ilObjDataCache->lookupObjId($bookings[$i][
'ref_id']);
202 $obj_type = $ilObjDataCache->lookupType($obj_id);
204 $tpl->setCurrentBlock(
'loop');
205 $tpl->setVariable(
'LOOP_POSITION', $i+1);
206 $tpl->setVariable(
'LOOP_AMOUNT',
'1');
207 $tpl->setVariable(
'LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt(
'period_of_service_provision')));
209 $tpl->setVariable(
'LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($obj_type)));
210 $tpl->setVariable(
'LOOP_TITLE', utf8_decode($bookings[$i][
'object_title']) . $assigned_coupons);
211 $tpl->setVariable(
'LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt(
'pay_entitled_retrieve')));
213 if( $bookings[$i][
'duration'] == 0 && $bookings[$i][
'access_enddate'] == NULL)
215 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
222 $tpl->setVariable(
'LOOP_DURATION',
223 $access_startdate.
' - '.$access_enddate.
' / '.
224 $bookings[$i][
'duration'] .
' ' . utf8_decode($this->lng->txt(
'paya_months')));
227 $tpl->setVariable(
'LOOP_VAT_RATE',number_format($bookings[$i][
'vat_rate'], 2,
',',
'.').
' %');
228 $tpl->setVariable(
'LOOP_VAT_UNIT', number_format($bookings[$i][
'vat_unit'], 2,
',',
'.').
' '.$currency);
229 $tpl->setVariable(
'LOOP_UNIT_PRICE',number_format($bookings[$i][
'price'], 2,
',',
'.').
' '.$currency);
230 $tpl->setVariable(
'LOOP_PRICE',number_format($bookings[$i][
'price'], 2,
',',
'.').
' '.$currency);
231 $tpl->parseCurrentBlock(
'loop');
233 $bookings[
'total'] += (float)$bookings[$i][
'price'];
234 $bookings[
'total_vat']+= (float)$bookings[$i][
'vat_unit'];
235 $bookings[
'total_discount'] +=(float) $bookings[$i][
'discount'];
238 $sub_total_amount = $bookings[
'total'];
241 $bookings[
'total'] += $bookings[
'total_discount'];
242 if($bookings[
'total_discount'] < 0)
244 $tpl->setCurrentBlock(
'cloop');
246 $tpl->setVariable(
'TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_subtotal_amount')));
247 $tpl->setVariable(
'SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2,
',',
'.') .
' ' . $currency);
249 $tpl->setVariable(
'TXT_COUPON', utf8_decode($this->lng->txt(
'paya_coupons_coupon') .
' ' . $coupon[
'pcc_code']));
250 $tpl->setVariable(
'BONUS', number_format($bookings[
'total_discount'], 2,
',',
'.') .
' ' . $currency);
251 $tpl->parseCurrentBlock();
254 if ($bookings[
'total'] < 0)
256 $bookings[
'total'] = 0.00;
259 $total_net_price = $sub_total_amount-$bookings[
'total_vat'];
261 $tpl->setVariable(
'TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt(
'total_netprice')));
262 $tpl->setVariable(
'TOTAL_NETPRICE', number_format($total_net_price, 2,
',',
'.') .
' ' . $currency);
264 $tpl->setVariable(
'TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt(
'pay_bmf_total_amount')));
265 $tpl->setVariable(
'TOTAL_AMOUNT', number_format($bookings[
'total'], 2,
',',
'.') .
' ' . $currency);
266 if ($bookings[
'total_vat'] > 0)
268 $tpl->setVariable(
'TOTAL_VAT',number_format( $bookings[
'total_vat'], 2,
',',
'.') .
' ' .$currency);
269 $tpl->setVariable(
'TXT_TOTAL_VAT', utf8_decode($this->lng->txt(
'plus_vat')));
271 if(1 == $bookings[0][
'b_pay_method'])
273 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_unpayed_bill')));
277 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
280 if (!@file_exists($genSet->get(
'pdf_path')))
286 if (@file_exists($genSet->get(
'pdf_path')))
288 ilUtil::html2pdf($tpl->get(), $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
291 if (@file_exists($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf'))
294 $genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf',
295 $transaction .
'.pdf',
296 $a_mime =
'application/pdf' 300 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.html');
301 @unlink($genSet->get(
'pdf_path') .
'/' . $file_name .
'.pdf');
308 parent::prepareOutput();
310 $ilTabs->setTabActive(
'paya_buyed_objects');
311 $ilTabs->setSubTabActive(
'paya_buyed_objects');
315 include_once
"./Services/Repository/classes/class.ilRepositoryExplorer.php";
319 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
330 foreach($bookings as $booking)
336 $transaction = $booking[
'transaction'];
338 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
340 $transaction .=
" (" . $str_paymethod .
")";
341 $f_result[$counter][
'transaction'] = $transaction;
347 $f_result[$counter][
'object_title'] =
"<a href=\"".$obj_link.
"\" target=\"".$obj_target.
"\">".$tmp_obj->getTitle().
"</a>";
353 $f_result[$counter][
'object_title'] = $booking[
'object_title'].
'<br> ('.$this->lng->txt(
'object_deleted').
')';
355 $f_result[$counter][
'vendor'] =
'['.$tmp_vendor->getLogin().
']';
356 $f_result[$counter][
'customer'] =
'['.$tmp_purchaser->getLogin().
']';
359 if($booking[
'duration'] == 0 && $booking[
'access_enddate'] == NULL)
361 $f_result[$counter][
'duration'] = $this->lng->txt(
"unlimited_duration");
365 if($booking[
'duration'] > 0)
367 $f_result[$counter][
'duration'] = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
372 $f_result[$counter][
'price'] = $booking[
'price'].
' '.$booking[
'currency_unit'];
373 $f_result[$counter][
'discount'] = ($booking[
'discount'] !=
'' ? (round($booking[
'discount'], 2).
' '.$booking[
'currency_unit']) :
' ');
375 $payed_access = $booking[
'payed'] ?
376 $this->lng->txt(
'yes') :
377 $this->lng->txt(
'no');
379 $payed_access .=
'/';
380 $payed_access .= $booking[
'access_granted'] ?
381 $this->lng->txt(
'yes') :
382 $this->lng->txt(
'no');
384 $f_result[$counter][
'payed_access'] = $payed_access;
388 unset($tmp_purchaser);
398 $tbl->setTitle($this->lng->txt(
"paya_buyed_objects"));
399 $tbl->setId(
'tbl_bought_objects');
400 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
402 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
403 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
404 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
405 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
406 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
407 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
408 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
409 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
410 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
412 $tbl->setData($a_result_set);
414 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
421 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
showStatisticTable($a_result_set)
static getBookingsOfCustomer($a_usr_id)
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
buildLinkTarget($a_node_id, $a_type)
note: most of this stuff is used by ilCourseContentInterface too
Class ilShopBoughtObjectsGUI.
static getStringByPaymethod($a_type)
static setUseRelativeDates($a_status)
set use relative dates
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static html2pdf($html, $pdf_file)
produce pdf out of html with htmldoc
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
STATIC, do not use $this inside!
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static __readBillByTransaction($a_user_id, $a_transaction_nr)
showBillHistoryTable($a_result_set)