EVOLUTION-NINJA
Edit File: billing_reports-28-12-19.php
<script src="<?php echo base_url('assets/js/jquery.table2excel.js');?>"></script> <script src="<?php echo base_url('assets/js/jspdf.debug.js');?>"></script> <script src="<?php echo base_url('assets/js/jspdf.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/shim.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/xlsx.full.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/Blob.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/FileSaver.js');?>"></script> <script> function country_wise() { var from_delivery_date_required_on =$('#from_delivery_date_required_on').val(); var to_delivery_date_required_on =$('#to_delivery_date_required_on').val(); $.ajax({ url:"<?php echo base_url('reports/billing_insert_data');?>", type:"POST", data:{'from_delivery_date_required_on':from_delivery_date_required_on,'to_delivery_date_required_on':to_delivery_date_required_on}, async:false, success:function(data) { window.location.href = '<?php echo base_url('reports/country_wise_preview');?>'; } }); } function customer_rank() { var from_delivery_date_required_on =$('#from_delivery_date_required_on').val(); var to_delivery_date_required_on =$('#to_delivery_date_required_on').val(); $.ajax({ url:"<?php echo base_url('reports/billing_insert_data');?>", type:"POST", data:{'from_delivery_date_required_on':from_delivery_date_required_on,'to_delivery_date_required_on':to_delivery_date_required_on}, async:false, success:function(data) { window.location.href = '<?php echo base_url('reports/customer_wise_preview');?>'; } }); } function billing_yarn() { var from_delivery_date_required_on =$('#from_delivery_date_required_on').val(); var to_delivery_date_required_on =$('#to_delivery_date_required_on').val(); $.ajax({ url:"<?php echo base_url('reports/billing_insert_data');?>", type:"POST", data:{'from_delivery_date_required_on':from_delivery_date_required_on,'to_delivery_date_required_on':to_delivery_date_required_on}, async:false, success:function(data) { window.location.href = '<?php echo base_url('reports/billing_rank_preview');?>'; } }); } </script> <style> .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } .ui-jqgrid tr.jqgrow td{ text-transform: uppercase !important; } </style> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <h3 class="page-title"> Billing Details </h3> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="https://swansilk.co/dashboard/dashboard_fun">Home</a> <i class="fa fa-angle-right"></i> <a href="#" > Billing Details </a></li> </ul> </div> <div class="row date_row"> <form > <div class="col-md-3"> <div class="form-group"> <label class="control-label col-md-4">From Date :</label> <div class="col-md-8"> <input type="text" class="form-control input-group openDatePicker from_delivery_date_required_on" name="from_delivery_date_required_on" id="from_delivery_date_required_on" data-provide="datepicker"> </div> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="control-label col-md-4">To Date :</label> <div class="col-md-8"> <input type="text" class="form-control input-group openDatePicker to_delivery_date_required_on" name="to_delivery_date_required_on" id="to_delivery_date_required_on" data-provide="datepicker"> </div> </div> </div> <div class="col-md-3"> <button type="button" onclick="load_grid();" class="btn btn-primary">Submit</button> <button type="button" onclick="export_page();" style="padding-top: 4px;padding-bottom: 4px;" class="btn btn-primary">Export</button> </div> <div class="col-md-3"> <button type="button" id="" onclick="country_wise();" value="Country Wise report" class="" style=""/>Country Wise report</button> <button type="button" id="" onclick="customer_rank();" value="Customer Rank List" class="" style=""/>Customer Rank List </button> <button type="button" id="" onclick="billing_yarn();" value="Billing yarn report" class="" style=""/>Billing yarn report</button> </div> </form> </div> <!-- row -2--> <div id = "jaytab3" style="margin-top:0%;margin-left: -28px;" class="col-sm-12 grid"> <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> </div> <div style="display:none;"><table border="1" style="border-spacing: 0px !important;" id="export_table" class="export_table"></table></div> <div style="display:none;"> <table border="1" style="border-spacing: 0px !important;" id="print_table" class="print_table"></table> </div> <script> function print_page1() { var divToPrint=document.getElementById('print_table'); newWin= window.open(""); newWin.document.write('<html><head><title></title>'); newWin.document.write('</head>'); newWin.document.write(divToPrint.outerHTML); newWin.document.write('</html>'); newWin.print(); document.getElementById('print_table').style.display=''; newWin.close(); location.reload(); } </script> <style type="text/css"> #edit_list3 { display:none; } #search_list3 { display:none; } #refresh_list3 { display:none; } #client_delete_new { display:none; } a{ color: inherit; } #print_broker_report{ display:none; } </style> <!-- 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.min.js'); ?>"></script> <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <!-- 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.min.css'); ?>" /> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <script type="text/javascript"> load_grid1(); function load_grid() { var from_delivery_date_required_on =$('#from_delivery_date_required_on').val(); var to_delivery_date_required_on =$('#to_delivery_date_required_on').val(); $("#list3").setGridParam( { url:"<?php echo site_url('reports/billing_data_new')?>?from_date="+from_delivery_date_required_on+"&&to_date="+to_delivery_date_required_on, page:1 } ).trigger("reloadGrid");//Reload grid trigger return false } function load_grid1(){ var ll; var type = $('#type').val(); var from_delivery_date_required_on =$('#from_delivery_date_required_on').val(); var to_delivery_date_required_on =$('#to_delivery_date_required_on').val(); jQuery("#list3").jqGrid({ url:"<?php echo base_url('reports/billing_data_new')?>?from_date="+from_delivery_date_required_on+"&&to_date="+to_delivery_date_required_on, datatype: "json", colNames:['Id','Date','Invoice #','Customer Name','Total Qty','Unit','Type','Currency','Discount','Other Charges','Invoice Value','Payment Amt Rec','Bank Charges','Bank Real Rate','INR Value','Remarks','Bank Ref','Country','Port Code','Shipping Bill #','Shipping Bill Date','Approved','Shipped','Payment'], colModel:[ {name:'id',index:'id',hidden:true, width:50,editable:true,width:100}, {name:'sys_date',index:'sys_date',editable:false, width:100}, {name:'invoice_num',index:'invoice_num',edittype:'text',editable:false,editrules:{required: true}, width:150}, {name:'customer_name',index:'customer_name',editable:false, width:190}, {name:'tot_qty',index:'tot_qty', width:50,editable:false,width:100}, {name:'units',index:'units', width:50,editable:false,width:100}, {name:'type',index:'design', width:50,editable:false,width:100}, {name:'new_currency',index:'new_currency',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'discount',index:'discount', width:50,editable:false,width:150}, {name:'other_charges',index:'other_charges', width:50,editable:false,width:150}, {name:'report_total_value',index:'report_total_value', width:50,editable:false,width:150}, {name:'payment_amount_received',index:'payment_amount_received',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'payment_bank_charged',index:'payment_bank_charged',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'payment_bank_realisation_rate',index:'payment_bank_realisation_rate',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'payment_inr_value',index:'payment_inr_value',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'payment_remark',index:'payment_remark',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'bank_reference',index:'bank_reference',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'country',index:'country',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'shipping_port_code',index:'shipping_port_code',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'shipping_bill_num',index:'shipping_bill_num',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name:'shipping_bill_date',index:'shipping_bill_date',edittype:'text',editable:false,editrules:{required: true}, width:100}, {name: 'confirm', index: 'confirm', width: 70, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: true }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="approve_fun($(this))" '; } }, {name: 'shipped', index: 'shipped', width: 70, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: true }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="approve_shipped_fun($(this))" '; } }, {name: 'payment', index: 'payment', width: 70, align: 'center', formatter: 'checkbox', editoptions: { value: '1:0' }, formatoptions: { disabled: true }, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="approve_shipped_fun($(this))" '; } }, ], height: 'auto', rowNum:20, rowTotal: 2000, rowList : [10,20,30,50,100,500,1000], rownumbers: true, rownumWidth: 40, pager:"#pager3", sortname:'owner_id', viewrecords: true, gridview: true, autowidth: true, sortorder:"asc", shrinkToFit: false, emptyrecords: 'No records to display', // multiselect: true, // multiboxonly: true, //loadonce:true, onSelectRow: function(id){ if(id && id!==ll){ jQuery('#list3').jqGrid('restoreRow',ll); jQuery('#list3').jqGrid('editRow',id,true);ll=id; } }, editurl: "<?php echo base_url('new_stores/edit_received_goods_details');?>", caption:"Billing Details", footerrow: true, loadComplete: function () { var sumOfPrice_rec_mtrs = jQuery("#list3").jqGrid('getCol','report_total_value',false,'sum'); var currency = jQuery("#list3").jqGrid('getCol','new_currency'); var tot_val = jQuery("#list3").jqGrid('getCol','report_total_value'); var inr=0; var usd=0; var eur=0; var chf=0; var gbp=0; $.each( currency, function( key, value ) { if(value=='INR') { inr=parseFloat(tot_val[key])+parseFloat(inr); }else if(value=='USD') { usd=parseFloat(tot_val[key])+parseFloat(usd); } else if(value=='GBP') { gbp=parseFloat(tot_val[key])+parseFloat(gbp); }else if(value=='EUR') { eur=parseFloat(tot_val[key])+parseFloat(eur); }else if(value=='CHF') { chf=parseFloat(tot_val[key])+parseFloat(chf); } }); jQuery("#list3").jqGrid('footerData', 'set', { type: 'USD Total:', new_currency: usd.toFixed(2) }); jQuery("#list3").jqGrid('footerData', 'set', { discount: ' INR Total:', other_charges: inr.toFixed(2) }); jQuery("#list3").jqGrid('footerData', 'set', { report_total_value: 'EUR Total:', payment_amount_received: eur.toFixed(2) }); jQuery("#list3").jqGrid('footerData', 'set', { payment_bank_charged: ' CHF Total:', payment_bank_realisation_rate: chf.toFixed(2) }); jQuery("#list3").jqGrid('footerData', 'set', { payment_inr_value: 'GBP Total:',payment_remark: gbp.toFixed(2) }); }, }); $("#list3").jqGrid("setLabel", "rn", "SL"); $("#list3").jqGrid('filterToolbar',{searchOperators : false}); //for multisearch code,remove if not required $("#list3").jqGrid('navGrid','#pager3', {edit:true,add:false,del:false,search:true,refreshstate:"current"}, { }, { }, { }, { sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'], closeOnEscape: true, multipleSearch: true, closeAfterSearch: true } ).navButtonAdd('#pager3', { caption:"Print", buttonicon:"ui-icon-print", onClickButton:print_page, position: "last", title:"", cursor: "pointer", id:"client_delete_new" } ); $("#list3").navButtonAdd('#pager3', { caption:"Export", buttonicon:"", //onClickButton: export_page_list, onClickButton: export_page, position: "last", title:"", cursor: "pointer", id:"client_delete" } ); } function export_page() { id = jQuery("#list3").jqGrid('getDataIDs'); var type= $('#type').val(); var type = $('#type').val(); var from_delivery_date_required_on =$('#from_delivery_date_required_on').val(); var to_delivery_date_required_on =$('#to_delivery_date_required_on').val(); $.ajax({ type : 'post', url:"<?php echo base_url('reports/billing_data_new')?>?from_date="+from_delivery_date_required_on+"&&to_date="+to_delivery_date_required_on, data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); //alert(d); console.log(response); var count =1; var received_qty_ref=0; var received_wt =0; var inr=0; var usd=0; var gbp=0; var eur=0; var chf=0; $('.export_table').empty(); var content = ''; content +='<thead><tr>'; content +='<th>Id</th>'; content +='<th>Date</th>'; content +='<th>Invoice #</th>'; content +='<th>Customer Name</th>'; content +='<th>Total Qty</th>'; content +='<th>Unit</th>'; content +='<th>Type</th>'; content +='<th>Currency</th>'; content +='<th>Discount</th>'; content +='<th>Other Charges</th>'; content +='<th>Invoice Value</th>'; content +='<th>Payment Amt Rec</th>'; content +='<th>Bank Charges</th>'; content +='<th>Bank Real Rate</th>'; content +='<th>INR Value</th>'; content +='<th>Remarks</th>'; content +='<th>Bank Ref</th>'; content +='<th>Country</th>'; content +='<th>Port Code</th>'; content +='<th>Shipping Bill #</th>'; content +='<th>Shipping Bill Date</th>'; content +='<th>Approved</th>'; content +='<th>Shipped</th>'; content +='<th>Payment<th>'; content +='</tr></thead>'; $.each(response,function(key,vas){ received_qty_ref +=parseFloat(vas.report_total_value); if(vas.new_currency=='INR') { inr=parseFloat(vas.report_total_value)+parseFloat(inr); }else if(vas.new_currency=='USD') { usd=parseFloat(vas.report_total_value)+parseFloat(usd); }else if(vas.new_currency=='GBP') { gbp=parseFloat(vas.report_total_value)+parseFloat(gbp); }else if(vas.new_currency=='EUR') { eur=parseFloat(vas.report_total_value)+parseFloat(eur); }else if(vas.new_currency=='CHF') { chf=parseFloat(vas.report_total_value)+parseFloat(chf); } content +='<tr>'; content +='<td>'+count+'</td>'; content +=' <td>'+vas.sys_date+'</td>'; content +=' <td>'+vas.invoice_num+'</td>'; content +=' <td>'+vas.customer_name+'</td>'; content +=' <td>'+vas.tot_qty+'</td>'; content +=' <td>'+vas.units+'</td>'; content +=' <td>'+vas.type+'</td>'; content +=' <td>'+vas.new_currency+'</td>'; content +=' <td>'+vas.discount+'</td>'; content +=' <td>'+vas.other_charges+'</td>'; content +=' <td>'+vas.report_total_value+'</td>'; content +='<td>'+vas.payment_amount_received+'</td>'; content +='<td>'+vas.payment_bank_charged+'</td>'; content +='<td>'+vas.payment_bank_realisation_rate+'</td>'; content +='<td>'+vas.payment_inr_value+'</td>'; content +='<td>'+vas.payment_remark+'</td>'; content +='<td>'+vas.bank_reference+'</td>'; content +=' <td>'+vas.country+'</td>'; content +=' <td>'+vas.shipping_port_code+'</td>'; content +='<td>'+vas.shipping_bill_num+'</td>'; content +='<td>'+vas.shipping_bill_date+'</td>'; content +='<td>'+vas.confirm+'</td>'; content +='<td>'+vas.shipped+'</td>'; content +='<td>'+vas.payment+'</td>'; content +='</tr>'; count++; }); content +='<tr></tr>'; content +='<tr><th><b>SUMMARY</b></th><th></th> <th></th> <th></th> <th></th> <th></th> <th></th> Total CHF Value<th>'+chf+'</th> <th></th><th><th></th></tr>'; content +='<tr><th>Total USD Value</th> <th><b>'+usd+'</b></th> <th>Total INR Value</th> <th>'+inr+'</th> <th></th> <th>Total GBP Value</th> <th>'+gbp+'</th> <th>Total EUR Value</th><th>'+eur+'<th></th></tr>'; $('.export_table').append(content); doit('xlsx'); // doit(type, fn, dl); // export_data(); // pdf_download(); } }); } function doit(type, fn, dl) { var elt = document.getElementById('export_table'); var wb = XLSX.utils.table_to_book(elt, {sheet:"Sheet JS"}); return dl ? XLSX.write(wb, {bookType:type, bookSST:true, type: 'base64'}) : XLSX.writeFile(wb, fn || ('Billing Receipt Report.' + (type || 'xlsx'))); } function tableau(pid, iid, fmt, ofile) { if(typeof Downloadify !== 'undefined') Downloadify.create(pid,{ swf: 'downloadify.swf', downloadImage: 'download.png', width: 100, height: 30, filename: ofile, data: function() { return doit(fmt, ofile, true); }, transparent: false, append: false, dataType: 'base64', onComplete: function(){ alert('Your File Has Been Saved!'); }, onCancel: function(){ alert('You have cancelled the saving of this file.'); }, onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); } }); else document.getElementById(pid).innerHTML = ""; } tableau('biff8btn', 'xportbiff8', 'biff8', 'test.xls'); tableau('odsbtn', 'xportods', 'ods', 'test.ods'); tableau('fodsbtn', 'xportfods', 'fods', 'test.fods'); tableau('xlsbbtn', 'xportxlsb', 'xlsb', 'test.xlsb'); tableau('xlsxbtn', 'xportxlsx', 'xlsx', 'test.xlsx'); function export_page_list() { id = jQuery("#list3").jqGrid('getDataIDs'); var type= $('#type').val(); $.ajax({ type : 'post', url:"<?php echo base_url('reports/billing_data')?>", data : {id:id}, success:function(data){ response=jQuery.parseJSON(data); //alert(d); console.log(response); var count =1; var received_qty_ref=0; var received_wt =0; $('.export_table').empty(); var content = ''; content +='<thead><tr><th><b>SL No.</b></th><th><b>Invoice #</b></th><th><b>Date</b></th> <th><b>Customer Name</b></th><th><b>Total Qty</b></th><th><b>Unit</b></th> <th><b>Type</b></th> <th><b>Invoice Value</b></th><th><b>Currency</b></th> <th><b>Country</b></th><th><b>Approved</b></th><th><b>Shipped</b></th></tr></thead>'; $.each(response,function(key,vas){ received_qty_ref +=parseFloat(vas.report_total_value); content +='<tr><td>'+count+'</td> <td>'+vas.invoice_num+'</td> <td>'+vas.sys_date+'</td> <td>'+vas.customer_name+'</td> <td>'+vas.tot_qty+'</td><td>'+vas.units+'</td> <td>'+vas.type+'</td><td>'+vas.report_total_value+'</td><td>'+vas.currency+'</td><td>'+vas.country+'</td><td>'+vas.confirm+'</td><td>'+vas.shipped+'</td></tr>'; count++; }); content +='<tr></tr>'; content +='<tr><th><b>SUMMARY</b></th><th></th> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th><th><th></th></tr>'; content +='<tr><th><b>Total Invoice Value</b></th> <th><b>'+received_qty_ref+'</b></th> <th></th> <th></th> <th></th> <th></th> <th></th> <th></th><th><th></th></tr>'; $('.export_table').append(content); export_data(); pdf_download(); } }); } function export_data() { //alert(); $("#export_table").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Billing Receipt Report", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); } // function pdf_download() // { // alert(); // var options = { // }; // var pdf = new jsPDF('p', 'pt', 'a4'); // pdf.addHTML($("#export_table"), 0, 0, options, function() { // pdf.save('inspected_fabric.pdf'); // }); // } $("#export").on("click", function(){ $("#list3").jqGrid("exportToHtml",{ includeLabels : true, includeGroupHeader : true, includeFooter: true, autoPrint : true }); }); function print_page() { id = jQuery("#list3").jqGrid('getDataIDs'); $.ajax({ type : 'post', url:"<?php echo base_url('reports/pdf_print')?>", data : {id:id}, success:function(){ } }); } function print_page1() { //alert(); var divToPrint=document.getElementById('print_table'); newWin= window.open(""); newWin.document.write('<html><head><title></title>'); newWin.document.write('</head>'); newWin.document.write(divToPrint.outerHTML); newWin.document.write('</html>'); newWin.print(); document.getElementById('print_table').style.display=''; newWin.close(); location.reload(); } function fun(rowId) { var type= $('#type').val(); var id = rowId.closest('tr').attr('id'); $.ajax({ type : 'post', url : "<?php echo site_url("edit-broker")?>?type="+type, data : {broker_id:id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $(".broker_id_pk").val(response.broker_details.broker_id); $(".name_or_id").val(response.broker_details.name_or_id); $(".associate_name").val(response.broker_details.associate_name); $(".address").val(response.broker_details.address); $(".email").val(response.broker_details.email); $(".mobile").val(response.broker_details.mobile); $(".mobile2").val(response.broker_details.mobile2); $(".reference_details").val(response.broker_details.reference_details); $(".pan_number").val(response.broker_details.pan_number); $(".adhar_number").val(response.broker_details.adhar_number); var ext = response.broker_details.scan_copy.split('.').pop(); if(ext == 'JPG' || ext == 'jpg' || ext == 'JPEG' || ext == 'jpeg' || ext == 'png' || ext == 'PNG') { $(".scanned_image").html('<img src ="<?php echo base_url("broker_uploads");?>/'+response.broker_details.scan_copy+'" style="width:250px;height:350px"/>'); } else if(ext == 'pdf') { $(".scanned_image").html('<embed src ="<?php echo base_url("broker_uploads");?>/'+response.broker_details.scan_copy+'" style="width:250px;height:350px"/>'); } var content = ''; if(response.broker_details.type == "Executives") { content += '<label class="radio-inline"><input type="radio" value="Executives" name="type" checked>Executives</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Executives" name="type">Executives</label>'; } if(response.broker_details.type == "Associate") { content += '<label class="radio-inline"><input type="radio" value="Associate" name="type" checked>Associate</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Associate" name="type">Associate</label>'; } if(response.broker_details.type == "Logistic") { content += '<label class="radio-inline"><input type="radio" value="Logistic" name="type" checked>Logistic</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Logistic" name="type">Logistic</label>'; } if(response.broker_details.type == "Sub Associate") { content += '<label class="radio-inline"><input type="radio" value="Sub Associate" name="type" checked>Sub Associate</label>'; } else { content +='<label class="radio-inline"><input type="radio" value="Sub Associate" name="type">Sub Associate</label>'; } $(".radio_button_class").html(content); $("#edit_modal").modal("show"); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } function fun_delete(rowId) { var type= $('#type').val(); var id = rowId.closest('tr').attr('id'); var broker_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(); // test.attr('disabled', 'disabled'); //test.text("Deleting..."); $.ajax({ type : 'post', url : "<?php echo site_url("delete-broker")?>?type="+type, data : {broker_id:broker_id}, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); //BrokersList(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } $('.update_form').submit(function(e){ e.preventDefault(); var type= $('#type').val(); formdata = new FormData($(this)[0]); // $(".submit").attr('disabled', 'disabled'); // $(".submit").text("Updating..."); $.ajax({ type : 'post', url : "<?php echo site_url("update-broker")?>?type="+type, data : formdata, contentType: false, processData: false, success:function(response){ response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $("#edit_modal").modal("hide"); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); toastr["success"](response.message); $('.update_form')[0].reset(); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else if(response.result==2) { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); function SortedResult(brokers_list) { tbody.empty(); var table_row = []; var slno = 1; var index = 1; $.each(brokers_list,function(idx,vx){ var row = []; var image = ""; row.push(slno); image='<img src ="<?php echo base_url("broker_uploads");?>/'+vx.scan_copy+'" style="width:80px;height:70px"/>'; row.push(vx.type); row.push(vx.name_or_id); row.push(vx.associate_name); row.push(vx.email); row.push(vx.mobile); row.push(vx.address); row.push(vx.pan_number); row.push(vx.reference_details); row.push(vx.adhar_number); var table_content = ''; table_content += '<div style="float:left;">'; table_content += '<a data-toggle="tooltip" title="Edit" class="edit" broker_id="'+vx.broker_id+'" href="javascript:void(0);"><span class="glyphicon glyphicon-edit"></span></a> <a data-toggle="tooltip" title="Delete" class="delete" broker_id="'+vx.broker_id+'" href="javascript:void(0);"><span class="glyphicon glyphicon-trash"></span></a>'; table_content += '</div>' row.push(table_content); table_row.push(row); slno++; index ++; }); datatable.clear(); datatable.rows.add(table_row).draw(); datatable.draw(); } </script> <style type="text/css"> .form-control:focus, input[type="Submit"]:focus, input[type="button"]:focus { border-color: #FF0000; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(255, 0, 0, 0.6); } #FrmGrid_list3 { width: 100% !important; } .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: 27px !important; background:#485b7f !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 .ui-jqgrid-bdiv { overflow-y: scroll; //overflow-x: hidden; } </style> <script type="text/javascript"> $(document).ready(function(){ $("#sites_print").click(function(){ var divToPrint=document.getElementById("print_sites_report"); newWin= window.open(""); newWin.document.write(divToPrint.outerHTML); newWin.print(); newWin.close(); }); $("#sites_export").click(function(){ $(".sites_table_print").table2excel({ exclude: ".noExl", name: "Excel Document Name", filename: "Broker List", fileext: ".xls", exclude_img: true, exclude_links: true, exclude_inputs: true }); }); }); </script> <link rel="stylesheet" href="<?php echo base_url('assets/css/code_jquery.min.css');?>"> <script src="<?php echo base_url('assets/js/jquery-ui.min.js'); ?>" type="text/javascript"></script> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('assets/css/jquery-ui.min.css'); ?>" /> <script> $(function(){ $(".from_delivery_date_required_on").datepicker({ dateFormat: 'dd-mm-yy', }).on('changeDate', function(ev){ $('.from_delivery_date_required_on').datepicker('hide'); }); }); $('.from_delivery_date_required_on').on('change', function(){ var date = $(this).val(); $('.to_delivery_date_required_on').datepicker({ dateFormat: 'dd-mm-yy', minDate: date, }); }); </script> <style type="text/css"> .content-wrapper, .right-side { //min-height:900px !important; } a { color: inherit; } .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] { position: absolute; margin-top: 4px\9; margin-left: -47px; } input[type=checkbox], input[type=radio] { margin: -8px 0 0; margin-top: 1px\9; line-height: normal; } .radio-inline input[type=radio] { margin-left: -20px; width: 15px !important; margin-top: -5px; } #ui-datepicker-div { z-index: 1000 !important; } .date_row { padding-bottom: 3%; } </style>