added penyelarasan table to remove bakilelong hardcode and put in untungrugiterkumpul
This commit is contained in:
@@ -62,6 +62,7 @@ use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Jobs\AccountCheckJob;
|
||||
use App\Penyelarasan;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
@@ -3789,6 +3790,10 @@ class AdminPageController extends Controller
|
||||
if($kodcaw == 'KB2')
|
||||
$total -= 64.8;
|
||||
|
||||
$total += Penyelarasan::on('mysql7')
|
||||
->where('kodcaw', $kodcaw)
|
||||
->sum(DB::raw('rugilelong + bakilelong + `lain-lain`'));
|
||||
|
||||
return response()->json($total,200);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,16 +225,12 @@ class LelongController extends Controller
|
||||
|
||||
$rugitotal=$rugilelong + $ansrugi;
|
||||
|
||||
if($kodcaw == 'APM')
|
||||
// $bakilelong += 4498.1;
|
||||
$bakilelong += 1228.07;
|
||||
|
||||
if($kodcaw == '010617')
|
||||
$rugitotal -= 6.1;
|
||||
|
||||
if($kodcaw == '011229'){
|
||||
$rugitotal -= 919.7;
|
||||
$bakilelong -= 144;
|
||||
}
|
||||
|
||||
if($kodcaw == '011412')
|
||||
@@ -242,31 +238,13 @@ class LelongController extends Controller
|
||||
|
||||
if($kodcaw == '020303')
|
||||
{
|
||||
$bakilelong -= 542.6;
|
||||
$rugitotal += 0.01;
|
||||
}
|
||||
|
||||
if($kodcaw === '011232')
|
||||
{
|
||||
$bakilelong += 6;
|
||||
}
|
||||
|
||||
if($kodcaw === 'ARP'){
|
||||
$rugitotal += 119;
|
||||
}
|
||||
|
||||
if($kodcaw == '020301'){
|
||||
$bakilelong -= 719.50;
|
||||
}
|
||||
|
||||
if($kodcaw == '011227'){
|
||||
$bakilelong -= 896.65;
|
||||
}
|
||||
|
||||
if($kodcaw == 'GC'){
|
||||
$bakilelong += 2135.75;
|
||||
$bakilelong -= 3; //added 15/10/2024 sebab ada kemusykilan 3 ringgit daripada rugi lelong
|
||||
}
|
||||
|
||||
$arraylelong = ['bakilelong' => $bakilelong, 'rugilelong' => $rugitotal];
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Penyelarasan extends Model
|
||||
{
|
||||
protected $table = 'penyelarasan';
|
||||
// public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
protected $fillable = [
|
||||
'kodcaw',
|
||||
'rugilelong',
|
||||
'bakilelong',
|
||||
'lain-lain',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePenyelarasanTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::create('penyelarasan', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->char('kodcaw', 20);
|
||||
$table->decimal('rugilelong', 10, 2)->default(0);
|
||||
$table->decimal('bakilelong', 10, 2)->default(0);
|
||||
$table->decimal('lain-lain', 10, 2)->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('penyelarasan');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user