Code Duplication    Length = 6-6 lines in 2 locations

includes/wpinv-item-functions.php 1 location

@@ 431-436 (lines=6) @@
428
    $tax        = '';
429
    $tax_rate   = '';
430
    
431
    if ( isset( $item['tax'] ) && $item['tax'] > 0 && $item['subtotal'] > 0 ) {
432
        $tax      = wpinv_price( wpinv_format_amount( $item['tax'] ) );
433
        $tax_rate = !empty( $item['vat_rate'] ) ? $item['vat_rate'] : ( $item['tax'] / $item['subtotal'] ) * 100;
434
        $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
435
        $tax_rate = $tax_rate != '' ? ' <small class="tax-rate normal small">(' . $tax_rate . '%)</small>' : '';
436
    }
437
    
438
    $tax        = $tax . $tax_rate;
439
    

includes/wpinv-template-functions.php 1 location

@@ 1287-1292 (lines=6) @@
1284
        
1285
        $item_tax       = '';
1286
        $tax_rate       = '';
1287
        if ( $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1288
            $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ), $invoice->get_currency() );
1289
            $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1290
            $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
1291
            $tax_rate = $tax_rate != '' ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
1292
        }
1293
        $line_item_tax = $item_tax . $tax_rate;
1294
        
1295
        if ( $line_item_tax === '' ) {