Commit 84c73885 by Tobin

daily commit

parent e32029c6
...@@ -94,6 +94,7 @@ class Booking extends CI_Controller { ...@@ -94,6 +94,7 @@ class Booking extends CI_Controller {
echo json_encode($return_arr);exit; echo json_encode($return_arr);exit;
} }
$report_data = $this->formatReportData($report_data);
if(!empty($report_data)){ if(!empty($report_data)){
if($action == 'view'){ if($action == 'view'){
$return_arr['status'] = 1; $return_arr['status'] = 1;
...@@ -168,5 +169,46 @@ class Booking extends CI_Controller { ...@@ -168,5 +169,46 @@ class Booking extends CI_Controller {
header('Content-Disposition: attachement; filename="' . $fileName . '";'); header('Content-Disposition: attachement; filename="' . $fileName . '";');
fpassthru($temp_memory); fpassthru($temp_memory);
} }
function formatReportData($reportData = array()){
if(empty($reportData)){
return 0;
}
foreach($reportData AS $key => $data){
if(isset($data['Book_Status'])){
switch ($data['Book_Status']) {
case '0': $reportData[$key]['Book_Status'] = 'Cancelled'; break;
case '1': $reportData[$key]['Book_Status'] = 'Booked'; break;
case '2': $reportData[$key]['Book_Status'] = 'Completed'; break;
case '3': $reportData[$key]['Book_Status'] = 'Pending'; break;
case '4': $reportData[$key]['Book_Status'] = 'Deleted'; break;
}
}
if(isset($data['Reserved_By'])){
switch ($data['Reserved_By']) {
case '1': $reportData[$key]['Reserved_By'] = 'Super Admin '; break;
case '2': $reportData[$key]['Reserved_By'] = 'Provider '; break;
case '3': $reportData[$key]['Reserved_By'] = 'Customer'; break;
}
}
if(!empty($data['Ticket_Details'])){
$tktDtls = json_decode($data['Ticket_Details'],true);
if(isset($tktDtls['price'],$tktDtls['no_ticket'],$tktDtls['total_price']) &&
!empty($tktDtls['price'])&&!empty($tktDtls['no_ticket'])&&!empty($tktDtls['total_price'])){
$pDiv = (isset($tktDtls['color'])&&!empty($tktDtls['color']))?
$tktDtls['color'].' Block : ':'';
$pDiv .= $tktDtls['price'].' * '.$tktDtls['no_ticket'].'(Seats) = '.$tktDtls['total_price'];
$reportData[$key]['Ticket_Details'] = $pDiv;
}
}
}
return $reportData;
}
} }
?> ?>
\ No newline at end of file
...@@ -50,7 +50,7 @@ class Booking_model extends CI_Model { ...@@ -50,7 +50,7 @@ class Booking_model extends CI_Model {
$where_clause = ''; $where_clause = '';
if(!empty($where_cond)){ if(!empty($where_cond)){
if(!empty($where_cond['provider_id'])){ if(!empty($where_cond['provider_id'])){
$where_clause = " WHERE BOK.provider_id = '".$where_cond['provider_id']."' "; $where_clause = " WHERE EVT.provider_id = '".$where_cond['provider_id']."' ";
} }
if(!empty($where_cond['start_date']) && !empty($where_cond['end_date'])){ if(!empty($where_cond['start_date']) && !empty($where_cond['end_date'])){
$where_clause .= (empty($where_clause))?' WHERE ':' AND '; $where_clause .= (empty($where_clause))?' WHERE ':' AND ';
...@@ -98,9 +98,6 @@ class Booking_model extends CI_Model { ...@@ -98,9 +98,6 @@ class Booking_model extends CI_Model {
if(empty($resData)){ if(empty($resData)){
return 2; return 2;
} }
foreach($resData AS $key => $data){
$resData[$key]['Appointment_Time'] = (!empty($data['Appointment_Time']))?date('d-M-y G:i',$data['Appointment_Time']):'';
}
return $resData; return $resData;
} }
return 0; return 0;
......
...@@ -117,45 +117,45 @@ ...@@ -117,45 +117,45 @@
$tables = array('booking_details' => $tables = array('booking_details' =>
array('name' => 'Basic Details', array('name' => 'Basic Details',
'fields' => 'fields' =>
array('BOK.bookId AS book_id'=>'Book ID', array('BOK.bookId AS Book_ID'=>'Book ID',
'CONCAT(EDT.date,\' \',EDT.time) AS show_time'=>'Show Time', 'CONCAT(EDT.date,\' \',EDT.time) AS Show_Time'=>'Show Time',
'BOK.qrcode AS qrcode'=>'QR Code', 'BOK.qrcode AS QR_Code'=>'QR Code',
'BOK.no_of_ticket AS no_of_ticket'=>'No Of Ticket', 'BOK.no_of_ticket AS No_Of_Ticket'=>'No Of Ticket',
'BOK.ticket_details AS ticket_details'=>'Ticked Details', 'BOK.ticket_details AS Ticket_Details'=>'Ticked Details',
'BOK.amount AS amount'=>'Booking Amount', 'BOK.amount AS Amount'=>'Booking Amount',
'BOK.reserved_by AS reserved_by'=>'Reserved By', 'BOK.reserved_by AS Reserved_By'=>'Reserved By',
'BOK.status AS book_status'=>'Booking Status' 'BOK.status AS Book_Status'=>'Booking Status'
) )
), ),
array('name' => 'Event Details', array('name' => 'Event Details',
'fields' => 'fields' =>
array('EVT.event_name AS event_name'=>'Event Name', array('EVT.event_name AS Event_Name'=>'Event Name',
'EVT.event_discription AS event_discription'=>'Event Discription', 'EVT.event_discription AS Event_Discription'=>'Event Discription',
'ECAT.category AS category'=>'Event Category', 'ECAT.category AS Category'=>'Event Category',
'ECAT.category_description AS category_description'=>'Category Description' 'ECAT.category_description AS Category_Description'=>'Category Description'
) )
), ),
array('name' => 'Customer Details', array('name' => 'Customer Details',
'fields' => 'fields' =>
array('CUST.name AS customer_name'=>'Customer Name', array('CUST.name AS Customer_Name'=>'Customer Name',
'CUST.phone AS customer_phone'=>'Customer Phone', 'CUST.phone AS Customer_Phone'=>'Customer Phone',
'CUST.email AS customer_email'=>'Customer Email', 'CUST.email AS Customer_Email'=>'Customer Email',
'CUST.city AS customer_city'=>'Customer City' 'CUST.city AS Customer_City'=>'Customer City'
) )
), ),
array('name' => 'Provider Details', array('name' => 'Provider Details',
'fields' => 'fields' =>
array('PRV.name AS provider_name'=>'Provider Name', array('PRV.name AS Provider_Name'=>'Provider Name',
'PRV.phone AS provider_phone'=>'Provider Phone', 'PRV.phone AS Provider_Phone'=>'Provider Phone',
'PRV.email AS provider_email'=>'Provider Email' 'PRV.email AS Provider_Email'=>'Provider Email'
) )
), ),
array('name' => 'Venue Details', array('name' => 'Venue Details',
'fields' => 'fields' =>
array('VEN.venue_name AS venue_name'=>'Venue Name', array('VEN.venue_name AS Venue_Name'=>'Venue Name',
'VEN.venue_details AS venue_details'=>'Venue Details', 'VEN.venue_details AS Venue_Details'=>'Venue Details',
'REG.name AS region'=>'Region', 'REG.name AS Region'=>'Region',
'VEN.location AS location'=>'Location' 'VEN.location AS Location'=>'Location'
) )
) )
...@@ -230,11 +230,12 @@ ...@@ -230,11 +230,12 @@
<thead> <thead>
<tr> <tr>
<th width="60px;">Book ID</th> <th width="60px;">Book ID</th>
<th width="100px;">Event Name</th> <th width="120px;">Event</th>
<th width="80px;">Tickets Booked</th> <th width="120px;">Customer Name</th>
<th width="100px;">Amount</th> <th width="80px;">Amount</th>
<th width="100px;">Show Time</th> <th width="100px;">Show Time</th>
<th width="80px;">Action</th> <th width="50px;">Status</th>
<th width="50px;">Action</th>
</tr> </tr>
</thead> </thead>
<tbody id="report_table_body"> <tbody id="report_table_body">
...@@ -250,6 +251,6 @@ ...@@ -250,6 +251,6 @@
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function(){ jQuery(document).ready(function(){
jQuery('[name^="TDLS.transport_id"],[name^="TDLS.medical_no"],[name^="TDLS.patient_name"],[name^="TDLS.age"],[name^="TDLS.phone"],[name^="APRES.reason"],[name^="TDLS.appointment_time"]').prop("checked", true).parent().closest('div').addClass('disable-block'); jQuery('[name^="BOK.bookId"],[name^="CONCAT(EDT.date,\' \',EDT.time)"],[name^="BOK.amount"],[name^="BOK.status"],[name^="EVT.event_name"],[name^="CUST.name"]').prop("checked", true).parent().closest('div').addClass('disable-block');
}); });
</script> </script>
\ No newline at end of file
...@@ -636,7 +636,9 @@ function checkChild(thisObj){ ...@@ -636,7 +636,9 @@ function checkChild(thisObj){
} else { } else {
jQuery('[id^="table_'+table+'_"]').prop("checked", false); jQuery('[id^="table_'+table+'_"]').prop("checked", false);
} }
jQuery('[name^="TDLS.transport_id"],[name^="TDLS.medical_no"],[name^="TDLS.patient_name"],[name^="TDLS.age"],[name^="TDLS.phone"],[name^="APRES.reason"],[name^="TDLS.appointment_time"]').prop("checked", true).parent().closest('div').addClass('disable-block'); jQuery(document).ready(function(){
jQuery('[name^="BOK.bookId"],[name^="CONCAT(EDT.date,\' \',EDT.time)"],[name^="BOK.amount"],[name^="BOK.status"],[name^="EVT.event_name"],[name^="CUST.name"]').prop("checked", true).parent().closest('div').addClass('disable-block');
});
} }
jQuery('[name="fieldType"]').click(function(){ jQuery('[name="fieldType"]').click(function(){
...@@ -699,7 +701,7 @@ jQuery('[id="rGenerate"]').click(function(){ ...@@ -699,7 +701,7 @@ jQuery('[id="rGenerate"]').click(function(){
jQuery.each(resp_data['report_data'], function(key, data) { jQuery.each(resp_data['report_data'], function(key, data) {
report_data[key] = data; report_data[key] = data;
var vBtn = '<a class="btn btn-sm btn-primary" id="report_view_pop_'+key+'" key="'+key+'"><i class="fa fa-fw fa-edit"></i>View</a>'; var vBtn = '<a class="btn btn-sm btn-primary" id="report_view_pop_'+key+'" key="'+key+'"><i class="fa fa-fw fa-edit"></i>View</a>';
table.row.add([data['book_id'],data['event_name'],data['no_of_ticket'],data['amount'],data['show_time'],vBtn]).draw(); table.row.add([data['Book_ID'],data['Event_Name'],data['Customer_Name'],data['Amount'],data['Show_Time'],data['Book_Status'],vBtn]).draw();
}); });
jQuery('[id="report_table_html"]').removeClass('hide'); jQuery('[id="report_table_html"]').removeClass('hide');
...@@ -714,3 +716,15 @@ jQuery('[id="rGenerate"]').click(function(){ ...@@ -714,3 +716,15 @@ jQuery('[id="rGenerate"]').click(function(){
} }
}); });
}); });
function setErrModal(header_msg,body_msg){
jQuery('[id="modal_body_msg"]').html(body_msg);
jQuery('[id="modal_header_msg"]').html(header_msg);
jQuery('[id="errModal"]').modal('show');
}
function slideTo(id){
jQuery('html, body').animate({
scrollTop: jQuery('[id="'+id+'"]').offset().top
}, 800);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment