Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/laciasmara.com/public_html/shop/application/views/pdf/ |
Upload File : |
<!DOCTYPE html> <html> <head> <title><?= $title ?></title> <style> body { font-family: arial !important; font-size: 12px; } table { border-collapse: collapse; width: 100%; font-family: arial; font-size: 12px; } table th { padding: 3px; font-weight: bold; text-align: center; } table td { padding: 3px; vertical-align: top; font-family: arial; font-size: 12px; } table.bordered { border-collapse: collapse; width: 100%; } table.bordered th { border: 1px solid #000; padding: 3px; font-weight: bold; text-align: center; } table.bordered td { border: 1px solid #000; padding: 3px; vertical-align: top; } </style> </head> <body> <?php $lokasiFile = realpath($_SERVER["DOCUMENT_ROOT"]) . "/shop/uploads/logoangsanaasmaraemail.jpg"; $lokasiFile1 = realpath($_SERVER["DOCUMENT_ROOT"]) . "/shop/uploads/logolaciasmaraemail.jpg"; $lokasiFile2 = realpath($_SERVER["DOCUMENT_ROOT"]) . "/shop/uploads/logoasmaragamaemail.jpg"; $lokasiFile3 = realpath($_SERVER["DOCUMENT_ROOT"]) . "/shop/uploads/logowhippedcreamemail.jpg"; ?> <table> <tr> <td style="text-align: center;"> <img style="max-width:150px" src="<?= $lokasiFile1; ?>" /> </td> </tr> </table> <br> <table> <tr> <td> <h2 style="text-align: left"> <span style="text-decoration: underline;">INVOICE</span><br> </h2> </td> </tr> </table> <br> <table> <?php $customer = $this->db->select('*')->from('customers')->where('id_customers', $order->customer_id)->get()->row(); $recipient_name = $order->gift_receiver_name ?: $order->recipient_name; $recipient_phone = $order->gift_receiver_phone ?: $order->phone; ?> <tr> <td align="left"> INV/<?php echo date("Ymd") ?>/<?= $order->id_orders; ?> <br> ORDER NO : <?= $order->id_orders; ?> <br>DATE : <?= $order->order_date; ?></td><br> <td></td> <td align="right"> SHIPPING TO : <b><?php echo ucwords($recipient_name); ?></b><br><br> <?= ucwords($order->address); ?><br> <?= ucwords("{$order->subdistrict}, {$order->district}, {$order->province}"); ?> <br><br> <?php if ($order->customer_invoice_note) : ?> <b>Note:</b> <?= ucwords($order->customer_invoice_note); ?><br> <?php endif; ?> <br> P/ <?php echo $recipient_phone; ?> </td></a><br> </tr> <tr> </tr> </table> <table class="bordered"> <?php if ($order->payment_type != 'bank transfer BCA' && $order->payment_type != 'bank transfer MANDIRI') : ?> <tr> <th>SHIPPING METHOD</th> <th>SHIPPING TERMS</th> <th>DELIVERY/ HANDLING FEE</th> <th>PAYMENT TERMS</th> </tr> <?php else : ?> <tr> <th style="width: 37%;">SHIPPING METHOD</th> <th>SHIPPING TERMS</th> <th style="width: 37%;">DELIVERY/ HANDLING FEE</th> </tr> <?php endif; ?> <tr> <td style="text-align:center;"> <?php foreach ($orders_detail as $item) : ?> <?php $query = $this->db->select('reseller_id')->from('customers')->where('id_customers', $order->customer_id)->get(); $row = $query->row(); $reseller_id = $row ? $row->reseller_id : null; // Cegah error jika $row null if ($reseller_id == NULL) { $shipping_method = $this->db->select('name')->from('shipment_method')->where('id', $item->chosen_shipping_id)->get()->row()->name; $shipper = $this->db->select('shipper')->from('shipment_method')->where('id', $item->chosen_shipping_id)->get()->row()->shipper; } else { $shipper = $this->db->select('shipper')->from('shipment_method')->where('id', $item->chosen_shipping_id)->get()->row()->shipper; switch ($order->customer_id) { case 2619: $shipping_name_byuser = 'Gosend Instant'; break; case 2618: $shipping_name_byuser = 'Private Courier'; break; case 2617: $shipping_name_byuser = 'Kurir Test'; break; case 2010: $shipping_name_byuser = 'Private Courier'; break; case 2288: $shipping_name_byuser = 'Gosend Instant'; break; case 2620: $shipping_name_byuser = 'Trucking'; break; case 2530: $shipping_name_byuser = 'Trucking'; break; default: $shipping_name_byuser = 'Reguler'; break; } $shipping_method = $shipping_name_byuser; } ?> <?php echo ucwords($shipping_method) . ' - ' . ucwords($shipper); break ?> <?php endforeach ?> </td> <td style="text-align:center;"> <?php $temp = number_format($order->shipping_fee); if ($temp == "0") { echo "Paid By Seller"; } else { echo "Paid By Customer"; } ?> </td> <td style="text-align:center;"> IDR <?= number_format($order->shipping_fee); ?></td> <?php if ($order->payment_type != 'bank transfer BCA' && $order->payment_type != 'bank transfer MANDIRI') : ?> <td style="text-align:center;"><?= ucwords($order->payment_type); ?></td> <?php endif; ?> </tr> </table> <?php if ($order->payment_type == 'bank transfer BCA') : ?> <br> <table class="bordered" style="table-layout: fixed; width: 100%;"> <colgroup> <col style="width: 33.33%;"> <col style="width: 33.33%;"> <col style="width: 33.33%;"> </colgroup> <tr> <th>PAYMENT TERMS</th> <th>ACCOUNT NAME</th> <th>ACCOUNT NUMBER</th> </tr> <tr> <td style="text-align:center;"><?= ucwords($order->payment_type); ?></td> <td style="text-align:center;">Angsana Asmara Indonesia</td> <td style="text-align:center;">436 999 9700</td> </tr> </table> <?php elseif ($order->payment_type == 'bank transfer MANDIRI') : ?> <br> <table class="bordered" style="table-layout: fixed; width: 100%;"> <colgroup> <col style="width: 33.33%;"> <col style="width: 33.33%;"> <col style="width: 33.33%;"> </colgroup> <tr> <th>PAYMENT TERMS</th> <th>ACCOUNT NAME</th> <th>ACCOUNT NUMBER</th> </tr> <tr> <td style="text-align:center;"><?= ucwords($order->payment_type); ?></td> <td style="text-align:center;">Angsana Asmara Indonesia</td> <td style="text-align:center;">124 000 221 0806</td> </tr> </table> <?php else : ?> <?php endif; ?> <table class="bordered" style="margin-top: 30px;"> <tr> <th>NO</th> <th>ITEM NAME</th> <th>QTY</th> <th>UNIT PRICE</th> <th>DISCOUNT</th> <th>LINE TOTAL</th> </tr> <?php $count = 0; $total_amount = 0; $footer_inserted = false; // Hitung total harga semua item terlebih dahulu jika ada voucher $total_items_price = 0; if (!empty($order->redeemed_voucher_code)) { foreach ($orders_detail as $od) { $item_real_price = $this->db->select('price')->from('product_details')->where('id', $od->item_id)->get()->row()->price; // Cek apakah reseller $cust_data = $this->db->select('reseller_id') ->from('customers') ->where('id_customers', $order->customer_id) ->get() ->row(); $res_id = $cust_data ? $cust_data->reseller_id : null; if ($res_id) { $res_price_data = $this->db->select('price') ->from('resellers_price') ->where('reseller_id', $res_id) ->where('product_detail_id', $od->item_id) ->get() ->row(); $item_real_price = $res_price_data ? $res_price_data->price : $item_real_price; } $total_items_price += ($od->quantity * $item_real_price); } } foreach ($orders_detail as $item) : $count++; $real_price = $this->db->select('price')->from('product_details')->where('id', $item->item_id)->get()->row()->price; // Ambil reseller_id customer $customer_data = $this->db->select('reseller_id') ->from('customers') ->where('id_customers', $order->customer_id) ->get() ->row(); $reseller_id = $customer_data ? $customer_data->reseller_id : null; // if ($reseller_id) { // // Jika customer adalah reseller, ambil harga dari tabel reseller_price // $reseller_price_data = $this->db->select('price') // ->from('resellers_price') // ->where('reseller_id', $reseller_id) // ->where('product_detail_id', $item->item_id) // ->get() // ->row(); // $real_price = $reseller_price_data ? $reseller_price_data->price : $real_price; // } ?> <tr> <td style="text-align:center;"><?= $count; ?></td> <td style="text-align:left;"><?= $item->item_name; ?><br><?= $item->attributes; ?><br>SKU : <?= $item->sku; ?></td> <td style="text-align:center;"><?= $item->quantity; ?> Pcs</td> <td style="text-align:center;">IDR <?= number_format($real_price); ?></td> <td style="text-align:center;"> <?php // Jika ada voucher yang diredem if (!empty($order->redeemed_voucher_code)) { // Hitung proporsi diskon untuk item ini $proportion = ($item->quantity * $real_price) / $total_items_price; $item_discount = $order->redeemed_voucher_amount * $proportion; // Tampilkan diskon dengan detail voucher echo "IDR " . number_format($item_discount); // Tambahkan informasi tipe voucher // if ($order->redeemed_voucher_type == 'percentage') { // echo " (" . $order->redeemed_voucher_value . "%)"; // } else { // echo " (" . $order->redeemed_voucher_code . ")"; // } } else { // Jika tidak ada voucher, gunakan selisih harga real dan harga item echo "IDR " . number_format($real_price - $item->item_price); } ?> </td> <td style="text-align:center;"> <?php // Jika ada voucher yang diredem if (!empty($order->redeemed_voucher_code)) { // Hitung proporsi diskon untuk item ini $proportion = ($item->quantity * $real_price) / $total_items_price; $item_discount = $order->redeemed_voucher_amount * $proportion; // Hitung subtotal setelah diskon voucher $subtotal_after_discount = ($real_price * $item->quantity) - $item_discount; echo "IDR " . number_format($subtotal_after_discount); } else { // Jika tidak ada voucher, gunakan item->subtotal seperti biasa echo "IDR " . number_format($item->subtotal); } ?> </td> </tr> <?php $total_amount = $total_amount + ($item->item_price * $item->quantity); // Check if 7 items have been displayed and the footer has not been inserted yet if ($count % 7 == 0 && !$footer_inserted) { // Insert footer after every 7 items $footer_inserted = true; // Set the flag to true after insertion ?> </table> <!-- Close table --> <br><br> <div style="position: auto; top:875px; width: 100%"> <table> <tr> <td style="text-align:center"> <img style="text-align:center; max-width:120px" src="<?= $lokasiFile; ?>" /> </td> </tr> </table> <table> <tr> <td style="color:#EC6434;text-align:center;font-size:16px;"><b>Thank you for your business, it is our pleasure</b></td> </tr> <tr> <td style="text-align:center; font-size:14px;"><span style="color:#EC6434;">P/ +62 21 2290 8396</span> <span style="margin-left: 10px; color:#EC6434;">E/ <span style="color:#EC6434;">asmara@angsana-asmara.com </span></span> <br><span style="margin-left: 10px;">www.angsana-asmara.com</span></td> </tr> </table> </div> <table class="bordered" style="margin-top: 30px;"> <!-- Reopen table for next set of items --> <?php } // End if endforeach; ?> </table> <table style="margin-top: 20px;"> <tr> <td style="width: 140px"><b>Total</b></td> <td>: IDR <?= number_format($order->total_amount); ?></td> </tr> <tr> <td>Shipping Fee</td> <td>: IDR <?= number_format($order->shipping_fee); ?></td> </tr> <?php if ($order->insurance_status == 'Yes') : ?> <tr> <td>Shipping Insurance</td> <td>: IDR <?= number_format($order->insurance_cost); ?></td> </tr> <?php endif; ?> <?php if (!empty($order->redeemed_voucher_code)) : ?> <tr> <td>Voucher Discount (<?= $order->redeemed_voucher_code ?>)</td> <td>: -IDR <?= number_format($order->redeemed_voucher_amount); ?></td> </tr> <?php endif; ?> <?php if ($order->minus_reward > 0) : ?> <tr> <?php $reseller_id = $this->db->select('reseller_id')->from('customers')->where('id_customers', $order->customer_id)->get()->row()->reseller_id; if ($reseller_id == NULL) : ?> <td>Redemeed Reward Points (<?= $order->minus_reward; ?> points)</td> <?php else : ?> <td>Credit </td> <?php endif; ?> <td>: -IDR <?= number_format($order->minus_reward_amount); ?></td> </tr> <?php endif; ?> <tr> <td><b>Grand Total</b></td> <td>: IDR <?= number_format($order->grand_total_amount) ?></td> </tr> </table> <div style="position: absolute; top:875px; width: 100%"> <table> <tr> <td style="text-align:center"> <img style="text-align:center; max-width:120px" src="<?= $lokasiFile; ?>" /> </td> </tr> </table> <table> <tr> <td style="color:#EC6434;text-align:center;font-size:16px;"><b>Thank you for your business, it is our pleasure</b> </td> </tr> <tr> <td style="text-align:center; font-size:14px;"><span style="color:#EC6434;">P/ +62 21 2290 8396</span> <span style="margin-left: 10px; color:#EC6434;">E/ <span style="color:#EC6434;">asmara@angsana-asmara.com </span></span> <br><span style="margin-left: 10px;">www.angsana-asmara.com</span></td> </tr> </table> </div> </body> </html>