Пример #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     $tax = Tax::findOrFail($id);
     $this->validate($request, Tax::$rules);
     $tax->update($request->all());
     return redirect('taxes')->with('success', l('This record has been successfully updated &#58&#58 (:id) ', ['id' => $id], 'layouts') . $request->get('name'));
 }
 public function ajaxLoad(Request $request)
 {
     if ($request->get('id')) {
         return Tax::where('active', 1)->where('id', $request->get('id'))->first();
     }
     return Tax::where('active', 1)->get();
 }
Пример #3
0
 /**
  * 完成税务申报
  * @param Request $request
  * @return mixed
  * @author AndyLee <*****@*****.**>
  */
 public function postFinishTaxApply(Request $request)
 {
     $input = $request->only('type', 'flag');
     $map = ['user_id' => $request->session()->get('company_id'), 'company_id' => $request->session()->get('customer_id')];
     /*
      * 国税部分
      */
     if ($input['type'] == 'guoshui') {
         $map['guoshui_status'] = 0;
         $tax = Tax::where($map)->first();
         if (!empty($tax)) {
             $tax->guoshui_status = 1;
             $tax->save();
             return \Response::json(['message' => '国税申报完成', 'state' => 'success']);
         }
     }
     if ($input['type'] == 'dishui') {
         $map['dishui_status'] = 0;
         $tax = Tax::where($map)->first();
         if (!empty($tax)) {
             $tax->dishui_status = 1;
             $tax->save();
             return \Response::json(['message' => '地税申报完成', 'state' => 'success']);
         }
     }
 }
Пример #4
0
 public function run()
 {
     Tax::truncate();
     Tax::create(['name' => 'IVA Normal (21%)', 'percent' => '21.0', 'extra_percent' => '5.2', 'active' => '1', 'created_at' => \Carbon\Carbon::createFromDate(2015, 04, 01)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString()]);
     Tax::create(['name' => 'IVA Reducido (10%)', 'percent' => '10.0', 'extra_percent' => '1.4', 'active' => '1', 'created_at' => \Carbon\Carbon::createFromDate(2015, 04, 01)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString()]);
     Tax::create(['name' => 'IVA Super Reducido (4%)', 'percent' => '4.0', 'extra_percent' => '0.5', 'active' => '1', 'created_at' => \Carbon\Carbon::createFromDate(2015, 04, 01)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString()]);
     Tax::create(['name' => 'IVA Exento (0%)', 'percent' => '0.0', 'extra_percent' => '0.0', 'active' => '1', 'created_at' => \Carbon\Carbon::createFromDate(2015, 04, 01)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString()]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  \App\Product $product
  * @return \Illuminate\Http\Response
  */
 public function edit(Product $product)
 {
     $productVariants = Product_variant::where('product_id', $product->product_id)->get();
     $languages = Language::orderBy('order', 'asc')->get();
     $categories = Category::all();
     $discounts = Discount::all();
     $taxes = Tax::all();
     return view('intothesource.webshop.products.edit', compact('product', 'productVariants', 'languages', 'categories', 'discounts', 'taxes'));
 }
 public function tax()
 {
     $taxs = \App\Tax::where('active', 1)->get();
     $data = [];
     foreach ($taxs as $tax) {
         array_push($data, ['tax_id' => $tax->id, 'type' => $tax->type, 'procentage' => $tax->procentage]);
     }
     $display['tax'] = $data;
     return $display;
 }
Пример #7
0
 public static function filterAndPaginate($name)
 {
     return Tax::name($name)->orderBy('name', 'ASC')->paginate();
 }
Пример #8
0
 /**
  * Get from query
  */
 public function get($page = null)
 {
     return $this->query(Tax::select(), $page);
 }
 public function closeOrder($id)
 {
     if (Gate::denies('order.close')) {
         return view(config('app.template') . '.error.403');
     }
     $order = Order::with(['karyawan', 'detail.produk', 'detail.detailReturn', 'place.place.kategori'])->find($id);
     if (!$order) {
         return view(config('app.template') . '.error.404');
     }
     // Detail Order
     $orderDetail = [];
     foreach ($order->detail->toArray() as $od) {
         $odQty = $od['qty'] - ($od['detail_return'] != null ? $od['detail_return']['qty'] : 0);
         $in = array_only($od, ['harga_jual', 'satuan']) + ['nama' => $od['produk']['nama'], 'qty' => $odQty, 'subtotal' => $od['harga_jual'] * $odQty];
         array_push($orderDetail, $in);
     }
     $current_place = implode(', ', array_column(array_column($order->place->toArray(), 'place'), 'nama'));
     $orderPlaces = [];
     foreach ($order->place as $op) {
         if ($op->harga > 0) {
             array_push($orderPlaces, ['nama' => $op->place->nama . ' - ' . $op->place->kategori->nama, 'harga' => $op->harga]);
         }
     }
     $data = ['order' => $order, 'orderDetail' => $orderDetail, 'orderPlaces' => $orderPlaces, 'tanggal' => $order->tanggal->format('Y-m-d'), 'current_place' => $current_place, 'init_tax' => Tax::where('active', 1)->first(), 'taxes' => Tax::where('active', 1)->lists('type', 'id'), 'banks' => Bank::where('active', 1)->lists('nama_bank', 'id')];
     return view(config('app.template') . '.order.close', $data);
 }
Пример #10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $tax = Tax::findOrFail($id);
     $tax->delete();
     Session::flash('message', $tax->name . ' was deleted !');
     return \Redirect::route('taxs.index');
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     // Currencies
     view()->composer(array('customers.edit', 'customer_invoices.create', 'companies.edit', 'customer_groups.create', 'customer_groups.edit'), function ($view) {
         $view->with('currencyList', \App\Currency::lists('name', 'id'));
     });
     // Customer Groups
     view()->composer(array('customers.edit'), function ($view) {
         $view->with('customer_groupList', \App\CustomerGroup::lists('name', 'id'));
     });
     // Payment Methods
     view()->composer(array('customers.edit', 'customer_invoices.create', 'customer_groups.create', 'customer_groups.edit'), function ($view) {
         $view->with('payment_methodList', \App\PaymentMethod::lists('name', 'id'));
     });
     // Sequences
     view()->composer(array('customers.edit', 'customer_invoices.create', 'customer_groups.create', 'customer_groups.edit'), function ($view) {
         $view->with('sequenceList', \App\Sequence::lists('name', 'id'));
     });
     // Invoice Template
     view()->composer(array('customers.edit', 'customer_invoices.create', 'customer_groups.create', 'customer_groups.edit'), function ($view) {
         $view->with('customerinvoicetemplateList', \App\Template::where('model_name', '=', 'CustomerInvoice')->lists('name', 'id'));
     });
     // Carriers
     view()->composer(array('customers.edit', 'customer_invoices.create', 'customer_groups.create', 'customer_groups.edit'), function ($view) {
         $view->with('carrierList', \App\Carrier::lists('name', 'id'));
     });
     // Sales Representatives
     view()->composer(array('customers.edit', 'customer_invoices.create'), function ($view) {
         $view->with('salesrepList', \App\SalesRep::select(DB::raw('concat (firstname," ",lastname) as name, id'))->lists('name', 'id'));
     });
     // Price Lists
     view()->composer(array('customers.edit', 'customer_groups.create', 'customer_groups.edit'), function ($view) {
         $view->with('price_listList', \App\PriceList::lists('name', 'id'));
     });
     // Warehouses
     view()->composer(array('products.create', 'stock_movements.create', 'configurationkeys.key_group_2', 'customer_invoices.create'), function ($view) {
         $whList = \App\Warehouse::with('address')->get();
         $list = [];
         foreach ($whList as $wh) {
             $list[$wh->id] = $wh->address->alias;
         }
         $view->with('warehouseList', $list);
         // $view->with('warehouseList', \App\Warehouse::lists('name', 'id'));
     });
     // Taxes
     view()->composer(array('customer_invoices.create', 'products.create', 'products.edit'), function ($view) {
         $view->with('taxList', \App\Tax::orderby('percent', 'desc')->lists('name', 'id'));
     });
     view()->composer(array('products.create', 'products.edit', 'customer_invoices.create'), function ($view) {
         $view->with('taxpercentList', \App\Tax::lists('percent', 'id'));
     });
     // Languages
     view()->composer(array('users.create', 'users.edit'), function ($view) {
         $view->with('languageList', \App\Language::lists('name', 'id'));
     });
     // Categories
     view()->composer(array('products.create', 'products._panel_main_data'), function ($view) {
         $view->with('categoryList', \App\Category::orderby('name', 'asc')->lists('name', 'id'));
     });
     // Stock Movement Types
     view()->composer(array('stock_movements.index', 'stock_movements.create'), function ($view) {
         $view->with('movement_typeList', \App\StockMovement::stockmovementList());
     });
 }