From a211d6b905f0fdbcdb043f8732fe328c5a6a31dc Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 26 Nov 2025 16:02:29 +0530 Subject: [PATCH] CHANGE_BDS_CHANGE_AND_FIX_CO_SHARE_TYPE_WORNGLY ADDED --- .../PolicyTransactionController.php | 17 +- app/Models/PTCOShareDetailsModel.php | 1 + .../policy_transaction_endorsement_form.php | 338 ++++++++++------- .../policy_transaction_inception_form.php | 340 +++++++++++------- 4 files changed, 432 insertions(+), 264 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index a2f88d5f..1547e007 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -496,12 +496,18 @@ $cop_amt = $data['co_premium'][$index] ?? 0; } + if(isset($data['calc_policy_issue_date'][$index])){ + $data['calc_policy_issue_date'][$index] = change_date_format($data['calc_policy_issue_date'][$index]); + } + + $co_share_type_value = $data['co_share'] == 1 ? $data['co_share_type'][$index] ?? 1 : 1; + // Prepare each co-share detail entry $coShareDetails[] = [ 'pt_id' => $pt_id, 'insurer_id' => $insurer_id ?? 0, 'insurer_branch_id' => $insurer_branch_id ?? 0, - 'co_share_type' => $data['co_share_type'][$index] ?? 1, + 'co_share_type' => $co_share_type_value, 'co_share_per' => $data['co_share_per'][$index] ?? 0, 'bp_amt' => $data['base_premium'][$index] ?? 0, 'bp_gst_amt' => $data['gst_amount'][$index] ?? 0, @@ -539,6 +545,7 @@ 'id' => $data['co_share_id'][$index] ?? null, // Assuming this is the ID to identify existing records 'follower_policy_no' => $data['follower_policy_no'][$index] ?? null, 'non_comm_per_amt' => $data['non_comm_per_amt'][$index] ?? null, + 'pt_policy_issue_date' => $data['calc_policy_issue_date'][$index] ?? null, ]; } @@ -1001,7 +1008,9 @@ co_share_id = pt_co_share_details.id AND is_active = 1 - ) AS actual_tep_brokerage_amount + ) AS actual_tep_brokerage_amount, + + DATE_FORMAT(pt_policy_issue_date, '%d/%m/%Y') AS pt_policy_issue_date ") ->where('pt_id', $id) @@ -1590,7 +1599,9 @@ co_share_id = pt_co_share_details.id AND is_active = 1 - ) AS actual_tep_brokerage_amount + ) AS actual_tep_brokerage_amount, + + DATE_FORMAT(pt_policy_issue_date, '%d/%m/%Y') AS pt_policy_issue_date ") ->where('pt_id', $id) diff --git a/app/Models/PTCOShareDetailsModel.php b/app/Models/PTCOShareDetailsModel.php index 1b2c84fd..fb63d682 100644 --- a/app/Models/PTCOShareDetailsModel.php +++ b/app/Models/PTCOShareDetailsModel.php @@ -68,6 +68,7 @@ class PTCOShareDetailsModel extends Model 'non_comm_per_amt', 'cotp_amt', 'cotep_amt', + 'pt_policy_issue_date', ]; public function getNonReconcileredPolicyTransactions(string $insurer_id,string $insurer_branch_id) diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index 698ef0f9..e135fec3 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -32,11 +32,13 @@ box-shadow: none; outline: none; width: 100%; + padding: 5px 30px !important; } + #insurerTable th, #insurerTable td { - padding: 5px; - height: 30px; + padding: 2px 4px !important; + /* height: 30px; */ vertical-align: middle; } @@ -50,16 +52,65 @@ height: 20px; width: 20px; } - #insurerTable th, + #insurerTable th { min-width: 230px; } + /** newly implemented */ + #insurerTable thead th:first-child { + border-top: 0px solid #fff !important; + border-bottom: 0px solid #fff !important; + background-color: transparent !important; + } + #insurerTable tbody td { + border-top: 0px solid #fff !important; + border-bottom: 0px solid #fff !important; + background-color: transparent !important; + } + #insurerTable th{ + color: black !important; + background-color: transparent !important; + } + + #insurerTable input[type="text"], + #insurerTable select { + width: 100%; + font-size: 14px; + line-height: 1.5; + color: #000; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ced4da; + border-radius: 4px; + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; + box-sizing: border-box; + } + + /* Focus effect like form-control */ + #insurerTable input[type="text"]:focus, + #insurerTable select:focus { + border-color: #80bdff; + outline: 0; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); + } + + /* Disabled & readonly styling */ + #insurerTable input[readonly], + #insurerTable input:disabled, + #insurerTable select:disabled { + background-color: #e0e0e0; /* Darker background */ + color: #666; /* Darker text color */ + cursor: not-allowed; + } + + + +
- +
- +
@@ -399,15 +435,19 @@ CD Amount - + Follower Policy No + + + Policy Issue Date + Co-Share % - Non Commitional
Premium Amount + Non Commissional
Premium Amount Base Premium @@ -2120,100 +2160,103 @@ break; case 4: // follower policy no newCell = ``; + break; + case 5: // calc_policy_issue_date + newCell = ``; break; - case 5: // Co-Share % + case 6: // Co-Share % newCell = ``; break; - case 6: // Non commissionable Premium amount % + case 7: // Non commissionable Premium amount % newCell = ``; break; - case 7: // Base Premium + case 8: // Base Premium newCell = ``; break; - case 8: // TP Premium + case 9: // TP Premium newCell = ``; break; - case 9: // Ter Premium + case 10: // Ter Premium newCell = ``; break; - case 10: // co Premium + case 11: // co Premium newCell = ``; break; - case 11: // Co TP Premium + case 12: // Co TP Premium newCell = ``; break; - case 12: // Co Ter Premium + case 13: // Co Ter Premium newCell = ``; break; - case 13: // CGST + case 14: // CGST newCell = ``; break; - case 14: // SGST + case 15: // SGST newCell = ``; break; - case 15: // IGST + case 16: // IGST newCell = ``; break; - case 16: // GST Amount + case 17: // GST Amount newCell = ``; break; - case 17: // Stamp Duty + case 18: // Stamp Duty newCell = ``; break; - case 18: // Total + case 19: // Total newCell = ``; break; - case 19: // Agreed BP % + case 20: // Agreed BP % newCell = ``; break; - case 20: // Agreed TP % + case 21: // Agreed TP % newCell = ``; break; - case 21: // Agreed Ter % + case 22: // Agreed Ter % newCell = ``; break; - case 22: // Agreed Amount + case 23: // Agreed Amount newCell = ``; break; - case 23: // Standard BP % + case 24: // Standard BP % newCell = ``; break; - case 24: // Standard TP % + case 25: // Standard TP % newCell = ``; break; - case 25: // Standard Ter % + case 26: // Standard Ter % newCell = ``; break; - case 26: // Actual BP Amount + case 27: // Actual BP Amount newCell = ``; break; - case 27: // Actual TP Amount + case 28: // Actual TP Amount newCell = ``; break; - case 28: // Actual TEP Amount + case 29: // Actual TEP Amount newCell = ``; break; - case 29: // Actual BP % + case 30: // Actual BP % newCell = ``; break; - case 30: // Actual TP % + case 31: // Actual TP % newCell = ``; break; - case 31: // Actual TEP % + case 32: // Actual TEP % newCell = ``; break; - case 32: // Actual BP Brokerage Amount + case 33: // Actual BP Brokerage Amount newCell = ``; break; - case 33: // Actual TP Brokerage Amount + case 34: // Actual TP Brokerage Amount newCell = ``; break; - case 34: // Actual TEP Brokerage Amount + case 35: // Actual TEP Brokerage Amount newCell = ``; break; - case 35: // Expected Amount + case 36: // Expected Amount newCell = ``; break; // case 30: // Variance @@ -2222,7 +2265,7 @@ // case 31: // Reward // newCell = ``; // break; - case 36: // ID For Update + case 37: // ID For Update newCell = ``; break; } @@ -2254,69 +2297,72 @@ case 4: // follower policy no newCell = ``; break; - case 5: // Co-Share % + case 5: // calc_policy_issue_date + newCell = ``; + break; + case 6: // Co-Share % newCell = ``; break; - case 6: // Non commissionable Premium amount % + case 7: // Non commissionable Premium amount % newCell = ``; break; - case 7: // Base Premium + case 8: // Base Premium newCell = ``; break; - case 8: // TP Premium + case 9: // TP Premium newCell = ``; break; - case 9: // Ter Premium + case 10: // Ter Premium newCell = ``; break; - case 10: // co Premium + case 11: // co Premium newCell = ``; break; - case 11: // Co TP Premium + case 12: // Co TP Premium newCell = ``; break; - case 12: // Co Ter Premium + case 13: // Co Ter Premium newCell = ``; break; - case 13: // CGST + case 14: // CGST newCell = ``; break; - case 14: // SGST + case 15: // SGST newCell = ``; break; - case 15: // IGST + case 16: // IGST newCell = ``; break; - case 16: // GST Amount + case 17: // GST Amount newCell = ``; break; - case 17: // Stamp Duty + case 18: // Stamp Duty newCell = ``; break; - case 18: // Total + case 19: // Total newCell = ``; break; - case 19: // Agreed BP % + case 20: // Agreed BP % newCell = ``; break; - case 20: // Agreed TP % + case 21: // Agreed TP % newCell = ``; break; - case 21: // Agreed Ter % + case 22: // Agreed Ter % newCell = ``; break; - case 22: // Standard BP % + case 23: // Standard BP % newCell = ``; break; - case 23: // Standard TP % + case 24: // Standard TP % newCell = ``; break; - case 24: // Standard Ter % + case 25: // Standard Ter % newCell = ``; break; - case 25: // ID For Update + case 26: // ID For Update newCell = ``; break; } @@ -2404,10 +2450,12 @@ if(is_co_pay_yes == 1){ $('.hidecotp').show(); $('#table_tr_7').show(); + $('#table_tr_35').show(); $('#table_tr_3').show(); }else{ $('.hidecotp').hide(); $('#table_tr_7').hide(); + $('#table_tr_35').hide(); $('#table_tr_3').hide(); } @@ -2452,6 +2500,11 @@ $('.follow_insurer').prop('required', false); } + var calc_policy_issue_date = flatpickr("#calc_policy_issue_date_" + insurerCount, { + dateFormat: "d/m/Y", + allowInput: false + }); + }); // Add click event for delete button @@ -2547,97 +2600,100 @@ case 4: // follower_policy_no cell.find('input').val(data.follower_policy_no); break; - case 5: // Co-Share % + case 5: // follower_policy_no + cell.find('input').val(data.pt_policy_issue_date); + break; + case 6: // Co-Share % cell.find('input').val(data.co_share_per).toggleClass('readonly-select', !!disable_td); break; - case 6: // non_comm_per_amt + case 7: // non_comm_per_amt cell.find('input').val(data.non_comm_per_amt); break; - case 7: // Base Premium + case 8: // Base Premium cell.find('input').val(status ? data.bp_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 8: // TP Premium + case 9: // TP Premium cell.find('input').val(status ? data.tp_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 9: // Ter Premium + case 10: // Ter Premium cell.find('input').val(status ? data.tep_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 10: // Co Premium + case 11: // Co Premium cell.find('input').val(status ? data.cop_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 11: // Co TP Premium + case 12: // Co TP Premium cell.find('input').val(status ? data.cotp_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 12: // Co Ter Premium + case 13: // Co Ter Premium cell.find('input').val(status ? data.cotep_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 13: // CGST + case 14: // CGST cell.find('input').val(data.bp_cgst).toggleClass('readonly-select', !!disable_td); break; - case 14: // SGST + case 15: // SGST cell.find('input').val(data.bp_sgst).toggleClass('readonly-select', !!disable_td); break; - case 15: // IGST + case 16: // IGST cell.find('input').val(data.bp_igst).toggleClass('readonly-select', !!disable_td); break; - case 16: // GST Amount + case 17: // GST Amount cell.find('input').val(status ? data.bp_gst_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 17: // Stamp Duty + case 18: // Stamp Duty cell.find('input').val(status ? data.stamp_duty : '').toggleClass('readonly-select', !!disable_td); break; - case 18: // Total + case 19: // Total cell.find('input').val(status ? data.amount : ''); break; - case 19: // Agreed BP % + case 20: // Agreed BP % cell.find('input').val(data.agreed_bp_per).toggleClass('readonly-select', !!disable_td); break; - case 20: // Agreed TP % + case 21: // Agreed TP % cell.find('input').val(data.agreed_tp_per).toggleClass('readonly-select', !!disable_td); break; - case 21: // Agreed Ter % + case 22: // Agreed Ter % cell.find('input').val(data.agreed_tep_per).toggleClass('readonly-select', !!disable_td); break; - case 22: // Agreed Amount + case 23: // Agreed Amount cell.find('input').val(data.agreed_amt).toggleClass('readonly-select', !!disable_td); break; - case 23: // Standard BP % + case 24: // Standard BP % cell.find('input').val(data.standerd_bp_per); break; - case 24: // Standard TP % + case 25: // Standard TP % cell.find('input').val(data.standerd_tp_per); break; - case 25: // Standard Ter % + case 26: // Standard Ter % cell.find('input').val(data.standerd_tep_per); break; - case 26: // Actual BP Amount + case 27: // Actual BP Amount cell.find('input').val(status ? data.actual_bp_amt : ''); break; - case 27: // Actual TP Amount + case 28: // Actual TP Amount cell.find('input').val(status ? data.actual_tp_amt : ''); break; - case 28: // Actual Ter Amount + case 29: // Actual Ter Amount cell.find('input').val(status ? data.actual_tep_amt : ''); break; - case 29: // Actual BP % + case 30: // Actual BP % cell.find('input').val(status ? data.actual_bp_per : ''); break; - case 30: // Actual TP % + case 31: // Actual TP % cell.find('input').val(status ? data.actual_tp_per : ''); break; - case 31: // Actual Ter % + case 32: // Actual Ter % cell.find('input').val(status ? data.actual_tep_per : ''); break; - case 32: // Actual BP Brokerage Amount + case 33: // Actual BP Brokerage Amount cell.find('input').val(status ? data.actual_bp_brokerage_amt : ''); break; - case 33: // Actual TP Brokerage Amount + case 34: // Actual TP Brokerage Amount cell.find('input').val(status ? data.actual_tp_brokerage_amt : ''); break; - case 34: // Actual Ter Brokerage Amount + case 35: // Actual Ter Brokerage Amount cell.find('input').val(status ? data.actual_tep_brokerage_amt : ''); break; - case 35: // Expected Amount + case 36: // Expected Amount cell.find('input').val(status ? data.exp_amt : ''); break; // case 30: // Variance @@ -2646,7 +2702,7 @@ // case 31: // Reward // cell.find('input').val(status ? data.reward : ''); // break; - case 36: // Co-share ID (hidden field) + case 37: // Co-share ID (hidden field) cell.find('input[type="hidden"]').val(status ? data.id : ''); break; } @@ -2668,67 +2724,70 @@ case 4: // follower_policy_no cell.find('input').val(data.follower_policy_no); break; - case 5: // Co-Share % + case 5: // follower_policy_no + cell.find('input').val(data.pt_policy_issue_date); + break; + case 6: // Co-Share % cell.find('input').val(data.co_share_per).toggleClass('readonly-select', !!disable_td); break; - case 6: // non_comm_per_amt + case 7: // non_comm_per_amt cell.find('input').val(data.non_comm_per_amt); break; - case 7: // Base Premium + case 8: // Base Premium cell.find('input').val(status ? data.bp_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 8: // TP Premium + case 9: // TP Premium cell.find('input').val(status ? data.tp_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 9: // Ter Premium + case 10: // Ter Premium cell.find('input').val(status ? data.tep_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 10: // Co Premium + case 11: // Co Premium cell.find('input').val(status ? data.cop_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 11: // Co TP Premium + case 12: // Co TP Premium cell.find('input').val(status ? data.cotp_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 12: // Co Ter Premium + case 13: // Co Ter Premium cell.find('input').val(status ? data.cotep_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 13: // CGST + case 14: // CGST cell.find('input').val(data.bp_cgst).toggleClass('readonly-select', !!disable_td); break; - case 14: // SGST + case 15: // SGST cell.find('input').val(data.bp_sgst).toggleClass('readonly-select', !!disable_td); break; - case 15: // IGST + case 16: // IGST cell.find('input').val(data.bp_igst).toggleClass('readonly-select', !!disable_td); break; - case 16: // GST Amount + case 17: // GST Amount cell.find('input').val(status ? data.bp_gst_amt : '').toggleClass('readonly-select', !!disable_td); break; - case 17: // Stamp Duty + case 18: // Stamp Duty cell.find('input').val(status ? data.stamp_duty : '').toggleClass('readonly-select', !!disable_td); break; - case 18: // Total + case 19: // Total cell.find('input').val(status ? data.amount : ''); break; - case 19: // Agreed BP % + case 20: // Agreed BP % cell.find('input').val(data.agreed_bp_per).toggleClass('readonly-select', !!disable_td); break; - case 20: // Agreed TP % + case 21: // Agreed TP % cell.find('input').val(data.agreed_tp_per).toggleClass('readonly-select', !!disable_td); break; - case 21: // Agreed Ter % + case 22: // Agreed Ter % cell.find('input').val(data.agreed_tep_per).toggleClass('readonly-select', !!disable_td); break; - case 22: // Standard BP % + case 23: // Standard BP % cell.find('input').val(data.standerd_bp_per); break; - case 23: // Standard TP % + case 24: // Standard TP % cell.find('input').val(data.standerd_tp_per); break; - case 24: // Standard Ter % + case 25: // Standard Ter % cell.find('input').val(data.standerd_tep_per); break; - case 25: // Co-share ID (hidden field) + case 26: // Co-share ID (hidden field) cell.find('input[type="hidden"]').val(status ? data.id : ''); break; } @@ -2884,6 +2943,25 @@ }) + $('#policy_issue_date').on('change', function(){ + let date = $(this).val(); + + let date_set = false + $('[name="co_share_type[]"]').each(function () { + console.log('co_share_type[] value', $(this).val()); + if($(this).val() == 1){ + let uniqueid = $(this).data('id'); + $('#calc_policy_issue_date_' + uniqueid).val(date).addClass('readonly-select'); + date_set = true; + } + }); + + if(!date_set){ + $('#calc_policy_issue_date_1').val(date).addClass('readonly-select'); + } + }); + + //----------------------------------------------------------------------------------------------------------- $(document).on('change', '#insurerTable input, #insurerTable select, #insurerTable textarea', function() { diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 1d5b8133..13b516ed 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -32,11 +32,13 @@ box-shadow: none; outline: none; width: 100%; + padding: 5px 30px !important; } + #insurerTable th, #insurerTable td { - padding: 5px; - height: 30px; + padding: 2px 4px !important; + /* height: 30px; */ vertical-align: middle; } @@ -50,6 +52,7 @@ height: 20px; width: 20px; } + #insurerTable th, #insurerTable th { min-width: 230px; @@ -96,11 +99,11 @@ .input-with-percentage::after { content: '%'; position: absolute; - right: 5px; + right: 10px; top: 50%; transform: translateY(-50%); font-weight: bold; - color: #000; + color: #495057; } /* .select2-container .select2-selection__rendered { @@ -142,21 +145,55 @@ } /** newly implemented */ + #insurerTable thead th:first-child { border-top: 0px solid #fff !important; border-bottom: 0px solid #fff !important; background-color: transparent !important; } + #insurerTable tbody td { border-top: 0px solid #fff !important; border-bottom: 0px solid #fff !important; background-color: transparent !important; } + #insurerTable th{ color: black !important; background-color: transparent !important; } + #insurerTable input[type="text"], + #insurerTable select { + width: 100%; + font-size: 14px; + line-height: 1.5; + color: #000; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ced4da; + border-radius: 4px; + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; + box-sizing: border-box; + } + + /* Focus effect like form-control */ + #insurerTable input[type="text"]:focus, + #insurerTable select:focus { + border-color: #80bdff; + outline: 0; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); + } + + /* Disabled & readonly styling */ + #insurerTable input[readonly], + #insurerTable input:disabled, + #insurerTable select:disabled { + background-color: #e0e0e0; /* Darker background */ + color: #666; /* Darker text color */ + cursor: not-allowed; + } +