$idform .= ' <input type="submit" name="submit" value="Open" />'; $idform .= '<input type="hidden" name="me_action" value="SUBMITINVOICENO" />'; $idform .= '</form>'; if(isset($_GET['id']) && $_GET['id']!='') { $vat = VAT; $vat_text = ($vat*100).'%'; $invoice_id = tep_db_prepare_input($_GET['id']); $content = file_get_contents($template_folder.'invoice_template.html'); $invoice_query = "SELECT mi.*,o.orders_no,o.date_purchased,o.paid_status FROM minierp_invoices mi"; $invoice_query .= " LEFT JOIN orders o ON o.orders_id=mi.orders_id"; $invoice_query .= " WHERE mi.invoices_id=" . $invoice_id; $invoice_result = tep_db_query($invoice_query); if(tep_db_num_rows($invoice_result)=='1') { $invoice = tep_db_fetch_array($invoice_result); $order_date = tep_date_only($invoice['date_purchased']); $invoice_date = tep_date_only($invoice['invoice_date']); $invoice_head = 'Rechnung für '.$invoice['invoices_no'].' '.$invoice_date; //$order_detail['Customers'] = "<strong>$row[customers_name]</strong><br />$row[customers_email_address]"; $billing_address = '<span class="address-head">Bestellt von:</span><br /><br />'; if($invoice['billing_company']!='') $billing_address .= "<strong>$invoice[billing_company]</strong><br />"; $billing_address .= "<strong>$invoice[billing_name]</strong><br />"; $billing_address .= "$invoice[billing_street_address]<br />"; $billing_address .= "$invoice[billing_postcode] $invoice[billing_city]<br />"; $billing_address .= "$invoice[billing_country]"; $delivery_address = '<span class="address-head">Empfänger:</span><br /><br />'; if($invoice['delivery_company']!='') $delivery_address .= "<strong>$invoice[delivery_company]</strong><br />"; $delivery_address .= "<strong>$invoice[delivery_name]</strong><br />"; $delivery_address .= "$invoice[delivery_street_address]<br />"; $delivery_address .= "$invoice[delivery_postcode] $invoice[delivery_city]<br />"; $delivery_address .= "$invoice[delivery_country]"; $invoice_title = 'Rechnung/Lieferschein für';
} elseif ($order["payment_method"] == PAYMENT_METHOD_DIRECT_DEBIT) { //Bankeinzug (Direct Debit) $request['clearingtype'] = PAYONE_PAYMENT_METHOD_DEBIT_PAYMENT; //elv } elseif ($order['payment_method'] == PAYMENT_METHOD_INVOICE) { //Rechnung (Bank Transfer) $request['clearingtype'] = PAYONE_PAYMENT_METHOD_INVOICE; //rec } } //$request['reference'] = ($is_sp) ? $order['jng_sp_orders_id'] : 'JG-'.$order['jng_sp_orders_id']; $request['reference'] = $is_sp ? $order['order_id'] : $order['orders_no']; $invoice_amount = $payi->detail['invoice_amount'] * 100; $request['amount'] = round($invoice_amount); $request['currency'] = 'EUR'; tep_date_only($date); //$request['param'] = $order['param']; //$request['narrative_text'] = ''; //for direct debit //--FinanceGate Business $request['due_time'] = strtotime($payi->detail['invoice_due_date']); //--INVOICE INFO $request['invoiceid'] = $payi->detail['invoice_no']; $request['invoice_deliverymode'] = PAYONE_INVOICE_DELIVERY_MAIL; $request['invoiceappendix'] = ''; $item_counter = 0; $request["id"] = array(); $request["pr"] = array(); $request["no"] = array(); $request["de"] = array(); $request["va"] = array(); foreach ($items as $i) {
<? if(isset($order_id) && $order_id!='' && isset($opp) && is_array($opp) && count($opp)>0) { $content = file_get_contents($template_folder.'delivery_note_template.html'); $order_query = "SELECT * FROM orders WHERE orders_id=$order_id"; $order_result = tep_db_query($order_query); if(tep_db_num_rows($order_result)=='1') { $order = tep_db_fetch_array($order_result); $order_date = tep_date_only($order['date_purchased']); $delivery_note_date = tep_date_only($order['date_purchased']); $delivery_note_head = 'Lieferschein für Bestell-Nr. '.$order['orders_no'].' '.$delivery_note_date; //$order_detail['Customers'] = "<strong>$row[customers_name]</strong><br />$row[customers_email_address]"; $delivery_address = '<span class="address-head">Empfänger:</span><br /><br />'; $delivery_address .= "<strong>$order[delivery_name]</strong><br />"; $delivery_address .= "$order[delivery_street_address]<br />"; $delivery_address .= "$order[delivery_postcode] $order[delivery_city]<br />"; $delivery_address .= "$order[delivery_country]"; $delivery_note_title = 'Lieferschein'; $delivery_note_info = '<div><strong>Bestell-Nr. '.$order['orders_no'].'</strong><br />'; $delivery_note_info .= 'Ihre Bestellung vom '.$order_date.'</div>'; //GET INVOICE PRODUCTS $opp_filter = implode(',', $opp); $delivery_note_products_query = "SELECT op.orders_products_id, SUM(opp.products_quantity) AS products_quantity"; $delivery_note_products_query .= ", op.products_model, op.products_name"; $delivery_note_products_query .= " FROM orders_products_problem opp"; $delivery_note_products_query .= " LEFT JOIN orders_products op ON op.orders_products_id=opp.orders_products_id"; $delivery_note_products_query .= " WHERE orders_products_problem_id IN ($opp_filter)"; $delivery_note_products_query .= " GROUP BY op.orders_products_id"; $delivery_note_products_result = tep_db_query($delivery_note_products_query); $delivery_note_products = array(); $products_table = '<table class="deliverynote-products-table" border="0" cellpadding="0" cellspacing="0">'; $products_table .= '<tr>';
$headline_text = $print_delivery_note ? 'Lieferschein' : 'Rechnung/Lieferschein für'; $pdf->Cell(120, 4, $headline_text); //Ivoice subheadline $ypos += 6; $pdf->SetXY($margin, $ypos); $pdf->setFont('Arial', 'B', '10'); if ($print_delivery_note) { $pdf->Cell(70, 4, 'Bestell-Nr. ' . $order['orders_no'], 0, 1); } else { $pdf->Cell(70, 4, 'Bestell-Nr. ' . $order['orders_no']); $pdf->Cell(70, 4, 'Rechnungs-Nr. ' . $class_pi->detail['invoice_no'], 0, 1); } $pdf->setFont('Arial', '', '10'); $pdf->Cell(70, 4, 'Ihre Bestellung vom ' . tep_date_only($order['date_purchased'])); if (!$print_delivery_note) { $pdf->Cell(70, 4, 'Lieferdatum/Rechnungsdatum: ' . tep_date_only($class_pi->detail['invoice_date'])); } //Products: $col1w = 12; $col2w = 25; $col3w = 60; $col4w = 27; $col5w = 23; $col6w = 16; $col7w = 20; //header $pdf->Line($margin, $ypos + 12, 200, $ypos + 12); $pdf->Line($margin, $ypos + 18, 200, $ypos + 18); $ypos += 13; $pdf->SetXY($margin, $ypos); $pdf->setFont('Arial', 'B', '8');
$pdf->SetXY($margin, $ypos); $pdf->setFont('Arial', 'B', '18'); $headline_text = 'Rechnung/Lieferschein für'; $pdf->Cell(120, 4, $headline_text); $ypos = $ypos + 13; $col_width = 35; $pdf->SetXY($margin, $ypos); $pdf->setFont('Arial', 'B', '10'); $labels = array(); $labels[] = 'Auftrags-Nr. '; $labels[] = 'Rechnungs-Nr. '; $labels[] = 'Rechnungsdatum '; $values = array(); $values[] = $order['orders_no']; $values[] = $invoice_no . $invoice_no_text; $values[] = tep_date_only($invoice_date); $pdf->MultiCell($col_width, 4, implode("\n", $labels)); $pdf->SetXY($margin + $col_width, $ypos); $pdf->MultiCell(150, 4, implode("\n", $values)); //Products: $col1w = 12; $col2w = 30; $col3w = 75; //50 + $col5w $col4w = 25; //$col5w = 25; $col6w = 12; $col7w = 27; //header $pdf->Line($margin, $ypos + 15, 200, $ypos + 15); $pdf->Line($margin, $ypos + 21, 200, $ypos + 21);
function tep_date_long($date) { if (!is_int($date)) { $date = strtotime($date); } $weekday = get_day(LANGUAGEID, date('w', $date)); $dateonly = tep_date_only($date); return "{$weekday}, {$dateonly}"; }
//$key = $cid.$md5_cidtime.$cid; //$link = 'http://'.JNG_LIVE_URL.'/extensions/sp-customers-bank-account.php?'; //$link .= 'cid='.$cid.'&t='.$time.'&key='.$key; //$link_html = '<a href="'.$link.'">'.$link.'</a>'; if ($to_email_address == '') { $counter_noemail++; } else { $order_id = $o['order_id']; $order_date = date('d.m.Y', strtotime($o['order_date'])); $items = $data_sp['items'][$o['jng_sp_orders_id']]; $email_text_products = array(); foreach ($items as $i) { $email_text_products[] = $i['article_number'] . ' - ' . $i['billing_text']; } // $return_date = tep_date_only($items[0]['return_date']); $return_date = tep_date_only($o['return_date']); include DIR_WS_EMAILS . $languages[2]['path'] . '/otto.de-products-returned.php'; $from_email_name = FROM_EMAIL_NAME; $from_email_address = FROM_EMAIL_ADDRESS; $sent = tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address); if ($sent) { $counter_success++; } else { $counter_fail++; } } $order = new Order(Order::ORDER_TYPE_SALES_PARTNER, $o['jng_sp_orders_id']); $order->sendReturnNotification(); } $content .= '<h3>' . $jng_sp_name . ': ' . $counter_success . ' Email(s) Sent, ' . $counter_noemail . ' Email(s) Not Found, ' . $counter_fail . ' Email(s) Failed</h3>'; break;
$shipping_address .= ' ' . $order['customer_billing_city']; $shipping_address .= "\n" . $order['customer_billing_country']; $pdf->SetXY($box1x, $ypos); $pdf->setFont('Arial', '', '10'); $pdf->MultiCell($address_width, 4, $shipping_address); //Invoice headline $ypos = 30 + $address_height_used; $pdf->SetXY($margin, $ypos); $pdf->setFont('Arial', 'B', '14'); $pdf->Cell(120, 4, $header_text); //Ivoice subheadline $ypos += 6; $pdf->SetXY($margin, $ypos); $pdf->setFont('Arial', '', '10'); $pdf->Cell(70, 4, 'Rechnungs-Nr.: ' . $invoice_no, 0, 1); $pdf->Cell(70, 4, 'Rechnungsdatum: ' . tep_date_only(time())); //Products: $ypos += 12; $pdf->SetXY($margin, $ypos); $list_header = 'Hiermit berechnen wir Ihnen folgende Leistung:'; $pdf->Cell(180, 4, $list_header); $col1w = 20; $col2w = 40; $col3w = 55; $col4w = 35; $col5w = 35; // $col6w = 16; // $col7w = 20; //header $ypos += 8; $pdf->Line($margin, $ypos - 1, 200, $ypos - 1);