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