public static function createCDV($data)
 {
     $CDV = $data['CDV'];
     $entries = json_decode($data['entries']);
     $userID = $data['userID'];
     $CDVNumSeries = CheckDisbursements::CDVNumSeries();
     $CDVNo = CheckDisbursements::getCDVNum();
     $ID = $CDVNo[0]->idNum;
     $Voucher = $CDVNo[0]->numSeries + 1;
     DB::table('tbl_series')->where('idNum', $ID)->update(['numSeries' => $Voucher]);
     $id = DB::table('tbl_cdv')->insertGetId(['CDVNo' => $CDVNumSeries[0]->CDV, 'payee' => $CDV['payee'], 'address' => $CDV['address'], 'chkDate' => $CDV['dt'], 'bankID' => $CDV['bank'], 'amount' => $CDV['amount'], 'chkNO' => $CDV['chkNO'], 'particular' => $CDV['particular'], 'transDate' => Carbon::NOW(), 'prepBy' => $userID]);
     for ($i = 0; $i < count($entries); $i++) {
         $var = $entries[$i];
         $amount = isset($var->DB) && $var->DB > 0 ? $var->DB : $var->CR;
         if (isset($var->DB) && !empty($var->DB)) {
             $ID = $var->acctTitle;
         } else {
             $ID = null;
         }
         if (isset($var->CR) && !empty($var->CR)) {
             $ID2 = $var->acctTitle;
         } else {
             $ID2 = null;
         }
         DB::table('tbl_acctngentries')->insert(['cdvID' => $id, 'idAcctTitleDB' => $ID, 'idAcctTitleCR' => $ID2, 'amount' => $amount]);
     }
     if ($id) {
         $ids['success'] = 'true';
         $ids['msg'] = 'New CDV has been saved';
     } else {
         $ids['success'] = 'false';
         $ids['msg'] = 'WARNING: Unknown error occur while creatting CDV';
     }
     return $ids;
 }
 public function getCDVNum()
 {
     $data = CheckDisbursements::getCDVNum();
     return response()->json($data);
 }