EVOLUTION-NINJA
Edit File: 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="<?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/css/bootstrap.min.css');?>"> <script src="<?php echo base_url('admin_assets/js/jquery-1.10.2.js');?>"></script> <script src="<?php echo base_url('admin_assets/toastr/toastr.min.js');?>"></script> <script src="<?php echo base_url('admin_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');?>" /> <html> <head> <title>Invoice</title> </head> <form id="invoi" method="post" style="padding:10px;"> <input type="hidden" class="quotation_id" name="quotation_ids"> <body> <div class="" style="width: 100%;"> <div class="" id="main_div" style="width:50%;float: left;margin-right: 10px;border-right: 1px solid #7b8ca0;padding-right: 10px;"> <div id="print_div"> <div class="page-header" style="text-align: center"> <div class="row_1" style="border-bottom: 1px solid #000;padding-bottom:65px;"> <img src="<?php echo base_url('admin_assets/logo.jpg');?>" style="float:left;"> <h1 style="color: #A6A6A6;text-align: right;padding-bottom: 5px;margin-bottom: 0px;float:right;" class="heading_name">INVOICE</h1> </div> <br/> <!--<button type="button" onClick="window.print()" style="background: pink">--> <!-- PRINT ME!--> <!--</button>--> </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="4"> Declaration: Payment mode will be in Cash, Cheques, NEFT or RTGS only. Make all cheques payable to [Jayblues] </td> </tr> <tr> <td style="padding-right:10px;padding-bottom:10px;"><b>Date: </b></td> <td><input type="text" style="" name="date" class="form-control date" value="<?php echo date('d-m-Y')?>" id="myInput1" autocomplete="off" required></td> </tr> <tr> <td style=" padding-right:0px;"><b>Invoice: </b></td> <td class="show_invoice" colspan="2"> <input type="text" style="width:100% ;"name="invoice" class="form-control invoice" value="<?php if($invoice_id != ""){ echo $invoice_id; } else{ echo 'JB-'.date('dmY').'/'.'1'; } ?>" id="myInput2" > <input type="hidden" style="width:100% ;"name="new_invoice_num" class="form-control" value="<?php echo $new_invoice_num;?>" id="new_invoice_num"> <input type="hidden" style="width:100% ;"name="new_pr_invoice_num" class="form-control" value="<?php echo $new_pr_invoice_num;?>" id="new_pr_invoice_num"> <input type="hidden" style="width:100% ;"name="new_cash_invoice_num" class="form-control" value="<?php echo $new_cash_invoice_num;?>" id="new_cash_invoice_num"> </td> </tr> <tr> <!--<td>Invoice Type</td>--> <td colspan="2" style="padding-right: 5px;"> <label>Invoice Type</label><br> <select type="select" name="from" class="from form-control" id="from" style="padding-bottom:5px;padding-top: 5px;"> <option value="">Select</option> <option value="Direct Invoice">Direct Invoice</option> <option value="From Quotation" selected="selected">From Quotation</option> </select> </td> <td colspan="2" class="quot_drop"> <label>Quotation</label><br> <input type="text" style="padding-bottom:5px;padding-top: 5px;" placeholder="Name" id="quotation_from" class="form-control quotation_from" name="quotation_id"> </td> </tr> <tr> <td colspan="2" style="padding-right: 5px;"> <select class="form-control invoice_type_new" name="invoice_type" id="invoice_type_new" required> <option value="">Select Invoice Type</option> <option value="Normal" selected>Normal</option> <option value="Profomo">Proforma</option> <option value="Cash">Cash</option> </select> </td> <td style="padding-right: 5px;"> <select class="form-control invoice_tax_new" name="invoice_tax_new" id="invoice_tax_new" required> <option value="">Select Tax/Not</option> <option value="tax">TAX</option> <option value="no_tax">NO TAX</option> </select> </td> <td colspan="2" class="show_tax_state"></td> </tr> <tr> </tr> <tr><td colspan="5"><hr style="border:transparent;"></td></tr> <tr> <td colspan="2" style="padding-right: 5px;"> <label>Bill To</label><br> <input type="text" placeholder="Name" style="width: 100%;" name="name" id="name" class="form-control name" required> <textarea rows="3" style="width:100%;margin-top:10px;" name="address" id="myInput4" class="address"></textarea> </td> <td colspan="2"> <label>Supply To</label><br> <input type="text" placeholder="" style="width: 100%;" name="supply_to" id="name_to_new" class="form-control name_to" required> <textarea rows="3" style="width:100%;margin-top:10px;" name="supply_to_address" id="address_new" class="address_new"></textarea> </td> </tr> <tr> <td colspan="2"> <button type="button" class="supply">Copy Bill To Address</button> </td> </tr> <tr> <td colspan="2"> GSTN: <input type="int" id="myInput5" style="" name="gstn" class="form-control gstn" > </td> </tr> <tr style="background:#7B8CA0;"> <th style="width: 5%;padding: 5px;border: 1px solid #000;">SI NO</th> <th style="width: 35%;padding: 5px;border: 1px solid #000;">DESCRIPTION</th> <th style="width: 30%;padding: 5px;border: 1px solid #000;">SAC</th> <th style="width: 20%;padding: 5px;border: 1px solid #000;">PRICE</th> <th style="width: 10%;padding: 5px;border: 1px solid #000;" class="action">Action</th> </tr> <tr class="old_tr"> <td style="padding: 5px;border: 1px solid #000;"><input type="text" style="" name="sino" class="form-control sino" value="1" id="myInput6" required> <br> <a href="" class="p_plus"><img src="<?php echo base_url(); ?>/admin_assets/images/blue-plus.png"></a> </td> <td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="" name="description[]" class="form-control description" id="myInput7" required></textarea></td> <td style="padding: 5px;border: 1px solid #000;vertical-align: top;"><input type="int" style="" name="sac[]" class="form-control sac" id="myInput8"></td> <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:100px;" name="price[]" id="total_price" onfocusout="price();" class="total_price" required></td> <td class="action" style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;"></td> </tr> <!--<tr>--> <!-- <td class="new_tr"></td>--> <!--</tr>--> <tbody class="new_tr"></tbody> <tr style="border-bottom: initial;border-color: transparent;" class="sub_total_tr"> <!--<td colspan="2" style="border-bottom:initial;border-left:initial;"></td>--> <td colspan="3" 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:100px;" class="sub_total" name="sub_total" id="myInput9" required></td> </tr> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="cgst_tr"> <!--<td colspan="2"></td>--> <td colspan="3" 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:100px;" name="cgst_amount" class="cgst_amount" id="cgst_amount"></td> </tr> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="sgst_tr"> <!--<td colspan="2"></td>--> <td colspan="3" 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" required> <?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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:100px;" class="sgst_amount" id="myInput10" name="sgst_amount"></td> </tr> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="igst_tr"> <!--<td colspan="2"></td>--> <td colspan="3" 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 class="" style="" class="igst" id="igst" name="igst" required> <?php foreach($igst 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:100px;" class="igst_amount" id="myInput20" name="igst_amount"></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <!--<td colspan="2" style="padding: 5px;"><b>In Words -</b></td>--> <td colspan="3" 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:100px;" class="total" id="myInput11" name="total_amount"></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" id="myInput14"></td>--> <td colspan="3" 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width:100px;" class="grand_total" name="grand_total" id="grand_total"></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="1" style="padding: 5px;border: 1px solid #000;font-weight: bold;font-size: 13px;">In Words:</td> <td colspan="3" style="padding: 5px;border: 1px solid #000;"><input type="text" style="" class="form-control amount_in_words" name="amount_in_words" id="myInput14"></td> </tr> <tr> <td colspan="2" style="padding-top:20px;">Company GSTN : 29BZLPS4657J1ZG</td> <td colspan="" style="padding-top:20px;">Company GSTN : 29BZLPS4657J1ZG</td> <td></td> </tr> <tr> <td colspan="2">Company Bank Details :</td> <td colspan="">Company Bank Details :</td> <td style="text-align:right;">For JAYBLUES TECHNOLOGIES</td> </tr> <tr> <td colspan="2">SBI</td> <td colspan="">HDFC Bank</td> <td rowspan="3"><img src="<?php echo base_url(); ?>/admin_assets/ajay_sig.jpg" style="float:right;width:100%;"/></td> </tr> <tr> <td colspan="2">Jayblues</td> <td colspan="">Jayblues</td> </tr> <tr> <td colspan="2">Account Type : Current Account</td> <td colspan="">Account Type : Current Account</td> </tr> <tr> <td colspan="2">Account Number : 62439776675</td> <td colspan="">Account Number : 50200010784596</td> <td colspan="" style="text-align:right;color:#000;">Authorized Signatory</td> </tr> <tr> <td colspan="2">IFSC : SBIN0020555</td> <td colspan="">IFSC : HDFC0000065</td> <td></td> </tr> <tr> <td colspan="2">Branch : Kalidasa Road, Mysore</td> <td colspan="">Branch : Saraswathipuram, Mysore</td> <td></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"> <!--<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;">K R Square, #1073, 15th cross,30th main, Banashankari 2nd stage, Bangalore - 560070.<br> Ph: 9663933606 / 9740285566, www.jayblues.com</p> </div> <div class="row_6" style="text-align:center;padding-top:50px;"> <button type="submit" style="background:blue;color:#fff;" id="submit_invoice">Save</button> <button type="button" style="background:blue;color:#fff;" onclick="save_data();">Save and Print</button> <button type="button" style="background:blue;color:#fff;" id="print_with_details" class="print_with_details">Print With Details</button> </div> <!--- <div class="row_1" style="border-bottom: 1px solid #000;padding-bottom:65px;"> <img src="<?php echo base_url('admin_assets/logo.jpg');?>" style="float:left;"> <h1 style="color: #A6A6A6;text-align: right;padding-bottom: 5px;margin-bottom: 0px;float:right;" class="heading_name">INVOICE</h1> </div> <div class="page-header-space"></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 echo date('d-m-Y')?>" id="myInput1" autocomplete="off" required></td> </tr> <tr> <td style=" padding-right:10px;"><b>Invoice: </b></td> <td> <div class="show_invoice"><input type="text" name="invoice" class="invoice" value="<?php if($invoice_id != ""){ $id=$invoice_id; echo 'JB-'.date('dmY').'/'.$id; } else{ echo 'JB-'.date('dmY').'/'.'1'; } ?>" id="myInput2" ></div> </td> </tr> </table> </div> <div class="row"> <div class="col-sm-4 invoice_type" style="padding-left: 0px;"> <select class="form-control invoice_type_new" name="invoice_type" required> <option value="">Select Invoice Type</option> <option value="Normal" selected>Normal</option> <option value="Profomo">Proforma</option> <option value="Cash">Cash</option> </select> </div> <div class="col-sm-4 invoice_tax" style="padding-left: 0px;" > <select class="form-control invoice_tax_new" name="invoice_tax_new" required> <option value="">Select TAX/NOT</option> <option value="tax">TAX</option> <option value="no_tax">NO TAX</option> </select> </div> <div class="col-sm-4 trtt show_tax_state" style="padding-left: 0px;"> </div> </div> <div class="row"> <div class="col-sm-4 trtt" style="padding-left: 0px;"> <label>Invoice Type</label> <select type="select" name="from" class="from form-control" style="padding-bottom:5px;padding-top: 5px;"> <option value="">Select</option> <option value="Direct Invoice">Direct Invoice</option> <option value="From Quotation" selected="selected">From Quotation</option> </select> </div> <div class="col-sm-4 quot_drop" style="display:none;padding-left: 0px !important;"> <label>Quotation</label> <input type="text" style="padding-bottom:5px;padding-top: 5px;" placeholder="Name" id="quotation_from" class="quotation_from" name="quotation_id"> </div> </div> <div class="" style="clear:both !important;"></div> <div class="row_3"> <div class="" style="padding-bottom:10px;padding-top: 30px; display: flow-root;width: 40%;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" required></p> <textarea rows="3" style="width:100%;" name="address" id="myInput4" class="address"></textarea> </div> <div class="supply_to" 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" required></p> <textarea rows="3" style="width:100%;" name="supply_to_address" id="address_new" class="address_new"></textarea> </div> </div> <button type="button" class="supply">Copy Bill To Address</button> <div class="row_4" style="padding: 20px 0px 30px;"> <p style="margin-bottom: 5px;">GSTN: <input type="int" id="myInput5" style="width: 30%;" name="gstn" class="gstn" ></p> <table class="gstn" 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> <tr> <td style="padding: 5px;border: 1px solid #000;"><input type="text" style="width: 100px;" name="sino" class="sino" id="myInput6" required> <br> <a href="" class="p_plus"><img src="<?php echo base_url(); ?>/admin_assets/images/blue-plus.png"></a> </td> <td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="width:100%;" name="description[]" class="description" id="myInput7" required></textarea></td> <td style="padding: 5px;border: 1px solid #000;vertical-align: top;"><input type="int" style="width: 100px;" name="sac[]" class="sac" id="myInput8"></td> <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: 100px;" name="price[]" id="total_price" onfocusout="price();" class="total_price" required></td> <td class="action" style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;"></td> </tr> <tbody class="new_tr"></tbody> <tr style="border-bottom: initial;border-color: transparent;" class="sub_total_tr"> <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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" class="sub_total" name="sub_total" id="myInput9" required></td> </tr> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="cgst_tr"> <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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" name="cgst_amount" class="cgst_amount" id="cgst_amount"></td> </tr> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="sgst_tr"> <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" required> <?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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" class="sgst_amount" id="myInput10" name="sgst_amount"></td> </tr> <tr style="border-bottom: initial;border-color: transparent;display: none;" class="igst_tr"> <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>IGST @</b> <select class="" style="" class="igst" id="igst" name="igst" required> <?php foreach($igst 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" class="igst_amount" id="myInput20" name="igst_amount"></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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" class="total" id="myInput11" name="total_amount"></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" id="myInput14"></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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" class="grand_total" name="grand_total" id="grand_total"></td> </tr> </table> </div> <div class="page-inner-space"></div> <div class="row_5" style=""> <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:19%;"> <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;">K R Square, #1073, 15th cross,30th main, Banashankari 2nd stage, Bangalore - 560070.<br> Ph: 9663933606 / 9740285566, www.jayblues.com</p> </div> <div class="page-footer-space"></div> <div class="row_6" style="text-align:center;padding-top:50px;"> <button type="submit" style="background:blue;color:#fff;" id="submit_invoice">Save</button> <button type="button" style="background:blue;color:#fff;" class="print">Print</button> <button type="button" style="background:blue;color:#fff;" id="print_with_details" class="print_with_details">Print With Details</button> </div> <br> </div>----> </div> </div> <div class="" id="print_div12" style="width: 40%;float: left;"> <div id="print_div1"> <div class="row_1" style="border-bottom: 1px solid #000;padding-bottom:65px;"> <h1 style="color: #A6A6A6;text-align: right;padding-bottom: 5px;margin-bottom: 0px;float:right;">Details</h1> </div> <br> <div style="clear:both !important;"></div> <div id="quotation_amount"></div> <table border="1" style="width:100%;border-collapse: collapse;border-left: initial;border-bottom: initial;margin-bottom: 20px;"> <tr style="background:#7B8CA0;"> <th style="width: 10%;padding: 5px;border: 1px solid #000;color: #fff;">Invoice Amount</th> <th style="width: 10%;padding: 5px;border: 1px solid #000;color: #fff;">Paid Amount</th> <th style="width: 10%;padding: 5px;border: 1px solid #000;color: #fff;">Date</th> <th style="width: 10%;padding: 5px;border: 1px solid #000;color: #fff;">Invoice No</th> <th style="width: 10%;padding: 5px;border: 1px solid #000;color: #fff;">Pending</th> </tr> <tbody id="invoice_paid_amounts"> </tbody> <!--<tbody id="total_invoice_amount"> </tbody>--> </table> <div id="pending_amount"></div> </div> <div id="quotation_table"></div> </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> <input type="hidden" class="balance_amount"> </html> <?php //echo $invoice_id; if($invoice_id != "") { // $id=$invoice_id; // echo 'JB-'.date('dmY').'/'.$id; } else { //echo 'JB-'.date('dmY').'/'.'1'; } ?> <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'); }); function state_change(){ var state=$('.state').val(); if(state=='Out of State'){ var tax=$('select[name="invoice_tax_new"]').val();//$('input[name=invoice_tax_new]').val(); if(tax=='tax'){ $('.igst_tr').show(); $('.cgst_tr').hide(); $('.sgst_tr').hide(); } }else if(state=='Within State'){ var tax=$('select[name="invoice_tax_new"]').val();//$('input[name=invoice_tax_new]').val(); if(tax=='tax'){ $('.igst_tr').hide(); $('.cgst_tr').show(); $('.sgst_tr').show(); } }else{ $('.igst_tr').hide(); $('.cgst_tr').hide(); $('.sgst_tr').hide(); } } $('.invoice_type_new').change(function(e){ e.preventDefault(); var ddd=$(this).val(); var con=''; if(ddd=='Profomo'){ //con+='<input type="text" name="invoice" class="invoice form-control" value="<?php if($proforma_id != ""){ echo $proforma_id; } else{ echo 'JB-PROFORMA/'.date('dmY').'/'.'1';} ?>" id="myInput2" >'; con+='<input type="text" name="invoice" class="invoice form-control" value="<?php if($proforma_id != ""){ echo $proforma_id; } else{ echo 'JB-'.date('dmY').'/'.'1'.'/PROFORMA';} ?>" id="myInput2" >'; con+='<input type="hidden" name="new_pr_invoice_num" class="form-control" value="<?php echo $new_pr_invoice_num;?>" id="new_pr_invoice_num" >'; $('.show_invoice').empty(); $('.show_invoice').append(con); $('.heading_name').empty(); $('.heading_name').append('PROFORMA INVOICE'); $('.invoice_tax').show(); }else if(ddd=='Normal'){ //con+='<input type="text" name="invoice" class="invoice form-control" value="<?php if($invoice_id != ""){ echo $invoice_id; } else{ echo 'JB-NORMAL/'.date('dmY').'/'.'1'; } ?>" id="myInput2" >'; con+='<input type="text" name="invoice" class="invoice form-control" value="<?php if($invoice_id != ""){ echo $invoice_id; } else{ echo 'JB-'.date('dmY').'/'.'1'; } ?>" id="myInput2" >'; con+='<input type="hidden" name="new_invoice_num" class="form-control" value="<?php echo $new_invoice_num;?>" id="new_invoice_num" >'; $('.show_invoice').empty(); $('.show_invoice').append(con); $('.heading_name').empty(); $('.heading_name').append('INVOICE'); $('.invoice_tax').show(); }else { //con+='<input type="text" name="invoice" class="invoice form-control" value="<?php if($cash_id != ""){ echo $cash_id; } else{ echo 'JB-CASH/'.date('dmY').'/'.'1';} ?>" id="myInput2" >'; con+='<input type="text" name="invoice" class="invoice form-control" value="<?php if($cash_id != ""){ echo $cash_id; } else{ echo 'JB-'.date('dmY').'/'.'1'.'/CASH';} ?>" id="myInput2" >'; con+='<input type="hidden" name="new_cash_invoice_num" class="form-control" value="<?php echo $new_cash_invoice_num;?>" id="new_cash_invoice_num" >'; $('.show_invoice').empty(); $('.show_invoice').append(con); $('.heading_name').empty(); $('.heading_name').append('CASH INVOICE'); $('.invoice_tax').show(); } }); var val = $("input[name='invoice_tax']:checked").val(); invoice_tax(val); function invoice_tax(val) { if(val=='no_tax'){ $('.show_tax_state').empty(); $('.sub_total_tr').show(); $('.cgst_tr').hide(); $('.sgst_tr').hide(); $('.igst_tr').hide(); }else if(val=='tax'){ var con=''; //con+='<label>Invoice Tax</label>'; con+=' <select type="select" name="invoice_tax" id="state" class="state state_append form-control" onchange="state_change();" style="padding-bottom:5px;padding-top: 5px;" required>'; con+='<option value="">Select Invoice Tax</option>'; con+='<option value="Within State">Within State</option>'; con+='<option value="Out of State">Out of State</option>'; con+='</select>'; $('.show_tax_state').empty(); $('.show_tax_state').append(con); $('.sub_total_tr').show(); $('.cgst_tr').show(); $('.sgst_tr').show(); $('.igst_tr').show(); } else{ $('.sub_total_tr').show(); $('.cgst_tr').show(); $('.sgst_tr').show(); $('.igst_tr').show(); } } $('.invoice_tax_new').change(function(e){ e.preventDefault(); var mm=$(this).val(); invoice_tax(mm); }); var option_val = $('.from').val(); invoice_type(option_val); function invoice_type(val) { if(val=='From Quotation'){ $('#name').attr("readonly", true); $('#myInput4').attr("readonly", true); $('.quot_drop').show(); }else{ $('#name').attr("readonly", false); $('#myInput4').attr("readonly", false) $('#name_to_new').attr("readonly", false); $('#address_new').attr("readonly", false); $('#name').val(''); $('#myInput4').val('') $('#name_to_new').val(''); $('#address_new').val(''); $('.quot_drop').hide(); } } $('.from').change(function(e){ e.preventDefault(); var frm=$('.from').val(); $('#invoice_paid_amounts').empty(); $('#total_invoice_amount').empty(); $('#quotation_from').val(''); invoice_type(frm) }); $(':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 last_id=$( ".sino" ).last().val(); var add_id=parseInt(last_id)+1; var content=''; content+='<tr class="page-inner-space1">'; 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="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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" 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);"><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(); }); $('.supply').click(function(e){ e.preventDefault(); var supply_to=$('#name').val(); var address_enw=$('#myInput4').val(); var name=supply_to.split(':'); var name=name[0]; $('#name_to_new').val(name); $('textarea#address_new').val(address_enw); $('#name_to_new').attr("readonly", true); $('#address_new').attr("readonly", true); }); function price(){ var tax_value = $("#invoice_tax_new").val(); var tax_invoice_value = $("#state").val(); var invoice_type_new = $("#invoice_type_new").val(); if(tax_value == "" && invoice_type_new != "Cash") { toastr["error"]('Select tax'); $(".total_price").val(''); } else if(tax_invoice_value == "" && invoice_type_new != "Cash") { toastr["error"]('Select invoice tax'); $(".total_price").val(''); } else { var tax=$('select[name="invoice_tax_new"]').val(); if(tax=='no_tax'){ $('.cgst_amount').val(0); $('.sgst_amount').val(0); $('#cgst').val(0); $('.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; $('.sub_total').val(sum); $('.total').val(sum); $('.grand_total').val(sum); var balance_amount = $('.balance_amount').val(); var pending_amount = balance_amount - total_sum; y=balance_amount.toString(); var lastThree = y.substring(y.length-3); var otherNumbers = y.substring(0,y.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_balance_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; z=pending_amount.toString(); var lastThree = z.substring(z.length-3); var otherNumbers = z.substring(0,z.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_pending_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; if($('.from').val() == 'Direct Invoice') { total_pending_amount = ''; total_balance_amount = ''; } var table_fields = ''; table_fields +='<tr>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_balance_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+sum+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_pending_amount+'</td>'; table_fields +='</tr>'; $('#total_invoice_amount').html(table_fields); 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"); } }else { 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'){ cgst(); sgst(); }else if(invoice_tax=='Out of State'){ igst(); } } } } 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 balance_amount = $('.balance_amount').val(); var pending_amount = balance_amount - total_round_new; y=balance_amount.toString(); var lastThree = y.substring(y.length-3); var otherNumbers = y.substring(0,y.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_balance_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; z=pending_amount.toString(); var lastThree = z.substring(z.length-3); var otherNumbers = z.substring(0,z.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_pending_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; if($('.from').val() == 'Direct Invoice') { total_pending_amount = ''; total_balance_amount = ''; } var table_fields = ''; table_fields +='<tr>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_balance_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_round+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"><?php echo date('d-m-Y')?></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"><?php if($invoice_id != ""){ $id=$invoice_id; echo 'JB-'.date('dmY').'/'.$id; } else{ echo 'JB-'.date('dmY').'/'.'1';} ?></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_pending_amount+'</td>'; table_fields +='</tr>'; $('#total_invoice_amount').html(table_fields); 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"); } } 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 balance_amount = $('.balance_amount').val(); var pending_amount = balance_amount - total_round_new; y=balance_amount.toString(); var lastThree = y.substring(y.length-3); var otherNumbers = y.substring(0,y.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_balance_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; z=pending_amount.toString(); var lastThree = z.substring(z.length-3); var otherNumbers = z.substring(0,z.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_pending_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; if($('.from').val() == 'Direct Invoice') { total_pending_amount = ''; total_balance_amount = ''; } var table_fields = ''; table_fields +='<tr>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_balance_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_round+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"><?php echo date('d-m-Y')?></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"><?php if($invoice_id != ""){ $id=$invoice_id; echo 'JB-'.date('dmY').'/'.$id; } else{ echo 'JB-'.date('dmY').'/'.'1';} ?></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_pending_amount+'</td>'; table_fields +='</tr>'; $('#total_invoice_amount').html(table_fields); 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(); 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); return { value: ui.item.value }; }, open: function() { //address1(); // Do something on open event. }, close: function() { address1(); direct_invoice_payment(); // Do something on close event } }); // $('.print').click(function(){ function print_data(){ $('.print').toggle(); $('#submit_invoice').toggle(); $("select").css({"-webkit-appearance": "none"}); $('.p_plus').hide(); $('.action').hide(); $('.delete_icon').hide(); $('#rd').remove(); $('.supply').hide(); $('.trtt').hide(); $('.quot_drop').hide(); 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"}); $("#main_div").css({"width": "100%"}); $("#name_to_new").css({"padding": "0px"}) $(".action").css({"display": "none"}); $(".action").hide(); $(".supply_to").css({"padding": "0px"}); $(".supply_to").css({"margin": "0px"}); $(".row_4").css({"height": "510px"}); // var tds=document.getElementById("tds").style; // tds.borderStyle="none"; var name_to_new=document.getElementById("name_to_new").style; name_to_new.borderStyle="none"; var total_price=document.getElementById("total_price").style; total_price.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 igst=document.getElementById("igst").style; igst.borderStyle="none"; var address_new=document.getElementById("address_new").style; address_new.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"; var myInput20=document.getElementById("myInput20").style; myInput20.borderStyle="none"; var print_div1=document.getElementById("print_div1").style; print_div1.display="none"; var print_with_details=document.getElementById("print_with_details").style; print_with_details.display="none"; var main_div=document.getElementById("main_div").style; main_div.borderStyle="none"; var invoice_type_new=document.getElementById("invoice_type_new").style; invoice_type_new.borderStyle="none"; var invoice_tax_new=document.getElementById("invoice_tax_new").style; invoice_tax_new.borderStyle="none"; var state=document.getElementById("state").style; state.borderStyle="none" $("#invoice_type_new").css("display", "none"); $("#invoice_tax_new").css("display", "none"); $("#state").css("display", "none"); var from=document.getElementById("from").style; from.borderStyle="none"; window.print(); //$("#print_div").print(); } window.onafterprint = function(){ window.location.reload(true); } $('.print_with_details').click(function(){ $('.print').toggle(); $('#submit_invoice').toggle(); $("select").css({"-webkit-appearance": "none"}); $('.p_plus').hide(); $('.action').hide(); $('.delete_icon').hide(); $('#rd').remove(); $('.supply').hide(); $('.trtt').hide(); $('.quot_drop').hide(); 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"}); $("#main_div").css({"width": "100%"}); $("#print_div12").css({"width": "100%"}); $(".action").css({"display": "none"}); $(".action").hide(); $(".supply_to").css({"padding": "0px"}); $(".supply_to").css({"margin": "0px"}); $(".row_4").css({"height": "510px"}); // var tds=document.getElementById("tds").style; // tds.borderStyle="none"; var name_to_new=document.getElementById("name_to_new").style; name_to_new.borderStyle="none"; var total_price=document.getElementById("total_price").style; total_price.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 igst=document.getElementById("igst").style; igst.borderStyle="none"; var address_new=document.getElementById("address_new").style; address_new.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"; var myInput20=document.getElementById("myInput20").style; myInput20.borderStyle="none"; var print_with_details=document.getElementById("print_with_details").style; print_with_details.display="none"; var main_div=document.getElementById("main_div").style; main_div.borderStyle="none"; window.print(); //$("#print_div").print(); }); </script> <script> var load_id='<?php echo $this->uri->segment(2);?>'; if(load_id!='') { $.ajax({ type:'post', url: '<?php echo site_url('yaskawa/search_quotation_id_to_invoice'); ?>', data: {'q_id':load_id}, success: function( data ) { data=jQuery.parseJSON(data); $('#submit').removeAttr("disabled"); if(data.result==1){ $('#quotation_from').val(data.message.quotation_id+':'+data.message.client_name + ":" +data.message.address+ ":"+data.message.amount+ ":" +data.message.quotation_id); address(); //get_description_and_price(load_id); }else{ //get_description_and_price(load_id); alert("Lead is not yet Created"); $('#submit').attr("disabled", "disabled"); } } }); } $("#quotation_from").autocomplete({ source: function( request, callback ) { var val=$('#quotation_from').val(); var type = 'post' $.ajax({ type:type, url: '<?php echo site_url('search-quotation'); ?>', data: {'val':val}, success: function( data ) { data=jQuery.parseJSON(data); $('#submit').removeAttr("disabled"); if(data!='0'){ multiple:true; callback($.map(data, function(vx){ return [ { label: vx.quotation_number + ":" + vx.client_name + ":" +vx.account_name+ ":"+vx.amount+ ":"+vx.address, value: vx.quotation_number + ":" + vx.client_name + ":" +vx.address+ ":"+vx.amount+ ":" +vx.quotation_id } ]; })); }else{ alert("Lead is not yet Created"); $('#submit').attr("disabled", "disabled"); } } }); }, minLength: 1, select: function( event, ui ) { $("#quotation_from").val( ui.item.label); $("#quotation_from").val( ui.item.value); return { value: ui.item.value }; }, open: function() { // Do something on open event. }, close: function() { address(); // Do something on close event } }); function direct_invoice_payment(){ var val=$('#name').val(); var name=val.split(':'); var n=name[0]; var quotation_id=name[1]; var names = n; $.ajax({ type : "post", url : "<?php echo site_url('yaskawa/get_invoice_payment_details')?>", data : {'name':names,'quotation_id':quotation_id,'from':'invoice'}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $('#invoice_paid_amounts').empty(); $('#total_invoice_amount').empty(); var table_fields = ''; $.each(response.message, function(key,val) { x=(val.balance_amount).toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var balance_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; y=(val.paid_amount).toString(); var lastThree = y.substring(y.length-3); var otherNumbers = y.substring(0,y.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var paid_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; z=(val.pending_amount).toString(); var lastThree = z.substring(z.length-3); var otherNumbers = z.substring(0,z.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var pending_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; table_fields +='<tr>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+balance_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+paid_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+val.date+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+val.invoice_no+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+pending_amount+'</td>'; table_fields +='</tr>'; $('.balance_amount').val(val.pending_amount); }); $('#invoice_paid_amounts').append(table_fields); if(response.quotation != null) { $("#quotation_amount").html('<h4>Quotation amount : '+response.quotation.amount+'</h4>'); $("#pending_amount").html('<h4>Quotation amount : '+response.quotation.pending+'</h4>'); } else { $("#quotation_amount").empty(); $("#pending_amount").empty(); } } else { $('#invoice_paid_amounts').empty(); $('#total_invoice_amount').empty(); } } }); } function address(){ var val=$('#quotation_from').val(); var name=val.split(':'); var quotation_number = name[0]; var n=name[1]; var address=name[2]; var amount=name[3]; var quotation_id=name[4]; var company_name=name[1]; $("#name").val(company_name); $('.address').val(address); $('.quotation_id').val(quotation_id); $('.balance_amount').val(amount); var names = n; $.ajax({ type : "post", url : "<?php echo site_url('yaskawa/get_invoice_payment_details')?>", data : {'name':names,'quotation_id':quotation_id,'from':'qoutation','quotation_number':quotation_number}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { get_description_and_price(quotation_id); $('#invoice_paid_amounts').empty(); $('#total_invoice_amount').empty(); $.each(response.message, function(key,val) { var table_fields = ''; x=(val.balance_amount).toString(); var lastThree = x.substring(x.length-3); var otherNumbers = x.substring(0,x.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var balance_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; y=(val.paid_amount).toString(); var lastThree = y.substring(y.length-3); var otherNumbers = y.substring(0,y.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var paid_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; z=(val.pending_amount).toString(); var lastThree = z.substring(z.length-3); var otherNumbers = z.substring(0,z.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var pending_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; table_fields +='<tr>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+balance_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+paid_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+val.date+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+val.invoice_no+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+pending_amount+'</td>'; table_fields +='</tr>'; $('#invoice_paid_amounts').append(table_fields); $('.balance_amount').val(val.pending_amount); }); if(response.quot_tax != "") { $(".invoice_tax_new").val(response.quot_tax.tax_no_tax); invoice_tax(response.quot_tax.tax_no_tax); } } else { get_description_and_price(quotation_id); $('#invoice_paid_amounts').empty(); $('#total_invoice_amount').empty(); } } }); } function get_description_and_price(id) { var quotation_content = ''; $.ajax({ type : "post", url : "<?php echo site_url('yaskawa/get_description_and_price')?>", data : {'quotation_id':id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { if(response.message.gst_amount != 0 || response.message.igst_amount != 0 || response.message.sgst_amount != 0){ $('.invoice_tax_new option[value="tax"').attr('selected','selected'); invoice_tax('tax'); if(response.message.igst_amount!=0) { $('.state_append option[value="Out of State"').attr('selected','selected'); state_change(); } else { $('.state_append option[value="Within State"').attr('selected','selected'); state_change(); } }else { $('.invoice_tax_new option[value="no_tax"').attr('selected','selected'); state_change(); invoice_tax('no_tax'); } var content=''; if(response.message.price!=''){ price=jQuery.parseJSON(response.message.price); description=jQuery.parseJSON(response.message.description); $.each(price, function( key, value ) { var ky=parseInt(key)+1; content+='<tr class="page-inner-space1">'; content+='<td style="padding: 5px;border: 1px solid #000;"><input type="text" value="'+ky+'" style="width: 100px;" name="sino" class="sino" id="myInput6" required>'; content+='<br>'; if(key==0){ content+='<a href="javascript:void(0)" class="p_plus"><img onclick="pluse();" src="<?php echo base_url(); ?>/admin_assets/images/blue-plus.png"></a>'; } content+='<td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="width:100%;" name="description[]" class="description" id="myInput7" required>'+description[key]+'</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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" value="'+value+'" style="width: 100px;" name="price[]" id="total_price" class="total_price" onfocusout="price_new();" 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);"><span class="glyphicon glyphicon-trash delete_icon"></span></a></td>'; content+='</tr>'; }); $('.old_tr').empty(); $('.new_tr').empty(); $('.new_tr').append(content); $('.description').height($('.description').prop('scrollHeight')); price_new(); //-------------------------------------------------------// quotation_content += '<h4>Quotation Amount</h4>'; quotation_content += '<table border="1" style="width:100%;border-collapse: collapse;border-left: initial;border-bottom: initial;">'; quotation_content += '<tr style="background:#7B8CA0; border: 1px solid #000;">'; quotation_content += '<th style="padding: 5px;color: #fff;">DESCRIPTION</th>'; quotation_content += '<th style="padding: 5px;color: #fff;">SAC</th>'; quotation_content += '<th style="padding: 5px;color: #fff;">PRICE</th>'; // quotation_content += '<th>Action</th>'; quotation_content += '</tr>'; quotation_content += '<tbody>'; $.each(price, function( key, value ) { var ky=parseInt(key)+1; quotation_content += '<tr class="page-inner-space1">'; quotation_content += '<td style="padding: 5px;border: 1px solid #000;">'+description[key]+'</td>'; quotation_content += '<td style="padding: 5px;border: 1px solid #000;vertical-align: top;"></td>'; quotation_content += '<td style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;"><i class="fa fa-inr" aria-hidden="true"></i>. '+value+'</td>'; // quotation_content += '<td style="padding: 5px;border: 1px solid #000;"><button type="button" class="btn btn-sm btn-primary copy_details" quotation_id="'+id+'">Copy</button></td>'; quotation_content += '</tr>'; }); quotation_content += '</tbody>'; quotation_content += '</table>'; $("#quotation_table").html(quotation_content); $(".copy_details").click(function(){ }); //-------------------------------------------------------// }else { content+='<tr class="page-inner-space1">'; content+='<td style="padding: 5px;border: 1px solid #000;"><input type="text" value="1" style="width: 100px;" name="sino" class="sino" id="myInput6" required>'; content+='<br>'; content+='<a href="javascript:void(0)" class="p_plus"><img onclick="pluse();" src="<?php echo base_url(); ?>/admin_assets/images/blue-plus.png"></a>'; content+='<td style="padding: 5px;border: 1px solid #000;"><textarea rows="3" style="width:100%;" name="description[]" class="description" id="myInput7" required>'+response.message.description+'</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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" value="'+response.message.amount+'" style="width: 100px;" name="price[]" id="total_price" class="total_price" onfocusout="price_new();" 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);"><span class="glyphicon glyphicon-trash delete_icon"></span></a></td>'; content+='</tr>'; $('.old_tr').empty(); $('.new_tr').empty(); $('.new_tr').append(content); $('.description').height($('.description').prop('scrollHeight')); price_new(); //-------------------------------------------------------// quotation_content += '<h4>Quotation Amount</h4>'; quotation_content += '<table border="1" style="width:100%;border-collapse: collapse;border-left: initial;border-bottom: initial;">'; quotation_content += '<tr style="background:#7B8CA0; border: 1px solid #000;">'; quotation_content += '<th style="padding: 5px;color: #fff;">DESCRIPTION</th>'; quotation_content += '<th style="padding: 5px;color: #fff;">SAC</th>'; quotation_content += '<th style="padding: 5px;color: #fff;">PRICE</th>'; // quotation_content += '<th>Action</th>'; quotation_content += '</tr>'; quotation_content += '<tbody>'; quotation_content += '<tr class="page-inner-space1">'; quotation_content += '<td style="padding: 5px;border: 1px solid #000;">'+response.message.description+'</td>'; quotation_content += '<td style="padding: 5px;border: 1px solid #000;vertical-align: top;"></td>'; quotation_content += '<td style="padding: 5px;border: 1px solid #000;vertical-align: top;text-align: right;"><i class="fa fa-inr" aria-hidden="true"></i>. '+response.message.amount+'</td>'; // quotation_content += '<td style="padding: 5px;border: 1px solid #000;"><button type="button" class="btn btn-sm btn-primary copy_details" quotation_id="'+id+'">Copy</button></td>'; quotation_content += '</tr>'; quotation_content += '</tbody>'; quotation_content += '</table>'; $("#quotation_table").html(quotation_content); $(".copy_details").click(function(){ var row_description = $(this).closest('td').next().text(); alert(row_description); }); //-------------------------------------------------------// } } else { $('#invoice_paid_amounts').empty(); $('#total_invoice_amount').empty(); } } }); } function pluse() { var last_id=$( ".sino" ).last().val(); var add_id=parseInt(last_id)+1; var content=''; content+='<tr class="page-inner-space1">'; content+='<td style="padding: 5px;border: 1px solid #000;"><input type="text" style="width: 100px;" value="'+add_id+'" 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;"><i class="fa fa-inr" aria-hidden="true"></i>. <input type="text" style="width: 100px;" name="price[]" id="total_price" class="total_price" onfocusout="price_new();" 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);"><span class="glyphicon glyphicon-trash delete_icon"></span></a></td>'; content+='</tr>'; $('.description').height($('.description').prop('scrollHeight')); $('.new_tr').append(content); } function price_new() { var tax=$('select[name="invoice_tax_new"]').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); var balance_amount = $('.balance_amount').val(); var pending_amount = balance_amount - total_sum; y=balance_amount.toString(); var lastThree = y.substring(y.length-3); var otherNumbers = y.substring(0,y.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_balance_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; z=pending_amount.toString(); var lastThree = z.substring(z.length-3); var otherNumbers = z.substring(0,z.length-3); if(otherNumbers != '') lastThree = ',' + lastThree; var total_pending_amount = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree; if($('.from').val() == 'Direct Invoice') { total_pending_amount = ''; total_balance_amount = ''; } var table_fields = ''; table_fields +='<tr>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_balance_amount+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+sum+'</td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"><?php echo date('d-m-Y')?></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;"><?php if($invoice_id != ""){ $id=$invoice_id; echo 'JB-'.date('dmY').'/'.$id; } else{ echo 'JB-'.date('dmY').'/'.'1';} ?></td>'; table_fields +='<td style="padding: 5px;border: 1px solid #000;">'+total_pending_amount+'</td>'; table_fields +='</tr>'; $('#total_invoice_amount').html(table_fields); 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"); } }else { 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'){ cgst(); sgst(); }else if(invoice_tax=='Out of State'){ igst(); } } } function address1(){ 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").val(data.billing_street+' '+data.billing_city+' '+data.billing_state); $('.gstn').val(data.gst_code); //$('.quotation_id').val(0); } }); } function save_data(){ formdata = new FormData($('#invoi')[0]); $(".submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("add-invoice-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { alert('Added Successfully'); print_data(); //location.reload(); //window.location = '<?php echo site_url("invoice-list")?>'; // $('.print').click(); } else { //toastr["error"](response.message); } } }); } $('#invoi').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("add-invoice-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { alert('Added Successfully'); //location.reload(); window.location = '<?php echo site_url("invoice-list")?>'; } else { //toastr["error"](response.message); } } }); }); $(function() { $('.description').each(function() { $(this).height($(this).prop('scrollHeight')); }); }); </script> <style type="text/css"> .p_plus img { width: 18px; padding-top: 5px; display: block; margin:auto; } /* @media print { .row_1 { position: fixed; top: 0mm; width: 100%; height:100px; } .page-header-space { height:100px; } .row_6 { position: fixed; bottom: 0mm; width: 100%; } .page-footer-space { height:100px; } .page-inner-space { height:120px; } .page-inner-space1 { } .gstn { height:100px; } .row_4 { page-break-after: always; } .new_tr { page-break-after: always; } }*/ .page-header { border-bottom: transparent !important; margin: 0px 0 20px; } table tr td { padding-bottom:1%; } @media print { textarea { resize:none; } .page-header { margin: 0px 0 0px; } .page-header, .page-header-space { height: 100px; } .page-footer, .page-footer-space { height: 150px; } .page-footer { position: fixed; bottom: 0; width: 100%; border-top: 1px solid black; /* for demo */ background: yellow; /* for demo */ } .page-header { position: fixed; top: 0mm; width: 100%; border-bottom: 1px solid black; /* for demo */ background: yellow; /* for demo */ } .page { page-break-after: always; } table tr { page-break-after: always; } @page { margin: 20mm } thead {display: table-header-group;} tfoot {display: table-footer-group;} button {display: none;} body {margin: 0;} } .ui-autocomplete { max-height: 200px; overflow-y: auto; /* prevent horizontal scrollbar */ overflow-x: hidden; /* add padding to account for vertical scrollbar */ z-index:1000 !important; } </style>