diff --git a/include/Webservices/LineItem/VtigerInventoryOperation.php b/include/Webservices/LineItem/VtigerInventoryOperation.php
index ade2deb304d6c9eac0b8f3e2f5336a192d2ff333..4502de55d2ebe2a24262eaa961be888ea2d14c36 100644
--- a/include/Webservices/LineItem/VtigerInventoryOperation.php
+++ b/include/Webservices/LineItem/VtigerInventoryOperation.php
@@ -336,7 +336,9 @@ class VtigerInventoryOperation extends VtigerModuleOperation {
 				unset($_REQUEST['charges'][1]['taxes'][$shTaxId]);
 				if(isset($element['hdnS_H_Percent']) && $element['hdnS_H_Percent'] != 0 && $element['hdnS_H_Amount'] != 0) {
 					$_REQUEST['charges'][1]['taxes'][$shTaxId] = $element['hdnS_H_Percent'];
-					$_REQUEST['s_h_percent'] = ($element['hdnS_H_Amount'] * $element['hdnS_H_Percent'])/100;
+                    $_REQUEST['s_h_percent'] = ($element['hdnS_H_Percent']/$element['hdnS_H_Amount'])*100;
+                    $_REQUEST['charges'][$firstActiveCharge]['taxes'][$shTaxId] = $_REQUEST['s_h_percent'];
+					$element['hdnS_H_Percent'] = $_REQUEST['s_h_percent'];
 					break;
 				} else {
 					$shTaxValue = 0;
diff --git a/include/utils/InventoryUtils.php b/include/utils/InventoryUtils.php
index 5280b6f48f73a35fbb5e0763ab1ee3d939d469a5..8eb69863ea3c21ff28da0bfdc4948c358598cc7d 100644
--- a/include/utils/InventoryUtils.php
+++ b/include/utils/InventoryUtils.php
@@ -864,7 +864,7 @@ function saveInventoryProductDetails(&$focus, $module, $update_prod_stock='false
 	$adb->pquery('INSERT INTO vtiger_inventorychargesrel VALUES (?, ?)', array($focus->id, Zend_Json::encode($chargesInfo)));
 
 	$updatequery .= " s_h_percent=?";
-	array_push($updateparams, $shipping_handling_charge);
+	array_push($updateparams, vtlib_purify($_REQUEST['s_h_percent']));
 
 	//$id_array = Array('PurchaseOrder'=>'purchaseorderid','SalesOrder'=>'salesorderid','Quotes'=>'quoteid','Invoice'=>'invoiceid');
 	//Added where condition to which entity we want to update these values
diff --git a/modules/Reports/ReportRun.php b/modules/Reports/ReportRun.php
index 4eaee0d62ab6b928e00c51552e682bba94bf9424..c846d9678e63c1bae180c8045260cd4f60b4a09e 100644
--- a/modules/Reports/ReportRun.php
+++ b/modules/Reports/ReportRun.php
@@ -3214,8 +3214,11 @@ class ReportRun extends CRMEntity {
 						} else {
 							$convert_price = false;
 						}
+						$originalValue = trim(str_replace(' ', '_', $value));
 						$value = trim($key);
-						$arraykey = $value . '_SUM';
+                        $originalkey = $value . '_SUM';
+						$originalValueKey = $originalValue.'_SUM';
+						$arraykey = $this->replaceSpecialChar($value) . '_SUM';
 						if (isset($keyhdr[$arraykey])) {
 							if ($convert_price) {
 								if ($operation == 'ExcelExport') {
@@ -3236,12 +3239,14 @@ class ReportRun extends CRMEntity {
 									}
 								}
 							}
-							$totalpdf[$rowcount][$arraykey] = $conv_value;
+							$totalpdf[$rowcount][$originalValueKey] = $conv_value;
 						} else {
-							$totalpdf[$rowcount][$arraykey] = '';
+							$totalpdf[$rowcount][$originalValueKey] = '';
 						}
 
-						$arraykey = $value . '_AVG';
+						$originalkey = $value . '_AVG';
+						$originalValueKey = $originalValue.'_AVG';
+						$arraykey = $this->replaceSpecialChar($value) . '_AVG';
 						if (isset($keyhdr[$arraykey])) {
 							if ($convert_price) {
 								if ($operation == 'ExcelExport') {
@@ -3262,12 +3267,14 @@ class ReportRun extends CRMEntity {
 									}
 								}
 							}
-							$totalpdf[$rowcount][$arraykey] = $conv_value;
+							$totalpdf[$rowcount][$originalValueKey] = $conv_value;
 						} else {
-							$totalpdf[$rowcount][$arraykey] = '';
+							$totalpdf[$rowcount][$originalValueKey] = '';
 						}
 
-						$arraykey = $value . '_MIN';
+						$originalkey = $value . '_MIN';
+						$originalValueKey = $originalValue.'_MIN';
+                        $arraykey = $this->replaceSpecialChar($value) . '_MIN';
 						if (isset($keyhdr[$arraykey])) {
 							if ($convert_price) {
 								if ($operation == 'ExcelExport') {
@@ -3288,12 +3295,14 @@ class ReportRun extends CRMEntity {
 									}
 								}
 							}
-							$totalpdf[$rowcount][$arraykey] = $conv_value;
+							$totalpdf[$rowcount][$originalValueKey] = $conv_value;
 						} else {
-							$totalpdf[$rowcount][$arraykey] = '';
+							$totalpdf[$rowcount][$originalValueKey] = '';
 						}
 
-						$arraykey = $value . '_MAX';
+						$originalkey = $value . '_MAX';
+						$originalValueKey = $originalValue.'_MAX';
+						$arraykey = $this->replaceSpecialChar($value) . '_MAX';
 						if (isset($keyhdr[$arraykey])) {
 							if ($convert_price) {
 								if ($operation == 'ExcelExport') {
@@ -3314,9 +3323,9 @@ class ReportRun extends CRMEntity {
 									}
 								}
 							}
-							$totalpdf[$rowcount][$arraykey] = $conv_value;
+							$totalpdf[$rowcount][$originalValueKey] = $conv_value;
 						} else {
-							$totalpdf[$rowcount][$arraykey] = '';
+							$totalpdf[$rowcount][$originalValueKey] = '';
 						}
 						$rowcount++;
 					}