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');
static getStringByPaymethod($a_type)
static setUseRelativeDates($a_status)
set use relative dates
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.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
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)