pembuatan api

This commit is contained in:
hafifierahman
2020-12-28 18:36:49 +08:00
parent 52e91a2050
commit 232aa41f0e
17 changed files with 740 additions and 38 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class AddTunai extends Model
{
protected $table = 'addtunai';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['tarikh','kodcaw','kodlaluan','tambah','kurang','nota'];
public $timestamps = false;
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class AnsRugi extends Model
{
protected $table = 'ansrugi';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'nosiri',
'norujukan',
'nopelanggan',
'tarikh',
'bayaran',
'teller',
'nowakil',
'hubungan'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class BatalGadai extends Model
{
protected $table = 'batalgadai';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'recNo','noRujukan','tellerId','namaTeller', 'tarikh', 'masa'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+16
View File
@@ -0,0 +1,16 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Denominasi extends Model
{
protected $table = 'denominasi';
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class HapusKira extends Model
{
protected $table = 'hapuskira';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'RECNO',
'KODCAW',
'BATCHNO',
'NORUJUKAN',
'TARIKH',
'KADARUPAH',
'AMAUN',
'N_MARHUN',
'SEMUA',
'NOTA' ,
'PRKOD',
'TELLER',
'PELULUS',
'TERIMA',
'BAKIPJM',
'BAKIUPAH',
'KODGL'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers;
use App\CawanganDetail;
use App\Cawangan;
use App\Denominasi;
use Illuminate\Http\Request;
class DenominasiController extends Controller
{
public function listdenominasi($kodcaw)
{
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$data=Denominasi::on($cawangan['mysql'])->orderby('tarikh','desc')->limit(1)->get();
return response()->json($data);
}
}
-35
View File
@@ -351,41 +351,6 @@ class GadaiController extends Controller
return response()->json($gadai);
}
//API FARIS
public function listPenebusanBaru($kodcaw)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$gadai = Gadai::on($cawangan['mysql'])
->where([
['t_update','=',$current->toDateString()],
['cetak','=',1],['tagserah','=',1],
['semakbarcode','=','Lulus']
])
->get();
return response()->json($gadai);
}
public function listSerahKhazanah($kodcaw)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$gadai = Gadai::on($cawangan['mysql'])->where([['cetak','=',1],['tagserah','=',1],['semakbarcode','=','Tebus'],['t_update','=',$current->toDateString()]])->get();
return response()->json($gadai);
}
//END API FARIS
public function getLaporanGadai($kodcaw,$tarikh){
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
+60 -3
View File
@@ -9,6 +9,8 @@ use App\Transaction;
use App\TransaksiKeuntungan;
use App\Advansur;
use App\Tebus;
use App\InOutMar;
use Illuminate\Http\Request;
use Carbon\Carbon;
@@ -218,7 +220,7 @@ class TebusController extends Controller
'kodcaw'=> $kodcaw,
'norujukan'=> $norujukan,
'nopelanggan' => $request->nopelanggan,
'jenisbyr' => "TN",
'JenisByr' => "TN",
'jenistebus' => $request->jenistebus,
'glcode' => "0",
't_tebus' => $current->toDateString(),
@@ -237,8 +239,22 @@ class TebusController extends Controller
'historygadaian' => $request->historygadaian,
'tarikhbyrn' => $current->toDateString()
]);
return response()->json($update_gadai, 200);
$create_inoutmar = InOutMar::on($cawangan['mysql'])->create([
'TARIKH' => $current->toDateString(),
'MASA' => $current->toTimeString(),
'NORUJUKAN' => $norujukan,
'NM' => $request->nilai_marhun,
'KPD' => "kosong",
'DRP' => "kosong",
'BLN' => $current->month,
'THN' => $current->year,
'TAG' => 0,
'jenisTebus' => $request->jenistebus,
'namaTeller' => "nama teller"
]);
return response()->json($update_gadai, 201);
}
public function getLaporanTebus($kodcaw,$tarikh){
@@ -252,5 +268,46 @@ class TebusController extends Controller
return response()->json($tebus);
}
//API FARIS
public function listPenebusanBaru($kodcaw)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$gadai = Tebus::on($cawangan['mysql'])
->where([['t_tebus','=',$current->toDateString()],['tagterima','=',0]])
->get();
return response()->json($gadai);
}
public function listSerahKhazanah($kodcaw)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$gadai = Tebus::on($cawangan['mysql'])
->where([['t_tebus','=',$current->toDateString()],['tagterima','=',1]])
->get();
return response()->json($gadai);
}
public function tagterimaupdate($kodcaw,$norujukan)
{
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$update_inoutmar = Tebus::on($cawangan['mysql'])->where('norujukan','=',$norujukan)->update(array(
'tagterima' => 1
));
}
//END API FARIS
}
+179
View File
@@ -0,0 +1,179 @@
<?php
namespace App\Http\Controllers;
use App\Cawangan;
use App\Tunai;
use App\AddTunai;
use App\RequestTeller;
use Illuminate\Http\Request;
use Carbon\Carbon;
class TunaiController extends Controller
{
public function listTunai($kodcaw)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$tunai=Tunai::on($cawangan['mysql'])->where([['kodcaw','=',$kodcaw],['tarikh','=',$current->toDateString()]])->get();
return response()->json($tunai);
}
public function sumBakiTunai($kodcaw)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$tunai=Tunai::on($cawangan['mysql'])->where('tarikh','=',$current->toDateString())->sum('baki');
return response()->json($tunai);
}
public function UpdateTunai($kodcaw, $kodlaluan, Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$updatetunai=Tunai::on($cawangan['mysql'])->where( [['tarikh','=', $current->toDateString()],['kodlaluan','=', $kodlaluan] ])->
update(array(
'tambah'=>$request->tambah,
'kurang'=>$request->kurang,
'baki'=>$request->bakiakhir
));
return response()->json($updatetunai, 200);
}
public function DaftarTunai($kodcaw, Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$tunai=Tunai::on($cawangan['mysql'])->create([
'tarikh' => $current->toDateString(),
'kodcaw'=> $request->kodcaw,
'kodlaluan'=>$request->teller,
'bakiawal'=>$request->bakiawal,
'masuk'=>$request->masuk,
'yuran'=>$request->yuran,
'keluar'=>$request->keluar,
'baki'=>$request->baki,
'tambah'=>$request->tambah,
'kurang'=>$request->kurang
]);
return response()->json($tunai,201);
}
public function getCurrentTunai($kodcaw,$kodlaluan)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$tunai=Tunai::on($cawangan['mysql'])
->where([['kodcaw','=',$kodcaw],['tarikh','<=',$current->toDateString()],['kodlaluan','=',$kodlaluan]])
->orderBy('tarikh','desc')
->first();
return response()->json($tunai);
}
///API FARIS
public function create($kodcaw,Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$addtunai=AddTunai::on($cawangan['mysql'])->create([
'tarikh' => $current->toDateString(),
'kodcaw'=> $request->kodcaw,
'kodlaluan'=>$request->KodLaluan,
'tambah'=>$request->tambah,
'kurang'=>$request->kurang,
'nota'=>$request->nota
]);
return response()->json($addtunai,201);
}
public function getAddTunai($kodcaw,$tarikh)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$addtunai=AddTunai::on($cawangan['mysql'])->where([['kodcaw','=',$kodcaw],['tarikh','=',$tarikh]])->get();
return response()->json($addtunai);
}
public function getRequestTeller($kodcaw,$kodlaluan)
{
$current = Carbon::now();
$current = new Carbon();
$requestteller=RequestTeller::on('mysql7')->where([['kodcaw','=',$kodcaw],['KodLaluan','=',$kodlaluan],['update','=',0]])->get();
return response()->json($requestteller);
}
public function createRequestTeller($kodcaw,$kodlaluan,Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$reqteller=RequestTeller::on('mysql7')->create([
'tarikh' => $current->toDateString(),
'kodcaw' => $kodcaw,
'KodLaluan'=> $kodlaluan,
'modal'=>$request->modal,
'serahan'=>$request->serahan,
'update' => '0'
]);
return response()->json($reqteller,200);
}
}
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Http\Controllers;
use App\Vault;
use App\Cawangan;
use App\Tunai;
use App\AddTunai;
use Illuminate\Http\Request;
use Carbon\Carbon;
class VaultController extends Controller
{
public function list($kodcaw)
{
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$vault=Vault::on($cawangan['mysql'])->where('kodcaw','=',$kodcaw)->orderby('tarikh','desc')->limit(1)->get();
return response()->json($vault);
}
public function updateVault($kodcaw, Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$updateVault=Vault::on($cawangan['mysql'])->where([['tarikh','=',$current->toDateString()],['kodcaw','=', $kodcaw]])->update(array(
'Masuk'=>$request->masuk,
'Keluar'=>$request->keluar,
'BakiAkhir'=>$request->bakiakhir,
'BakiEod'=>$request->bakieod
) );
return response()->json($updateVault, 200);
}
public function create($kodcaw,Request $request)
{
$current = Carbon::now();
$current = new Carbon();
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$vault=Vault::on($cawangan['mysql'])->create([
'kodcaw'=>$request->kodcaw,
'tarikh'=> $current->toDateString()
]);
}
}
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class InOutMar extends Model
{
protected $table = 'inoutmar';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'TARIKH',
'MASA',
'NORUJUKAN',
'NM',
'KPD',
'DRP',
'BLN',
'THN',
'TAG',
'jenisTebus',
'namaTeller'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
public $timestamps = false;
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Pembeli extends Model
{
protected $table = 'pembeli';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'nopembeli',
'nokp',
'nama',
'alamat1',
'alamat2',
'alamat3',
'alamat4',
'telefon',
'tag_syarikat'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class RequestTeller extends Model
{
protected $table = 'requestteller';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['no','KodLaluan','modal','serahan','tarikh','update','kodcaw'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
public $timestamps = false;
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Tunai extends Model
{
protected $table = 'tunai';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['tarikh','kodcaw','kodlaluan','bakiawal','masuk','yuran','keluar','baki','tambah','kurang' ];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
public $timestamps = false;
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class TuntutBaki extends Model
{
protected $table = 'tuntutbaki';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'RECNO',
'BATCHNO',
'JENIS',
'KODCAW',
'NORUJUKAN',
'TARIKH',
'PRKOD',
'TELLER',
'PELULUS',
'BAKIPJM',
'BAKIUPAH',
'CAJLAIN',
'CAJLELONG',
'KODGL',
'GLCODE',
'TERIMA',
'F_LULUS',
'JUMLAH',
'NOWAKIL',
'HARGAJUAL',
'gst_cl',
'gst_hj'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Vault extends Model
{
protected $table = 'vault';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['kodcaw',
'tarikh',
'bakiawal',
'keluar',
'masuk',
'bakiakhir',
'bakieod',
'pendahuluan',
'serahan',
'1sen',
'5sen',
'10sen',
'20sen',
'50sen',
'rm1',
'rm2',
'rm5',
'rm10',
'rm50',
'rm100',
'rm1000',
'totPanjar'
];
public $timestamps = false;
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class WTD extends Model
{
protected $table = 'wtd';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'recno',
'tarikh',
'batchno',
'norujukan',
'nokp',
'nopelanggan',
't_jual',
'baki',
'kerugian',
'rugi',
'ansrugi',
'wtd',
'hargajual',
'pinjaman',
'bakiupah',
'cajlelong',
'gst_cl',
'norujukan2'
];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
// protected $hidden = [];
}