/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('work_order_tasks')->delete(); $work_order_tasks = array(['name' => 'Created', 'order' => 1, 'active' => 0], ['name' => 'Approved', 'order' => 2, 'active' => 1], ['name' => 'Cut', 'order' => 3, 'active' => 1], ['name' => 'Based', 'order' => 4, 'active' => 1], ['name' => 'Stencil Cut', 'order' => 5, 'active' => 1], ['name' => 'Painted', 'order' => 6, 'active' => 1]); foreach ($work_order_tasks as $wot) { WorkOrderTask::create($wot); } Model::reguard(); }
public function index(Request $request) { $returnVals = array(); $requestedReport = $request['view']; $returnVals['view'] = $requestedReport; $returnVals['args'] = array(); switch ($requestedReport) { case 'weekworkorders': $returnVals['workordertasks'] = WorkOrderTask::select(['id', 'name'])->where('active', 1)->orderBy('order', 'asc')->get(); $returnVals['args']['detailsview'] = intval($request['details']); $returnVals['results'] = $this->reportService->getWeekWorkOrderReport(); break; } //dd($returnVals); return view('print')->with($returnVals); }
public function finalizePurchaseOrder($poId) { $returnData = []; try { \DB::beginTransaction(); // Mark completed field for all work orders for this PO WorkOrder::where('purchase_order_id', $poId)->update(['completed' => 1]); // Get all work orders for this PO $workOrderIds = WorkOrder::where('purchase_order_id', $poId)->select(['id'])->get(); // Get all WorkOrderTask statuses $workOrderTaskIds = WorkOrderTask::select(['id'])->where('active', 1)->get(); foreach ($workOrderIds as $woId) { // Delete all existing progress rows first WorkOrderProgress::where('work_order_id', $woId)->delete(); } /* foreach($workOrderIds as $woId) { // Create full set of statuses for this work order foreach($workOrderTaskIds as $woTaskId) { WorkOrderProgress::create([ 'work_order_id' => $woId, 'work_order_task_id' => $woTaskId ]); } } */ // Future PO finalization stuff goes here. \DB::commit(); //return $returnData; } catch (\Exception $ex) { \DB::rollBack(); throw $ex; } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $work_order_tasks = WorkOrderTask::select(['id', 'name'])->where('active', 1)->orderBy('order', 'asc')->get(); return $work_order_tasks; }