Example #1
0
 public function checkLogin(Request $request)
 {
     $agent = new MeaAgent();
     $data = array("session_id" => Session::getId(), "username" => $request->input('username'), "pwd" => $request->input('password'), "os" => $agent->platform(), "browser" => $agent->browser(), "ip_address" => $request->ip(), "access_channel" => $agent->access_channel(), "device_id" => "", "device_os" => $agent->platform());
     $curl = new Curl('Login', $data);
     $result_login = $curl->getResult();
     $retError = "";
     if ($result_login->errCode != 0) {
         switch ($result_login->errCode) {
             case 1:
                 $retError = "ท่านระบุรหัสผู้ใช้งานไม่ถูกต้อง";
                 break;
             case 2:
                 $retError = "ท่านระบุรหัสผ่านไม่ถูกต้อง";
                 break;
             case 7706:
                 $retError = "รหัสผู้ใช้งานของท่านไม่ได้รับอนุญาตให้เข้าใช้งานระบบ กรุณาติดต่อผู้ดูแลระบบ";
                 break;
             case 7707:
                 $retError = "ท่านไม่สามารถเข้าใช้งานระบบได้ เนื่องจากท่านได้ลาออกจากสมาชิกกองทุน เมื่อวันที่ " . get_date_notime($result_login->leave_fund_group_date) . " หากต้องการรายละเอียดเพิ่มเติม กรุณาติดต่อกองทุนสำรองเลี้ยงชีพ";
                 break;
             default:
                 $retError = 'The email or password you entered is incorrect.';
                 break;
         }
         // login fail
         return redirect()->to('login')->withErrors([$retError]);
     } else {
         if ($result_login->result[0]->first_login_flag == "0") {
             //echo "asdasd" . $result_login->result[0]->first_login_flag;
             //                session(['first_emp_id' => $filter1]);
             return redirect()->to('firstlogin')->with('emp_id', $result_login->result[0]->emp_id);
         } else {
             // logged in
             session(['logged_in' => true, 'user_data' => $result_login->result[0], 'access_channel' => 'frontend']);
             // echo  "hello";
             return redirect()->intended('/profile');
         }
     }
 }
 public function ajax_report_search_export()
 {
     //        window.location.href =  "report1/exportsearch?EmpID=" + EmpID +"&depart=" + depart + "&plan=" + plan + "&date_start" + "&date_end=" + date_end;
     //        Input::get("param");
     $ArrParam = array();
     $ArrParam["pagesize"] = "";
     $ArrParam["PageNumber"] = "";
     $ArrParam["emp_id"] = Input::get("EmpID");
     $ArrParam["depart"] = Input::get("depart");
     $ArrParam["plan"] = Input::get("plan");
     $ArrParam["date_start"] = Input::get("date_start");
     $ArrParam["date_end"] = Input::get("date_end");
     $ArrParam["check_name"] = Input::get("check_name");
     $ArrParam["check_depart"] = Input::get("check_depart");
     $ArrParam["check_plan"] = Input::get("check_plan");
     $ArrParam["check_date"] = Input::get("check_date");
     // $sql2 = "SELECT TOP  5 * FROM  TBL_MEMBER_BENEFITS WHERe EMP_ID = '".get_userID()."' ORDER BY RECORD_DATE ASC";
     $data = $this->DataSource($ArrParam, true, false);
     $results = array();
     foreach ($data as $item) {
         //            $item->filed1 = 'some modification';
         //            $item->filed2 = 'some modification2';
         $results[] = (array) $item;
         // $results[5] = get_date_notime($item->modify_new);
         #or first convert it and then change its properties using
         #an array syntax, it's up to you
     }
     Excel::create('ExcelExport', function ($excel) use($results, $ArrParam) {
         $excel->sheet('Sheetname', function ($sheet) use($results, $ArrParam) {
             //format
             //                $sheet->setColumnFormat(array(
             //                    'D' => '0.00',
             //
             //                ));
             //
             // first row styling and writing content
             $sheet->mergeCells('A1:D1');
             $sheet->mergeCells('A2:D2');
             $sheet->mergeCells('A3:D3');
             $sheet->row(1, function ($row) {
                 $row->setFontFamily('Comic Sans MS');
                 $row->setFontSize(20);
                 $row->setAlignment('center');
             });
             $sheet->row(2, function ($row) {
                 $row->setAlignment('center');
             });
             $sheet->row(3, function ($row) {
                 $row->setAlignment('center');
             });
             $sheet->row(1, array('รายงานข้อมูลสมาชิกที่พ้นสภาพสมาขิก'));
             if ($ArrParam["check_date"] == "true" && $ArrParam["date_start"] != "" && $ArrParam["date_end"] != "") {
                 $sheet->row(2, array('ในช่วงวันที่ ' . get_date_notime($ArrParam["date_start"]) . ' ถึง ' . get_date_notime($ArrParam["date_end"])));
             }
             $sheet->row(3, array('รายงานข้อมูล ณ วันที่ ' . get_date_notime(date("Y-m-d H:i:s"))));
             $header[] = null;
             $header[0] = 'รหัสพนักงาน';
             $header[1] = "ชื่อ-นามสกุล";
             $header[2] = "หน่วยงาน";
             $header[3] = "วันที่พ้นสภาพ";
             $header[4] = "สาเหตุ";
             //                $header[4] = "สถานะของสมาชิก";
             //                $header[5] = "วันที่พ้นสภาพ";
             $sheet->row(4, $header);
             foreach ($results as $user) {
                 $sheet->appendRow($user);
             }
             //                }
         });
     })->download('xls');
     //        Excel::create('Export1', function($excel) use ($data){
     //
     //            $excel->sheet('New sheet', function($sheet)use ($data) {
     //                $sheet->mergeCells('A1:M1');
     //                $sheet->mergeCells('A3:M3');
     //
     //                $sheet->loadView('backend.pages.export.export_report2')->with([
     //                    'data' => $data,
     //                    'topic' => "รายชื่อสมาชิกเปลี่ยนอัตราสะสม"
     //                ]);
     //
     //            });
     //
     //        })->download('xls');
 }
 function getGraphColum($netasset)
 {
     $euqity = array();
     $Debt = array();
     $DateCreate = array();
     $count = 0;
     foreach ($netasset as $index => $arrItem) {
         $euqity[$count] = (double) $arrItem->EQUITY;
         $Debt[$count] = (double) $arrItem->DEBT;
         $DateCreate[$count] = get_date_notime($arrItem->CREATE_DATE);
         $count = $count + 1;
     }
     //piechart creation
     $graph["chart"] = array("type" => 'column', 'plotBackgroundColor' => NULL, 'plotBorderWidth' => NULL, 'plotShadow' => false);
     $graph["title"] = array("text" => 'สัดส่วนการลงทุน');
     $graph["exporting"] = array("enabled" => false);
     $graph["credits"] = array("enabled" => false);
     //$graph["tooltip"] = array("pointFormat" => '{series.name}: <b>{point.percentage:.1f}%</b>');
     $graph["legend"] = array('align' => 'right', 'x' => -30, 'verticalAlign' => 'top', 'y' => 25, 'floating' => true, 'backgroundColor' => '#fff', 'borderColor' => '#CCC', 'borderWidth' => 1, 'shadow' => false);
     $graph["xAxis"] = array("categories" => $DateCreate);
     $graph["yAxis"] = array("title" => array("text" => "%(เปอร์เซ็นต์)"));
     $graph["plotOptions"] = array('column' => array('stacking' => 'normal', 'dataLabels' => array('enabled' => true, 'color' => "#fff ", 'style' => array('textShadow' => '0 0 3px black'))));
     $graph['series'] = array(array("name" => 'ตราสารหนี้', "color" => "#ffbf3f", "data" => $Debt), array("name" => 'ตราสารทุน', "color" => "#fe5000", "data" => $euqity));
     return $graph;
 }