|
|
@@ -569,14 +569,14 @@ class utils {
|
|
|
return $flag;
|
|
|
}
|
|
|
|
|
|
- public static function _getSql($ids, $type,$shipment_mode) {
|
|
|
+ public static function _getSql($ids, $type,$shipment_mode,$sqlWhere) {
|
|
|
$ids_arr = explode(',', $ids);
|
|
|
$sql = "";
|
|
|
if($type == "co2e_orgin"){
|
|
|
- $str = "SUM(COALESCE(carbon_emission,0)::numeric(12,10)) as catnum ";
|
|
|
+ $str = "SUM(COALESCE(carbon_emission,0)) as catnum ";
|
|
|
$filed = "shippr_uncode";
|
|
|
} else {
|
|
|
- $str = "SUM(COALESCE(carbon_emission,0)::numeric(12,10)) as catnum ";
|
|
|
+ $str = "SUM(COALESCE(carbon_emission,0)) as catnum ";
|
|
|
$filed = "consignee_uncode";
|
|
|
}
|
|
|
|
|
|
@@ -585,10 +585,11 @@ class utils {
|
|
|
if($shipment_mode == "air" || $shipment_mode == "road"){
|
|
|
$shipment_mode_where = " 1<>1 ";
|
|
|
}
|
|
|
+ $shipment_mode_where .= $sqlWhere;
|
|
|
foreach ($ids_arr as $value) {
|
|
|
if (!empty($value)) {
|
|
|
if (empty($sql)) {
|
|
|
- $sql .= "SELECT $str FROM online_ocean where $shipment_mode_where and $filed = '$value'";
|
|
|
+ $sql .= "SELECT $str FROM online_ocean where $shipment_mode_where and $filed = '$value'";
|
|
|
} else {
|
|
|
$sql .= " union all SELECT $str from online_ocean where $shipment_mode_where and $filed = '$value'";
|
|
|
}
|