バージョン選択

フォーラム

メニュー

オンライン状況

50 人のユーザが現在オンラインです。 (42 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 50
もっと...

サイト内検索

質問 > その他 > インボイス対応に伴い消費税を表示したい

その他

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
zakey
投稿日時: 2023/5/11 10:27
対応状況: −−−
一人前
登録日: 2011/2/8
居住地: 兵庫県神戸市
投稿: 145
インボイス対応に伴い消費税を表示したい
▼テンプレート
[EC-CUBE] 2.13.5
[レンタルサーバ] Xサーバー
[PHP] PHP 5.6.40
[データベース] MySQL 5.7.16

[現象]
インボイス対応に伴い order_mail.tpl で表示してる合計金額に消費税を追加して表示したいです。

[現在]
----------
小計 ¥ 5,500(うち消費税 ¥500)
値引き ¥ 45
送料 ¥0
手数料 ¥0
=========
合計 ¥5,455

[希望]
----------
小計 ¥ 5,500(うち消費税 ¥500)
値引き ¥ 45
送料 ¥0
手数料 ¥0
=========
合計 ¥5,455(うち消費税 ¥495) ←追加

order_mail.tpl がどこからかデータを引っ張ってきてるのかと思うんですが、見つからずで。

よろしくお願いします。
yuh
投稿日時: 2023/5/11 10:35
対応状況: −−−
登録日: 2013/1/9
居住地: 大阪
投稿: 1818
Re: インボイス対応に伴い消費税を表示したい
SC_Helper_MailのsfSendOrderMailで処理しています。


----------------


http://ec-lab.net/

zakey
投稿日時: 2023/5/11 16:07
対応状況: −−−
一人前
登録日: 2011/2/8
居住地: 兵庫県神戸市
投稿: 145
Re: インボイス対応に伴い消費税を表示したい
ありがとうございます!見てみます!
zakey
投稿日時: 2023/5/11 16:57
対応状況: −−−
一人前
登録日: 2011/2/8
居住地: 兵庫県神戸市
投稿: 145
Re: インボイス対応に伴い消費税を表示したい
SC_Helper_Mailに

//インボイス追加
$arrTplVar->tax_payment = ($arrOrder['total'] - $arrOrder['tax'] - $arrOrder['use_point']) / 10;

と追加して order_mail.tpl に

<!--{$tax_payment}-->

を入れてみたんですが、何も表示されずでした。。。
取得の仕方が間違ってますでしょうか?
yuh
投稿日時: 2023/5/11 17:19
対応状況: −−−
登録日: 2013/1/9
居住地: 大阪
投稿: 1818
Re: インボイス対応に伴い消費税を表示したい
引用:
$arrTplVar->tax_payment = ($arrOrder['total'] - $arrOrder['tax'] - $arrOrder['use_point']) / 10;


この計算式の意味がちょっとよく分からないんですが、軽減税率の割合を計算しないのであれば

引用:

<!--{$arrOrder.tax}-->

でいいんじゃないでしょうか?

受注に対する税金はtaxに入っているので、8%・10%分けて表示させる必要が無いのであれば
$arrOrder['tax']
だけでいいとは思います。


----------------


http://ec-lab.net/

zakey
投稿日時: 2023/5/12 9:51
対応状況: −−−
一人前
登録日: 2011/2/8
居住地: 兵庫県神戸市
投稿: 145
Re: インボイス対応に伴い消費税を表示したい
消費税を課税扱いにしたいので、

(小計 - 消費税 - ポイント利用分) / 10

と計算して <!--{$arrOrder.tax}--> とは別で出力したいです。

例:5500円(消費税500円)
使用ポイント 45ポイント
(5500 - 500 - 45) / 10 = 495

yuh
投稿日時: 2023/5/12 10:32
対応状況: −−−
登録日: 2013/1/9
居住地: 大阪
投稿: 1818
Re: インボイス対応に伴い消費税を表示したい
引用:
$arrTplVar->tax_payment = intval(($arrOrder['total'] - $arrOrder['tax'] - $arrOrder['use_point']) / 10);

で正常に出力されたんですが、処理を書いた箇所は

引用:
$arrOrder = $objQuery->getRow('*', 'dtb_order', $where, array($order_id));

の後に書いてますか?


----------------


http://ec-lab.net/

zakey
投稿日時: 2023/5/12 18:09
対応状況: −−−
一人前
登録日: 2011/2/8
居住地: 兵庫県神戸市
投稿: 145
Re: インボイス対応に伴い消費税を表示したい
プラグインを使用していたので、別ファイルになるんですが、

引用:

<?php
/*
* ProductOptions
* Copyright (C) 2012 Bratech CO.,LTD. All Rights Reserved.
* http://wwww.bratech.co.jp/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

require_once PLUGIN_UPLOAD_REALDIR . "ProductOptions/plg_ProductOptions_Util.php";

class plg_ProductOptions_SC_Helper_Mail extends SC_Helper_Mail{

/* 受注完了メール送信 */
function sfSendOrderMail($order_id, $template_id, $subject = '', $header = '', $footer = '', $send = true) {
$arrTplVar = new stdClass();
$arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
$arrTplVar->arrInfo = $arrInfo;

$objQuery =& SC_Query_Ex::getSingletonInstance();

if ($subject == '' && $header == '' && $footer == '') {
// メールテンプレート情報の取得
$where = 'template_id = ?';
$arrRet = $objQuery->select('subject, header, footer', 'dtb_mailtemplate', $where, array($template_id));
$arrTplVar->tpl_header = $arrRet[0]['header'];
$arrTplVar->tpl_footer = $arrRet[0]['footer'];
$tmp_subject = $arrRet[0]['subject'];
} else {
$arrTplVar->tpl_header = $header;
$arrTplVar->tpl_footer = $footer;
$tmp_subject = $subject;
}

// 受注情報の取得
$where = 'order_id = ? AND del_flg = 0';
$arrOrder = $objQuery->getRow('*', 'dtb_order', $where, array($order_id));

// 今回追加分
$arrTplVar->tax_payment = intval(($arrOrder['total'] - $arrOrder['tax'] - $arrOrder['use_point']) / 10);

if (empty($arrOrder)) {
trigger_error("該当する受注が存在しない。(注文番号: $order_id)", E_USER_ERROR);
}

$where = 'order_id = ?';
$objQuery->setOrder('order_detail_id');
$arrTplVar->arrOrderDetail = $objQuery->select('*', 'dtb_order_detail', $where, array($order_id));
$arrOptions = plg_ProductOptions_Util::lfSetOrderDetailOptions($arrTplVar->arrOrderDetail);
foreach($arrTplVar->arrOrderDetail as $key => $detail){
foreach($detail['plg_productoptions'] as $option_id => $item){
if($item['option_type'] == 3 || $item['option_type'] == 4){
$arrTplVar->arrOrderDetail[$key]['plg_productoptions'][$option_id]['optioncategory_name'] = str_replace("\n","\n     ",$item['optioncategory_name']);
}
}
}
foreach($arrOptions as $product_class_id => $detail){
foreach($detail as $option_id => $item){
if($item['option_type'] == 3 || $item['option_type'] == 4){
$arrOptions[$product_class_id][$option_id]['optioncategory_name'] = str_replace("\n","\n     ",$item['optioncategory_name']);
}
}
}


$objProduct = new SC_Product_Ex();
$objQuery->setOrder('shipping_id');
$arrRet = $objQuery->select('*', 'dtb_shipping', 'order_id = ?', array($order_id));
foreach ($arrRet as $key => $value) {
$objQuery->setOrder('shipping_id');
$arrItems = $objQuery->select('*', 'dtb_shipment_item', 'order_id = ? AND shipping_id = ?',
array($order_id, $arrRet[$key]['shipping_id']));
$i=1;
foreach ($arrItems as $arrDetail) {
foreach ($arrDetail as $detailKey => $detailVal) {
$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i][$detailKey] = $detailVal;
}
$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i]['plg_productoptions'] = plg_ProductOptions_Util::convProductOptions($arrDetail['plg_productoptions_flg']);
foreach($arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i]['plg_productoptions'] as $option_id => $item){
if($item['option_type'] == 3 || $item['option_type'] == 4){
$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i]['plg_productoptions'][$option_id]['optioncategory_name'] = str_replace("\n","\n     ",$item['optioncategory_name']);
}
}

$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i]['productsClass'] =& $objProduct->getDetailAndProductsClass($arrDetail['product_class_id']);
foreach($arrTplVar->arrOrderDetail as $detail){
if($arrDetail['product_class_id'] == $detail['product_class_id']){
if(isset($detail['tax_rate']))$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i]['tax_rate'] = $detail['tax_rate'];
if(isset($detail['tax_rule']))$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']."_".$i]['tax_rule'] = $detail['tax_rule'];
break;
}
}
$i++;
}
}
$arrTplVar->arrShipping = $arrRet;

$arrTplVar->Message_tmp = $arrOrder['message'];

// 会員情報の取得
$customer_id = $arrOrder['customer_id'];
$objQuery->setOrder('customer_id');
$arrRet = $objQuery->select('point', 'dtb_customer', 'customer_id = ?', array($customer_id));
$arrCustomer = isset($arrRet[0]) ? $arrRet[0] : '';

$arrTplVar->arrCustomer = $arrCustomer;
$arrTplVar->arrOrder = $arrOrder;

//その他決済情報
if ($arrOrder['memo02'] != '') {
$arrOther = unserialize($arrOrder['memo02']);

foreach ($arrOther as $other_key => $other_val) {
if (SC_Utils_Ex::sfTrim($other_val['value']) == '') {
$arrOther[$other_key]['value'] = '';
}
}

$arrTplVar->arrOther = $arrOther;
}

// 都道府県変換
$arrTplVar->arrPref = $this->arrPref;

$objCustomer = new SC_Customer_Ex();
$arrTplVar->tpl_user_point = $objCustomer->getValue('point');

$objMailView = null;
if ($template_id == 2) {
$objMailView = new SC_MobileView_Ex();
} else {
$objMailView = new SC_SiteView_Ex();
}
// メール本文の取得
$objMailView->setPage($this->getPage());
$objMailView->assignobj($arrTplVar);
$body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]);

// メール送信処理
$objSendMail = new SC_SendMail_Ex();
$bcc = $arrInfo['email01'];
$from = $arrInfo['email03'];
$error = $arrInfo['email04'];
$tosubject = $this->sfMakeSubject($tmp_subject, $objMailView);

$objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
$objSendMail->setTo($arrOrder['order_email'], $arrOrder['order_name01'] . ' '. $arrOrder['order_name02'] .' 様');

// 送信フラグ:trueの場合は、送信する。
if ($send) {
if ($objSendMail->sendMail()) {
$this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body);
}
}

return $objSendMail;
}

}



と入れて
引用:

<!--{$tax_payment}-->


で出してみたんですが、でないです。
mcontact
投稿日時: 2023/5/13 11:55
対応状況: −−−
登録日: 2022/1/22
居住地:
投稿: 1240
Re: インボイス対応に伴い消費税を表示したい
引用:
$arrTplVar->tpl_user_point = $objCustomer->getValue('point');


の後に、$arrTplVarオブジェクトに$arrTplVar->tax_payment変数がしっかり値がある事を確認しているのでしょうか...


----------------
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EC-CUBEインテグレートパートナー【ゴールド】ランク
M&I Works
URL: https://miworks.biz/
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

zakey
投稿日時: 2023/5/15 13:58
対応状況: 解決済
一人前
登録日: 2011/2/8
居住地: 兵庫県神戸市
投稿: 145
Re: インボイス対応に伴い消費税を表示したい
別のプラグインでもSC_Helper_Mail.phpと同様の処理をしていたようで、そちらに今回の分を記載して動作確認できました。

ご教授いただきありがとうございました!
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,288名です
総投稿数は109,688件です

投稿数ランキング

1
seasoft
7365
2
468
3217
3
AMUAMU
2712
4
nanasess
2303
5
umebius
2085
6
yuh
1818
7
h_tanaka
1610
8
red
1567
9
mcontact
1240
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
796
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.