where("no_of_the_joint_as_per_as_built_survey", "not like", "%R%"); $currentNps = apply_welded_filter(db("weld_logs"))->where("no_of_the_joint_as_per_as_built_survey", "not like", "%R%")->whereNotNull("welding_date"); $countNps = apply_welded_filter(db("weld_logs"))->where("no_of_the_joint_as_per_as_built_survey", "not like", "%R%"); $max = 80000; if($project != "General") { $totalNps = $totalNps->where("project", $project); $currentNps = $currentNps->where("project", $project); $countNps = $countNps->where("project", $project); $max = 20000; } $currentNps = $currentNps->sum("nps_1"); $totalNps = $totalNps->sum("nps_1"); $countNps = $countNps->sum("nps_1"); try { $npsPercent = round($currentNps * 100 / $totalNps, 2); $apprPercent = round($appr * 100 / $totalNps, 2); } catch (\Throwable $th) { $apprPercent = 0; $npsPercent = 0; } ?>