diff --git a/app/Services/Miscellaneous/PanjarServices.php b/app/Services/Miscellaneous/PanjarServices.php index 46ded2c..deafb20 100644 --- a/app/Services/Miscellaneous/PanjarServices.php +++ b/app/Services/Miscellaneous/PanjarServices.php @@ -129,7 +129,7 @@ class PanjarServices if (!$vault) throw new \Exception('Custom Exception: Vault Does Not Exist!'); if (!$deno_panjar) throw new \Exception('Custom Exception: Denominasi Panjar Does Not Exist!'); - DB::transaction(function () use ($cawangan,$deno_panjar,$panjar,$denominasi,$current,$vault,$request,$bakiperubatan) { + return DB::transaction(function () use ($cawangan,$deno_panjar,$panjar,$denominasi,$current,$vault,$totalperubatan) { $return_data = $this->calculation_denominasi($deno_panjar,$denominasi,'masuk'); if($return_data == 'no data') throw new \Exception('Custom Exception: Denominasi Panjar Not Return Data'); @@ -200,11 +200,13 @@ class PanjarServices DenoPanjar::on('mysql7')->where('kodcaw', $this->cawangan)->where('recno', $panjar['recno'])->latest('tarikh','masa')->delete(); Panjar::on($cawangan['mysql'])->where('recno',$panjar['recno'])->delete(); - $array_response = [ + return $array_response = [ 'result' => 'success', 'data' => 1, 'bakiperubatan' => $totalperubatan, - ]; + 'tuntutoleh' => $panjar['tuntutoleh'], + 'jenis' => ($panjar['kategori'] == 'Belanja AM - Perubatan') ? 'perubatan' : 'none' + ]; }); }catch(\Exception $e){ @@ -278,7 +280,7 @@ class PanjarServices 'update' => '0' ]); - $return_data = $this->calculation_denominasi($denopanjar,$denominasi,'masuk'); + $return_data = $this->calculation_denominasi($denopanjar,$denominasi,'keluar'); if($return_data == 'no data') throw new \Exception('Custom Exception: Denominasi Panjar Not Return Data'); Denominasi::on($cawangan['mysql'])->where([['tarikh','=',$current->toDateString()]])->update(array(