Пример #1
0
 function index()
 {
     $this->jquery->script('/ressources/jquery-1.6.2.min.js', TRUE);
     //	$js =$this->jquery->corner('#tt');
     //	$this->javascript->output($js);
     //	$this->javascript->compile();
     if (!intval($this->session->userdata('uid')) > 0) {
         redirect('/login');
     }
     $orderno = doubleval($orderno);
     // Print all orderdetails and calculate sum
     setlocale(LC_MONETARY, 'da_DK');
     $total = $this->input->get_post('amount');
     // Create orderhead
     $neworder = createuniqueorderno($this->session->userdata('uid'));
     $orderno = $neworder['orderno'];
     $orderkey = $neworder['orderkey'];
     // Create orderlines
     $item = $this->input->get_post('item');
     $pickupdate = $this->input->get_post('pickupdate');
     $itemamount = $this->input->get_post('itemamount');
     $quant = $this->input->get_post('quant');
     $status = 'Ingen ordrelinier<br>';
     $temp_total = 0;
     $vat_amount = 0;
     if (is_array($item)) {
         while (list($key, $value) = each($item)) {
             $amount = $quant[$key] * $itemamount[$key];
             $temp_total += $amount;
             if ($quant[$key] > 0) {
                 $status = '<!-- Ordrelinier gemt. -->';
                 $this->_insertpickuporderline($orderno, $orderkey, $item[$key], $this->session->userdata('uid'), $pickupdate[$key], $quant[$key], $amount, $vat_amount);
             }
         }
     } else {
         $amount = $this->input->get_post('quant') * $itemamount;
         $temp_total += $amount;
         $qfield = "new{$pickupdate}";
         if ($qfield > 0) {
             $status = '<!-- Ordrelinie gemt. -->';
             $this->_insertpickuporderline($orderno, $orderkey, $item, $this->session->userdata('uid'), $pickupdate, $quant, $amount, $vat_amount);
         }
     }
     $pickuplines = $this->_getpicuporders($orderno);
     $data = array('total' => $total, 'orderkey' => $orderkey, 'orderno' => $orderno, 'pickuplines' => $pickuplines, 'status' => $status);
     // Update orderhead with amount
     updateorderamount($orderno, $total);
     $this->load->view('onlinebet3', $data);
 }
Пример #2
0
 function _createorder_old($uid, $itemid, $created_by, $quant, $pickupdates, $method, $division)
 {
     $neworder = createuniqueorderno($uid, 'kontant');
     // Create orderlines
     $orderno = $neworder['orderno'];
     $orderkey = $neworder['orderkey'];
     $price = $this->_getitemprice($division);
     if ($price['error'] == '') {
         $status3 = 'OK';
     } else {
         $status3 = 'priceerror';
     }
     $vat_amount = 0;
     // To be handled elsewhere
     $no_of_days = 0;
     while (list($key, $date) = each($pickupdates)) {
         $no_of_days++;
         $lineamount = $price['price'] * $quant;
         $this->_insertorderline($orderno, $orderkey, $uid, $itemid, $quant, $lineamount, $vat_amount, $created_by, $date, $status3);
     }
     $amount = $quant * $price['price'] * $no_of_days;
     $this->_updateorderhead($orderno, $orderkey, $amount, $vat_amount, $status3, $method, $created_by);
     $this->_update_kontant_transactions($orderno, $uid, $amount);
     $kvit = kvitgetorderhead($orderno, $orderkey, '', '');
     $emailkvittering = kvitgetorderlines($orderno, $orderkey, $kvit['kvittering']);
     sendreceipt($emailkvittering, $orderno, $kvit['email'], $kvit['firstname'], $kvit['middlename'], $kvit['lastname']);
     $return = array();
     $return['orderno'] = $orderno;
     $return['amount'] = $amount;
     return $return;
 }
Пример #3
0
 function _createorder($uid, $producttype_id, $created_by, $quant, $date, $method, $division)
 {
     $neworder = createuniqueorderno($uid, 'kontant');
     // Create orderlines
     $orderno = $neworder['orderno'];
     $orderkey = $neworder['orderkey'];
     $price = $this->_getitemprice($division, $producttype_id);
     $amount = $quant * $price['price'];
     if ($price['error'] > '') {
         $status3 = 'priceerror';
     }
     $itemid = $price['id'];
     $vat_amount = 0;
     // To be handled elsewhere
     $this->_insertorderline($orderno, $orderkey, $uid, $itemid, $quant, $amount, $vat_amount, $created_by, $date, $status3);
     $this->_updateorderhead($orderno, $orderkey, $amount, $vat_amount, $status3, $method, $created_by);
     $return = array();
     $return['orderno'] = $orderno;
     $return['orderkey'] = $orderkey;
     return $return;
 }