diff --git a/inc/template-tags.php b/inc/template-tags.php
index 02940c4..68eea14 100644
--- a/inc/template-tags.php
+++ b/inc/template-tags.php
@@ -186,7 +186,7 @@ function bill_vektor_invoice_each_tax( $post ) {
// すべてが埋まっていない行は算出対象外に
if ( ! empty( $bill_item['name'] ) &&
! empty( $bill_item['count'] ) &&
- ! empty( $bill_item['unit'] ) &&
+ // ! empty( $bill_item['unit'] ) &&
! empty( $bill_item['price'] ) &&
! empty( $bill_item['tax-rate'] ) &&
! empty( $bill_item['tax-type'] )
diff --git a/readme.txt b/readme.txt
index 6536d6e..611b941 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,7 +2,7 @@
Contributors: kurudrive,vektor-inc,rickaddison7634
Tested up to: 6.3
Requires PHP: 7.2
-Stable tag: 1.11.2
+Stable tag: 1.11.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -13,6 +13,9 @@ GitHub : https://github.com/vektor-inc/BillVektor
== Changelog ==
+1.11.3
+[ 不具合修正 ] 単位が未入力だと合計金額が 0円になるなる不具合を修正
+
1.11.2
[ 仕様変更 ] 単位未入力の場合でも数値を表示するように変更
[ 微調整 ] 編集画面での税込 / 税抜及び消費税率の状態を見やすく
diff --git a/style.css b/style.css
index bbd1ca8..07d9daa 100755
--- a/style.css
+++ b/style.css
@@ -4,7 +4,7 @@ Theme Name: BillVektor
Description:
Author: Vektor,Inc.
Author URI:
-Version:1.11.2
+Version:1.11.3
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
diff --git a/template-parts/doc/table-price.php b/template-parts/doc/table-price.php
index 5e1ce7e..50a268f 100644
--- a/template-parts/doc/table-price.php
+++ b/template-parts/doc/table-price.php
@@ -88,13 +88,17 @@
$form_item_tax_rate = $item_tax_rate !== '0%' ? $item_tax_rate : __( '非課税', 'bill-vektor' );
// 対象品目の合計税込金額
- $item_total = bill_vektor_invoice_full_plice( $item_price_total, $item_tax_value );
+ $item_total = bill_vektor_invoice_full_plice( $item_price_total, $item_tax_value );
+ $item_total_unit = '';
+ if ( ! empty( $bill_item['unit'] ) ) {
+ $item_total_unit = $bill_item['unit'];
+ }
$item_total_print = '¥ ' . number_format( $item_total, $digits );
?>
|
|
- |
+ |
|
|
|
diff --git a/tests/test-invoice.php b/tests/test-invoice.php
index 7a3e814..143cccb 100644
--- a/tests/test-invoice.php
+++ b/tests/test-invoice.php
@@ -801,4 +801,122 @@ public function test_bill_vektor_invoice_total_tax() {
}
}
+ /**
+ * 合計金額テスト
+ */
+ public function test_bill_vektor_invoice_total_tax__unit() {
+
+ print PHP_EOL;
+ print '------------------------------------' . PHP_EOL;
+ print 'test_bill_vektor_invoice_total_tax__unit' . PHP_EOL;
+ print '------------------------------------' . PHP_EOL;
+ print PHP_EOL;
+
+ $post_data = array(
+ 'post_title' => 'test',
+ 'post_content' => 'test',
+ 'post_status' => 'publish',
+ 'post_type' => 'post',
+ );
+
+ $test_array = array(
+ array(
+ 'test_name' => 'とりあえず動くか確認',
+ 'custom_fields' => array(
+ 'bill_items' => array(
+ array(
+ 'name' => 'test',
+ 'count' => 1,
+ 'unit' => '円',
+ 'price' => 10000,
+ 'tax-rate' => '10%',
+ 'tax-type' => 'tax_excluded',
+ ),
+ ),
+ 'bill_tax_rate' => 10, // old_tax_rate
+ 'bill_tax_type' => 'tax_included', // old_tax_type
+ 'bill_tax_fraction' => 'floor',
+ ),
+ 'expected' => 11000,
+ ),
+ array(
+ 'test_name' => '単位が空の場合',
+ 'custom_fields' => array(
+ 'bill_items' => array(
+ array(
+ 'name' => 'test',
+ 'count' => 1,
+ 'unit' => '',
+ 'price' => 10000,
+ 'tax-rate' => '10%',
+ 'tax-type' => 'tax_excluded',
+ ),
+ ),
+ 'bill_tax_fraction' => 'floor',
+ ),
+ 'expected' => 11000,
+ ),
+ array(
+ 'test_name' => '旧設定で税抜きだが 個別項目で税込み -> 税込みで計算される',
+ 'custom_fields' => array(
+ 'bill_items' => array(
+ array(
+ 'name' => 'test',
+ 'count' => 1,
+ 'unit' => '',
+ 'price' => 11000,
+ 'tax-rate' => '10%',
+ 'tax-type' => 'tax_included',
+ ),
+ ),
+ 'bill_tax_rate' => 10, // old_tax_rate
+ 'bill_tax_type' => 'tax_excluded', // old_tax_type
+ 'bill_tax_fraction' => 'floor',
+ ),
+ 'expected' => 11000,
+ ),
+ array(
+ 'test_name' => '10%税込 + 8%税込',
+ 'custom_fields' => array(
+ 'bill_items' => array(
+ array(
+ 'name' => 'test',
+ 'count' => 1,
+ 'unit' => '',
+ 'price' => 11000,
+ 'tax-rate' => '10%',
+ 'tax-type' => 'tax_included',
+ ),
+ array(
+ 'name' => 'test',
+ 'count' => 1,
+ 'unit' => '',
+ 'price' => 10800,
+ 'tax-rate' => '8%',
+ 'tax-type' => 'tax_included',
+ ),
+ ),
+ 'bill_tax_fraction' => 'floor',
+ ),
+ 'expected' => 21800,
+ ),
+
+ );
+
+ foreach ( $test_array as $test_item ) {
+ $post_id = wp_insert_post( $post_data );
+ foreach ( $test_item['custom_fields'] as $key => $value ) {
+ update_post_meta( $post_id, $key, $value );
+ }
+ $post = get_post( $post_id );
+ $actual = bill_vektor_invoice_total_tax( $post );
+ print PHP_EOL;
+ print 'test_name :' . $actual . PHP_EOL;
+ print 'actual :' . $actual . PHP_EOL;
+ print 'expected :' . $test_item['expected'] . PHP_EOL;
+ $this->assertEquals( $test_item['expected'], $actual );
+ wp_delete_post( $post_id, true );
+ }
+ }
+
}