keluar lelong
This commit is contained in:
@@ -13,6 +13,8 @@ use App\AnsRugi;
|
||||
use App\SerahBaki;
|
||||
use App\Tebus;
|
||||
use App\Advansur;
|
||||
use App\LelTebus;
|
||||
use App\LelMarhun;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
@@ -558,6 +560,32 @@ class LelongController extends Controller
|
||||
foreach($cawangan_all as $index=>$cawangan){
|
||||
$list_tebus_today = Tebus::on($cawangan['mysql'])->where('t_tebus',$current->toDateString())->pluck('norujukan')->toArray();
|
||||
$list_advansur_today = Advansur::on($cawangan['mysql'])->where('tarikh',$current->toDateString())->pluck('norujukan')->toArray();
|
||||
|
||||
$gadai_tebus = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$list_advansur_today)->update([
|
||||
'taglel' => 0
|
||||
]);
|
||||
$gadai_advansur = Gadai::on($cawangan['mysql'])->whereIn('norujukan',$list_tebus_today)->update([
|
||||
'sttebus' => '',
|
||||
'taglel' => 0
|
||||
]);
|
||||
$lelong_tebus = Lelong::on($cawangan['mysql'])->whereIn('norujukan',$list_tebus_today)->get();
|
||||
foreach($lelong_tebus as $index=>$tebus_lelong){
|
||||
$tebus_detail = Tebus::on($cawangan['mysql'])->where('norujukan',$tebus_lelong['norujukan'])->first();
|
||||
|
||||
$lel_tebus = LelTebus::on($cawangan['mysql'])->create([
|
||||
'tarikh' => $current->toDateString(),
|
||||
'teller' => $tebus_detail['teller'],
|
||||
'norujukan' => $tebus_lelong['norujukan'],
|
||||
'batch_no' => $tebus_lelong['batchno'],
|
||||
'nilai_marhun' => $tebus_lelong['nilaimarhun'],
|
||||
'pinjaman' => $tebus_lelong['pinjaman'],
|
||||
'upah' => $tebus_detail['bakiupah'],
|
||||
'jbg' => $tebus_detail['jbg'],
|
||||
'jenis_tebus' => 'T',
|
||||
]);
|
||||
}
|
||||
$lelong_marhun_tebus = LelMarhun::on($cawangan['mysql'])->whereIn('norujukan',$list_tebus_today)->delete();
|
||||
$lelong_marhun_adv = LelMarhun::on($cawangan['mysql'])->whereIn('norujukan',$list_advansur_today)->delete();
|
||||
$lelong_tebus = Lelong::on($cawangan['mysql'])->whereIn('norujukan',$list_tebus_today)->delete();
|
||||
$lelong_advansur = Lelong::on($cawangan['mysql'])->whereIn('norujukan',$list_advansur_today)->delete();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LelMarhun extends Model
|
||||
{
|
||||
protected $table = 'lelmarhun';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LelTebus extends Model
|
||||
{
|
||||
protected $table = 'lelong_tebus';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'tarikh',
|
||||
'teller',
|
||||
'norujukan',
|
||||
'batch_no',
|
||||
'nilai_marhun',
|
||||
'pinjaman',
|
||||
'upah',
|
||||
'jbg',
|
||||
'jenis_tebus',
|
||||
];
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
// protected $hidden = [];
|
||||
}
|
||||
Reference in New Issue
Block a user