Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
be3fd62cbb
@ -92,3 +92,25 @@ define('EVENT_PRIORITY_NORMAL', 100);
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_HIGH', 10);
|
||||
|
||||
/**
|
||||
* @User Role Constant
|
||||
*/
|
||||
|
||||
define('ENROLLMENT_TEAM_ID', '1');
|
||||
define('CLAIMS_TEAM_ID', '2');
|
||||
define('BUSINESS_TEAM_ID', '3');
|
||||
define('FINANCE_TEAM_ID', '4');
|
||||
define('SALES_TEAM_ID', '5');
|
||||
|
||||
/**
|
||||
* @User Teams Constant
|
||||
*/
|
||||
|
||||
define('ADMIN_ROLE_ID', 1);
|
||||
define('MANAGER_ROLE_ID', 2);
|
||||
define('ACCOUNT_MANAGER_ROLE_ID', 3);
|
||||
define('STAFF_ROLE_ID', 4);
|
||||
define('HEAD_ROLE_ID', 5);
|
||||
|
||||
|
||||
|
||||
@ -326,6 +326,9 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("report", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list", "PolicyTransactionController::reportBDS");
|
||||
$routes->get("report-varience-list", "PolicyTransactionController::reportVarience");
|
||||
$routes->get("report-business-list", "PolicyTransactionController::reportBusinessList");
|
||||
$routes->get("report-finance-list", "PolicyTransactionController::reportFinanceList");
|
||||
});
|
||||
|
||||
$routes->group("statement", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
@ -39,6 +39,7 @@ use App\Models\PolicyTransactionStatusModel;
|
||||
use App\Models\VehicleModel;
|
||||
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
use App\Controllers\GoogleDriveController;
|
||||
|
||||
|
||||
class ClientController extends AdminController
|
||||
@ -320,10 +321,10 @@ class ClientController extends AdminController
|
||||
|
||||
$data['subTypeOptions'] = $subTypeOptions;
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
$data['insurerName']= $this->insurerModel->getInsurerName($insurerId);
|
||||
$loggedInUserID = get_session_userid();
|
||||
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
$data['insurerName']= $this->insurerModel->getInsurerName($insurerId, $clientId);
|
||||
$data['depositdata']= $this->clientPolicyModel->getdepositData($clientId,$insurerId);
|
||||
$data['clientData'] = $this->clientPolicyModel->getClientById($clientId);
|
||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId);
|
||||
@ -331,7 +332,7 @@ class ClientController extends AdminController
|
||||
// dd($data['depositdata']);
|
||||
|
||||
// print_r($data['depositdata'] );die;
|
||||
// Load the view for the new list page
|
||||
// Load the view for the new list page;
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('view_deposit',$data);
|
||||
echo view('layout/footer');
|
||||
@ -481,6 +482,8 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createClientKYCInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','create Client kyc function called');
|
||||
@ -490,7 +493,12 @@ class ClientController extends AdminController
|
||||
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
|
||||
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
|
||||
if(!empty($File)){
|
||||
|
||||
$data['file_name'] = $File;
|
||||
$uploadFilePath = $uploadFilePath . '/' .$File;
|
||||
$GoogleDriveController = new GoogleDriveController();
|
||||
$GoogleDriveController->uploadFiletoGdrive(client_id: $data['client_id'], doc_type: 'KYC', file_path: $uploadFilePath, file_name: $data['file_name']);
|
||||
|
||||
}
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
@ -3127,14 +3135,17 @@ class ClientController extends AdminController
|
||||
|
||||
// Fetch policies in a single query
|
||||
$policies = $this->clientPolicyModel
|
||||
->select('
|
||||
->select("
|
||||
client_policy.*,
|
||||
policy_type.policy_type,
|
||||
policy_type.ebp,
|
||||
policy_type.etp,
|
||||
policy_type.iep,
|
||||
policy_type.itp
|
||||
')
|
||||
policy_type.itp,
|
||||
policy_type.bap,
|
||||
DATE_FORMAT(client_policy.policy_start_date, '%d/%m/%Y') as policy_start_date,
|
||||
DATE_FORMAT(client_policy.policy_end_date, '%d/%m/%Y') as policy_end_date
|
||||
")
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->whereIn('client_policy.client_id', $clientIds)
|
||||
->where('client_policy.is_active', 1)
|
||||
@ -3212,6 +3223,7 @@ class ClientController extends AdminController
|
||||
'aadhar' => $postData['aadhar'],
|
||||
'phone' => $postData['phone'],
|
||||
'email' => $postData['email'],
|
||||
'entity_type_id' => 7
|
||||
]);
|
||||
} else {
|
||||
$client_data['entity_type_id'] = $postData['entity_type_id'];
|
||||
@ -3389,8 +3401,4 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -13,6 +13,7 @@ use CodeIgniter\API\ResponseTrait;
|
||||
use App\Models\MessageModel;
|
||||
use App\Models\UserMessageModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\PolicyTransactionModel;
|
||||
|
||||
use App\Models\JobModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
@ -30,6 +31,7 @@ class DashboardController extends AdminController
|
||||
protected $clientPolicyModel;
|
||||
protected $notificationModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $policyTransactionModel;
|
||||
|
||||
protected $myLogger;
|
||||
|
||||
@ -42,6 +44,7 @@ class DashboardController extends AdminController
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->policyTransactionModel = new PolicyTransactionModel();
|
||||
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
@ -65,8 +68,9 @@ class DashboardController extends AdminController
|
||||
|
||||
$pendingActionsController = new PendingActionsController;
|
||||
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||
|
||||
|
||||
$businessTeamData = $this->policyTransactionModel->getBusinessReportList();
|
||||
$financeTeamData = $this->policyTransactionModel->getFinanceReportList();
|
||||
|
||||
$groupedData = [];
|
||||
|
||||
foreach ($results as $row) {
|
||||
@ -157,6 +161,8 @@ class DashboardController extends AdminController
|
||||
$session->set('enrollment_data', json_encode($data));
|
||||
// echo "<pre>";
|
||||
$data['pendingActionsData'] = $pendingActionsData;
|
||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||
$data['financeTeamCount'] = count($financeTeamData) ?? 0;
|
||||
// print_r($data);die;
|
||||
|
||||
|
||||
|
||||
@ -41,13 +41,20 @@ class LoginController extends BaseController
|
||||
$user = $UserModel->getUserByEmail($value->email);
|
||||
if($user){
|
||||
if($user->is_active !== '0'){
|
||||
|
||||
$user_team = $UserModel->getUserTeamsByUserID($user->id);
|
||||
// dd($user_team);
|
||||
|
||||
$session_data = [
|
||||
'isLoggedIn' => True ,
|
||||
'userid' => $user->id,
|
||||
'userData' => $user,
|
||||
'userProfile' => $value->picture,
|
||||
'user_team' => $user_team,
|
||||
];
|
||||
|
||||
set_session_data($session_data);
|
||||
|
||||
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
||||
log_message('error', 'User Login Sucessfully');
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@ class MasterController extends AdminController
|
||||
protected $clientModel;
|
||||
protected $clientDepositModel;
|
||||
protected $insurerTemplateModel;
|
||||
protected $cli_colors;
|
||||
|
||||
|
||||
|
||||
@ -84,6 +85,13 @@ class MasterController extends AdminController
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->clientDepositModel = new ClientDepositModel();
|
||||
$this->insurerTemplateModel = new InsurerExcelExportTemplateModel();
|
||||
$this->cli_colors = [
|
||||
'red' => "\033[31m",
|
||||
'green' => "\033[32m",
|
||||
'yellow' => "\033[33m",
|
||||
'blue' => "\033[34m",
|
||||
'reset' => "\033[0m"
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@ -1260,6 +1268,8 @@ class MasterController extends AdminController
|
||||
|
||||
$insert = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
||||
|
||||
$data = $this->CDMasterModel->where('id', $id)->first();
|
||||
|
||||
$cd_transaction_updated_data = [
|
||||
'balance' => $data['opening_bal'],
|
||||
'amount' => $data['opening_bal']
|
||||
@ -1378,7 +1388,7 @@ class MasterController extends AdminController
|
||||
|
||||
$cd_data = $this->CDMasterModel->where('client_id', $data['client_id'])->where('insurer_id', $data['insurer_id'])->findAll();
|
||||
|
||||
return $this->respond(['status' => true, 'data' => $cd_data, 'message' => 'CD Account number created successfully'], 200);
|
||||
return $this->respond(['status' => true, 'data' => $cd_data, 'cd_ac_no'=>$data['cd_ac_no'], 'message' => 'CD Account number created successfully'], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false, 'message' => 'Failed to created CD Account number'], 200);
|
||||
}
|
||||
@ -1544,6 +1554,7 @@ class MasterController extends AdminController
|
||||
$this->checkAndCreateDirectories();
|
||||
$this->checkGoogleOAuthCredentialsinDB();
|
||||
$this->getCronJobsList();
|
||||
$this->checkGdriveRootFolderID();
|
||||
|
||||
}
|
||||
|
||||
@ -1592,7 +1603,7 @@ class MasterController extends AdminController
|
||||
$token = $settingsModel->where('id', 1)->first();
|
||||
|
||||
echo "################ CHECKING GMAIL OAUTH FOR EMAIL ###################\n";
|
||||
if (is_array($token) && !is_null($token['gmail_api_oauth_credentials'])) {
|
||||
if (is_array($token) && is_null($token['gmail_api_oauth_credentials'])) {
|
||||
|
||||
echo "Email OAuth credentials not found in database.\n";
|
||||
echo "Check the following..!\n";
|
||||
@ -1630,4 +1641,20 @@ class MasterController extends AdminController
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
//check gdrive root folder id in env file
|
||||
function checkGdriveRootFolderID()
|
||||
{
|
||||
echo "#################### CHECKING GDRIVE FOLDER ID IN ENV FILE ############################\n";
|
||||
$id = getenv('GDRIVE_ROOT_FOLDER_ID');
|
||||
if($id)
|
||||
{
|
||||
echo $this->cli_colors['green'] . "ID is :". $id . $this->cli_colors['reset']. "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $this->cli_colors['red'] ."Gdrive Folder id not set in env file. set it under 'GDRIVE_ROOT_FOLDER_ID' in env file.". $this->cli_colors['reset'] ."\n";
|
||||
}
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -50,13 +50,13 @@ class DepositHelper
|
||||
'amount' => $data['amount'],
|
||||
'sub_type' => $data['sub_type_id'],
|
||||
'client_id' => $data['client_id'],
|
||||
'client_policy_id' => $data['client_policy_id'],
|
||||
'client_policy_id' => $data['client_policy_id'] ?? 0,
|
||||
'cd_ac_no' => $data['cd_ac_no'],
|
||||
'endorsement_no' => $data['endorsement_no'],
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'unit' => $data['unit'] ?? null,
|
||||
'description' => $data['description'],
|
||||
'event_name' => $data['event_name'],
|
||||
'description' => $data['description'] ?? null,
|
||||
'event_name' => $data['event_name'] ?? null,
|
||||
'transaction_type' => $data['transaction_type'],
|
||||
'is_active' => 1,
|
||||
'created_by' => $loggedInUserID,
|
||||
@ -99,17 +99,17 @@ class DepositHelper
|
||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$cd_ac_no];
|
||||
|
||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? null;
|
||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? 0;
|
||||
|
||||
if(empty($lastBalance) && $lastBalance == null){
|
||||
// if(empty($lastBalance) && $lastBalance == null){
|
||||
|
||||
$cd_model = new ClientDepositModel();
|
||||
// $cd_model = new ClientDepositModel();
|
||||
|
||||
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
$getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
|
||||
// $getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||
// $getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
|
||||
|
||||
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
||||
}
|
||||
// $lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
||||
// }
|
||||
|
||||
return $lastBalance;
|
||||
}
|
||||
|
||||
@ -140,6 +140,15 @@ if (!function_exists('get_session_context')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('user_team')) {
|
||||
function user_team()
|
||||
{
|
||||
// $CI =& get_instance();
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('user_team');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ class ClientPolicyModel extends Model
|
||||
->select('clients.client_name as client_name')
|
||||
->join('clients','clients.id=client_policy.client_id')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('cd_master', 'cd_master.insurer_id = client_policy.insurer_id')
|
||||
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||
->where('client_policy.client_id', $id)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
||||
|
||||
@ -37,13 +37,16 @@ class InsurerModel extends Model
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getInsurerName($insurerId)
|
||||
public function getInsurerName($insurerId, $client_id)
|
||||
{
|
||||
// Fetch the insurer name based on the insurer ID
|
||||
$query = $this->select('insurers.id,insurers.name, cd_master.cd_ac_no')
|
||||
->join('cd_master', 'cd_master.insurer_id = insurers.id')
|
||||
->where('insurers.id', $insurerId)
|
||||
->get();
|
||||
$query = $this->db->table('client_policy')
|
||||
->select('insurers.id, insurers.name, cd_master.cd_ac_no')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||
->where('client_policy.insurer_id', $insurerId)
|
||||
->where('client_policy.client_id', $client_id)
|
||||
->get();
|
||||
|
||||
if ($query->resultID->num_rows > 0) {
|
||||
$result = $query->getRow();
|
||||
|
||||
@ -21,6 +21,7 @@ class InsurerStatements extends Model
|
||||
"reason",
|
||||
"invoice_status",
|
||||
"invoice_no",
|
||||
"invoice_amount",
|
||||
"invoice_date",
|
||||
"updated_by"
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ class InvPaymentDetailsModel extends Model
|
||||
'statement_id',
|
||||
'inv_amt',
|
||||
'utr_no',
|
||||
'tds',
|
||||
'received_date',
|
||||
'created_by',
|
||||
'is_active',
|
||||
|
||||
@ -87,16 +87,18 @@ class PTCOShareDetailsModel extends Model
|
||||
pt_co.bp_amt,
|
||||
pt_co.tp_amt,
|
||||
pt_co.tep_amt,
|
||||
pt_co.exp_amt
|
||||
pt_co.exp_amt,
|
||||
pt_co.statement_id
|
||||
')
|
||||
->join('policy_transaction pt', 'pt_co.pt_id = pt.id')
|
||||
->join('clients c', 'pt.client_id = c.id')
|
||||
->where('pt_co.is_active', 1)
|
||||
->where('MONTH(pt.created_at)', $month)
|
||||
->where('YEAR(pt.created_at)', $year)
|
||||
->where('MONTH(pt.month)', $month)
|
||||
->where('YEAR(pt.month)', $year)
|
||||
->where('pt_co.insurer_id', $insurer_id)
|
||||
->where('pt_co.insurer_branch_id', $insurer_branch_id)
|
||||
->where('pt_co.statement_id is null')
|
||||
->where('pt.status','completed')
|
||||
// ->where('pt_co.exp_amt', 0.00)
|
||||
// ->orWhere('pt_co.exp_amt is null')
|
||||
->get()
|
||||
|
||||
@ -75,6 +75,7 @@ class PolicyTransactionModel extends Model
|
||||
'ct_type',
|
||||
'ct_tran_id',
|
||||
'remarks',
|
||||
'month',
|
||||
];
|
||||
|
||||
|
||||
@ -119,7 +120,11 @@ class PolicyTransactionModel extends Model
|
||||
->select("
|
||||
policy_transaction.*,
|
||||
DATE_FORMAT(policy_transaction.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||
DATE_FORMAT(policy_transaction.policy_issue_date, '%b') AS policy_issue_month,
|
||||
DATE_FORMAT(
|
||||
IF(policy_transaction.month IS NULL,
|
||||
policy_transaction.policy_issue_date,
|
||||
policy_transaction.month),
|
||||
'%b %Y') AS policy_issue_month,
|
||||
CASE
|
||||
WHEN clients.client_type = 1 THEN 'Group'
|
||||
WHEN clients.client_type = 2 THEN 'Retail'
|
||||
@ -147,31 +152,110 @@ class PolicyTransactionModel extends Model
|
||||
vehicle.vehicle_no,
|
||||
tpa.name as tpa_name,
|
||||
pt_co_share_details.remark as remarks,
|
||||
pt_co_share_details.reward,
|
||||
pt_co_share_details.bp_amt,
|
||||
sales_user.first_name as salse_person_name,
|
||||
service_user.first_name as service_person_name,
|
||||
|
||||
ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS premium_wo_gst,
|
||||
|
||||
ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2) AS gst_amount,
|
||||
|
||||
ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) + ROUND((ROUND((pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) * 18 / 100), 2)), 2) AS total_premium,
|
||||
|
||||
ROUND((pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 2) AS tp_or_ter,
|
||||
|
||||
DATEDIFF(policy_transaction.policy_end_date, CURDATE()) AS days,
|
||||
|
||||
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per) AS agreed_tp_or_ter_per,
|
||||
|
||||
pt_co_share_details.agreed_bp_per,
|
||||
ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) AS total_irda,
|
||||
ROUND((ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) * 18 / 100), 2) AS gst_on_revenue,
|
||||
|
||||
ROUND(
|
||||
(ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) +
|
||||
ROUND((ROUND((pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per + (pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) * (pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)), 2) * 18 / 100), 2)),
|
||||
2) AS total_amt_received
|
||||
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
|
||||
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
|
||||
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
|
||||
2) AS total_irda,
|
||||
|
||||
ROUND(
|
||||
(ROUND(
|
||||
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
|
||||
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
|
||||
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
|
||||
2) * 18 / 100),
|
||||
2) AS gst_on_revenue,
|
||||
|
||||
ROUND(
|
||||
(ROUND(
|
||||
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
|
||||
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
|
||||
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
|
||||
2) +
|
||||
ROUND(
|
||||
(ROUND(
|
||||
(pt_co_share_details.bp_amt * pt_co_share_details.agreed_bp_per +
|
||||
(pt_co_share_details.tp_amt + pt_co_share_details.tep_amt) *
|
||||
(pt_co_share_details.agreed_tp_per + pt_co_share_details.agreed_tep_per)) / 100,
|
||||
2) * 18 / 100),
|
||||
2)),
|
||||
2) AS total_amt_received,
|
||||
insurer_statements.invoice_date,
|
||||
insurer_statements.invoice_no,
|
||||
insurer_statements.invoice_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds)) AS realization_amount
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
|
||||
) AS realization_amount,
|
||||
|
||||
ROUND(
|
||||
insurer_statements.invoice_amount -
|
||||
(
|
||||
SELECT
|
||||
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds))
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
),
|
||||
2) AS outstanding_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT(inv_payment_details.utr_no SEPARATOR ', ') AS utr_numbers
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
) AS utr_numbers,
|
||||
|
||||
(
|
||||
SELECT
|
||||
GROUP_CONCAT(inv_payment_details.received_date SEPARATOR ', ') AS payment_dates
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
) AS payment_dates
|
||||
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('user_profiles', 'policy_transaction.created_by = user_profiles.id', 'left')
|
||||
->join('vehicle', 'policy_transaction.vehicle_id = vehicle.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->join('insurers', 'policy_transaction.insurer_id = insurers.id', 'left')
|
||||
->join('insurer_branch', 'policy_transaction.insurer_branch_id = insurer_branch.id', 'left')
|
||||
->join('tpa', 'policy_transaction.tpa_id = tpa.id', 'left')
|
||||
@ -188,6 +272,13 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
||||
}else{
|
||||
|
||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
// ->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
@ -205,8 +296,395 @@ class PolicyTransactionModel extends Model
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
|
||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
|
||||
}
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getInceptionTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
{
|
||||
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select('
|
||||
policy_transaction.*,
|
||||
clients.short_name AS client_short_name,
|
||||
clients.client_code,
|
||||
clients.client_type,
|
||||
clients.client_name,
|
||||
client_branch.branch_name AS client_branch_name,
|
||||
insurers.name AS insurer_name,
|
||||
insurers.short_name AS insurer_short_name,
|
||||
policy_type.policy_type,
|
||||
pt_co_share_details.agreed_amt AS amount,
|
||||
pt_co_share_details.bp_amt AS bp,
|
||||
pt_co_share_details.tp_amt AS tp
|
||||
')
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.action_type', 'inception');
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
|
||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
|
||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
||||
}else{
|
||||
|
||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
// ->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
if ($status != 0) {
|
||||
$builder->where('policy_transaction.status', $status);
|
||||
}
|
||||
|
||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
|
||||
}
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getEndorsementTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
{
|
||||
// dd($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $status);
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select('
|
||||
policy_transaction.*,
|
||||
clients.short_name as client_short_name,
|
||||
clients.client_code,
|
||||
client_branch.branch_name as client_branch_name,
|
||||
insurers.name AS insurer_name,
|
||||
insurers.short_name AS insurer_short_name,
|
||||
policy_type.policy_type
|
||||
')
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
|
||||
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id','left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.action_type !=', 'inception');
|
||||
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
|
||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
|
||||
$builder->where('policy_transaction.'.$date_type.'>=', $startDate)
|
||||
->where('policy_transaction.'.$date_type.'<=', $endDate);
|
||||
}else{
|
||||
|
||||
// $fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
// $toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
// $builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
// ->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
if ($status != 0) {
|
||||
$builder->where('policy_transaction.status', $status);
|
||||
}
|
||||
|
||||
if($client_id == 0 && $insurer_id == 0 && $policy_type_id == 0 && $date_type == 0 && $issuer == 0){
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
|
||||
}
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getVarienceReportLIst($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
{
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select("
|
||||
policy_transaction.id,
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
ELSE 'E'
|
||||
END AS action_type,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance,
|
||||
insurer_statements.invoice_amount,
|
||||
insurer_statements.invoice_status,
|
||||
|
||||
ROUND((pt_co_share_details.actual_bp_brokerage_amt + pt_co_share_details.actual_tp_brokerage_amt + pt_co_share_details.actual_tep_brokerage_amt), 2) AS realization_amount2,
|
||||
|
||||
(
|
||||
SELECT
|
||||
(SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds)) AS realization_amount
|
||||
FROM
|
||||
inv_payment_details
|
||||
WHERE
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
|
||||
) AS realization_amount,
|
||||
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
->join('inv_payment_details', 'insurer_statements.id = inv_payment_details.statement_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('pt_co_share_details.actual_bp_brokerage_amt IS NOT NULL AND pt_co_share_details.actual_bp_brokerage_amt != 0')
|
||||
->where('pt_co_share_details.variance IS NOT NULL')
|
||||
->where('pt_co_share_details.variance !=', 0);
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
|
||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
|
||||
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||
} else {
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
|
||||
if ($status != 0) {
|
||||
$builder->where('policy_transaction.status', $status);
|
||||
}
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getBusinessReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
{
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select([
|
||||
'policy_transaction.id AS policy_trns_id',
|
||||
'clients.client_name',
|
||||
'insurers.name AS insurer_name',
|
||||
'policy_type.policy_type',
|
||||
'policy_transaction.policy_no',
|
||||
'policy_transaction.endorsement_no',
|
||||
"CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
ELSE 'E'
|
||||
END AS action_type",
|
||||
'policy_transaction.action_type as action_type_full',
|
||||
'pt_co_share_details.bp_amt',
|
||||
'pt_co_share_details.tp_amt',
|
||||
'pt_co_share_details.tep_amt'
|
||||
])
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.status', 'completed')
|
||||
->where('pt_co_share_details.bp_amt IS NULL OR pt_co_share_details.bp_amt = 0');
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
|
||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
|
||||
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||
} else {
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
|
||||
if ($status != 0) {
|
||||
$builder->where('policy_transaction.status', $status);
|
||||
}
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getFinanceReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
{
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select("
|
||||
policy_transaction.id,
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
ELSE 'E'
|
||||
END AS action_type,
|
||||
policy_transaction.action_type AS action_type_full,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.status', 'completed')
|
||||
->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
|
||||
->where('COALESCE(pt_co_share_details.actual_bp_amt, 0) + COALESCE(pt_co_share_details.actual_tp_amt, 0) + COALESCE(pt_co_share_details.actual_tep_amt, 0) = 0')
|
||||
->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0');
|
||||
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
|
||||
$startDate = date('Y-m-d 00:00:00', strtotime($start_date));
|
||||
$endDate = date('Y-m-d 23:59:59', strtotime($end_date));
|
||||
|
||||
$builder->where('policy_transaction.' . $date_type . '>=', $startDate)
|
||||
->where('policy_transaction.' . $date_type . '<=', $endDate);
|
||||
} else {
|
||||
|
||||
$fromDate = date('Y-m-d', strtotime('-30 days'));
|
||||
$toDate = date('Y-m-d 23:59:59');
|
||||
|
||||
$builder->where('policy_transaction.created_at >=', $fromDate)
|
||||
->where('policy_transaction.created_at <=', $toDate);
|
||||
}
|
||||
|
||||
if ($client_id != 0) {
|
||||
$builder->where('policy_transaction.client_id', $client_id);
|
||||
}
|
||||
|
||||
if ($insurer_id != 0) {
|
||||
$builder->where('policy_transaction.insurer_id', $insurer_id);
|
||||
}
|
||||
|
||||
if ($policy_type_id != 0) {
|
||||
$builder->where('client_policy.policy_type_id', $policy_type_id);
|
||||
}
|
||||
|
||||
if ($issuer != 0) {
|
||||
$builder->where('policy_transaction.issuer', $issuer);
|
||||
}
|
||||
|
||||
if ($status != 0) {
|
||||
$builder->where('policy_transaction.status', $status);
|
||||
}
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,5 +105,24 @@ class UserModel extends Model
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getUserTeamsByUserID($user_id){
|
||||
|
||||
$user_teams = $this->db->table('user_profiles')
|
||||
->select('user_teams.team_id')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
->where('user_profiles.id', $user_id)
|
||||
->where('user_teams.is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (!empty($user_teams)) {
|
||||
// Extract only the 'team_id' values
|
||||
$team_ids = array_column($user_teams, 'team_id');
|
||||
return $team_ids; // Return array of team IDs
|
||||
} else {
|
||||
return []; // Return empty array if no teams found
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -62,10 +62,23 @@ body {
|
||||
<span class="d-none d-sm-inline-block">Enrolment</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="#bds-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="bds_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">BDS</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('enrollment_dash.php'); ?>
|
||||
<?php include('endorsement_dash.php'); ?>
|
||||
<?php include('bds_dash.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
195
app/Views/bds_dash.php
Normal file
195
app/Views/bds_dash.php
Normal file
@ -0,0 +1,195 @@
|
||||
<style>
|
||||
|
||||
body{
|
||||
margin-top:20px;
|
||||
background:#FAFAFA;
|
||||
}
|
||||
.order-card {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.bg-c-blue {
|
||||
background: linear-gradient(45deg,#4099ff,#73b4ff);
|
||||
}
|
||||
|
||||
.bg-c-green {
|
||||
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
|
||||
}
|
||||
|
||||
.bg-c-yellow {
|
||||
background: linear-gradient(45deg,#FFB64D,#ffcb80);
|
||||
}
|
||||
|
||||
.bg-c-pink {
|
||||
background: linear-gradient(45deg,#FF5370,#ff869a);
|
||||
}
|
||||
|
||||
.bg-c-red {
|
||||
background: linear-gradient(45deg,#FF4E50,#F9D423);
|
||||
}
|
||||
|
||||
.bg-c-purple {
|
||||
background: linear-gradient(45deg,#9D50BB,#6E48AA);
|
||||
}
|
||||
|
||||
.bg-c-orange {
|
||||
background: linear-gradient(45deg,#F2994A,#F2C94C);
|
||||
}
|
||||
|
||||
.bg-c-teal {
|
||||
background: linear-gradient(45deg,#1ABC9C,#16A085);
|
||||
}
|
||||
|
||||
.bg-c-cyan {
|
||||
background: linear-gradient(45deg,#00C9FF,#92FE9D);
|
||||
}
|
||||
|
||||
.bg-c-lime {
|
||||
background: linear-gradient(45deg,#A8E063,#56AB2F);
|
||||
}
|
||||
|
||||
.bg-c-indigo {
|
||||
background: linear-gradient(45deg,#3F51B5,#5A55AE);
|
||||
}
|
||||
|
||||
.bg-c-Pelorous {
|
||||
background: linear-gradient(45deg, #00d6db, #00a8b5);
|
||||
}
|
||||
|
||||
.bg-c-Pelorous2 {
|
||||
background: linear-gradient(45deg, #02a8b5, #017f8b);
|
||||
}
|
||||
|
||||
.bg-c-Pelorous3 {
|
||||
background: linear-gradient(45deg, #098895, #046063);
|
||||
}
|
||||
|
||||
.bg-c-Grenadier {
|
||||
background: linear-gradient(45deg, #ff9d37, #ff7a10);
|
||||
}
|
||||
|
||||
.bg-c-Grenadier2 {
|
||||
background: linear-gradient(45deg, #ff8010, #ff4c00);
|
||||
}
|
||||
|
||||
.bg-c-Grenadier3 {
|
||||
background: linear-gradient(45deg, #f06306, #cc4b05);
|
||||
}
|
||||
|
||||
.bg-c-SilverChalice {
|
||||
background: linear-gradient(45deg, #a3a8a8, #8f9494);
|
||||
}
|
||||
|
||||
.bg-c-SilverChalice2 {
|
||||
background: linear-gradient(45deg, #7e8484, #686e6e);
|
||||
}
|
||||
|
||||
.bg-c-SilverChalice3 {
|
||||
background: linear-gradient(45deg, #5c6363, #434949);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.card {
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
|
||||
box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
|
||||
border: none;
|
||||
margin-bottom: 30px;
|
||||
-webkit-transition: all 0.3s ease-in-out;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.card .card-block {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
|
||||
.order-card i {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.f-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.f-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.m-b-1{
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.modal-right{
|
||||
width: 100% !important;
|
||||
justify-content: normal !important;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
max-height: 100vh;
|
||||
overflow-y: auto;
|
||||
padding-left: 25px !important;
|
||||
padding-right: 25px !important;
|
||||
padding-top: 10px !important;
|
||||
padding-bottom: 35% !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade" id="bds-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
|
||||
<div class="row">
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous order-card" onclick="linkRedirectForBDS(this, 'B')">
|
||||
<div class="card-block">
|
||||
<h6 class="m-b-20 font-15">Business Team Pending</h6>
|
||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= $businessTeamCount ?></span></h2>
|
||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous2 order-card" onclick="linkRedirectForBDS(this, 'F')">
|
||||
<div class="card-block">
|
||||
<h6 class="m-b-20 font-15">Finance Team Pending</h6>
|
||||
<h2 class="text-right"><i class="mdi mdi-playlist-check f-left"></i><span><?= $financeTeamCount ?></span></h2>
|
||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function linkRedirectForBDS(input, team)
|
||||
{
|
||||
var link = "";
|
||||
|
||||
if(team == 'B'){
|
||||
link = '<?= base_url('/policy_tranction/report/report-business-list') ?>'
|
||||
}else if(team == 'F'){
|
||||
link = '<?= base_url('/policy_tranction/report/report-finance-list') ?>'
|
||||
}
|
||||
console.log(link);
|
||||
|
||||
if(link){
|
||||
window.location.href = link;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
440
app/Views/business_team_list.php
Normal file
440
app/Views/business_team_list.php
Normal file
@ -0,0 +1,440 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($clients) && count($clients)) {
|
||||
foreach ($clients as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php if (isset($insurer) && count($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id']?>"><?= $value['name']?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_id" name="policy_type_id">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type"
|
||||
onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="display: none;" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control"
|
||||
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate">
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
|
||||
<a href="<?= base_url("/policy_tranction/report/report-business-list"); ?>"
|
||||
class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/report/report-business-list"); ?>"
|
||||
class="btn btn-primary" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
|
||||
<a href="<?= base_url("/policy_tranction/report/list"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Business Team</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive" style="overflow-x: auto;">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Client Name</th>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Event Type</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($business_list)) { ?>
|
||||
<?php foreach($business_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['policy_no']; ?></td>
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td><?php echo $row['action_type_full']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="
|
||||
<?php
|
||||
if ($row['action_type'] == 'I') {
|
||||
echo base_url("/policy_tranction/inception/list") . '?pt_id=' . $row['policy_trns_id'];
|
||||
} else {
|
||||
echo base_url("/policy_tranction/endorsement/list") . '?pt_id=' . $row['policy_trns_id'];
|
||||
}
|
||||
?>" id="get-policy-list" class="dropdown-item btnEdit">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this)
|
||||
.text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
||||
2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex +
|
||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
||||
'</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams() {
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
console.log('startDate', startDate)
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
|
||||
// Log the values or use them as needed
|
||||
console.log('Start Date:', startDate);
|
||||
console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD-MM-YYYY');
|
||||
var end = moment(endDateParam, 'DD-MM-YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null) {
|
||||
let val = $('#date_type').val();
|
||||
|
||||
if (input) {
|
||||
val = input;
|
||||
}
|
||||
|
||||
if (val != 0) {
|
||||
$('#date_div').show()
|
||||
} else {
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
function sendPolicyTransactionID(event, pt_id) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
console.log(pt_id);
|
||||
|
||||
var queryParams = {
|
||||
pt_id: pt_id,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
</script>
|
||||
@ -11,6 +11,20 @@
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||
color: #000000;
|
||||
}
|
||||
/* .select2-search__field{
|
||||
height: 2px !important;
|
||||
} */
|
||||
|
||||
.select2-selection__choice {
|
||||
background-color: #0a8794 !important;
|
||||
color: white !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.select2-selection__choice__remove {
|
||||
color: white !important;
|
||||
margin-right: 5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
@ -760,6 +774,7 @@ $(document).ready(function() {
|
||||
|
||||
$("#selected").select2({
|
||||
tags: true,
|
||||
placeholder: "Enter Units",
|
||||
tokenSeparators: [], // Disable default token separators
|
||||
createTag: function (params) {
|
||||
var term = $.trim(params.term);
|
||||
@ -772,7 +787,11 @@ $(document).ready(function() {
|
||||
newTag: true
|
||||
};
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("textarea.select2-search__field").attr('rows', '1');
|
||||
$("textarea.select2-search__field").css('resize', 'none');
|
||||
|
||||
|
||||
// Intercept keydown event
|
||||
$("#selected").on('select2:select', function (e) {
|
||||
@ -802,13 +821,13 @@ $(document).ready(function() {
|
||||
// Get the Select2 container element
|
||||
var select2Container = $('#selected').next('.select2-container');
|
||||
|
||||
|
||||
// Find the dropdown within the Select2 container
|
||||
var select2Dropdown = select2Container.find('.select2-dropdown');
|
||||
|
||||
// Set the display style to none
|
||||
select2Dropdown.css('display', 'none');
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_docs">File<span
|
||||
class="text-danger">*</span></label>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
|
||||
<input class="form-control" type="file" name="file_name" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
||||
<div class="form-group col-md-4" style="<?= isset($client['id']) ? 'margin-top: 41px;' : 'margin-top: 30px;' ?>">
|
||||
@ -174,13 +174,19 @@
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
"?client_id=" + item.client_id +
|
||||
"&file_type=kyc" +
|
||||
"&file_name=" + item.file_name +
|
||||
"&client_policy_id=client_policy_id";
|
||||
|
||||
// console.log('step 1')
|
||||
|
||||
if(item.file_name != null && item.file_name != ""){
|
||||
// console.log('step 2')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).show();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', url);
|
||||
$('#delete_'+item.kyc_doc_type_id).show();
|
||||
|
||||
}
|
||||
@ -227,7 +233,6 @@
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#btn_other_docs').click(function(){
|
||||
$('#others').toggle();
|
||||
$('#other_docs_table').toggle();
|
||||
@ -286,6 +291,14 @@
|
||||
other_docs_count++;
|
||||
}
|
||||
|
||||
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
"?client_id=" + item.client_id +
|
||||
"&file_type=kyc" +
|
||||
"&file_name=" + item.file_name +
|
||||
"&client_policy_id=client_policy_id";
|
||||
|
||||
|
||||
|
||||
// console.log("Current item:", item);
|
||||
if (item.kyc_doc_type_id == '0') {
|
||||
// console.log("Appending item:", item);
|
||||
@ -294,14 +307,16 @@
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td>
|
||||
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
|
||||
<a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
$('#other_docs').append(rowHtml);
|
||||
|
||||
//<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
|
||||
|
||||
if(other_docs_count > 0){
|
||||
$('#others').show()
|
||||
$('#other_docs_table').show();
|
||||
@ -406,13 +421,12 @@
|
||||
</td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td>
|
||||
<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
|
||||
<a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
||||
</td>
|
||||
</tr>`;
|
||||
tbody.append(row);
|
||||
});
|
||||
|
||||
//<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -430,9 +444,9 @@
|
||||
|
||||
function appendKycTableListData(data){
|
||||
|
||||
console.log('-----------------------------------------------------------')
|
||||
console.log('appendKycTableListData function called')
|
||||
console.log('-----------------------------------------------------------')
|
||||
// console.log('-----------------------------------------------------------')
|
||||
// console.log('appendKycTableListData function called')
|
||||
// console.log('-----------------------------------------------------------')
|
||||
|
||||
var table = '';
|
||||
|
||||
@ -447,19 +461,27 @@
|
||||
other_docs_count++;
|
||||
}
|
||||
|
||||
|
||||
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
"?client_id=" + item.client_id +
|
||||
"&file_type=kyc" +
|
||||
"&file_name=" + item.file_name +
|
||||
"&client_policy_id=client_policy_id";
|
||||
|
||||
if(item.kyc_doc_type_id == '0'){
|
||||
table += `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td>
|
||||
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
|
||||
<a href = "${url}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" target="_blank"></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
}
|
||||
// <i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
|
||||
});
|
||||
|
||||
$('#other_docs').append(table);
|
||||
@ -480,11 +502,17 @@
|
||||
|
||||
// console.log('step 1')
|
||||
|
||||
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
"?client_id=" + item.client_id +
|
||||
"&file_type=kyc" +
|
||||
"&file_name=" + item.file_name +
|
||||
"&client_policy_id=client_policy_id";
|
||||
|
||||
if(item.file_name != null && item.file_name != ""){
|
||||
// console.log('step 2')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).show();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', url).attr('target', '_blank');;
|
||||
$('#delete_'+item.kyc_doc_type_id).show();
|
||||
}
|
||||
else{
|
||||
|
||||
@ -237,8 +237,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Initialize Flatpickr for the start date with today's date
|
||||
var openDatePicker = flatpickr("#open_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
@ -717,7 +715,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
|
||||
|
||||
@ -836,7 +834,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (res.data.is_addon == 2 || res.data.is_addon == 3) {
|
||||
|
||||
$("#insurer").next(".select2-container").css({
|
||||
@ -870,7 +867,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
||||
$('#tpa').prop('required', false);
|
||||
$('#tpa_danger').hide()
|
||||
@ -879,13 +875,15 @@
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
$('#client_branch').val(res.data.client_branch_id).select2();
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function(){
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||
}, 2000)
|
||||
|
||||
$('#client_branch').val(res.data.client_branch_id).change();
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
@ -12,9 +12,10 @@
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<form class="parsley-examples" id="drive_file_upload_form" method="post"
|
||||
enctype="multipart/form-data" onsubmit="return validateForm();">
|
||||
enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" id="policy_tranction_primarykey_for_file_upload" name="pt_id">
|
||||
<input type="hidden" id="client_policy_id_for_file_upload" name="client_policy_id">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@ -50,7 +51,7 @@
|
||||
<th>S.No</th>
|
||||
<th>Docs Name</th>
|
||||
<th>File Name</th>
|
||||
<th>Drive File Location</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="table_bd">
|
||||
|
||||
@ -911,10 +911,10 @@ $(document).ready(function() {
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = true;
|
||||
if (select.options[i].value === "inception") {
|
||||
if (select.options[i].value === "inception" || select.options[i].value === "enrollment") {
|
||||
select.options[i].disabled = false;
|
||||
}
|
||||
if (select.options[i].value === "") {
|
||||
if (select.options[i].value === "" || select.options[i].value === "enrollment") {
|
||||
select.options[i].disabled = false;
|
||||
}
|
||||
}
|
||||
@ -935,7 +935,7 @@ $(document).ready(function() {
|
||||
console.error('Error fetching data from API:', error);
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
if (select.options[i].value === "inception") {
|
||||
if (select.options[i].value === "inception" || select.options[i].value === "enrollment" ) {
|
||||
select.options[i].disabled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet"> -->
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script> -->
|
||||
|
||||
<!-- Bootstrap JS (ensure this is included) -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
|
||||
|
||||
440
app/Views/finance_team_list.php
Normal file
440
app/Views/finance_team_list.php
Normal file
@ -0,0 +1,440 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="finance_filter">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($clients) && count($clients)) {
|
||||
foreach ($clients as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php if (isset($insurer) && count($insurer)) { ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id']?>"><?= $value['name']?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_id" name="policy_type_id">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type"
|
||||
onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="display: none;" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control"
|
||||
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate">
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
|
||||
<a href="<?= base_url("/policy_tranction/report/report-finance-list"); ?>"
|
||||
class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/report/report-finance-list"); ?>"
|
||||
class="btn btn-primary" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
|
||||
<a href="<?= base_url("/policy_tranction/report/list"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" id="finance_list">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Finance Team</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive" style="overflow-x: auto;">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Client Name</th>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Event Type</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($finance_list)) { ?>
|
||||
<?php foreach($finance_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['policy_no']; ?></td>
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td><?php echo $row['action_type_full']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="
|
||||
<?php
|
||||
if ($row['action_type'] == 'I') {
|
||||
echo base_url("/policy_tranction/inception/list") . '?pt_id=' . $row['id'];
|
||||
} else {
|
||||
echo base_url("/policy_tranction/endorsement/list") . '?pt_id=' . $row['id'];
|
||||
}
|
||||
?>" id="get-policy-list" class="dropdown-item btnEdit">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this)
|
||||
.text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
||||
2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex +
|
||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
||||
'</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams() {
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
console.log('startDate', startDate)
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
|
||||
// Log the values or use them as needed
|
||||
console.log('Start Date:', startDate);
|
||||
console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD-MM-YYYY');
|
||||
var end = moment(endDateParam, 'DD-MM-YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null) {
|
||||
let val = $('#date_type').val();
|
||||
|
||||
if (input) {
|
||||
val = input;
|
||||
}
|
||||
|
||||
if (val != 0) {
|
||||
$('#date_div').show()
|
||||
} else {
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
function sendPolicyTransactionID(event, pt_id) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
console.log(pt_id);
|
||||
|
||||
var queryParams = {
|
||||
pt_id: pt_id,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
</script>
|
||||
@ -113,13 +113,10 @@ table.dataTable tbody td {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Insurer Statement List</h4>
|
||||
</div>
|
||||
<!-- <div class="col-2" id="add_div" style="text-align: right; position: relative;top: 56px; left: 314px;"> -->
|
||||
<!-- <button type="button" id="change_status" class="btn btn-primary waves-effect waves-light">Invoice Status</button> -->
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div class="col-1" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;"> -->
|
||||
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<button type="button" id="btnAdd" onclick="showFileUploadModal()" class="btn btn-primary waves-effect waves-light">Upload</button>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
@ -155,18 +152,20 @@ table.dataTable tbody td {
|
||||
|
||||
<td><?php echo (isset($invoice_status_array[ $row['invoice_status'] ]) ? $invoice_status_array[ $row['invoice_status'] ] : ' - ') ?>
|
||||
<span class="col-xl-3 col-lg-4 col-sm-6">
|
||||
<?php if($row['file_status'] == 'success' ) { ?>
|
||||
<i class="fe-alert-circle"
|
||||
data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="<?php echo 'Exp Invoice Amt: ' . (isset($row['exp_inv_amt']) ? $row['exp_inv_amt'] : '0.00' ) . ' Received Invoice Amt: ' . (isset($row['received_inv_amt']) ? $row['received_inv_amt'] : '0.00') ; ?>"
|
||||
title="<?php echo 'Invoice Amt: ' . (isset($row['invoice_amount']) ? $row['invoice_amount'] : '0.00' ) . ' Received Amt: ' . (isset($row['received_inv_amt']) ? $row['received_inv_amt'] : '0.00') ; ?>"
|
||||
data-original-title="Tooltip on right">
|
||||
</i>
|
||||
<?php } ?>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
<td><?php echo change_date_format($row['created_at'],'Y-m-d H:i:s','d M Y h:i a').' by <br>'.$row['first_name'] ?></td>
|
||||
<td>
|
||||
|
||||
<?php if($row['file_status'] != 'failed'){?>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
@ -175,6 +174,7 @@ table.dataTable tbody td {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@ -203,7 +203,7 @@ table.dataTable tbody td {
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<div class="form-group col-md-10">
|
||||
<label for="insurer"> Insurer <spanclass="text-danger">*</spanclass=></label>
|
||||
<select class="form-control" id="insurer" name="insurer" required>
|
||||
<option value="" selected>Select Insurer</option>
|
||||
@ -216,11 +216,11 @@ table.dataTable tbody td {
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<div class="form-group col-md-10">
|
||||
<label for="statement_month">Statement month</label>
|
||||
<input type="date" class="form-control" id="statement_month" name="statement_month" placeholder="Enter Invoice Number" required>
|
||||
<input type="text" class="form-control" id="statement_month" name="statement_month" placeholder="" required readonly>
|
||||
</div>
|
||||
<div class="form-group col-md-12" >
|
||||
<div class="form-group col-md-10" >
|
||||
<label for="statment">Statement </label> <span><a href="downloadSampleInsurerStatement" id="download_sample_file" style="font-size: small;">Download sample file</a></span>
|
||||
<input type="file" class="form-control" name="statement" required accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||||
</div>
|
||||
@ -254,7 +254,7 @@ table.dataTable tbody td {
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<!-- Invoice status content modal-->
|
||||
<div class="modal fade" id="invoice_modal" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="invoice_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -282,25 +282,29 @@ table.dataTable tbody td {
|
||||
</select>
|
||||
<input type="hidden" id="hidden_statement_id" name="hidden_statement_id">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<!-- <div class="form-group col-md-4">
|
||||
<label for="addon_policy">Exp Amount</label>
|
||||
<input type="text" class="form-control" id="modal_exp_amt" placeholder="Enter Invoice Number" disabled>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="addon_policy">Received Amount</label>
|
||||
<input type="text" class="form-control" id="modal_received_amt" placeholder="Enter Invoice Number" disabled>
|
||||
<input type="text" class="form-control" id="modal_exp_amt" placeholder="" disabled>
|
||||
</div> -->
|
||||
<div class="form-group col-md-4" id="modal_received_amt_div">
|
||||
<label for="addon_policy">Total Received Amount</label>
|
||||
<input type="text" class="form-control" id="modal_received_amt" placeholder="" disabled>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Invoice Number and Invoice Date in same row -->
|
||||
<div class="row" id="invoice_no_div_modal" style="display: none;">
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="invoice_no">Invoice Number<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="invoice_no_modal" name="invoice_no" placeholder="Enter Invoice Number" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="invoice_no">Invoice Amount<span id="base_danger" class="text-danger"></span></label>
|
||||
<input type="number" class="form-control" id="invoice_amount_no_modal" name="invoice_amount" placeholder="Enter Invoice Amt" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="invoice_date">Invoice Date</label>
|
||||
<input type="date" class="form-control" id="invoice_date_modal" name="invoice_date" value="<?php echo date('Y-m-d'); ?>" required>
|
||||
<input type="text" class="form-control" id="invoice_date_modal" name="invoice_date" value="<?php echo date('Y-m-d'); ?>" readonly required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -315,7 +319,8 @@ table.dataTable tbody td {
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="display: none;">pk</th>
|
||||
<th>Invoice Amount</th>
|
||||
<th>Received Amount</th>
|
||||
<th>TDS</th>
|
||||
<th>UTR Number</th>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
@ -324,9 +329,10 @@ table.dataTable tbody td {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
|
||||
<td><input type="date" class="form-control" name="payment_date[]" value="<?php echo date('Y-m-d'); ?>" required></td>
|
||||
<td><input type="text" class="form-control payment_date" name="payment_date[]" value="<?php echo date('d-m-Y'); ?>" placeholder="dd-mm-yyyy" required readonly></td>
|
||||
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -354,19 +360,24 @@ table.dataTable tbody td {
|
||||
const invoiceNoDiv = document.getElementById('invoice_no_div_modal');
|
||||
// const invoiceDateDiv = document.getElementById('invoice_date_div_modal');
|
||||
const paymentTableDiv = document.getElementById('payment_table_div_modal');
|
||||
const totalReceivedAmtDiv = document.getElementById('modal_received_amt_div');
|
||||
|
||||
// Hide everything initially
|
||||
invoiceNoDiv.style.display = 'none';
|
||||
// invoiceDateDiv.style.display = 'none';
|
||||
paymentTableDiv.style.display = 'none';
|
||||
totalReceivedAmtDiv.style.display = 'none';
|
||||
|
||||
// Show fields based on selected status
|
||||
if (invoiceStatus === 'generated' || invoiceStatus === 'sent') {
|
||||
invoiceNoDiv.style.display = 'flex';
|
||||
totalReceivedAmtDiv.style.display = 'none';
|
||||
switchRequired('invoice_no_modal',true);
|
||||
switchRequired('invoice_date_modal',true);
|
||||
switchRequired('invoice_amount_no_modal',true);
|
||||
|
||||
switchRequired('invoice_amount',false,'name');
|
||||
switchRequired('received_amount',false,'name');
|
||||
switchRequired('tds',false,'name');
|
||||
switchRequired('utr_no',false,'name');
|
||||
switchRequired('payment_date',false,'name');
|
||||
switchRequired('pk',false,'name');
|
||||
@ -374,24 +385,32 @@ table.dataTable tbody td {
|
||||
} else if (invoiceStatus === 'payment_received') {
|
||||
invoiceNoDiv.style.display = 'flex';
|
||||
paymentTableDiv.style.display = 'block';
|
||||
totalReceivedAmtDiv.style.display = 'block';
|
||||
switchRequired('invoice_no_modal',true);
|
||||
switchRequired('invoice_date_modal',true);
|
||||
|
||||
switchRequired('invoice_amount',true,'name');
|
||||
switchRequired('invoice_amount_no_modal',true);
|
||||
|
||||
|
||||
switchRequired('received_amount',true,'name');
|
||||
switchRequired('utr_no',true,'name');
|
||||
switchRequired('tds',true,'name');
|
||||
switchRequired('payment_date',true,'name');
|
||||
switchRequired('pk',true,'name');
|
||||
}else if(invoiceStatus === 'pending')
|
||||
{
|
||||
invoiceNoDiv.style.display = 'none';
|
||||
paymentTableDiv.style.display = 'none';
|
||||
totalReceivedAmtDiv.style.display = 'none';
|
||||
// switchRequired('modal_received_amt_div',false);
|
||||
switchRequired('invoice_no_modal',false);
|
||||
switchRequired('invoice_date_modal',false);
|
||||
switchRequired('invoice_amount_no_modal',false);
|
||||
|
||||
switchRequired('invoice_amount',false,'name');
|
||||
switchRequired('received_amount',false,'name');
|
||||
switchRequired('utr_no',false,'name');
|
||||
switchRequired('payment_date',false,'name');
|
||||
switchRequired('pk',false,'name');
|
||||
switchRequired('tds',false,'name');
|
||||
|
||||
}
|
||||
});
|
||||
@ -417,12 +436,21 @@ table.dataTable tbody td {
|
||||
$('#invoiceForm').on('submit', function (e) {
|
||||
e.preventDefault(); // Prevent default form submission
|
||||
var form = document.getElementById('invoiceForm');
|
||||
if(!form.checkValidity())
|
||||
// alert(form.checkValidity());
|
||||
// alert($('#invoice_date_modal').val());
|
||||
if((!form.checkValidity()))
|
||||
{
|
||||
// console.log('error2');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($('#invoice_date_modal').val().trim() === '' && $('#invoice_status').val() != 'pending')
|
||||
{
|
||||
// console.log('error1');
|
||||
return false;
|
||||
}
|
||||
// console.log('final');
|
||||
// return false;
|
||||
// Serialize form data to array and then convert to JSON
|
||||
var formData = new FormData(form);
|
||||
var formDataJSON = {};
|
||||
@ -456,14 +484,13 @@ table.dataTable tbody td {
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
// Close the modal
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.hide();
|
||||
|
||||
|
||||
$('.close').click()
|
||||
// Reset the form data
|
||||
$('#invoiceForm')[0].reset();
|
||||
|
||||
// Optionally display success message or perform further actions
|
||||
|
||||
alert('Invoice updated successfully!');
|
||||
location.reload();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Handle any errors
|
||||
@ -471,6 +498,7 @@ table.dataTable tbody td {
|
||||
alert('An error occurred while updating the invoice.');
|
||||
}
|
||||
});
|
||||
// location.reload();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(10).fadeOut('slow');
|
||||
});
|
||||
@ -484,13 +512,18 @@ table.dataTable tbody td {
|
||||
|
||||
newRow.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" placeholder="Enter Amount"></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
|
||||
<td><input type="date" class="form-control" value="<?php echo date('Y-m-d'); ?>" name="payment_date[]" placeholder="Enter UTR No" required></td>
|
||||
<td><input type="text" class="form-control payment_date" value="<?php echo date('d-m-Y'); ?>" name="payment_date[]" placeholder="Enter UTR No" required readonly></td>
|
||||
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
`;
|
||||
|
||||
tableBody.appendChild(newRow);
|
||||
$('.payment_date').datepicker({
|
||||
format: 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
});
|
||||
|
||||
// Remove row
|
||||
@ -529,33 +562,7 @@ table.dataTable tbody td {
|
||||
});
|
||||
|
||||
|
||||
function switchRequired(elementId, isRequired, type = 'id') {
|
||||
|
||||
if(type == 'id')//id attribute
|
||||
{
|
||||
let element = document.getElementById(elementId);
|
||||
if (isRequired) {
|
||||
element.setAttribute('required', 'required');
|
||||
} else {
|
||||
element.removeAttribute('required');
|
||||
}
|
||||
}
|
||||
else //name attribute
|
||||
{
|
||||
var name_attribute = elementId+'[]';
|
||||
// Select all elements with the name 'invoice_amt[]'
|
||||
var elements = document.getElementsByName(name_attribute);
|
||||
|
||||
// Loop through the elements and set or remove the 'required' attribute
|
||||
elements.forEach(function(element) {
|
||||
if (isRequired) {
|
||||
element.setAttribute('required', 'required'); // Make required
|
||||
} else {
|
||||
element.removeAttribute('required'); // Remove required
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -568,16 +575,31 @@ function showFileUploadModal(input)
|
||||
// $(input).val('');
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var day = ("0" + date.getDate()).slice(-2);
|
||||
var month = ("0" + (date.getMonth() + 1)).slice(-2);
|
||||
var year = date.getFullYear();
|
||||
return day + "-" + month + "-" + year;
|
||||
}
|
||||
function formatDateToDMY(dateStr) {
|
||||
// Split the date string by the hyphen
|
||||
var parts = dateStr.split('-');
|
||||
return parts[2] + '-' + parts[1] + '-' + parts[0]; // Rearrange to DD-MM-YYYY
|
||||
}
|
||||
function showInvoiceStatusModal(event)
|
||||
{
|
||||
var modal_received_amt_div = document.getElementById('modal_received_amt_div');
|
||||
modal_received_amt_div.style.display = 'none';
|
||||
// alert();
|
||||
// console.log(event.target.data)
|
||||
var dataId = event.target.getAttribute('data-id');
|
||||
var dataExpAmt = event.target.getAttribute('data-exp-amt');
|
||||
var dataReceivedAmt = event.target.getAttribute('data-received-amt');
|
||||
// Set the value to a hidden input field in the modal
|
||||
document.getElementById('hidden_statement_id').value = dataId;
|
||||
document.getElementById('modal_exp_amt').value = dataExpAmt;
|
||||
// document.getElementById('modal_exp_amt').value = dataExpAmt;
|
||||
document.getElementById('modal_received_amt').value = dataReceivedAmt;
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
// AJAX call to get the invoice details based on data-id
|
||||
@ -602,8 +624,14 @@ function showInvoiceStatusModal(event)
|
||||
}
|
||||
|
||||
document.getElementById('invoice_no_modal').value = response.data.invoice_no;
|
||||
document.getElementById('invoice_date_modal').value = response.data.invoice_date;
|
||||
document.getElementById('invoice_date_modal').value = response.data.invoice_date === '' ? <?php echo date('d-m-Y')?> : response.data.invoice_date;
|
||||
document.getElementById('invoice_amount_no_modal').value = response.data.invoice_amount;
|
||||
|
||||
if (!$('#invoice_date_modal').val()) {
|
||||
// alert('nope');
|
||||
// Set today's date as the default date
|
||||
$('#invoice_date_modal').datepicker('setDate', new Date());
|
||||
}
|
||||
// Clear existing rows in the payment table
|
||||
var paymentTableBody = document.querySelector('#payment_table_modal tbody');
|
||||
|
||||
@ -616,14 +644,15 @@ function showInvoiceStatusModal(event)
|
||||
var row = paymentTableBody.insertRow();
|
||||
row.innerHTML = `
|
||||
<td style="display: none;"><input type="hidden" class="form-control" name="pk[]" value="${payment.id}"></td>
|
||||
<td><input type="number" class="form-control" name="invoice_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" value="${payment.inv_amt}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter Amount" value="${payment.tds}" onchange="checkInvAmont(event)" required></td>
|
||||
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" value="${payment.utr_no}" required></td>
|
||||
<td><input type="date" class="form-control" name="payment_date[]" value="${payment.received_date}" required></td>
|
||||
<td><input type="text" class="form-control payment_date" name="payment_date[]" value="${formatDateToDMY(payment.received_date)}" required readonly></td>
|
||||
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
$('.payment_date').datepicker({ format: 'dd-mm-yyyy',autoclose: true});
|
||||
// Show the modal
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.show();
|
||||
@ -641,17 +670,51 @@ function showInvoiceStatusModal(event)
|
||||
});
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(10).fadeOut('slow');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
myModal.show();
|
||||
// var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
|
||||
// myModal.show();
|
||||
// $(input).val('');
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var rollover_date = flatpickr("#statement_month", {
|
||||
dateFormat: "Y-M-d",
|
||||
allowInput: true
|
||||
// var rollover_date = flatpickr("#statement_month", {
|
||||
// dateFormat: "Y-M",
|
||||
// allowInput: true
|
||||
// });
|
||||
$('#statement_month').datepicker({
|
||||
format: 'yyyy-M',
|
||||
viewMode: 'months',
|
||||
minViewMode: 'months',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
|
||||
$('.payment_date').datepicker({
|
||||
format: 'dd-mm-yyyy',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
// Get today's date
|
||||
var today = new Date();
|
||||
|
||||
// Calculate the minimum date (60 days before today)
|
||||
var minDate = new Date();
|
||||
minDate.setDate(today.getDate() - 180);
|
||||
|
||||
// Calculate the maximum date (60 days after today)
|
||||
var maxDate = new Date();
|
||||
maxDate.setDate(today.getDate() + 180);
|
||||
$('#invoice_date_modal').datepicker({
|
||||
format: 'dd-mm-yyyy',
|
||||
autoclose: true,
|
||||
startDate: minDate,
|
||||
endDate: maxDate
|
||||
});
|
||||
|
||||
// var invoice_date_modal = flatpickr("#invoice_date_modal", {
|
||||
// dateFormat: "d-m-Y",
|
||||
// allowInput: true
|
||||
// });
|
||||
});
|
||||
|
||||
|
||||
@ -692,7 +755,7 @@ $(document).ready(function(){
|
||||
toastr.success(
|
||||
'File upload successs',
|
||||
'success');
|
||||
$('.close').click()
|
||||
$('.close').click();
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
@ -765,19 +828,59 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
|
||||
function checkInvAmont(event)
|
||||
{
|
||||
function checkInvAmont(event) {
|
||||
var total = 0;
|
||||
document.querySelectorAll('input[name="invoice_amount[]"]').forEach(function(el) {
|
||||
let val = parseFloat(el.value) || 0;
|
||||
total += val;
|
||||
});
|
||||
var exp_amt = document.getElementById('modal_exp_amt').value;
|
||||
if(exp_amt < total)
|
||||
{
|
||||
alert('Exceeds expected amt');
|
||||
event.target.value = '';
|
||||
var receivedAmounts = document.querySelectorAll('input[name="received_amount[]"]');
|
||||
var tdsAmounts = document.querySelectorAll('input[name="tds[]"]');
|
||||
// console.log();
|
||||
receivedAmounts.forEach(function(el, index) {
|
||||
// Get the received amount
|
||||
let receivedVal = parseFloat(el.value) || 0;
|
||||
// Get the corresponding tds amount (paired with the received amount)
|
||||
let tdsVal = parseFloat(tdsAmounts[index].value) || 0;
|
||||
// Add received amount and tds amount
|
||||
// console.log();
|
||||
total += (receivedVal + tdsVal);
|
||||
});
|
||||
// console.log(total);
|
||||
// Get the expected invoice amount
|
||||
var exp_amt = parseFloat(document.getElementById('invoice_amount_no_modal').value) || 0;
|
||||
|
||||
// Check if the total exceeds the expected amount
|
||||
if (exp_amt < total) {
|
||||
alert('Exceeds Invoice amount');
|
||||
event.target.value = ''; // Reset the value of the element that triggered the event
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function switchRequired(elementId, isRequired, type = 'id') {
|
||||
// console.log('switchRequired: ' + elementId+' - '+' - '+ type);
|
||||
if(type == 'id')//id attribute
|
||||
{
|
||||
let element = document.getElementById(elementId);
|
||||
if (isRequired) {
|
||||
element.setAttribute('required', 'required');
|
||||
} else {
|
||||
element.removeAttribute('required');
|
||||
}
|
||||
}
|
||||
else //name attribute
|
||||
{
|
||||
var name_attribute = elementId+'[]';
|
||||
// Select all elements with the name 'invoice_amt[]'
|
||||
var elements = document.getElementsByName(name_attribute);
|
||||
|
||||
// Loop through the elements and set or remove the 'required' attribute
|
||||
elements.forEach(function(element) {
|
||||
if (isRequired) {
|
||||
element.setAttribute('required', 'required'); // Make required
|
||||
} else {
|
||||
element.removeAttribute('required'); // Remove required
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -652,6 +652,7 @@
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
@ -667,18 +668,44 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (in_array(BUSINESS_TEAM_ID, user_team())) { ?>
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">DMS Search</a>
|
||||
<a href="<?= base_url('/dmsSearch') ?>">Documents</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- End Sidebar -->
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -21,12 +21,6 @@ table.dataTable thead th {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.readonly-select {
|
||||
pointer-events: none;
|
||||
background-color: #f0f0f0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.column-header {
|
||||
margin-right: 10px; /* Adjust this value as needed */
|
||||
}
|
||||
@ -44,6 +38,131 @@ table.dataTable thead th {
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="endorsement_filter">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id_for_search" name="client_id" >
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($client) && count($client)) {
|
||||
foreach ($client as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id_for_search" name="insurer_id" >
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id']?>"><?= $value['name']?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_for_search" name="policy_type_id" >
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer_for_search" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Status <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_status_for_search" name="policy_type_id" >
|
||||
<option value="0">Select Status</option>
|
||||
<?php
|
||||
if (isset($policy_status) && count($policy_status)) {
|
||||
foreach ($policy_status as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="display: none;" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate">
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
|
||||
<a href="<?= base_url("/policy_tranction/endorsement/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/endorsement/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="endorsement_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -60,6 +179,7 @@ table.dataTable thead th {
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Sno</th>
|
||||
<th>Issuer</th>
|
||||
<th>Client</th>
|
||||
<th>Branch</th>
|
||||
@ -68,7 +188,7 @@ table.dataTable thead th {
|
||||
<th>Endorsement Type</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Data Recived Date</th>
|
||||
<th>No of Employees</th>
|
||||
<th>No of Insured</th>
|
||||
<th>No of Dependence</th>
|
||||
<th>Closure Date</th>
|
||||
<th>Status</th>
|
||||
@ -76,8 +196,9 @@ table.dataTable thead th {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($endorsement_data_list as $row){ ?>
|
||||
<?php foreach($endorsement_data_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $index+1; ?></td>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? ''; ?></td>
|
||||
<td><?php echo $row['client_short_name']; ?></td>
|
||||
<td><?php echo $row['client_branch_name']; ?></td>
|
||||
@ -85,17 +206,17 @@ table.dataTable thead th {
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $action_type[$row['action_type']]; ?></td>
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['data_received_date'])); ?></td>
|
||||
<td><?php echo $row['emp_count']; ?></td>
|
||||
<td><?php echo $row['dependent_count']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['closure_date'])); ?></td>
|
||||
<td><?php echo empty($row['data_received_date']) ? '' : date('d/m/Y', strtotime($row['data_received_date'])); ?></td>
|
||||
<td class="right-align-input"><?php echo $row['emp_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['dependent_count']; ?></td>
|
||||
<td><?php echo empty($row['closure_date']) ? '' : date('d/m/Y', strtotime($row['closure_date'])); ?></td>
|
||||
<td><?php echo $policy_status[$row['status']]; ?></td>
|
||||
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEndorsementEdit(this)"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEndorsementEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -171,7 +292,8 @@ table.dataTable thead th {
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
@ -184,41 +306,61 @@ table.dataTable thead th {
|
||||
var today = new Date();
|
||||
|
||||
var data_received_date = flatpickr("#data_received_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
allowInput: false
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
parseDate: (datestr, format) => {
|
||||
return new Date(datestr.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3"));
|
||||
},
|
||||
onOpen: function(selectedDates, dateStr, instance) {
|
||||
instance.setDate(instance.input.value, false);
|
||||
},
|
||||
onInput: function(selectedDates, dateStr, instance) {
|
||||
let inputValue = instance.input.value;
|
||||
let formattedDate = inputValue.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3");
|
||||
instance.input.value = formattedDate;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var closure_date = flatpickr("#closure_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var start_date = flatpickr("#policy_start_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
allowInput: false
|
||||
});
|
||||
// var start_date = flatpickr("#policy_start_date", {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
var end_date = flatpickr("#policy_end_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
allowInput: false
|
||||
});
|
||||
// var end_date = flatpickr("#policy_end_date", {
|
||||
// dateFormat: "d/m/Y",
|
||||
// allowInput: false
|
||||
// });
|
||||
|
||||
var endorse_eff_date = flatpickr("#endorse_eff_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
})
|
||||
var month = flatpickr("#month", {
|
||||
dateFormat: "M/Y",
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hide_list_show_add()
|
||||
{
|
||||
removeAllColumnsExceptFirst('insurerTable');
|
||||
$('.hideter').hide()
|
||||
$('.hidetp').hide()
|
||||
$('#endorsement_form_id')[0].reset();
|
||||
$('#client_id').val('').change();
|
||||
$('#client_policy_id').val('').change();
|
||||
$('#endorsement_form').show()
|
||||
$('#endorsement_list').hide()
|
||||
$('#invoice_no_div').hide()
|
||||
$('#endorsement_form').show();
|
||||
$('#endorsement_list').hide();
|
||||
$('#endorsement_filter').hide();
|
||||
$('#invoice_no_div').hide();
|
||||
$('#invoice_no').attr('required', false)
|
||||
}
|
||||
|
||||
@ -226,6 +368,7 @@ table.dataTable thead th {
|
||||
{
|
||||
$('#endorsement_form').hide()
|
||||
$('#endorsement_list').show()
|
||||
$('#endorsement_filter').show()
|
||||
|
||||
}
|
||||
|
||||
@ -330,6 +473,7 @@ table.dataTable thead th {
|
||||
'data-etp' : item.etp,
|
||||
'data-iep' : item.iep,
|
||||
'data-itp' : item.itp,
|
||||
'data-bap' : item.bap,
|
||||
'data-tpa' : item.tpa_branch_id + '-' + item.tpa_id,
|
||||
});
|
||||
$('#client_policy_id').append(option);
|
||||
@ -429,4 +573,170 @@ table.dataTable thead th {
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id_for_search').select2();
|
||||
$('#insurer_id_for_search').select2();
|
||||
$('#policy_type_for_search').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event)
|
||||
{
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id_for_search').val();
|
||||
var insurer_id = $('#insurer_id_for_search').val();
|
||||
var policy_type_id = $('#policy_type_for_search').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer_for_search').val();
|
||||
var status = $('#policy_status_for_search').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
status: status,
|
||||
};
|
||||
|
||||
console.log(queryParams)
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj)
|
||||
{
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams()
|
||||
{
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
const status = params.get('status') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
// console.log('startDate', startDate)
|
||||
// console.log('endDate', endDate)
|
||||
// console.log('client_id', client_id)
|
||||
// console.log('insurer_id', insurer_id)
|
||||
// console.log('policy_type_id', policy_type_id)
|
||||
// console.log('date_type', date_type)
|
||||
// console.log('issuer', issuer)
|
||||
// console.log('status', status)
|
||||
|
||||
// Log the values or use them as needed
|
||||
// console.log('Start Date:', startDate);
|
||||
// console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function(){
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id_for_search').val(client_id).change()
|
||||
$('#insurer_id_for_search').val(insurer_id).change()
|
||||
$('#policy_type_for_search').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer_for_search').val(issuer)
|
||||
$('#policy_status_for_search').val(status)
|
||||
},1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD/MM/YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD/MM/YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD/MM/YYYY');
|
||||
var end = moment(endDateParam, 'DD/MM/YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D/MM/YYYY') + ' - ' + end.format('D/MM/YYYY'));
|
||||
$('#startDate').val(start.format('DD/MM/YYYY'));
|
||||
$('#endDate').val(end.format('DD/MM/YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id_for_search').val('0').change();
|
||||
$('#insurer_id_for_search').val('0').change();
|
||||
$('#policy_type_for_search').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer_for_search').val('0');
|
||||
$('#policy_status_for_search').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null)
|
||||
{
|
||||
let val = $('#date_type').val();
|
||||
|
||||
if(input){
|
||||
val = input;
|
||||
}
|
||||
|
||||
if(val != 0){
|
||||
$('#date_div').show()
|
||||
}else{
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -105,6 +105,131 @@ table.dataTable tbody td {
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="inception_filter">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h4 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h4>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id_for_search" name="client_id" >
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($client) && count($client)) {
|
||||
foreach ($client as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger" class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id_for_search" name="insurer_id" >
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id']?>"><?= $value['name']?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_for_search" name="policy_type_id" >
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer_for_search" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Status <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_status_for_search" name="policy_type_id" >
|
||||
<option value="0">Select Status</option>
|
||||
<?php
|
||||
if (isset($policy_status) && count($policy_status)) {
|
||||
foreach ($policy_status as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type" onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="display: none;" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate">
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
|
||||
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/inception/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="inception_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -122,6 +247,7 @@ table.dataTable tbody td {
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th><div class="column-header">S.No.</div></th>
|
||||
<th><div class="column-header">Issuer</div></th>
|
||||
<th><div class="column-header">Issuing Type</div></th>
|
||||
<th><div class="column-header">Client Type</div></th>
|
||||
@ -132,7 +258,7 @@ table.dataTable tbody td {
|
||||
<th><div class="column-header">Policy Issue Date</div></th>
|
||||
<th><div class="column-header">D.O.C</div></th>
|
||||
<th><div class="column-header">D.O.E</div></th>
|
||||
<th><div class="column-header">No of Employees</div></th>
|
||||
<th><div class="column-header">No of Insured</div></th>
|
||||
<th><div class="column-header">No of Dependents</div></th>
|
||||
<th><div class="column-header">Status</div></th>
|
||||
<th><div class="column-header">Action</div></th>
|
||||
@ -140,8 +266,9 @@ table.dataTable tbody td {
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach($inception_data_list as $row){ ?>
|
||||
<?php foreach($inception_data_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $index+1; ?></td>
|
||||
<td><?php echo $issuer[$row['issuer']]; ?></td>
|
||||
<td><?php echo $issuing_type[$row['issue_type']]; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
@ -149,17 +276,17 @@ table.dataTable tbody td {
|
||||
<td><?php echo $row['insurer_short_name']; ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['policy_no']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['policy_issue_date'])); ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td><?php echo $row['emp_count']; ?></td>
|
||||
<td><?php echo $row['dependent_count']; ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_issue_date'])); ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td><?php echo empty($row['policy_issue_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td class="right-align-input"><?php echo $row['emp_count']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['dependent_count']; ?></td>
|
||||
<td><?php echo $policy_status[$row['status']]; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit(this)">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
</div>
|
||||
@ -179,57 +306,6 @@ table.dataTable tbody td {
|
||||
|
||||
<?php include('pt_form_file_upload_tab.php'); ?>
|
||||
|
||||
|
||||
<!-- CD No form content modal-->
|
||||
<div class="modal fade" id="cd_form_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="title">Add CD Account Number</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body p-4">
|
||||
<div class="">
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="CDMasterForm" enctype="multipart/form-data">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Opening Date<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="opening_date" id="opening_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="cd_ac_no_data" name="cd_ac_no" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Opening Amount<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="file_upload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
@ -355,7 +431,8 @@ $(document).ready(function() {
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
// ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
@ -367,18 +444,13 @@ $(document).ready(function(){
|
||||
|
||||
var today = new Date();
|
||||
|
||||
var policy_issue_date = flatpickr("#policy_issue_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var opening_date = flatpickr("#opening_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var policy_start_date = flatpickr("#policy_start_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
dateFormat: "d/m/Y",
|
||||
defaultDate: today,
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates, dateStr, instance) {
|
||||
@ -400,21 +472,44 @@ $(document).ready(function(){
|
||||
closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year
|
||||
|
||||
var policy_end_datePicker = flatpickr("#policy_end_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
dateFormat: "d/m/Y",
|
||||
defaultDate: closeDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var renewal_datePicker = flatpickr("#renewal_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var month = flatpickr("#month", {
|
||||
dateFormat: "M/Y", // Format as month and year
|
||||
allowInput: false, // Disable manual input
|
||||
});
|
||||
|
||||
var policy_issue_date = flatpickr("#policy_issue_date", {
|
||||
dateFormat: "d/m/Y", // Format as day-month-year
|
||||
allowInput: false, // Disable manual input
|
||||
onChange: function(selectedDates, dateStr, instance) {
|
||||
// Get the selected date
|
||||
var selectedDate = new Date(selectedDates[0]);
|
||||
|
||||
// Format the selected date to "M-Y"
|
||||
var formattedMonth = flatpickr.formatDate(selectedDate, "M/Y");
|
||||
|
||||
// Set the value of the #month input
|
||||
month.setDate(formattedMonth);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function hide_list_show_add()
|
||||
{
|
||||
$('#page_title').text('Add Policy')
|
||||
@ -440,6 +535,7 @@ function hide_list_show_add()
|
||||
|
||||
$('#pt_onboarding').show()
|
||||
$('#inception_list').hide()
|
||||
$('#inception_filter').hide()
|
||||
$('#policyholdernamediv').hide();
|
||||
$('.branchdiv').show();
|
||||
}
|
||||
@ -448,6 +544,7 @@ function show_list_hide_add()
|
||||
{
|
||||
$('#pt_onboarding').hide()
|
||||
$('#inception_list').show()
|
||||
$('#inception_filter').show();
|
||||
$('#nav_pills').empty()
|
||||
$('#tab_content').empty()
|
||||
count = 0
|
||||
@ -588,91 +685,91 @@ function appendRenewalPolicies(data)
|
||||
});
|
||||
}
|
||||
|
||||
function getCDAccountNumber(client_id, insurer_id)
|
||||
{
|
||||
console.log('getCDAccountNumber')
|
||||
// function getCDAccountNumber(client_id, insurer_id)
|
||||
// {
|
||||
// console.log('getCDAccountNumber')
|
||||
|
||||
// var client_id = $('#client_id').val()
|
||||
// var insurer_id = $('#insurer_id').find('option:selected').attr('data-id');
|
||||
// // var client_id = $('#client_id').val()
|
||||
// // var insurer_id = $('#insurer_id').find('option:selected').attr('data-id');
|
||||
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
// console.log('client_id', client_id)
|
||||
// console.log('insurer_id', insurer_id)
|
||||
|
||||
if(client_id && insurer_id){
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
// if(client_id && insurer_id){
|
||||
// $.ajax({
|
||||
// url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id,
|
||||
// type: "GET",
|
||||
// dataType: 'json',
|
||||
// success: function(res) {
|
||||
|
||||
console.log('cd_res', res);
|
||||
if(res.status == true){
|
||||
// appendCDAccountNumber(res.data[0].cd_ac_no)
|
||||
if(res.data[0].cd_ac_no){
|
||||
$('#cd_ac_no').val(res.data[0].cd_ac_no)
|
||||
}
|
||||
}else{
|
||||
toastr.warning('The insurer does not has a CD account number');
|
||||
}
|
||||
// console.log('cd_res', res);
|
||||
// if(res.status == true){
|
||||
// // appendCDAccountNumber(res.data[0].cd_ac_no)
|
||||
// if(res.data[0].cd_ac_no){
|
||||
// $('#cd_ac_no').val(res.data[0].cd_ac_no)
|
||||
// }
|
||||
// }else{
|
||||
// toastr.warning('The insurer does not has a CD account number');
|
||||
// }
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
function appendCDAccountNumber(data)
|
||||
{
|
||||
console.log('appendCDAccountNumber', data);
|
||||
console.log('appendCDAccountNumber', $('#cd_ac_no'));
|
||||
// function appendCDAccountNumber(data)
|
||||
// {
|
||||
// console.log('appendCDAccountNumber', data);
|
||||
// console.log('appendCDAccountNumber', $('#cd_ac_no'));
|
||||
|
||||
$('#cd_ac_no').empty();
|
||||
// $('#cd_ac_no').empty();
|
||||
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Policy',
|
||||
}));
|
||||
// $('#cd_ac_no').append($('<option>', {
|
||||
// value: '',
|
||||
// text: 'Select Policy',
|
||||
// }));
|
||||
|
||||
$('#cd_ac_no').append($('<option>', {
|
||||
value: 'add_cd',
|
||||
text: '+ Add CD'
|
||||
}));
|
||||
// $('#cd_ac_no').append($('<option>', {
|
||||
// value: 'add_cd',
|
||||
// text: '+ Add CD'
|
||||
// }));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.cd_ac_no,
|
||||
text: item.cd_ac_no,
|
||||
});
|
||||
$('#cd_ac_no').append(option);
|
||||
});
|
||||
}
|
||||
// $.each(data, function(index, item) {
|
||||
// var option = $('<option>', {
|
||||
// value: item.cd_ac_no,
|
||||
// text: item.cd_ac_no,
|
||||
// });
|
||||
// $('#cd_ac_no').append(option);
|
||||
// });
|
||||
// }
|
||||
|
||||
function addCDAccountNumber(input)
|
||||
{
|
||||
var val = $(input).val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
// function addCDAccountNumber(input)
|
||||
// {
|
||||
// var val = $(input).val();
|
||||
// var client_id = $('#client_id').val();
|
||||
// var insurer_id = $('#insurer_id').val();
|
||||
|
||||
console.log('addCDAccountNumber', 'addCDAccountNumber');
|
||||
console.log('client_id', client_id);
|
||||
console.log('insurer_id', insurer_id);
|
||||
// console.log('addCDAccountNumber', 'addCDAccountNumber');
|
||||
// console.log('client_id', client_id);
|
||||
// console.log('insurer_id', insurer_id);
|
||||
|
||||
if(client_id == '' || insurer_id == ''){
|
||||
toastr.warning('Client, Insurer, or both do not exist.');
|
||||
$(input).val('')
|
||||
return false;
|
||||
}
|
||||
// if(client_id == '' || insurer_id == ''){
|
||||
// toastr.warning('Client, Insurer, or both do not exist.');
|
||||
// $(input).val('')
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if(val == 'add_cd')
|
||||
{
|
||||
var myModal = new bootstrap.Modal(document.getElementById('cd_form_modal'));
|
||||
myModal.show();
|
||||
$(input).val('')
|
||||
}
|
||||
}
|
||||
// if(val == 'add_cd')
|
||||
// {
|
||||
// var myModal = new bootstrap.Modal(document.getElementById('cd_form_modal'));
|
||||
// myModal.show();
|
||||
// $(input).val('')
|
||||
// }
|
||||
// }
|
||||
|
||||
function getPolicyDetailsByPolicyId(input)
|
||||
{
|
||||
@ -705,12 +802,12 @@ function addHTMLInput(data = null)
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
newRow.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label for="file_name">Document Name<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" id="docs_name" name="doc_name[]" placeholder="Enter file name">
|
||||
<label for="file_name">Document Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="docs_name" name="doc_name[]" placeholder="Enter file name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="file">Upload File<span class="text-danger"></span></label>
|
||||
<input type="file" class="form-control" id="file_name" name="file[]">
|
||||
<label for="file">Upload File<span class="text-danger">*</span></label>
|
||||
<input type="file" class="form-control" id="file_name" name="file[]" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
@ -815,10 +912,19 @@ function appendFileTableBody(data)
|
||||
row.append($('<td>').text(item.doc_name));
|
||||
row.append($('<td>').text(item.file_name));
|
||||
|
||||
var url = "<?= base_url('/downloadGdriveFile'); ?>" +
|
||||
"?client_id=" + item.client_id +
|
||||
"&file_type=policy" +
|
||||
"&file_name=" + item.file_name +
|
||||
"&client_policy_id=" + item.client_policy_id;
|
||||
|
||||
var link = $('<a>')
|
||||
.attr('href', item.url)
|
||||
.attr('href', url)
|
||||
.attr('target', '_blank') // Open in a new tab
|
||||
.text(item.url); // Text for the link
|
||||
.attr('style', 'font-size:18px;')
|
||||
.attr('data-id', item.id)
|
||||
.addClass('fa fa-download')
|
||||
|
||||
|
||||
// Append the <a> tag inside the <td>
|
||||
row.append($('<td>').append(link));
|
||||
@ -1051,61 +1157,6 @@ $('#invoice_status_modal').change(function(){
|
||||
}
|
||||
})
|
||||
|
||||
$("#CDMasterForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#CDMasterForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
form_action = '<?= base_url("util/createCDAccountNumberUsingAjax"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
|
||||
// console.log('client_id', client_id);
|
||||
// console.log('insurer_id', insurer_id);
|
||||
|
||||
var formData = new FormData($('#CDMasterForm')[0]);
|
||||
formData.append('client_id', client_id);
|
||||
formData.append('insurer_id', insurer_id);
|
||||
|
||||
$.ajax({
|
||||
data:formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res.status == true){
|
||||
appendCDAccountNumber(res.data)
|
||||
toastr.success(res.message, 'Success');
|
||||
}else{
|
||||
toastr.error(res.message, 'Error');
|
||||
}
|
||||
|
||||
$('.close').click();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#invoiceForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
@ -1255,6 +1306,8 @@ $('#issue_type').change(function(){
|
||||
}
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
function formatDateforpolicy(dateStr)
|
||||
{
|
||||
|
||||
@ -1277,4 +1330,170 @@ function onlyNumbers(event)
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id_for_search').select2();
|
||||
$('#insurer_id_for_search').select2();
|
||||
$('#policy_type_for_search').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event)
|
||||
{
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id_for_search').val();
|
||||
var insurer_id = $('#insurer_id_for_search').val();
|
||||
var policy_type_id = $('#policy_type_for_search').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer_for_search').val();
|
||||
var status = $('#policy_status_for_search').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
status: status,
|
||||
};
|
||||
|
||||
console.log(queryParams)
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj)
|
||||
{
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams()
|
||||
{
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
const status = params.get('status') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
// console.log('startDate', startDate)
|
||||
// console.log('endDate', endDate)
|
||||
// console.log('client_id', client_id)
|
||||
// console.log('insurer_id', insurer_id)
|
||||
// console.log('policy_type_id', policy_type_id)
|
||||
// console.log('date_type', date_type)
|
||||
// console.log('issuer', issuer)
|
||||
// console.log('status', status)
|
||||
|
||||
// Log the values or use them as needed
|
||||
// console.log('Start Date:', startDate);
|
||||
// console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function(){
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id_for_search').val(client_id).change()
|
||||
$('#insurer_id_for_search').val(insurer_id).change()
|
||||
$('#policy_type_for_search').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer_for_search').val(issuer)
|
||||
$('#policy_status_for_search').val(status)
|
||||
},1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD/MM/YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD/MM/YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD/MM/YYYY');
|
||||
var end = moment(endDateParam, 'DD/MM/YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D/MM/YYYY') + ' - ' + end.format('D/MM/YYYY'));
|
||||
$('#startDate').val(start.format('DD/MM/YYYY'));
|
||||
$('#endDate').val(end.format('DD/MM/YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id_for_search').val('0').change();
|
||||
$('#insurer_id_for_search').val('0').change();
|
||||
$('#policy_type_for_search').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer_for_search').val('0');
|
||||
$('#policy_status_for_search').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null)
|
||||
{
|
||||
let val = $('#date_type').val();
|
||||
|
||||
if(input){
|
||||
val = input;
|
||||
}
|
||||
|
||||
if(val != 0){
|
||||
$('#date_div').show()
|
||||
}else{
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -8,18 +8,18 @@
|
||||
<span class="d-none d-sm-inline-block">Policy</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">File Upload</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab2">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">KYC Docs</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" id="hide_file_upload" style="display: none;">
|
||||
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">File Upload</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" id="hide_vehicle_tab" style="display: none;">
|
||||
<a href="#vehicle-docs-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="vehicle_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
|
||||
@ -16,6 +16,10 @@ table.dataTable tbody td {
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12" id="second_page">
|
||||
@ -32,49 +36,40 @@ table.dataTable tbody td {
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S. No</th>
|
||||
<th>User Name</th>
|
||||
<th>Month</th>
|
||||
<th>Business Type</th>
|
||||
<th>Date</th>
|
||||
<th>Sales Generated By (Name)</th>
|
||||
<th>Branch (JIBS)</th>
|
||||
<th>Serviced By (Name)</th>
|
||||
<th>Client Name</th>
|
||||
<th>Client Address</th>
|
||||
<th>Client Type</th>
|
||||
<th>Payment From</th>
|
||||
<th>Reference</th>
|
||||
<th>Remarks</th>
|
||||
<th>Policy/Endorsement</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Policy/<br>Endorsement</th>
|
||||
<th>Policy Type</th>
|
||||
<th>BAP Group</th>
|
||||
<th>Vehicle Number</th>
|
||||
<th>Policy No</th>
|
||||
<th>Endorsement No</th>
|
||||
<th>Insurer Name</th>
|
||||
<th>Insurer Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Days Until Expiry</th>
|
||||
<th>Endorsement Effective Date</th>
|
||||
<th>Policy Effective Date</th>
|
||||
<th>Policy Expiry Date</th>
|
||||
<th>Policy Type</th>
|
||||
<th>BAP Group</th>
|
||||
<th>Vehicle Number</th>
|
||||
<th>Endorsement <br> Effective Date</th>
|
||||
<th>Policy <br> Effective Date</th>
|
||||
<th>Policy <br> Expiry Date</th>
|
||||
<th>Reference</th>
|
||||
<th>Remarks</th>
|
||||
<th>Base Premium</th>
|
||||
<th>Terrorism/TP</th>
|
||||
<th>Premium (without GST)</th>
|
||||
<th>Premium <br> (without GST)</th>
|
||||
<th>GST @ 18%</th>
|
||||
<th>Total Premium</th>
|
||||
<th>Base Revenue %</th>
|
||||
<th>TP / Terrorism Revenue %</th>
|
||||
<th>Total IRDA Revenue INR</th>
|
||||
<th>Base <br> Revenue %</th>
|
||||
<th>TP / Terrorism <br> Revenue %</th>
|
||||
<th>Total IRDA <br> Revenue INR</th>
|
||||
<th>GST on Revenue</th>
|
||||
<th>Total Amount Receivable</th>
|
||||
<th>Rewards %</th>
|
||||
<th>Total Amount <br> Receivable</th>
|
||||
<th>Rewards</th>
|
||||
<th>Total Brokerage</th>
|
||||
<th>Payment Ref</th>
|
||||
<th>Invoice Number</th>
|
||||
<th>Invoice Date</th>
|
||||
<th>Invoice Amount</th>
|
||||
<th>Realization Amount</th>
|
||||
<th>Outstanding Amount</th>
|
||||
<th>Payment Status</th>
|
||||
<th>UTR</th>
|
||||
<th>Payment Date</th>
|
||||
@ -85,52 +80,53 @@ table.dataTable tbody td {
|
||||
<?php foreach($report_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['user_name']; ?></td>
|
||||
<td><?php echo $row['policy_issue_month']; ?></td>
|
||||
<td><?php echo $row['revenue_type']; ?></td>
|
||||
<td><?php echo $row['policy_issue_date']; ?></td>
|
||||
<td><?php echo $row['salse_person_name']; ?></td> <!-- Sales Generated By (Name) -->
|
||||
<td><?php echo 'Chennai'; ?></td>
|
||||
<td><?php echo $row['service_person_name']; ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['client_address']; ?></td>
|
||||
<td><?php echo $row['client_type']; ?></td>
|
||||
<td></td> <!-- Payment From -->
|
||||
<td><?php echo $row['ref']; ?></td>
|
||||
<td><?php echo $row['remarks']; ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['action_type']; ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['bap']; ?></td>
|
||||
<td><?php echo $row['vehicle_no'] ?? 'N.A'; ?></td>
|
||||
<td><?php echo $row['policy_no']; ?></td>
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?> </td>
|
||||
<td><?php echo $row['insurer_branch_name']; ?></td>
|
||||
<td><?php echo $row['tpa_name']; ?></td>
|
||||
<td><?php echo $row['days']; ?></td>
|
||||
<td><?php echo $row['endorse_eff_date']; ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td><?php echo date('d-m-Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td><?php echo $row['policy_type']; ?></td>
|
||||
<td><?php echo $row['bap']; ?></td>
|
||||
<td><?php echo $row['vehicle_no'] ?? 'N.A'; ?></td>
|
||||
<td><?php echo $row['bp_amt']; ?></td>
|
||||
<td><?php echo $row['tp_or_ter']; ?></td>
|
||||
<td><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<td><?php echo $row['gst_amount']; ?></td>
|
||||
<td><?php echo $row['total_premium']; ?></td>
|
||||
<td><?php echo $row['agreed_bp_per']; ?></td>
|
||||
<td><?php echo $row['agreed_tp_or_ter_per']; ?></td>
|
||||
<td><?php echo $row['total_irda']; ?></td>
|
||||
<td><?php echo $row['gst_on_revenue']; ?></td>
|
||||
<td><?php echo $row['total_amt_received']; ?></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><?php echo empty($row['endorse_eff_date']) ? '' : date('d/m/Y', strtotime($row['endorse_eff_date'])) ?></td>
|
||||
<td><?php echo empty($row['policy_start_date']) ? '' : date('d/m/Y', strtotime($row['policy_start_date'])); ?></td>
|
||||
<td><?php echo empty($row['policy_end_date']) ? '' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td><?php echo $row['ref']; ?></td>
|
||||
<td><?php echo $row['remarks']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['bp_amt']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['premium_wo_gst']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['gst_amount']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['total_irda']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['gst_on_revenue']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['total_amt_received']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['reward']; ?></td>
|
||||
<td><?php echo $row['invoice_no']; ?></td>
|
||||
<td><?php echo empty($row['invoice_date']) ? '' : date('d/m/Y', strtotime($row['invoice_date'])); ?></td>
|
||||
<td class="right-align-input"><?php echo $row['invoice_amount']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['realization_amount']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['outstanding_amount']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($row['outstanding_amount'] == '0.00'){
|
||||
echo 'Payment Received';
|
||||
}else if($row['outstanding_amount'] == NULL){
|
||||
echo '';
|
||||
}else{
|
||||
echo 'Partially Received';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $row['utr_numbers']; ?></td>
|
||||
<td><?php echo $row['payment_dates']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -143,6 +139,7 @@ table.dataTable tbody td {
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
@ -164,14 +161,39 @@ $(document).ready(function() {
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this).text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) + 2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex + '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) + '</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
pageLength: 25, // Set default number of rows per page (optional)
|
||||
ordering: false,
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
|
||||
@ -100,14 +100,19 @@
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 text-right m-b-0" style="margin-top: 29px;">
|
||||
<a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/report/list"); ?>" class="btn btn-primary" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<!-- <div class="form-group text-right m-b-0">
|
||||
<button type="button" class="btn btn-secondary" id="clear-filters">Clear</button>
|
||||
<a href="<?= base_url("/policy_tranction/report/list"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -126,7 +131,6 @@
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
|
||||
449
app/Views/variance_report_list.php
Normal file
449
app/Views/variance_report_list.php
Normal file
@ -0,0 +1,449 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.right-align-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.center-align-input {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="varience_filter">
|
||||
<div class="col-12" style="margin-top: -12px;">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Client<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="client_id" name="client_id">
|
||||
<option value="0">Select Client</option>
|
||||
<?php
|
||||
if (isset($clients) && count($clients)) {
|
||||
foreach ($clients as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['client_name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Insurer <span id="base_danger"
|
||||
class="text-danger"></span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id">
|
||||
<option value="0" selected>Select Insurer</option>
|
||||
<?php if(isset($insurer) && count($insurer)){ ?>
|
||||
<?php foreach ($insurer as $value) { ?>
|
||||
<option value="<?= $value['id']?>"><?= $value['name']?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="email"> Policy Type <span class="text-danger"></span></label>
|
||||
<select class="form-control" id="policy_type_id" name="policy_type_id">
|
||||
<option value="0">Select Policy Type</option>
|
||||
<?php
|
||||
if (isset($policy_types) && count($policy_types)) {
|
||||
foreach ($policy_types as $key => $value) {
|
||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Issuer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer" name="issuer" required>
|
||||
<option value="0">Select Issure</option>
|
||||
<?php
|
||||
if (isset($issuer) && count($issuer)) {
|
||||
foreach ($issuer as $key => $value) {
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label>Date Type<span class="text-danger"></span></label>
|
||||
<select class="form-control" id="date_type" name="date_type"
|
||||
onchange="hideDateField()">
|
||||
<option value="0">Select Date Type</option>
|
||||
<?php
|
||||
if (isset($date_type) && count($date_type)) {
|
||||
foreach ($date_type as $key => $value) {
|
||||
echo "<option value='" . $key . "'>" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="display: none;" id="date_div">
|
||||
<label>Date<span class="text-danger"></span></label>
|
||||
<div id="reportrange" class="form-control"
|
||||
style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
||||
<i class="fa fa-calendar"></i>
|
||||
<span></span> <i class="fa fa-caret-down"></i>
|
||||
</div>
|
||||
<input type="hidden" id="startDate">
|
||||
<input type="hidden" id="endDate">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>"
|
||||
class="btn btn-secondary" id="clear-filters">Clear</a>
|
||||
<a href="<?= base_url("/policy_tranction/report/report-varience-list"); ?>"
|
||||
class="btn btn-primary" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" id="varience_list">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 style="position: relative;">Variance Report</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive" style="overflow-x: auto;">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>S.No</th>
|
||||
<th>Client Name</th>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
<!-- <th>Policy No</th> -->
|
||||
<th>Endorsement No</th>
|
||||
<th>Expected Amount</th>
|
||||
<th>Invoice Status</th>
|
||||
<th>Invoice Amount</th>
|
||||
<th>Realization Amount</th>
|
||||
<th>Variance</th>
|
||||
<!-- <th>Action</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($varience_list)) { ?>
|
||||
<?php foreach($varience_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?php echo $row['client_name']; ?></td>
|
||||
<td><?php echo $row['insurer_name']; ?></td>
|
||||
<td><?php echo $row['policy_type'] .' - '. $row['policy_no']; ?></td>
|
||||
<!-- <td><?php echo $row['policy_no']; ?></td> -->
|
||||
<td><?php echo $row['endorsement_no']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['exp_amt']; ?></td>
|
||||
<td class="center-align-input"><?php echo isset($row['invoice_status']) ? $row['invoice_status'] : ' - '; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['invoice_amount']) ? $row['invoice_amount'] : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo isset($row['realization_amount']) ? $row['realization_amount'] : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['variance']; ?></td>
|
||||
<!-- <td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);"
|
||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="
|
||||
<?php
|
||||
if ($row['action_type'] == 'I') {
|
||||
echo base_url("/policy_tranction/inception/list") . '?pt_id=' . $row['id'];
|
||||
} else {
|
||||
echo base_url("/policy_tranction/endorsement/list") . '?pt_id=' . $row['id'];
|
||||
}
|
||||
?>" id="get-policy-list" class="dropdown-item btnEdit">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td> -->
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Datatable document ready
|
||||
$(document).ready(function() {
|
||||
|
||||
var ticketsTable = $('#scroll-horizontal-datatable');
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel',
|
||||
title: 'Policy-Tranction-BDS-List',
|
||||
customize: function(xlsx) {
|
||||
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
||||
var total = 0;
|
||||
|
||||
// Find cells in column AB (28th column in Excel)
|
||||
$('row c[r^="AB"]', sheet).each(function() {
|
||||
var value = parseFloat($('v', this)
|
||||
.text()); // Get the value inside the cell
|
||||
if (!isNaN(value)) {
|
||||
total += value;
|
||||
}
|
||||
});
|
||||
|
||||
// Get the last row index and append the total row
|
||||
var lastRow = $('row:last', sheet);
|
||||
var rowIndex = parseInt(lastRow.attr('r')) +
|
||||
2; // Find the next row index
|
||||
var totalRow = '<row r="' + rowIndex + '">' +
|
||||
'<c t="inlineStr" r="AA' + rowIndex +
|
||||
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
||||
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
||||
'</v></c>' + // Insert sum in AB
|
||||
'</row>';
|
||||
|
||||
// Append the new total row to the sheet
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true, // Enable pagination
|
||||
pageLength: 25 // Set default number of rows per page (optional)
|
||||
});
|
||||
} else {
|
||||
console.error("Table not found.");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
getURLParams()
|
||||
$('#client_id').select2();
|
||||
$('#insurer_id').select2();
|
||||
$('#policy_type_id').select2();
|
||||
})
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var start_date = $('#startDate').val();
|
||||
var end_date = $('#endDate').val();
|
||||
var client_id = $('#client_id').val();
|
||||
var insurer_id = $('#insurer_id').val();
|
||||
var policy_type_id = $('#policy_type_id').val();
|
||||
var date_type = $('#date_type').val();
|
||||
var issuer = $('#issuer').val();
|
||||
|
||||
console.log(start_date + '-' + end_date);
|
||||
|
||||
var queryParams = {
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
client_id: client_id,
|
||||
insurer_id: insurer_id,
|
||||
policy_type_id: policy_type_id,
|
||||
date_type: date_type,
|
||||
issuer: issuer,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function getURLParams() {
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
const startDate = params.get('start_date') || 0; // Default to 0 if not found
|
||||
const endDate = params.get('end_date') || 0; // Default to 0 if not found
|
||||
const client_id = params.get('client_id') || 0; // Default to 0 if not found
|
||||
const insurer_id = params.get('insurer_id') || 0; // Default to 0 if not found
|
||||
const policy_type_id = params.get('policy_type_id') || 0; // Default to 0 if not found
|
||||
const date_type = params.get('date_type') || 0; // Default to 0 if not found
|
||||
const issuer = params.get('issuer') || 0; // Default to 0 if not found
|
||||
|
||||
hideDateField(date_type)
|
||||
|
||||
console.log('startDate', startDate)
|
||||
console.log('endDate', endDate)
|
||||
console.log('client_id', client_id)
|
||||
console.log('insurer_id', insurer_id)
|
||||
console.log('policy_type_id', policy_type_id)
|
||||
console.log('date_type', date_type)
|
||||
console.log('issuer', issuer)
|
||||
|
||||
// Log the values or use them as needed
|
||||
console.log('Start Date:', startDate);
|
||||
console.log('End Date:', endDate);
|
||||
|
||||
if (startDate != 0 && endDate != 0) {
|
||||
setTimeout(function() {
|
||||
$('#start_date').val(startDate)
|
||||
$('#end_date').val(endDate)
|
||||
$('#client_id').val(client_id).change()
|
||||
$('#insurer_id').val(insurer_id).change()
|
||||
$('#policy_type_id').val(policy_type_id).change()
|
||||
$('#date_type').val(date_type)
|
||||
$('#issuer').val(issuer)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const params = new URLSearchParams(url.search);
|
||||
|
||||
// Get start and end dates from URL parameters, or use default values
|
||||
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
||||
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
||||
|
||||
// Parse the dates to moment objects
|
||||
var start = moment(startDateParam, 'DD-MM-YYYY');
|
||||
var end = moment(endDateParam, 'DD-MM-YYYY');
|
||||
|
||||
// var start = moment().subtract(29, 'days');
|
||||
// var end = moment();
|
||||
|
||||
function cb(start, end) {
|
||||
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
||||
$('#startDate').val(start.format('DD-MM-YYYY'));
|
||||
$('#endDate').val(end.format('DD-MM-YYYY'));
|
||||
}
|
||||
|
||||
$('#reportrange').daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month')
|
||||
.endOf('month')
|
||||
]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
$('#clear-filters').on('click', function() {
|
||||
// Reset all select dropdowns to the first option
|
||||
$('#client_id').val('0').change();
|
||||
$('#insurer_id').val('0').change();
|
||||
$('#policy_type_id').val('0').change();
|
||||
$('#date_type').val('0');
|
||||
$('#issuer').val('0');
|
||||
$('#date_div').hide()
|
||||
|
||||
// Reset the date range picker to default
|
||||
$('#reportrange').data('daterangepicker').setStartDate(moment().subtract(29, 'days'));
|
||||
$('#reportrange').data('daterangepicker').setEndDate(moment());
|
||||
cb(start, end); // Update the displayed date range
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function hideDateField(input = null) {
|
||||
let val = $('#date_type').val();
|
||||
|
||||
if (input) {
|
||||
val = input;
|
||||
}
|
||||
|
||||
if (val != 0) {
|
||||
$('#date_div').show()
|
||||
} else {
|
||||
$('#date_div').hide()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sendPolicyTransactionID(event, pt_id) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
console.log(pt_id);
|
||||
|
||||
var queryParams = {
|
||||
pt_id: pt_id,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-policy-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
}
|
||||
</script>
|
||||
BIN
writable/tmp/20240924164906
Normal file
BIN
writable/tmp/20240924164906
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 219 KiB |
BIN
writable/tmp/20240924165542
Normal file
BIN
writable/tmp/20240924165542
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 207 KiB |
BIN
writable/tmp/20240924171719
Normal file
BIN
writable/tmp/20240924171719
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 167 KiB |
BIN
writable/tmp/20240926123034
Normal file
BIN
writable/tmp/20240926123034
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
BIN
writable/tmp/20241001102246
Normal file
BIN
writable/tmp/20241001102246
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 328 KiB |
Loading…
Reference in New Issue
Block a user