Selaa lähdekoodia

latest

master
Siti Rahayu 4 vuotta sitten
vanhempi
commit
d7b21f8c27

+ 9
- 9
app/Http/Controllers/Api/DataController.php Näytä tiedosto

@@ -28,11 +28,11 @@ class DataController extends BaseController
$data = array();

//data array, length = 6
foreach ($response->data as $s)
foreach ($response->data as $s)
{
foreach($s->areas as $a)
{
foreach ($a->roads as $r)
foreach ($a->roads as $r)
{
array_push($data, array
(
@@ -49,11 +49,11 @@ class DataController extends BaseController
}
}

foreach ($data as $d)
foreach ($data as $d)
{
$road = CodeMukim::where('_id', $d['_id'])->first();
if (empty($road))
if (empty($road))
{
$codeMukim = new CodeMukim();
$codeMukim->_id = new \MongoDB\BSON\ObjectID($d['_id']);
@@ -63,12 +63,12 @@ class DataController extends BaseController
$codeMukim->KWS_KNAMA = $d['area_name'];
$codeMukim->JLN_MKKOD = $d['section_code'];
$codeMukim->MKM_MNAMA = $d['section_name'];
$codeMukim->save();
$codeMukim->save();
}
}
}

return 'finished';
}
}
}
}

+ 94
- 73
app/Http/Controllers/Api/Export/CalculationReportEnforcer.php Näytä tiedosto

@@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api\Export;
use Illuminate\Http\Request;
use App\Http\Controllers\Api\BaseController;
use Carbon\Carbon;
@@ -11,7 +11,7 @@ use App\Model\Module\ReportEnforcer;
use App\Model\Staff;
use App\Model\StaffDetail;
use App\Model\Module\Department;
class CalculationReportEnforcer extends BaseController
{
private function jumlah_kompaun_bulanan($month, $year, $dikeluarkan){
@@ -24,7 +24,7 @@ class CalculationReportEnforcer extends BaseController
foreach ($compound as $key => $c) {
$jumlah = $jumlah + floatval($c->jumlah_asal_kompaun);
$id_array[] = $c->_id;
}
}

$result = array(
'keping' => count($compound),
@@ -180,74 +180,95 @@ class CalculationReportEnforcer extends BaseController

return true;
}
}
}

public function returnReportKutipan(Request $request)
{
$nested_data = array();

$date = $request->date;
$jenis = $request->jenis;
$current_id = $request->current_id;
$jabatan = $request->jabatan;

$data = false;

$date = explode('-', $date);
$start = Carbon::createFromDate(null, $date[1], $date[0]);
dd($date);



return \DataTables::of($nested_data)->make(true);

public function returnReportEnforcer(Request $request){
$nested_data = array();

$year = $request->year;
$jenis = $request->jenis;
$current_id = $request->current_id;
$jabatan = $request->jabatan;
$data = false;

if($year != 'null' && $jenis != 'null' && $jabatan != 'null'){

$data = $this->report_enforcer($year,$jabatan,$jenis);

// dd($data);

$data_report = ReportEnforcer::where('year', $year)->where('jbkod', $jabatan)->get();
if(!empty($data_report)){
if($jenis == 'jumlah'){
foreach ($data_report as $key => $d) {
$st = StaffDetail::find($d->staff_detail_id);
array_push($nested_data, array(
'index' => '',
'name' => $st->full_name,
'jan' => $d->jan['jumlah'],
'feb' => $d->feb['jumlah'],
'mac' => $d->mac['jumlah'],
'apr' => $d->apr['jumlah'],
'mei' => $d->mei['jumlah'],
'jun' => $d->jun['jumlah'],
'july' => $d->july['jumlah'],
'ogos' => $d->ogos['jumlah'],
'sept' => $d->sept['jumlah'],
'okt' => $d->okt['jumlah'],
'nov' => $d->nov['jumlah'],
'dis' => $d->dis['jumlah'],
'total' => $d->total['jumlah'],
));
}
}else if($jenis == 'keping'){
foreach ($data_report as $key => $d) {
$st = StaffDetail::find($d->staff_detail_id);
array_push($nested_data, array(
'index' => '',
'name' => $st->full_name,
'jan' => $d->jan['keping'],
'feb' => $d->feb['keping'],
'mac' => $d->mac['keping'],
'apr' => $d->apr['keping'],
'mei' => $d->mei['keping'],
'jun' => $d->jun['keping'],
'july' => $d->july['keping'],
'ogos' => $d->ogos['keping'],
'sept' => $d->sept['keping'],
'okt' => $d->okt['keping'],
'nov' => $d->nov['keping'],
'dis' => $d->dis['keping'],
'total' => $d->total['keping'],
));
}
}
}

}


return \DataTables::of($nested_data)->make(true);
}
}

// public function returnReportEnforcer(Request $request){
// $nested_data = array();

// $year = $request->year;
// $jenis = $request->jenis;
// $current_id = $request->current_id;
// $jabatan = $request->jabatan;
// $data = false;

// if($year != 'null' && $jenis != 'null' && $jabatan != 'null'){

// $data = $this->report_enforcer($year,$jabatan,$jenis);

// // dd($data);

// $data_report = ReportEnforcer::where('year', $year)->where('jbkod', $jabatan)->get();
// if(!empty($data_report)){
// if($jenis == 'jumlah'){
// foreach ($data_report as $key => $d) {
// $st = StaffDetail::find($d->staff_detail_id);
// array_push($nested_data, array(
// 'index' => '',
// 'name' => $st->full_name,
// 'jan' => $d->jan['jumlah'],
// 'feb' => $d->feb['jumlah'],
// 'mac' => $d->mac['jumlah'],
// 'apr' => $d->apr['jumlah'],
// 'mei' => $d->mei['jumlah'],
// 'jun' => $d->jun['jumlah'],
// 'july' => $d->july['jumlah'],
// 'ogos' => $d->ogos['jumlah'],
// 'sept' => $d->sept['jumlah'],
// 'okt' => $d->okt['jumlah'],
// 'nov' => $d->nov['jumlah'],
// 'dis' => $d->dis['jumlah'],
// 'total' => $d->total['jumlah'],
// ));
// }
// }else if($jenis == 'keping'){
// foreach ($data_report as $key => $d) {
// $st = StaffDetail::find($d->staff_detail_id);
// array_push($nested_data, array(
// 'index' => '',
// 'name' => $st->full_name,
// 'jan' => $d->jan['keping'],
// 'feb' => $d->feb['keping'],
// 'mac' => $d->mac['keping'],
// 'apr' => $d->apr['keping'],
// 'mei' => $d->mei['keping'],
// 'jun' => $d->jun['keping'],
// 'july' => $d->july['keping'],
// 'ogos' => $d->ogos['keping'],
// 'sept' => $d->sept['keping'],
// 'okt' => $d->okt['keping'],
// 'nov' => $d->nov['keping'],
// 'dis' => $d->dis['keping'],
// 'total' => $d->total['keping'],
// ));
// }
// }
// }

// }



// return \DataTables::of($nested_data)->make(true);
// }
}

+ 0
- 24
app/Http/Controllers/Api/LoginController.php Näytä tiedosto

@@ -152,30 +152,6 @@ class LoginController extends BaseController
}
}

// public function resetPassword(Request $request)
// {
// $data = array();
// $staff = Staff::where('api_token', $request->api_token)->first();
// if(!empty($staff))
// {
// $ic_num = StaffDetail::with('Staff')->where('identity', $request->ic_number)->first();
// $id = $ic_num->_id;
// if(!empty($id))
// {
// $staffID = Staff::where('_id', $id)->first();
// $staffID->password = $request->new_password;
// }
// else
// {
// return $this->sendError('Gagal', 'Identiti tidak dijumpai');
// }
// }
// else
// {
// return $this->sendError('Gagal', 'penguatkuasa tidak wujud');
// }
// }

public function testing(Request $request)
{


+ 34
- 19
app/Http/Controllers/Main/TaskController.php Näytä tiedosto

@@ -30,6 +30,11 @@ use App\Model\Module\SubHistory;
use App\Model\Module\Memo;
use App\Model\Module\Attachment;
use App\Model\Module\CodeMukim;
use App\Model\Module\AreaRoad;
use App\Model\Module\Road;
use App\Model\Module\Residence;
use App\Model\Module\City;


use App\Jobs\StoreCompoundEPBT;
use App\Jobs\UpdateCompoundPrice;
@@ -490,37 +495,47 @@ class TaskController extends Controller

public function insertdata()
{
// $roads = CodeMukim::all()->toArray();

$roads = CodeMukim::all()->toArray();
// $jalan = json_decode(file_get_contents(public_path(). '/jalan.json'));
// $taman = json_decode(file_get_contents(public_path(). '/taman.json'));
$bandar = json_decode(file_get_contents(public_path(). '/bandar.json'));

$response = json_decode(file_get_contents(public_path(). '/mukim_kawasan_jalan_mbip.json'));
$temp = [];
if($response->success == true){
$temp = []; $avail = []; $countx = 0;

foreach ($response->data as $key => $r)
if(($bandar->success == true)){

foreach ($bandar->data as $r)
{
// search value in db COde Mukim, if none, add to array
if(!in_array($r->_id, array_column($roads, '_id')))
{
// $data = count(Road::where('kod_jalan', $r->kod_jalan)->get());

$com = new CodeMukim();
$com->_id = new \MongoDB\BSON\ObjectID($r->_id);
$com->JLN_MKKOD = $r->JLN_MKKOD;
$com->MKM_MNAMA = $r->MKM_MNAMA;
$com->JLN_KWKOD = $r->JLN_KWKOD;
$com->KWS_KNAMA = $r->KWS_KNAMA;
$com->JLN_JNAMA = $r->JLN_JNAMA;
// if empty, then add the data
if(empty(City::where('kod_epbt', $r->kod)->first()))
{
// $bandar = '-';

// if(isset($r->bandar) == true)
// {
// $bandar = $r->bandar;
// }

$com = new City();
// $com->_id = new \MongoDB\BSON\ObjectID($r->_id);
$com->kod_epbt = $r->kod;
$com->nama_bandar = $r->nama;
$com->negeri = $r->negeri;
// $com->kod_bandar = $bandar;
// $com->poskod = $poskod;
$com->save();

if(!$com)
{
$temp[] = $r;
$temp[] = $r->kod;
}
}
}

}

return 'data not inserted : ' . json_encode($temp);
return 'kod jalan tak berjaya disimpan : ' . json_encode($temp) ;

}
}

+ 17
- 0
app/Model/Module/AreaRoad.php Näytä tiedosto

@@ -0,0 +1,17 @@
<?php

namespace App\Model\Module;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;

class AreaRoad extends Eloquent
{
//
use SoftDeletes;

protected $connection = 'mongodb';
protected $collection = 'area_road';

protected $guarded = ['_id'];
}

+ 1
- 1
app/Model/Module/Attachment.php Näytä tiedosto

@@ -11,7 +11,7 @@ class Attachment extends Eloquent
use SoftDeletes;

protected $connection = 'mongodb';
protected $collection = 'attachment';
protected $collection = 'attachment_test';

protected $guarded = ['_id'];


+ 17
- 0
app/Model/Module/City.php Näytä tiedosto

@@ -0,0 +1,17 @@
<?php

namespace App\Model\Module;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;

class City extends Eloquent
{
//
use SoftDeletes;

protected $connection = 'mongodb';
protected $collection = 'city';

protected $guarded = ['_id'];
}

+ 3
- 3
app/Model/Module/CodeMukim.php Näytä tiedosto

@@ -9,9 +9,9 @@ class CodeMukim extends Eloquent
{
//
use SoftDeletes;
protected $connection = 'mongodb';
protected $collection = 'area_roads';
protected $guarded = ['_id'];
}
}

+ 1
- 1
app/Model/Module/Compound.php Näytä tiedosto

@@ -11,7 +11,7 @@ class Compound extends Eloquent
use SoftDeletes;

protected $connection = 'mongodb';
protected $collection = 'compound';
protected $collection = 'compound_test';

protected $guarded = ['_id'];


+ 1
- 1
app/Model/Module/ConfidentialFile.php Näytä tiedosto

@@ -8,7 +8,7 @@ class ConfidentialFile extends Eloquent
{
//
protected $connection = 'mongodb';
protected $collection = 'confidential_file';
protected $collection = 'confidential_file_test';

protected $guarded = ['_id'];


+ 1
- 1
app/Model/Module/History.php Näytä tiedosto

@@ -8,7 +8,7 @@ class History extends Eloquent
{
//
protected $connection = 'mongodb';
protected $collection = 'history';
protected $collection = 'history_test';

protected $guarded = ['_id'];


+ 17
- 0
app/Model/Module/Residence.php Näytä tiedosto

@@ -0,0 +1,17 @@
<?php

namespace App\Model\Module;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;

class Residence extends Eloquent
{
//
use SoftDeletes;

protected $connection = 'mongodb';
protected $collection = 'residence';

protected $guarded = ['_id'];
}

+ 17
- 0
app/Model/Module/Road.php Näytä tiedosto

@@ -0,0 +1,17 @@
<?php

namespace App\Model\Module;

use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;

class Road extends Eloquent
{
//
use SoftDeletes;

protected $connection = 'mongodb';
protected $collection = 'road';

protected $guarded = ['_id'];
}

+ 1
- 1
app/Model/Module/SubHistory.php Näytä tiedosto

@@ -8,7 +8,7 @@ class SubHistory extends Eloquent
{
//
protected $connection = 'mongodb';
protected $collection = 'sub_history';
protected $collection = 'sub_history_test';

protected $guarded = ['_id'];


+ 83
- 0
public/bandar.json Näytä tiedosto

@@ -0,0 +1,83 @@
{
"status": 200,
"success": true,
"data":
[
{
"kod": "01",
"nama": "SKUDAI",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "02",
"nama": "ULU TIRAM",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "03",
"nama": "MASAI",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "04",
"nama": "KANGKAR PULAI",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "05",
"nama": "GELANG PATAH",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "06",
"nama": "PLENTONG",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "07",
"nama": "ULU CHOH",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "08",
"nama": "LIMA KEDAI",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "09",
"nama": "ISKANDAR PUTERI",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "11",
"nama": "TEKNOLOGI JOHOR",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "12",
"nama": "INDAH WATER (IWK)",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "13",
"nama": "TANJUNG KUPANG & SEKITAR",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "16",
"nama": "TENAGA NASIONAL BHD",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "17",
"nama": "PELABUHAN JOHOR",
"negeri": "JOHOR DARUL TAKZIM"
},
{
"kod": "18",
"nama": "MENARA TELEKOMUNIKASI",
"negeri": "JOHOR DARUL TAKZIM"
}
]

}

+ 50560
- 0
public/jalan.json
File diff suppressed because it is too large
Näytä tiedosto


+ 2052
- 0
public/taman.json
File diff suppressed because it is too large
Näytä tiedosto


+ 1
- 1
resources/views/include/horizontal-menu.blade.php Näytä tiedosto

@@ -187,7 +187,7 @@
<li class="{{ Request::is('main/report/statistic/enforcer') ? 'active' : '' }}">
<a href="{{ url('/main/report/statistic/enforcer') }}" class="waves-effect waves-dark">
<span class="pcoded-micon"><i class="ti-bar-chart-alt"></i></span>
<span class="pcoded-mtext">Statistik Pengeluaran Kompaun</span>
<span class="pcoded-mtext">Kutipan Kompaun</span>
<span class="pcoded-mcaret"></span>
</a>
</li>

+ 19
- 15
resources/views/main-dashboard/report/enforcer.blade.php Näytä tiedosto

@@ -6,7 +6,7 @@

@section('content')
<style type="text/css">
select.form-control, select.form-control:focus, select.form-control:hover {
select.form-control, select.form-control:focus, select.form-control:hover {
border: 1px solid #ccc !important;
height: auto !important;
}
@@ -25,7 +25,7 @@
<div class="col-md-2">
<div class="card">
<div class="card-block">
<div class="form-group" style="margin-top: 1.25em">
{{-- <div class="form-group" style="margin-top: 1.25em">
<label><b>Tahun <code>*</code></b></label>
<select name="tahun" id="tahun" class="form-control" required>
<option value="null">Pilih tahun</option>
@@ -35,7 +35,11 @@
<option value="2019">2019</option>
<option value="2020">2020</option>
</select>
</div>
</div> --}}
<div class="form-group" style="margin-top: 1.25em">
<label><b>Tahun <code>*</code></b></label>
<input type="month" name="tahun" id="tahun" class="form-control" required>
</div>
<div class="form-group" style="margin-top: 1.25em">
<label><b>Jabatan <code>*</code></b></label>
<select name="jabatan" id="jabatan" class="form-control" required>
@@ -58,7 +62,7 @@
<div id="link" style="float:right"></div>
</div>
<div class="card-block">
<div class="row m-b-30">
<div class="col-lg-12 col-xl-12">
<!-- Nav tabs -->
@@ -175,7 +179,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

@@ -225,9 +229,9 @@
{ "data": "nov", "name": "nov" },
{ "data": "dis", "name": "dis" },
{ "data": "total", "name": "total" },
],
],
"columnDefs": [
{
{
"render": function ( data, type, row, meta ) {
return (meta.row+1);
},
@@ -311,7 +315,7 @@
var link = "{{ url('main/export/report/enforcer') }}/"+$('#tahun').val()+"/"+$('#jenis').val()+"/"+$('#jabatan').val();
$('#link').html('<a target="_blank" href="'+link+'" class="btn btn-primary btn-sm waves-effect waves-light">Excel</a>');
}
},
},
});

table2 = $('#reportJ').DataTable({
@@ -325,7 +329,7 @@
"ajax": {
"url": "{{ url('api/get/statistic-compound/enforcer') }}",
"data": {
"year": function() { return $('#tahun').val() },
"date": function() { return $('#tahun').val() },
"jabatan": function() { return $('#jabatan').val() },
"jenis": "jumlah",
"current_id": current_id,
@@ -347,9 +351,9 @@
{ "data": "nov", "name": "nov" },
{ "data": "dis", "name": "dis" },
{ "data": "total", "name": "total" },
],
],
"columnDefs": [
{
{
"render": function ( data, type, row, meta ) {
return (meta.row+1);
},
@@ -424,7 +428,7 @@
return parseFloat(a) + parseFloat(b);
}, 0 );
$( api.column( 14 ).footer() ).html(jum);
},
},
});

$('#jana').on('click', function(e){
@@ -433,12 +437,12 @@
if($('#tahun').val() == 'null' || $('#jabatan').val() == 'null'){
alert('Sila pilih tahun dan jabatan');
}else {
console.log("jabatan " + $('#jabatan').val());
console.log("tahun " + $('#tahun').val());
table1.ajax.reload();
table2.ajax.reload();
}
});
});
</script>
@endsection
@endsection

Loading…
Peruuta
Tallenna