CHANGE_CLIENT_FILE_UPLOAD_PAN_DUP_CHECK : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-05 14:15:56 +05:30
parent a41a3f5c11
commit 1797349ebb

View File

@ -435,28 +435,40 @@ class ClientController extends BaseController
"created_by" => $created_by,
"business_id" => $business_id,
];
$client_pan_find = $this->ClientModel->where('pan_no', $value['pan_no'])->first();
$client = $this->ClientModel->insert($insertData);
if($client){
if($value['branches']){
foreach ($value['branches'] as $key => $branch) {
$insertBranchData = [
"name" => $branch['b_name'],
"gst_no" => $branch['gst_no'],
"email" => $branch['b_email'],
"mobile_no" => $branch['b_mobile_no'],
"created_by" => $created_by,
"client_id" => $client,
"country" => $branch['country'],
"state" => $branch['state'],
"city" => $branch['city'],
"pin_code" => $branch['pin_code'],
"address" => $branch['address'],
];
$clientBranch = $this->ClientBranchModel->insert($insertBranchData);
if($client_pan_find){
}else{
$client = $this->ClientModel->insert($insertData);
if($client){
if($value['branches']){
foreach ($value['branches'] as $key => $branch) {
$insertBranchData = [
"name" => $branch['b_name'],
"gst_no" => $branch['gst_no'],
"email" => $branch['b_email'],
"mobile_no" => $branch['b_mobile_no'],
"created_by" => $created_by,
"client_id" => $client,
"country" => $branch['country'],
"state" => $branch['state'],
"city" => $branch['city'],
"pin_code" => $branch['pin_code'],
"address" => $branch['address'],
];
if($this->ClientBranchModel->where('gst_no', $branch['gst_no'])->first()){
}else{
$clientBranch = $this->ClientBranchModel->insert($insertBranchData);
}
}
}
}
}
}
return json_encode(true);
} else {