Esempio n. 1
1
 public function store(ItemRequest $request)
 {
     try {
         $customers = Customer::all();
         Item::create($request->all());
         $item = Item::orderBy('created_at', 'desc')->first();
         foreach ($customers as $customer) {
             Price::create(['item_id' => $item->id, 'customer_id' => $customer->id, 'custom_price' => $item->price, 'sellable' => '1', 'is_custom' => '0']);
         }
         return redirect('item')->with('message', 'Data berhasil dibuat!');
     } catch (\Illuminate\Database\QueryException $e) {
         return redirect('item')->with('message', 'Data dengan nama tersebut sudah digunakan!');
     } catch (\PDOException $e) {
         return redirect('item')->with('message', 'Data dengan nama tersebut sudah digunakan!');
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $customer = Customer::all();
     // dd($customer);
     return View('customer.index')->with('customer', $customer);
 }
Esempio n. 3
0
 public function xlsFileCustomer()
 {
     $namefile = date('Yh:i:s') . "_Customer";
     Excel::create($namefile, function ($excel) {
         // Set the title
         $excel->setTitle('NMK Customer Form');
         // Chain the setters
         $excel->setCreator('NMK Application')->setCompany('NMK');
         // Call them separately
         $excel->setDescription('This files has all lead form record');
         $excel->sheet('Excel sheet', function ($sheet) {
             $roadshows = Customer::all();
             $sheet->setStyle(array('font' => array('name' => 'Calibri', 'size' => 13)));
             $sheet->row(1, array('Company', 'Contact Person', 'Telephone', 'Mobile', 'Address', 'P.O. Box', 'City', 'Delivery Address', 'Email'));
             foreach ($roadshows as $key => $value) {
                 $sheet->row(1, function ($row) {
                     // call cell manipulation methods
                     $row->setBackground('#888888');
                     $row->setFont(array('family' => 'Calibri', 'size' => '16', 'bold' => true));
                 });
                 $sheet->rows(array(array($value->company, $value->person, $value->telephone, $value->mobile, $value->address, $value->pobox, $value->city, $value->deliveryAddress, $value->email)));
             }
             //$sheet->fromModel($roles);
             // $sheet->fromArray(array(
             //     array('Name', 'Phone','Email','Job Title','Company','Intrested Brand','Intrested Seminiar'),
             //     $leads
             // ));
             $sheet->setOrientation('landscape');
         });
     })->export('xls');
 }
Esempio n. 4
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $customers = Customer::all();
     //     	return view('order.create',compact('customers', $customers));
     return view('order.create', array('customers' => $customers));
     //         return view('order.create');
 }
Esempio n. 5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($idkas)
 {
     $kas = Kas::find($idkas);
     $cust = Customer::all();
     $data = array('kas' => $kas, 'cust' => $cust);
     return View('kas.edit')->with('data', $data);
 }
Esempio n. 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($idpic)
 {
     $pic = Pic::find($idpic);
     $cust = Customer::all();
     $data = array('pic' => $pic, 'cust' => $cust);
     return View('pic.edit')->with('data', $data);
 }
Esempio n. 7
0
 public function create()
 {
     $input = Input::all();
     $customers = Customer::all();
     $salesmen = Employee::all();
     return view('return.create', compact('input', 'customers', 'salesmen'));
 }
Esempio n. 8
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($idms)
 {
     $ms = Ms::find($idms);
     $cust = Customer::all();
     $data = array('ms' => $ms, 'cust' => $cust);
     return View('ms.edit')->with('data', $data);
     //
 }
Esempio n. 9
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $customers = Customer::all();
     foreach ($customers as $customer) {
         $customer->old_password = $customer->password;
         $customer->save();
     }
 }
Esempio n. 10
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($idtr)
 {
     $tr = Tr::find($idtr);
     $cust = Customer::all();
     $data = array('tr' => $tr, 'cust' => $cust);
     return View('tr.edit')->with('data', $data);
     //
 }
Esempio n. 11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $estimates = Estimate::orderBy('id', 'DESC')->get();
     $customers = Customer::all();
     $vehicles = Vehicle::all();
     $departments = Department::all();
     $users = User::all();
     return view('estimates.estimates', compact('estimates', 'customers', 'vehicles', 'departments', 'users'));
 }
Esempio n. 12
0
 public function search()
 {
     $products = Product::all();
     $doctors = Customer::all();
     $MRs = Employee::where('level_id', 7)->get();
     $AMs = Employee::where('level_id', 3)->get();
     $SMs = Employee::where('level_id', 2)->get();
     $dataView = ['products' => $products, 'doctors' => $doctors, 'MRs' => $MRs, 'AMs' => $AMs, 'SMs' => $SMs];
     return view('admin.search.sales.search', $dataView);
 }
Esempio n. 13
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $provisioning = Provisioning::all();
     $customers = Customer::all();
     $onts = Ont::all();
     $accessSwitches = AccessSwitch::all();
     $dhcpSharedNetworks = DhcpSharedNetwork::all();
     $ipaddresses = Ipaddress::all();
     $ports = AccessSwitchPort::all();
     return view('home')->with('provisioning', $provisioning)->with('customers', $customers)->with('onts', $onts)->with('accessSwitches', $accessSwitches)->with('ports', $ports)->with('ipaddresses', $ipaddresses)->with('DhcpSharedNetworks', $dhcpSharedNetworks);
 }
Esempio n. 14
0
 public function create()
 {
     $customers = Customer::all();
     $coffee1 = DB::table('coffees')->where('id', 2)->first();
     $coffee2 = DB::table('coffees')->where('id', 3)->first();
     $coffee3 = DB::table('coffees')->where('id', 4)->first();
     $coffee4 = DB::table('coffees')->where('id', 5)->first();
     $coffee5 = DB::table('coffees')->where('id', 6)->first();
     $pastry1 = DB::table('pastries')->where('id', 7)->first();
     $pastry2 = DB::table('pastries')->where('id', 10)->first();
     $pastry3 = DB::table('pastries')->where('id', 11)->first();
     $pastry4 = DB::table('pastries')->where('id', 12)->first();
     $pastry5 = DB::table('pastries')->where('id', 15)->first();
     return view('order.create', compact('customers', 'coffee1', 'coffee2', 'coffee3', 'coffee4', 'coffee5', 'pastry1', 'pastry2', 'pastry3', 'pastry4', 'pastry5'));
 }
Esempio n. 15
0
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index(request $request)
 {
     if ($request->input('st')) {
         $site_id = $request->input('st');
         $state_id = DB::table('site_details')->where('id', '=', $site_id)->pluck('state_id');
         if ($state_id) {
             $parameters = DB::table('parameters')->join('tests', 'tests.parameter_id', '=', 'parameters.id')->where('tests.state_id', '=', $state_id)->orderBy('parameters.name')->get();
         }
     } else {
         $state_id = "";
         $parameters = DB::table('parameters')->orderBy('parameters.name')->get();
     }
     $users = DB::table('users')->where('role_id', '=', 3)->select('id', 'name', 'email')->get();
     $customers = Customer::all();
     $orders = Order::where('customer_id', '=', 14)->get();
     return view('order/index')->with(compact('parameters', 'users', 'orders', 'customers', 'state_id'));
 }
Esempio n. 16
0
 function sendSMS(Request $request)
 {
     $customers = Customer::all();
     // return $customers;
     // return $request->input('phone_number');
     $user_name = $request->input('customer');
     $phone_number = $request->input('phone_number');
     DB::table('customers')->insert(['name' => $user_name, 'phone_number' => $phone_number]);
     $sms = new sms();
     $username = 00;
     $password = 00;
     $msisdn = $phone_number;
     $message = 'Test sms with laravel framework';
     $sender = 'THAIBULKSMS';
     // $ScheduledDelivery = date('ymdHi');
     // return $ScheduledDelivery ;
     $result = $sms->send_sms('0812916723', '098663', '0836554738', $message, $sender);
     return $result;
 }
Esempio n. 17
0
 /**
  *  Faz a consulta no SEFAZ para cada uma das empresas cadastradas
  *
  * - Para primeira carga de uma nova empresa o campo config_nfe.nfeconfig_ultnsu deve ser igual a 0 (zero), essa primeira carga vai buscar todas as notas
  * dos ultimos 15 dias para cada empresa. Na primeira carga deve-se chamar esse metodo quantas vezes forem necessarias ate que tenha como retorno
  * a seguinte mensagem "Dados atualizados. Nao ha mais NFe para buscar."
  *
  * - Para cargas diarias o script se auto executara ate buscar todas as notas de todas as empresas.
  * Ao final será retornado a seguinte mensagem "Dados atualizados. Nao ha mais NFe para buscar."
  *
  * @name	getCustomerNfe
  * @access	public
  * @author	Roberson Faria
  */
 public function getCustomerNFe()
 {
     try {
         $result = Customer::all()->toArray();
         if (count($result) > 0) {
             foreach ($result as $config) {
                 $operation = new Operation();
                 $ultnsu = $operation->where('id_customer', $config['id'])->max('resnfe_nsu');
                 $nfe = new ToolsNFe($this->setConfig($config));
                 $nfe->sefazDistDFe('AN', $this->dadosConfig["tpAmb"], $this->dadosConfig["cnpj"], $ultnsu, 0, $this->retorno, false);
                 // 					dd($this->retorno);
                 foreach ($this->retorno['aDoc'] as $dados) {
                     if ($dados["schema"] == "resNFe_v1.00.xsd") {
                         $xml = simplexml_load_string($dados['doc']);
                         if (strlen($xml->CNPJ) > 0) {
                             $doc = $xml->CNPJ;
                         } else {
                             $doc = $xml->CPF;
                         }
                         Operation::create(['id_customer' => $config['id'], 'resnfe_nsu' => $dados['NSU'], 'resnfe_tpdoc' => "1", 'resnfe_dhrecbtolocal' => date('Y-m-d H:i:s'), 'resnfe_cnpj_cpf' => $doc, 'resnfe_ie' => $xml->IE, 'resnfe_xnome' => $xml->xNome, 'resnfe_chnfe' => $xml->chNFe, 'resnfe_demi' => date('Y-m-d H:i:s', strtotime($xml->dhEmi)), 'resnfe_tpnf' => $xml->tpNF, 'resnfe_csitnfe' => $xml->cSitNFe, 'resnfe_dhrecbto' => date('Y-m-d H:i:s', strtotime($xml->dhRecbto)), 'resnfe_vnf' => $xml->vNF, 'resnfe_xml' => addslashes($dados['doc'])]);
                         if ($xml->cSitNFe == 4 or $xml->cSitNFe == 1) {
                             $this->downloadXml($config['id'], $xml->chNFe);
                         }
                         // 							echo "res = ".$xml->chNFe."<br>";
                     } elseif ($dados["schema"] == "procNFe_v1.00.xsd") {
                         // 							dd($dados);
                         // 							$xml = simplexml_load_string ($dados['doc']);
                         // 							dd($xml);
                         // 							echo "proc = ".$xml->protNFe->infProt->chNFe."<br>";
                     } else {
                         // 							print_r($dados);
                         // 							echo "<br>";
                     }
                 }
             }
         }
         // 			dd("acabou");
     } catch (Exception $e) {
         Log::warning("Erro LibNfe Exception: " . $e->getMessage());
         exit;
     }
 }
 public function __construct()
 {
     View::share('pros', Product::take(8)->Where('status', 1)->orderBy('created_at', 'DESC')->get());
     View::share('customs', Product::take(8)->Where('type', 0)->orderBy('created_at', 'DESC')->get());
     View::share('products', Product::take(8)->Where('status', 1)->orderBy('created_at', 'DESC')->get());
     View::share('cus', Product::take(8)->Where('status', 1)->orderBy('created_at', 'ASC')->get());
     View::share('categories', Category::all());
     View::share('cart_content', Cart::content());
     View::share('count', Cart::count());
     View::share('total', Cart::total());
     View::share('set', Setting::find(1));
     View::share('tos', Cart::tos());
     View::share('transactions', Transaction::orderBy('created_at', 'desc')->paginate(10));
     View::share('settings', Setting::find(1));
     View::share('caty', Category::take(5)->orderBy('created_at', 'DESC')->get());
     View::share('payments', Payment::Where('status', 1)->get());
     View::share('customers', Customer::all());
     View::share('orders', Order::all());
     View::share('cat', Category::all());
     View::share('db', Product::take(6)->Where('status', 1)->orderBy('created_at', 'ASC')->get());
 }
Esempio n. 19
0
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
    $name = $faker->firstName;
    return ['name' => $name, 'surname' => $faker->lastName, 'gender' => $faker->randomElement($array = ['Male', 'Female']), 'job_title' => $faker->job_title, 'email' => strtolower($name . "@mbc.co.zw"), 'password' => bcrypt('password'), 'user_type_id' => $faker->randomElement($array = [1, 2, 3]), 'remember_token' => str_random(10)];
});
$factory->define(App\Order::class, function (Faker\Generator $faker) {
    $c = \App\Customer::all('id');
    $id = $c[rand(0, count($c) - 1)]->id;
    return ["id" => $faker->numerify('OD-########'), "customer_id" => $id, "user_id" => 2, "order_status_id" => $faker->randomElement($array = [1, 2, 3]), "sync_id" => $faker->randomElement($array = [1, 2, 3])];
});
$factory->define(App\OrderDetail::class, function (Faker\Generator $faker) {
    $od = \App\Product::all('id');
    $pd = $od[rand(0, count($od) - 1)]->id;
    return ["order_id" => null, "product_id" => $pd, "quantity" => rand(100, 2000)];
});
$factory->define(App\Customer::class, function (Faker\Generator $faker) {
    return ["id" => ucfirst($faker->randomLetter) . $faker->numerify('-###'), "name" => $faker->company, "vat_number" => $faker->randomNumber(5), "address" => $faker->address, "city" => $faker->city, "telephone" => $faker->phoneNumber, "fax" => $faker->phoneNumber, "email" => $faker->companyEmail, "contact_person" => $faker->name, "contact_position" => $faker->job_title, "contact_cell" => $faker->phoneNumber, "customer_status_id" => $faker->randomElement([1, 2, 3]), "customer_type_id" => $faker->randomElement([1, 2, 3])];
});
$factory->define(App\Product::class, function (Faker\Generator $faker) {
    $od = $faker->numerify('PDT-########');
    return ["id" => $od, "Description" => $faker->randomElement(['Coke', 'Fanta', 'Sprite']) . " " . $faker->randomElement([300, 330, 500, 1000, 2000]) . " ml", "category_id" => 1, "price" => rand(5, 20), "image" => $faker->imageUrl(150, 150)];
});
Esempio n. 20
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $customers = Customer::all();
     return view('customer.index', compact('customers'));
 }
Esempio n. 21
0
 public function show_devis()
 {
     $title = 'Devis';
     $quotations = Quotation::all();
     $cars = Car::all();
     $customers = Customer::all();
     /*  return view('Mail/mail_devis',[
         'finition'=>$request->finition,
         'basic_price'=>$request->basic_price,
         'tva'=>$request->tva,
         'frais_imm'=>$request->frais_imm,
         'tme'=>$request->tme,
         'frais_timbre'=>$request->frais_timbre,
         'prix_tot'=>$request->prix_total_voiture,
         'options'=>$options,
         'prix_options'=>$request->prix_options,
         'name'=>$customer->name,
         'last_name'=>$customer->last_name,
         'datetime'=>$datetime] );*/
 }
Esempio n. 22
0
 public function listAll()
 {
     $customers = Customer::all();
     $dataView = ['customers' => $customers];
     return view('admin.customer.list', $dataView);
 }
Esempio n. 23
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $customers = Customer::all();
     $vehicles = Vehicle::all();
     return view('customers.customers', compact('customers', 'vehicles'));
 }
Esempio n. 24
0
 public function history()
 {
     $history = History::all();
     $customers = Customer::all();
     return view('admin.history', compact('history', 'customers'));
 }
Esempio n. 25
0
 public function AMSearch()
 {
     $AMs = Employee::where('manager_id', \Auth::user()->id)->get();
     $products = Product::all();
     $gifts = Gift::all();
     $doctors = Customer::all();
     $dataView = ['doctors' => $doctors, 'AMs' => $AMs, 'products' => $products, 'gifts' => $gifts];
     return view('sm.search.reports.search', $dataView);
 }
 /**
  * Load data into DataTable for Users (Customers).
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function fillData()
 {
     $customers = Customer::all();
     return response()->json(['data' => $customers]);
 }
Esempio n. 27
0
 public function affiche($id)
 {
     $title = "voiture";
     $options = $idCategries = array();
     $customers = array();
     $customer = Customer::all();
     foreach ($customer as $c) {
         $customers[$c->id] = $c->name . ' ' . $c->last_name;
     }
     if (isset($id) && !empty($id)) {
         $car = Car::findOrFail($id);
         $options = current($car->optioncars()->lists('option_id'));
         if (!empty($options)) {
             $ids = implode(",", $options);
             //option ID's
             $prices = OptionCar::whereRaw('option_id  in (' . $ids . ' ) and car_id=' . $id . ' order by option_id')->get();
             foreach ($prices as $price) {
                 $prices_car[$price->option_id]['price'] = $price->option_price;
                 $prices_car[$price->option_id]['id'] = $price->id;
             }
             $optionsList = Option::whereRaw('id  in (' . $ids . ' ) order by id')->get();
             foreach ($optionsList as $option) {
                 $el = $option->category_id;
                 if (!in_array($el, $idCategries)) {
                     //if not exist in array
                     array_push($idCategries, $el);
                 }
             }
             $idCategries = implode(",", $idCategries);
             $categories = Category::whereRaw('id  in (' . $idCategries . ')')->get();
             foreach ($categories as $cat) {
                 foreach ($optionsList as $option) {
                     if ($option['category_id'] == $cat['id']) {
                         $listcategories[$cat->id]['name'] = $cat->name_category;
                         $listcategories[$cat->id]['options'][$option->id]['name'] = $option->name;
                         $listcategories[$cat->id]['options'][$option->id]['description'] = $option->description;
                         $listcategories[$cat->id]['options'][$option->id]['price'] = $prices_car[$option->id]['price'];
                         $listcategories[$cat->id]['options'][$option->id]['id'] = $prices_car[$option->id]['id'];
                     }
                 }
             }
             return view('Cars/car-details', ['categories' => $listcategories, 'title' => $title, 'car' => $car, 'customers' => $customers]);
         } else {
             return view('Cars/car-details', ['categories' => null, 'car' => $car, 'title' => $title]);
         }
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $customers = Customer::all()->sortBy('customer_name');
     return view('customers.index', compact('customers'));
 }
Esempio n. 29
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit(Request $request, $userId)
 {
     $user = User::where('id', $userId)->first();
     $permissions = Permission::where('id', $user->permission_id)->first();
     $customers = Customer::all();
     return view('layouts.user.new', ['customers' => $customers, 'my_permissions' => $this->my_permissions, 'user' => $user, 'permissions' => $permissions]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $customers = Customer::all();
     return view('layouts.customer.index', ['customers' => $customers, 'my_permissions' => $this->my_permissions, 'my_customer_id' => $this->my_customer_id]);
 }