DONE: add accumulated amount display
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
[x] hardcode on daftar kehadiran
|
[x] hardcode on daftar kehadiran
|
||||||
[x] buang flow pengesahan
|
[x] buang flow pengesahan
|
||||||
[x] tambah siapa yang bagi duit (activity log)
|
[x] tambah siapa yang bagi duit (activity log)
|
||||||
[ ] there is certain part/files that is hardcoded
|
[x] there is certain part/files that is hardcoded
|
||||||
|
|
||||||
Penambahan Untuk Sistem Mengundi
|
Penambahan Untuk Sistem Mengundi
|
||||||
[x] Pendaftaran kehadiran (fizikal/maya)
|
[x] Pendaftaran kehadiran (fizikal/maya)
|
||||||
|
|||||||
@@ -51,8 +51,10 @@ class UpdateVoterPelaburanFromJson extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pelaburanRaw = $row['pelaburan'] ?? 0;
|
$map[$noAnggota] = [
|
||||||
$map[$noAnggota] = $this->cleanNumber($pelaburanRaw);
|
'pelaburan' => $this->cleanNumber($row['pelaburan'] ?? 0),
|
||||||
|
'accumulated_amount' => $this->cleanNumber($row['accumulated_amount'] ?? 0),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($map) === 0) {
|
if (count($map) === 0) {
|
||||||
@@ -78,7 +80,7 @@ class UpdateVoterPelaburanFromJson extends Command
|
|||||||
$bar->start();
|
$bar->start();
|
||||||
|
|
||||||
DB::table('voter')
|
DB::table('voter')
|
||||||
->select(['id', 'no_anggota', 'pelaburan'])
|
->select(['id', 'no_anggota', 'pelaburan', 'accumulated_amount'])
|
||||||
->where('election_id', $electionId)
|
->where('election_id', $electionId)
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->chunkById(500, function ($chunk) use ($map, $dryRun, &$updated, &$matched, &$missingInJson, &$unchanged, $bar) {
|
->chunkById(500, function ($chunk) use ($map, $dryRun, &$updated, &$matched, &$missingInJson, &$unchanged, $bar) {
|
||||||
@@ -92,11 +94,15 @@ class UpdateVoterPelaburanFromJson extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$matched++;
|
$matched++;
|
||||||
|
$jsonRow = $map[$noAnggota];
|
||||||
|
|
||||||
$newPelaburan = $map[$noAnggota];
|
|
||||||
$oldPelaburan = $voter->pelaburan !== null ? (float) $voter->pelaburan : 0.0;
|
$oldPelaburan = $voter->pelaburan !== null ? (float) $voter->pelaburan : 0.0;
|
||||||
|
$oldAccumulated = $voter->accumulated_amount !== null ? (float) $voter->accumulated_amount : 0.0;
|
||||||
|
|
||||||
if (abs($oldPelaburan - $newPelaburan) < 0.00001) {
|
if (
|
||||||
|
abs($oldPelaburan - $jsonRow['pelaburan']) < 0.00001
|
||||||
|
&& abs($oldAccumulated - $jsonRow['accumulated_amount']) < 0.00001
|
||||||
|
) {
|
||||||
$unchanged++;
|
$unchanged++;
|
||||||
$bar->advance();
|
$bar->advance();
|
||||||
continue;
|
continue;
|
||||||
@@ -106,7 +112,8 @@ class UpdateVoterPelaburanFromJson extends Command
|
|||||||
DB::table('voter')
|
DB::table('voter')
|
||||||
->where('id', $voter->id)
|
->where('id', $voter->id)
|
||||||
->update([
|
->update([
|
||||||
'pelaburan' => $newPelaburan,
|
'pelaburan' => $jsonRow['pelaburan'],
|
||||||
|
'accumulated_amount' => $jsonRow['accumulated_amount'],
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -129,7 +136,6 @@ class UpdateVoterPelaburanFromJson extends Command
|
|||||||
|
|
||||||
private function resolvePath(string $path): string
|
private function resolvePath(string $path): string
|
||||||
{
|
{
|
||||||
// absolute path
|
|
||||||
if (strpos($path, DIRECTORY_SEPARATOR) === 0) {
|
if (strpos($path, DIRECTORY_SEPARATOR) === 0) {
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
@@ -155,4 +161,3 @@ class UpdateVoterPelaburanFromJson extends Command
|
|||||||
return is_numeric($value) ? (float) $value : 0.0;
|
return is_numeric($value) ? (float) $value : 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ class Voter extends Authenticatable
|
|||||||
|
|
||||||
protected $table = 'voter';
|
protected $table = 'voter';
|
||||||
|
|
||||||
protected $fillable = ['name', 'no_kp', 'no_anggota','unit', 'election_id', 'alamat', 'telefon', 'saham', 'yuran', 'kehadiran','status_penyata','persetujuan','tarikh_sah','cadangan','pelaburan','tergempar','barangan','peribadi','berjamin_yuran','roadtax','pelbagai'];
|
protected $fillable = ['name', 'no_kp', 'no_anggota','unit', 'election_id', 'alamat', 'telefon', 'saham', 'yuran', 'kehadiran','status_penyata','persetujuan','tarikh_sah','cadangan','pelaburan', 'accumulated_amount', 'tergempar','barangan','peribadi','berjamin_yuran','roadtax','pelbagai'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'fizikal_registration_verified_at' => 'datetime',
|
'fizikal_registration_verified_at' => 'datetime',
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
*.sqlite
|
*.sqlite
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddAccumulatedAmountToVoterTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('voter', function (Blueprint $table) {
|
||||||
|
$table->decimal('accumulated_amount', 12, 2)->default(0)->after('pelaburan');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('voter', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('accumulated_amount');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -143,4 +143,4 @@ You can watch the System Demo [here](https://youtu.be/dsEoONiovdA).
|
|||||||
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag=migrations
|
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag=migrations
|
||||||
```
|
```
|
||||||
|
|
||||||
formula kiraan = ((Bulan masuk/12) * jumlah pelaburan) * 0.12
|
formula kiraan (purate) = ((Bulan masuk/12) * jumlah pelaburan) * 0.12
|
||||||
@@ -1,49 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4><b>Kemaskini Maklumat</b></h4>
|
<h4><b>Kemaskini Maklumat</b></h4>
|
||||||
<form @submit.prevent="edit()" id="edit-form">
|
<form @submit.prevent="edit()" id="edit-form">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Nama</label>
|
<label for="name">Nama</label>
|
||||||
<input type="text" name="name" class="form-control" :value="data.voter.name" required/>
|
<input type="text" name="name" class="form-control" :value="data.voter.name" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="no_kp">No. Kad Pengenalan</label>
|
<label for="no_kp">No. Kad Pengenalan</label>
|
||||||
<input type="text" name="no_kp" class="form-control" :value="data.voter.no_kp" required/>
|
<input type="text" name="no_kp" class="form-control" :value="data.voter.no_kp" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="telefon">No. Telefon</label>
|
<label for="telefon">No. Telefon</label>
|
||||||
<input type="text" name="telefon" class="form-control" :value="data.voter.telefon" required/>
|
<input type="text" name="telefon" class="form-control" :value="data.voter.telefon" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Unit">Unit</label>
|
<label for="Unit">Unit</label>
|
||||||
<input type="text" name="unit" class="form-control" :value="data.voter.unit" required/>
|
<input type="text" name="unit" class="form-control" :value="data.voter.unit" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="saham">Saham</label>
|
<label for="saham">Saham</label>
|
||||||
<input type="text" name="saham" class="form-control" :value="data.voter.saham" required/>
|
<input type="text" name="saham" class="form-control" :value="data.voter.saham" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="yuran">Yuran</label>
|
<label for="yuran">Yuran</label>
|
||||||
<input type="text" name="yuran" class="form-control" :value="data.voter.yuran" required/>
|
<input type="text" name="yuran" class="form-control" :value="data.voter.yuran" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="submit" value="Hantar" class="btn btn-success"/>
|
<label for="accumulated_amount">Jumlah Pelaburan (hingga Dis 2025)</label>
|
||||||
<router-link :to="{name: 'Manage Voter'}" class="btn btn-default">Kembali</router-link>
|
<input type="text" name="accumulated_amount" class="form-control"
|
||||||
</div>
|
:value="data.voter.accumulated_amount" required />
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="pelaburan">Dividen Simpanan Khas (Tabung 1) Tahun 2025</label>
|
||||||
|
<input type="text" name="pelaburan" class="form-control" :value="data.voter.pelaburan" required />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="submit" value="Hantar" class="btn btn-success" />
|
||||||
|
<router-link :to="{ name: 'Manage Voter' }" class="btn btn-default">Kembali</router-link>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default{
|
export default {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
loading: false
|
loading: false
|
||||||
@@ -52,7 +63,7 @@ export default{
|
|||||||
|
|
||||||
created: function () {
|
created: function () {
|
||||||
if (!this.data.voter.id) {
|
if (!this.data.voter.id) {
|
||||||
this.$router.push({name:'Manage Voter'});
|
this.$router.push({ name: 'Manage Voter' });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -62,15 +73,15 @@ export default{
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
var vm = this;
|
var vm = this;
|
||||||
this.util.notify('Updating voter', 'loading');
|
this.util.notify('Updating voter', 'loading');
|
||||||
axios.put(config.API+'voter/'+this.data.voter.id, $('#edit-form').serialize())
|
axios.put(config.API + 'voter/' + this.data.voter.id, $('#edit-form').serialize())
|
||||||
.then(response=>{
|
.then(response => {
|
||||||
vm.loading = false;
|
vm.loading = false;
|
||||||
$.notifyClose();
|
$.notifyClose();
|
||||||
if (vm.util.showResult(response, 'success')) {
|
if (vm.util.showResult(response, 'success')) {
|
||||||
vm.$router.push({name:'Manage Voter'});
|
vm.$router.push({ name: 'Manage Voter' });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error=>{
|
.catch(error => {
|
||||||
$.notifyClose();
|
$.notifyClose();
|
||||||
vm.loading = false;
|
vm.loading = false;
|
||||||
vm.util.showResult(error);
|
vm.util.showResult(error);
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ export default {
|
|||||||
{ title: 'Unit', key: 'unit', sortable: true },
|
{ title: 'Unit', key: 'unit', sortable: true },
|
||||||
{ title: 'Saham', key: 'saham', sortable: true },
|
{ title: 'Saham', key: 'saham', sortable: true },
|
||||||
{ title: 'Yuran', key: 'yuran', sortable: true },
|
{ title: 'Yuran', key: 'yuran', sortable: true },
|
||||||
|
{ title: 'Jumlah Pelaburan (hingga Dis 2025)', key: 'accumulated_amount', sortable: true },
|
||||||
|
{ title: 'Dividen Simpanan Khas (Tabung 1) Tahun 2025', key: 'pelaburan', sortable: true },
|
||||||
{ title: 'Tindakan', key: 'actions', sortable: false }
|
{ title: 'Tindakan', key: 'actions', sortable: false }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -393,6 +393,7 @@ export default {
|
|||||||
{ icon: "fa-building", label: "Unit", value: u.unit || "—" },
|
{ icon: "fa-building", label: "Unit", value: u.unit || "—" },
|
||||||
{ icon: "fa-line-chart", label: "Saham", value: "RM " + fmt(u.saham) },
|
{ icon: "fa-line-chart", label: "Saham", value: "RM " + fmt(u.saham) },
|
||||||
{ icon: "fa-money", label: "Yuran", value: "RM " + fmt(u.yuran) },
|
{ icon: "fa-money", label: "Yuran", value: "RM " + fmt(u.yuran) },
|
||||||
|
{ icon: "fa-bank", label: "Simpanan Khas (Tabung 1) - (Sehingga Dis 2025)", value: "RM " + fmt(u.accumulated_amount) },
|
||||||
{ icon: "fa-percent", label: "Dividen Simpanan Khas (Tabung 1) Tahun 2025", value: "RM " + fmt(u.pelaburan) }
|
{ icon: "fa-percent", label: "Dividen Simpanan Khas (Tabung 1) Tahun 2025", value: "RM " + fmt(u.pelaburan) }
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user