EVOLUTION-NINJA
Edit File: print_invoice.php
<link rel="stylesheet" href="<?php echo base_url('admin_assets/assets/font-awesome/4.5.0/css/font-awesome.min.css');?>" /> <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <link rel="stylesheet" href="<?php echo base_url('admin_assets/toastr/toastr.min.css');?>"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="<?php echo base_url('admin_assets/toastr/toastr.min.js');?>"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <html> <head> <title>Invoice</title> </head> <form id="invoi" method="post" > <body> <div class="" style="width: 800px;float: left;"> <div id="print_div"> <div class="row_1" style="border-bottom: 1px solid #000;padding-bottom:65px;"> <img src="<?php echo base_url('admin_assets/logo.png');?>" style="float:left;"> <h1 style="color: #A6A6A6;text-align: right;padding-bottom: 5px;margin-bottom: 0px;float:right;">INVOICE</h1> </div> <div style="clear:both !important;"></div> <div class="row_2" style="padding-top:15px;padding-bottom:15px;"> <table> <tr> <td style="padding-right:10px;"><b>Date: </b></td> <td><input type="text" style="width: 100px;" name="date" class="date" value="<?php if($result->invoice_date!='0000-00-00') { echo date('d-m-Y',strtotime($result->invoice_date)); } else { echo date('d-m-Y'); } ?>" id="myInput1" readonly></td> </tr> <tr> <td style=" padding-right:10px;"><b>Invoice: </b></td> <td> <input type="text" name="invoice_no" class="invoice" value="<?php echo $result->invoice_no;?>" id="myInput2" readonly> </td> </tr> </table> </div> <div class="" style="clear:both !important;"></div> <input type="hidden" name="id" class="invoice_id" value="<?php echo $result->id;?>"> <input type="hidden" class="account_id" required> <div class="row_3"> <div class="" style="padding-bottom:10px;padding-top: 30px; display: flow-root;width: 49%;float: left;margin-right: 15px;"> <p style="margin-bottom:5px;"><b>Bill To,</b></p> <p style="margin-bottom:5px;"><input type="text" placeholder="Name" style="width: 250px;" name="name" id="name" class="name" value="<?php echo $result->name;?>" readonly></p> <textarea rows="3" style="width:100%;" name="address" id="myInput4" class="address" readonly><?php echo $result->address;?></textarea> </div> <div class="" style="padding-bottom:10px;padding-top: 30px;display: flow-root;width: 49%;margin-left: 15px;"> <p style="margin-bottom:5px;"><b>Supply To,</b></p> <p style="margin-bottom:5px;"><input type="text" placeholder="" style="width: 100%;" name="supply_to" id="name_to_new" class="name_to" value="<?php echo $result->supply_to;?>" readonly></p> <textarea rows="3" style="width:100%;" name="supply_to_address" id="address_new" class="address_new" readonly><?php echo $result->supply_address;?></textarea> </div> </div> <div class="row_4" style="padding: 20px 0px 30px;"> <p style="margin-bottom: 5px;">GSTN: <input type="int" id="myInput5" name="gstn" class="gstn" value="<?php echo $result->gstn;?>" ></p> <table border="1" style="width:100%;border-collapse: collapse;border-left: initial;border-bottom: initial;"> <tr style="background:#7B8CA0;"> <th style="width: 10%;padding: 5px;border: 1px solid #000;">SI NO</th> <th style="width: 52%;padding: 5px;border: 1px solid #000;">DESCRIPTION</th> <th style="width: 18%;padding: 5px;border: 1px solid #000;">SAC</th> <th style="width: 20%;padding: 5px;border: 1px solid #000;">PRICE</th> <th style="width: 20%;padding: 5px;border: 1px solid #000;" class="action">Action</th> </tr> <?php $price=json_decode($result->price); $description=json_decode($result->description);$sac=json_decode($result->sac); foreach($price as $key => $value) { ?> <tr> <td style="padding: 5px;border: 1px solid #000;"><input type="text" style="width: 100px;" name="sino" class="sino" id="myInput6" value="<?php echo $key+1;; ?>" readonly> <br> </td> <td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="width:100%;" name="description[]" class="description" id="myInput7" value="<?php echo $description[$key]; ?>" readonly><?php echo $description[$key]; ?></textarea></td> <td style="padding: 5px;border: 1px solid #000;vertical-align: top;"><input type="int" style="width: 100px;" name="sac[]" class="sac" value="<?php echo $sac[$key]; ?>" id="myInput8" readonly></td> <td style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;">Rs. <input type="text" style="width: 100px;" name="price[]" value="<?php echo $value; ?>" id="total_price" onfocusout="price();" class="total_price" readonly></td> <td></td> </tr> <?php } ?> <tbody class="new_tr"></tbody> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2" style="border-bottom:initial;border-left:initial;"></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><b>Sub Total</b></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" class="sub_total" name="sub_total" id="myInput9" value="<?php echo number_format($result->total); ?>" readonly></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2"></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>CGST @</b> <select class="" class="cgst" id="cgst" name="cgst" required> <?php foreach($gst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" name="cgst_amount" class="cgst_amount" value="<?php echo number_format($result->cgst_amount); ?>" id="cgst_amount" readonly></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2"></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>SGST @</b> <select class="" style="" class="sgst" id="sgst" name="sgst" readonly> <?php foreach($sgst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" class="sgst_amount" id="myInput10" value="<?php echo number_format($result->sgst_amount); ?>" name="sgst_amount" readonly></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2" style="padding: 5px;"><b>In Words -</b></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><b>Total</b></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" class="total" id="myInput11" name="total_amount" value="<?php echo number_format($result->total_amount); ?>" readonly></td> </tr> <!-- <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2" style="padding: 5px;"><b>In Words -</b></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><b>TDS@10%</b> <input type="checkbox" name="tds" value="1" id="tds" ></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" name="tds_amount" id="tds_amount" value="<?php echo number_format($result->tds_amount); ?>" readonly></td> </tr> --> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2" style="padding: 5px;"><input type="text" style="width: 100%;" class="amount_in_words" name="amount_in_words" value="<?php echo $result->total_amount_words; ?>" id="myInput14" readonly></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><b>Grand Total</b></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" class="grand_total" name="grand_total" value="<?php echo number_format($result->grand_total); ?>" id="grand_total" readonly></td> </tr> </table> </div> <div class="row_5" style="padding-top:20px;"> <table style="width:100%; color:#898989;"> <tr> <td>Company GSTN : 29BZLPS4657J1ZG</td> <td>Company GSTN : 29BZLPS4657J1ZG</td> <td></td> </tr> <tr> <td>Company Bank Details :</td> <td>Company Bank Details :</td> <td style="text-align:right;">For JAYBLUES TECHNOLOGIES</td> </tr> <tr> <td>SBI</td> <td>HDFC Bank</td> <td rowspan="3"><img src="<?php echo base_url(); ?>/admin_assets/ajay_sig.jpg" style="float:right;"/></td> </tr> <tr> <td>Jayblues</td> <td>Jayblues</td> </tr> <tr> <td>Account Type : Current Account</td> <td>Account Type : Current Account</td> </tr> <tr> <td>Account Number : 62439776675</td> <td>Account Number : 50200010784596</td> <td style="text-align:right;color:#000;">Authorized Signatory</td> </tr> <tr> <td>IFSC : SBIN0020555</td> <td>IFSC : HDFC0000065</td> <td></td> </tr> <tr> <td>Branch : Kalidasa Road, Mysore</td> <td>Branch : Saraswathipuram, Mysore</td> <td></td> </tr> </table> </div> <div class="row_6" style="padding-top:10%;"> <p style="text-align:center;margin-bottom:5px;font-size: 13px;">Declaration: Payment mode will be in Cash, Cheques, NEFT or RTGS only. Make all cheques payable to [Jayblues]</p> <h4 style="text-align: center;padding-bottom: 10px;border-bottom: 1px solid #000;margin-bottom: 5px;margin-top: 5px;">THANK YOU FOR YOUR BUSINESS!</h4> <p style="text-align: center;color:#898989; margin: 0 !important; padding-bottom: 3px;">Head Off. : #656/D, 16th Main, 5th Cross, Saraswathipuram, Mysore, Karnataka-570009.</p> <p style="text-align: center;color:#898989; margin: 0 !important;">Branch Off. : K R Square, #1073, 15th cross, 30th main, Banashankari 2nd stage, Bangalore - 560070.<br> Ph: 9663933606 / 9740285566, www.jayblues.com</p> </div> </div> <div class="row_6" style="text-align:center;padding-top:50px;"> <button type="submit" style="background:blue;color:#fff;" id="submit_invoice">Update</button> <button type="button" style="background:blue;color:#fff;" class="print">Print</button> </div> </div> <div style="width:100px; float:left;padding-left: 30px;padding-top: 30px;" id="rd"> <a href="<?php echo site_url('invoice-list');?>" style="color:blue;"><i class="fa fa-long-arrow-left fa-2x"></i></a> </div> </body> </form> </html> <link rel="stylesheet" href="<?php echo base_url('admin_assets/css/datepicker3.css');?>" /> <script src="<?php echo base_url('admin_assets/event/assets/js/bootstrap-datepicker.js');?>"></script> <style> textarea{ resize:none; } </style> <script> $('.date').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#datepick1').datepicker('hide'); }); $(':checkbox').change(function() { if($(this).is(":checked")) { var tot=$('#myInput11').val(); var tot = tot.replace(/[_\W]+/g, ""); var tds=parseInt(tot*10/100); x=tds.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('#tds_amount').val(res); var tot_new=parseInt(tot-tds); x=tot_new.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var tot = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.grand_total').val(tot); var words = new Array(); words[0] = ''; words[1] = 'One'; words[2] = 'Two'; words[3] = 'Three'; words[4] = 'Four'; words[5] = 'Five'; words[6] = 'Six'; words[7] = 'Seven'; words[8] = 'Eight'; words[9] = 'Nine'; words[10] = 'Ten'; words[11] = 'Eleven'; words[12] = 'Twelve'; words[13] = 'Thirteen'; words[14] = 'Fourteen'; words[15] = 'Fifteen'; words[16] = 'Sixteen'; words[17] = 'Seventeen'; words[18] = 'Eighteen'; words[19] = 'Nineteen'; words[20] = 'Twenty'; words[30] = 'Thirty'; words[40] = 'Forty'; words[50] = 'Fifty'; words[60] = 'Sixty'; words[70] = 'Seventy'; words[80] = 'Eighty'; words[90] = 'Ninety'; amount = tot_new.toString(); var atemp = amount.split("."); var number = atemp[0].split(",").join(""); var n_length = number.length; var words_string = ""; if (n_length <= 9) { var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); var received_n_array = new Array(); for (var i = 0; i < n_length; i++) { received_n_array[i] = number.substr(i, 1); } for (var i = 9 - n_length, j = 0; i < 9; i++, j++) { n_array[i] = received_n_array[j]; } for (var i = 0, j = 1; i < 9; i++, j++) { if (i == 0 || i == 2 || i == 4 || i == 7) { if (n_array[i] == 1) { n_array[j] = 10 + parseInt(n_array[j]); n_array[i] = 0; } } } value = ""; for (var i = 0; i < 9; i++) { if (i == 0 || i == 2 || i == 4 || i == 7) { value = n_array[i] * 10; } else { value = n_array[i]; } if (value != 0) { words_string += words[value] + " "; } if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) { words_string += "Crores "; } if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) { words_string += "Lakhs "; } if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) { words_string += "Thousand "; } if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) { words_string += "Hundred and "; } else if (i == 6 && value != 0) { words_string += "Hundred "; } } words_string = words_string.split(" ").join(" "); $('.amount_in_words').val(words_string+ "Rupees Only"); } } else{ $('#tds_amount').val(''); var total=$('.total').val(); $('.grand_total').val(total); var words = new Array(); words[0] = ''; words[1] = 'One'; words[2] = 'Two'; words[3] = 'Three'; words[4] = 'Four'; words[5] = 'Five'; words[6] = 'Six'; words[7] = 'Seven'; words[8] = 'Eight'; words[9] = 'Nine'; words[10] = 'Ten'; words[11] = 'Eleven'; words[12] = 'Twelve'; words[13] = 'Thirteen'; words[14] = 'Fourteen'; words[15] = 'Fifteen'; words[16] = 'Sixteen'; words[17] = 'Seventeen'; words[18] = 'Eighteen'; words[19] = 'Nineteen'; words[20] = 'Twenty'; words[30] = 'Thirty'; words[40] = 'Forty'; words[50] = 'Fifty'; words[60] = 'Sixty'; words[70] = 'Seventy'; words[80] = 'Eighty'; words[90] = 'Ninety'; amount = total.toString(); var atemp = amount.split("."); var number = atemp[0].split(",").join(""); var n_length = number.length; var words_string = ""; if (n_length <= 9) { var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); var received_n_array = new Array(); for (var i = 0; i < n_length; i++) { received_n_array[i] = number.substr(i, 1); } for (var i = 9 - n_length, j = 0; i < 9; i++, j++) { n_array[i] = received_n_array[j]; } for (var i = 0, j = 1; i < 9; i++, j++) { if (i == 0 || i == 2 || i == 4 || i == 7) { if (n_array[i] == 1) { n_array[j] = 10 + parseInt(n_array[j]); n_array[i] = 0; } } } value = ""; for (var i = 0; i < 9; i++) { if (i == 0 || i == 2 || i == 4 || i == 7) { value = n_array[i] * 10; } else { value = n_array[i]; } if (value != 0) { words_string += words[value] + " "; } if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) { words_string += "Crores "; } if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) { words_string += "Lakhs "; } if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) { words_string += "Thousand "; } if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) { words_string += "Hundred and "; } else if (i == 6 && value != 0) { words_string += "Hundred "; } } words_string = words_string.split(" ").join(" "); $('.amount_in_words').val(words_string+ "Rupees Only"); } } }); $('.grand_total').focusout(function(){ var g_tot=$(this).val(); gs_tot=g_tot.replace(/[_\W]+/g, ""); x=gs_tot.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var tot = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.grand_total').val(tot); $('.total').val(tot); var gst=parseInt(g_tot/1.18); var gst_val=parseInt(g_tot-gst); cgst=gst_val/2; $('.cgst_amount').val(cgst); $('.sgst_amount').val(cgst); $('.total_price').val(gst); x=gst.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var gst = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.sub_total').val(gst); var words = new Array(); words[0] = ''; words[1] = 'One'; words[2] = 'Two'; words[3] = 'Three'; words[4] = 'Four'; words[5] = 'Five'; words[6] = 'Six'; words[7] = 'Seven'; words[8] = 'Eight'; words[9] = 'Nine'; words[10] = 'Ten'; words[11] = 'Eleven'; words[12] = 'Twelve'; words[13] = 'Thirteen'; words[14] = 'Fourteen'; words[15] = 'Fifteen'; words[16] = 'Sixteen'; words[17] = 'Seventeen'; words[18] = 'Eighteen'; words[19] = 'Nineteen'; words[20] = 'Twenty'; words[30] = 'Thirty'; words[40] = 'Forty'; words[50] = 'Fifty'; words[60] = 'Sixty'; words[70] = 'Seventy'; words[80] = 'Eighty'; words[90] = 'Ninety'; amount = g_tot.toString(); var atemp = amount.split("."); var number = atemp[0].split(",").join(""); var n_length = number.length; var words_string = ""; if (n_length <= 9) { var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); var received_n_array = new Array(); for (var i = 0; i < n_length; i++) { received_n_array[i] = number.substr(i, 1); } for (var i = 9 - n_length, j = 0; i < 9; i++, j++) { n_array[i] = received_n_array[j]; } for (var i = 0, j = 1; i < 9; i++, j++) { if (i == 0 || i == 2 || i == 4 || i == 7) { if (n_array[i] == 1) { n_array[j] = 10 + parseInt(n_array[j]); n_array[i] = 0; } } } value = ""; for (var i = 0; i < 9; i++) { if (i == 0 || i == 2 || i == 4 || i == 7) { value = n_array[i] * 10; } else { value = n_array[i]; } if (value != 0) { words_string += words[value] + " "; } if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) { words_string += "Crores "; } if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) { words_string += "Lakhs "; } if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) { words_string += "Thousand "; } if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) { words_string += "Hundred and "; } else if (i == 6 && value != 0) { words_string += "Hundred "; } } words_string = words_string.split(" ").join(" "); $('.amount_in_words').val(words_string+ "Rupees Only"); } }); $('.p_plus').click(function(e){ e.preventDefault(); var content=''; content+='<tr>'; content+='<td style="padding: 5px;border: 1px solid #000;"><input type="text" style="width: 100px;" name="sino" class="sino" id="myInput6" required>'; content+='<br>'; content+='<td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="width:100%;" name="description[]" class="description" id="myInput7" required></textarea></td>'; content+='<td style="padding: 5px;border: 1px solid #000;vertical-align: top;"><input type="int" style="width: 100px;" name="sac[]" class="sac" id="myInput8"></td>'; content+='<td style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;">Rs. <input type="text" style="width: 100px;" name="price[]" id="total_price" class="total_price" onfocusout="price();" required></td>'; content += '<td style="text-align:center;"><a class="remove" href="javascript:void(0);"><span class="glyphicon glyphicon-trash delete_icon"></span></a></td>'; content+='</tr>'; $('.new_tr').append(content); }); $(document).on('click','.delete_icon',function(){ var whichtr = $(this).closest("tr"); whichtr.remove(); price(); }); function price(){ var sum=0; $(".total_price").each(function(i,val){ if($(this).val()!=''){ m=$(this).val(); m=parseInt(m); sum+=m; } }); x=sum.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var sum = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.sub_total').val(sum); cgst(); sgst(); } function cgst(){ var value =$('#cgst').val(); var cgst =parseInt(value); var sub_total =$('.sub_total').val(); var sub_total = sub_total.replace(/[_\W]+/g, ""); var cgst_amount =Math.round((cgst*sub_total)/100); x=cgst_amount.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var cgst_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.cgst_amount').val(cgst_amount); } function sgst(){ var value=$('#sgst').val(); var sgst =parseInt(value); var sub_total =$('.sub_total').val(); var sub_total = sub_total.replace(/[_\W]+/g, ""); var sgst_amount =Math.round((sgst*sub_total)/100); x=sgst_amount.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var sgst_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.sgst_amount').val(sgst_amount); sgst_amount=sgst_amount.replace(/[_\W]+/g, ""); var cgst_amount=$('.cgst_amount').val(); cgst_amount=cgst_amount.replace(/[_\W]+/g, ""); var sub_total = sub_total.replace(/[_\W]+/g, ""); total_amount=parseInt(sgst_amount)+parseInt(cgst_amount)+parseInt(sub_total); var total_round_new=Math.round(total_amount); x=total_round_new.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_round = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.total').val(total_round); $('.grand_total').val(total_round); var words = new Array(); words[0] = ''; words[1] = 'One'; words[2] = 'Two'; words[3] = 'Three'; words[4] = 'Four'; words[5] = 'Five'; words[6] = 'Six'; words[7] = 'Seven'; words[8] = 'Eight'; words[9] = 'Nine'; words[10] = 'Ten'; words[11] = 'Eleven'; words[12] = 'Twelve'; words[13] = 'Thirteen'; words[14] = 'Fourteen'; words[15] = 'Fifteen'; words[16] = 'Sixteen'; words[17] = 'Seventeen'; words[18] = 'Eighteen'; words[19] = 'Nineteen'; words[20] = 'Twenty'; words[30] = 'Thirty'; words[40] = 'Forty'; words[50] = 'Fifty'; words[60] = 'Sixty'; words[70] = 'Seventy'; words[80] = 'Eighty'; words[90] = 'Ninety'; amount = total_round_new.toString(); var atemp = amount.split("."); var number = atemp[0].split(",").join(""); var n_length = number.length; var words_string = ""; if (n_length <= 9) { var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0); var received_n_array = new Array(); for (var i = 0; i < n_length; i++) { received_n_array[i] = number.substr(i, 1); } for (var i = 9 - n_length, j = 0; i < 9; i++, j++) { n_array[i] = received_n_array[j]; } for (var i = 0, j = 1; i < 9; i++, j++) { if (i == 0 || i == 2 || i == 4 || i == 7) { if (n_array[i] == 1) { n_array[j] = 10 + parseInt(n_array[j]); n_array[i] = 0; } } } value = ""; for (var i = 0; i < 9; i++) { if (i == 0 || i == 2 || i == 4 || i == 7) { value = n_array[i] * 10; } else { value = n_array[i]; } if (value != 0) { words_string += words[value] + " "; } if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) { words_string += "Crores "; } if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) { words_string += "Lakhs "; } if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) { words_string += "Thousand "; } if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) { words_string += "Hundred and "; } else if (i == 6 && value != 0) { words_string += "Hundred "; } } words_string = words_string.split(" ").join(" "); $('.amount_in_words').val(words_string+ "Rupees Only"); } } $("#name").autocomplete({ source: function( request, callback ) { var val=$('#name').val(); //alert(val); var type = 'post' $.ajax({ type:type, url: '<?php echo site_url('search-account'); ?>', data: {'val':val}, success: function( data ) { data=jQuery.parseJSON(data); console.log(data); multiple:true; callback($.map(data, function(vx){ return [ { label: vx.account_name + ":" +vx.website, value: vx.account_name + ":" +vx.account_id, } ]; })); } }); }, minLength: 1, select: function( event, ui ) { $("#name").val( ui.item.label); $("#name").val( ui.item.value); address(); return { value: ui.item.value }; }, open: function() { // Do something on open event. }, close: function() { // Do something on close event } }); function address(){ var val=$('#name').val(); var name=val.split(':'); var n=name[0]; var acc_id=name[1]; var type = 'post' $.ajax({ type:type, url: '<?php echo site_url('account-address'); ?>', data: {'acc_id':acc_id}, success: function( data ) { data=jQuery.parseJSON(data); $("textarea.address").empty(); $("textarea.address").append(data.billing_street+' '+data.billing_city+' '+data.billing_state); } }); } $('.print').click(function(){ $('.print').toggle(); $('#submit_invoice').toggle(); $("select").css({"-webkit-appearance": "none"}); $('.p_plus').hide(); $('.action').hide(); $('.delete_icon').hide(); $('#rd').remove(); var val=$('#name').val(); var name=val.split(':'); var n=name[0]; $('#name').val(n); $(".sino").css({"border-style": "none"}); $('.description').css({"border-style": "none"}); $('.sac').css({"border-style": "none"}); $('.total_price').css({"border-style": "none"}); $('#tds').css({"border-style": "none"}); $("textarea").css({"resize": "none"}); // var tds=document.getElementById("tds").style; // tds.borderStyle="none"; var total_price=document.getElementById("total_price").style; total_price.borderStyle="none"; var name_to_new=document.getElementById("name_to_new").style; name_to_new.borderStyle="none"; var address_new=document.getElementById("address_new").style; address_new.borderStyle="none"; var address_new=document.getElementById("address_new").style; address_new.borderStyle="none"; var name_to_new=document.getElementById("name_to_new").style; name_to_new.borderStyle="none"; var myInput1 = document.getElementById("myInput1").style; myInput1.borderStyle="none"; var myInput2 = document.getElementById("myInput2").style; myInput2.borderStyle="none"; var name = document.getElementById("name").style; name.borderStyle="none"; $('#myInput5').removeAttr('placeholder'); $('#myInput4').removeAttr('placeholder'); var myInput4 = document.getElementById("myInput4").style; myInput4.borderStyle="none"; var myInput5 = document.getElementById("myInput5").style; myInput5.borderStyle="none"; var myInput6 = document.getElementById("myInput6").style; myInput6.borderStyle="none"; var myInput7 = document.getElementById("myInput7").style; myInput7.borderStyle="none"; var myInput8 = document.getElementById("myInput8").style; myInput8.borderStyle="none"; var total_price = document.getElementById("total_price").style; total_price.borderStyle="none"; var myInput9=document.getElementById("myInput9").style; myInput9.borderStyle="none"; var myInput10 = document.getElementById("myInput10").style; myInput10.borderStyle="none"; var myInput11 = document.getElementById("myInput11").style; myInput11.borderStyle="none"; var cgst_amount = document.getElementById("cgst_amount").style; cgst_amount.borderStyle="none"; var cgst = document.getElementById("cgst").style; cgst.borderStyle="none"; var sgst=document.getElementById("sgst").style; sgst.borderStyle="none"; // var tds_amount=document.getElementById("tds_amount").style; // tds_amount.borderStyle="none"; var grand_total=document.getElementById("grand_total").style; grand_total.borderStyle="none"; var myInput14=document.getElementById("myInput14").style; myInput14.borderStyle="none"; window.print(); }); </script> <script> $('#invoi').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("update-invoice-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { alert('Updated Successfully'); // window.location = '<?php echo site_url("Consulataion-list")?>'; } else { //toastr["error"](response.message); } } }); }); </script> <style type="text/css"> .p_plus img { width: 18px; padding-top: 5px; display: block; margin:auto; } </style>