/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_map_view($v = true) { //perms $this->etc->check_permission('SEC_USER.MAP_OPER_VIEW'); //sorting $sortdata = array('id', 'user_name', 'operator_name', 'dateadd'); //fmt params $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_map_view() : params [ {$dmp} ]"); //role-list $rdata = $this->secuser_operator_model->get($fdata); $rlist = $rdata['data']; $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; $json_str = $this->fmt_jason_data_map($rlist, $fdata['page'], $rdata['total'], $fdata['draw']); //fmt view data $vdata = $this->get_droplist(); $vdata['jData_Total'] = @intval($rdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Ajax'] = true; //view if (!$v) { $this->load->view('secuser.map.view.php', $vdata); } else { echo $json_str; } }
/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_view($v = true) { global $g_SYSTEM_DATA; //perms $this->etc->check_permission('LOCATION.VIEW'); //sorting $sortdata = array("code", "description", "useradd", "dateadd"); //fmt params $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_view() : params [ {$dmp} ]"); //get all the operator -> parent_id=0 if ($this->etc->is_user_ext_operator()) { $fdata['by'] = $this->etc->get_id(); } //role-list $rdata = $this->operator_model->get_location($fdata); $rlist = $rdata['data']; $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; //reset $fdata['by'] = null; $json_str = $this->fmt_jason_data($rlist, $fdata['page'], $rdata['total'], $fdata['draw']); //fmt view data $vdata['jData_Total'] = @intval($rdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Ajax'] = true; //view if (!$v) { $this->load->view('location.view.php', $vdata); } else { echo $json_str; } }
/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_view($v = true) { //perms $this->etc->check_permission('USER.LIST'); //sorting $sortdata = array("name", "email", "role", "status", "created", "pass_expiry"); //fmt params $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_view() : params [ {$dmp} ]"); //get list $gdata = $this->user_model->get(array('order' => $fdata['order'], 'limit' => $fdata['limit'])); //role-list $rdata = $this->user_role_model->get(); $rlist = $rdata['data']; $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; $json_str = $this->fmt_jason_data($gdata['data'], $fdata['page'], $gdata['total'], $rlist, $fdata['draw']); //fmt view data $vdata['jData_Total'] = @intval($gdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Ajax'] = true; //view if (!$v) { $this->load->view('user.view.php', $vdata); } else { echo $json_str; } }
/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_view_traffic($v = true, $csvid = 0) { //globals here ;-) global $g_SYSTEM_DATA; //filter $csvid = $csvid == 0 ? trim($this->input->get_post('csvid')) : $csvid; log_message("INFO", "ajx_view_traffic() : CSV-ID [ {$csvid} ]"); //perms $this->etc->check_permission('CSV.VIEW'); //sorting $sortdata = array("trafficrecap_id", "operator_code", "traffic_code", "job_id", "station_code", "dateshift", "shift_code", "user_code", "created_dt"); //fmt params $fdata = fmt_ajx_params($sortdata); $fdata['csvid'] = $csvid; //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_view_traffic() : params [ {$dmp} ]"); //role-list $rdata = $this->csv_mgmt_model->getTraffic($fdata); $rlist = $rdata['data']; $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; $json_str = $this->fmt_jason_data_traffic($rlist, $fdata['page'], $rdata['total'], $fdata['draw']); //fmt view data $vdata['jData_Total'] = @intval($rdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Ajax'] = true; $vdata['jData_Hidden'] = array('csvid' => $csvid); $vdata['jData_CsvId'] = $csvid; //view if (!$v) { $this->load->view('csv.traffic.view.php', $vdata); } else { echo $json_str; } }
function search_revpervehicleXXXXX() { $this->etc->check_permission('REPORT.GENERATE'); //get params $vShiftCode = trim($this->input->get_post("vShiftCode")); $vVehicleType = trim($this->input->get_post("vVehicleType")); $vStationCode = trim($this->input->get_post("vStationCode")); $vMemberCode = trim($this->input->get_post("vMemberCode")); $vProductCode = trim($this->input->get_post("vProductCode")); $vTrafficName = trim($this->input->get_post("vTrafficName")); $vOfficerType = trim($this->input->get_post("vOfficerType")); $vOperatorCode = trim($this->input->get_post("vOperatorCode")); $vRecapType = trim($this->input->get_post("vRecapType")); $vLocList = $this->input->get_post('CHK_LIST_LOCATION[]'); //dates $dt1 = trim($this->input->get_post('dtRange1')); $dt2 = trim($this->input->get_post('dtRange2')); $dt1a = trim($this->input->get_post('vDate1')); $dt2a = trim($this->input->get_post('vDate2')); $vlocations = @var_export($vLocList, 1); $moreLocs = @count($vLocList) > 0 ? " IN ( '" . @implode("','", $vLocList) . "' ) " : ""; log_message("INFO", "filter() -> LOCATIONS: {$vlocations}; "); log_message("INFO", "filter() -> LOCATIONS: {$moreLocs} "); //get dropdownlists $err_msg = ''; $vdata = $this->get_fmt_vdata(); //save prev data $vdata['jData_Hidden'] = array('vDate1' => $dt1, 'vDate2' => $dt2, 'dtRange1' => $dt1, 'dtRange2' => $dt2, 'vShiftCode' => $vShiftCode, 'vVehicleType' => $vVehicleType, 'vStationCode' => $vStationCode, 'vMemberCode' => $vMemberCode, 'vProductCode' => $vProductCode, 'vTrafficName' => $vTrafficName, 'vOfficerType' => $vOfficerType, 'vOperatorCode' => $vOperatorCode, 'vRecapType' => $vRecapType); $fmtdt1 = null; $fmtdt2 = null; if (($fmtdt1 = strtotime($dt1)) === false) { log_message("INFO", "filter() -> failed-date:1 "); //set status $vdata['error_message'] = "Tanggal Awal: Start date is invalid! (YYYY-MM-DD)"; //fwd $this->load->view('reports.revpervehicle.search.php', $vdata); return; } $dtfmt1 = @date('Y-m-d', $fmtdt1); if (($fmtdt2 = strtotime($dt2)) === false) { log_message("INFO", "filter() -> failed-date:2 "); //set status $vdata['error_message'] = "Tanggal Awal: End date is invalid! (YYYY-MM-DD)"; //fwd $this->load->view('reports.revpervehicle.search.php', $vdata); return; } $dtfmt2 = @date('Y-m-d', $fmtdt2); if ($dtfmt2 < $dtfmt1) { log_message("INFO", "filter() -> failed-date:3 "); //set status $vdata['error_message'] = "Tanggal Awal: Start/End date is invalid! (YYYY-MM-DD)"; //fwd $this->load->view('reports.revpervehicle.search.php', $vdata); return; } //EXT-operator or EXT-location [ must choose an operator ] if ($vOperatorCode <= 0 and ($this->etc->is_user_ext_operator() or $this->etc->is_user_ext_location())) { log_message("INFO", "filter() -> failed-date:4 "); //set status $vdata['error_message'] = "Please select a valid operator!"; //fwd $this->load->view('reports.revpervehicle.search.php', $vdata); return; } //fmt params $sortdata = array(); $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "search_revpervehicle() : params [ {$dmp} ]"); //fmt xtra $fdata['date1'] = $dt1; $fdata['date2'] = $dt2; $fdata['shift'] = $vShiftCode; $fdata['vehicle'] = $vVehicleType; $fdata['station'] = $vStationCode; $fdata['member'] = $vMemberCode; $fdata['product'] = $vProductCode; $fdata['traffic'] = $vTrafficName; $fdata['officer'] = $vOfficerType; $fdata['operator'] = $vOperatorCode; $fdata['recap'] = $vRecapType; $fdata['location'] = $vLocList; //add user-id if ($this->etc->is_user_ext_operator() or $this->etc->is_user_ext_location()) { $fdata['user'] = $this->etc->get_id(); } // Recap => SUMMARY = 1 file // Non-Recap => PER LOCATION = X file(s) //fmt date $sdate = explode('-', $fdata['date1']); $edate = explode('-', $fdata['date2']); $range_s = sprintf("%s/%s/%s", $sdate[2], $sdate[1], $sdate[0]); $range_e = sprintf("%s/%s/%s", $edate[2], $edate[1], $edate[0]); //date format @date('Y-m-d h:i A'); log_message("INFO", "filter() -> data: dt1:{$dt1} "); log_message("INFO", "filter() -> data: dt2:{$dt2} "); //RECAP if (!@preg_match("/^(Non-Recap)\$/i", $vRecapType)) { //RECAP = 1 file $rdata = $this->rpt_mgmt_model->getReportRevenueVehicleType($fdata); } else { //NO-RECAP = multiple files $norecap = $this->rpt_mgmt_model->getLocationsPerOperator($fdata); $xtotal = @intval($norecap['total']); if ($xtotal <= 0) { $vdata['error_message'] = "( {$xtotal} ) Total location records found!"; $this->load->view('reports.revpervehicle.search.php', $vdata); return; } //all locations foreach ($norecap['data'] as $loc_k => $loc_v) { //fmt params $loc_arr = array(); $loc_arr[] = $loc_v->operator_id; $fdata['location'] = $loc_arr; //get all $rdata = $this->rpt_mgmt_model->getReportRevenueVehicleType($fdata); } } //else no-recap $xtotal = @intval($rdata['total']); //chk results if ($xtotal <= 0) { $vdata['error_message'] = "( {$xtotal} ) Total records found!"; $this->load->view('reports.revpervehicle.search.php', $vdata); return; } //good data $summdat = array(); $tcodes = array(); $tdata = array(); //template header $hdata = file_get_contents(PDF_TMPL8_REVENUEPERVEHICLE); $ddata = file_get_contents(PDF_TMPL8_REVENUEPERVEHICLE_TAB); $uuid = u_generate_uuid(); $pfx1 = @date('YmdhisA'); $tmf_dst = sprintf("%s/rpt-revpervehicle-uno-%s%s.pdf", FILEPATH_USERPDF, $pfx1, substr(@uniqid(rand(), true), 0, 8)); $record = 0; //loop foreach ($rdata['data'] as $kk => $vv) { //save it $trafficname = @strtoupper(trim($vv->traffic_name)); $sumdat["qtyinpc"] += sprintf("%d", $vv->qtyinpc); //computed $sumdat["qtyoutpc"] += sprintf("%d", $vv->qtyoutpc); //computed $sumdat["qtyinman"] += sprintf("%d", $vv->qtyinman); //manual $sumdat["qtyoutman"] += sprintf("%d", $vv->qtyoutman); //manual $sumdat["qtyvoucher"] += sprintf("%d", $vv->qtyvoucher); //voucher $sumdat["qtyloss"] += sprintf("%d", $vv->qtyloss); //masalah $sumdat["totalnettopc"] += sprintf("%.02f", $vv->totalnettopc); //tunai $sumdat["totalnettoman"] += sprintf("%.02f", $vv->totalnettoman); //tunai $sumdat["totallosspc"] += sprintf("%.02f", $vv->totallosspc); //masalah $sumdat["totallossman"] += sprintf("%.02f", $vv->totallossman); //masalah $sumdat["totalvaluefinepc"] += sprintf("%.02f", $vv->totalvaluefinepc); //denda $sumdat["totalvaluefineman"] += sprintf("%.02f", $vv->totalvaluefineman); //denda $sumdat["totalvoucherpc"] += sprintf("%.02f", $vv->totalvoucherpc); //voucher $sumdat["totalvoucherman"] += sprintf("%.02f", $vv->totalvoucherman); //voucher //revenue = (tunai+masalah+denda) $revenuepc = sprintf("%.02f", $vv->totalnettopc + $vv->totallosspc + $vv->totalvaluefinepc); $revenueman = sprintf("%.02f", $vv->totalnettoman + $vv->totallossman + $vv->totalvaluefineman); $sumdat["totalrevenuepc"] += $revenuepc; //pendapatan $sumdat["totalrevenueman"] += $revenueman; //pendapatan //one-rec $tmf_detail = $ddata; $tmf_detail = @preg_replace('/#P1#/', $trafficname, $tmf_detail); $tmf_detail = @preg_replace('/#P2#/', '', $tmf_detail); $tmf_detail = @preg_replace('/#P3#/', $vv->qtyinpc, $tmf_detail); $tmf_detail = @preg_replace('/#P4#/', $vv->qtyoutpc, $tmf_detail); $tmf_detail = @preg_replace('/#P5#/', $vv->qtyinman, $tmf_detail); $tmf_detail = @preg_replace('/#P6#/', $vv->qtyoutman, $tmf_detail); $tmf_detail = @preg_replace('/#P7#/', $vv->qtyvoucher, $tmf_detail); $tmf_detail = @preg_replace('/#P8#/', $vv->qtyloss, $tmf_detail); $tmf_detail = @preg_replace('/#P9#/', number_format($vv->totalnettopc, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P10#/', number_format($vv->totalnettoman, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P11#/', number_format($vv->totallosspc, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P12#/', number_format($vv->totallossman, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P13#/', number_format($vv->totalvaluefinepc, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P14#/', number_format($vv->totalvaluefineman, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P15#/', number_format($revenuepc, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P16#/', number_format($revenueman, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P17#/', number_format($vv->totalvoucherpc, 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P18#/', number_format($vv->totalvoucherman, 2, ".", ","), $tmf_detail); //add-in $tdata[] = $tmf_detail; $record++; } //operator-list $operators = '<span>'; foreach ($rdata['operators'] as $kk => $vv) { $operators .= sprintf("<label for='operators'>%s</label><br/>", trim($vv->description)); } $operators .= '</span>'; //summary $tmf_detail = $ddata; $tmf_detail = @preg_replace('/#P1#/', '', $tmf_detail); $tmf_detail = @preg_replace('/#P2#/', '', $tmf_detail); $tmf_detail = @preg_replace('/#P3#/', $sumdat["qtyinpc"], $tmf_detail); $tmf_detail = @preg_replace('/#P4#/', $sumdat["qtyoutpc"], $tmf_detail); $tmf_detail = @preg_replace('/#P5#/', $sumdat["qtyinman"], $tmf_detail); $tmf_detail = @preg_replace('/#P6#/', $sumdat["qtyoutman"], $tmf_detail); $tmf_detail = @preg_replace('/#P7#/', $sumdat["qtyvoucher"], $tmf_detail); $tmf_detail = @preg_replace('/#P8#/', $sumdat["qtyloss"], $tmf_detail); $tmf_detail = @preg_replace('/#P9#/', number_format($sumdat["totalnettopc"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P10#/', number_format($sumdat["totalnettoman"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P11#/', number_format($sumdat["totallosspc"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P12#/', number_format($sumdat["totallossman"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P13#/', number_format($sumdat["totalvaluefinepc"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P14#/', number_format($sumdat["totalvaluefineman"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P15#/', number_format($sumdat["totalrevenuepc"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P16#/', number_format($sumdat["totalrevenueman"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P17#/', number_format($sumdat["totalvoucherpc"], 2, ".", ","), $tmf_detail); $tmf_detail = @preg_replace('/#P18#/', number_format($sumdat["totalvoucherman"], 2, ".", ","), $tmf_detail); //add-in $tdata[] = $tmf_detail; $tmore = @count($tdata); $tmfstr = ''; for ($i = 0; $i < $tmore; $i++) { $tmfstr .= trim($tdata[$i]); } //replace the details $fmt_hdata = $hdata; $fmt_hdata = @preg_replace('/#OPER#/', $operators, $fmt_hdata); $fmt_hdata = @preg_replace('/#PAGE#/', 1, $fmt_hdata); $fmt_hdata = @preg_replace('/#RECORD#/', $record, $fmt_hdata); $fmt_hdata = @preg_replace('/<!--\\/\\/#DETAILS#\\/\\/-->/', $tmfstr, $fmt_hdata); //save the template $pdfStr = save2pdf($tmf_dst, $fmt_hdata, PDF_TMPL8_REVENUEPERVEHICLE_TITLE); //chk if (!write_file($tmf_dst, $pdfStr)) { log_message("INFO", "pdf() -> FAILED > {$tmf_dst}"); $vdata['error_message'] = "Failed to generate the Preview and/or the PDF file!"; $this->load->view('reports.revpervehicle.search.php', $vdata); return; } //download $href = sprintf("%s", site_url("reports/tmfdownload/" . basename($tmf_dst)), substr($tmf_dst, 2)); log_message("INFO", "pdf() -> file > {$tmf_dst}"); //save $allsummary[] = array('DETAILS' => $tmfstr, 'START-DT' => $range_s, 'END-DT' => $range_e, 'PDF' => $href, 'PAGE' => 1, 'RECORD' => $record, 'OPERATOR' => $operators, 'ERROR-MSG' => $err_msg); //prv $vdata['jSummary'] = $allsummary; $this->preview($vdata); }
/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_view_ori($v = true) { //perms $this->etc->check_permission('PERMISSION.LIST'); //sorting $sortdata = array(); //fmt params $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_view() : params [ {$dmp} ]"); //perms-list $rdata = $this->user_resource_model->get(); $rlist = $rdata['data']; //role-list $rodata = $this->user_role_model->get(); $rolist = $rodata['data']; $buff = ''; $buff .= "{id: \"resource\" , caption: \"Resource\", sortable: false},\n"; //set headers foreach ($rolist as $kk => $vv) { //ignore ;-) root if ($this->config->item('DEFAULT_ROLE_ROOT_ID') == $kk) { continue; } $buff1 = '"' . $vv->name . '"'; $buff2 = '"' . ucfirst($vv->name) . '"'; $buff .= "{id: {$buff1} , caption: {$buff2}, sortable: false},\n"; } $buff = substr($buff, 0, strlen($buff) - 2); log_message("INFO", "ajx_view() : HDRS [ {$buff} ]"); $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; $json_str = $this->fmt_jason_data($rlist, $fdata['page'], $rdata['total'], $rolist, $fdata['draw']); //fmt view data $vdata['jData_Total'] = @intval($rdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Headers'] = $buff; $vdata['jData_Ajax'] = true; //view if (!$v) { $this->load->view('permission.view.php', $vdata); } else { echo $json_str; } }
/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_view($v = true) { //perms $this->etc->check_permission('ROLE.LIST'); //sorting $sortdata = array("id", "name", "description", "created"); //fmt params $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_view() : params [ {$dmp} ]"); //role-list $rdata = $this->user_role_model->get($fdata); $rlist = $rdata['data']; $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; $json_str = $this->fmt_jason_data($rlist, $fdata['page'], $rdata['total'], $fdata['draw']); //fmt view data $vdata['jData_Total'] = @intval($rdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Ajax'] = true; //view if (!$v) { $this->load->view('role.view.php', $vdata); } else { echo $json_str; } }
/** | @name | - view | | @params | - | | @return | - | | @description | - default controller ( view list ) | **/ function ajx_view($v = true) { //perms $this->etc->check_permission('EVENT.LIST'); //sorting $sortdata = array("remarks", "uri", "created", "created_by"); //fmt params $fdata = fmt_ajx_params($sortdata); //dmp $dmp = @var_export($fdata, true); log_message("INFO", "ajx_view() : params [ {$dmp} ]"); //role-list $rdata = $this->event_log->get(array('order' => $fdata['order'], 'limit' => $fdata['limit'])); $rlist = $rdata['data']; $rdata['total'] = $rdata['total'] == '' ? 0 : $rdata['total']; //('status' => $ok, 'data' => $data , 'total' => $tot ); $json_str = $this->fmt_jason_data($rlist, $fdata['page'], $rdata['total'], $fdata['draw']); //fmt view data $vdata['jData_Total'] = @intval($rdata['total']); $vdata['jData_Str'] = $json_str; $vdata['jData_Ajax'] = true; //view if (!$v) { $this->load->view('eventlog.view.php', $vdata); } else { echo $json_str; } }