109 {
110 global
$tpl,$ilObjDataCache;
111
113 $transaction =
$_GET[
'transaction'];
114
115
116
117 $i = 0;
118
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';
122
124 $currency = $genSet->get('currency_unit');
125
126 $user_id = $this->user_obj->getId();
127
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)
133 {
134 $bookings[$i]['country'] = nl2br(utf8_decode($customer->getCountry()));
135 }
136
137 if(2 == strlen($bookings[$i]['country']))
138 {
139 $this->lng->loadLanguageModule('meta');
140 $bookings[$i]['country'] = utf8_decode($this->lng->txt('meta_c_'.strtoupper($bookings[$i]['country'])));
141 }
142
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');
145
146 if(
$tpl->placeholderExists(
'HTTP_PATH'))
147 {
149 $tpl->setVariable(
'HTTP_PATH', $http_path);
150 }
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'])))
158 {
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']);
161 }
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')));
165
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')));
170
171
172 $tpl->setVariable(
'CUSTOMER_FIRSTNAME',utf8_decode($customer->getFirstName()));
173 $tpl->setVariable(
'CUSTOMER_LASTNAME', utf8_decode($customer->getLastName()));
174 if($bookings['po_box']== '')
175 {
176 $tpl->setVariable(
'CUSTOMER_STREET',utf8_decode( $bookings[$i][
'street']));
177 }
178 else
179 {
180 $tpl->setVariable(
'CUSTOMER_STREET', utf8_decode($bookings[$i][
'po_box']));
181 }
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']));
185
186 $tpl->setVariable(
'BILL_NO', $transaction);
187
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')));
191
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')));
196
197 for ($i = 0; $i < count($bookings[$i]); $i++)
198 {
199 $tmp_pobject =
new ilPaymentObject($this->user_obj, $bookings[$i][
'pobject_id']);
200
201 $obj_id = $ilObjDataCache->lookupObjId($bookings[$i]['ref_id']);
202 $obj_type = $ilObjDataCache->lookupType($obj_id);
203
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')));
208
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')));
212
213 if( $bookings[$i]['duration'] == 0 && $bookings[$i]['access_enddate'] == NULL)
214 {
215 $tpl->setVariable(
'LOOP_DURATION', utf8_decode($this->lng->txt(
'unlimited_duration')));
216 }
217 else
218 {
221
222 $tpl->setVariable(
'LOOP_DURATION',
223 $access_startdate.' - '.$access_enddate.' / '.
224 $bookings[$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months')));
225 }
226
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');
232
233 $bookings['total'] += (float)$bookings[$i]['price'];
234 $bookings['total_vat']+= (float)$bookings[$i]['vat_unit'];
235 $bookings['total_discount'] +=(float) $bookings[$i]['discount'];
236 unset($tmp_pobject);
237
238 $sub_total_amount = $bookings['total'];
239 }
240
241 $bookings['total'] += $bookings['total_discount'];
242 if($bookings['total_discount'] < 0)
243 {
244 $tpl->setCurrentBlock(
'cloop');
245
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);
248
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();
252 }
253
254 if ($bookings['total'] < 0)
255 {
256 $bookings['total'] = 0.00;
257
258 }
259 $total_net_price = $sub_total_amount-$bookings['total_vat'];
260
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);
263
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)
267 {
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')));
270 }
271 if(1 == $bookings[0]['b_pay_method'])
272 {
273 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_unpayed_bill')));
274 }
275 else
276 {
277 $tpl->setVariable(
'TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt(
'pay_payed_bill')));
278 }
279
280 if (!@file_exists($genSet->get('pdf_path')))
281 {
283 }
284
285 $file_name = time();
286 if (@file_exists($genSet->get('pdf_path')))
287 {
289 }
290
291 if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf'))
292 {
294 $genSet->get('pdf_path') . '/' . $file_name . '.pdf',
295 $transaction . '.pdf',
296 $a_mime = 'application/pdf'
297 );
298 }
299
300 @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
301 @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
302 }
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
static getStringByPaymethod($a_type)
static __readBillByTransaction($a_user_id, $a_transaction_nr)
special template class to simplify handling of ITX/PEAR
static html2pdf($html, $pdf_file)
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 ...