Example #1
0
 public static function onClosing()
 {
     $getLastOpen = Self::getLastOpen()->toArray();
     #$lastOpen['created_at']
     $lastOpen = $getLastOpen['created_at'];
     /**
      * Total de depositos
      * @var decimal
      */
     $deposites = Till::where('action', Self::getActionTrans('deposit'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $deposites = array_sum(array_column($deposites, 'cash'));
     /**
      * Total de Ventas
      * @var decimal
      */
     $cash_sales = Till::where('action', Self::getActionTrans('sale'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $cash_sales = array_sum(array_column($cash_sales, 'cash'));
     /**
      * Total de Ventas
      * @var decimal
      */
     $payable_sales = Till::where('action', Self::getActionTrans('sale'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $payable_sales = array_sum(array_column($payable_sales, 'payable'));
     /**
      * Total de Retiros
      * @var decimal
      */
     $withdrawals = Till::where('action', Self::getActionTrans('withdrawal'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $withdrawals = array_sum(array_column($withdrawals, 'cash'));
     $till = ['total_in_open_till' => $getLastOpen['till'], 'total_deposites' => $deposites, 'total_cash_sales' => $cash_sales, 'total_payable_sales' => $payable_sales, 'total_witdrawls' => $withdrawals, 'total_all_sales' => Calc::suma([$cash_sales, $payable_sales]), 'total_till' => Calc::resta([$cash_sales, $deposites, $getLastOpen['till']], [$withdrawals])];
     return (object) $till;
 }
Example #2
0
 public static function onClosing()
 {
     $getLastOpen = Self::getLastOpen()->toArray();
     #$lastOpen['created_at']
     $lastOpen = $getLastOpen['created_at'];
     /**
      * Total de depositos
      * @var decimal
      */
     $deposites = Till::where('action', Self::getActionTrans('deposit'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $deposites = array_sum(array_column($deposites, 'total'));
     /**
      * Total de Ventas de Parking
      * @var decimal
      */
     $parking_sales = Till::where('action', Self::getActionTrans('sale'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $parking_sales = array_sum(array_column($parking_sales, 'total'));
     /**
      * Total de Abonoso pagos
      * @var decimal
      */
     $total_subs = Till::where('action', Self::getActionTrans('sale_subs'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $total_subs = array_sum(array_column($total_subs, 'total'));
     /**
      * Total de Retiros
      * @var decimal
      */
     $withdrawals = Till::where('action', Self::getActionTrans('withdrawal'))->where('created_at', '>=', $lastOpen)->get()->toArray();
     $withdrawals = array_sum(array_column($withdrawals, 'total'));
     $till = ['total_deposites' => $deposites, 'total_parking_sales' => $parking_sales, 'total_subscription' => $total_subs, 'total_witdrawls' => $withdrawals, 'total_all_sales' => Calc::suma([$parking_sales, $total_subs]), 'total_income' => Calc::suma([$parking_sales, $total_subs, $deposites])];
     $till['total_in_till'] = Calc::resta([$till['total_income']], [$withdrawals]);
     # lo que queda en caja con la suma total menos los depositos.
     return (object) $till;
 }