/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $dateA = Input::get('dateApplication'); $dateApplication = date(microtime(substr($dateA, 6, 4) . "-" . substr($dateA, 3, 2) . "-" . substr($dateA, 0, 2) . " " . substr($dateA, 10, 6)) * 10000); $boosterI = Input::get('boosterInjection'); $boosterInjection = date(microtime(substr($boosterI, 6, 4) . "-" . substr($boosterI, 3, 2) . "-" . substr($boosterI, 0, 2) . " " . substr($boosterI, 10, 6)) * 10000); //dd($request->diseaseName); $animalName = Animal::where('id', $request->animalName)->pluck('nombre'); $diseaseName = Disease::where('id', $request->diseaseName)->pluck('name'); $vaccineName = Vaccine::where('id', $request->vaccineName)->pluck('name'); $vc = new VaccinationControl(); $vc->idUser = Auth::id(); $vc->animalName = $animalName; $vc->diseaseName = $diseaseName; $vc->vaccineName = $vaccineName; $vc->dateApplication = Input::get('dateApplication'); $vc->dose = Input::get('dose'); $vc->responsible = Input::get('responsible'); $vc->boosterInjection = Input::get('boosterInjection'); //dd($vc); $vc->save(); $event = new Calendar(); $event->idUser = Auth::id(); $event->title = 'Vacunacion'; $event->body = 'Programada'; $event->url = 'http://localhost:8000/vaccinationControl'; $event->class = 'Preventivo'; $event->start = $dateApplication; $event->end = $boosterInjection; $event->save(); return redirect()->route('vaccinationControl.show'); }
/** * get storage volume of specific store. * * @param int $id * @return Response */ public function vaccineStocks($id) { $item = Stock::where('recipient_id', Auth::user()->recipient_id)->select('vaccine_id', DB::raw('sum(amount) as total'))->groupBy('vaccine_id')->get(); $array = array(); foreach ($item as $stock) { $array[] = array('id' => $stock->vaccine_id, 'name' => Vaccine::find($stock->vaccine_id)->name, 'amount' => $stock->total); } return json_encode($array); }
public function ejecutar_vacunas(Request $request) { $rules = array('dateApplication' => 'required', 'boosterInjection' => 'required', 'dose' => 'required', 'responsible' => 'required'); $this->validate($request, $rules); $dateA = Input::get('dateApplication'); $dateApplication = date(microtime(substr($dateA, 6, 4) . "-" . substr($dateA, 3, 2) . "-" . substr($dateA, 0, 2) . " " . substr($dateA, 10, 6)) * 10000); $boosterI = Input::get('boosterInjection'); $boosterInjection = date(microtime(substr($dateA, 6, 4) . "-" . substr($dateA, 3, 2) . "-" . substr($dateA, 0, 2) . " " . substr($dateA, 10, 6)) * 10000); $price = Vaccine::where('id', $request->vaccineName)->pluck('price_ml'); $vc = new VaccinationControl(); $vc->idUser = Auth::id(); $vc->animalName = $request->animalName; $vc->diseaseName = $request->animalName; $vc->vaccineName = $request->vaccineName; $vc->dateApplication = $request->dateApplication; $vc->dose = $request->dose; $vc->value = $request->dose * $price; $vc->responsible = $request->responsible; $vc->boosterInjection = $request->boosterInjection; $vc->save(); $event = new Calendar(); $event->idUser = Auth::id(); $event->title = 'Vacunacion'; $event->body = 'Programada'; $event->url = 'http://localhost:8000/vaccinationControl'; $event->class = 'Preventivo'; $event->start = $dateApplication; $event->end = $boosterInjection; $event->save(); return redirect()->route('animal.index'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, Request $request) { $vaccine = Vaccine::findOrFail($id); if (Input::hasFile('image')) { $file = Input::file('image'); //Creamos una instancia de la libreria instalada $image = \Image::make(\Input::file('image')); //Ruta donde queremos guardar las imagenes $path = 'img/vaccines/'; // Guardar Original //$image->save($path.$file->getClientOriginalName()); // Cambiar de tamaño $image->resize(450, 450); $image->save($path . $file->getClientOriginalName()); // Guardar //$image->save($path.'injec_'.$file->getClientOriginalName()); //Guardamos nombre y nombreOriginal en la BD $vaccine->nameV = Input::get('name'); $vaccine->indications = Input::get('indications'); $vaccine->Dosage = Input::get('Dosage'); $vaccine->composition = Input::get('composition'); $vaccine->application = Input::get('application'); $vaccine->precautions = Input::get('precautions'); $vaccine->effects = Input::get('effects'); $vaccine->size = Input::get('sizes'); $vaccine->price = Input::get('prices'); //dd($request->price); $price_ml = $request->prices / $request->sizes; $vaccine->price_ml = $price_ml; $vaccine->due_date = Input::get('due_date'); $vaccine->image = $file->getClientOriginalName(); $vaccine->save(); return redirect()->route('vaccine.index'); } $file = Vaccine::where('id', $id)->pluck('image'); $vaccine->nameV = Input::get('name'); $vaccine->indications = Input::get('indications'); $vaccine->Dosage = Input::get('Dosage'); $vaccine->composition = Input::get('composition'); $vaccine->application = Input::get('application'); $vaccine->precautions = Input::get('precautions'); $vaccine->effects = Input::get('effects'); $vaccine->size = Input::get('sizes'); $vaccine->price = Input::get('prices'); $price_ml = $request->prices / $request->sizes; $vaccine->price_ml = $price_ml; $vaccine->due_date = Input::get('due_date'); $vaccine->image = $file; $vaccine->save(); return redirect()->route('vaccine.index'); }
public function move_item(Request $request) { $storeStock = StoreStock::find($request->input('item_id')); $volume = $request->input('doses') * PackagingInformation::find($storeStock->packaging_id)->cm_per_dose * 0.001; $recipient = Recipient::find(Auth::user()->recipient_id); $storeStock->amount = $request->has('doses') ? $storeStock->amount - $request->input('doses') : $storeStock->amount; $storeStock->save(); if ($storeStock->amount == 0) { $storeStock->delete(); } if (count(StoreStock::where('store_id', $request->input('to_store'))->where('vaccine_id', $storeStock->vaccine_id)->where('lot_number', $storeStock->lot_number)->get()) != 0) { $storeStock1 = StoreStock::where('store_id', $request->input('to_store'))->where('vaccine_id', $storeStock->vaccine_id)->where('lot_number', $storeStock->lot_number)->first(); $storeStock1->amount = $request->has('doses') ? $storeStock1->amount + $request->input('doses') : $storeStock1->amount; $storeStock1->save(); } else { $storeStock1 = new StoreStock(); $storeStock1->vaccine_id = $storeStock->vaccine_id; $storeStock1->store_id = $request->input('to_store'); $storeStock1->amount = $request->input('doses'); $storeStock1->lot_number = $storeStock->lot_number; $storeStock1->packaging_id = $storeStock->packaging_id; $storeStock1->expiry_date = $storeStock->expiry_date; $storeStock1->unit_price = $storeStock->unit_price; $storeStock1->source_id = $storeStock->source_id; $storeStock1->activity_id = $storeStock->activity_id; $storeStock1->save(); } $movement = new ItemMovement(); $nextNumber = $this->getNextMovementNumber(); $str = ""; for ($sj = 6; $sj > strlen($nextNumber); $sj--) { $str .= "0"; } $movement->reference = date('Y') . "4" . $str + "" . $nextNumber; $movement->from_store = $storeStock->store_id; $movement->to_store = $storeStock1->store_id; $movement->store_item_id = $storeStock->id; $movement->user_id = Auth::user()->id; $movement->amount = $request->input('doses'); $movement->recipient_id = Auth::user()->recipient_id; $movement->vaccine_id = $storeStock->vaccine_id; $movement->lot_number = $storeStock->lot_number; $movement->expiry_date = $storeStock->expiry_date; $movement->moved_volume = $volume; $movement->year = date('Y'); $movement->order_no = $nextNumber; $movement->save(); $store = Store::find($storeStock->store_id); $store1 = Store::find($storeStock1->store_id); $store->used_volume = $store->used_volume - $volume; $store->save(); $store1->used_volume = $store1->used_volume + $volume; $store1->save(); Log::create(array("user_id" => Auth::user()->id, "action" => "Move " . $request->input('doses') . " Doses of " . Vaccine::find($storeStock->vaccine_id)->name . " from " . $store->name . " To " . $store1->name)); return $movement->reference; }
*/ Route::get('/', function () { //return view('welcome'); return view('index'); }); Route::get('dropdown', function () { return view('dropdown'); }); Route::get('form', function () { return view('form'); }); Route::post('post_to_me', function () { echo 'hit here'; }); Route::get('categories', function () { $categories = \App\Vaccine::all(); return View::make('index')->with('vaccines', $vaccines); }); Route::get('/ajax-subcat', function () { $cat_id = Input::get('cat_id'); $subcategories = \App\Age::where('category_id', '=', $cat_id)->get(); return Response::json($Age); }); Route::get('/admin/ancu/health', function () { $title = "testing healthinfo page"; return view('admin.ancu.healthinfo', compact('title')); }); Route::group(['prefix' => 'admin'], function () { # Admin Dashboard Route::get('/', 'AdminDashboardController@index'); # Department Management
public function to_pdf($id) { $barcode = new DNS1D(); $translation = array("english" => array("title" => "Vaccines Visibility System", "voucher_title" => "Ministry Of Health, Government of Nicaragua", "dispatch_date" => "Dispatch Date", "entered_by" => "Entered By :", "issued_to" => "Issued To :", "transport_mode1" => "Transport Mode :", "product" => "Products", "manufacture" => "Manufacturer", "lot_number" => "Batch Number", "expired_date" => "Expiration Date", "doses" => "Doses", "vials" => "Vials", "t_price" => "T. Price", "total_price" => "Total Price :", "issued" => "Issued By", "name_signature" => "Name & Designation:", "sign" => "Signature:", "receiver" => "Received By"), "spanish" => array("title" => "Sistema de Visibilidad de Vacunas", "voucher_title" => "Ministerio de Salud, Gobierno de Nicaragua", "dispatch_date" => "Fecha de Despacho", "entered_by" => "Anotado por :", "issued_to" => "Enviado a :", "transport_mode1" => "Modo de Transporte :", "product" => "Producto", "manufacture" => "Fabricante", "lot_number" => "Número de Lote", "expired_date" => "Fecha de Caducación", "doses" => "Dosis", "vials" => "Frascos", "t_price" => "Precio T.", "total_price" => "Precio Total :", "issued" => "Despachado por", "name_signature" => "Nombre y Designación:", "sign" => "Firma:", "receiver" => "Recibido Por")); $system_settings = SystemSettings::where('id', '!=', "0")->first(); $lanKey = $system_settings->language; $main_currency = $system_settings->main_currency; $translate = $lanKey == "enUS" ? $translation['english'] : $translation['spanish']; $package = RecipientPackage::where('voucher_number', $id)->first(); $transport = TransportMode::find($package->transport_mode_id); $issued_to = Recipient::find($package->recipient_id); $user = User::find($package->sending_user); $html = "<div style='width: 710px; font-family: \"Droid Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;'>"; $html .= "<table style='width: 710px; font-family: \"Droid Sans\",\"Helvetica Neue\",Helvetica,Arial,sans-serif;'>"; $html .= '<tr>'; $html .= '<td><img src="' . asset('img/logo1.jpg') . '" style="height: 100px;width: 100px"></td>'; $html .= '<td>'; $html .= '<h3 style="text-align: center">' . $translate['title'] . '</h3>'; $html .= '<h4 style="text-align: center">' . $translate['voucher_title'] . '</h4>'; $html .= '</td>'; $html .= '<td style="text-align: right"><img src="' . asset('img/logo.jpg') . '" style="height: 100px;width: 100px"></td>'; $html .= '</tr>'; $html .= "</table>"; //Barcode Image $html .= "<div style='margin-left: 35%'>"; $html .= '<div>' . $barcode->getBarcodeHTML($id, "C128", 2, 53) . '</div>'; $html .= "<div style='margin-left: 15%'>" . $id . "</div>"; $html .= "</div>"; // Dispatch Date $html .= "<div style='text-align: center'>"; $html .= "<h4>" . $translate['dispatch_date'] . " " . $package->date_sent . "</h4>"; $html .= "</div>"; $html .= "<table style='width: 710px; margin-top: 30px;margin-bottom: 20px'>"; $html .= '<tr>'; $html .= '<td>' . $translate['entered_by'] . ' ' . $user->first_name . ' ' . $user->last_name . '</td>'; $html .= '<td>' . $translate['issued_to'] . ' ' . $issued_to->name . '</td>'; $html .= '<td>' . $translate['transport_mode1'] . ' ' . $transport->name . '</td>'; $html .= '</tr>'; $html .= "</table>"; $html .= "<table style='width: 710px;border-collapse: collapse;' border='1px'>"; $html .= '<tr style="background-color: #ADFF2F; font-size: 12px">'; $html .= '<th>Sr</th>'; $html .= '<th>' . $translate['product'] . '</th>'; $html .= '<th>' . $translate['manufacture'] . '</th>'; $html .= '<th>' . $translate['lot_number'] . '</th>'; $html .= '<th>' . $translate['expired_date'] . '</th>'; $html .= '<th>' . $translate['doses'] . '</th>'; $html .= '<th>' . $translate['vials'] . '</th>'; $html .= '<th>' . $translate['t_price'] . '</th>'; $html .= '</tr>'; $i = 1; $total_price = 0; foreach ($package->items as $val) { $vaccine = Vaccine::find($val->vaccine_id); $packaging = PackagingInformation::find($val->packaging_id); $manufacture = Manufacture::find($packaging->manufacture_id); $html .= '<tr style="font-size: 12px">'; $html .= '<td style="text-align: center">' . $i . '</td>'; $html .= '<td style="text-align: center">' . $vaccine->name . '</td>'; $html .= '<td style="text-align: center">' . $manufacture->name . '</td>'; $html .= '<td style="text-align: center">' . $val->batch_number . '</td>'; $html .= '<td style="text-align: center">' . $val->expiry_date . '</td>'; $html .= '<td style="text-align: center">' . $val->amount . '</td>'; $html .= '<td style="text-align: center">' . round($val->amount / $packaging->dose_per_vial, 0, PHP_ROUND_HALF_DOWN) . '</td>'; $html .= '<td style="text-align: center">' . $main_currency . " " . $val->amount * $val->unit_price . '</td>'; $html .= '</tr>'; $total_price += $val->amount * $val->unit_price; } $html .= "</table>"; $html .= "<div><h4>" . $main_currency . " " . $translate['total_price'] . " " . $total_price . "</h4></div>"; $html .= "<table style='width: 710px;'>"; $html .= '<tr>'; $html .= '<td style="width: 30%; font-size: 12px"">'; $html .= '<div>' . $translate['issued'] . '</div>'; $html .= '<div>' . $translate['name_signature'] . ' _________</div>'; $html .= '<div>' . $translate['sign'] . ' ________</div>'; $html .= '</td>'; $html .= '<td style="width: 40%"></td>'; $html .= '<td style="width: 30%; font-size: 12px">'; $html .= '<div>' . $translate['receiver'] . '</div>'; $html .= '<div>' . $translate['name_signature'] . ' ___________</div>'; $html .= '<div>' . $translate['sign'] . ' ___________</div>'; $html .= '</td>'; $html .= '</tr>'; $html .= "</table>"; $html .= "</div>"; $pdf = App::make('dompdf.wrapper'); $pdf->loadHTML($html); return $pdf->stream(); // return view('dispatch_voucher', [ // 'name' => 'James', // 'second_name'=> 'Mbwilo' // ]); }