Merge branch 'feature/add-jumlah-div-terkumpul' into 'main'
DONE: add accumulated amount display See merge request erahn/voting!17
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',
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -33,6 +33,17 @@
|
|||||||
<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">
|
||||||
|
<label for="accumulated_amount">Jumlah Pelaburan (hingga Dis 2025)</label>
|
||||||
|
<input type="text" name="accumulated_amount" class="form-control"
|
||||||
|
:value="data.voter.accumulated_amount" required />
|
||||||
|
</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">
|
<div class="form-group">
|
||||||
<input type="submit" value="Hantar" class="btn btn-success" />
|
<input type="submit" value="Hantar" class="btn btn-success" />
|
||||||
<router-link :to="{ name: 'Manage Voter' }" class="btn btn-default">Kembali</router-link>
|
<router-link :to="{ name: 'Manage Voter' }" class="btn btn-default">Kembali</router-link>
|
||||||
|
|||||||
@@ -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