public function dispense($ic, $name) { $getID = Patient::where('pt_ic', $ic)->first(); //whole row $deID = $getID->id; //get the id from the ic $getcaseID = Record::where('pt_id', $deID)->first(); $caseID = $getcaseID->id; $disData = Dispensary::where('case_ref', $caseID)->first(); //xpe pakai first() sbb setiap case unik, case lain xpakai id ni $arrQty = explode("#", $disData->dispensed_quantity); $arrDrug = explode("#", $disData->dispensed_drug_code); //need declare $prices array x? $prices = array(); for ($x = 0; $x < count($arrDrug) - 1; $x++) { //get price of each drug into an array $hehe = Inventory::where('drug_name', $arrDrug[$x])->first(); $prices[$x] = $hehe->spu; } // $arrOne = count($arrDrug); // arr1 = druglist , arr2= respective qty of drug, arr3= respective price of drug $panel = Panel::all(); return view('staff.dispensary')->with('name', $name)->with('arr2', $arrQty)->with('arr1', $arrDrug)->with('arr3', $prices)->with('panel', $panel)->with('ptid', $deID); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $panel = Panel::find($id); $panel->delete(); //Session::flash('flash_message', 'Successfully deleted!'); return redirect()->action('PanelController@index'); }
public function done($id) { $task = Panel::find($id); if (date_default_timezone_get() != "prc") { date_default_timezone_set("prc"); } $task->actual_finish_date = date('y-m-d H:i:s', time()); $task->status = "3"; if ($task->save()) { return Redirect::to('panel'); } else { return Redirect::back()->withInput()->withErrors('保存失败!'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $data['patient'] = Patient::find($id); $panel = Panel::all(); return view('patient.edit', $data)->with('panel', $panel); }