public function create() { $all = Input::all(); $all['user_id'] = Auth::user()->id; $all['deposit_date'] = sqldate($all['deposit_date']); $all['amount'] = unformat_money($all['amount']); $all['status'] = 0; //Insert into database $created = Bankentry::create($all); $data['status'] = 'success'; $data['message'] = 'saved!'; return Response::json($data); }
public function save() { $r = Input::all(); $r['date'] = sqldate($r['date']); $r['amount'] = unformat_money($r['amount']); $r['user_id'] = Auth::user()->id; $r['status'] = User::permitted('role.admin') === true ? 1 : 0; //Insert into database $created = Expenditure::create($r); $data['status'] = 'success'; $data['message'] = 'Record saved successfully!'; return Response::json($data); }
public function create() { $all = Input::all(); $all['user_id'] = Auth::user()->id; $all['deposit_date'] = sqldate($all['deposit_date']); $all['amount'] = unformat_money($all['amount']); //Lets check if the current user is admin to determine the assigned status $all['status'] = User::permitted('role.admin') ? 1 : 0; //Insert into database $created = Bankentry::create($all); $data['status'] = 'success'; $data['message'] = 'saved!'; return Response::json($data); }
private function _update_costprice($product, $inputs) { $old_amount = $product->costprice; $product->costprice = $new = unformat_money($inputs['value']); $totalcostprice = $product->costprice * $product->quantity; //LOG STOCK $stocklog = new Stocklog(); $this->_stockLog($stocklog, $product); //SAVE USER STOCK ACTIVITY $brandLog = $product->brand->name; $productcatLog = $product->categories->name; $log['products'] = "[ {$brandLog} / {$productcatLog} ] = <b class='orange'>" . $product->name . '</b>'; $log['stocktype'] = 'costprice'; $log['amount'] = currency() . format_money($new) . 'k'; $log['old_amount'] = currency() . format_money($old_amount) . 'k'; $this->_saveActivityLog($log); //Ajax response return $ajax['costprice'] = format_money($product->costprice); $ajax['totalcostprice'] = format_money($totalcostprice); $ajax['status'] = 'success'; return $ajax; }
curl_setopt($curl, CURLOPT_URL,$url); curl_setopt($curl, CURLOPT_POST, count($fields)); curl_setopt($curl, CURLOPT_POSTFIELDS, $fields_string); $html = curl_exec ($curl); curl_close ($curl); */ $url = "http://query.nictusa.com/cgi-bin/cancomsrs/?_12+COM+MN"; $html = scraperwiki::scrape($url); // Parse Dom $dom = new simple_html_dom(); $dom->load($html); $count = 0; // There is only one table with no identifiying attributes. foreach ($dom->find("table tbody tr") as $rows) { $count++; // First row is header $data = $rows->find("td"); if ($count > 1) { // Massage $link = $data[0]->find('a', 0); $href = isset($link->href) ? 'http://query.nictusa.com' . $link->href : ''; $committee = ''; if ($href) { $ex = explode('+', $href); $committee = $ex[1]; } // Create record $record = array('id' => md5(trim($data[0]->plaintext)), 'name' => ucwords(strtolower($data[0]->plaintext)), 'link' => $href, 'committee' => $committee, 'receipts' => unformat_money($data[1]->plaintext), 'distributed' => unformat_money($data[2]->plaintext), 'cash' => unformat_money($data[3]->plaintext), 'debt' => unformat_money($data[4]->plaintext), 'through' => trim($data[5]->plaintext) ? date('Y-m-d', strtotime($data[5]->plaintext)) : '', 'timestamp' => time()); scraperwiki::save(array('id'), $record); } }