EVOLUTION-NINJA
Edit File: invoice_list.php
<?php $this->load->view('includes/admin_header');?> <!--<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">--> <link rel="stylesheet" href="<?php echo base_url('admin_assets/toastr/toastr.min.css');?>"> <link rel="stylesheet" href="<?php echo base_url('admin_assets/sweet_alert/sweet-alert.css');?>"> <script src="<?php echo base_url('admin_assets/sweet_alert/sweet-alert.js');?>"></script> <script src="<?php echo base_url('admin_assets/toastr/toastr.min.js');?>"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <div class="main-container " id="main-container"> <div class="main-content"> <div class="main-content-inner"> <div class=" page-content" style="background-color:#f0f0f0;"> <div class="row"> <div class="col-sm-7 " style="margin-top:5px;"> <h3>Invoice List</h3> </div> <div class="col-sm-2" style="float:left;"> </div> </div> <label><input type="radio" name="status" value="All" class="inv_st" checked>All</label> <label><input type="radio" name="status" value="PENDING" class="inv_st" >PENDING</label>   <label><input type="radio" name="status" value="CANCELLED" class="inv_st">CANCELLED</label>   <label><input type="radio" name="status" value="CLEARED" class="inv_st">CLEARED</label>   <label><input type="radio" name="status" value="PARTIAL" class="inv_st">PARTIAL PAID</label>   <div class="col-sm-3" style="float:right;"> <input type="text" name="date" id="search_invoice_date"> <button onclick="search_invoice();">Search</button> </div> <!-- Modal --> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <form id="import_employee"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">Import Employees</h4> </div> <div class="modal-body"> <input type="file" name="import_employee" > </div> <div class="modal-footer"> <button type="sumit" class="btn">Import</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </form> </div> </div> <!-- <button class="inv_pay">Update</button> --> <div class="row" style="background-color:white;margin-top:10px;"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div> <div class="row search-page" id="search-page-1"> <div class="col-xs-12"> <div class="row"> <div class="col-xs-12 col-sm-12"> <div class="row"> <div id="addele_more"> <div id="jaytab3" style="margin-top:2%;"> <div class="grid_div"></div> <table id="list3"> </table> <div id="pager3"></div> <div id="dialogSelectRow3" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="addele_more6" style="display:none;"> <div id="jaytab4c" style="margin-top:2%;" > <div class="grid_div"></div> <table id="list6"> </table> <div id="pager6"></div> <div id="dialogSelectRow6" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="addele_more1" style="display:none;"> <div id="jaytab4c" style="margin-top:2%;" > <div class="grid_div"></div> <table id="list4"> </table> <div id="pager4"></div> <div id="dialogSelectRow4" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="addele_more2" style="display:none;"> <div id="jaytab5p" style="margin-top:2%;"> <div class="grid_div"></div> <table id="list5"> </table> <div id="pager5"></div> <div id="dialogSelectRow5" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="addele_more3" style="display:none;"> <div id="jaytab6pp" style="margin-top:2%;"> <div class="grid_div"></div> <table id="list_new"> </table> <div id="pager6"></div> <div id="dialogSelectRow6" title="Warning" style="display:none"> <p>Please select row</p> </div> </div> </div> <div id="addele_more7" style="display:none;"> </div> </div> </div> </div> </div> </div> </div> </div><!-- /.col --> </div><!-- /.row --> <div style="width: 800px;display:none" id="edit_invoice" > <div id="print_div"> <div class="row_1" style="border-bottom: 1px solid #000;padding-bottom:65px;"> <img src="<?php echo base_url('admin_assets/assets/images/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" required></td> </tr> <tr> <td style=" padding-right:10px;"><b>Invoice: </b></td> <td><input type="text" style="width: 100px;" name="invoice" class="invoice" readonly></td> </tr> </table> </div> <div class="" style="clear:both !important;"></div> <div class="row_3"> <div class="" style="padding-bottom:10px;"> <p style="margin-bottom:5px;"><b>To,</b></p> <p style="margin-bottom:5px;"><input type="hidden" class="account_id" required> <input type="text" placeholder="Name" style="width: 100px;" name="name" id="name" class="name" required></p> <textarea rows="3" style="width:100%;" name="address" class="address"></textarea> </div> <p style="margin-bottom: 5px;">GSTN: <input type="text" style="width: 100px;" name="gstn" class="gstn" required></p> </div> <div class="row_4" style="padding: 10px 0px 30px;"> <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: 54%;padding: 5px;border: 1px solid #000;">DESCRIPTION</th> <th style="width: 16%;padding: 5px;border: 1px solid #000;">SAC</th> <th style="width: 20%;padding: 5px;border: 1px solid #000;">PRICE</th> </tr> <tr> <td style="padding: 5px;border: 1px solid #000;"><input type="text" style="width: 100px;" name="sino" class="sino" required></td> <td style="padding: 5px;border: 1px solid #000;"><textarea rows="10" style="width:100%;" name="description" class="description" required></textarea></td> <td style="padding: 5px;border: 1px solid #000;"><input type="text" style="width: 100px;" name="sac" class="sac" ></td> <td style="padding: 5px;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" name="price" id="total_price" class="total_price" onfocusout="price()" required></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2" style="border-bottom:initial;border-left:initial;"></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><b>Sub Total</b></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;">Rs. <input type="text" style="width: 100px;" class="sub_total" name="sub_total" required></td> </tr> <tr style="border-bottom: initial;border-color: transparent;"> <td colspan="2"></td> <td style="padding: 5px;text-align: right;border: 1px solid #000;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>CGST @</b> <select class="" onfocusout="cgst_percent()" 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;" class="cgst_amount" required></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;"><p style="display: inline-flex;margin-top:0px;margin-bottom:0px;"><b>SGST @</b> <select class="" style="width:50px;" onfocusout="sgst_percent()" 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" name="sgst_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" ></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" name="total_amount" ></td> </tr> </table> </div> <div class="row_5" > <table style="width:100%; color:#898989;"> <tr> <td>Company GSTN : 29BZLPS4657ILZG</td> <td></td> </tr> <tr> <td>Company Bank Details :</td> <td style="text-align:right;">For JAYBLUES TECHNOLOGIES</td> </tr> <tr> <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></td> </tr> <tr> <td>Account Type : Current Account</td> <td style="text-align:right;color:#000;">Authorized Signatory</td> </tr> <tr> <td>Account Number : 50200010784596</td> <td></td> </tr> <tr> <td>IFSC : HDFC0000065</td> <td></td> </tr> <tr> <td>Branch : Saraswathipuram</td> <td></td> </tr> </table> </div> <div class="row_6" > <p style="text-align:center;margin-bottom:5px;">Declaration: Payment mode will be in Cash, Cheques, NEFT or RTGS only. Make all cheques payable to [Jayblues, Mysore]</p> <h4 style="text-align: center;padding-bottom: 3px;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. : #205, S A Arcade, 3rd floor, 24th main, JP Nagar 5th phase, Bangalore - 560078<br> Ph: 9663933606, 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="update">Update</button> <button type="submit" style="background:blue;color:#fff;" id="update_invoice">Update and Print</button> </div> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <div class="footer"> <div class="footer-inner"> <div class="footer-content"> <span class="blue">All Right Reserved © 2017</span> <a href=""> Jay Blues Technologies</a> </div> </div> </div> <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"> <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i> </a> </div><!-- /.main-container --> <div class="modal fade" id="mailModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">Confirm Email</h4> </div> <form method="post" class="email_body"> <i class="fa fa-user fa-3x"></i> <select name="email_settings_id"> </select> <input type="hidden" class="invoice_id" name="invoice_id"> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2"> To</label> <input type="text" name="email_to[]" placeholder="email" class="email_to" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2"> CC</label> <input type="text" name="cc" value="ajay@jayblues.com,subramanya@jayblues.com" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2">Subject</label> <input type="text" name="subject" class="col-sm-8" placeholder="Subject" value="Invoice"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2"><b>Text</b></label> <textarea type="text" name="body" rows="4" class="col-sm-8" placeholder="Message"></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary submit">Send</button> </div> </form> </div> </div> </div> <div class="modal fade" id="msgModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Send Message</h4> </div> <form class="quote_msg" method="post"> <div class="modal-body"> <i class="fa fa-user fa-3x"></i> <select name="email_settings_id"> <input type="hidden" class="quotation_id" name="lead_id"> </select> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-3">Phone Number</label> <input type="text" name="phone_number" placeholder="phone number" class="phone_number" style="width: 230px; border-bottom: 1px solid #000;border-top:initial;border-right:initial; border-left:initial;"> </div> </div> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-2">Text</label> <textarea type="text" name="message_text" rows="4" class="col-sm-8" placeholder="message"></textarea> </div> </div> <!-- <input type="hidden" class="new_body" name="body"> --> <div class="row" style="text-align:center;padding-top:50px;"> <button type="submit" style="background:blue;color:#fff;" id="submit">Send</button> </div> </div> </form> </div> </div> </div> <div class="modal fade" id="closeModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">Close Invoice</h4> </div> <form method="post" class="colse"> <input type="hidden" class="invoice_id_new" name="invoice_id"> <div class="row row-form"> <div class="col-sm-12"> <label class="col-sm-3"><b>Choose Reason</b></label> <select name="reason" class="reason_new"> <?php $master=json_decode($master->field_value); foreach($master as $val) { ?> <option value="<?php echo $val;?>"><?php echo $val;?></option> <?php }?> </select> </div> <div class="col-sm-12 reason" style="display: none;"> <label class="col-sm-2"><b>Text</b></label> <textarea type="text" name="others" rows="4" class="col-sm-8" placeholder="Reason" ></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary update">Update</button> </div> </form> </div> </div> </div> <!-- Modal --> <div class="modal fade" id="description_modal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title" id="invoice_number_id"></h4> </div> <div class="modal-body" id="description_div"> </div> </div> </div> </div> <script src="<?php echo base_url('admin_assets/assets/datatables/jquery.dataTables.min.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/datatables/dataTables.bootstrap.min.js');?>"></script> <link rel="stylesheet" href="<?php echo base_url('admin_assets/assets/datatables/dataTables.bootstrap.css');?>"> <link rel="stylesheet" href="<?php echo base_url('admin_assets/css/datepicker3.css');?>" /> <!-- <script src="<?php echo base_url('admin_assets/assets/js/jquery-2.1.4.min.js'); ?>"></script> --> <!-- <script src="<?php echo base_url('admin_assets/assets/js/bootstrap.min.js'); ?>"></script> --> <!-- page specific plugin scripts --> <script src="<?php echo base_url('admin_assets/assets/js/tree.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/select2.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/jquery-ui.custom.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/jquery.ui.touch-punch.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/holder.min.js'); ?>"></script> <!-- ace scripts --> <script src="<?php echo base_url('admin_assets/assets/js/ace-elements.min.js'); ?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/ace.min.js'); ?>"></script> <!-- inline scripts related to this page --> <!--<link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">--> <script src="<?php echo base_url('admin_assets/assets/js/jquery-ui.js');?>"></script> <script src="<?php echo base_url('admin_assets/assets/js/jquery.table2excel.js');?>"></script> </body> </html> <script type="text/javascript"> $(".table td").hover(function() { //$(this).prop('title', $.trim($(this).text())); addclass(); }); function addclass(){ $('.table td').addClass("edit1"); } var datatable; var tbody = $('#table_body'); datatable = $('.table').DataTable({ }); </script> <script src="<?php echo base_url('admin_assets/event/assets/js/bootstrap-datepicker.js');?>"></script> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/jquery.jqGrid.min.js'); ?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. <!-- We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('jqgrid/js/i18n/grid.locale-en.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid.css'); ?>" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('jqgrid/css/ui.jqgrid-bootstrap.css'); ?>" /> <script type="text/javascript"> $(document).ready(function (){ jQuery("#list3").jqGrid({ url:"<?php echo site_url('view-invoice-list');?>", datatype: "json", //colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','GSTN','Description','Bill Amount','CGST%','CGST Amount','SGST%','SGST Amount','Total Amount','Status','Invoice Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','Description','Bill Amount','Total Amount','Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'name',index:'name', width:200, editable:false,formatter: function (cellvalue, options, rowObject) { if(rowObject.name!=''){ return "<a href='JavaScript:void(0);' style='color:blue;' onclick='fun_edit($(this));' id='"+rowObject.id+"'>"+rowObject.name+"</a>"; } }}, {name:'invoice_type',index:'invoice_type', hidden:true,width:200, editable:false}, {name:'invoice_no',index:'invoice_no',editrules:{}, width:200, formatter: function (cellvalue, options, rowObject) { if(rowObject.invoice_type=='Profomo'){ var invoice=rowObject.invoice_no; return invoice; }else{ var invoice=rowObject.invoice_no; return invoice; } }}, {name:'address',index:'address', width:100, editable:false}, {name:'invoice_date',index:'invoice_date', width:90, editable:false,formatter: 'date', formatoptions: { newformat: 'd-m-Y'} }, //{name:'gstn',index:'gstn', width:80, editable:false}, {name:'description',index:'description',editable:false,editrules:{}, width:90, formatter: function (cellvalue, options, rowObject) { if(rowObject.description){ var description=jQuery.parseJSON(rowObject.description); console.log(description); var retVal = ''; var showChar = 100; var moretext = "Read more..."; var ellipsestext = "..."; $.each(description, function(key, val){ var html = ""; var content = val; var textcontent = val; if (textcontent.length > showChar) { var c = textcontent.substr(0, showChar); //var h = content.substr(showChar-1, content.length - showChar); var html = c; // $(this).html(html); html +=" <a style='color:red;' id='"+rowObject.id+"' href='javascript:void(0);' class='morelink'>"+ moretext + "</a>"; retVal +=html; } else { retVal = val; } }); return retVal; } else{ return ''; } }}, {name:'total',index:'total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.total){var value=rowObject.total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, /*{name:'cgst',index:'cgst', width:100, editable:false}, {name:'cgst_amount',index:'cgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.cgst_amount){var value=rowObject.cgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'sgst',index:'sgst', width:100, editable:false}, {name:'sgst_amount',index:'sgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.sgst_amount){var value=rowObject.sgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}},*/ {name:'grand_total',index:'grand_total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.grand_total){var value=rowObject.grand_total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'status',index:'status', width:70, editable:false}, //{name:'invoice_status',index:'invoice_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:50,cellattr: function (rowId, tv, rawObject, cm, rdata) { //return ' onclick="fun_edit_print($(this))" '; return ' onclick="fun_print($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PRINT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:50,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:60,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PAYMENT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:50,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_mail_send(this.id)' type='button' id='"+rowObject.id+"'' value='SEND'\>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:80,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_message_send(this.id)' type='button' id='"+rowObject.id+"'' value='Send Message'\>"; }}, ], rowNum:20, rowList:[20,50,100,200,300], rownumbers: true, pager: '#pager3', sortname:'id', viewrecords: true, loadonce:true, gridview: true, sortorder:"desc", caption:"Invoice List", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); id=row_id; //alert(id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ //alert(id); url:"<?php echo site_url('view-invoice-payment');?>/"+id, mtype : "get", datatype: "json", colNames:['id','Name','Collected By','Payment Type','Amount','Cheque No','Cheque Date','DD No','DD Date','UTR No','Online Date','Bank Name','Branch Name','EDIT','DELETE'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'name',index:'name', width:200, editable:false}, {name:'collected_by',index:'collected_by', width:200, editable:false}, {name:'payment_type',index:'payment_type', width:150, editable:false}, {name:'paid_amount',index:'paid_amount', width:150, editable:false}, {name:'cheque_no',index:'cheque_no', width:140, editable:false}, {name:'cheque_date',index:'cheque_date', width:120, editable:false}, {name:'dd_no',index:'dd_no', width:140, editable:false}, {name:'dd_date',index:'dd_date', width:120, editable:false}, {name:'utr_no',index:'utr_no', width:140, editable:false}, {name:'online_date',index:'online_date', width:120,editable:false}, {name:'bank_name',index:'bank_name', width:200, editable:false}, {name:'branch_name',index:'branch_name', width:200, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list3").jqGrid("setLabel", "rn", "SL"); $("#list3").setGridParam({sortname:'Invoice Date', sortorder: 'desc'}) .trigger('reloadGrid'); $("#list3").jqGrid('filterToolbar',{searchOperators : false,stringResult: true, searchOnEnter: false, defaultSearch: "cn"}); $("#list3").jqGrid('navGrid','#pager3', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['cn', 'eq', 'ne', 'lt', 'gt', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); //Pending invoice list jQuery("#list4").jqGrid({ url:"<?php echo site_url('pending-invoice-list');?>", datatype: "json", // colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','GSTN','Description','Bill Amount','CGST%','CGST Amount','SGST%','SGST Amount','Total Amount','Status','Invoice Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','Description','Bill Amount','Total Amount','Status','EDIT','PRINT','CANCEL','DELETE','Add Payment','Send Mail','Send Message'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'name',index:'name', width:200, editable:false,formatter: function (cellvalue, options, rowObject) { if(rowObject.name!=''){ return "<a href='JavaScript:void(0);' style='color:blue;' onclick='fun_edit($(this));' id='"+rowObject.id+"'>"+rowObject.name+"</a>"; } }}, {name:'invoice_type',index:'invoice_type', hidden:true,width:200, editable:false}, {name:'invoice_no',index:'invoice_no',editrules:{}, width:200, formatter: function (cellvalue, options, rowObject) { if(rowObject.invoice_type=='Profomo'){ var invoice=rowObject.invoice_no; return invoice; }else{ var invoice=rowObject.invoice_no; return invoice; } }}, {name:'address',index:'address', width:100, editable:false}, {name:'invoice_date',index:'invoice_date', width:90,sorttype: "date", editable:false,formatter: 'date', formatoptions: { newformat: 'd-m-Y'}}, //{name:'gstn',index:'gstn', width:50, editable:false}, {name:'description',index:'description',editable:false,editrules:{}, width:90, formatter: function (cellvalue, options, rowObject) { if(rowObject.description){ var description=jQuery.parseJSON(rowObject.description); console.log(description); var retVal = ''; var showChar = 100; var moretext = "Read more..."; var ellipsestext = "..."; $.each(description, function(key, val){ var html = ""; var content = val; var textcontent = val; if (textcontent.length > showChar) { var c = textcontent.substr(0, showChar); //var h = content.substr(showChar-1, content.length - showChar); var html = c; // $(this).html(html); html +=" <a style='color:red;' id='"+rowObject.id+"' href='javascript:void(0);' class='morelink'>"+ moretext + "</a>"; retVal +=html; } else { retVal = val; } }); return retVal; } else{ return ''; } }}, {name:'total',index:'total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.total){var value=rowObject.total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, //{name:'cgst',index:'cgst', width:100, editable:false}, /*{name:'cgst_amount',index:'cgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.cgst_amount){var value=rowObject.cgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}},*/ //{name:'sgst',index:'sgst', width:100, editable:false}, /* {name:'sgst_amount',index:'sgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.sgst_amount){var value=rowObject.sgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}},*/ {name:'grand_total',index:'grand_total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.grand_total){var value=rowObject.grand_total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'status',index:'status', width:70, editable:false}, //{name:'invoice_status',index:'invoice_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:50,cellattr: function (rowId, tv, rawObject, cm, rdata) { //return ' onclick="fun_edit_print($(this))" '; return ' onclick="fun_print($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PRINT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'cancel',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:60,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_cancel($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='CANCEL' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:60,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:70,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PAYMENT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:50,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_mail_send(this.id)' type='button' id='"+rowObject.id+"'' value='SEND'\>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:80,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_message_send(this.id)' type='button' id='"+rowObject.id+"'' value='Send Message'\>"; }}, ], rowNum:20, rowList:[20,50,100,200,300], rownumbers: true, pager: '#pager4', sortname:'id', viewrecords: true, loadonce:true, gridview: true, sortable: true, loadonce: true, caption:"Pending Invoice List", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); id=row_id; //alert(id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ //alert(id); url:"<?php echo site_url('view-invoice-payment');?>/"+id, mtype : "get", datatype: "json", colNames:['id','Name','Collected By','Payment Type','Amount','Cheque No','Cheque Date','DD No','DD Date','UTR No','Online Date','Bank Name','Branch Name','EDIT','DELETE'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'name',index:'name', width:200, editable:false}, {name:'collected_by',index:'collected_by', width:200, editable:false}, {name:'payment_type',index:'payment_type', width:150, editable:false}, {name:'paid_amount',index:'paid_amount', width:150, editable:false}, {name:'cheque_no',index:'cheque_no', width:140, editable:false}, {name:'cheque_date',index:'cheque_date', width:120, editable:false}, {name:'dd_no',index:'dd_no', width:140, editable:false}, {name:'dd_date',index:'dd_date', width:120, editable:false}, {name:'utr_no',index:'utr_no', width:140, editable:false}, {name:'online_date',index:'online_date', width:120,editable:false}, {name:'bank_name',index:'bank_name', width:200, editable:false}, {name:'branch_name',index:'branch_name', width:200, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list4").jqGrid("setLabel", "rn", "SL"); $("#list4").jqGrid('filterToolbar',{searchOperators : false,stringResult: true, searchOnEnter: false, defaultSearch: "cn"}); $("#list4").jqGrid('navGrid','#pager4', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['cn', 'eq', 'ne', 'lt', 'gt', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); //----------------------------------------------------------------------------------------------// jQuery("#list6").jqGrid({ url:"<?php echo site_url('cancelled-invoice-list');?>", datatype: "json", // colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','GSTN','Description','Bill Amount','CGST%','CGST Amount','SGST%','SGST Amount','Total Amount','Status','Invoice Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','Description','Bill Amount','Total Amount','Status','Invoice status'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'name',index:'name', width:200, editable:false,formatter: function (cellvalue, options, rowObject) { if(rowObject.name!=''){ return "<a href='JavaScript:void(0);' style='color:blue;' onclick='fun_edit($(this));' id='"+rowObject.id+"'>"+rowObject.name+"</a>"; } }}, {name:'invoice_type',index:'invoice_type', hidden:true,width:200, editable:false}, {name:'invoice_no',index:'invoice_no',editrules:{}, width:200, formatter: function (cellvalue, options, rowObject) { if(rowObject.invoice_type=='Profomo'){ var invoice=rowObject.invoice_no; return invoice; }else{ var invoice=rowObject.invoice_no; return invoice; } }}, {name:'address',index:'address', width:100, editable:false}, {name:'invoice_date',index:'invoice_date', width:90,sorttype: "date", editable:false,}, //{name:'gstn',index:'gstn', width:50, editable:false}, {name:'description',index:'description',editable:false,editrules:{}, width:90, formatter: function (cellvalue, options, rowObject) { if(rowObject.description){ var description=jQuery.parseJSON(rowObject.description); console.log(description); var retVal = ''; var showChar = 100; var moretext = "Read more..."; var ellipsestext = "..."; $.each(description, function(key, val){ var html = ""; var content = val; var textcontent = val; if (textcontent.length > showChar) { var c = textcontent.substr(0, showChar); //var h = content.substr(showChar-1, content.length - showChar); var html = c; // $(this).html(html); html +=" <a style='color:red;' id='"+rowObject.id+"' href='javascript:void(0);' class='morelink'>"+ moretext + "</a>"; retVal +=html; } else { retVal = val; } }); return retVal; } else{ return ''; } }}, {name:'total',index:'total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.total){var value=rowObject.total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'grand_total',index:'grand_total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.grand_total){var value=rowObject.grand_total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'status',index:'status', width:70, editable:false}, {name:'invoice_status',index:'invoice_status', width:100, editable:false}, ], rowNum:20, rowList:[20,50,100,200,300], rownumbers: true, pager: '#pager6', sortname:'id', viewrecords: true, loadonce:true, gridview: true, sortable: true, loadonce: true, caption:"Cancelled Invoice List", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); id=row_id; //alert(id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ //alert(id); url:"<?php echo site_url('view-invoice-payment');?>/"+id, mtype : "get", datatype: "json", colNames:['id','Name','Collected By','Payment Type','Amount','Cheque No','Cheque Date','DD No','DD Date','UTR No','Online Date','Bank Name','Branch Name','EDIT','DELETE'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'name',index:'name', width:200, editable:false}, {name:'collected_by',index:'collected_by', width:200, editable:false}, {name:'payment_type',index:'payment_type', width:150, editable:false}, {name:'paid_amount',index:'paid_amount', width:150, editable:false}, {name:'cheque_no',index:'cheque_no', width:140, editable:false}, {name:'cheque_date',index:'cheque_date', width:120, editable:false}, {name:'dd_no',index:'dd_no', width:140, editable:false}, {name:'dd_date',index:'dd_date', width:120, editable:false}, {name:'utr_no',index:'utr_no', width:140, editable:false}, {name:'online_date',index:'online_date', width:120,editable:false}, {name:'bank_name',index:'bank_name', width:200, editable:false}, {name:'branch_name',index:'branch_name', width:200, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list6").jqGrid("setLabel", "rn", "SL"); $("#list6").jqGrid('filterToolbar',{searchOperators : false,stringResult: true, searchOnEnter: false, defaultSearch: "cn"}); $("#list6").jqGrid('navGrid','#pager6', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['cn', 'eq', 'ne', 'lt', 'gt', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); //----------------------------------------------------------------------------------------------// //Cleared invoice list jQuery("#list5").jqGrid({ url:"<?php echo site_url('cleared-invoice-list');?>", datatype: "json", //colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','GSTN','Description','Bill Amount','CGST%','CGST Amount','SGST%','SGST Amount','Total Amount','Status','Invoice Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','Description','Bill Amount','Total Amount','Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'name',index:'name', width:200, editable:false,formatter: function (cellvalue, options, rowObject) { if(rowObject.name!=''){ return "<a href='JavaScript:void(0);' style='color:blue;' onclick='fun_edit($(this));' id='"+rowObject.id+"'>"+rowObject.name+"</a>"; } }}, {name:'invoice_type',index:'invoice_type', hidden:true,width:200, editable:false}, {name:'invoice_no',index:'invoice_no',editrules:{}, width:200, formatter: function (cellvalue, options, rowObject) { if(rowObject.invoice_type=='Profomo'){ var invoice=rowObject.invoice_no; return invoice; }else{ var invoice=rowObject.invoice_no; return invoice; } }}, {name:'address',index:'address', width:100, editable:false}, {name:'invoice_date',index:'invoice_date', width:90, editable:false,formatter: 'date', formatoptions: { newformat: 'd-m-Y'} }, //{name:'gstn',index:'gstn', width:80, editable:false}, {name:'description',index:'description',editable:false,editrules:{}, width:90, formatter: function (cellvalue, options, rowObject) { if(rowObject.description){ var description=jQuery.parseJSON(rowObject.description); console.log(description); var retVal = ''; var showChar = 100; var moretext = "Read more..."; var ellipsestext = "..."; $.each(description, function(key, val){ var html = ""; var content = val; var textcontent = val; if (textcontent.length > showChar) { var c = textcontent.substr(0, showChar); //var h = content.substr(showChar-1, content.length - showChar); var html = c; // $(this).html(html); html +=" <a style='color:red;' id='"+rowObject.id+"' href='javascript:void(0);' class='morelink'>"+ moretext + "</a>"; retVal +=html; } else { retVal = val; } }); return retVal; } else{ return ''; } }}, {name:'total',index:'total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.total){var value=rowObject.total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, /*{name:'cgst',index:'cgst', width:100, editable:false}, {name:'cgst_amount',index:'cgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.cgst_amount){var value=rowObject.cgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'sgst',index:'sgst', width:100, editable:false}, {name:'sgst_amount',index:'sgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.sgst_amount){var value=rowObject.sgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}},*/ {name:'grand_total',index:'grand_total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.grand_total){var value=rowObject.grand_total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'status',index:'status', width:70, editable:false}, //{name:'invoice_status',index:'invoice_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:50,cellattr: function (rowId, tv, rawObject, cm, rdata) { //return ' onclick="fun_edit_print($(this))" '; return ' onclick="fun_print($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PRINT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:60,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:60,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PAYMENT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:50,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_mail_send(this.id)' type='button' id='"+rowObject.id+"'' value='SEND'\>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:70,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_message_send(this.id)' type='button' id='"+rowObject.id+"'' value='Send Message'\>"; }}, ], rowNum:20, rowList:[20,50,100,200,300], rownumbers: true, pager: '#pager5', sortname:'id', viewrecords: true, loadonce:true, gridview: true, sortorder:"desc", caption:"Cleared Invoice List", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); id=row_id; //alert(id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ //alert(id); url:"<?php echo site_url('view-invoice-payment');?>/"+id, mtype : "get", datatype: "json", colNames:['id','Name','Collected By','Payment Type','Amount','Cheque No','Cheque Date','DD No','DD Date','UTR No','Online Date','Bank Name','Branch Name','EDIT','DELETE'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'name',index:'name', width:200, editable:false}, {name:'collected_by',index:'collected_by', width:200, editable:false}, {name:'payment_type',index:'payment_type', width:150, editable:false}, {name:'paid_amount',index:'paid_amount', width:150, editable:false}, {name:'cheque_no',index:'cheque_no', width:140, editable:false}, {name:'cheque_date',index:'cheque_date', width:120, editable:false}, {name:'dd_no',index:'dd_no', width:140, editable:false}, {name:'dd_date',index:'dd_date', width:120, editable:false}, {name:'utr_no',index:'utr_no', width:140, editable:false}, {name:'online_date',index:'online_date', width:120,editable:false}, {name:'bank_name',index:'bank_name', width:200, editable:false}, {name:'branch_name',index:'branch_name', width:200, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list5").jqGrid("setLabel", "rn", "SL"); $("#list5").jqGrid('filterToolbar',{searchOperators : false,stringResult: true, searchOnEnter: false, defaultSearch: "cn"}); $("#list5").jqGrid('navGrid','#pager5', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['cn', 'eq', 'ne', 'lt', 'gt', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); //Partial paid invoice list jQuery("#list_new").jqGrid({ url:"<?php echo site_url('partial-invoice-list');?>", datatype: "json", //colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','GSTN','Description','Bill Amount','CGST%','CGST Amount','SGST%','SGST Amount','Total Amount','Status','Invoice Status','EDIT','Close','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','Description','Bill Amount','Total Amount','Status','EDIT','Close','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'name',index:'name', width:200, editable:false,formatter: function (cellvalue, options, rowObject) { if(rowObject.name!=''){ return "<a href='JavaScript:void(0);' style='color:blue;' onclick='fun_edit($(this));' id='"+rowObject.id+"'>"+rowObject.name+"</a>"; } }}, {name:'invoice_type',index:'invoice_type', hidden:true,width:200, editable:false}, {name:'invoice_no',index:'invoice_no',editrules:{}, width:200, formatter: function (cellvalue, options, rowObject) { if(rowObject.invoice_type=='Profomo'){ var invoice=rowObject.invoice_no; return invoice; }else{ var invoice=rowObject.invoice_no; return invoice; } }}, {name:'address',index:'address', width:100, editable:false}, {name:'invoice_date',index:'invoice_date', width:90, editable:false, formatter: 'date', formatoptions: { newformat: 'd-m-Y'}}, //{name:'gstn',index:'gstn', width:80, editable:false}, {name:'description',index:'description',editable:false,editrules:{}, width:90, formatter: function (cellvalue, options, rowObject) { if(rowObject.description){ var description=jQuery.parseJSON(rowObject.description); console.log(description); var retVal = ''; var showChar = 100; var moretext = "Read more..."; var ellipsestext = "..."; $.each(description, function(key, val){ var html = ""; var content = val; var textcontent = val; if (textcontent.length > showChar) { var c = textcontent.substr(0, showChar); //var h = content.substr(showChar-1, content.length - showChar); var html = c; // $(this).html(html); html +=" <a style='color:red;' id='"+rowObject.id+"' href='javascript:void(0);' class='morelink'>"+ moretext + "</a>"; retVal +=html; } else { retVal = val; } }); return retVal; } else{ return ''; } }}, {name:'total',index:'total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.total){var value=rowObject.total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, /*{name:'cgst',index:'cgst', width:100, editable:false}, {name:'cgst_amount',index:'cgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.cgst_amount){var value=rowObject.cgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'sgst',index:'sgst', width:100, editable:false}, {name:'sgst_amount',index:'sgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.sgst_amount){var value=rowObject.sgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}},*/ {name:'grand_total',index:'grand_total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.grand_total){var value=rowObject.grand_total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'status',index:'status', width:60, editable:false}, //{name:'invoice_status',index:'invoice_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_close($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='Close' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { //return ' onclick="fun_edit_print($(this))" '; return ' onclick="fun_print($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PRINT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:50,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:70,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PAYMENT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:40,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_mail_send(this.id)' type='button' id='"+rowObject.id+"'' value='SEND'\>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:80,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_message_send(this.id)' type='button' id='"+rowObject.id+"'' value='Send Message'\>"; }}, ], rowNum:20, rowList:[20,50,100,200,300], rownumbers: true, pager: '#pager6', sortname:'id', viewrecords: true, loadonce:true, gridview: true, sortorder:"desc", caption:"Partial paid Invoice List", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); id=row_id; //alert(id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ //alert(id); url:"<?php echo site_url('view-invoice-payment');?>/"+id, mtype : "get", datatype: "json", colNames:['id','Name','Collected By','Payment Type','Amount','Cheque No','Cheque Date','DD No','DD Date','UTR No','Online Date','Bank Name','Branch Name','EDIT','DELETE'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'name',index:'name', width:200, editable:false}, {name:'collected_by',index:'collected_by', width:200, editable:false}, {name:'payment_type',index:'payment_type', width:150, editable:false}, {name:'paid_amount',index:'paid_amount', width:150, editable:false}, {name:'cheque_no',index:'cheque_no', width:140, editable:false}, {name:'cheque_date',index:'cheque_date', width:120, editable:false}, {name:'dd_no',index:'dd_no', width:140, editable:false}, {name:'dd_date',index:'dd_date', width:120, editable:false}, {name:'utr_no',index:'utr_no', width:140, editable:false}, {name:'online_date',index:'online_date', width:120,editable:false}, {name:'bank_name',index:'bank_name', width:200, editable:false}, {name:'branch_name',index:'branch_name', width:200, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list_new").jqGrid("setLabel", "rn", "SL"); $("#list_new").jqGrid('filterToolbar',{searchOperators : false,stringResult: true, searchOnEnter: false, defaultSearch: "cn"}); $("#list_new").jqGrid('navGrid','#pager6', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['cn', 'eq', 'ne', 'lt', 'gt', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); }); function fun_close(rowId){ var id = rowId.closest('tr').attr('id'); $('.invoice_id_new').val(id); $('#closeModel').modal('show'); } $('.colse').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".update").attr('disabled', 'disabled'); $(".update").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("yaskawa/update_invoice")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('#closeModel').modal('hide'); $("#list_new").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); location.reload(); $(".update").text("Submit"); $(".update").removeAttr('disabled'); toastr["success"](response.message); } else { // $('.update')[0].reset(); $(".update").text("Submit"); $(".update").removeAttr('disabled'); toastr["error"](response.message); } } }); }); //setInterval(Status_change, 4000); function Status_change(){ $.ajax({ url:"<?php echo site_url("invoice-status-change")?>", type:"GET", success:function(response) { response=jQuery.parseJSON(response); console.log(response); } }); } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var id = id; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("delete-invoice")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_cancel(rowId) { var id = rowId.closest('tr').attr('id'); var id = id; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, cancel it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("cancel-invoice")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); $("#list4").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_pay(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url("payment")?>", type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response.result==1) { window.location.href = "<?php echo site_url('invoice-payment');?>/"+id; } else { toastr["error"](response.message); } } }); } function fun_delete_pay(rowId) { var id = rowId.closest('tr').attr('id'); var id = id; swal({ title: "Are you sure?", text: "You will not be able to recover this data!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, delete it!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ url:"<?php echo site_url("delete-payment")?>", type:"POST", data:{id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_edit_pay(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url("edit-invoice-payment")?>/"+id, type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response.result==1) { window.location.href = '<?php echo site_url('edit-invoice-payments');?>/'+id; } } }); } function fun_edit(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url("edit-invoice")?>", type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response.result==1) { window.location.href = '<?php echo site_url('edit-invoice-disp');?>/'+id; } } }); } function fun_print(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url("edit-invoice")?>", type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response.result==1) { window.location.href = '<?php echo site_url('print-invoice-disp');?>/'+id; } } }); } function fun_edit_print(rowId) { var id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url("edit-invoice")?>", type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response.result==1) { window.location.href = '<?php echo site_url('print-invoice');?>/'+id; } } }); } function fun_mail_send(id) { $('.invoice_id').val(id); $.ajax({ url:"<?php echo site_url("yaskawa/get_invoice_email")?>", type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response) { $('.email_to').val(response.email_id); } } }); $('#mailModel').modal('show'); } function fun_message_send(id) { $('.invoice_id').val(id); $.ajax({ url:"<?php echo site_url("yaskawa/get_invoice_email")?>", type:"POST", data:{'id':id}, success:function(data) { response=jQuery.parseJSON(data); console.log(response); if(response) { $('.phone_number').val(''); $('.phone_number').val(response.phone); } } }); $('#msgModal').modal('show'); } $('.quote_msg').submit(function(e){ e.preventDefault(); //$('#submit'). $("#submit").attr('disabled', 'disabled'); $("#submit").text("Sending..."); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("yaskawa/send_quotation_message")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result=='1') { toastr['success'](response.message); $("#submit").text("Sending"); $("#submit").removeAttr('disabled'); $('.quote_msg')[0].reset(); $("#msgModal").modal('hide'); //location.reload(); } else { toastr['error']('Something went wrong'); $("#submit").text("Sending"); $("#submit").removeAttr('disabled'); } } }); }); $('.email_body').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Submitting..."); $.ajax({ type : 'post', url : '<?php echo site_url("send_invoice_mail")?>', data : formdata, dataType: 'json', contentType: false, processData: false, success:function(response){ //response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('#mailModel').modal('hide'); $('.email_body')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); toastr["success"](response.message); } else { $('.email_body')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); toastr["error"](response.message); } } }); }); $('#import_employee').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("import-employees")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { alert("Imported Successfully"); location.reload(); } else { alert("Something went wrong..try again"); //$(".lead_submit").text("Submit"); //$(".lead_submit").removeAttr('disabled'); } } }); }); $(document).on("click", ".delete_invoice", function(){ var id = $(this).attr('id'); var test = $(this); var row = $(this).closest('tr'); $.ajax({ type : 'post', url : '<?php echo site_url("delete-invoice")?>', data : {id:id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { alert("Deleted Successfully"); location.reload(); } else { alert("Something went wrong"); } } }); }); $(document).on('click','.morelink',function(){ var id = $(this).attr('id'); $.ajax({ type : 'post', url : '<?php echo site_url("get-more-invoice-description")?>', data : {id:id}, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var description=jQuery.parseJSON(response.details.description); console.log(description); var retVal = ''; $.each(description, function(key, val){ retVal +=val; }); $("#invoice_number_id").html('<p>Invoice Description - '+response.details.invoice_no+'</p>'); $("#description_div").html('<pre>'+retVal+'</pre>'); $("#description_modal").modal('show'); } else { $("#description_div").empty(); } } }); }); </script> <script type="text/javascript"> $("#employee_export").click(function(){ //alert(); $(".employee_list").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "employee-list", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); }); </script> <style type="text/css"> .datepicker{ z-index: 9999 !important; } #treeview-searchable .node-disabled { display: none; } .hoverr:hover .addd { display:block; } .addd{ display:none; } .add_more { padding: 0px 7px !important; font-size: 12px !important; } #block{display:none;padding-left:10px;} .pd-7{ padding-right:7px !important; padding-left:7px !important; } .pd-9{ padding:2px 9px !important; } #jaytab3 { width: 100% !important; overflow-x: scroll; } #jaytab4c { width: 100% !important; overflow-x: scroll; } #jaytab5p { width: 100% !important; overflow-x: scroll; } #jaytab6pp { width: 100% !important; overflow-x: scroll; } .ui-jqdialog .ui-jqdialog-titlebar { height: 29px !important; background-color: #001a00; color: white; padding-left: 10px; } .fm-button { height: 21px !important; padding: 1px; margin-right: 10px !important; height: 21px !important; width: 50%; margin-top: -7px !important; } .ui-jqdialog-content td.navButton { padding-top: 12px !important; } .ui-jqgrid .ui-jqgrid-titlebar { height: 7px !important; background:steelblue !important; color:white !important; } .ui-jqgrid-bdiv { height: auto !important; } .ui-widget-overlay { z-index:0 !important; } .ui-widget-header { background: #1e7ad7 !important; } .ui-jqgrid-hdiv ui-state-default { //width: 873px !important; cursor: default!important } ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight { border: 1px solid #fed22f; background: #ffe45c; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { font-weight: bold; color: black; } .ui-jqgrid { //width: 988px !important; overflow-x: scroll !important; } @media only screen and (min-width:641px) and (max-width:991px){ .ui-jqgrid{ } #jaytab3{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: hidden; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } #jaytab4c{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: hidden; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } #jaytab5p{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: hidden; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } #jaytab6pp{ margin-top: 0 !important; margin-left: 0 !important; //overflow-x: hidden; width: 100% !important; padding-left:0 !important; padding-right:9px !important; } } @media only screen and (min-width:320px) and (max-width:641px){ .ui-jqgrid{ } </style> <script> $(".col1").click(function(){ var text = $(this).val(); var test = $(this); if($(this).is(':checked')) { $("#column_id").append('<th>'+text+'</th>'); } else { $(".column_id").empty(); $('input[name="columns[]"]:checked').each(function() { console.log(this.value); $(".column_id").append('<th>'+this.value+'</th>'); }); } }); $('.inv_st').change(function(e){ e.preventDefault(); if($("input[type=radio][name=status]:checked" ).val()=='All'){ $('#addele_more1').css('display','none'); $('#addele_more2').css('display','none'); $('#addele_more3').css('display','none'); $('#addele_more7').css('display','none'); $('#addele_more6').css('display','none'); $('#addele_more').show(); } else if($("input[type=radio][name=status]:checked" ).val()=='CLEARED'){ $('#addele_more').css('display','none'); $('#addele_more1').css('display','none'); $('#addele_more7').css('display','none'); $('#addele_more6').css('display','none'); $('#addele_more3').hide(); $('#addele_more2').show(); } else if($("input[type=radio][name=status]:checked" ).val()=='PARTIAL'){ $('#addele_more').css('display','none'); $('#addele_more1').css('display','none'); $('#addele_more2').css('display','none'); $('#addele_more7').css('display','none'); $('#addele_more6').css('display','none'); $('#addele_more3').show(); } else if($("input[type=radio][name=status]:checked" ).val()=='PENDING'){ $('#addele_more').css('display','none'); $('#addele_more3').css('display','none'); $('#addele_more2').css('display','none'); $('#addele_more7').css('display','none'); $('#addele_more6').css('display','none'); $('#addele_more1').show(); } else if($("input[type=radio][name=status]:checked" ).val()=='CANCELLED'){ $('#addele_more').css('display','none'); $('#addele_more3').css('display','none'); $('#addele_more2').css('display','none'); $('#addele_more7').css('display','none'); $('#addele_more1').css('display','none'); $('#addele_more6').show(); } }); $('.reason_new').change(function(e){ e.preventDefault(); if($(this).val()=='Others') { $('.reason').show(); }else{ $('.reason').hide(); } }); $('.inv_pay').click(function(e){ e.preventDefault(); $.ajax({ type : 'post', url : '<?php echo site_url("yaskawa/update_invoice_status")?>', success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response) { alert("Added Successfully"); } else { alert("Something went wrong..Try again"); } } }); }); $(document).ready(function(){ $('.emp_submit').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ type : 'post', url : '<?php echo site_url("add-new-employee")?>', data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); //console.log(response); if(response.result == 1) { window.location.href = '<?php echo site_url('yaskawa/employees_list');?>'; toastr["success"](response.message); // $('.emp_submit')[0].reset(); // //$(".lead_submit").text("Submit"); // //$(".lead_submit").removeAttr('disabled'); } // else if(response.result == 2) // { // toastr["error"](response.message); // //$(".lead_submit").text("Submit"); // //$(".lead_submit").removeAttr('disabled'); // } // else // { // toastr["error"](response.message); // //$(".lead_submit").text("Submit"); // //$(".lead_submit").removeAttr('disabled'); // } } }); }); }); function search_invoice() { var status = $('input[name=status]:checked').val(); var fields = ''; fields +='<div id="jaytab7pp" style="margin-top:2%;">'; fields +='<div class="grid_div"></div>'; fields +='<table id="list7">'; fields +='</table>'; fields +='<div id="pager7"></div>'; fields +='<div id="dialogSelectRow6" title="Warning" style="display:none;">'; fields +='<p>Please select row</p>'; fields +='</div>'; fields +='</div>'; $('input[name=status]').attr('checked', false); $('#addele_more7').html(fields); $('#addele_more').css('display','none'); $('#addele_more2').css('display','none'); $('#addele_more1').css('display','none'); $('#addele_more3').css('display','none'); $('#addele_more3').hide(); $('#addele_more7').show(); var date = $('#search_invoice_date').val(); jQuery("#list7").jqGrid({ url:"<?php echo site_url('yaskawa/search_invoice_date');?>/"+date+'/'+status, datatype: "json", //colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','GSTN','Description','Bill Amount','CGST%','CGST Amount','SGST%','SGST Amount','Total Amount','Status','Invoice Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colNames:['id','Invoice Name','invoice type','Invoice Number','Address','Invoice Date','Description','Bill Amount','Total Amount','Status','EDIT','PRINT','DELETE','Add Payment','Send Mail','Send Message'], colModel:[ {name:'id',index:'id', hidden:true,width:100,editable:false,}, {name:'name',index:'name', width:200, editable:false,formatter: function (cellvalue, options, rowObject) { if(rowObject.name!=''){ return "<a href='JavaScript:void(0);' style='color:blue;' onclick='fun_edit($(this));' id='"+rowObject.id+"'>"+rowObject.name+"</a>"; } }}, {name:'invoice_type',index:'invoice_type', hidden:true,width:200, editable:false}, {name:'invoice_no',index:'invoice_no',editrules:{}, width:200, formatter: function (cellvalue, options, rowObject) { if(rowObject.invoice_type=='Profomo'){ var invoice=rowObject.invoice_no; return invoice; }else{ var invoice=rowObject.invoice_no; return invoice; } }}, {name:'address',index:'address', width:100, editable:false}, {name:'invoice_date',index:'invoice_date', width:90, editable:false,}, //{name:'gstn',index:'gstn', width:80, editable:false}, {name:'description',index:'description',editable:false,editrules:{}, width:90, formatter: function (cellvalue, options, rowObject) { if(rowObject.description){ var description=jQuery.parseJSON(rowObject.description); console.log(description); var retVal = ''; $.each(description, function(key, val){ retVal +=val; }); return retVal; } else{ return ''; } }}, {name:'total',index:'total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.total){var value=rowObject.total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, /*{name:'cgst',index:'cgst', width:100, editable:false}, {name:'cgst_amount',index:'cgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.cgst_amount){var value=rowObject.cgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'sgst',index:'sgst', width:100, editable:false}, {name:'sgst_amount',index:'sgst_amount',editable:true,editrules:{} , width:70,formatter: function (cellvalue, options, rowObject) { if(rowObject.sgst_amount){var value=rowObject.sgst_amount; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}},*/ {name:'grand_total',index:'grand_total',editable:true,editrules:{} , width:80,formatter: function (cellvalue, options, rowObject) { if(rowObject.grand_total){var value=rowObject.grand_total; var value=value.replace(/,/g , ''); x=value.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; return res; } else{ var res = ''; return res; }}}, {name:'status',index:'status', width:100, editable:false}, // {name:'invoice_status',index:'invoice_status', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:40,cellattr: function (rowId, tv, rawObject, cm, rdata) { //return ' onclick="fun_edit_print($(this))" '; return ' onclick="fun_edit($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PRINT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:50,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:60,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PAYMENT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:50,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_mail_send(this.id)' type='button' id='"+rowObject.id+"'' value='SEND'\>"; }}, {name:'id',index:'id',editable:false,align: "center",search:false,editrules:{required: true}, width:80,formatter:function (cellvalue, options, rowObject) { return "<input onclick='fun_message_send(this.id)' type='button' id='"+rowObject.id+"'' value='Send Message'\>"; }}, ], rowNum:20, rowList:[20,50,100,200,300], rownumbers: true, pager: '#pager7', sortname:'id', viewrecords: true, loadonce:true, gridview: true, sortorder:"desc", caption:"Invoice List", subGrid: true, subGridRowExpanded: function(subgrid_id, row_id) { var subgrid_table_id; //alert(row_id); id=row_id; //alert(id); subgrid_table_id = subgrid_id+"_t"; jQuery("#"+subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table>"); jQuery("#"+subgrid_table_id).jqGrid({ //alert(id); url:"<?php echo site_url('yaskawa/view_invoice_search_payment');?>/"+id+"/"+date, mtype : "get", datatype: "json", colNames:['id','Name','Collected By','Payment Type','Amount','Cheque No','Cheque Date','DD No','DD Date','UTR No','Online Date','Bank Name','Branch Name','EDIT','DELETE'], colModel:[ {name:'id',index:'id', width:50, hidden:true,editable:false,key:true}, {name:'name',index:'name', width:200, editable:false}, {name:'payment_type',index:'payment_type', width:150, editable:false}, {name:'paid_amount',index:'paid_amount', width:150, editable:false}, {name:'collected_by',index:'collected_by', width:200, editable:false}, {name:'cheque_no',index:'cheque_no', width:140, editable:false}, {name:'cheque_date',index:'cheque_date', width:120, editable:false}, {name:'dd_no',index:'dd_no', width:140, editable:false}, {name:'dd_date',index:'dd_date', width:120, editable:false}, {name:'utr_no',index:'utr_no', width:140, editable:false}, {name:'online_date',index:'online_date', width:120,editable:false}, {name:'bank_name',index:'bank_name', width:200, editable:false}, {name:'branch_name',index:'branch_name', width:200, editable:false}, {name:' ',index:' ',editable:false,align: "center",search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_edit_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,search:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete_pay($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], height: 'auto', rowNum:20, sortname: 'num', sortorder: "asc" }); } }); $("#list7").jqGrid("setLabel", "rn", "SL"); $("#list7").setGridParam({sortname:'Invoice Date', sortorder: 'desc'}) .trigger('reloadGrid'); $("#list7").jqGrid('filterToolbar',{searchOperators : false,stringResult: true, searchOnEnter: false, defaultSearch: "cn"}); $("#list7").jqGrid('navGrid','#pager7', {edit:false,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['cn', 'eq', 'ne', 'lt', 'gt', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ); } </script> <script> $('#cbxShowHide').click(function(){ this.checked?$('#block').show():$('#block').hide(); }); $('#search_invoice_date').datepicker({ format: "dd-mm-yyyy", }).on('changeDate', function(ev){ $('#search_invoice_date').datepicker('hide'); }); </script> <style type="text/css" media="screen"> th.ui-th-column div{ white-space:normal !important; height:auto !important; padding:2px; } </style>