public function savePertanggalDetail(Request $request)
 {
     $id = $request->get('id');
     $diskon = $request->get('diskon') != "" && $request->get('diskon') != " " ? $request->get('diskon') : 0;
     if (OrderBayar::where('order_id', $id)->update(['diskon' => $diskon])) {
         return redirect()->back()->with('succcess', 'Sukses simpan data pembayaran.');
     }
     return redirect()->back()->withErrors(['failed' => 'Gagal simpan data pembayaran.']);
 }
 public function closeTransaksi(Request $request)
 {
     \Debugbar::disable();
     $id = $request->get('id');
     $orderTax = ['order_id' => $id, 'tax_id' => $request->get('tax_id'), 'procentage' => $request->get('tax_procentage')];
     if (\App\OrderTax::create($orderTax)) {
         $orderBayar = ['order_id' => $id, 'karyawan_id' => Auth::guard('api')->check() ? Auth::guard('api')->user()->karyawan->id : '1', 'service_cost' => $request->get('service_cost'), 'diskon' => $request->get('diskon') != '' ? $request->get('diskon') : 0, 'bayar' => $request->get('bayar'), 'type_bayar' => $request->get('type_bayar')];
         if (\App\OrderBayar::create($orderBayar)) {
             if ($request->get('type_bayar') == 'debit' || $request->get('type_bayar') == 'credit_card') {
                 $orderBayarBank = ['order_id' => $id, 'bank_id' => $request->get('bank_id')];
                 $orderBayarBank['tax_procentage'] = $request->get('tax_bayar_procentage');
                 \App\OrderBayarBank::create($orderBayarBank);
             }
             $inputs = ['state' => 'Closed'];
             if ($request->get('customer_id') != "") {
                 $inputs['customer_id'] = $request->get('customer_id');
             }
             $order = \App\Order::find($id);
             if ($order->update($inputs)) {
                 // Update Sale Account
                 Artisan::call('sale:count', ['tanggal' => $order->tanggal->format('Y-m-d')]);
                 Artisan::call('bahan:count');
                 Artisan::call('produk:count');
                 return 1;
             }
         }
     }
     return 0;
 }