Add export data lelong
This commit is contained in:
+8
-3
@@ -7,15 +7,20 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class BatchLel extends Model
|
class BatchLel extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'batchlel';
|
protected $table = 'batchlel';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
// protected $fillable = [
|
protected $fillable = [
|
||||||
|
'tarikh',
|
||||||
// ];
|
'tarikh2',
|
||||||
|
'batchno',
|
||||||
|
'kodcaw'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes excluded from the model's JSON form.
|
* The attributes excluded from the model's JSON form.
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ use App\Tebus;
|
|||||||
use App\Advansur;
|
use App\Advansur;
|
||||||
use App\LelTebus;
|
use App\LelTebus;
|
||||||
use App\LelMarhun;
|
use App\LelMarhun;
|
||||||
|
use App\Tunai;
|
||||||
use App\Audit;
|
use App\Audit;
|
||||||
|
use App\GlDetail;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
@@ -963,4 +965,66 @@ class LelongController extends Controller
|
|||||||
return response()->json($arraylelong);
|
return response()->json($arraylelong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportLelong(Request $request)
|
||||||
|
{
|
||||||
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw', $request->kodcaw)->first();
|
||||||
|
|
||||||
|
$batchlel = BatchLel::on($cawangan['mysql'])
|
||||||
|
->select('batchno')
|
||||||
|
->orderBy('batchno', 'desc')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$newBatchNo = $batchlel->batchno + 1;
|
||||||
|
|
||||||
|
$newBatchLel = BatchLel::on($cawangan['mysql'])->create([
|
||||||
|
'kodcaw' => $request->kodcaw,
|
||||||
|
'batchno' => $newBatchNo,
|
||||||
|
'tarikh' => $request->tarikh,
|
||||||
|
'tarikh2' => $request->tarikh,
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($request->lelongbid as $index) {
|
||||||
|
$lelong_to_be_inserted = new Lelong();
|
||||||
|
$lelong_to_be_inserted->kodcaw = $index['kodcaw'];
|
||||||
|
$lelong_to_be_inserted->batchno = $newBatchNo;
|
||||||
|
$lelong_to_be_inserted->t_lelong = $request->tarikh;
|
||||||
|
$lelong_to_be_inserted->norujukan = $index['norujukan'];
|
||||||
|
|
||||||
|
$lelong_arr[] = $lelong_to_be_inserted->attributesToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
Lelong::on($cawangan['mysql'])->insert($lelong_arr);
|
||||||
|
|
||||||
|
foreach ($request->lelongbidmarhun as $data) {
|
||||||
|
$lelmarhun_to_be_inserted = new LelMarhun();
|
||||||
|
$lelmarhun_to_be_inserted->kodcaw = $request['kodcaw'];
|
||||||
|
$lelmarhun_to_be_inserted->norujukan = $data['norujukan'];
|
||||||
|
$lelmarhun_to_be_inserted->t_gadai = $data['t_gadai'];
|
||||||
|
$lelmarhun_to_be_inserted->nota = $data['nota'];
|
||||||
|
$lelmarhun_to_be_inserted->batch_no = $newBatchNo;
|
||||||
|
|
||||||
|
$lelmarhun_arr[] = $lelmarhun_to_be_inserted->attributesToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
LelMarhun::on($cawangan['mysql'])->insert($lelmarhun_arr);
|
||||||
|
|
||||||
|
$tunai = Tunai::on($cawangan['mysql'])->create([
|
||||||
|
'tarikh' => $request->tarikh,
|
||||||
|
'kodlaluan' => "LELONG",
|
||||||
|
'masuk' => $request->tunai,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$gldetail = GlDetail::on($cawangan['mysql'])->create([
|
||||||
|
'tarikh' => $request->tarikh,
|
||||||
|
'dtacct' => "1000/010",
|
||||||
|
'ktacct' => "1000/020",
|
||||||
|
'teller' => "LELONG ONLINE",
|
||||||
|
'descpt' => "SERAHAN LELONG ONLINE",
|
||||||
|
'amaun' => $request->gldetail
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
return response()->json("success");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ class LelMarhun extends Model
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'kodcaw',
|
||||||
|
'norujukan',
|
||||||
|
't_gadai',
|
||||||
|
'marhun',
|
||||||
|
'nota',
|
||||||
|
'batch_no',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes excluded from the model's JSON form.
|
* The attributes excluded from the model's JSON form.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -740,6 +740,7 @@ $router->group(['prefix'=>'admin'], function () use ($router){
|
|||||||
$router->group(['prefix'=>'lelong'], function () use ($router){
|
$router->group(['prefix'=>'lelong'], function () use ($router){
|
||||||
$router->post('taglel/update',['uses'=>'GadaiController@updateTagLelong']);
|
$router->post('taglel/update',['uses'=>'GadaiController@updateTagLelong']);
|
||||||
$router->post('taglel/revert',['uses'=>'GadaiController@revertTagLelong']);
|
$router->post('taglel/revert',['uses'=>'GadaiController@revertTagLelong']);
|
||||||
|
$router->post('exportLelong',['uses'=>'LelongController@exportLelong']);
|
||||||
});
|
});
|
||||||
|
|
||||||
$router->group(['prefix'=>'kelantanpay'], function () use ($router){
|
$router->group(['prefix'=>'kelantanpay'], function () use ($router){
|
||||||
|
|||||||
Reference in New Issue
Block a user