static function tax_label($data = array()) { $general_options = wc2_get_option('general'); if (is_array($data) && array_key_exists('order_condition', $data)) { $condition = maybe_unserialize($data['order_condition']); $tax_mode = isset($condition['tax_mode']) ? $condition['tax_mode'] : $general_options['tax_mode']; } else { $tax_mode = $general_options['tax_mode']; } if ('exclude' == $tax_mode) { $label = __('Consumption tax', 'wc2'); } else { if (isset($condition['tax_mode']) && !empty($data['ID'])) { $materials = array('total_price' => $data['item_total_price'], 'discount' => $data['discount'], 'shipping_charge' => $data['shipping_charge'], 'cod_fee' => $data['cod_fee']); $label = __('Internal consumption tax', 'wc2') . '(' . wc2_crform(wc2_internal_tax($materials), true, false, true) . ')'; } else { $label = __('Internal consumption tax', 'wc2'); } } $label = apply_filters('wc2_filter_tax_label', $label, $tax_mode); return $label; }
public function pdfSetFooter($pdf, $data) { global $wc2; $wc2_options = wc2_get_option(); $font = $this->font; $border = 0; list($fontsize, $lineheight, $linetop) = $this->set_font_size(9); $pdf->SetFont($font, '', $fontsize); // Body label $pdf->SetXY(15.5, 94.90000000000001); $pdf->MultiCell(87.8, $lineheight, $this->conv_enc(__('Item name', 'wc2')), $border, 'C'); $pdf->SetXY(103.7, 94.90000000000001); $pdf->MultiCell(11.4, $lineheight, $this->conv_enc(__('Quantity', 'wc2')), $border, 'C'); $pdf->SetXY(115.8, 94.90000000000001); $pdf->MultiCell(11.0, $lineheight, $this->conv_enc(__('Unit', 'wc2')), $border, 'C'); $pdf->SetXY(127.2, 94.90000000000001); $pdf->MultiCell(15.0, $lineheight, $this->conv_enc(__('Price', 'wc2')), $border, 'C'); $pdf->SetXY(142.9, 94.90000000000001); $pdf->MultiCell(22.4, $lineheight, $this->conv_enc(__('Amount', 'wc2') . '(' . __(wc2_crcode(), 'wc2') . ')'), $border, 'C'); // Footer label $labeldata = array('order_condition' => $data['order_condition'], 'order_item_total_price' => $data['item_total_price'], 'order_discount' => $data['discount'], 'order_shipping_charge' => $data['shipping_charge'], 'order_cod_fee' => $data['cod_fee']); $pdf->SetXY(104.3, 198.8); $pdf->MultiCell(37.7, $lineheight, $this->conv_enc(__('Total amount of items', 'wc2')), $border, 'C'); $pdf->SetXY(104.3, 204.8); $pdf->MultiCell(37.7, $lineheight, $this->conv_enc(apply_filters('wc2_filter_discount_label', __('Discount', 'wc2'), $data)), $border, 'C'); if ('products' == wc2_get_tax_target()) { $data_1 = apply_filters('wc2_filter_tax_label', wc2_tax_label($labeldata)); $data_2 = apply_filters('wc2_filter_shipping_label', __('Shipping charges', 'wc2')); $data_3 = apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2')); } else { $data_1 = apply_filters('wc2_filter_shipping_label', __('Shipping charges', 'wc2')); $data_2 = apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2')); $data_3 = apply_filters('wc2_filter_tax_label', wc2_tax_label($labeldata)); } $pdf->SetXY(104.3, 210.8); $pdf->MultiCell(37.7, $lineheight, $this->conv_enc($data_1), $border, 'C'); $pdf->SetXY(104.3, 216.7); $pdf->MultiCell(37.7, $lineheight, $this->conv_enc($data_2), $border, 'C'); $pdf->SetXY(104.3, 222.7); $pdf->MultiCell(37.7, $lineheight, $this->conv_enc($data_3), $border, 'C'); if (wc2_is_membersystem_point()) { $pdf->SetXY(104.3, 228.6); $pdf->MultiCell(37.7, $lineheight, $this->conv_enc(apply_filters('wc2_filter_point_label', __('Used points', 'wc2'))), $border, 'C'); $pdf->SetXY(104.3, 235.8); $pdf->MultiCell(37.77, $lineheight, $this->conv_enc(__('Total Amount', 'wc2')), $border, 'C'); } else { $pdf->SetXY(104.3, 235.8); $pdf->MultiCell(37.77, $lineheight * 2, $this->conv_enc(__('Total Amount', 'wc2')), $border, 'C'); } list($fontsize, $lineheight, $linetop) = $this->set_font_size(8); $pdf->SetFont($font, '', $fontsize); // Footer value $payment = wc2_get_payment($data['payment_method']); $transfers = apply_filters('wc2_filter_pdf_transfer', array('BT'), $data); if ('invoice' == $_REQUEST['type'] && in_array($payment['settlement'], $transfers)) { $transferee = __('Transfer', 'wc2') . " : \r\n"; $transferee .= wc2_get_option('transferee_info') . "\r\n"; $note_text = apply_filters('wc2_filter_mail_transferee', $transferee, $data, 'pdf', $payment); } else { $note_text = $data['note']; } $pdf->SetXY(16.1, 198.8); $pdf->MultiCell(86.59999999999999, $lineheight, $this->conv_enc(apply_filters('wc2_filter_pdf_note', $note_text, $data, $_REQUEST['type'])), $border, 'J'); list($fontsize, $lineheight, $linetop) = $this->set_font_size(9); $pdf->SetFont($font, '', $fontsize); $pdf->SetXY(142.9, 198.8); $total_price = $data['item_total_price'] - $data['usedpoint'] + $data['discount'] + $data['shipping_charge'] + $data['cod_fee'] + $data['tax']; $pdf->MultiCell(22.6, $lineheight, wc2_get_currency($data['item_total_price']), $border, 'R'); $materials = array('total_price' => $data['item_total_price'], 'discount' => $data['discount'], 'shipping_charge' => $data['shipping_charge'], 'cod_fee' => $data['cod_fee']); if ('include' == $wc2_options['general']['tax_mode']) { $tax = '(' . wc2_internal_tax($materials) . ')'; } else { $tax = wc2_get_currency($data['tax']); } if ('products' == wc2_get_tax_target()) { $datav_1 = apply_filters('wc2_filter_tax_value', $tax, $data); $datav_2 = apply_filters('wc2_filter_shipping_value', wc2_get_currency($data['shipping_charge']), $data); $datav_3 = apply_filters('wc2_filter_cod_value', wc2_get_currency($data['cod_fee']), $data); } else { $datav_1 = apply_filters('wc2_filter_shipping_value', wc2_get_currency($data['shipping_charge']), $data); $datav_2 = apply_filters('wc2_filter_cod_value', wc2_get_currency($data['cod_fee']), $data); $datav_3 = apply_filters('wc2_filter_tax_value', $tax, $data); } $pdf->SetXY(142.9, 204.8); $pdf->MultiCell(22.6, $lineheight, $this->conv_enc(apply_filters('wc2_filter_discount_value', wc2_get_currency($data['discount']), $data)), $border, 'R'); $pdf->SetXY(142.9, 210.8); $pdf->MultiCell(22.6, $lineheight, $this->conv_enc($datav_1), $border, 'R'); $pdf->SetXY(142.9, 216.7); $pdf->MultiCell(22.6, $lineheight, $this->conv_enc($datav_2), $border, 'R'); $pdf->SetXY(142.9, 222.7); $pdf->MultiCell(22.6, $lineheight, $this->conv_enc($datav_3), $border, 'R'); if (wc2_is_membersystem_point()) { $pdf->SetXY(142.9, 228.6); $pdf->MultiCell(22.6, $lineheight, $this->conv_enc(apply_filters('wc2_filter_point_value', wc2_get_currency($data['usedpoint']), $data)), $border, 'R'); $pdf->SetXY(142.9, 235.8); $pdf->MultiCell(22.67, $lineheight, $this->conv_enc(wc2_get_currency($total_price)), $border, 'R'); } else { $pdf->SetXY(142.9, 235.8); $pdf->MultiCell(22.67, $lineheight, $this->conv_enc(wc2_get_currency($total_price)), $border, 'R'); } do_action('wc2_action_order_print_footer', $pdf, $data); }
public function get_post_data() { $data = array(); $data[ORDER_MEMBER_ID] = isset($_POST['member_id']) ? $_POST['member_id'] : ''; $data[ORDER_EMAIL] = isset($_POST['customer']['email']) ? $_POST['customer']['email'] : ''; $data[ORDER_NAME1] = isset($_POST['customer']['name1']) ? $_POST['customer']['name1'] : ''; $data[ORDER_NAME2] = isset($_POST['customer']['name2']) ? $_POST['customer']['name2'] : ''; $data[ORDER_NAME3] = isset($_POST['customer']['name3']) ? $_POST['customer']['name3'] : ''; $data[ORDER_NAME4] = isset($_POST['customer']['name4']) ? $_POST['customer']['name4'] : ''; $data[ORDER_COUNTRY] = isset($_POST['customer']['country']) ? $_POST['customer']['country'] : ''; $data[ORDER_ZIPCODE] = isset($_POST['customer']['zipcode']) ? $_POST['customer']['zipcode'] : ''; $data[ORDER_PREF] = isset($_POST['customer']['pref']) ? $_POST['customer']['pref'] : ''; $data[ORDER_ADDRESS1] = isset($_POST['customer']['address1']) ? $_POST['customer']['address1'] : ''; $data[ORDER_ADDRESS2] = isset($_POST['customer']['address2']) ? $_POST['customer']['address2'] : ''; $data[ORDER_TEL] = isset($_POST['customer']['tel']) ? $_POST['customer']['tel'] : ''; $data[ORDER_FAX] = isset($_POST['customer']['fax']) ? $_POST['customer']['fax'] : ''; $data[ORDER_NOTE] = isset($_POST['offer']['note']) ? $_POST['offer']['note'] : ''; $data[ORDER_DELIVERY_METHOD] = isset($_POST['offer']['delivery_method']) ? $_POST['offer']['delivery_method'] : -1; $data[ORDER_DELIVERY_NAME] = isset($_POST['offer']['delivery_name']) ? $_POST['offer']['delivery_name'] : ''; $data[ORDER_DELIVERY_DATE] = isset($_POST['offer']['delivery_date']) ? $_POST['offer']['delivery_date'] : ''; $data[ORDER_DELIVERY_TIME] = isset($_POST['offer']['delivery_time']) ? $_POST['offer']['delivery_time'] : ''; $data[ORDER_DELIDUE_DATE] = isset($_POST['offer']['delidue_date']) ? $_POST['offer']['delidue_date'] : ''; $data[ORDER_PAYMENT_METHOD] = isset($_POST['offer']['payment_method']) ? $_POST['offer']['payment_method'] : -1; $data[ORDER_PAYMENT_NAME] = isset($_POST['offer']['payment_name']) ? $_POST['offer']['payment_name'] : ''; $data[ORDER_CONDITION] = isset($_POST['order_id']) ? wc2_get_order_data_value($_POST['order_id'], 'order_condition') : serialize(wc2_get_condition()); $data[ORDER_ITEM_TOTAL_PRICE] = isset($_POST['offer']['item_total_price']) ? $_POST['offer']['item_total_price'] : 0; $data[ORDER_GETPOINT] = isset($_POST['offer']['getpoint']) ? $_POST['offer']['getpoint'] : 0; $data[ORDER_USEDPOINT] = isset($_POST['offer']['usedpoint']) ? $_POST['offer']['usedpoint'] : 0; $data[ORDER_DISCOUNT] = isset($_POST['offer']['discount']) ? $_POST['offer']['discount'] : 0; $data[ORDER_SHIPPING_CHARGE] = isset($_POST['offer']['shipping_charge']) ? $_POST['offer']['shipping_charge'] : 0; $data[ORDER_COD_FEE] = isset($_POST['offer']['cod_fee']) ? $_POST['offer']['cod_fee'] : 0; $data[ORDER_TAX] = isset($_POST['offer']['tax']) ? $_POST['offer']['tax'] : 0; $data[ORDER_DATE] = isset($_POST['order_date']) ? $_POST['order_date'] : ''; $data[ORDER_MODIFIED] = isset($_POST['modified']) ? $_POST['modified'] : ''; $data[ORDER_STATUS] = isset($_POST['offer']['order_status']) ? $_POST['offer']['order_status'] : ''; $data[RECEIPT_STATUS] = isset($_POST['offer']['receipt_status']) ? $_POST['offer']['receipt_status'] : ''; $data[RECEIPTED_DATE] = isset($_POST['offer']['receipted_date']) ? $_POST['offer']['receipted_date'] : ''; $data[ORDER_TYPE] = isset($_POST['offer']['order_type']) ? $_POST['offer']['order_type'] : 'adminorder'; $data[ORDER_CHECK] = isset($_POST['order_id']) ? wc2_get_order_data_value($_POST['order_id'], 'order_check') : serialize(array()); $data['meta_key'][ORDER_MEMO] = isset($_POST['order_memo']) ? $_POST['order_memo'] : ''; //Custom Customer $cscs_keys = wc2_get_custom_field_keys(WC2_CSCS); if (!empty($cscs_keys) && is_array($cscs_keys)) { foreach ($cscs_keys as $key) { list($pfx, $cscs_key) = explode('_', $key, 2); if (array_key_exists(WC2_CUSTOM_CUSTOMER, $_POST) and array_key_exists($cscs_key, $_POST[WC2_CUSTOM_CUSTOMER])) { if (is_array($_POST[WC2_CUSTOM_CUSTOMER][$cscs_key])) { $data[WC2_CUSTOM_CUSTOMER][$cscs_key] = serialize($_POST[WC2_CUSTOM_CUSTOMER][$cscs_key]); } else { $data[WC2_CUSTOM_CUSTOMER][$cscs_key] = $_POST[WC2_CUSTOM_CUSTOMER][$cscs_key]; } } else { $data[WC2_CUSTOM_CUSTOMER][$cscs_key] = ''; } } } //Custom Order $csod_keys = wc2_get_custom_field_keys(WC2_CSOD); if (!empty($csod_keys) && is_array($csod_keys)) { foreach ($csod_keys as $key) { list($pfx, $csod_key) = explode('_', $key, 2); if (array_key_exists(WC2_CUSTOM_ORDER, $_POST) and array_key_exists($csod_key, $_POST[WC2_CUSTOM_ORDER])) { if (is_array($_POST[WC2_CUSTOM_ORDER][$csod_key])) { $data[WC2_CUSTOM_ORDER][$csod_key] = serialize($_POST[WC2_CUSTOM_ORDER][$csod_key]); } else { $data[WC2_CUSTOM_ORDER][$csod_key] = $_POST[WC2_CUSTOM_ORDER][$csod_key]; } } else { $data[WC2_CUSTOM_ORDER][$csod_key] = ''; } } } //Cart $data[ORDER_CART] = array(); if (array_key_exists('cart_id', $_POST)) { $general_options = wc2_get_option('general'); foreach ((array) $_POST['cart_id'] as $cart_id) { $post_id = isset($_POST['cart_post_id'][$cart_id]) ? $_POST['cart_post_id'][$cart_id] : 0; $item_id = isset($_POST['item_id'][$cart_id]) ? $_POST['item_id'][$cart_id] : 0; $sku_id = isset($_POST['sku_id'][$cart_id]) ? $_POST['sku_id'][$cart_id] : 0; $quantity = isset($_POST['quantity'][$cart_id]) ? $_POST['quantity'][$cart_id] : 1; $price = isset($_POST['sku_price'][$cart_id]) ? $_POST['sku_price'][$cart_id] : 0; $row_index = isset($_POST['row_index'][$cart_id]) ? $_POST['row_index'][$cart_id] : 1; $meta_type = isset($_POST['meta_type'][$cart_id]) ? $_POST['meta_type'][$cart_id] : array(); $meta_key = isset($_POST['meta_key'][$cart_id]) ? $_POST['meta_key'][$cart_id] : array(); if (empty($general_options['tax_rate'])) { $tax = 0; } else { $materials = array('total_price' => $price * $quantity, 'discount' => 0, 'shipping_charge' => 0, 'cod_fee' => 0); $tax = wc2_internal_tax($materials); } $order_cart_data = wc2_get_order_cart_data($_POST['order_id'], $cart_id); $cart_data = array_shift($order_cart_data); $data[ORDER_CART][$row_index][ORDER_CART_ID] = $cart_id; $data[ORDER_CART][$row_index][ORDER_CART_GROUP_ID] = 0; $data[ORDER_CART][$row_index][ORDER_CART_ROW_INDEX] = $row_index; $data[ORDER_CART][$row_index][ORDER_CART_POST_ID] = $post_id; $data[ORDER_CART][$row_index][ORDER_CART_ITEM_ID] = $item_id; $data[ORDER_CART][$row_index][ORDER_CART_ITEM_CODE] = $cart_data[ORDER_CART_ITEM_CODE]; $data[ORDER_CART][$row_index][ORDER_CART_ITEM_NAME] = $cart_data[ORDER_CART_ITEM_NAME]; $data[ORDER_CART][$row_index][ORDER_CART_SKU_ID] = $sku_id; $data[ORDER_CART][$row_index][ORDER_CART_SKU_CODE] = $cart_data[ORDER_CART_SKU_CODE]; $data[ORDER_CART][$row_index][ORDER_CART_SKU_NAME] = $cart_data[ORDER_CART_SKU_NAME]; $data[ORDER_CART][$row_index][ORDER_CART_PRICE] = $price; $data[ORDER_CART][$row_index][ORDER_CART_CPRICE] = $cart_data[ORDER_CART_CPRICE]; $data[ORDER_CART][$row_index][ORDER_CART_QUANTITY] = $quantity; $data[ORDER_CART][$row_index][ORDER_CART_UNIT] = $cart_data[ORDER_CART_UNIT]; $data[ORDER_CART][$row_index][ORDER_CART_TAX] = $tax; //$data[ORDER_CART][$row_index][ORDER_CART_DESTINATION_ID] = 0; $data[ORDER_CART][$row_index][ORDER_CART_META_TYPE] = maybe_unserialize($meta_type); $data[ORDER_CART][$row_index][ORDER_CART_META_KEY] = maybe_unserialize($meta_key); } } //Delivery $data[ORDER_DELIVERY] = array(); $data[ORDER_DELIVERY][0][ORDER_DELIVERY_ID] = isset($_POST['delivery']['deli_id']) ? $_POST['delivery']['deli_id'] : 0; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_ROW_INDEX] = 0; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_NAME1] = isset($_POST['delivery']['name1']) ? $_POST['delivery']['name1'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_NAME2] = isset($_POST['delivery']['name2']) ? $_POST['delivery']['name2'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_NAME3] = isset($_POST['delivery']['name3']) ? $_POST['delivery']['name3'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_NAME4] = isset($_POST['delivery']['name4']) ? $_POST['delivery']['name4'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_COUNTRY] = isset($_POST['delivery']['country']) ? $_POST['delivery']['country'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_ZIPCODE] = isset($_POST['delivery']['zipcode']) ? $_POST['delivery']['zipcode'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_PREF] = isset($_POST['delivery']['pref']) ? $_POST['delivery']['pref'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_ADDRESS1] = isset($_POST['delivery']['address1']) ? $_POST['delivery']['address1'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_ADDRESS2] = isset($_POST['delivery']['address2']) ? $_POST['delivery']['address2'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_TEL] = isset($_POST['delivery']['tel']) ? $_POST['delivery']['tel'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_FAX] = isset($_POST['delivery']['fax']) ? $_POST['delivery']['fax'] : ''; $data[ORDER_DELIVERY][0][ORDER_DELIVERY_META_TYPE] = isset($_POST['delivery']['meta_type']) ? $_POST['delivery']['meta_type'] : array(); $data[ORDER_DELIVERY][0][ORDER_DELIVERY_META_KEY] = isset($_POST['delivery']['meta_type']) ? $_POST['delivery']['meta_type'] : array(); //Custom Delivery $csde_keys = wc2_get_custom_field_keys(WC2_CSDE); if (!empty($csde_keys) && is_array($csde_keys)) { foreach ($csde_keys as $key) { list($pfx, $csde_key) = explode('_', $key, 2); if (array_key_exists(WC2_CUSTOM_DELIVERY, $_POST) and array_key_exists($csde_key, $_POST[WC2_CUSTOM_DELIVERY])) { if (is_array($_POST[WC2_CUSTOM_DELIVERY][$csde_key])) { $data[ORDER_DELIVERY][0][WC2_CUSTOM_DELIVERY][$csde_key] = serialize($_POST[WC2_CUSTOM_DELIVERY][$csde_key]); } else { $data[ORDER_DELIVERY][0][WC2_CUSTOM_DELIVERY][$csde_key] = $_POST[WC2_CUSTOM_DELIVERY][$csde_key]; } } else { $data[ORDER_DELIVERY][0][WC2_CUSTOM_DELIVERY][$csde_key] = ''; } } } $data = apply_filters('wc2_filter_admin_order_get_post_data', $data); //wc2_log(print_r($data,true),"test.log"); return $data; }