protected function processAddStockProduct(\Emayk\Ics\Repo\Transaction\Receive\Product\History $recordItemHistory) { /*Menambahkan Product dari Item History*/ $qtyIn = $recordItemHistory->qty; $qtyrollIn = $recordItemHistory->qtyroll; $sjId = $recordItemHistory->sj_id; $totalqty = $recordItemHistory->getTotalQtyReceived(); //? $receivedate = $recordItemHistory->receivedate; $totalroll = $recordItemHistory->getTotalRollReceived(); $createby_id = $recordItemHistory->getReceiveBy(); // $trxnumber = $recordItemHistory->trxnumber; /** * Jika Product Stock Belum ada */ $product = $recordItemHistory->product; if (is_null($product->stock)) { $totalqty = 0; $totalroll = 0; $oStock = new \Emayk\Ics\Repo\Factory\Product\Stock\Eloquent(); $stock = $oStock->add($product, $totalqty, $totalroll, $createby_id); } else { $stock = $recordItemHistory->product->stock; } $StockHistory = new \Emayk\Ics\Repo\Factory\Product\Stock\History(); $refDoc = $StockHistory->getRefDoc() . $trxnumber; $noRoll = $StockHistory->getNextNoroll(); $StockHistory->addrecord($stock, $refDoc, $noRoll, $qtyIn, 0, 0, $qtyrollIn, $recordItemHistory->qtyreceived, $recordItemHistory->qtyrollreceived, $receivedate, $createby_id, $sjId); }
protected function addEmptyStock() { if (is_null($this->stock)) { $oStock = new \Emayk\Ics\Repo\Factory\Product\Stock\Eloquent(); // $product = $this; $stock = $oStock->add($product, 0, 0, $this->getUid()); return $stock; } }
// $hpp->save(); // \Log::info('Setelah disave adalah', $hpp->toArray()); // } } return 'Done'; }); Route::get("addstock", function () { $oProducts = new \Emayk\Ics\Repo\Factory\Product\Eloquent(); //::lists('id'); $productIds = $oProducts->lists('id'); $product = $oProducts->findOrFail(1); $product->load('stock'); $trxnumber_simulasi = 'TRX' . time(); if (is_null($product->stock)) { // Buat Stock $stock = new \Emayk\Ics\Repo\Factory\Product\Stock\Eloquent(); $stock->add($product, 0, 0, 1); } return $oProducts->findOrFail(1); }); Route::get('/', function () { return 'Test Print'; }); }); Route::group(array('prefix' => 'print'), function () { Route::get('/', function () { return 'Test Print'; }); Route::get('sent_order_to_receive', function () { $order = new \Emayk\Ics\Repo\Transaction\Purchase\Order\Eloquent(); /*Update Database dengan record yang ditentukan*/