Esempio n. 1
0
 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);
 }
Esempio n. 2
0
function wc2_ordermail($data, $send = 'order')
{
    $cart = $data['cart'];
    $payment = wc2_get_payment($data['payment_method']);
    $general_options = wc2_get_option('general');
    $total_price = $data['item_total_price'] - $data['usedpoint'] + $data['discount'] + $data['shipping_charge'] + $data['cod_fee'] + $data['tax'];
    $msg_body = "";
    if ($data['order_type'] == 'estimate') {
        $msg_top = "\r\n\r\n\r\n" . __('【お見積】', 'wc2') . "\r\n";
        $msg_top .= wc2_mail_line(1, $data['email']);
        //********************
        $msg_top .= apply_filters('wc2_filter_ordermail_first', "", $data, $payment, $send);
        $msg_top .= wc2_get_mail_addressform($data, 'customer');
        $msg_top .= __('お見積番号', 'wc2') . " : " . $data['order_id'] . "\r\n";
    } else {
        $msg_top = "\r\n\r\n\r\n" . __('【ご注文内容】', 'wc2') . "\r\n";
        $msg_top .= wc2_mail_line(1, $data['email']);
        //********************
        $msg_top .= apply_filters('wc2_filter_ordermail_first', "", $data, $payment, $send);
        $msg_top .= wc2_get_mail_addressform($data, 'customer');
        $msg_top .= __('Order number', 'wc2') . " : " . $data['dec_order_id'] . "\r\n";
        $msg_top .= __('注文日時', 'wc2') . " : " . $data['order_date'] . "\r\n";
    }
    $msg_top .= "\r\n";
    $msg_body = apply_filters('wc2_filter_ordermail_top', $msg_top, $data, $payment, $send);
    $msg_detail = __('Items', 'wc2') . "\r\n";
    foreach ($cart as $idx => $cart_row) {
        //		$item_id = $cart_row['item_id'];
        //		$sku_id = $cart_row['sku_id'];
        $item_name = $cart_row['item_name'];
        $item_code = $cart_row['item_code'];
        $sku_name = $cart_row['sku_name'];
        $sku_code = $cart_row['sku_code'];
        $cart_item_name = wc2_get_cart_item_name($item_name, $item_code, $sku_name, $sku_code);
        $cart_options = '';
        $msg_detail .= wc2_mail_line(2, $data['email']);
        //--------------------
        $msg_detail .= $cart_item_name . "\r\n";
        if (is_array($cart_options) && count($cart_options) > 0) {
            $optstr = '';
            foreach ($cart_options as $key => $value) {
                if (!empty($key)) {
                    $key = urldecode($key);
                    if (is_array($value)) {
                        $c = '';
                        $optstr .= $key . ' : ';
                        foreach ($value as $v) {
                            $optstr .= $c . urldecode($v);
                            $c = ', ';
                        }
                        $optstr .= "\r\n";
                    } else {
                        $optstr .= $key . ' : ' . urldecode($value) . "\r\n";
                    }
                }
            }
            $msg_detail .= apply_filters('wc2_filter_ordermail_cartrow_options', $optstr, $cart_options, $send);
        }
        $msg_detail .= __('単価', 'wc2') . " " . wc2_crform($cart_row['price'], true, false) . __(' * ', 'wc2') . $cart_row['quantity'] . "\r\n";
    }
    $msg_detail .= wc2_mail_line(3, $data['email']);
    //====================
    $msg_detail .= __('商品合計', 'wc2') . " : " . wc2_crform($data['item_total_price'], true, false) . "\r\n";
    if ($data['discount'] != 0) {
        $msg_detail .= apply_filters('wc2_filter_discount_label', __('値引', 'wc2'), $data['order_id']) . " : " . wc2_crform($data['discount'], true, false) . "\r\n";
    }
    if (0.0 < (double) $data['tax'] && 'products' == $general_options['tax_target']) {
        $msg_detail .= wc2_tax_label($data) . " : " . wc2_crform($data['tax'], true, false) . "\r\n";
    }
    $msg_detail .= __('送料', 'wc2') . " : " . wc2_crform($data['shipping_charge'], true, false) . "\r\n";
    if ($payment['settlement'] == 'COD') {
        $msg_detail .= apply_filters('wc2_filter_cod_label', __('COD fee', 'wc2')) . " : " . wc2_crform($data['cod_fee'], true, false) . "\r\n";
    }
    if (0.0 < (double) $data['tax'] && 'all' == $general_options['tax_target']) {
        $msg_detail .= wc2_tax_label($data) . " : " . wc2_crform($data['tax'], true, false) . "\r\n";
    }
    if ($data['usedpoint'] != 0) {
        $msg_detail .= __('ご利用ポイント', 'wc2') . " : " . number_format($data['usedpoint']) . __('ポイント', 'wc2') . "\r\n";
    }
    $msg_detail .= wc2_mail_line(2, $data['email']);
    //--------------------
    $msg_detail .= __('お支払金額', 'wc2') . " : " . wc2_crform($total_price, true, false) . "\r\n";
    $msg_detail .= wc2_mail_line(2, $data['email']);
    //--------------------
    $msg_detail .= "(" . __('Currency', 'wc2') . ' : ' . __(wc2_crcode(), 'wc2') . ")\r\n\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_detail', $msg_detail, $data, $payment, $send);
    $msg_shipping = __('【配送先】', 'wc2') . "\r\n";
    $msg_shipping .= wc2_mail_line(1, $data['email']);
    //********************
    $msg_shipping .= wc2_get_mail_addressform($data, 'delivery');
    $msg_shipping .= __('配送方法', 'wc2') . " : " . $data['delivery_name'] . "\r\n";
    $msg_shipping .= __('配送希望日', 'wc2') . " : " . $data['delivery_date'] . "\r\n";
    $msg_shipping .= __('配送希望時間', 'wc2') . " : " . $data['delivery_time'] . "\r\n";
    $msg_shipping .= "\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_shipping', $msg_shipping, $data, $payment, $send);
    $msg_payment = __('【お支払方法】', 'wc2') . "\r\n";
    $msg_payment .= wc2_mail_line(1, $data['email']);
    //********************
    $msg_payment .= $payment['name'] . wc2_payment_detail($data) . "\r\n\r\n";
    if ($payment['settlement'] == 'BT') {
        $transferee = __('お振込先', 'wc2') . " : \r\n";
        $transferee .= wc2_get_option('transferee_info') . "\r\n\r\n";
        $transferee .= wc2_mail_line(2, $data['email']) . "\r\n";
        //--------------------
        $msg_payment .= apply_filters('wc2_filter_mail_transferee', $transferee, $data, $payment, $send);
    }
    $msg_payment .= "\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_payment', $msg_payment, $data, $payment, $send);
    $msg_other = __('【その他】', 'wc2') . "\r\n";
    $msg_other .= wc2_mail_line(1, $data['email']);
    //********************
    $msg_other .= wc2_mail_custom_field_info($data, 'order', 'beforeremarks');
    $msg_other .= $data['note'] . "\r\n";
    $msg_other .= wc2_mail_custom_field_info($data, 'order', 'other');
    $msg_other .= "\r\n\r\n\r\n";
    $msg_body .= apply_filters('wc2_filter_ordermail_other', $msg_other, $data, $payment, $send);
    $msg_body = apply_filters('wc2_filter_ordermail_body', $msg_body, $data, $payment, $send);
    return $msg_body;
}