Fix manual order calculation when using non-standard decimal points Closes #4742

This commit is contained in:
Mike Jolley 2014-02-12 15:01:56 +00:00 committed by Coen Jacobs
parent 7554cc8cd7
commit e999cc1c1d
2 changed files with 11 additions and 6 deletions

View File

@ -233,10 +233,10 @@ jQuery( function($){
var $qty = $row.find('input.quantity'); var $qty = $row.find('input.quantity');
var qty = $qty.val(); var qty = $qty.val();
var line_subtotal = $row.find('input.line_subtotal').val(); var line_subtotal = accounting.unformat( $row.find('input.line_subtotal').val(), woocommerce_admin.mon_decimal_point );
var line_total = $row.find('input.line_total').val(); var line_total = accounting.unformat( $row.find('input.line_total').val(), woocommerce_admin.mon_decimal_point );
var line_tax = $row.find('input.line_tax').val(); var line_tax = accounting.unformat( $row.find('input.line_tax').val(), woocommerce_admin.mon_decimal_point );
var line_subtotal_tax = $row.find('input.line_subtotal_tax').val(); var line_subtotal_tax = accounting.unformat( $row.find('input.line_subtotal_tax').val(), woocommerce_admin.mon_decimal_point );
if ( qty ) { if ( qty ) {
unit_subtotal = parseFloat( accounting.toFixed( ( line_subtotal / qty ), woocommerce_admin_meta_boxes.rounding_precision ) ); unit_subtotal = parseFloat( accounting.toFixed( ( line_subtotal / qty ), woocommerce_admin_meta_boxes.rounding_precision ) );
@ -283,6 +283,11 @@ jQuery( function($){
var total = parseFloat( accounting.formatNumber( unit_total * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) ); var total = parseFloat( accounting.formatNumber( unit_total * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) );
var total_tax = parseFloat( accounting.formatNumber( unit_total_tax * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) ); var total_tax = parseFloat( accounting.formatNumber( unit_total_tax * qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) );
subtotal = subtotal.toString().replace( '.', woocommerce_admin.mon_decimal_point );
tax = tax.toString().replace( '.', woocommerce_admin.mon_decimal_point );
total = total.toString().replace( '.', woocommerce_admin.mon_decimal_point );
total_tax = total_tax.toString().replace( '.', woocommerce_admin.mon_decimal_point );
$row.find('input.line_subtotal').val( subtotal ); $row.find('input.line_subtotal').val( subtotal );
$row.find('input.line_total').val( total ); $row.find('input.line_total').val( total );
$row.find('input.line_subtotal_tax').val( tax ); $row.find('input.line_subtotal_tax').val( tax );

File diff suppressed because one or more lines are too long