EVOLUTION-NINJA
Edit File: pay_slip.php
<?php $this->load->view('includes/header.php')?> <link rel="stylesheet" type="text/css" href="<?php echo base_url('dashboard_assets/css/main.css'); ?>" /> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"> <script type="text/javascript" src="<?php echo base_url('dashboard_assets/js/popper.min.js'); ?>" ></script> <?php if($details != 'No data found'){?> <form id="payslip_submit"> <input type="submit" class="btn btn-primary pull-right" value="Save & Print" style="margin: 50px;" > <div id='DivIdToPrint'> <section class="part_main"> <div class="container"> <img src="<?php echo base_url('assets/images/mmg_logo.png ');?>" class="img-fluid d-block mx-auto"> <p class="py-3 text-center font-weight-bold">MMG CONSTRUCTIONS LLP<br> #617, 1st Floor, New Kantharaja Urs Road,<br> Kuvempunagar,Chamaraja Mohalla, Mysore-23</p> <p class="text-center py-3">PAY SLIP FOR THE MONTH OF <input type="text" name="month_year" id="month_year" style="border: initial;" readonly /></p> <input type="hidden" name="emp_id" class="emp_id" value="<?php echo $details->emp_id; ?>" /> <table class="table table-bordered table-sm mt-3"> <tr> <td class="border-dark font-weight-bold">Employee ID </td> <td colspan="2" class="border-dark"><input type="text" name="employee_id" value="<?php echo $details->employee_id; ?>" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">Location</td> <td class="border-dark"><input type="text" name="location" value="<?php echo $details->name; ?>" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">Name</td> <td colspan="2" class="border-dark"><input type="text" name="employee_name" value="<?php echo $details->first_name.' '.$details->last_name; ?>" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">Bank Name</td> <td class="border-dark"><input type="text" name="bank_name" value="<?php echo $details->bank_name; ?>" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">Department</td> <td colspan="2" class="border-dark"><input type="text" name="dept_name" value="<?php echo $details->dept_name; ?>" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">Bank Acc No</td> <td class="border-dark"><input type="text" name="account_no" value="<?php echo $details->account_no; ?>" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">Designation</td> <td colspan="2" class="border-dark"><input type="text" name="designation" value="<?php echo $details->role_id; ?>" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">PAN No.</td> <td class="border-dark"><input type="text" name="pan_no" value="<?php echo $details->pan_no; ?>" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">DOB</td> <td colspan="2" class="border-dark"><input type="text" name="dob" value="<?php echo $details->date_of_birth; ?>" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">PF UAN NO</td> <td class="border-dark"><input type="text" name="pf_uan_no" value="100001087872" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">DOJ</td> <td colspan="2" class="border-dark"><input type="text" name="date_of_joining" value="<?php echo $details->date_of_joining; ?>" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">Total EL (PA)</td> <td class="border-dark"><input type="text" name="cl" value="<?php echo $details->cl; ?>" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">Actual payable days</td> <td colspan="2" class="border-dark"><input type="text" name="payable_days" value="30" style="border: initial;" readonly /></td> <td class="border-dark font-weight-bold">Remain EL</td> <td class="border-dark"><input type="text" name="remaining_el" value="8" style="border: initial;" readonly /></td> </tr> <tr> <td class="border-dark font-weight-bold">Paid days</td> <td colspan="2" class="border-dark"><input type="text" name="paid_days" value="30" style="border: initial;" readonly /></td> <td class="border-dark"></td> <td class="border-dark"></td> </tr> <tr> <td class="border-dark font-weight-bold">LOP days</td> <td colspan="2" class="border-dark"><input type="text" name="lop" value="0" style="border: initial;" readonly /></td> <td class="border-dark"></td> <td class="border-dark"></td> </tr> <tr> <td colspan="5" class="border-dark"> </td> </tr> <tr> <td colspan="3" class="border-dark font-weight-bold text-center">Earnings</td> <td colspan="2" class="border-dark font-weight-bold text-center">Deduction</td> </tr> <tr> <td class="border-dark font-weight-bold">Description</td> <td class="border-dark font-weight-bold">Rate</td> <td class="border-dark font-weight-bold">Monthly</td> <td class="border-dark font-weight-bold">Description</td> <td class="border-dark font-weight-bold">Amount</td> </tr> <tr> <td class="border-dark">Basic & DA</td> <td class="border-dark text-right"><input type="text" value="<?php echo number_format($details->basic); ?>" readonly /></td> <td class="border-dark text-right"><input type="text" name="basic" value="<?php echo number_format($details->basic); ?>" readonly /></td> <td class="border-dark">PF</td> <td class="border-dark text-right"><input type="text" name="pf" value="<?php echo number_format($details->pf); ?>" readonly /></td> </tr> <tr> <td class="border-dark">House Rent Allowance</td> <td class="border-dark text-right"><input type="text" value="<?php echo number_format($details->hra); ?>" readonly /></td> <td class="border-dark text-right"><input type="text" name="hra" value="<?php echo number_format($details->hra); ?>" readonly /></td> <td class="border-dark">ESIC</td> <td class="border-dark text-right"><input type="text" name="esi" value="<?php echo number_format($details->esi); ?>" readonly /></td> </tr> <tr> <td class="border-dark">Other Allownance </td> <td class="border-dark text-right"><input type="text" value="<?php echo number_format($details->special_allowance); ?>" readonly /></td> <td class="border-dark text-right"><input type="text" name="special_allowance" value="<?php echo number_format($details->special_allowance); ?>" readonly /></td> <td class="border-dark">Professional Tax</td> <td class="border-dark text-right"><input type="text" name="prof_tax" value="<?php echo number_format($details->prof_tax); ?>" readonly /></td> </tr> <tr> <td class="border-dark"></td> <td class="border-dark"></td> <td class="border-dark"></td> <td class="border-dark">Deductions</td> <td class="border-dark text-right"> - </td> </tr> <tr> <td class="border-dark font-weight-bold">GROSS EARNING: </td> <td class="border-dark font-weight-bold text-right"><input type="text" value="<?php echo number_format($details->gross_earning); ?>" readonly /></td> <td class="border-dark font-weight-bold text-right"><input type="text" name="gross_earning" value="<?php echo number_format($details->gross_earning); ?>" readonly /></td> <td class="border-dark font-weight-bold">GROSS DEDUCTION: </td> <td class="border-dark font-weight-bold text-right"><input type="text" name="gross_deduction" value="<?php echo number_format($details->gross_deduction); ?>" readonly /></td> </tr> <tr> <td colspan="5" class="border-dark"> </td> </tr> <tr> <td class="border-dark font-weight-bold">Net Pay :</td> <td class="border-dark font-weight-bold text-right"><input type="text" name="net_pay" value="<?php echo number_format($details->net_pay); ?>" readonly /></td> <td colspan="3" class="border-dark font-weight-bold"> <?php $number = $details->net_pay; $no = floor($number); $point = round($number - $no, 2) * 100; $hundred = null; $digits_1 = strlen($no); $i = 0; $str = array(); $words = array('0' => '', '1' => 'One', '2' => 'Two', '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', '13' => 'Thirteen', '14' => 'Fourteen', '15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen', '18' => 'Eighteen', '19' =>'Nineteen', '20' => 'Twenty', '30' => 'Thirty', '40' => 'Forty', '50' => 'Fifty', '60' => 'Sixty', '70' => 'Seventy', '80' => 'Eighty', '90' => 'Ninety'); $digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore'); while ($i < $digits_1) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += ($divider == 10) ? 1 : 2; if ($number) { $counter = count($str); $hundred = ($counter == 1 && $str[0]) ? 'and ' : null; $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . " " . $hundred : $words[floor($number / 10) * 10] . " " . $words[$number % 10] . " " . $digits[$counter] . " " . $hundred; }else $str[] = null; } $str = array_reverse($str); $result = implode('', $str); $points = ($point) ? "." . $words[$point / 10] . " " . $words[$point = $point % 10] : ''; $amount = $result . "Rupees "; ?> <input type="text" name="amt_in_words" value="<?php echo ucfirst($amount); ?>" style="width:600px;" readonly /> </td> </tr> </table> <p class="text-right pt-5 mt-5 font-weight-bold">Authorized Signatory</p> </div> </section> </div> </form> <?php } else { ?> echo '<script type="text/javascript">swal({ title: "Salary details not added!",text: "", type: "warning", showCancelButton: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); window.location = '<?php echo site_url("Add-Salary")?>'; } } );</script>'; <?php } ?> <script type="text/javascript"> /* https://stackoverflow.com/questions/23106027/javascript-function-to-convert-indian-currency-numbers-to-words-with-paise-suppo*/ function month_year_onload() { var currentYear = (new Date).getFullYear(); var currentMonth = (new Date).getMonth() + 1; //var currentDay = (new Date).getDate(); var month; if(currentMonth == 1) { month = "January"; } else if(currentMonth == 2) { month = "February"; } else if(currentMonth == 3) { month = "March"; } else if(currentMonth == 4) { month = "April"; } else if(currentMonth == 5) { month = "May"; } else if(currentMonth == 6) { month = "June"; } else if(currentMonth == 7) { month = "July"; } else if(currentMonth == 8) { month = "August"; } else if(currentMonth == 9) { month = "September"; } else if(currentMonth == 10) { month = "October"; } else if(currentMonth == 11) { month = "November"; } else if(currentMonth == 12) { month = "December"; } var month_year = month+' '+currentYear; $('#month_year').val(month_year); } $('#payslip_submit').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); swal({ title: "Are you sure?", text: "You want to Save this?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type : 'post', url : "<?php echo site_url('add-employee-payslip');?>", data : formdata, contentType: false, processData: false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); setTimeout(function wait(){ //window.location.reload(); var divToPrint=document.getElementById('DivIdToPrint'); var newWin=window.open('','Print-Window'); newWin.document.open(); newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>'); newWin.document.close(); setTimeout(function(){newWin.close();},10); }, 1000); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }); /*var divToPrint=document.getElementById('DivIdToPrint'); var newWin=window.open('','Print-Window'); newWin.document.open(); newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>'); newWin.document.close(); setTimeout(function(){newWin.close();},10);*/ month_year_onload(); </script> <?php $this->load->view('includes/footer.php')?>