diff --git a/app/Controllers/Emppaydate.php b/app/Controllers/Emppaydate.php index d71c129b..cb945bf5 100755 --- a/app/Controllers/Emppaydate.php +++ b/app/Controllers/Emppaydate.php @@ -92,6 +92,33 @@ class Emppaydate extends BaseController $CreateBy = $this->session->get('userId'); $loandetails = array('EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Created_By' => $CreateBy); + + + $path = ROOTPATH.'public/uploads/images/'; + + $file2 = $this->request->getFile('request_letter'); + if ($file2 && $file2->isValid() && !$file2->hasMoved()) { + if(!is_dir($path)) { mkdir($path, 0777, true); } + $request_letter = $file2->getName().rand(00,99); + $file2->move($path,$request_letter); + $loandetails['request_letter'] = $request_letter; + } + else{ + $loandetails['request_letter'] = NULL; + } + + $file1 = $this->request->getFile('payment_statement'); + if ($file1 && $file1->isValid() && !$file1->hasMoved()) { + if(!is_dir($path)) { mkdir($path, 0777, true); } + $payment_statement = $file1->getName().rand(00,99); + $file1->move($path,$payment_statement); + $loandetails['payment_statement'] = $payment_statement; + } + else{ + $loandetails['payment_statement'] = NULL; + } + + if ($Loan_Amount != 0) { $result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'add'); @@ -145,6 +172,32 @@ class Emppaydate extends BaseController $loandetails = array('Loan_ID' => $loan_ID, 'EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Last_Mod_By' => $Last_Mod_By); + + $path = ROOTPATH.'public/uploads/images/'; + + $file2 = $this->request->getFile('request_letter'); + if ($file2 && $file2->isValid() && !$file2->hasMoved()) { + if(!is_dir($path)) { mkdir($path, 0777, true); } + $request_letter = $file2->getName().rand(00,99); + $file2->move($path,$request_letter); + $loandetails['request_letter'] = $request_letter; + } + else{ + $loandetails['request_letter'] = $this->request->getPost('hidden_request_letter') ? $this->request->getPost('hidden_request_letter') : NULL; + } + + $file1 = $this->request->getFile('payment_statement'); + if ($file1 && $file1->isValid() && !$file1->hasMoved()) { + if(!is_dir($path)) { mkdir($path, 0777, true); } + $payment_statement = $file1->getName().rand(00,99); + $file1->move($path,$payment_statement); + $loandetails['payment_statement'] = $payment_statement; + } + else{ + $loandetails['payment_statement'] = $this->request->getPost('hidden_payment_statement') ? $this->request->getPost('hidden_payment_statement') : NULL; + } + + if ($Loan_Amount != 0 and $loan_ID != '') { $result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'update'); if ($result2 > 0) { diff --git a/app/Views/addemppaydate.php b/app/Views/addemppaydate.php index 27bbbe15..44c06b89 100755 --- a/app/Views/addemppaydate.php +++ b/app/Views/addemppaydate.php @@ -29,7 +29,7 @@
-
+
@@ -97,48 +97,65 @@
-
-
+
- Loan Issue(d) Date - +
+ Loan Issue(d) Date + +
-
-
+
Due Started - -
-
-
- -
-
-
- Paid Amount - +
+ +
+ + +

Loan Documents

+ +
+
+ +
+ Request letter + +
+ +
+
+
+
+ +
+ Payment Receipt + +
+ +
+
+ + +
@@ -202,23 +219,31 @@ $(document).ready(function() { + + // Get the current date + const currentDate = new Date(); - // $('#loan_issued_date').datepicker({ - // format: "M-yyyy", - // minViewMode: 1, - // autoclose: true, // Ensures the datepicker closes after selection - // }).on('changeDate', function (e) { - // $(this).val(e.format('M-yyyy')); // Explicitly set the value to the input field - // }); + // Format the date as "M-yyyy" + const options = { month: 'short', year: 'numeric' }; + const formattedDate = currentDate.toLocaleDateString('en-US', options).replace(' ', '-'); - $("#due_started").datepicker({ - minDate: 'now', - //maxDate : 'now', - dateFormat: 'dd-mm-yy', - changeMonth: true, - changeYear: true, - yearRange: '-100:+1' - }); + // Set the value of the input field + document.getElementById('due_started').value = formattedDate; + document.getElementById('loan_issued_date').value = formattedDate; + + $('#loan_issued_date').datepicker({ + format: "M-yyyy", + minViewMode: 1, // Month selection only + orientation: "bottom auto", // Ensures it opens downward + autoclose: true + }); + + $('#due_started').datepicker({ + format: "M-yyyy", + minViewMode: 1, // Month selection only + orientation: "bottom auto", // Ensures it opens downward + autoclose: true + }); }); diff --git a/app/Views/editOldemppay.php b/app/Views/editOldemppay.php index 94318b31..97a74a0a 100755 --- a/app/Views/editOldemppay.php +++ b/app/Views/editOldemppay.php @@ -2,53 +2,23 @@ $(document).ready(function() { - $("#loan_issued_date").datepicker({ - minDate: 'now', - // maxDate : 'now', - dateFormat: 'dd-mm-yy', - changeMonth: true, - changeYear: true, - yearRange: '-100:+0' + $('#loan_issued_date').datepicker({ + format: "M-yyyy", + minViewMode: 1, // Month selection only + orientation: "bottom auto", // Ensures it opens downward + autoclose: true }); - $("#due_started").datepicker({ - minDate: 'now', - //maxDate : 'now', - dateFormat: 'dd-mm-yy', - changeMonth: true, - changeYear: true, - yearRange: '-100:+1' + $('#due_started').datepicker({ + format: "M-yyyy", + minViewMode: 1, // Month selection only + orientation: "bottom auto", // Ensures it opens downward + autoclose: true }); }); - // window.onload = function(){ - // loanReset(); - // function loanReset(){ - // //alert("hi"); - // var loan=$("#Loan_Amount").val();//document.getElementById('Loan_Amount').value; - // var paid=$("#Paid_Amount").val();//document.getElementById('Paid_Amount').value; - // if(loan !=0){ - // if (loan == paid) - // { - // //alert("loan reset"); - // $("#Loan_Amount").val(0.00); - // $("#Paid_Amount").val(0.00); - // $("#monthly_due").val(0.00); - // $("#no_of_due").val(0); - // $("#remaining_due").val(0); - // $("#paid_due").val(0); - // $("#loan_issued_date").val(""); - // $("#due_started").val(""); - - // }else - // { - // //alert("loan pending"); - // } - // } - // } - // }; Loan_Issued_Date)) { $Loan_issued_date = new DateTime($ep->Loan_Issued_Date, new DateTimeZone('Asia/Kolkata')); - $Loan_issued_date = $Loan_issued_date->format('d-m-Y'); + $Loan_issued_date = $Loan_issued_date->format('M-Y'); } else { $Loan_issued_date = null; } @@ -121,7 +91,7 @@ if (!empty($emppay)) { } if (!empty($ep->Due_Start_Date)) { $Due_start_date = new DateTime($ep->Due_Start_Date, new DateTimeZone('Asia/Kolkata')); - $Due_start_date = $Due_start_date->format('d-m-Y'); + $Due_start_date = $Due_start_date->format('M-Y'); } else { $Due_start_date = null; } @@ -146,6 +116,8 @@ if (!empty($emppay)) { $Last_Mod_By = $ep->Last_Mod_By; $Last_Mod_Time = $ep->Last_Mod_Time; $loanid = $ep->Loan_ID; + $request_letter = $ep->request_letter; + $payment_statement = $ep->payment_statement; } } @@ -180,7 +152,7 @@ if (!empty($emppay)) {
- +
@@ -235,7 +207,7 @@ if (!empty($emppay)) {
Loan Issue(d) Date - +
@@ -244,7 +216,7 @@ if (!empty($emppay)) {
Due Started - +
@@ -272,6 +244,54 @@ if (!empty($emppay)) {
+ +

Loan Documents

+ +
+
+
+ Request letter + + +
+
+ + + +
+ +
+
+
+ Payment Receipt + + +
+
+ + + + +
+ + +