EVOLUTION-NINJA
Edit File: booked_sites.php
<?php echo view('includes/header');?> <link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('public/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('public/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 --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/assets/css/jquery-ui.css'); ?>" /> <!-- The link to the CSS that the grid needs --> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url('public/jqgrid/css/ui.jqgrid.css'); ?>" /> <script src="<?php echo base_url('public/assets/js/jquery-ui.js'); ?>" type="text/javascript"></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_list2 { 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:#AF0100 !important; color:white !important; } .ui-jqgrid-bdiv { height: 232px !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> <section class="content-header"> <h1> Booked sites </h1> </section> <!--- section 1 ----> <section class="content"> <div id="menu1" class="tab-panecol-sm-12 col-md-12 "> <div class="col-sm-1"></div> <div id = "jaytab3" style="margin-top:3%;" class="col-sm-10 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> </section> <!--- section 2 ----> <div id="print_div" style="display:none;"></div> <style type="text/css"> .content-wrapper, .right-side { min-height: 2000px !important; } .bok-details{ background: gainsboro; text-align: center; padding-top: 7px; padding-bottom: 7px; margin-bottom: 30px; margin-top: 33px; } a { color: inherit; } </style> <script type="text/javascript"> function some_function() { console.log("Edit button clicked!"); } function print_page() { console.log("button clicked!"); } function export_page() { console.log("button clicked!"); } $(document).ready(function (){ jQuery("#list3").jqGrid({ url:"<?php echo site_url('booking-list')?>", mtype : "post", datatype: "json", colNames:['SI','Project','Site Number','Customer','Status','Khata Status','Source','View','Preview','Edit','Delete'], colModel:[ {name:'booking_id',index:'booking_id', width:50, hidden:true,editable:false,key:true}, {name:'project_name',index:'project_name', width:150, editable:false}, {name:'site_number',index:'site_number', width:100, editable:false}, {name:'customer_name',index:'customer_name', width:150, editable:false}, {name:'a_booking_status',index:'a_booking_status', width:175, editable:false}, {name:'d_status',index:'d_status', width:175, editable:false}, {name:'source_type',index:'source_type', width:100, editable:false}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_view($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='VIEW' \>"; }}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_preview($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='PREVIEW' \>"; }}, {name:' ',index:' ',editable:false,align: "center",editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='EDIT' onclick='some_function' data-toggle='modal' data-target='#edit_modal' \>"; }}, {name:'delete',index:'delete',align: "center",editable:false,editrules:{required: true}, width:100,cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' onclick="fun_delete($(this))" '; },formatter:function (cellvalue, options, rowObject) { return "<input type='button' value='DELETE' \>"; }}, ], 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, caption:" Booked Sites", }); $("#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 } ); function change_status() { console.log("button clicked!"); } // $("#list3").navButtonAdd('#pager3', // { caption:"Change Status", // buttonicon:"ui-icon-pencil", // onClickButton: change_status, // position: "last", // title:"", // cursor: "pointer", // id:"client_edit_new" // } // ); // $("#list3").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, // position: "last", // title:"", // cursor: "pointer", // id:"client_delete" // } // ); }); function fun(rowId) { var booking_id = rowId.closest('tr').attr('id'); $.ajax({ url:"<?php echo site_url('edit-booking-details')?>/"+ booking_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('edit-booking-details')?>/"+ booking_id; } }); } function fun_delete(rowId) { var id = rowId.closest('tr').attr('id'); var booking_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-booking")?>', data : {booking_id:booking_id}, success:function(response) { //response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); //BookingList(); $("#list3").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid'); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); } function fun_view(rowId) { var id = rowId.closest('tr').attr('id'); var booking_id=id; $.ajax({ url:"<?php echo site_url('booking-details')?>/"+ booking_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('booking-details')?>/"+ booking_id; } }); } function fun_preview(rowId) { var id = rowId.closest('tr').attr('id'); var booking_id=id; $.ajax({ url:"<?php echo site_url('preview-booking-details')?>/"+ booking_id, type:"POST", //data:{project_id:project_id}, success:function(response) { //alert(response); window.location.href="<?php echo site_url('preview-booking-details')?>/"+ booking_id; } }); } $('.update_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); $(".submit").attr('disabled', 'disabled'); $(".submit").text("Updating..."); $.ajax({ type : 'post', url : '<?php echo site_url("update-new-project")?>', data : formdata, contentType: false, processData: false, success:function(response){ //response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { $("#edit_modal").modal("hide"); //NewProjectsList(); 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 if(response.result == 3) { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Submit"); $(".submit").removeAttr('disabled'); } } }); }); </script> <script type="text/javascript"> $(document).ready(function(){ $(".tsv_input").keyup(function (e) { var tsv_input = $(this).val(); var dimen_input = $(".dimen_input").val(); if(dimen_input == "") { toastr["error"]("Dimesion is not available"); } else { var per_sqft = (tsv_input / dimen_input).toFixed(2); $(".per_sqft_input").val(per_sqft); } }); $("input[name='payment_type']").change(function(){ var value = $('input[name=payment_type]:checked').val(); if(value == "Cheque") { var check_content = ''; check_content += '<div class="form-group col-sm-12 col-md-6">'; check_content += '<label class="col-sm-4">Cheque No</label>'; check_content += '<input type="text" class="form-control col-sm-8" name="check_no" required="required">'; check_content += '</div>'; check_content += '<div class="form-group col-sm-12 col-md-6">'; check_content += '<label class="col-sm-4">Cheque Date</label>'; check_content += '<input type="rext" class="form-control col-sm-8 date_picker" name="check_date" max="" required="required">'; check_content += '</div>'; check_content += '<div class="form-group col-sm-12 col-md-6">'; check_content += '<label class="col-sm-4">Bank Name</label>'; check_content += '<input type="text" class="form-control col-sm-8" name="bank_name" required="required">'; check_content += '</div>'; $("#onlinepayment_div").empty(); $("#check_div").html(check_content).fadeIn('slow'); $('.date_picker').datepicker({ dateFormat: 'yy-mm-dd' }); } else if(value == "Online Payment") { var payment_content = ''; payment_content += '<div class="form-group col-sm-12 col-md-6">'; payment_content += '<label class="col-sm-4">VTR No</label>'; payment_content += '<input type="text" class="form-control col-sm-8" name="vtr_no" required="required">'; payment_content += '</div>'; payment_content += '<div class="form-group col-sm-12 col-md-6">'; payment_content += '<label class="col-sm-4">Date</label>'; payment_content += '<input type="text" class="form-control col-sm-8 date_picker" name="online_date" max="" required="required">'; payment_content += '</div>'; $("#check_div").empty(); $("#onlinepayment_div").html(payment_content).fadeIn('slow'); $('.date_picker').datepicker({ dateFormat: 'yy-mm-dd' }); } else { $("#check_div").empty(); $("#onlinepayment_div").empty(); } }); $('.booking_form').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("add-booking-details")?>', data : formdata, contentType: false, processData: false, success:function(response){ //response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { BookingList(); //toastr["success"](response.message); $('.booking_form')[0].reset(); $(".submit").text("Save & Print"); $(".submit").removeAttr('disabled'); //window.location='<?php echo base_url("payments");?>'; //window.location='<?php echo base_url("add-payment");?>/'+response.booking_id+''; var print_content = ''; print_content += '<div style="width:700px;"><style>.inv-ta-head{padding-top:5px;}.invoicetext{text-align:center;//margin-bottom:10px;}table{border-spacing:0;margin-left:10px;}td{padding:6px;}table.reference td:first-child, table.reference th:first-child {border-left: 1px solid #47ae32;}html, body {margin: 0 !important;padding: 0 !important;color: #000000 !important;font-family: Lato, Helvetica !important;font-size: 14px !important;}h1, ul, li, span, p, h2, h3, h4{padding:0 !important;margin: 0 auto !important;}.pding{//padding-right:17px;//padding-left:17px;}.pding p{padding-bottom: 3px !important;}</style>'; print_content += '<div id="printableArea">'; print_content += '<div class="inv-ta-head"></div> <!--- header END ------>'; print_content += '<div class="logo" style="padding-top:10px;">'; print_content += '<img src="<?php echo base_url("public/assets/admin_dashboard/images/logo.png");?>" class="img-responsive center-block" style="padding-left: 31%;padding-bottom: 6px;">'; print_content += '<p style="text-align:center; padding-top:5px;">#1104, First Floor, Udayaravi Road, Kuvempunagar, Mysore - 570023.</p>'; print_content += '<p style="text-align:center;"><b>Ph : 0821-1234567 / 1234567   /   gss@investinmysore.com </b> </p>'; print_content += '</div>'; print_content += '<div class="row">'; print_content += '<table border="0" style="width:100%; border-color: white; padding-top: 7px;">'; print_content += '<tr>'; print_content += '<td colspan="12" style="text-align:center; border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += '<h4 style="text-transform: uppercase;"><b>Receipt</b></h4>'; print_content += '</td>'; print_content += '</tr>'; print_content += '<tr>'; print_content += '<td colspan="3" class="pding">'; print_content += '<p><strong> Name : </strong>'+response.booking_receipt.customer_name+'</p>'; print_content += '<p><strong> Phone : </strong>'+response.number+'</p>'; print_content += '</td>'; print_content += '<td colspan="4" class="pding">'; print_content += '<p><strong>Address : </strong>'+response.user_data.address+'</p>'; print_content += '<p><strong>Email : </strong>'+response.user_data.email+'</p>'; print_content += '</td>'; print_content += '<td colspan="5" class="pding">'; print_content += '<p><strong>Recipt No : </strong> 1</p>'; print_content += '<p><strong>Bill Date : </strong>'+response.todays_date+'</p>'; print_content += '</td>'; print_content += '</tr>'; print_content += '<tr style="background:#f3f2f2;">'; print_content += '<td colspan="1" class="pding" style="border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += '<strong>Site No.</strong>'; print_content += '</td>'; print_content += '<td colspan="2" class="pding" style="border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += '<strong>Project Name</strong>'; print_content += '</td>'; print_content += '<td colspan="2" class="pding" style="border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += '<strong>Received</strong>'; print_content += '</td>'; print_content += '<td colspan="2" class="pding" style="border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += '<strong>Balance</strong>'; print_content += '</td>'; print_content += '<td colspan="4" class="pding" style="border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += '<strong>Total Amount</strong>'; print_content += '</td>'; print_content += '</tr>'; print_content += '<tr>'; print_content += '<td colspan="1" class="pding">'+response.booking_receipt.site_number+'</td>'; print_content += '<td colspan="2" class="pding">'+response.booking_receipt.project_name+'</td>'; print_content += '<td colspan="2" class="pding">'+response.received+'</td>'; print_content += '<td colspan="2" class="pding">'+response.balance+'</td>'; print_content += '<td colspan="4" class="pding">'+response.total+'</td>'; print_content += '</tr>'; print_content += '<tr>'; print_content += '<td colspan="6" style="text-align:left; border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += 'Towards Booking Amount / Agreement / Registration Amount'; print_content += '</td>'; print_content += '<td colspan="3" style="font-weight:bold; border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += 'TOTAL'; print_content += '</td>'; print_content += '<td colspan="3" style="text-align:left; font-weight:bold; border-bottom: 1px solid silver; border-top: 1px solid silver;">'; print_content += response.total; print_content += '</td>'; print_content += '</tr>'; if(response.booking_receipt.booking_payment_type == "Cash") { print_content += '<tr>'; print_content += '<td colspan="3" style="border-bottom: 1px solid silver;"> Cash</td>'; print_content += '<td colspan="3" style="border-bottom: 1px solid silver;"></td>'; print_content += '<td colspan="4" style="border-bottom: 1px solid silver;"></td>'; print_content += '</tr>'; print_content += '<tr>'; } else if(response.booking_receipt.booking_payment_type == "Cheque") { print_content += '<tr>'; print_content += '<td colspan="3" style="border-bottom: 1px solid silver;">Cheque: </td>'; print_content += '<td colspan="4" style="border-bottom: 1px solid silver;"> Cheque no : '+response.booking_receipt.check_no+'</td>'; print_content += '<td colspan="4" style="border-bottom: 1px solid silver;"> Bank : '+response.booking_receipt.bank_name+'</td>'; print_content += '<td colspan="4" style="border-bottom: 1px solid silver;"> Date : '+response.booking_receipt.check_date+'</td>'; print_content += '</tr>'; print_content += '<tr>'; } else if(response.booking_receipt.booking_payment_type == "Online Payment") { print_content += '<tr>'; print_content += '<td colspan="3" style="border-bottom: 1px solid silver;">Online Payment: </td>'; print_content += '<td colspan="3" style="border-bottom: 1px solid silver;">'+response.booking_receipt.vtr_no+'</td>'; print_content += '<td colspan="4" style="border-bottom: 1px solid silver;"> Date : '+response.booking_receipt.online_date+'</td>'; print_content += '</tr>'; print_content += '<tr>'; } print_content += '<td colspan="4" style="padding-top:42px;"> Bill Generated By</td>'; print_content += '<td colspan="3"> </td>'; print_content += '<td colspan="5" style="padding-top:42px;"> For Authorized Signatory </td>'; print_content += '</tr>'; print_content += '</table>'; print_content += '</div>'; print_content += '</div>'; print_content += '</div><!--table div-->'; $("#print_div").html(print_content); var divContents = $("#print_div").html(); newWin= window.open(""); newWin.document.write(divContents); newWin.print(); newWin.close(); } else if(response.result==2) { toastr["error"](response.message); $(".submit").text("Save & Print"); $(".submit").removeAttr('disabled'); } else { toastr["error"](response.message); $(".submit").text("Save & Print"); $(".submit").removeAttr('disabled'); } } }); }); }); </script> <?php echo view('includes/footer');?>