diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 6784c0fd..b6c4ed88 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1480,7 +1480,7 @@ class PolicyTransactionController extends BaseController //Actual data for the list $data['report_list'] = $this->policyTransactionModel->getBDSReportList($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id); - // dd($data['report_list']); + //!dd($data['report_list']); $this->loadLayout('report_bds_filter', $data); } @@ -1529,6 +1529,7 @@ class PolicyTransactionController extends BaseController $data['varience_list'] = $this->policyTransactionModel->getVarienceReportLIst($start_date, $end_date, $client_id, $insurer_id, $policy_type_id, $date_type, $issuer, $client_branch_id, $insurer_branch_id, $client_policy_id); + // !dd($data['varience_list']); $this->loadLayout('variance_report_list', $data); } @@ -1768,6 +1769,12 @@ class PolicyTransactionController extends BaseController return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file not uploaded', 'error_data' => $validation_result['error_data'],'error_code' => $validation_result['error_code']], 200); } + if (isset($file_id) || $validation_result['status']) { + $this->insurerStatements->where('id', $file_id)->set(['invoice_status' => 'pending'])->update(); + } + + + return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200); } diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 0364fd17..edd39439 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -363,7 +363,6 @@ 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, pt_co_share_details.exp_amt, pt_co_share_details.id as pt_id, @@ -383,7 +382,6 @@ class PolicyTransactionModel extends Model (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( ( SELECT @@ -405,6 +403,24 @@ class PolicyTransactionModel extends Model ), 2 ) AS total_irda_amt, + ROUND( + ( + SELECT + ( + SUM(co_share_stmt_details.reward) + + ) AS reward + FROM + co_share_stmt_details + JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id + WHERE + co_share_stmt_details.co_share_id = pt_co_share_details.id + AND co_share_stmt_details.is_active = 1 + AND insurer_statements.is_active = 1 + $date_condition + ), + 2 + ) AS reward, ROUND( ( @@ -424,7 +440,7 @@ class PolicyTransactionModel extends Model AND co_share_stmt_details.is_active = 1 AND pt_table.is_active = 1 AND insurer_statements.is_active = 1 - AND insurer_statements.invoice_no IS NOT NULL + AND insurer_statements.invoice_status IS NOT NULL $date_condition ), @@ -467,7 +483,7 @@ class PolicyTransactionModel extends Model AND co_share_stmt_details.is_active = 1 AND pt_table.is_active = 1 AND insurer_statements.is_active = 1 - AND insurer_statements.invoice_no IS NULL + AND insurer_statements.invoice_status IS NULL $date_condition ) ), @@ -735,16 +751,55 @@ class PolicyTransactionModel extends Model pt_co_share_details.exp_amt, pt_co_share_details.variance, + ROUND ( (pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt),2) as original_premium, + ROUND( + ( + SELECT + ( + SUM(co_share_stmt_details.actual_bp_amt) + SUM(co_share_stmt_details.actual_tp_amt) + SUM(co_share_stmt_details.actual_bp_per) + ) AS total_stmt_amt + FROM + co_share_stmt_details + JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1 + WHERE + co_share_stmt_details.co_share_id = pt_co_share_details.id + AND co_share_stmt_details.is_active = 1 + ), + 2 + ) AS statement_premium, + + COALESCE( + (pt_co_share_details.bp_amt + pt_co_share_details.tp_amt + pt_co_share_details.tep_amt), 0 + ) - + COALESCE( + ( + SELECT + SUM(co_share_stmt_details.actual_bp_amt) + + SUM(co_share_stmt_details.actual_tp_amt) + + SUM(co_share_stmt_details.actual_bp_per) + FROM + co_share_stmt_details + JOIN + insurer_statements + ON + co_share_stmt_details.statement_id = insurer_statements.id + AND insurer_statements.is_active = 1 + WHERE + co_share_stmt_details.co_share_id = pt_co_share_details.id + AND co_share_stmt_details.is_active = 1 + ), 0 + ) AS premium_variance_amt, + ROUND( ( SELECT ( - SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.reward) ) AS total_irda_amt FROM co_share_stmt_details - JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id + JOIN insurer_statements ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1 WHERE co_share_stmt_details.co_share_id = pt_co_share_details.id AND co_share_stmt_details.is_active = 1 @@ -759,11 +814,11 @@ class PolicyTransactionModel extends Model ( SUM(co_share_stmt_details.actual_bp_brokerage_amt) + SUM(co_share_stmt_details.actual_tp_brokerage_amt) + - SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.actual_tep_brokerage_amt) + SUM(co_share_stmt_details.reward) ) FROM co_share_stmt_details JOIN insurer_statements - ON co_share_stmt_details.statement_id = insurer_statements.id + ON co_share_stmt_details.statement_id = insurer_statements.id and insurer_statements.is_active = 1 WHERE co_share_stmt_details.co_share_id = pt_co_share_details.id AND co_share_stmt_details.is_active = 1 @@ -783,7 +838,18 @@ class PolicyTransactionModel extends Model ->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left') ->where('policy_transaction.is_active', 1) ->where('pt_co_share_details.is_active', 1) - ->having('variance_amt IS NOT NULL'); + // ->where('insurer_statements.is_active',1); + // ->having('variance_amt IS NOT NULL') + // ->having('variance_amt !=',0) + // ->having('premium_variance_amt IS NOT NULL') + // ->having('premium_variance_amt !=',0); + + // ->group_start() + ->having('variance_amt IS NOT NULL') + ->orHaving('variance_amt !=', 0) + ->having('premium_variance_amt IS NOT NULL') + ->orHaving('premium_variance_amt !=', 0); + // ->group_end(); // ->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); diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 2772907a..230921e0 100644 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -399,7 +399,7 @@ custom-dropdown-menu {
- +
@@ -431,7 +431,7 @@ custom-dropdown-menu { @@ -458,7 +458,7 @@ custom-dropdown-menu { - + @@ -676,7 +676,8 @@ document.addEventListener("DOMContentLoaded", function () { // alert($('#invoice_date_modal').val()); if((!form.checkValidity())) { - // console.log('error2'); + console.log('error2'); + console.log(form.checkValidity()); return false; } @@ -748,7 +749,7 @@ document.addEventListener("DOMContentLoaded", function () { newRow.innerHTML = ` - + @@ -891,7 +892,7 @@ function showInvoiceStatusModal(event) var row = paymentTableBody.insertRow(); row.innerHTML = ` - + diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index 3fa60b7e..e9654a72 100644 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -61,10 +61,11 @@ table.dataTable tbody td { Total Premium Base
Revenue % TP / Terrorism
Revenue % + Rewards Total IRDA
Revenue INR Billed Amount UnBilled Amount - Rewards + @@ -97,11 +98,17 @@ table.dataTable tbody td {  %  % - + + + + - - + + diff --git a/app/Views/variance_report_list.php b/app/Views/variance_report_list.php index 07387337..28d85d44 100644 --- a/app/Views/variance_report_list.php +++ b/app/Views/variance_report_list.php @@ -170,6 +170,9 @@ table.dataTable tbody td { Insurer Branch Policy Endorsement No + Premium + Statement Premium + Premium Variance Expected Amount Statement Amount Variance @@ -186,9 +189,12 @@ table.dataTable tbody td { + + + - - + +