コード例 #1
0
ファイル: Article.php プロジェクト: heromdn/inventarios
 /**
  * Devuelve la cantidad involucrada en ventas pendientes.
  * @param  Branche $branch
  * @return integer $cantidad
  */
 public function inSales($branch)
 {
     $salesPendientes = Sale::where('status', '=', 'pendiente')->where('branch_id', '=', $branch->id)->get();
     $cantidad = 0;
     foreach ($salesPendientes as $sale) {
         foreach ($sale->saleItems as $item) {
             if ($this->id == $item->article->id) {
                 $cantidad += $item->amount;
             }
         }
     }
     return $cantidad;
 }
コード例 #2
0
 public function getFilterById()
 {
     $TIPO_REMISION = self::TIPO_REMISION;
     $title = 'Ventas';
     $input = Input::all();
     $sales = Sale::where('id', '=', $input['idRemision'])->orderBy('id', 'desc')->paginate(6);
     $mensaje = 'Venta con código <strong>' . $input['idRemision'] . '</strong>';
     return View::make('sales.index')->with(compact('title', 'sales', 'mensaje', 'input', 'TIPO_REMISION'));
 }
コード例 #3
0
ファイル: CustomersController.php プロジェクト: fagray/fposs
 /**
  * Customers Profile
  */
 public function profile($id)
 {
     $customer = $this->customer->findOrFail($id);
     $total_amount_purchased = $this->customer->getTotalAmountPurchased($customer->id);
     $invoices = Sale::where('customer_id', '=', $customer->id)->groupBy('trans_id')->get();
     return View::make('customers.profile')->with('title', 'Customer Profile | ' . $customer->fname)->with('customer', $customer)->with('total', $total_amount_purchased)->with('invoices', $invoices);
 }