示例#1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(ReceivingRequest $request)
 {
     $receivings = new Receiving();
     $receivings->supplier_id = Input::get('supplier_id');
     $receivings->user_id = Auth::user()->id;
     $receivings->payment_type = Input::get('payment_type');
     $receivings->comments = Input::get('comments');
     $receivings->save();
     // process receiving items
     $receivingItems = ReceivingTemp::all();
     foreach ($receivingItems as $value) {
         $receivingItemsData = new ReceivingItem();
         $receivingItemsData->receiving_id = $receivings->id;
         $receivingItemsData->item_id = $value->item_id;
         $receivingItemsData->cost_price = $value->cost_price;
         $receivingItemsData->quantity = $value->quantity;
         $receivingItemsData->total_cost = $value->total_cost;
         $receivingItemsData->save();
         //process inventory
         $items = Item::find($value->item_id);
         $inventories = new Inventory();
         $inventories->item_id = $value->item_id;
         $inventories->user_id = Auth::user()->id;
         $inventories->in_out_qty = $value->quantity;
         $inventories->remarks = 'RECV' . $receivings->id;
         $inventories->save();
         //process item quantity
         $items->quantity = $items->quantity + $value->quantity;
         $items->save();
     }
     //delete all data on ReceivingTemp model
     ReceivingTemp::truncate();
     $itemsreceiving = ReceivingItem::where('receiving_id', $receivingItemsData->receiving_id)->get();
     Session::flash('message', 'You have successfully added receivings');
     //return Redirect::to('receivings');
     return view('receiving.complete')->with('receivings', $receivings)->with('receivingItemsData', $receivingItemsData)->with('receivingItems', $itemsreceiving);
 }
示例#2
0
 public static function check_data($user)
 {
     if ($user == 'moving') {
         $data = LocationMovingTr::count();
     } elseif ($user == 'items') {
         $data = Item::count();
     } elseif ($user == 'location') {
         $data = Location::count();
     } elseif ($user == 'sale') {
         $data = Sale::count();
     } elseif ($user == 'receiving') {
         $data = Receiving::count();
     } elseif ($user == 'saletemp') {
         $data = SaleTemp::count();
     }
     return $data;
 }
示例#3
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $items = Item::where('type', 1)->count();
     $item_kits = Item::where('type', 2)->count();
     $customers = Customer::count();
     $suppliers = Supplier::count();
     $receivings = Receiving::count();
     $sales = Sale::count();
     $employees = User::count();
     // passing jam variable
     $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu", "Minggu");
     $hari = $array_hari[date("N")];
     $tanggal = date("j");
     $array_bulan = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember");
     $bulan = $array_bulan[date("n")];
     $tahun = date("Y");
     $date = "{$tanggal} {$bulan} {$tahun}";
     $time = date("H:i:s");
     //end jam
     return view('home')->with('items', $items)->with('item_kits', $item_kits)->with('customers', $customers)->with('suppliers', $suppliers)->with('receivings', $receivings)->with('sales', $sales)->with('employees', $employees)->with('date', $date);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $receivingsReport = Receiving::all();
     return view('report.receiving')->with('receivingReport', $receivingsReport);
 }