@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | //dd($this->invoice->get()); |
| 48 | 48 | return \Datatable::collection($this->subscription->get()) |
| 49 | 49 | |
| 50 | - ->addColumn('user_id', function ($model) { |
|
| 50 | + ->addColumn('user_id', function($model) { |
|
| 51 | 51 | $user = $model->user()->first(); |
| 52 | 52 | $first = $user->first_name; |
| 53 | 53 | $last = $user->last_name; |
@@ -55,18 +55,18 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 57 | 57 | }) |
| 58 | - ->addColumn('plan_id', function ($model) { |
|
| 58 | + ->addColumn('plan_id', function($model) { |
|
| 59 | 59 | $name = $this->plan->where('id', $model->plan_id)->first()->name; |
| 60 | 60 | |
| 61 | 61 | return $name; |
| 62 | 62 | }) |
| 63 | - ->addColumn('order_id', function ($model) { |
|
| 63 | + ->addColumn('order_id', function($model) { |
|
| 64 | 64 | $name = $this->order->where('id', $model->order_id)->first()->id; |
| 65 | 65 | |
| 66 | 66 | return $name; |
| 67 | 67 | }) |
| 68 | 68 | ->showColumns('ends_at') |
| 69 | - ->addColumn('action', function ($model) { |
|
| 69 | + ->addColumn('action', function($model) { |
|
| 70 | 70 | return '<a href='.url('subscriptions/'.$model->id)." |
| 71 | 71 | class='btn btn-sm btn-primary'>View</a>"; |
| 72 | 72 | }) |
@@ -475,7 +475,8 @@ discard block |
||
| 475 | 475 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 476 | 476 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 477 | 477 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 478 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 478 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 479 | +//if tax_enable is 0 |
|
| 479 | 480 | |
| 480 | 481 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 481 | 482 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -484,13 +485,15 @@ discard block |
||
| 484 | 485 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 485 | 486 | $taxs = $rate['taxes']; |
| 486 | 487 | $rate = $rate['rate']; |
| 487 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 488 | + } elseif ($geoip_country != 'IN') { |
|
| 489 | +//In case of other country |
|
| 488 | 490 | // when tax is available and tax is not enabled(Applicable |
| 489 | 491 | //when Global Tax class for any country and state is not there) |
| 490 | 492 | |
| 491 | 493 | $taxClassId = Tax::where('state', $geoip_state) |
| 492 | 494 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 493 | - if ($taxClassId) { //if state equals the user State |
|
| 495 | + if ($taxClassId) { |
|
| 496 | +//if state equals the user State |
|
| 494 | 497 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 495 | 498 | $taxs = $rate['taxes']; |
| 496 | 499 | $rate = $rate['rate']; |
@@ -533,11 +536,13 @@ discard block |
||
| 533 | 536 | $i_gst = 0; |
| 534 | 537 | $ut_gst = 0; |
| 535 | 538 | $state_code = ''; |
| 536 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 539 | + if ($user_state != '') { |
|
| 540 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 537 | 541 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 538 | 542 | $taxes = $tax['taxes']; |
| 539 | 543 | $value = $tax['value']; |
| 540 | - } else {//If user from other Country |
|
| 544 | + } else { |
|
| 545 | +//If user from other Country |
|
| 541 | 546 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 542 | 547 | $taxes = $tax['taxes']; |
| 543 | 548 | $value = $tax['value']; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $from = $request->input('from'); |
| 105 | 105 | $till = $request->input('till'); |
| 106 | 106 | |
| 107 | - return view('themes.default1.invoice.index', compact('name','invoice_no','status','currencies','currency_id','from', |
|
| 107 | + return view('themes.default1.invoice.index', compact('name', 'invoice_no', 'status', 'currencies', 'currency_id', 'from', |
|
| 108 | 108 | |
| 109 | 109 | 'till')); |
| 110 | 110 | } catch (\Exception $ex) { |
@@ -127,35 +127,35 @@ discard block |
||
| 127 | 127 | return \DataTables::of($query->take(100)) |
| 128 | 128 | ->setTotalRecords($query->count()) |
| 129 | 129 | |
| 130 | - ->addColumn('checkbox', function ($model) { |
|
| 130 | + ->addColumn('checkbox', function($model) { |
|
| 131 | 131 | return "<input type='checkbox' class='invoice_checkbox' |
| 132 | 132 | value=".$model->id.' name=select[] id=check>'; |
| 133 | 133 | }) |
| 134 | - ->addColumn('user_id', function ($model) { |
|
| 134 | + ->addColumn('user_id', function($model) { |
|
| 135 | 135 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 136 | 136 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
| 137 | 137 | $id = $this->user->where('id', $model->user_id)->first()->id; |
| 138 | 138 | |
| 139 | 139 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 140 | 140 | }) |
| 141 | - ->addColumn('number', function ($model) { |
|
| 141 | + ->addColumn('number', function($model) { |
|
| 142 | 142 | return ucfirst($model->number); |
| 143 | 143 | }) |
| 144 | 144 | |
| 145 | - ->addColumn('date', function ($model) { |
|
| 145 | + ->addColumn('date', function($model) { |
|
| 146 | 146 | $date = ($model->created_at); |
| 147 | 147 | |
| 148 | 148 | return $date; |
| 149 | 149 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 150 | 150 | }) |
| 151 | - ->addColumn('grand_total', function ($model) { |
|
| 151 | + ->addColumn('grand_total', function($model) { |
|
| 152 | 152 | return ucfirst($model->number); |
| 153 | 153 | }) |
| 154 | - ->addColumn('status', function ($model) { |
|
| 154 | + ->addColumn('status', function($model) { |
|
| 155 | 155 | return ucfirst($model->status); |
| 156 | 156 | }) |
| 157 | 157 | |
| 158 | - ->addColumn('action', function ($model) { |
|
| 158 | + ->addColumn('action', function($model) { |
|
| 159 | 159 | $action = ''; |
| 160 | 160 | |
| 161 | 161 | $check = $this->checkExecution($model->id); |
@@ -171,25 +171,25 @@ discard block |
||
| 171 | 171 | style='color:white;'> </i> View</a>" |
| 172 | 172 | ." $action"; |
| 173 | 173 | }) |
| 174 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
| 174 | + ->filterColumn('user_id', function($query, $keyword) { |
|
| 175 | 175 | $sql = 'first_name like ?'; |
| 176 | 176 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 177 | 177 | }) |
| 178 | 178 | |
| 179 | - ->filterColumn('status', function ($query, $keyword) { |
|
| 179 | + ->filterColumn('status', function($query, $keyword) { |
|
| 180 | 180 | $sql = 'status like ?'; |
| 181 | 181 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 182 | 182 | }) |
| 183 | 183 | |
| 184 | - ->filterColumn('number', function ($query, $keyword) { |
|
| 184 | + ->filterColumn('number', function($query, $keyword) { |
|
| 185 | 185 | $sql = 'number like ?'; |
| 186 | 186 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 187 | 187 | }) |
| 188 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 188 | + ->filterColumn('grand_total', function($query, $keyword) { |
|
| 189 | 189 | $sql = 'grand_total like ?'; |
| 190 | 190 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 191 | 191 | }) |
| 192 | - ->filterColumn('date', function ($query, $keyword) { |
|
| 192 | + ->filterColumn('date', function($query, $keyword) { |
|
| 193 | 193 | $sql = 'date like ?'; |
| 194 | 194 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 195 | 195 | }) |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $join = $join->select('id', 'user_id', 'number', 'date', 'grand_total', 'currency', 'status', 'created_at'); |
| 235 | 235 | |
| 236 | 236 | $join = $join->orderBy('created_at', 'desc') |
| 237 | - ->select('invoices.id','first_name','invoices.created_at', |
|
| 237 | + ->select('invoices.id', 'first_name', 'invoices.created_at', |
|
| 238 | 238 | 'invoices.currency', 'user_id', 'number', 'status'); |
| 239 | 239 | |
| 240 | 240 | return $join; |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till); |
| 126 | 126 | |
| 127 | 127 | return \DataTables::of($query->take(100)) |
| 128 | - ->setTotalRecords($query->count()) |
|
| 128 | + ->setTotalRecords($query->count()) |
|
| 129 | 129 | |
| 130 | - ->addColumn('checkbox', function ($model) { |
|
| 131 | - return "<input type='checkbox' class='invoice_checkbox' |
|
| 130 | + ->addColumn('checkbox', function ($model) { |
|
| 131 | + return "<input type='checkbox' class='invoice_checkbox' |
|
| 132 | 132 | value=".$model->id.' name=select[] id=check>'; |
| 133 | - }) |
|
| 133 | + }) |
|
| 134 | 134 | ->addColumn('user_id', function ($model) { |
| 135 | 135 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 136 | 136 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
@@ -138,9 +138,9 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 140 | 140 | }) |
| 141 | - ->addColumn('number', function ($model) { |
|
| 142 | - return ucfirst($model->number); |
|
| 143 | - }) |
|
| 141 | + ->addColumn('number', function ($model) { |
|
| 142 | + return ucfirst($model->number); |
|
| 143 | + }) |
|
| 144 | 144 | |
| 145 | 145 | ->addColumn('date', function ($model) { |
| 146 | 146 | $date = ($model->created_at); |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | return $date; |
| 149 | 149 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 150 | 150 | }) |
| 151 | - ->addColumn('grand_total', function ($model) { |
|
| 152 | - return ucfirst($model->number); |
|
| 153 | - }) |
|
| 154 | - ->addColumn('status', function ($model) { |
|
| 155 | - return ucfirst($model->status); |
|
| 156 | - }) |
|
| 151 | + ->addColumn('grand_total', function ($model) { |
|
| 152 | + return ucfirst($model->number); |
|
| 153 | + }) |
|
| 154 | + ->addColumn('status', function ($model) { |
|
| 155 | + return ucfirst($model->status); |
|
| 156 | + }) |
|
| 157 | 157 | |
| 158 | 158 | ->addColumn('action', function ($model) { |
| 159 | 159 | $action = ''; |
@@ -171,30 +171,30 @@ discard block |
||
| 171 | 171 | style='color:white;'> </i> View</a>" |
| 172 | 172 | ." $action"; |
| 173 | 173 | }) |
| 174 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
| 175 | - $sql = 'first_name like ?'; |
|
| 176 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 177 | - }) |
|
| 174 | + ->filterColumn('user_id', function ($query, $keyword) { |
|
| 175 | + $sql = 'first_name like ?'; |
|
| 176 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 177 | + }) |
|
| 178 | 178 | |
| 179 | - ->filterColumn('status', function ($query, $keyword) { |
|
| 180 | - $sql = 'status like ?'; |
|
| 181 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 182 | - }) |
|
| 179 | + ->filterColumn('status', function ($query, $keyword) { |
|
| 180 | + $sql = 'status like ?'; |
|
| 181 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 182 | + }) |
|
| 183 | 183 | |
| 184 | 184 | ->filterColumn('number', function ($query, $keyword) { |
| 185 | 185 | $sql = 'number like ?'; |
| 186 | 186 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 187 | 187 | }) |
| 188 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 189 | - $sql = 'grand_total like ?'; |
|
| 190 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 191 | - }) |
|
| 192 | - ->filterColumn('date', function ($query, $keyword) { |
|
| 193 | - $sql = 'date like ?'; |
|
| 194 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 195 | - }) |
|
| 196 | - |
|
| 197 | - ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 188 | + ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 189 | + $sql = 'grand_total like ?'; |
|
| 190 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 191 | + }) |
|
| 192 | + ->filterColumn('date', function ($query, $keyword) { |
|
| 193 | + $sql = 'date like ?'; |
|
| 194 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 195 | + }) |
|
| 196 | + |
|
| 197 | + ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 198 | 198 | ->make(true); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $join = $join->select('id', 'user_id', 'number', 'date', 'grand_total', 'currency', 'status', 'created_at'); |
| 235 | 235 | |
| 236 | 236 | $join = $join->orderBy('created_at', 'desc') |
| 237 | - ->select('invoices.id','first_name','invoices.created_at', |
|
| 237 | + ->select('invoices.id','first_name','invoices.created_at', |
|
| 238 | 238 | 'invoices.currency', 'user_id', 'number', 'status'); |
| 239 | 239 | |
| 240 | 240 | return $join; |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | $symbol = $attributes[0]['currency'][0]['code']; |
| 425 | 425 | //dd($symbol); |
| 426 | 426 | $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number, |
| 427 | - 'date' => $date, 'grand_total' => $grand_total, 'status' => 'pending', |
|
| 428 | - 'currency' => $symbol, ]); |
|
| 427 | + 'date' => $date, 'grand_total' => $grand_total, 'status' => 'pending', |
|
| 428 | + 'currency' => $symbol, ]); |
|
| 429 | 429 | |
| 430 | 430 | foreach (\Cart::getContent() as $cart) { |
| 431 | 431 | $this->createInvoiceItems($invoice->id, $cart); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | 'currency' => $currency, 'status' => 'pending', 'description' => $description, ]); |
| 531 | 531 | |
| 532 | 532 | $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid, |
| 533 | - $code, $total, $currency, $qty, $plan, $user_id, $tax_name, $tax_rate); |
|
| 533 | + $code, $total, $currency, $qty, $plan, $user_id, $tax_name, $tax_rate); |
|
| 534 | 534 | $result = $this->getMessage($items, $user_id); |
| 535 | 535 | } catch (\Exception $ex) { |
| 536 | 536 | dd($ex); |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
| 683 | 683 | |
| 684 | 684 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 685 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 685 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 686 | 686 | //other tax is available and tax is not enabled |
| 687 | 687 | if ($taxClassId) { |
| 688 | 688 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
@@ -750,10 +750,10 @@ discard block |
||
| 750 | 750 | foreach ($taxes as $key => $tax) { |
| 751 | 751 | if ($taxes[0]) { |
| 752 | 752 | $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1, |
| 753 | - 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 754 | - 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 755 | - 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 756 | - 'origin_state' => $origin_state, ]; |
|
| 753 | + 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 754 | + 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 755 | + 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 756 | + 'origin_state' => $origin_state, ]; |
|
| 757 | 757 | |
| 758 | 758 | $rate = $tax->rate; |
| 759 | 759 | |
@@ -963,8 +963,8 @@ discard block |
||
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | return view('themes.default1.invoice.payment', |
| 966 | - compact('invoice_status', 'payment_status', |
|
| 967 | - 'payment_method', 'invoice_id', 'domain', 'invoice', 'userid')); |
|
| 966 | + compact('invoice_status', 'payment_status', |
|
| 967 | + 'payment_method', 'invoice_id', 'domain', 'invoice', 'userid')); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | return redirect()->back(); |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | case 1: |
| 1004 | 1004 | $percentage = $price * ($value / 100); |
| 1005 | 1005 | |
| 1006 | - return $price - $percentage; |
|
| 1006 | + return $price - $percentage; |
|
| 1007 | 1007 | case 2: |
| 1008 | 1008 | return $price - $value; |
| 1009 | 1009 | case 3: |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | $payment_date = \Carbon\Carbon::now()->toDateTimeString(); |
| 1036 | 1036 | $amount = $grand_total; |
| 1037 | 1037 | $paymentRenewal = $this->updateInvoicePayment($invoiceid, $payment_method, |
| 1038 | - $payment_status, $payment_date, $amount); |
|
| 1038 | + $payment_status, $payment_date, $amount); |
|
| 1039 | 1039 | |
| 1040 | 1040 | return redirect()->back()->with('success', 'Payment Accepted Successfully'); |
| 1041 | 1041 | } catch (\Exception $ex) { |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | return \Datatable::collection($this->bundle->select('id', 'name', |
| 50 | 50 | 'valid_from', 'valid_till', 'uses', 'maximum_uses')->get()) |
| 51 | - ->addColumn('#', function ($model) { |
|
| 51 | + ->addColumn('#', function($model) { |
|
| 52 | 52 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
| 53 | 53 | }) |
| 54 | 54 | ->showColumns('name', 'valid_from', 'valid_till', 'uses', 'maximum_uses') |
| 55 | - ->addColumn('item', function ($model) { |
|
| 55 | + ->addColumn('item', function($model) { |
|
| 56 | 56 | $name = $this->relation->where('bundle_id', $model->id)->pluck('product_id'); |
| 57 | 57 | //dd($name); |
| 58 | 58 | $result = []; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | //dd($result); |
| 63 | 63 | return implode(',', $result); |
| 64 | 64 | }) |
| 65 | - ->addColumn('action', function ($model) { |
|
| 65 | + ->addColumn('action', function($model) { |
|
| 66 | 66 | return '<a href='.url('bundles/'.$model->id.'/edit'). |
| 67 | 67 | " class='btn btn-sm btn-primary'>Edit</a>"; |
| 68 | 68 | }) |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function getBundles() |
| 48 | 48 | { |
| 49 | 49 | return \Datatable::collection($this->bundle->select('id', 'name', |
| 50 | - 'valid_from', 'valid_till', 'uses', 'maximum_uses')->get()) |
|
| 50 | + 'valid_from', 'valid_till', 'uses', 'maximum_uses')->get()) |
|
| 51 | 51 | ->addColumn('#', function ($model) { |
| 52 | 52 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
| 53 | 53 | }) |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return view('themes.default1.product.bundle.edit', |
| 151 | - compact('products', 'bundle', 'relation', 'till', 'from')); |
|
| 151 | + compact('products', 'bundle', 'relation', 'till', 'from')); |
|
| 152 | 152 | } catch (\Exception $e) { |
| 153 | 153 | return redirect()->back()->with('fails', $e->getMessage()); |
| 154 | 154 | } catch (\InvalidArgumentException $e) { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $from = null; |
| 158 | 158 | |
| 159 | 159 | return view('themes.default1.product.bundle.edit', |
| 160 | - compact('products', 'bundle', 'relation', 'till', 'from')); |
|
| 160 | + compact('products', 'bundle', 'relation', 'till', 'from')); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | return '<a href='.url('groups/'.$model->id.'/edit'). |
| 72 | 72 | " class='btn btn-sm btn-primary'>Edit</a>"; |
| 73 | 73 | }) |
| 74 | - ->rawColumns(['name', 'features', 'action']) |
|
| 74 | + ->rawColumns(['name', 'features', 'action']) |
|
| 75 | 75 | ->make(true); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | // return \Datatable::of($this->group->select('id', 'name')->get()) |
| 54 | 54 | |
| 55 | - ->editColumn('#', function ($model) { |
|
| 55 | + ->editColumn('#', function($model) { |
|
| 56 | 56 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
| 57 | 57 | }) |
| 58 | 58 | // ->showColumns('name') |
| 59 | - ->editColumn('features', function ($model) { |
|
| 59 | + ->editColumn('features', function($model) { |
|
| 60 | 60 | $features = $this->feature->select('features')->where('group_id', $model->id)->get(); |
| 61 | 61 | //dd($features); |
| 62 | 62 | $result = []; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | //dd($result); |
| 68 | 68 | return implode(',', $result); |
| 69 | 69 | }) |
| 70 | - ->addColumn('action', function ($model) { |
|
| 70 | + ->addColumn('action', function($model) { |
|
| 71 | 71 | return '<a href='.url('groups/'.$model->id.'/edit'). |
| 72 | 72 | " class='btn btn-sm btn-primary'>Edit</a>"; |
| 73 | 73 | }) |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | public function getServices() |
| 36 | 36 | { |
| 37 | 37 | return \Datatable::collection($this->service->get()) |
| 38 | - ->addColumn('#', function ($model) { |
|
| 38 | + ->addColumn('#', function($model) { |
|
| 39 | 39 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
| 40 | 40 | }) |
| 41 | 41 | ->showColumns('name') |
| 42 | - ->addColumn('plan', function ($model) { |
|
| 42 | + ->addColumn('plan', function($model) { |
|
| 43 | 43 | //return $this->product->plan()->name; |
| 44 | 44 | }) |
| 45 | - ->addColumn('action', function ($model) { |
|
| 45 | + ->addColumn('action', function($model) { |
|
| 46 | 46 | return '<a href='.url('products/'.$model->id.'/edit') |
| 47 | 47 | ." class='btn btn-sm btn-primary'>Edit</a>"; |
| 48 | 48 | }) |
@@ -18,28 +18,28 @@ |
||
| 18 | 18 | ->get(); |
| 19 | 19 | |
| 20 | 20 | return \DataTables::of($new_upload) |
| 21 | - ->addColumn('checkbox', function ($model) { |
|
| 21 | + ->addColumn('checkbox', function($model) { |
|
| 22 | 22 | return "<input type='checkbox' class='upload_checkbox' value=".$model->id.' name=select[] id=checks>'; |
| 23 | 23 | }) |
| 24 | 24 | |
| 25 | - ->addColumn('product_id', function ($model) { |
|
| 25 | + ->addColumn('product_id', function($model) { |
|
| 26 | 26 | return ucfirst($this->product->where('id', $model->product_id)->first()->name); |
| 27 | 27 | }) |
| 28 | 28 | |
| 29 | - ->addColumn('title', function ($model) { |
|
| 29 | + ->addColumn('title', function($model) { |
|
| 30 | 30 | return ucfirst($model->title); |
| 31 | 31 | }) |
| 32 | - ->addColumn('description', function ($model) { |
|
| 32 | + ->addColumn('description', function($model) { |
|
| 33 | 33 | return ucfirst($model->description); |
| 34 | 34 | }) |
| 35 | - ->addColumn('version', function ($model) { |
|
| 35 | + ->addColumn('version', function($model) { |
|
| 36 | 36 | return $model->version; |
| 37 | 37 | }) |
| 38 | 38 | |
| 39 | - ->addColumn('file', function ($model) { |
|
| 39 | + ->addColumn('file', function($model) { |
|
| 40 | 40 | return $model->file; |
| 41 | 41 | }) |
| 42 | - ->addColumn('action', function ($model) { |
|
| 42 | + ->addColumn('action', function($model) { |
|
| 43 | 43 | return '<a href='.('#edit-upload-option/'.$model->id).' |
| 44 | 44 | class=" btn btn-sm btn-primary " data-title="'.$model->title.'" |
| 45 | 45 | data-description="'.$model->description.'" data-version="' |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | return '<a href='.('#edit-upload-option/'.$model->id).' |
| 43 | 43 | class=" btn btn-sm btn-primary " data-title="'.$model->title.'" |
| 44 | 44 | data-description="'.$model->description.'" data-version="' |
| 45 | - .$model->version.'" data-id="'.$model->id.'" onclick="openEditPopup(this)" >Edit</a>'; |
|
| 45 | + .$model->version.'" data-id="'.$model->id.'" onclick="openEditPopup(this)" >Edit</a>'; |
|
| 46 | 46 | }) |
| 47 | 47 | ->rawcolumns(['checkbox', 'product_id', 'title', 'description', 'version', 'file', 'action']) |
| 48 | 48 | ->make(true); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | if ($product->require_domain == 1) { |
| 93 | 93 | $field .= "<div class='col-md-4 form-group'> |
| 94 | 94 | <label class='required'>"./* @scrutinizer ignore-type */ |
| 95 | - \Lang::get('message.domain')."</label> |
|
| 95 | + \Lang::get('message.domain')."</label> |
|
| 96 | 96 | <input type='text' name='domain' class='form-control' |
| 97 | 97 | id='domain' placeholder='http://example.com'> |
| 98 | 98 | </div>"; |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | 'state_subdivision_id', 'country_code_char2', |
| 14 | 14 | 'country_code_char3', 'state_subdivision_name', |
| 15 | 15 | 'state_subdivision_alternate_names', 'primary_level_name', |
| 16 | - 'state_subdivision_code', |
|
| 16 | + 'state_subdivision_code', |
|
| 17 | 17 | ]; |
| 18 | 18 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $dbpassword = $this->ask('Enter your database password (blank if not entered)', false); |
| 49 | 49 | $port = $this->ask('Enter your sql port (blank if not entered)', false); |
| 50 | 50 | $array = ['DB_TYPE' => $default, 'DB_HOST' => $host, |
| 51 | - 'DB_DATABASE' => $database, 'DB_USERNAME' => $dbusername, 'DB_PASSWORD' => $dbpassword, ]; |
|
| 51 | + 'DB_DATABASE' => $database, 'DB_USERNAME' => $dbusername, 'DB_PASSWORD' => $dbpassword, ]; |
|
| 52 | 52 | $this->updateDBEnv($array); |
| 53 | 53 | $this->call('key:generate'); |
| 54 | 54 | $this->call('migrate'); |
@@ -192,149 +192,149 @@ discard block |
||
| 192 | 192 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 193 | 193 | |
| 194 | 194 | if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
| 195 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 196 | - |
|
| 197 | - $state_code = ''; |
|
| 198 | - $c_gst = ''; |
|
| 199 | - $s_gst = ''; |
|
| 200 | - $i_gst = ''; |
|
| 201 | - $ut_gst = ''; |
|
| 202 | - $value = ''; |
|
| 203 | - $rate = ''; |
|
| 204 | - $status = 1; |
|
| 205 | - |
|
| 206 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 207 | - $c_gst = $user_state->c_gst; |
|
| 208 | - $s_gst = $user_state->s_gst; |
|
| 209 | - $i_gst = $user_state->i_gst; |
|
| 210 | - $ut_gst = $user_state->ut_gst; |
|
| 211 | - $state_code = $user_state->state_code; |
|
| 212 | - |
|
| 213 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 214 | - $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 195 | + if ($tax_enable == 1) {//If GST is Enabled |
|
| 196 | + |
|
| 197 | + $state_code = ''; |
|
| 198 | + $c_gst = ''; |
|
| 199 | + $s_gst = ''; |
|
| 200 | + $i_gst = ''; |
|
| 201 | + $ut_gst = ''; |
|
| 202 | + $value = ''; |
|
| 203 | + $rate = ''; |
|
| 204 | + $status = 1; |
|
| 205 | + |
|
| 206 | + if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 207 | + $c_gst = $user_state->c_gst; |
|
| 208 | + $s_gst = $user_state->s_gst; |
|
| 209 | + $i_gst = $user_state->i_gst; |
|
| 210 | + $ut_gst = $user_state->ut_gst; |
|
| 211 | + $state_code = $user_state->state_code; |
|
| 212 | + |
|
| 213 | + if ($state_code == $origin_state) {//If user and origin state are same |
|
| 214 | + $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 215 | 215 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 216 | 216 | |
| 217 | - $taxes = $rateForSameState['taxes']; |
|
| 218 | - $status = $rateForSameState['status']; |
|
| 219 | - $value = $rateForSameState['value']; |
|
| 220 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 221 | - $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 217 | + $taxes = $rateForSameState['taxes']; |
|
| 218 | + $status = $rateForSameState['status']; |
|
| 219 | + $value = $rateForSameState['value']; |
|
| 220 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 221 | + $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 222 | 222 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 223 | - $taxes = $rateForOtherState['taxes']; |
|
| 224 | - $status = $rateForOtherState['status']; |
|
| 225 | - $value = $rateForOtherState['value']; |
|
| 226 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 227 | - $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 223 | + $taxes = $rateForOtherState['taxes']; |
|
| 224 | + $status = $rateForOtherState['status']; |
|
| 225 | + $value = $rateForOtherState['value']; |
|
| 226 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 227 | + $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 228 | 228 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 229 | - $taxes = $rateForUnionTerritory['taxes']; |
|
| 230 | - $status = $rateForUnionTerritory['status']; |
|
| 231 | - $value = $rateForUnionTerritory['value']; |
|
| 232 | - } |
|
| 233 | - } else {//If user from other Country |
|
| 234 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 235 | - ->orWhere('country', $geoip_country) |
|
| 236 | - ->pluck('tax_classes_id')->first(); |
|
| 237 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 238 | - $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 229 | + $taxes = $rateForUnionTerritory['taxes']; |
|
| 230 | + $status = $rateForUnionTerritory['status']; |
|
| 231 | + $value = $rateForUnionTerritory['value']; |
|
| 232 | + } |
|
| 233 | + } else {//If user from other Country |
|
| 234 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 235 | + ->orWhere('country', $geoip_country) |
|
| 236 | + ->pluck('tax_classes_id')->first(); |
|
| 237 | + if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 238 | + $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 239 | 239 | $productid, $status); |
| 240 | - $taxes = $taxForSpecificCountry['taxes']; |
|
| 241 | - $status = $taxForSpecificCountry['status']; |
|
| 242 | - $value = $taxForSpecificCountry['value']; |
|
| 243 | - $rate = $taxForSpecificCountry['value']; |
|
| 244 | - } else {//if Tax is selected for Any Country Any State |
|
| 245 | - $taxClassId = Tax::where('country', '') |
|
| 246 | - ->where('state', 'Any State') |
|
| 247 | - ->pluck('tax_classes_id')->first(); |
|
| 248 | - if ($taxClassId) { |
|
| 249 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 250 | - $taxes = $taxForAnyCountry['taxes']; |
|
| 251 | - $status = $taxForAnyCountry['status']; |
|
| 252 | - $value = $taxForAnyCountry['value']; |
|
| 253 | - $rate = $taxForAnyCountry['value']; |
|
| 254 | - } else { |
|
| 255 | - $taxes = [0]; |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - foreach ($taxes as $key => $tax) { |
|
| 240 | + $taxes = $taxForSpecificCountry['taxes']; |
|
| 241 | + $status = $taxForSpecificCountry['status']; |
|
| 242 | + $value = $taxForSpecificCountry['value']; |
|
| 243 | + $rate = $taxForSpecificCountry['value']; |
|
| 244 | + } else {//if Tax is selected for Any Country Any State |
|
| 245 | + $taxClassId = Tax::where('country', '') |
|
| 246 | + ->where('state', 'Any State') |
|
| 247 | + ->pluck('tax_classes_id')->first(); |
|
| 248 | + if ($taxClassId) { |
|
| 249 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 250 | + $taxes = $taxForAnyCountry['taxes']; |
|
| 251 | + $status = $taxForAnyCountry['status']; |
|
| 252 | + $value = $taxForAnyCountry['value']; |
|
| 253 | + $rate = $taxForAnyCountry['value']; |
|
| 254 | + } else { |
|
| 255 | + $taxes = [0]; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + foreach ($taxes as $key => $tax) { |
|
| 260 | 260 | |
| 261 | 261 | //All the da a attribute that is sent to the checkout Page if tax_compound=0 |
| 262 | - if ($taxes[0]) { |
|
| 263 | - $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 264 | - 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 262 | + if ($taxes[0]) { |
|
| 263 | + $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 264 | + 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 265 | 265 | 'state' => $state_code, 'origin_state'=>$origin_state, |
| 266 | - 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 266 | + 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 267 | 267 | |
| 268 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 268 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 269 | 269 | |
| 270 | 270 | 'name' => 'no compound', |
| 271 | 271 | 'type' => 'tax', |
| 272 | 272 | 'target' => 'item', |
| 273 | 273 | 'value' => $value, |
| 274 | - ]); |
|
| 275 | - } else { |
|
| 276 | - $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 277 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 278 | - 'name' => 'null', |
|
| 279 | - 'type' => 'tax', |
|
| 280 | - 'target' => 'item', |
|
| 281 | - 'value' => '0%', |
|
| 282 | - ]); |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 286 | - $status = 1; |
|
| 287 | - if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 288 | - $taxClassId = Tax::where('country', '') |
|
| 289 | - ->where('state', 'Any State') |
|
| 290 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 291 | - // other tax is available and tax is not enabled |
|
| 292 | - if ($taxClassId) { |
|
| 293 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 294 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 295 | - if ($value == 0) { |
|
| 296 | - $status = 0; |
|
| 297 | - } |
|
| 298 | - $rate = $value; |
|
| 299 | - foreach ($taxes as $key => $tax) { |
|
| 300 | - $tax_attribute[$key] = ['name' => $tax->name, |
|
| 301 | - 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 302 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 274 | + ]); |
|
| 275 | + } else { |
|
| 276 | + $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 277 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 278 | + 'name' => 'null', |
|
| 279 | + 'type' => 'tax', |
|
| 280 | + 'target' => 'item', |
|
| 281 | + 'value' => '0%', |
|
| 282 | + ]); |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 286 | + $status = 1; |
|
| 287 | + if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 288 | + $taxClassId = Tax::where('country', '') |
|
| 289 | + ->where('state', 'Any State') |
|
| 290 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 291 | + // other tax is available and tax is not enabled |
|
| 292 | + if ($taxClassId) { |
|
| 293 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 294 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 295 | + if ($value == 0) { |
|
| 296 | + $status = 0; |
|
| 297 | + } |
|
| 298 | + $rate = $value; |
|
| 299 | + foreach ($taxes as $key => $tax) { |
|
| 300 | + $tax_attribute[$key] = ['name' => $tax->name, |
|
| 301 | + 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 302 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 303 | 303 | |
| 304 | 304 | 'name' => $tax->name, |
| 305 | 305 | 'type' => 'tax', |
| 306 | 306 | 'target' => 'item', |
| 307 | 307 | 'value' => $value, |
| 308 | 308 | ]); |
| 309 | - } |
|
| 310 | - } else {//In case of other country |
|
| 311 | - //when tax is available and tax is not enabled |
|
| 312 | - //(Applicable when Global Tax class for any country and state is not there) |
|
| 313 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 314 | - ->orWhere('country', $geoip_country) |
|
| 315 | - ->pluck('tax_classes_id')->first(); |
|
| 316 | - if ($taxClassId) { //if state equals the user State |
|
| 317 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 318 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 319 | - if ($value == '') { |
|
| 320 | - $status = 0; |
|
| 321 | - } |
|
| 322 | - $rate = $value; |
|
| 323 | - } |
|
| 324 | - foreach ($taxes as $key => $tax) { |
|
| 325 | - $tax_attribute[$key] = ['name' => $tax->name, |
|
| 326 | - 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 327 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 309 | + } |
|
| 310 | + } else {//In case of other country |
|
| 311 | + //when tax is available and tax is not enabled |
|
| 312 | + //(Applicable when Global Tax class for any country and state is not there) |
|
| 313 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 314 | + ->orWhere('country', $geoip_country) |
|
| 315 | + ->pluck('tax_classes_id')->first(); |
|
| 316 | + if ($taxClassId) { //if state equals the user State |
|
| 317 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 318 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 319 | + if ($value == '') { |
|
| 320 | + $status = 0; |
|
| 321 | + } |
|
| 322 | + $rate = $value; |
|
| 323 | + } |
|
| 324 | + foreach ($taxes as $key => $tax) { |
|
| 325 | + $tax_attribute[$key] = ['name' => $tax->name, |
|
| 326 | + 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 327 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 328 | 328 | |
| 329 | 329 | 'name' => $tax->name, |
| 330 | 330 | 'type' => 'tax', |
| 331 | 331 | 'target' => 'item', |
| 332 | 332 | 'value' => $value, |
| 333 | 333 | ]); |
| 334 | - } |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - } |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | 338 | } else { |
| 339 | 339 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
| 340 | 340 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $value = ''; |
| 414 | 414 | $value = $taxes->toArray()[0]['active'] ? |
| 415 | 415 | (TaxProductRelation::where('product_id', $productid) |
| 416 | - ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 416 | + ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 417 | 417 | |
| 418 | 418 | return $value; |
| 419 | 419 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $otherRate = 0; |
| 431 | 431 | $status = $taxes->toArray()[0]['active']; |
| 432 | 432 | if ($status && (TaxProductRelation::where('product_id', $productid) |
| 433 | - ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 433 | + ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 434 | 434 | $otherRate = Tax::where('tax_classes_id', $taxClassId)->first()->rate; |
| 435 | 435 | } |
| 436 | 436 | $value = $otherRate.'%'; |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | if ($subregion) { |
| 712 | 712 | $result = ['id' => $subregion->state_subdivision_code, |
| 713 | 713 | |
| 714 | - 'name' => $subregion->state_subdivision_name, ]; |
|
| 714 | + 'name' => $subregion->state_subdivision_name, ]; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | return $result; |
@@ -178,8 +178,10 @@ discard block |
||
| 178 | 178 | $origin_state = $this->setting->first()->state; //Get the State of origin |
| 179 | 179 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 180 | 180 | |
| 181 | - if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
|
| 182 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 181 | + if ($tax_class_id) { |
|
| 182 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
| 183 | + if ($tax_enable == 1) { |
|
| 184 | +//If GST is Enabled |
|
| 183 | 185 | |
| 184 | 186 | $state_code = ''; |
| 185 | 187 | $c_gst = ''; |
@@ -190,45 +192,52 @@ discard block |
||
| 190 | 192 | $rate = ''; |
| 191 | 193 | $status = 1; |
| 192 | 194 | |
| 193 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 195 | + if ($user_state != '') { |
|
| 196 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 194 | 197 | $c_gst = $user_state->c_gst; |
| 195 | 198 | $s_gst = $user_state->s_gst; |
| 196 | 199 | $i_gst = $user_state->i_gst; |
| 197 | 200 | $ut_gst = $user_state->ut_gst; |
| 198 | 201 | $state_code = $user_state->state_code; |
| 199 | 202 | |
| 200 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 203 | + if ($state_code == $origin_state) { |
|
| 204 | +//If user and origin state are same |
|
| 201 | 205 | $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
| 202 | 206 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 203 | 207 | |
| 204 | 208 | $taxes = $rateForSameState['taxes']; |
| 205 | 209 | $status = $rateForSameState['status']; |
| 206 | 210 | $value = $rateForSameState['value']; |
| 207 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 211 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 212 | +//If user is from other state |
|
| 208 | 213 | $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
| 209 | 214 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 210 | 215 | $taxes = $rateForOtherState['taxes']; |
| 211 | 216 | $status = $rateForOtherState['status']; |
| 212 | 217 | $value = $rateForOtherState['value']; |
| 213 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 218 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 219 | +//if user from Union Territory |
|
| 214 | 220 | $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
| 215 | 221 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 216 | 222 | $taxes = $rateForUnionTerritory['taxes']; |
| 217 | 223 | $status = $rateForUnionTerritory['status']; |
| 218 | 224 | $value = $rateForUnionTerritory['value']; |
| 219 | 225 | } |
| 220 | - } else {//If user from other Country |
|
| 226 | + } else { |
|
| 227 | +//If user from other Country |
|
| 221 | 228 | $taxClassId = Tax::where('state', $geoip_state) |
| 222 | 229 | ->orWhere('country', $geoip_country) |
| 223 | 230 | ->pluck('tax_classes_id')->first(); |
| 224 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 231 | + if ($taxClassId) { |
|
| 232 | +//if state equals the user State or country equals user country |
|
| 225 | 233 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
| 226 | 234 | $productid, $status); |
| 227 | 235 | $taxes = $taxForSpecificCountry['taxes']; |
| 228 | 236 | $status = $taxForSpecificCountry['status']; |
| 229 | 237 | $value = $taxForSpecificCountry['value']; |
| 230 | 238 | $rate = $taxForSpecificCountry['value']; |
| 231 | - } else {//if Tax is selected for Any Country Any State |
|
| 239 | + } else { |
|
| 240 | +//if Tax is selected for Any Country Any State |
|
| 232 | 241 | $taxClassId = Tax::where('country', '') |
| 233 | 242 | ->where('state', 'Any State') |
| 234 | 243 | ->pluck('tax_classes_id')->first(); |
@@ -269,7 +278,8 @@ discard block |
||
| 269 | 278 | ]); |
| 270 | 279 | } |
| 271 | 280 | } |
| 272 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 281 | + } elseif ($tax_enable == 0) { |
|
| 282 | +//If Tax enable is 0 |
|
| 273 | 283 | $status = 1; |
| 274 | 284 | if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
| 275 | 285 | $taxClassId = Tax::where('country', '') |
@@ -294,13 +304,15 @@ discard block |
||
| 294 | 304 | 'value' => $value, |
| 295 | 305 | ]); |
| 296 | 306 | } |
| 297 | - } else {//In case of other country |
|
| 307 | + } else { |
|
| 308 | +//In case of other country |
|
| 298 | 309 | //when tax is available and tax is not enabled |
| 299 | 310 | //(Applicable when Global Tax class for any country and state is not there) |
| 300 | 311 | $taxClassId = Tax::where('state', $geoip_state) |
| 301 | 312 | ->orWhere('country', $geoip_country) |
| 302 | 313 | ->pluck('tax_classes_id')->first(); |
| 303 | - if ($taxClassId) { //if state equals the user State |
|
| 314 | + if ($taxClassId) { |
|
| 315 | +//if state equals the user State |
|
| 304 | 316 | $taxes = $this->getTaxByPriority($taxClassId); |
| 305 | 317 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 306 | 318 | if ($value == '') { |
@@ -882,7 +894,8 @@ discard block |
||
| 882 | 894 | try { |
| 883 | 895 | $currency = Setting::find(1)->default_currency; |
| 884 | 896 | $currency_symbol = Setting::find(1)->default_symbol; |
| 885 | - if (!\Auth::user()) {//When user is not logged in |
|
| 897 | + if (!\Auth::user()) { |
|
| 898 | +//When user is not logged in |
|
| 886 | 899 | $cont = new \App\Http\Controllers\Front\PageController(); |
| 887 | 900 | $location = $cont->getLocation(); |
| 888 | 901 | $country = \App\Http\Controllers\Front\CartController::findCountryByGeoip($location['iso_code']); |
@@ -901,7 +914,8 @@ discard block |
||
| 901 | 914 | $currency = \Auth::user()->currency; |
| 902 | 915 | $currency_symbol = \Auth::user()->currency_symbol; |
| 903 | 916 | } |
| 904 | - if ($userid != '') {//For Admin Panel Clients |
|
| 917 | + if ($userid != '') { |
|
| 918 | +//For Admin Panel Clients |
|
| 905 | 919 | $currencyAndSymbol = $this->getCurrency($userid); |
| 906 | 920 | $currency = $currencyAndSymbol['currency']; |
| 907 | 921 | $currency_symbol = $currencyAndSymbol['symbol']; |