EVOLUTION-NINJA
Edit File: print_quotation.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="<?php echo base_url('admin_assets/css/jquery-ui.css');?>"> <link rel="stylesheet" href="<?php echo base_url('admin_assets/toastr/toastr.min.css');?>"> <link rel="stylesheet" href="<?php echo base_url('admin_assets/assets/css/bootstrap.min.css');?>"> <script src="<?php echo base_url('admin_assets/js/jquery-1.12.4.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/bootstrap.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/js/jquery-ui.js');?>"></script> <link rel='shortcut icon' type='image/x-icon' href="<?php echo base_url('admin_assets/favicon.png');?>" /> <script src="<?php echo base_url('admin_assets/toastr/toastr.min.js');?>"></script> <html> <head> <title>JBERP</title> </head> <body> <!--------------------------------------Print Page------------------------------------------------> <div class="main" id="print_div" style="width: 800px;float: left;padding-left: 10px;"> <div class="page-header" style="text-align: center"> <div class="top_row"> <div class="top_line"></div> <img src="<?php echo base_url('admin_assets/logo.jpg');?>" style="float:left;padding-top: 1.5%;"> <h2 style="color: #A6A6A6;float:right;padding-top: 2%;letter-spacing: 2px;padding-right:2%;" class="heading_name">QUOTATION</h2> </div> </div> <table style="width: 100%;"> <thead> <tr> <td> <!--place holder for the fixed-position header--> <div class="page-header-space"></div> </td> </tr> </thead> <tbody class="page"> <tr> <td colspan="5" style="text-align: center;">Please don't compare our quotation with others as Quality is our main priority!</td> </tr> <tr style="display:none;"> <td> <input type="hidden" name="quotation_id" value="<?php echo $quotations->quotation_id; ?>" > <input type="hidden" name="lead_id" value="" class="lead"> <input type="hidden" name="client_name" value="" class="client_name"> </td> </tr> <tr class="tax" style="display:none;"> <td></td> <td colspan=""> <label><input type="radio" name="invoice_tax" value="tax" class="invoice_tax_new" <?php if($quotations->tax_no_tax=='tax') { echo 'checked'; } ?>>Add Tax</label>   <label><input type="radio" name="invoice_tax" value="no_tax" class="invoice_tax_new" <?php if($quotations->tax_no_tax=='no_tax') { echo 'checked'; } ?> >No Tax</label>   </td> <td> <span class="trtt" style="padding-left: 0px; <?php if($quotations->tax_no_tax=='tax') {echo 'display:black'; } else { echo 'display:none';} ?>"> <label>Invoice Tax</label> <select type="select" name="invoice_tax_state" class="state" style="padding-bottom:5px;padding-top: 5px;"> <option value="">Select</option> <option value="Within State" <?php if($quotations->tax_state=='Within State') { echo 'selected'; } ?> >Within State</option> <option value="Out of State" <?php if($quotations->tax_state=='Out of State'){ echo 'selected'; }?> >Out of State</option> </select> </span> </td> </tr> <tr> <td class="to_address"><b>To:</b></td> <td colspan="2"><?php echo ucfirst($quotations->client_name); ?></td> <td colspan="3"><b>Date: </b><?php echo date('d-m-Y',strtotime($quotations->quo_date)); ?></td> </tr> <tr> <td class="to_address"><b>Name:</b></td> <td colspan="2"><?php echo ucfirst($quotations->client_name); ?></td> <td colspan="3"><b>Quotation#: </b><?php echo $quotations->quotation_number; ?></td> </tr> <tr> <td class="to_address"><b>Address:</b></td> <td colspan="2"><?php echo $quotations->address; ?></td> <td colspan="3"><b>Quotation valid until: </b><?php echo $till_date=date('d-m-Y', strtotime($quotations->quot_end_date)); ?></td> </tr> <tr> <td colspan="3" class="to_address"><b>Comments or Special instruction:</b> <br> <?php echo $quotations->comments; ?></td> <td colspan="3"><b>Prepared by: </b><?php echo $quotations->generated_by; ?></td> </tr> <tr class="table_head hidden_tr" style="visibility: hidden;"> <th style="width: 10%;">1</th> <th style="width: 30%;">2</th> <th style="width: 30%;">3</th> <th style="width: 15%;">4</th> <th style="width: 15%;">5</th> </tr> <tr class="table_head" style="background-color: gray;"> <th style="padding: 5px;border: 1px solid #000;background-color: gray;">SL NO</th> <th colspan="2" style="padding: 5px;border: 1px solid #000;background-color: gray;">DESCRIPTION</th> <th style="padding: 5px;border: 1px solid #000;">OTHER</th> <th style="padding: 5px;border: 1px solid #000;">PRICE</th> </tr> <?php if(!empty($quotations->description)){ if (strpos($quotations->description, '["') !== false) { $decode=json_decode($quotations->description); foreach($decode as $key=>$val){ $ky=$key+1; ?> <tr> <td style="padding: 5px;border-left: 1px solid #000;border-bottom: 1px solid #000;"><?php echo $ky;?> <br><?php if($key==0){?> <?php } ?> </td> <td colspan="2"style="padding: 5px;border-left: 1px solid #000;border-bottom: 1px solid #000;"><?php echo $val;?></td> <td style="padding: 5px;border-left: 1px solid #000;border-bottom: 1px solid #000;vertical-align: top;"></td> <td id="print_price_td" style="padding: 5px;border-left: 1px solid #000;border-right: 1px solid #000;border-bottom: 1px solid #000;vertical-align: top;text-align: right;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;border:none;" readonly name="price[]" value="<?php if(!empty($quotations->description)){ $decode=json_decode($quotations->price); foreach($decode as $keys=>$vals){ if($key==$keys){ echo $vals;}}} ;?>" id="total_price" onfocusout="price();" class="total_price" required></td> </tr> <?php } }else{ ?> <tr> <td style="padding: 5px;border: 1px solid #000;">1</td> <td colspan="2"style="padding: 5px;border: 1px solid #000;"><?php echo $quotations->description ;?></td> <td style="padding: 5px;border: 1px solid #000;vertical-align: top;">-</td> <td id="print_price_td" style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;border:none;" readonly name="price[]" value="<?php echo $quotations->amount ;?>" id="total_price" onfocusout="price();" class="total_price" required></td> </tr> <?php } }?> <tbody class="new_tr"></tbody> <tr style="border-bottom: initial;border-color: transparent;" class="sub_total_tr amt_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"><b>Sub Total</b></td> <td id="print_subtotal_td" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;line-height: 1.2;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px; background-color:white;border:none;" readonly class="sub_total" value="<?php $num=$quotations->sub_total; $explrestunits = "" ; if(strlen($num)>3) { $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++) { // creates each of the 2's group and adds a comma to the end if($i==0) { $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer } else { $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; } else { $thecash = $num; } echo $thecash;?>" name="sub_total" id="myInput9" required></td> </tr> <?php if($quotations->gst_amount!='0') { ?> <tr style="border-bottom: initial;border-color: transparent;<?php if($quotations->tax_no_tax=='tax') {echo 'display:black'; } else { echo 'display:none';} ?>" class="cgst_tr amt_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-top: 1px solid #000;line-height: 1.2;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>CGST @</b> <select style="display:none;" class="cgst" id="cgst" name="cgst" required> <?php foreach($gst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p><?php echo $value; ?></td> <td style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;line-height: 1.2;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;background-color:white;border:none;" readonly class="cgst_amount" value="<?php $num=$quotations->gst_amount; $explrestunits = "" ; if(strlen($num)>3) { $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++) { // creates each of the 2's group and adds a comma to the end if($i==0) { $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer } else { $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; } else { $thecash = $num; } echo $thecash;?>" name="cgst_amount" class="cgst_amount" id="cgst_amount"></td> </tr> <?php } else { ?> <tr style="border-bottom: initial;border-color: transparent;<?php if($quotations->tax_state=='Within State') {echo 'display:black'; } else { echo 'display:none';} ?>;" class="cgst_tr amt_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-top: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>CGST @</b> <select style="display:none;" class="cgst" id="cgst" name="cgst" required> <?php foreach($gst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p><?php echo $value; ?></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;" id="cgst_td"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;background-color:white;border:none;" readonly name="cgst_amount" class="cgst_amount" id="cgst_amount"></td> </tr> <?php } ?> <?php if($quotations->sgst_amount!='0') { ?> <tr style="border-bottom: initial;border-color: transparent;<?php if($quotations->tax_state=='Within State') {echo 'display:black'; } else { echo 'display:none';} ?>;" class="sgst_tr amt_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-top: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>SGST @</b> <select style="display:none;" class="sgst" id="sgst" name="sgst" required> <?php foreach($sgst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p><?php echo $value; ?></td> <td style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" value="<?php echo number_format($quotations->sgst_amount); ?>" style="width:80px;background-color:white;border:none;" readonly class="sgst_amount" id="myInput10" name="sgst_amount"></td> </tr> <?php } else { ?> <tr style="border-bottom: initial;border-color: transparent;display: black;" class="sgst_tr amt_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;font-size: 15px;"><b>SGST @</b> <select style="display:none;" class="sgst" id="sgst" name="sgst" required> <?php foreach($sgst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p><?php echo $value; ?></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;" id="print_sgst_amount"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;background-color:white;border:none;" readonly class="sgst_amount" id="myInput10" name="sgst_amount"></td> </tr> <?php } ?> <?php if($quotations->igst_amount!='0') { ?> <tr style="border-bottom: initial;border-color: transparent;<?php if($quotations->tax_state=='Out of State') {echo 'display:black'; } else { echo 'display:none';} ?>;" class="igst_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>IGST @</b> <select style="display:none;" class="igst" id="igst" name="igst" required> <?php foreach($igst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p><?php echo $value; ?></td> <td style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;border:none;" readonly class="igst_amount" id="myInput20" name="igst_amount"></td> </tr> <?php } else { ?> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="igst_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>IGST @</b> <select style="display:none;" class="igst" id="igst" name="igst" required> <?php foreach($igst as $value){ ?> <option value="<?php echo $value; ?>"><?php echo $value; ?></option> <?php } ?> </select></p><?php echo $value; ?></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;border:none;" readonly class="igst_amount" id="myInput20" name="igst_amount"></td> </tr> <?php } ?> <tr style="border-bottom: initial;border-color: transparent;" class="amt_tr"> <td colspan="3" rowspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;"></td> <td colspan="" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-top: 1px solid #000;"><b>Total</b></td> <td id="print_total_td" style="padding: 5px;text-align: right;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;background-color:white;border:none;" readonly class="total" value="<?php $num=$quotations->amount; $explrestunits = "" ; if(strlen($num)>3) { $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++) { // creates each of the 2's group and adds a comma to the end if($i==0) { $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer } else { $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; } else { $thecash = $num; } echo $thecash;?>" id="myInput11" name="total_amount"></td> </tr> <tr class="grand_total_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" id="myInput14"></td>--> </tr> <tr class="table_head" style="border-bottom: initial;border-color: transparent;"> <td colspan="1" style="padding: 5px;border-left: 1px solid #000;border-top: 1px solid #000;border-bottom: 1px solid #000;font-weight: bold;font-size: 15px;"><b>In Words</b></td> <td colspan="2" style="padding: 5px;border-left: 1px solid #000;border-right: 1px solid #000;border-top: 1px solid #000;border-bottom: 1px solid #000;" id="amount_inwords_td"></td> <td colspan="" style="padding: 5px;text-align: right;border-right: 1px solid #000;border-top: 1px solid #000;border-bottom: 1px solid #000;font-size: 15px;"><b>Grand Total</b></td> <td id="print_grandtotal_td" style="padding: 5px;text-align: right;border-right: 1px solid #000;border-top: 1px solid #000;border-bottom: 1px solid #000;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:80px;background-color:grey;border:none;" readonly class="grand_total" value="<?php $num=$quotations->amount; $explrestunits = "" ; if(strlen($num)>3) { $lastthree = substr($num, strlen($num)-3, strlen($num)); $restunits = substr($num, 0, strlen($num)-3); // extracts the last three digits $restunits = (strlen($restunits)%2 == 1)?"0".$restunits:$restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. $expunit = str_split($restunits, 2); for($i=0; $i<sizeof($expunit); $i++) { // creates each of the 2's group and adds a comma to the end if($i==0) { $explrestunits .= (int)$expunit[$i].","; // if is first value , convert into integer } else { $explrestunits .= $expunit[$i].","; } } $thecash = $explrestunits.$lastthree; } else { $thecash = $num; } echo $thecash;?>" name="grand_total" id="grand_total"></td> </tr> <tr> <td colspan="2" style="line-height: 2.5;"> <b>Company GSTN:</b> 29BZLPS4657J1ZG <br> <b>Company Bank Details:</b> SBI Jayblues<br> <b>Account Type:</b> Current Account<br> <b>Account Number:</b> 62439776675<br> <b>IFSC:</b> SBI0020555<br> <b>Branch:</b> Kalidasa Road,Mysore </td> <td colspan="2" style="line-height: 2.5;"> <b>Company GSTN:</b> 29BZLPS4657J1ZG <br> <b>Company Bank Details:</b> HDFC Bank Jayblues <br> <b>Account Type:</b> Currrent Account <br> <b>Account Number:</b> 50200010784596 <br> <b>IFSC:</b> HDFC0000065 <br> <b>Branch:</b> Saraswathipuram,Mysore </td> </tr> </tbody> <tfoot> <tr> <td> <!--place holder for the fixed-position footer--> <div class="page-footer-space"></div> </td> </tr> </tfoot> </table> <div class="page-footer footer_address"> <div class="foot_line"></div> <h4 class="thank_message" style="color: #017dc6;text-align: center;padding-top: 5px;padding-bottom: 5px;border-bottom: 1px solid #000;margin-bottom: 5px;margin-top: 5px;">THANK YOU FOR YOUR BUSINESS!</h4> <h5 class="footer_office">Head Office</h5> <p>#656/D, 16th Main ,5th Cross,Saraswathipuram,Mysore,karnataka-570009.</p> <h5 class="footer_office">Branch Office</h5> <p>K R Square.#1073, 15th Cross,30th Main, Banashankari 2nd Stage, Bangalore-560070</p> <p>Ph:9663933606 / 9740285566, www.jayblues.com</p> <p>E-Mail: info@jayblues.com</p> <div class="top_line"></div> </div> <div class="row_6" style="text-align:center;padding-top:50px;"> <button type="button" style="background:blue;color:#fff;" class="print">Print</button> </div> <style> .main { font-family:'Conv_Taro-Bold_0',Sans-Serif; font-size: 14px; } table tr td { /*line-height: 1.6;*/ } .table_head { background-color: gray; color: white; text-align: center; } .table_head th, .table_head td { text-align: center; } .top_line { border: 2px solid #017dc6; } .to_address { vertical-align: top; } .foot_line { background-color: #000; height: 1px; width: 75%; text-align: center; margin-left: 93px; } .footer_office { text-align: center; font-weight: bold; letter-spacing: 1px; font-size: 16px; color: #000; } .footer_address p { text-align: center; letter-spacing: 1px; color: #555; font-weight: bold; } .top_row { border-bottom: 1px solid black; padding-bottom: 90px; } .page-header { border-bottom: transparent !important; margin: 0px 0 20px; } table tr td { padding-bottom:1%; } .amt_tr td { font-size: 14px; line-height: 1; } @media print { textarea { resize:none; } .table_head th { background-color: gray; color: white; text-align: center; } .thank_message { color: red; } .page-header { margin: 0px 0 0px; } .page-header, .page-header-space { height: 100px; } .page-footer, .page-footer-space { height: 250px; } .page-footer { position: fixed; bottom: 0; width: 100%; border-top: 1px solid black; } .page-header { position: fixed; top: 0mm; width: 100%; border-bottom: 1px solid black; } .page { page-break-after: always; } table tr { /*page-break-after: always;*/ } .footer_address p { margin: 0 !important; line-height: 1.8; } .footer_address h5 { margin-top: 5px !important; margin-bottom: 5px !important; } .amt_tr td { /*border: transparent !important;*/ border-left: 1px solid #000 !important; margin: 0 !important; } /* @page { margin: 20mm }*/ thead {display: table-header-group;} tfoot {display: table-footer-group;} button {display: none;} body {margin: 0;} } </style> </div> <div style="width: 100px;display: table-cell;padding-left: 30px;padding-top: 50px;"> <a href="<?php echo site_url('quotation-list');?>"><i class="fa fa-long-arrow-left fa-2x arro_w"></i></a> </div> </body> <!--------------------------------------------------------------------------------------> </html> <script type="text/javascript"> price(); $('.p_plus').click(function(e){ e.preventDefault(); var last_id=$( ".sino" ).last().val(); var add_id=parseInt(last_id)+1; var content=''; content+='<tr>'; content+='<td style="padding: 5px;border: 1px solid #000;"><input type="text" style="" value="'+add_id+'" name="sino" class="form-control sino" id="myInput6" required>'; content+='<br>'; content+='<td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="" name="description[]" class="form-control description" id="myInput7" required></textarea></td>'; content+='<td style="padding: 5px;border: 1px solid #000;vertical-align: top;"></td>'; content+='<td style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:120px;" name="price[]" id="total_price" class="total_price" onfocusout="price();" required></td>'; content += '<td class="action" style="text-align:center;padding: 5px;border: 1px solid #000;vertical-align: middle;"><a class="remove" href="javascript:void(0);"><i class="fa fa-trash" aria-hidden="true"></i></a></td>'; content+='</tr>'; $('.new_tr').append(content); $(".remove").click(function(){ $(this).closest('tr').remove(); price(); }); }); $(".remove_old").click(function(){ $(this).closest('tr').remove(); price(); }); $('.qut_amt').focusout(function(e){ e.preventDefault(); var t=$(this).val(); var res=$(this).val(); var res = res.replace(/[_\W]+/g, ""); var t=res; x=res.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; $('.qut_amt').val(res); $('#myInput9').val(res); var type=$('input[name=invoice_tax]:checked').val(); if(type=='tax'){ var state = $('select.state option:selected').val(); //alert(state); if(state=='Within State'){ var gst_per=$("#myInput10 option:selected").val().replace(/%/g,''); va=parseInt(gst_per); t=parseInt(t); var gst=t*va/100; gst=parseInt(gst); x=gst.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; $('#myInput11').val(res); var sgst_per=$("#myInput100 option:selected").val().replace(/%/g,''); sva=parseInt(sgst_per); t=parseInt(t); var sgst=t*sva/100; sgst=parseInt(sgst); x=sgst.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; $("#myInput111").val(res); var tot=parseInt(gst+sgst+t); x=tot.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; $('#myInput12').val(res); }else if(state=='Out of State'){ t=parseInt(t); var igst_per=$("#myInput201 option:selected").val().replace(/%/g,''); igst_va=parseInt(igst_per); t=parseInt(t); var igst=t*igst_va/100; igst=parseInt(igst); x=igst.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; $('#myInput211').val(res); var tot=parseInt(igst+t); x=tot.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; $('#myInput12').val(res); } }else{ $('#myInput12').val(res); } }); $('.invoice_tax_new').change(function(e){ e.preventDefault(); var mm=$(this).val(); if(mm=='no_tax'){ $('.trtt').hide(); $('.cgst_tr').hide(); $('.sgst_tr').hide(); $('.igst_tr').hide(); $('#myInput11').val(''); $('#myInput111').val(''); $('#myInput211').val(''); }else{ $('.trtt').show(); } }); $('.state').change(function(e){ e.preventDefault(); var state=$(this).val(); if(state=='Out of State'){ var tax=$('input[name=invoice_tax]:checked').val(); if(tax=='tax'){ $('.igst_tr').show(); $('.cgst_tr').hide(); $('.sgst_tr').hide(); } }else if(state=='Within State'){ var tax=$('input[name=invoice_tax]:checked').val(); if(tax=='tax'){ $('.igst_tr').hide(); $('.cgst_tr').show(); $('.sgst_tr').show(); } }else{ $('.igst_tr').hide(); $('.cgst_tr').hide(); $('.sgst_tr').hide(); } }); $('#myInput10').change(function(e){ e.preventDefault(); var amt=$('.qut_amt').val(); var res = amt.replace(/[_\W]+/g, ""); var t=parseInt(res); var per=$("#myInput10 option:selected").val().replace(/%/g,''); per=parseInt(per); var gst=t*per/100; var tot=gst+t; 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; x=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; $('#myInput11').val(gst); $('#myInput12').val(tot); }); $("#myInput4").autocomplete({ source: function( request, callback ) { var val=$('#myInput4').val(); var type = 'post' $.ajax({ type:type, url: '<?php echo site_url('search-lead'); ?>', data: {'val':val}, success: function( data ) { data=jQuery.parseJSON(data); multiple:true; callback($.map(data, function(vx){ return [ { label: vx.first_name + ":" +vx.email, value: vx.first_name + ":" +vx.email + ":" +vx.lead_id, } ]; })); } }); }, minLength: 1, select: function( event, ui ) { $("#myInput4").val( ui.item.label); $("#myInput4").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=$('#myInput4').val(); var name=val.split(':'); var n=name[0]; var company=name[1]; var lead_id=name[2]; $('.client_name').val(n); $('.lead').val(lead_id); var type = 'post' $.ajax({ type:type, url: '<?php echo site_url('lead-address'); ?>', data: {'lead_id':lead_id}, success: function( data ) { data=jQuery.parseJSON(data); $("textarea#myInput5").val(''); $("textarea#myInput5").val(data.street+' '+data.city+'\n'+data.state+' '+data.zip_code); } }); } $('.print').click(function(){ // $('.hidden_tr').hide(); // $('.invoice_tax').hide(); // $('.print').toggle(); // $('#submit').toggle(); // $("select").css({"-webkit-appearance": "none"}); // $('.p_plus').hide(); // $('.action').hide(); // $('.delete_icon').hide(); // $(".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"}); // $("#main_div").css({"width": "100%"}); // $("#name_to_new").css({"padding": "0px"}) // $(".action").css({"display": "none"}); // $(".grand_total_tr").css({"display": "none"}); // $(".tax").css({"display": "none"}); // $(".action").hide(); // $(".supply_to").css({"padding": "0px"}); // $(".supply_to").css({"margin": "0px"}); // $(".row_4").css({"height": "510px"}); // var val=$('#myInput4').val(); // var name=val.split(':'); // var n=name[0]; // $('#myInput4').val(n); // //("textarea").css({"resize": "none"}); // var myInput1 = document.getElementById("myInput1").style; // myInput1.borderStyle="none"; // $('.arro_w').hide(); // var myInput2 = document.getElementById("myInput2").style; // myInput2.borderStyle="none"; // var myInput3 = document.getElementById("myInput3").style; // myInput3.borderStyle="none"; // var myInput31 = document.getElementById("myInput31").style; // myInput31.borderStyle="none"; // $('#myInput5').removeAttr('placeholder'); // $('#myInput4').removeAttr('placeholder'); // var myInput1 = document.getElementById("myInput4").style; // myInput1.borderStyle="none"; // var myInput2 = document.getElementById("myInput5").style; // myInput2.borderStyle="none"; // var myInput6 = document.getElementById("myInput6").style; // myInput6.borderStyle="none"; // var myInput1 = document.getElementById("myInput7").style; // myInput1.borderStyle="none"; // //var myInput2 = document.getElementById("myInput8").style; // //myInput2.borderStyle="none"; // var myInput3 = document.getElementById("myInput9").style; // myInput3.borderStyle="none"; // //var myInput111 = document.getElementById("myInput111").style; // //myInput111.borderStyle="none"; // var myInput11 = document.getElementById("myInput11").style; // myInput11.borderStyle="none"; // var myInput10 = document.getElementById("myInput10").style; // myInput10.borderStyle="none"; // // var myInput2 = document.getElementById("myInput12").style; // //myInput2.borderStyle="none"; // $("#tableID .action").remove(); // window.print(); // }); // window.onafterprint = function(){ // window.location.reload(true); // var divToPrint=document.getElementById('print_div'); // newWin= window.open(""); // // newWin.document.write('<html><head><title></title>'); // // newWin.document.write('</head>'); // newWin.document.write(divToPrint.outerHTML); // // newWin.document.write('</html>'); // newWin.print(); // document.getElementById('print_div').style.display=''; // newWin.close(); window.print(); }); window.onafterprint = function(){ window.location.reload(true); } function price(){ // alert("price"); var tax=$('input[name=invoice_tax]:checked').val(); if(tax=='no_tax'){ $('.sub_total').removeAttr('required'); $('#cgst').removeAttr('required'); $('.cgst_amount').removeAttr('required'); $('#sgst').removeAttr('required'); $('.sgst_amount').removeAttr('required'); var sum=0; $(".total_price").each(function(i,val){ if($(this).val()!=''){ m=$(this).val(); m=parseInt(m); sum+=m; } }); var total_sum = sum; 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; $('.total').val(sum); $('.sub_total').val(sum); $('.grand_total').val(sum); total_pending_amount = 0; total_balance_amount = 0; 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 = sum.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"); $("#amount_inwords_td").html(words_string+ "Rupees Only"); } }else if(tax=='tax') { 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); var invoice_tax=$(".state option:selected").val(); if(invoice_tax=='Within State'){ // alert("within state"); cgst(); sgst(); }else if(invoice_tax=='Out of State'){ igst(); } }else { $('.sub_total').removeAttr('required'); $('#cgst').removeAttr('required'); $('.cgst_amount').removeAttr('required'); $('#sgst').removeAttr('required'); $('.sgst_amount').removeAttr('required'); var sum=0; $(".total_price").each(function(i,val){ if($(this).val()!=''){ m=$(this).val(); m=parseInt(m); sum+=m; } }); var total_sum = sum; 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; $('.total').val(sum); $('.sub_total').val(sum); $('.grand_total').val(sum); total_pending_amount = 0; total_balance_amount = 0; 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 = sum.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"); $("#amount_inwords_td").html(words_string+ "Rupees Only"); } } } function igst(){ var value=$('#igst').val(); var value=value.replace(/%/g,''); var igst =parseInt(value); var sub_total =$('.sub_total').val(); var sub_total = sub_total.replace(/[_\W]+/g, ""); var igst_amount =Math.round((igst*sub_total)/100); x=igst_amount.toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var igst_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; $('.igst_amount').val(igst_amount); var igst_amount=$('.igst_amount').val(); igst_amount=igst_amount.replace(/[_\W]+/g, ""); total_amount=parseInt(igst_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"); $("#amount_inwords_td").html(words_string+ "Rupees Only"); } } function cgst(){ // alert("cgst"); var value =$('#cgst').val(); var cgst =parseInt(value); var sub_total =$('.sub_total').val(); // alert("subtotal--"+sub_total); 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; // alert(cgst_amount); $('.cgst_amount').val(cgst_amount); //$("#cgst_td").append('<i class="fa fa-inr" aria-hidden="true"></i>. '+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(); if(cgst_amount!=undefined){ cgst_amount=cgst_amount.replace(/[_\W]+/g, ""); }else { cgst_amount=0; } 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"); $("#amount_inwords_td").html(words_string+ "Rupees Only"); } } $('#add_accounts').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("quotation-data-update")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response) { $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); toastr["success"]("Updated Successfully"); } else { $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); toastr["error"]("Something went wrong..Try again"); } } }); }); // $('#myInput12').focusout(function(e){ // e.preventDefault(); // var gst_per=$("#myInput10 option:selected").val().replace(/%/g,''); // var final_amount=$('#myInput12').val(); // var final_amount = final_amount.replace(/[_\W]+/g, ""); // var get_gst_amt=parseInt(gst_per)/100; // var final_gst=get_gst_amt+1; // var sub_tot=parseInt(final_amount)/parseFloat(final_gst); // sub_tot=Math.round(sub_tot); // var gst_tax=parseInt(final_amount)-parseInt(sub_tot); // gst_tax=Math.round(gst_tax); // x=sub_tot.toString(); // var lastThree = x.substring(x.length-3); // var otherNumbers = x.substring(0,x.length-3); // if(otherNumbers != '') // lastThree = ',' + lastThree; // var sub_tot = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; // x=gst_tax.toString(); // var lastThree = x.substring(x.length-3); // var otherNumbers = x.substring(0,x.length-3); // if(otherNumbers != '') // lastThree = ',' + lastThree; // var gst_tax = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; // $('#myInput11').val(gst_tax); // $('#myInput9').val(sub_tot); // $('#myInput8').val(sub_tot); // }); function getdate() { var tt = document.getElementById('myInput1').value; var res = tt.split("-"); var date_mdy=res[1]+'-'+res[0]+'-'+res[2]; var date = new Date(date_mdy); var newdate = new Date(date); newdate.setDate(newdate.getDate() + 15); var dd = newdate.getDate(); var mm = newdate.getMonth() + 1; var y = newdate.getFullYear(); var someFormattedDate = dd + '-' +mm + '-' + y; document.getElementById('myInput3').value = someFormattedDate; } $(function() { $('.description').each(function() { $(this).height($(this).prop('scrollHeight')); }); }); </script>