Commit cfa878b6 authored by Pardeep Sahu's avatar Pardeep Sahu

Merge branch 'sahu_new_10_12_2021' into staging

parents 3c0cdbfa 877bf8bc
Pipeline #2152 passed with stage
in 18 seconds
......@@ -93,10 +93,12 @@ class ApiController extends Controller
User::where('role', 3)->where('mobile_no', '=', $mobile_no)->update($data);
if (!empty($matchOtp->dealer_id)) {
$dealer_id = $matchOtp->dealer_id;
$dealerPercentage = getDealerPercentage($matchOtp->dealer_id);
} else {
$dealer_id = $matchOtp->dealer_office;
$dealerPercentage = "0";
}
$result = array('user_id' => $matchOtp->id, 'username' => $matchOtp->name, 'dealer_id' => $dealer_id, 'role' => $matchOtp->role);
$result = array('user_id' => $matchOtp->id, 'username' => $matchOtp->name, 'dealer_id' => $dealer_id, 'role' => $matchOtp->role, 'dealer_percentage' => $dealerPercentage);
$return = array('result' => $result, 'status_code' => 200);
exit(json_encode($return));
}
......
......@@ -1001,4 +1001,15 @@ function getTaregtNumber($target_id)
{
$data = DB::table('target_treatments')->where('target_id',$target_id)->sum('target_num');
return $data;
}
function getDealerPercentage($dealer_id)
{
$percentage = DB::table('dealer_shares')->where("dealer_id", $dealer_id)->orderBy("id", "DESC")->first()->share_percentage;
if (!empty($percentage)) {
$percentage = $percentage;
} else {
$percentage = "0";
}
return $percentage;
}
\ No newline at end of file
......@@ -666,7 +666,9 @@ if (@$advisor_id) {
var customer = ".customer" + a;
var actualclass = ".actualPrice" + a;
var dealerPercent = ".dealerPercent" + a;
var powerShare = ".powerShare" + a;
var diff = ".difference" + a;
var diffPrice = $(diff).val();
var customerPrice = $(customer).val();
......@@ -679,7 +681,7 @@ if (@$advisor_id) {
// $(diff).val(isNaN(difference)? 0 : difference.toFixed(2));
$(actualclass).val(isNaN(actualP) ? 0 : actualP.toFixed(2));
$(dealerPercent).val(isNaN(deal) ? 0 : deal.toFixed(2));
$(".powerShare" + a).val(( $(actualclass).val() - $(dealerPercent).val()).toFixed(2));
$(powerShare).val(( $(actualclass).val() - $(dealerPercent).val()).toFixed(2));
}
});
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment