public function addToBasket(Request $request) { $array = $request->input('prod_id'); $array2 = json_decode($array); if (!\Session::has('product8')) { \Session::put('product8.' . $array2[0], $array2[0]); \Session::put('product8.' . $array2[0] . '.kolvo', 1); \Session::put('product8.' . $array2[0] . '.img', $array2[1]); \Session::put('product8.' . $array2[0] . '.title', $array2[2]); \Session::put('product8.' . $array2[0] . '.content', $array2[3]); \Session::put('product8.' . $array2[0] . '.price', $array2[4]); if (!\Session::has('addToBasket')) { \Session::put('addToBasket', 1); // общий счетчик товара } } else { if (!array_key_exists($array2[0], \Session::get('product8'))) { $kol = \Session::get('addToBasket'); \Session::put('addToBasket', $kol + 1); \Session::put('product8.' . $array2[0], $array2[0]); \Session::put('product8.' . $array2[0] . '.kolvo', 1); \Session::put('product8.' . $array2[0] . '.img', $array2[1]); \Session::put('product8.' . $array2[0] . '.title', $array2[2]); \Session::put('product8.' . $array2[0] . '.content', $array2[3]); \Session::put('product8.' . $array2[0] . '.price', $array2[4]); } } return \Session::get('addToBasket'); }
private function autoLogin() { try { if (\Session::has('userID')) { } else { //try set session from cookies if no session if (!empty(\Cookie::get('userID'))) { $field = array('field' => '_id', 'value' => (string) \Cookie::get('userID')); if (Auth::isExists($field)) { \Session::put('userID', \Cookie::get('userID')); // //return \Response::make()->withCookie(\Cookie::make('userID', \Cookie::get('userID') , self::COOKIE_EXPIRE)); } else { throw new AuthCheckException('username', 'auth.username.doesnt.exist'); } } else { //\Session::forget('userID')->withCookie(\Cookie::forget('userID'))->withCookie(\Cookie::forget('userID')); throw new AuthCheckException('userid', 'auth.userid.doesnt.exist'); } } } catch (Exception $e) { $return = \Response::json(["message" => "Session logout!"], 400); \Session::forget('userID'); return $return->withCookie(Cookie::forget('userID'))->withCookie(Cookie::forget('userID')); } }
/** * show and handle input page * * @author My Vo * * @return \Illuminate\View\View */ public function input(Prj02FormR5 $prj02FormR5) { $this->checkSession($this->catalogItem); // Get array catalog item in select page $dct = $this->getCatalogItem(); // check dct $count = count(array_intersect($dct, \Session::get('distinct'))); $min = \Config::get('constants.MIN_CATALOG'); if ($count > 1 || count($dct) < $min) { \Session::forget('dct'); return redirect()->route('owner-select')->withErrors(['dct' => '選択カタログは']); } \Session::put('cat_item', $this->catalogItem); $platFormID = $prj02FormR5->platform; if (!\Session::has('id')) { \Session::put('id', $platFormID); } \Session::put('dct', $dct); $form = \Helper::getFormTable($this->catalogItem); // Generate file name for model $file_name = $prj02FormR5->platformName; \Helper::catalogLoad($platFormID, $file_name); $catalogList = $file_name . $platFormID . 'List'; // Get old input $info_input = array(); if (\Session::has('info_input')) { $info_input = \Session::get('info_input'); } return view('pages.default.catalog.r5.input', ['catalogItem' => $this->catalogItem, 'dct' => $dct, 'id' => $platFormID, 'form' => $form, 'catalogList' => $catalogList, 'info_input' => $info_input]); }
public function index() { if (\Session::has("clientid")) { $clientid = \Session::get("clientid"); $data = array(); $ts = strtotime(date("d.m.Y h:m:i")); $params["dt_start"] = date("01.m.Y"); $params["dt_end"] = date("d.m.Y"); $query = "SELECT count(DISTINCT a.FOLDERNO) as CNT, count(c.ID) as CNT2 FROM FOLDERS a INNER JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PANELS c ON c.ID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "'"; $res = $this->DBquery->query($query); foreach ($res as $row) { $row = (array) $row; $data["COUNT"]["FOLDERS"] = $row['CNT']; $data["COUNT"]["PANELS"] = $row['CNT2']; } $query = "SELECT sum(d.COST) AS CNT FROM FOLDERS a LEFT JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PRICES d ON d.PANELID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "' AND d.PRICELISTID = a.PRICELISTID AND a.PRICELISTID IS NOT NULL"; $res = $this->DBquery->query($query); foreach ($res as $row) { $row = (array) $row; foreach ($row as $k => $v) { if ($k == 0) { if ($v == null) { $data["COUNT"]["SUMM"] = "N/A"; } else { $data["COUNT"]["SUMM"] = $v . " руб."; } } } } return \View::make('stat')->with(['params' => $params, 'ts' => $ts, 'data' => $data]); } else { return \View::make('mainPage'); } }
public function show_tree($id) { try { // check this guy exist or not $result = array(); $r = DB::table('persons')->where('person_id', '=', $id)->where('deleted_flag', '=', false)->first(); if (count($r) == 0) { $result['Info']['status'] = "Complete"; $result['Info']['message'] = "No Person Found"; return response()->json($result, 200); } $result['Info']['status'] = "Complete"; $result['Info']['message'] = "Found"; if (\Session::has('focused_id')) { \Session::set('focused_id', $id); } else { \Session::put('focused_id', $id); } $this->list[] = $r->person_id; // Let's fill personal information to id array list. $result = $this->adjustArrayForTree($result, 10); //$result = $this->remove_NonRelevance($result, $id); //$result = $this->sortTree($result); return response()->json($result, 200); } catch (Exception $e) { $result['status'] = "Error"; $result['message'] = $e; return response()->json($result, 200); } }
public function __construct() { if (\Session::has('tempuser.token')) { } else { //dd(\Session::has('tempuser.token')); throw new AuthCheckException('base', 'invalid session'); } }
public function getLogout() { if (\Session::has('UserID')) { \Session::forget('UserID'); } $this->auth->logout(); return redirect(url('/user/login')); }
public function error403() { $error = null; if (\Session::has('error')) { $error = \Session::get('error'); } return response(view("errors.403", compact('error')), 403); }
public function delete($id) { if (\Session::has('product8')) { \Session::forget('product8.' . $id); $kol = \Session::get('addToBasket'); \Session::forget('addToBasket', $kol - 1); } return redirect('basket'); }
public function sessionFilter() { if (Session::has('account')) { if (Session::get('login-date') != date("Ymd")) { $this->export(413); die; } } else { Session::set('account', array('uid' => 1)); Session::set('login-date', date("Ymd")); } }
public function delete_ads($id) { if (\Session::has('tempuser.token')) { if ($id) { DB::delete("delete from advertisements where adv_id = '" . $id . "' "); return \Redirect::route('table'); } else { return "Error! no id!"; } } else { return \Redirect::route('login'); } }
public function getVisuri(Request $req) { $sort = $req->input('sort', null); $query = Dream::orderBy('created_at'); if (!is_null($sort)) { $query->orderBy($sort); \Session::put('dreams_sort', $sort); } elseif (\Session::has('dreams_sort')) { $query->orderBy(\Session::get('dreams_sort')); } $data['models'] = $query->paginate($this->pageSize); return view('administration.visuri', $data); }
public function getVisuri(Request $req) { $sort = $req->input('sort', null); $week = $req->input('week', null); $page = $req->input('page', 0); date_default_timezone_set('Europe/Bucharest'); $startDate = new Carbon(\Config::get('constants.start_date')); $currentDate = Carbon::now(); $endDate = $currentDate; $daysDiff = $currentDate->diff($startDate)->days; $weeksDiff = floor($daysDiff / 7); if (is_null($week)) { $week = $weeksDiff; } if (is_numeric($week) && $week < $weeksDiff) { $startDate->addWeeks($week); $endDate = $startDate->copy(); $endDate->addWeek()->subDay(); } else { if ($weeksDiff > 0) { $startDate->addWeeks($weeksDiff); } } $query = Dream::with('user'); $query = Dream::whereBetween('approved_at', [$startDate, $endDate]); $totalPages = $query->count() / $this->pageSize; if (is_numeric($page) && $page > 0 && $page <= $totalPages) { $query->skip($page * $this->pageSize); } if (!is_null($sort)) { \Session::put('dreams_sort', $sort); } if (\Session::has('dreams_sort')) { $sort = \Session::get('dreams_sort'); switch ($sort) { case 'approved_at': $data['models'] = $query->orderBy($sort, 'ASC')->take($this->pageSize)->get(); break; case 'votes': $data['models'] = $query->orderBy($sort, 'DESC')->take($this->pageSize)->get(); break; } } else { $data['models'] = $query->take($this->pageSize)->get(); } $data['totalPages'] = $totalPages; $data['totalWeeks'] = $weeksDiff; $data['currentWeek'] = $week ? $week : $weeksDiff; $data['currentPage'] = $page; return view('visuri', $data); }
public function index() { $f = new FuncControllers(); if (!\Session::has('clientid')) { return \View::make('main'); } else { // if ($f->isOwner(\Input::get("folderno"), \Session::get('clientid'))) { $f->do_dellfolderno(\Input::get("folderno")); //return redirect('main'); // } else { return redirect('http://nacpp.info/main'); // echo "fail"; // } } }
public function anyInput($catalogItem, Prj02Catalog $prj02Catalog) { $this->checkSession($catalogItem); $flag = $this->selectDefault($catalogItem); \Session::put('cat_item', $catalogItem); // Get array catalog item in select page $dct = $this->getCatalogItem(); // Check array catalog $number = count($dct); if ($number <= \Config::get('constants.MAX_CATALOG') && $number >= \Config::get('constants.MIN_CATALOG')) { $platFormID = $prj02Catalog->platform; if (!\Session::has('id')) { \Session::put('id', $platFormID); } \Session::put('dct', $dct); $form = \Helper::getFormTable($catalogItem); // Generate file name for modal $file_name = $prj02Catalog->platformName; \Helper::catalogLoad($platFormID, $file_name); $catalogList = $file_name . $platFormID . 'List'; //get infomation dct foreach ($dct as $item) { $arrDctInfo[] = \Cache::get($catalogList)[$item]; } // Get old input $info_input = array(); if (\Session::has('info_input')) { $info_input = \Session::get('info_input'); } $path = null; $view = 'input'; if ($form == 'input-r2') { $path = 'r2'; $view = 'input-r2'; } return view('pages.default.catalog.' . $path . '.' . $view, ['catalogItem' => $catalogItem, 'dct' => $dct, 'id' => $platFormID, 'form' => $form, 'catalogList' => $catalogList, 'info_input' => $info_input, 'flag' => $flag, 'panel' => $this->checkVisualArea($catalogItem), 'arrDctInfo' => $arrDctInfo]); } return redirect()->route('catalog-select', compact('catalogItem'))->withErrors(['dct' => '選択カタログは、1個から3個の間で指定してください。']); }
public function store(Request $request) { $user = \Helper::getUser(); $customer = \Helper::getCustomer(); if ($customer->is_registered) { return '请勿重复注册'; } $validator = \Validator::make($request->all(), ['phone' => 'required|digits:11|unique:customers,phone,' . $customer->id, 'code' => 'required|digits:6']); if ($validator->fails()) { return redirect()->back()->withErrors($validator)->withInput(); } if ($request->input('code') != $customer->auth_code || $request->input('code') == '000000') { return redirect()->back()->with('error_message', '验证码不匹配!')->withInput(); } if (Carbon::now()->diffInMinutes($customer->auth_code_expire) > 0) { return redirect()->back()->with('error_message', '验证码过期!')->withInput(); } $beans_total_update = 0; if ($customer->beans_total > 0) { $beans_total_update = $customer->beans_total; } $customer->update(['phone' => $request->input('phone'), 'is_registered' => true, 'beans_total' => $beans_total_update, 'nickname' => $user['nickname'], 'head_image_url' => $user['headimgurl'], 'qr_code' => \Wechat::getForeverQrCodeUrl($customer->id)]); if ($ci = CustomerInformation::where('phone', '=', $request->input('phone'))->first()) { $ci->customer_id = $customer->id; $ci->save(); } // $ret = $customer->register(); if ($customer->referrer_id) { // \BeanRecharger::invite($customer->getReferrer()); \Analyzer::updateBasicStatistics($customer->referrer_id, AnalyzerConstant::CUSTOMER_FRIEND); } \EnterpriseAnalyzer::updateBasic(AnalyzerConstant::ENTERPRISE_REGISTER); event(new Register($customer)); if (\Session::has('register_next_url')) { return redirect(\Session::get('register_next_url')); } return redirect('register/success'); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $startTime = microtime(true); $sId = \Session::get('currentSerie'); $series = loadSerieWithIdOrTitleAndExercise($sId, $id); if (empty($series)) { $series = loadSeriesWithExercise($id); if (count($series) == 1) { $sId = $series[0]->id; } elseif (count($series) > 1) { return view('series.duplicates', compact('series')); } else { flash()->error("Something went horribly wrong. Try reproducing the problem & notify the devs please...")->important(); return redirect('/'); } } elseif (count($series) == 1) { $sId = $series[0]->id; } elseif (count($series) > 1) { return view('series.duplicates', compact('series')); } else { flash()->error("Something went horribly wrong. Try reproducing the problem & notify the devs please...")->important(); return redirect('/'); } \Session::put('currentSerie', $sId); $exercise = loadExercise($id)[0]; if ($exercise->expected_result != "*") { $exercise->expected_result = null; } $result = null; $answer = null; if (\Session::has('result')) { $result = \Session::pull('result', ''); } if (\Session::has('answer')) { $answer = \Session::pull('answer', ''); } return view('exercises.show', compact('exercise', 'result', 'answer', 'sId', 'startTime')); }
/** * Store a newly created resource in storage. * Check, before buy * @return Response */ public function postCheckcart(Request $request) { if (\Auth::check()) { //MENU $mainMenu = Category::getParentMenu(); $allMenu = Category::getAllMenu($mainMenu); //HOT PRODUCTS. $hotProduct = Product::hotProduct(); //DISCOUNT PRODUCTS. $discountProduct = Product::discountProduct(); //PAY $pay = Pay::find($request->get('pay')); if ($request->get('pay') == 2) { $account_number = true; } else { $account_number = false; } //SHIP $ship = Ship::find($request->get('ship')); if (\Session::has('giohang')) { \Session::put('pay', $pay->id); \Session::put('ship', $ship->id); return view('fornindex.shopping_cart_detail', compact('account_number', 'ship', 'pay', 'data', 'allMenu', 'hotProduct', 'discountProduct')); } else { echo 'vui long chon san pham!!!'; } } else { return redirect('auth/login'); } }
/** * TODO: I need a comment * @param [type] $id [description] * @return [type] [description] */ public function showCreatePhotoAndVideo($id) { // TODO: How we upload images will be different, need that before implementing // Instantiate the APIHelper $api = new \App\Helpers\ApiHelper(); $url = 'events/' . $id; if (\Auth::check()) { $url .= '?auth_user_id=' . \Auth::user()->id; } // Show event associated the ID. $event = $api->index($url); // $photos = $event->photos(); return \View::make('events.create_photo_and_video')->with(['step' => 'photo_and_video', 'stepsLocked' => false, 'event' => $event['data']['event'], 'photos' => $event['data']['event']['photos'], 'justUploaded' => \Session::has('just_uploaded')]); }
/** * Get catalog item form select or session * * @author Dung Le * * @return arrary $catalogItem */ private function getCatalogItem() { $dct = []; switch (\Request::method()) { case 'GET': if (\Session::has('dct')) { $dct = \Session::get('dct'); } break; case 'POST': if (\Input::has('dct')) { $dct = \Input::get('dct'); } break; } return $dct; }
public function vendorProducts() { $products = array(); if (\Session::has(config('app.session_key_vendor'))) { $products = $this->dataAccess->getProductsByVendor(\Session::get(config('app.session_key_vendor')), ['id', 'published', 'name', 'pack', 'size', 'gtin', 'mpc'], true, 20); } return view('profile.products')->with('products', $products); }
public function getFinishOrder() { $tipos_pagos = TipoPago::all()->lists('descripcion', 'id'); $meses = ['01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12']; $anios = ['2016' => '2016', '2017' => '2017', '2018' => '2018', '2019' => '2019', '2020' => '2020']; if (\Session::has('orden_id')) { return view('cart.finish')->with(compact('tipos_pagos', 'meses', 'anios')); } return redirect()->to('home'); }
function back_button() { if (\Session::has('entry_date')) { \Session::forget('entry_date'); } $active = $this->check(); if ($active) { $Session = \Session::all(); //return view('Dashboard', compact('Session')); return \Redirect::to('dashboard'); } else { return \Redirect::to('login'); } }
public function getAgencyPaymentDone(Request $request) { if (!\Session::has('_temp_payment_sess')) { return redirect(url('agency'))->with('flashMessage', ['class' => 'danger', 'message' => 'Your session has expired, please try again.']); } $data = session('_temp_payment_sess'); $id = $request->get('paymentId'); $token = $request->get('token'); $payer_id = $request->get('PayerID'); $payment = PayPal::getById($id, $this->paypalApiContext); $paymentExecution = PayPal::PaymentExecution(); $paymentExecution->setPayerId($payer_id); $executePayment = $payment->execute($paymentExecution, $this->paypalApiContext); $agency = \Agency::getAgency(); try { switch ($data['type']) { case 'credit': \Agency::updateCredit($agency, $data['xCreditAmount']); break; case 'contract': \Agency::updateVIP($agency, true); break; default: break; } session(['_sess_agency' => ['model' => $agency]]); \Session::forget('_temp_payment_sess'); } catch (\Exception $e) { // TODO: Need better error handler // re-run try with queue? \Session::forget('_temp_payment_sess'); return redirect(url('agency'))->with('flashMessage', ['class' => 'danger', 'message' => $e->getMessage()]); } return redirect(url('agency'))->with('flashMessage', ['class' => 'success', 'message' => $data['successMessage']]); }
public function getHerhaling($slug, Webinar $w, Webinarherhaling $wh, Attendee $a) { $webinar = $w->where('slug', $slug)->first(); $hetwebinar = $webinar->webinarherhaling->first(); $webinardatum = $hetwebinar->herhaling_start_tijd; $webinareind = $hetwebinar->herhaling_eind_tijd; if (\Session::has('deattendee')) { $attendee = \Session::get('deattendee'); } else { $attendee = null; } if ($attendee === null) { return redirect()->action('WebinarController@getHerhalingLogin', array($hetwebinar->webinars->first()->slug))->with(['message' => 'Je moet je eerst aanmelden voordat je dit webinar mag bekijken!']); } else { return view('webinars.herhaling', compact('hetwebinar'))->with(['message' => 'Welkom bij ons webinar!']); } }
public function index() { if (\Session::has("clientid")) { $clientid = \Session::get("clientid"); } else { $clientid = null; } if (\Session::has("clientcode")) { $clientcode = \Session::get("clientcode"); } else { $clientcode = null; } define('REMOTE', 1); if (isset($_GET["action"])) { switch ($_GET["action"]) { case "label": if (Input::has("id")) { $folderno = htmlspecialchars(Input::get("id")); $guid = $this->GUID(); header('Content-Disposition: filename=' . $guid . '.pdf'); header('Content-Type: application/pdf'); if (\Session::has("username") && (\Session::get("username") == "TESTER" || \Session::get("username") == "POLYMED")) { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/label.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folderno' => $folderno), 'client-id' => $clientid); $json = $this->DBquery->getJsonMainListXSL($params); $obj = json_decode($json, true); echo base64_decode($obj["data"][0]["pdf"]); } else { echo "<h2>ERROR</h2>"; } break; case "act": if (isset($_GET["id"])) { $folderno = htmlspecialchars($_GET["id"]); $guid = $this->GUID(); header('Content-Disposition: filename=' . $guid . '.pdf'); header('Content-Type: application/pdf'); if (isset($_SESSION["username"]) && ($_SESSION["username"] == "TESTER" || $_SESSION["username"] == "POLYMED")) { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/act.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folderno' => $folderno), 'client-id' => $clientid); $json = $this->DBquery->getJsonMainListXSL($params); $obj = json_decode($json, true); echo base64_decode($obj["data"][0]["pdf"]); } else { echo "<h2>ERROR</h2>"; } break; /* case "reportlims": header('Content-Disposition: filename=' . $guid); header('Content-Type: application/pdf'); require_once('nreports/forms.php'); require_once('nreports/main.php'); $guid = GUID(); $tempdir = '/mnt/tmpfs/' . $guid; $oldmask=umask(0); mkdir($tempdir, 0777); chdir($tempdir); umask($oldmask); $fp = fopen($tempdir . '/report.tex', "w"); if(isset($_GET["folderno"])) { $sql = " WHERE f.folderno in (".$_GET["folderno"].")"; getSqlTex($sql, $fp); } fclose($fp); putenv("HOME=/home/daemon"); exec("export PATH=/bin:/usr/local/texlive/2013/bin/x86_64-linux; pdflatex report.tex"); $fp = fopen($tempdir.'/report.pdf', 'rb' ); fpassthru($fp); exec('rm -rf ' . $tempdir); break; */ /* case "reportlims": header('Content-Disposition: filename=' . $guid); header('Content-Type: application/pdf'); require_once('nreports/forms.php'); require_once('nreports/main.php'); $guid = GUID(); $tempdir = '/mnt/tmpfs/' . $guid; $oldmask=umask(0); mkdir($tempdir, 0777); chdir($tempdir); umask($oldmask); $fp = fopen($tempdir . '/report.tex', "w"); if(isset($_GET["folderno"])) { $sql = " WHERE f.folderno in (".$_GET["folderno"].")"; getSqlTex($sql, $fp); } fclose($fp); putenv("HOME=/home/daemon"); exec("export PATH=/bin:/usr/local/texlive/2013/bin/x86_64-linux; pdflatex report.tex"); $fp = fopen($tempdir.'/report.pdf', 'rb' ); fpassthru($fp); exec('rm -rf ' . $tempdir); break; */ case "viewreport": if (isset($_GET["id"])) { $folderno = htmlspecialchars($_GET["id"]); if (isset($_GET["upd"])) { $this->setPrinterFlag($folderno); } if (isset($_SESSION["username"]) && $_SESSION["username"] == "TESTER") { $port = "1029"; } else { $port = "1028"; } //if (isset($_GET["a5"])) $port = '1029'; $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/report.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folderno' => $folderno, 'client-id' => $clientid)); //if (isset($_GET["seal"])) $params['params']['seal'] = "1"; //if (isset($_GET["signature"])) $params['params']['signature'] = "1"; if (isset($_GET["logo"])) { $params['params']['logo'] = "1"; } if (isset($_GET["a5"])) { $params['params']['a5'] = "1"; } if (isset($_GET["seal"])) { $params['params']['nacpp-seal'] = "1"; } $json = $this->DBquery->getJsonMainListXSL($params); $obj = json_decode($json, true); if (isset($obj["status"]) && $obj["status"] == 'fail') { if (isset($obj["error_code"]) && isset($obj["message"])) { echo $obj["error_code"] . ": " . $obj["message"]; } } else { header('Content-Disposition: filename=report#' . $folderno . '.pdf'); header('Content-Type: application/pdf'); echo base64_decode($obj["data"][0]["pdf"]); } } else { echo "<h2>ERROR</h2>"; } break; case "viewmultiplereport": if (isset($_GET["ids"])) { $ids = explode(",", htmlspecialchars($_GET["ids"])); if (isset($_GET["upd"])) { foreach ($ids as $id) { $this->setPrinterFlag($id); } } $guid = $this->GUID(); header('Content-Disposition: filename=' . $guid . '.pdf'); header('Content-Type: application/pdf'); if (isset($_SESSION["username"]) && $_SESSION["username"] == "TESTER") { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:1028/api/report.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folders' => 'Array', 'client-id' => $clientid)); foreach ($ids as $k => $v) { $params['params']["folders[{$k}]"] = $v; } if (isset($_GET["logo"])) { $params['params']['logo'] = "1"; } $json = $this->getJsonMainList($params); $obj = json_decode($json, true); echo base64_decode($obj["data"][0]["pdf"]); } else { echo "<h2>ERROR</h2>"; } break; case "savexmlreport": if (isset($_GET["id"]) && $_GET["id"]) { $id = $_GET["id"]; header("Content-Disposition: attachment; filename=report#" . $id . ".xml"); header("Content-Type: text/xml"); if (isset($_SESSION["username"]) && $_SESSION["username"] == "TESTER") { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/integration/result.xml', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'orderno' => $id, 'fupdate' => 'N', 'client-id' => $clientid, 'clientcode' => \Session::get('clientcode'))); $data = $this->DBquery->getJsonMainListXSL($params); echo $data; } else { echo "<h2>ERROR</h2>"; } break; case "savereport": if (isset($_GET["id"])) { header("Pragma: public"); // required header('Expires: 0'); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Cache-Control: private', false); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="report#' . $_GET["id"] . '.pdf"'); header('Content-Transfer-Encoding: binary'); if (isset($_GET["id"])) { $folderno = htmlspecialchars($_GET["id"]); } else { exit; } if (isset($_GET["logo"])) { $logo = "1"; } else { $logo = "0"; } if (isset($_GET["signature"])) { $signature = "1"; } else { $signature = ''; } if (isset($_GET["seal"])) { $seal = "1"; } else { $seal = "0"; } if ($seal == "1") { if (isset($_SESSION["valid_user"]) && $_SESSION["valid_user"] == "TESTER") { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/report.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folderno' => $folderno, 'seal' => '1', 'client-id' => $clientid)); } else { if ($signature == "1") { if (isset($_SESSION["valid_user"]) && $_SESSION["valid_user"] == "TESTER") { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/report.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folderno' => $folderno, 'signature' => '1', 'client-id' => $clientid)); } else { if (isset($_SESSION["valid_user"]) && $_SESSION["valid_user"] == "TESTER") { $port = "1029"; } else { $port = "1028"; } $params = array('domain' => 'https://192.168.0.17:' . $port . '/api/report.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'folderno' => $folderno, 'client-id' => $clientid)); } } if (isset($_GET["seal"])) { $params['params']['nacpp-seal'] = "1"; } if (isset($_GET["logo"])) { $params['params']['logo'] = "1"; } $json = $this->getJsonMainList($params); $obj = json_decode($json, true); echo base64_decode($obj["data"][0]["pdf"]); } else { echo "<h2>ERROR</h2>"; } break; } } }
public function index() { if (\Input::has("clientid")) { $clientid = \Input::get("clientid"); } else { if (\Session::has("clientid")) { $clientid = \Session::get("clientid"); } else { $clientid = null; } } if (\Input::has("clientcode")) { $clientcode = \Input::get("clientcode"); } else { if (\Session::has("clientcode")) { $clientcode = \Session::get("clientcode"); } else { $clientcode = null; } } if (isset($_GET["mode"]) && $_GET["mode"] == '0') { $params = array('domain' => 'https://192.168.0.17:1028/api/cross_excel.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'client-id' => $clientcode, 'panel' => '5635', 'datefrom' => date('Y/m/d'), 'dateto' => date('Y/m/1'))); if (isset($_GET["datefrom"])) { $params["params"]["datefrom"] = date("Y/m/d", strtotime($_GET["datefrom"])); } if (isset($_GET["dateto"])) { $params["params"]["dateto"] = date("Y/m/d", strtotime($_GET["dateto"])); } $json = $this->DBquery->getJsonMainListXSL($params); $obj = json_decode($json, true); if (isset($obj["status"]) && $obj["status"] == 'fail') { if (isset($obj["error_code"]) && isset($obj["message"])) { echo $obj["error_code"] . ": " . $obj["message"]; } } else { header('Content-Disposition: filename=report-' . date("d-m-Y") . '.xls'); header('Content-Type: application/octet-stream'); echo base64_decode($obj["data"][0]["xls"]); } } else { $params = array('domain' => 'https://192.168.0.17:1028/api/excel.json', 'cookies' => 'cookies.txt', 'params' => array('api-key' => '5b2e6d61-1bea-4c8f-811e-b95a946a7e46', 'client-id' => $clientcode, 'panel' => '5635', 'datefrom' => '2014/09/24', 'dateto' => '2014/09/01')); if (isset($_GET["panel"])) { $params["params"]["panel"] = $_GET["panel"]; } if (isset($_GET["datefrom"])) { $params["params"]["datefrom"] = date("Y/m/d", strtotime($_GET["datefrom"])); } if (isset($_GET["dateto"])) { $params["params"]["dateto"] = date("Y/m/d", strtotime($_GET["dateto"])); } if (isset($_GET["appdat"])) { $params["params"]["appdat"] = '1'; } if (isset($_GET["doctor"])) { $params["params"]["doctor"] = '1'; } if (isset($_GET["insurer"])) { $params["params"]["insurer"] = '1'; } if (isset($_GET["organisation"])) { $params["params"]["organisation"] = '1'; } if (isset($_GET["regdat"])) { $params["params"]["regdat"] = '1'; } if (isset($_GET["doctorval"]) && !empty($_GET["doctorval"])) { $params["params"]["doctorval"] = rawurlencode(mb_convert_case($_GET["doctorval"], MB_CASE_UPPER, "UTF-8")); } if (isset($_GET["organisationval"]) && !empty($_GET["organisationval"])) { $params["params"]["organisationval"] = rawurlencode(mb_convert_case($_GET["organisationval"], MB_CASE_UPPER, "UTF-8")); } if (isset($_GET["folderapprsts"]) && $_GET["folderapprsts"] != '-1') { $params["params"]["folderapprsts"] = $_GET["folderapprsts"]; } if (isset($_GET["orderstatus"]) && $_GET["orderstatus"] != '-1') { $params["params"]["orderstatus"] = $_GET["orderstatus"]; } $json = $this->DBquery->getJsonMainListXSL($params); $obj = json_decode($json, true); if (isset($obj["status"]) && $obj["status"] == 'fail') { if (isset($obj["error_code"]) && isset($obj["message"])) { echo $obj["error_code"] . ": " . $obj["message"]; } } else { header('Content-Disposition: filename=report-' . date("d-m-Y") . '.xls'); header('Content-Type: application/octet-stream'); echo base64_decode($obj["data"][0]["xls"]); } } }
public function hechouka_Compra() { $empresas = Empresa::paginate(100); $directorio = Storage::disk('local'); if ($directorio->exists('file.txt')) { $directorio->delete('file.txt'); } foreach ($empresas as $item) { $fila = $item->id . "\t" . $item->name; Storage::disk('local')->append('file.txt', $fila); } // dd($array); dd("ok"); // $rango1=[1,2,3,5]; // $rango2=[4,7,8,9,10,11,13]; // $rango3=[4,7,8,9,10,13]; if (\Session::has('id_empresa')) { $miscompras = Compras_Ventas::miscompras(\Session::get('id_empresa'))->get(); $array_compras = json_decode($item); if ($array_compras != []) { $cont = 0; foreach ($miscompras as $item) { while ($cont <= 15000) { $tipo_registro = 2; $ruc = $this->dividirCodigo($item->gov_code)[0]; $dv = $this->dividirCodigo($item->gov_code)[1]; $nombre = $item->name; $tipo_documento = 1; $timbrado = $item->invoice_code; $numero_documento = $item->invoice_number; $fecha = date_format($item->invoice_date, 'd/m/Y'); $mismontos = Comercial_invoice_iva::getMontoIva($item->id)->get(); $monto_10 = 0; $iva_10 = 0; $monto_5 = 0; $iva_5 = 0; $monto_e = 0; foreach ($mismontos as $item1) { if ($item1->vat_id == 1) { $monto_10 = intval($item1->value); $iva_10 = intval($monto_10 * 0.1); } else { if ($item1->vat_id == 2) { $monto_5 = intval($item1->value); $iva_5 = intval($monto_10 * 0.05); } else { $monto_e = intval($item1->value); } } } $tipo_operacion = 0; $condicion = 1; if ($item->payment_condition == 1) { $condicion = 2; } $cantidad_cuotas = $item->cuotas; $detalle = $tipo_registro . "\t" . $ruc . "\t" . $dv . "\t" . $nombre . "\t" . $timbrado . "\t" . $tipo_documento . "\t" . $numero_documento . "\t" . $fecha . "\t" . $monto_10 . "\t" . $iva_10 . "\t" . $monto_5 . "\t" . $iva_5 . "\t" . $monto_e . "\t" . $tipo_operacion . "\t" . $condicion . "\t" . $cantidad_cuotas; $cont++; } } } } }
public function __construct() { if (!\Session::has('cart')) { \Session::put('cart', array()); } }
public function index() { global $f; $f = new FuncControllers(); $bio = array("54.100", "54.105", "54.335", "54.120", "54.440", "54.445", "54.130", "54.110", "54.115", "54.420", "54.125", "54.185", "54.205", "54.210", "54.215", "54.220", "54.225", "54.151", "54.206", "54.230", "54.265", "54.250", "54.255", "54.260", "54.245", "54.130", "54.300"); if (\Session::has("clientid")) { $this->clientid = \Session::get("clientid"); } if (Input::has("folderno")) { $this->folderno = Input::get("folderno"); } $exc = array("37", "95", "169", "199", "266", "284", "285", "301", "320", "324", "328", "329", "332", "370", "380", "382", "389", "397", "405", "407", "440", "93", "327", "1327", "345", "346", "387", "70"); $debug = 0; if (Input::has("delete")) { if (Input::has("panels")) { $p = substr($_GET["panels"], 0, -1); $p = explode(";", $p); foreach ($p as $panel) { $vsql = "EXECUTE PROCEDURE DEL_PANEL ('" . m_quotes($_GET["folderno"]) . "', '" . m_quotes($panel) . "', 'LIMS')"; $stmt = $this->DBquery->query($vsql); if ($stmt === false) { echo "Error in executing query.</br>"; } else { echo "<b>Панель была успешно удалена из заявки.</b>"; } } } else { $vsql = "EXECUTE PROCEDURE DEL_PANEL ('" . $f->m_quotes($_GET["folderno"]) . "', '" . $f->m_quotes($_GET["panel_id"]) . "', 'LIMS')"; $stmt = $this->DBquery->query($vsql); if ($stmt === false) { echo "Error in executing query.</br>"; } else { echo "<b>Панель была успешно удалена из заявки.</b>"; } } } else { if (\Input::has("save")) { if (Input::has("panels")) { $panels = $f->m_quotes(substr(Input::get('panels'), 0, -1)); } if (Input::has("surname")) { $surname = $f->strtoupper_utf8($f->m_quotes(Input::get("surname"))); // $surname = preg_replace("/([\s\x{0}\x{0B}]+)/i", " ", trim($surname)); } if (Input::has("name")) { $name = $f->strtoupper_utf8($f->m_quotes(Input::get("name"))); // $name = preg_replace("/([\s\x{0}\x{0B}]+)/i", " ", trim($name)); } if (Input::has("namepatr")) { $namepatr = $f->strtoupper_utf8($f->m_quotes(Input::get("namepatr"))); // $namepatr = preg_replace("/([\s\x{0}\x{0B})+)/i", " ", trim($namepatr)); } else { $namepatr = ''; } if (Input::has("doctor")) { $doctor = $f->strtoupper_utf8($f->m_quotes(Input::get("doctor"))); } else { $doctor = ''; } if (Input::has("policy")) { $policy = $f->strtoupper_utf8($f->m_quotes(Input::get("policy"))); } else { $policy = ''; } if (Input::has("insurer")) { $insurer = $f->strtoupper_utf8($f->m_quotes(Input::get("insurer"))); } if (!isset($insurer) || $insurer == "") { $insurer = "N/A"; } if (Input::has("insurerid")) { $insurerid = $f->strtoupper_utf8($f->m_quotes(Input::get("insurerid"))); } if (isset($insurerid) && $insurerid == "") { $insurerid = "6"; } if (Input::has("gender")) { $gender = $f->m_quotes(Input::get("gender")); switch ($gender) { case -1: $gender = ""; break; case 1: $gender = "M"; break; case 2: $gender = "F"; break; } } else { $gender = ''; } if (Input::has("cito")) { $cito = $f->m_quotes(Input::get("cito")); } else { $cito = ''; } if (Input::has("preg")) { $pregnancy = $f->m_quotes(Input::get("preg")); } else { $pregnancy = ''; } switch ($pregnancy) { case -1: $pregnancy = ""; break; } if (Input::has("phase")) { $phase = $f->m_quotes(Input::get("phase")); switch ($phase) { case "-1": $phase = ""; break; } } else { $phase = ''; } if (Input::has("dt_bday")) { $dt_bday = $f->m_quotes(date("Y/n/j", strtotime(Input::get("dt_bday")))); } else { $dt_bday = ''; } if (Input::has("comments")) { $comments = $f->m_quotes(Input::get("comments")); } else { $comments = ''; } if (Input::has("dt_catched")) { $dt_take = $f->m_quotes(date("Y/n/j G:i", strtotime(Input::get("dt_catched")))); } else { $dt_take = ''; } if (Input::has("diagnosis")) { $diagnosis = $f->m_quotes(Input::get("diagnosis")); } else { $diagnosis = ''; } if (Input::has("phone")) { $phone = $f->m_quotes(Input::get("phone")); } else { $phone = ''; } if (Input::has("diuresis")) { $diuresis = $f->m_quotes(trim(Input::get("diuresis")) * 1.0); } else { $diuresis = ''; } if (Input::has("antibio")) { $antibiot = "Y"; if (Input::has("antibiotics")) { $antibiotics = $f->m_quotes(Input::get("antibiotics")); } else { $antibiotics = ''; } if (Input::has("dt_biostart")) { $dt_biostart = $f->m_quotes(date("Y/n/j", strtotime(Input::get("dt_biostart")))); } else { $dt_biostart = ''; } if (Input::has("dt_bioend")) { $dt_bioend = $f->m_quotes(date("Y/n/j", strtotime(Input::get("dt_bioend")))); } else { $dt_bioend = ''; } } else { $antibiot = ''; $antibiotics = ''; $dt_biostart = ''; $dt_bioend = ''; } if (Input::has("passport_series")) { $passport_series = $f->m_quotes(Input::get("passport_series")); } else { $passport_series = ''; } if (Input::has("passport_number")) { $passport_number = $f->m_quotes(Input::get("passport_number")); } else { $passport_number = ''; } if (Input::has("email")) { $email = $f->m_quotes(Input::get("email")); } else { $email = ''; } if (Input::has("department")) { $department = $f->m_quotes(Input::get("department")); } else { $department = ''; } if (Input::has("address")) { $address = $f->m_quotes(Input::get("address")); } else { $address = ''; } if (Input::has("weight")) { $weight = $f->m_quotes(Input::get("weight")); } else { $weight = ''; } if (Input::has("height")) { $height = $f->m_quotes(Input::get("height")); } else { $height = ''; } if (Input::has("tube")) { $tube = $f->m_quotes(Input::get("tube")); } else { $tube = ''; } if (Input::has("glass")) { $glass = $f->m_quotes(Input::get("glass")); } else { $glass = ''; } if (Input::has("card")) { $card = $f->m_quotes(Input::get("card")); } else { $card = ''; } if (Input::has("aisorder") && trim(Input::has("aisorder")) !== '') { $aisorder = $f->m_quotes(Input::get("aisorder")); } else { $aisorder = $this->folderno; } if (Input::has("organisation")) { $organisation = $f->m_quotes(Input::get("organisation")); } else { $organisation = ''; } //if($organisation == "") $organisation = 'null'; $a = $cito . "|" . $surname . "|" . $name . "|" . $namepatr . "|" . $gender . "|" . $dt_take . "|" . $dt_bday . "|" . $phase . "|" . $pregnancy . "|" . $this->clientid . "|" . $doctor . "|" . $policy . "|" . $insurer . "|" . $diagnosis . "|" . $address . "|" . $comments . "|" . $tube . "|" . $phone . "|" . $email . "|" . $passport_series . "|" . $passport_number . "|" . \Session::get("valid_user") . "|" . date("d.m.Y H:i") . "|" . $this->folderno; $f->writeFoldersAudit($a); $vsql = "update folders set CARD = '" . $card . "', URGENT = '" . $cito . "', SURNAME = '" . $surname . "', NAME = '" . $name . "', PATRONIMIC = '" . $namepatr . "', GENDER = '" . $gender . "', DATE_COLLECTED = '" . $dt_take . "', DATE_BIRTH = '" . $dt_bday . "', PHASE = '" . $phase . "', PREGNANCY = '" . $pregnancy . "', CLIENTID = " . $this->clientid . ", DOCTOR = '" . $doctor . "', POLICY = '" . $policy . "', INSURER = '" . $insurer . "', DIURESIS = '" . $diuresis . "', DIAGNOSIS = '" . $diagnosis . "', ANTIB = '" . $antibiot . "', ANTIBIOTICS = '" . $antibiotics . "', ANTIB_START = '" . $dt_biostart . "', ANTIB_END = '" . $dt_bioend . "', ADDRESS = '" . $address . "', COMMENTS = '" . $comments . "', GLASS = '" . $glass . "', TUBE = '" . $tube . "', PHONE = '" . $phone . "', EMAIL = '" . $email . "', WEIGHT = '" . $weight . "', HEIGHT = '" . $height . "', PASSPORT_SERIES = '" . $passport_series . "', PASSPORT_NUMBER = '" . $passport_number . "', DEPARTMENT = '" . $department . "', ORGANISATION = '" . $organisation . "', AISORDER = '" . $aisorder . "' WHERE FOLDERNO = '" . $this->folderno . "'"; $vsql = str_replace("''", "null", $vsql); $stmt = $this->DBquery->query($vsql); if ($stmt === false) { echo "Error in executing query.</br>"; } $_panels = explode(",", $panels); foreach ($_panels as $panel) { $vsql = "EXECUTE PROCEDURE ADD_PANEL ('" . $this->folderno . "', '" . $panel . "', 'LIMS')"; $stmt = $this->DBquery->query3($vsql); $stmt = (array) json_decode($stmt); if (!$stmt['status'] == "success") { echo "Error in executing query.</br>"; } if (Input::has(str_replace(".", "_", $panel))) { $vsql = "select fc.id from foldercontainers fc inner join orders ord on ord.folderno = fc.folderno " . "inner join ordtask o on o.containerid = fc.id and ord.id = o.ordersid " . "inner join panels p on p.id = ord.panelid " . "where fc.folderno ='" . $this->folderno . "' AND p.code = '" . $panel . "'"; $stmt = $this->DBquery->query($vsql); if ($stmt === false) { echo "Error in executing query.</br>"; } $row = $stmt[0]; $row = (array) $row; $vsql = "update foldercontainers set mattypeid = '" . Input::get(str_replace(".", "_", $panel)) . "' WHERE id = '" . $row[0] . "'"; $stmt = ib_query($vsql); if ($stmt === false) { echo "Error in executing query.</br>"; } } } if ($debug == 1) { echo "-------------- ОТЛАДОЧНАЯ ИНФОРМАЦИЯ --------------<br/>"; echo "Дата сбора: " . $dt_take . "<br/>"; echo "Фамилия: " . $surname . "<br/>"; echo "Имя: " . $name . "<br/>"; echo "Отчество: " . $namepatr . "<br/>"; echo "Доктор: " . $doctor . "<br/>"; echo "Полис: " . $policy . "<br/>"; echo "Страховая: " . $insurerid . "<br/>"; echo "Пол: " . $gender . "<br/>"; echo "Срочность: " . $cito . "<br/>"; echo "Срок беременности: " . $pregnancy . "<br/>"; echo "Фаза: " . $phase . "<br/>"; echo "Дата рождения: " . $dt_bday . "<br/>"; echo "Комментарий: " . $comments . "<br/>"; echo "Диагноз: " . $diagnosis . "<br/>"; echo "Телефон: " . $phone . "<br/>"; echo "Диурез: " . $diuresis . "<br/>"; echo "Антибиотики начало: " . $dt_biostart . "<br/>"; echo "Антибиотики конец: " . $dt_bioend . "<br/>"; echo "Серия паспорта: " . $passport_series . "<br/>"; echo "Номер паспорта: " . $passport_number . "<br/>"; echo "E-mail: " . $email . "<br/>"; echo "Препарат: " . $antibiotics . "<br/>"; echo "Отделение: " . $department . "<br/>"; echo "Адрес: " . $address . "<br/>"; echo "КОД ЛПУ: " . $this->clientid . "<br/>"; echo "ПАНЕЛИ: " . $panels . "<br/>"; echo "Вес: " . $weight . "<br/>"; echo "Рост: " . $height . "<br/>"; echo "-------------- ОТЛАДОЧНАЯ ИНФОРМАЦИЯ --------------<br/><br/>"; } echo "<script>\$('#folderno').html('" . $this->folderno . "');</script>"; echo "<img style=\"vertical-align: inherit; padding-right: 15px; margin:0px; border:0\" src=\"images/ok.jpg\" /><b>Ваши изменения были успешно сохранены</b>"; } else { $this->editReg(); // var_dump($this->arr); // var_dump($this->rowf); return \View::make('regEdit')->with(['folderno' => $this->folderno, 'rowf' => $this->rowf, 'arr' => $this->arr]); } } }