Esempio n. 1
0
 function loadEnquiry()
 {
     $postData = $this->input->post();
     $enquries = $this->consultants->getAllEnquires($postData);
     $weeks = getWeekRange();
     $enqArr = array();
     if ($enquries && count($enquries) > 0) {
         foreach ($enquries as $enq) {
             $dateDiff = myDateDiff($weeks[1]['start']['date'], $enq['eventDate']);
             $week = (int) ($dateDiff['days'] / 7 + 1);
             $enqArr[$week][] = $enq;
         }
     }
     echo json_encode($enqArr);
 }
Esempio n. 2
0
 function genratePayble()
 {
     error_reporting(1);
     $filename = "data.xls";
     header('Content-type: application/ms-excel');
     header('Content-Disposition: attachment; filename=' . $filename);
     $postData = $this->input->post();
     $enquries = $this->consultants->getPay($postData);
     $weeks = getWeekRange();
     $enqArr = array();
     $evids = array();
     if ($enquries && count($enquries) > 0) {
         foreach ($enquries as $enq) {
             $dateDiff = myDateDiff($weeks[1]['start']['date'], $enq['eventDate']);
             $week = (int) ($dateDiff['days'] / 7 + 1);
             $enqArr[$week][] = $enq;
             $evids[] = $enq['eventID'];
         }
     }
     $invitations = $this->consultants->getMusicianInvitationForEvent('', array('event_id' => $evids));
     $invarr = array();
     foreach ($invitations as $inv) {
         $invarr[$inv->event_id][] = $inv;
     }
     $htmlcontent = "<table>";
     $htmlcontent .= "<tr><th>Gig Name</th><th>Date</th><th>Day</th><th>Lead Singer</th><th>Band brand</th><th>Musician name</th><th>Paid Amount</th></tr>";
     $events = $enqArr;
     $eventInv = $invarr;
     $awaitingDepositsList = array();
     $showcaseInfo = array();
     if ($events) {
         foreach ($events as $week => $val) {
             foreach ($val as $ev) {
                 $leadsinger = '';
                 $leadsingertip = '';
                 $bandsizetip = '';
                 $bandsize = '0';
                 $nrplytip = '';
                 $nrply = '0';
                 $declinedtip = '';
                 $declined = '0';
                 $musiciancost = 0;
                 $event = $ev['eventID'];
                 if (isset($eventInv[$ev['eventID']])) {
                     foreach ($eventInv[$ev['eventID']] as $inv) {
                         if ($inv->event_lead_singer) {
                             $lead = "Yes";
                         } else {
                             $lead = "No";
                         }
                         $musician_name = $inv->first_name . ' ' . $inv->last_name;
                         $band_brand = $inv->band_brand;
                         $musiciancost = $inv->base_cost + $inv->extra_time_cost + $inv->distance_cost;
                         $htmlcontent .= "<tr><td>" . $ev['firstName'] . ' ' . $ev['lastName'] . "</td><td>" . mysqlDate2UkDate($ev['eventDate']) . "</td><td>" . getDayFromMysqlDate($ev['eventDate']) . "</td><td>" . $lead . "</td><td>" . $band_brand . "</td><td>" . $musician_name . "</td><td>" . $musiciancost . "</td></tr>";
                     }
                 }
             }
         }
     }
     $htmlcontent .= "</table>";
     // Create as XLS file and send to browser for download
     echo $htmlcontent;
 }