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();
 }
Esempio n. 2
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']);
         }
     }
 }
 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;
 }
 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);
 }