function sm_woo_get_packing_slip($purchase_ids, $purchase_id_arr) { if (!empty($purchase_ids) && !empty($purchase_id_arr)) { ?> <style type="text/css"> body { font-family:"Helvetica Neue", Helvetica, Arial, Verdana, sans-serif; } h1 span { font-size:0.75em; } h2 { color: #333; } .no-page-break { page-break-after: avoid; } #wrapper { margin:0 auto; width:95%; page-break-after: always; } #wrapper_last { margin:0 auto; width:95%; page-break-after: avoid; } .address{ width:98%; border-top:1px; border-right:1px; margin:1em auto; border-collapse:collapse; } .address_border{ border-bottom:1px; border-left:1px ; padding:.2em 1em; text-align:left; } table { width:98%; border-top:1px solid #e5eff8; border-right:1px solid #e5eff8; margin:1em auto; border-collapse:collapse; font-size:10pt; } td { border-bottom:1px solid #e5eff8; border-left:1px solid #e5eff8; padding:.3em 1em; text-align:center; } tr.odd td, tr.odd .column1 { background:#f4f9fe url(background.gif) no-repeat; } .column1 { background:#f4f9fe; } thead th { background:#f4f9fe; text-align:center; font:bold 1.2em/2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif; } .datagrid { position: relative; top:-30pt; } .producthead{ text-align: left; } .pricehead{ text-align: right; } .sm_address_div{ position: relative; left:28pt; } .sm_email_span{ position: relative; left:10pt; } </style> <?php $counter = 0; foreach ($purchase_id_arr as $purchase_id_value) { $order = new WC_Order($purchase_id_value); $date_format = get_option('date_format'); if (is_plugin_active('woocommerce-sequential-order-numbers-pro/woocommerce-sequential-order-numbers.php')) { $purchase_display_id = isset($order->order_custom_fields['_order_number_formatted'][0]) ? $order->order_custom_fields['_order_number_formatted'][0] : $purchase_id_value; } else { $purchase_display_id = $purchase_id_value; } $counter++; if (count($purchase_id_arr) == $counter) { echo '<div id="wrapper_last">'; } else { echo '<div id="wrapper">'; } echo smart_manager_print_logo(); echo '<div style="margin-top:-0.8em;">'; echo '<h4 style="font:bold 1.2em/2em "Century Gothic","Trebuchet MS",Arial,Helvetica,sans-serif; position:relative; 12pt;"> ' . get_bloginfo('name') . '</h4>'; echo '<table class="address" style="position:relative; top:-22pt; left:-35pt;">'; echo '<tr><td class="address_border" colspan="2" valign="top" width="50%"><span style="position:relative; left:27pt; top:10pt;"> <b>Order # ' . $purchase_display_id . ' - ' . date($date_format, strtotime($order->order_date)) . '</b></span><br/></td></tr>'; echo '<tr><td class="address_border" width="35%" align="center"><br/><div class="sm_address_div">'; $formatted_billing_address = $order->get_formatted_billing_address(); if ($formatted_billing_address != '') { echo '<b>' . __('Billing Address', 'smart-manager') . '</b><p>'; echo $formatted_billing_address; echo '</p></td>'; } $formatted_shipping_address = $order->get_formatted_shipping_address(); if ($formatted_shipping_address != '') { echo '<td class="address_border" width="30%"><br/><div style="position:relative; top:3pt;"><b>' . __('Shipping Address', 'smart-manager') . '</b><p>'; echo $formatted_shipping_address; echo '</p></div></td>'; } echo '</tr>'; echo '<tr><td colspan="2" class="address_border"><span class="sm_email_span"><table class="address"><tr><td colspan="2" class="address_border" > <b>' . __('Email id', 'smart-manager') . ':</b> ' . $order->billing_email . '</td></tr> <tr><td class="address_border"><b>' . __('Tel', 'smart-manager') . ' :</b> ' . $order->billing_phone . '</td></tr></table> </span></td></tr>'; echo '</table>'; echo '<div class="datagrid"><table><tr class="column1"> <td class="producthead">' . __('Product', 'smart-manager') . '</td><td>' . __('SKU', 'smart-manager') . '</td> <td>' . __('Quantity', 'smart-manager') . '</td><td class="pricehead">' . __('Price', 'smart-manager') . '</td></tr>'; foreach ($order->get_items() as $item) { $_product = $order->get_product_from_item($item); $sku = $variation = ''; $sku = $_product->get_sku(); $formatted_variation = woocommerce_get_formatted_variation($_product->variation_data, true); $variation = !empty($formatted_variation) ? ' (' . $formatted_variation . ')' : ''; $item_total = $_product->get_price() * $item['item_meta']['_qty'][0]; $total_order += $item_total; echo '<tr><td class="producthead">'; echo $item['name'] . $variation; echo '</td><td>' . $sku . '</td><td>'; echo $item['item_meta']['_qty'][0]; echo '</td><td class="pricehead">'; echo woocommerce_price($item_total); echo '</td></tr>'; } echo '<tr><td colspan="2" rowspan="5" class="address_border" valign="top"><br/> <i>' . ($order->customer_note != '' ? __('Order Notes', 'smart-manager') . ' : ' . $order->customer_note : '') . '</i></td><td style="text-align:right;" class="address_border" valign="top"> <b>Subtotal </b></td><td class="pricehead">' . $order->get_subtotal_to_display() . '</td></tr>'; echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Shipping', 'smart-manager') . ' </b></td><td class="pricehead">' . $order->get_shipping_to_display() . '</td></tr>'; if ($order->cart_discount > 0) { echo '<tr><td style="text-align:right;" class="address_border">' . __('Cart Discount', 'smart-manager') . '</td><td style="text-align:right;">'; echo woocommerce_price($order->cart_discount); echo '</td></tr>'; } if ($order->order_discount > 0) { echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Order Discount', 'smart-manager') . ' </b></td>'; echo '<td class="pricehead">' . woocommerce_price($order->order_discount) . '</td></tr>'; } echo '<tr><td style="text-align:right;" class="address_border"><b>' . __('Tax', 'smart-manager') . ' </b></td><td class="pricehead">' . woocommerce_price($order->get_total_tax()) . '</td></tr>'; echo '<tr><td class="column1" style="text-align:right;"><b>' . __('Total', 'smart-manager') . ' </b></td><td class="column1" style="text-align:right;">' . woocommerce_price($order->order_total) . ' -via ' . $order->payment_method_title . '</td></tr>'; echo '</table></div></div></div>'; } } exit; }
function get_packing_slip($purchase_ids, $purchase_id_arr) { global $purchlogitem; if (!empty($purchase_ids) && !empty($purchase_id_arr)) { ?> <style type="text/css"> body { font-family:"Helvetica Neue", Helvetica, Arial, Verdana, sans-serif; } h1 span { font-size:0.75em; } h2 { color: #333; } #wrapper { margin:0 auto; width:95%; page-break-after: always; } #header { } #customer { overflow:hidden; } #customer .shipping, #customer .billing { float: left; width: 50%; } table { border:1px solid #000; border-collapse:collapse; margin-top:1em; width:100%; } th { background-color:#efefef; text-align:center; } th, td { padding:5px; } td { text-align:center; } #cart-items td.amount { text-align:right; } td, tbody th { border-top:1px solid #ccc; } th.column-total { width:90px; } th.column-shipping { width:120px; } th.column-price { width:100px; } </style> <?php if (!class_exists('wpsc_purchaselogs_items')) { require_once WP_PLUGIN_DIR . '/wp-e-commerce/wpsc-includes/purchaselogs.class.php'; } foreach ($purchase_id_arr as $purchase_id_value) { $purchlogitem = new wpsc_purchaselogs_items((int) $purchase_id_value); ?> <div id="wrapper"> <?php echo smart_manager_print_logo(); ?> <div id="header" style="margin-top:-0.8em;"> <h1> <?php echo get_bloginfo('name'); ?> <br /> <span><?php printf(esc_html__('Packing Slip for Order #%s', 'wpsc'), $purchase_id_value); ?> </span> </h1> </div> <div id="customer"> <div class="shipping"> <h2><?php echo esc_html_x('Ship To:', 'packing slip', 'wpsc'); ?> </h2> <strong><?php echo wpsc_display_purchlog_shipping_name(); ?> </strong><br /> <?php echo wpsc_display_purchlog_shipping_address(); ?> <br /> <?php echo wpsc_display_purchlog_shipping_city(); ?> <br /> <?php echo wpsc_display_purchlog_shipping_state_and_postcode(); ?> <br /> <?php echo wpsc_display_purchlog_shipping_country(); ?> <br /> </div> <div class="billing"> <h2><?php echo esc_html_x('Bill To:', 'packing slip', 'wpsc'); ?> </h2> <strong><?php echo wpsc_display_purchlog_buyers_name(); ?> </strong><br /> <?php echo wpsc_display_purchlog_buyers_address(); ?> <br /> <?php echo wpsc_display_purchlog_buyers_city(); ?> <br /> <?php echo wpsc_display_purchlog_buyers_state_and_postcode(); ?> <br /> <?php echo wpsc_display_purchlog_buyers_country(); ?> <br /> </div> </div> <table id="order"> <thead> <tr> <th><?php echo esc_html_x('Order Date', 'packing slip', 'wpsc'); ?> </th> <th><?php echo esc_html_x('Order ID', 'packing slip', 'wpsc'); ?> </th> <th><?php echo esc_html_x('Shipping Method', 'packing slip', 'wpsc'); ?> </th> <th><?php echo esc_html_x('Payment Method', 'packing slip', 'wpsc'); ?> </th> </tr> </thead> <tbody> <tr> <td><?php echo wpsc_purchaselog_details_date(); ?> </td> <td><?php echo wpsc_purchaselog_details_purchnumber(); ?> </td> <td><?php echo wpsc_display_purchlog_shipping_method(); ?> </td> <td><?php echo wpsc_display_purchlog_paymentmethod(); ?> </td> </tr> </tbody> </table> <table id="cart-items" class="widefat" cellspacing="0"> <thead> <tr> <th scope='col' id='title' class='manage-column column-title' style=""><?php _e('Item Name', 'wpsc'); ?> </th> <th scope='col' id='sku' class='manage-column column-sku' style=""><?php _e('SKU', 'wpsc'); ?> </th> <th scope='col' id='quantity' class='manage-column column-quantity' style=""><?php _e('Quantity', 'wpsc'); ?> </th> <th scope='col' id='price' class='manage-column column-price' style=""><?php _e('Price', 'wpsc'); ?> </th> <th scope='col' id='shipping' class='manage-column column-shipping' style=""><?php _e('Item Shipping', 'wpsc'); ?> </th> <th scope='col' id='tax' class='manage-column column-tax' style=""><?php _e('Item Tax', 'wpsc'); ?> </th> <th scope='col' id='total' class='manage-column column-total' style=""><?php _e('Item Total', 'wpsc'); ?> </th> <?php $cols = 5; // this is counted as ( count of th - 2 ) ?> </tr> </thead> <tbody> <?php while (wpsc_have_purchaselog_details()) { wpsc_the_purchaselog_item(); ?> <tr> <td><?php echo wpsc_purchaselog_details_name(); ?> </td> <!-- NAME! --> <td><?php echo wpsc_purchaselog_details_SKU(); ?> </td> <!-- SKU! --> <td><?php echo wpsc_purchaselog_details_quantity(); ?> </td> <!-- QUANTITY! --> <td> <?php echo wpsc_currency_display(wpsc_purchaselog_details_price()); do_action('wpsc_additional_sales_amount_info', wpsc_purchaselog_details_id()); ?> </td> <!-- PRICE! --> <td><?php echo wpsc_currency_display(wpsc_purchaselog_details_shipping()); ?> </td> <!-- SHIPPING! --> <?php if (wpec_display_product_tax()) { ?> <td><?php echo wpsc_currency_display(wpsc_purchaselog_details_tax()); ?> </td> <!-- TAX! --> <?php } ?> <!-- <td><?php echo wpsc_currency_display(wpsc_purchaselog_details_discount()); ?> </td> --> <!-- DISCOUNT! --> <td class="amount"><?php echo wpsc_currency_display(wpsc_purchaselog_details_total()); ?> </td> <!-- TOTAL! --> </tr> <?php } ?> <tr class="wpsc_purchaselog_start_totals"> <td colspan="<?php echo $cols; ?> "> <?php if (wpsc_purchlog_has_discount_data()) { ?> <?php esc_html_e('Coupon Code', 'wpsc'); ?> : <?php echo wpsc_display_purchlog_discount_data(); ?> <?php } ?> </td> <th><?php esc_html_e('Discount', 'wpsc'); ?> </th> <td class="amount"><?php echo wpsc_display_purchlog_discount(); ?> </td> </tr> <?php if (!wpec_display_product_tax()) { ?> <tr> <td colspan='<?php echo $cols; ?> '></td> <th><?php esc_html_e('Taxes', 'wpsc'); ?> </th> <td class="amount"><?php echo wpsc_display_purchlog_taxes(); ?> </td> </tr> <?php } ?> <tr> <td colspan='<?php echo $cols; ?> '></td> <th><?php esc_html_e('Shipping', 'wpsc'); ?> </th> <td class="amount"><?php echo wpsc_display_purchlog_shipping(); ?> </td> </tr> <tr> <td colspan='<?php echo $cols; ?> '></td> <th><?php esc_html_e('Total', 'wpsc'); ?> </th> <td class="amount"><?php echo wpsc_display_purchlog_totalprice(); ?> </td> </tr> </tbody> </table> </div> <?php } exit; } }