Beispiel #1
0
 private function calcVals($type, $vals, $date = null)
 {
     $p = 0;
     foreach ($vals as $v) {
         $res2 = q_custom("SELECT oli_proizvod_id,oli_order_id,SUM(oli_kolicina),ord_date,ord_paid FROM orderlist " . "INNER JOIN orders ON oli_order_id=ord_id " . "AND oli_proizvod_id=" . $v['pro_id'] . " AND ord_paid='C'");
         if (null === $date || null !== $date && date('Y-m', strtotime($res2[0]['ord_date'])) === $date) {
             if ($type === 'sum') {
                 $p += $v['pro_cena'] * $res2[0][2];
             } elseif ($type === 'kom') {
                 $p += $res2[0][2];
             }
         }
     }
     return $p;
 }
Beispiel #2
0
 public function leadersSentEmail($post)
 {
     $le = q_custom("SELECT * FROM groupleaders " . "INNER JOIN users ON lea_user_id=id " . "JOIN tours ON lea_tour_id=tou_id " . "AND lea_id=" . $post['glid']);
     if ($post['emailto'] === 'all') {
         $pa = q_custom("SELECT * FROM enroll_full " . "INNER JOIN users ON enf_user_id=id " . "AND enf_status='C' AND enf_tour_id=" . $le[0]['lea_tour_id']);
         foreach ($pa as $p) {
             $message = '<strong>' . $le[0]['firstname'] . ' ' . $le[0]['lastname'] . ', group leader of ' . $le[0]['tou_title'] . ' sent you the message:</strong>';
             $message .= '<article><em>' . $post['text'] . '</em></article>';
             mailing($p['email'], $post['emailfrom'], 'Message from groupleader', $message);
         }
     } else {
         $message = '<strong>' . $le[0]['firstname'] . ' ' . $le[0]['lastname'] . ', group leader of ' . $le[0]['tou_title'] . ' sent you the message:</strong>';
         $message .= '<article><em>' . $post['text'] . '</em></article>';
         mailing($post['emailto'], $post['emailfrom'], 'Message from groupleader', $message);
     }
 }
Beispiel #3
0
 public function getFilteredOrders($s)
 {
     $search = explode('=', $s);
     if ($search[0] === 'pobroju') {
         $where = " WHERE ord_number='" . $search[1] . "'";
     }
     if ($search[0] === 'poimenu') {
         $where = " WHERE ord_name='" . $search[1] . "'";
     }
     if ($search[0] === 'postatusu') {
         $s1 = explode('-', $search[1]);
         $where = " WHERE ord_paid='" . $s1[0] . "' AND ord_status='" . $s1[1] . "'";
     }
     $res = array('orders' => array(), 'list' => array());
     $res['orders'] = q_custom("SELECT * FROM orders" . $where . " ORDER BY ord_id DESC");
     foreach ($res['orders'] as $o) {
         $resol = q_custom("SELECT * FROM orderlist " . "INNER JOIN proizvodi ON pro_id=oli_proizvod_id " . "AND oli_order_id=" . $o['ord_id']);
         array_push($res['list'], $resol);
     }
     return $res;
 }
Beispiel #4
0
 public function showStuDet()
 {
     $stid = filter_input(INPUT_POST, 'stid');
     $res = q_custom("SELECT * FROM students " . "INNER JOIN users ON stu_user_id=id " . "AND stu_id=" . $stid);
     $str = '<table class="table">';
     $str .= '<tr style="background:#ccc;"><th colspan="2">Student</td></tr>';
     $str .= '<tr><td>Name :</td><td>' . $res[0]['stu_firstname'] . ' ' . $res[0]['stu_lastname'] . '</td></tr>';
     $str .= '<tr><td>Date of birth :</td><td>' . date('m-d-Y', strtotime($res[0]['stu_dob'])) . '</td></tr>';
     if ($res[0]['stu_gender'] === 'M') {
         $str .= '<tr><td>Gender :</td><td>Male</td></tr>';
     } else {
         $str .= '<tr><td>Gender :</td><td>Female</td></tr>';
     }
     $str .= '<tr style="background:#ccc;"><th colspan="2">Parent</th></tr>';
     $str .= '<tr><td>Name :</td><td>' . $res[0]['firstname'] . ' ' . $res[0]['lastname'] . '</td></tr>';
     $str .= '<tr><td>Address :</td><td>' . $res[0]['address1'] . ', ' . $res[0]['city'] . ', ' . $res[0]['state'] . '</td></tr>';
     $str .= '<tr><td>Home Phone :</td><td>' . $res[0]['homephone'] . '</td></tr>';
     $str .= '<tr><td>Mobile Phone :</td><td>' . $res[0]['mobilephone'] . '</td></tr>';
     $str .= '</table>';
     echo $str;
 }
Beispiel #5
0
 public function getSimilar()
 {
     $post = filter_input_array(INPUT_POST);
     $data = q_custom("SELECT * FROM proizvodi WHERE pro_marka_id=" . $post['mid'] . " AND NOT pro_id=" . $post['pid']);
     echo self::view('home/featured', $data);
 }
Beispiel #6
0
 public function getExtra()
 {
     $res = q_custom("SELECT * FROM proizvodi ORDER BY RAND() LIMIT 6");
     return $res;
 }