@@ -47,7 +47,8 @@ |
||
47 | 47 | if ($url) { |
48 | 48 | $content = \Cart::getContent(); |
49 | 49 | $currency = (\Session::get('currency')); |
50 | - if (\Auth::user()->currency != $currency['currency']) {//If user currency is not equal to the cart currency then redirect to default url and clear his cart items and let the customer add the Product again so that the tax could be calculated properly |
|
50 | + if (\Auth::user()->currency != $currency['currency']) { |
|
51 | +//If user currency is not equal to the cart currency then redirect to default url and clear his cart items and let the customer add the Product again so that the tax could be calculated properly |
|
51 | 52 | foreach ($content as $key => $item) { |
52 | 53 | $id = $item->id; |
53 | 54 | Cart::remove($id); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | 'user_id', 'plan_id', 'order_id', 'deny_after_subscription', 'version', 'product_id', 'support_ends_at', ]; |
16 | 16 | protected $dates = ['ends_at']; |
17 | 17 | protected static $logName = 'Subscription'; |
18 | - protected static $logAttributes = ['ends_at', 'update_ends_at', 'support_ends_at', 'user_id', 'plan_id', 'order_id', 'version', 'product_id']; |
|
18 | + protected static $logAttributes = ['ends_at', 'update_ends_at', 'support_ends_at', 'user_id', 'plan_id', 'order_id', 'version', 'product_id']; |
|
19 | 19 | protected static $logOnlyDirty = true; |
20 | 20 | |
21 | 21 | public function getDescriptionForEvent(string $eventName): string |
@@ -232,7 +232,7 @@ |
||
232 | 232 | $payment_date = \Carbon\Carbon::now()->toDateTimeString(); |
233 | 233 | $amount = $grand_total; |
234 | 234 | $paymentRenewal = $this->updateInvoicePayment($invoiceid, $payment_method, |
235 | - $payment_status, $payment_date, $amount); |
|
235 | + $payment_status, $payment_date, $amount); |
|
236 | 236 | |
237 | 237 | return redirect()->back()->with('success', 'Payment Accepted Successfully'); |
238 | 238 | } catch (\Exception $ex) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $value = ''; |
171 | 171 | $value = $taxes->toArray()[0]['active'] ? |
172 | 172 | (TaxProductRelation::where('product_id', $productid) |
173 | - ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
173 | + ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
174 | 174 | |
175 | 175 | return $value; |
176 | 176 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $otherRate = 0; |
188 | 188 | $status = $taxes->toArray()[0]['active']; |
189 | 189 | if ($status && (TaxProductRelation::where('product_id', $productid) |
190 | - ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
190 | + ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
191 | 191 | $otherRate = Tax::where('tax_classes_id', $taxClassId)->first()->rate; |
192 | 192 | } |
193 | 193 | $value = $otherRate.'%'; |
@@ -18,24 +18,28 @@ discard block |
||
18 | 18 | |
19 | 19 | public function getDetailsWhenUserStateIsIndian($user_state, $origin_state, $productid, $geoip_state, $geoip_country, $status = 1) |
20 | 20 | { |
21 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user,if user from INdia |
|
21 | + if ($user_state != '') { |
|
22 | +//Get the CGST,SGST,IGST,STATE_CODE of the user,if user from INdia |
|
22 | 23 | $c_gst = $user_state->c_gst; |
23 | 24 | $s_gst = $user_state->s_gst; |
24 | 25 | $i_gst = $user_state->i_gst; |
25 | 26 | $ut_gst = $user_state->ut_gst; |
26 | 27 | $state_code = $user_state->state_code; |
27 | 28 | |
28 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
29 | + if ($state_code == $origin_state) { |
|
30 | +//If user and origin state are same |
|
29 | 31 | $rateForSameState = $this->getTaxWhenIndianSameState($user_state, $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
30 | 32 | $taxes = $rateForSameState['taxes']; |
31 | 33 | $status = $rateForSameState['status']; |
32 | 34 | $value = $rateForSameState['value']; |
33 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
35 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
36 | +//If user is from other state |
|
34 | 37 | $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, $origin_state, $productid, $i_gst, $state_code, $status); |
35 | 38 | $taxes = $rateForOtherState['taxes']; |
36 | 39 | $status = $rateForOtherState['status']; |
37 | 40 | $value = $rateForOtherState['value']; |
38 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
41 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
42 | +//if user from Union Territory |
|
39 | 43 | $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
40 | 44 | $taxes = $rateForUnionTerritory['taxes']; |
41 | 45 | $status = $rateForUnionTerritory['status']; |
@@ -56,13 +60,15 @@ discard block |
||
56 | 60 | $taxClassId = Tax::where('state', $geoip_state) |
57 | 61 | ->orWhere('country', $geoip_country) |
58 | 62 | ->pluck('tax_classes_id')->first(); |
59 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
63 | + if ($taxClassId) { |
|
64 | +//if state equals the user State or country equals user country |
|
60 | 65 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, $productid, $status); |
61 | 66 | $taxes = $taxForSpecificCountry['taxes']; |
62 | 67 | $status = $taxForSpecificCountry['status']; |
63 | 68 | $value = $taxForSpecificCountry['value']; |
64 | 69 | $rate = $taxForSpecificCountry['value']; |
65 | - } else {//if Tax is selected for Any Country Any State |
|
70 | + } else { |
|
71 | +//if Tax is selected for Any Country Any State |
|
66 | 72 | $taxClassId = Tax::where('country', '') |
67 | 73 | ->where('state', 'Any State') |
68 | 74 | ->pluck('tax_classes_id')->first(); |
@@ -96,13 +102,15 @@ discard block |
||
96 | 102 | $status = 0; |
97 | 103 | } |
98 | 104 | $rate = $value; |
99 | - } else {//In case of other country |
|
105 | + } else { |
|
106 | +//In case of other country |
|
100 | 107 | //when tax is available and tax is not enabled |
101 | 108 | //(Applicable when Global Tax class for any country and state is not there) |
102 | 109 | $taxClassId = Tax::where('state', $geoip_state) |
103 | 110 | ->orWhere('country', $geoip_country) |
104 | 111 | ->pluck('tax_classes_id')->first(); |
105 | - if ($taxClassId) { //if state equals the user State |
|
112 | + if ($taxClassId) { |
|
113 | +//if state equals the user State |
|
106 | 114 | $taxes = $this->getTaxByPriority($taxClassId); |
107 | 115 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
108 | 116 | if ($value == '') { |
@@ -169,7 +169,8 @@ discard block |
||
169 | 169 | |
170 | 170 | $plan = new Plan(); |
171 | 171 | $plans = $plan->where('product', $productid)->pluck('name', 'id')->toArray(); |
172 | - if (count($plans) > 0) {//If Plan Exist For A product, Display Dropdown for Plans |
|
172 | + if (count($plans) > 0) { |
|
173 | +//If Plan Exist For A product, Display Dropdown for Plans |
|
173 | 174 | $field = "<div class='col-md-4 form-group'> |
174 | 175 | <label class='required'>"./* @scrutinizer ignore-type */ |
175 | 176 | \Lang::get('message.subscription').'</label> |
@@ -180,7 +181,8 @@ discard block |
||
180 | 181 | ['class' => 'form-control', 'id' => 'plan', 'onchange' => 'getPrice(this.value)'] |
181 | 182 | ).' |
182 | 183 | </div>'; |
183 | - } else {//If No Plan Exist For A Product |
|
184 | + } else { |
|
185 | +//If No Plan Exist For A Product |
|
184 | 186 | $userid = $request->input('user'); |
185 | 187 | $price = $controller->cost($productid, $userid); |
186 | 188 | } |
@@ -243,7 +245,8 @@ discard block |
||
243 | 245 | |
244 | 246 | public function getRelease($owner, $repository, $order_id, $file) |
245 | 247 | { |
246 | - if ($owner && $repository) {//If the Product is downloaded from Github |
|
248 | + if ($owner && $repository) { |
|
249 | +//If the Product is downloaded from Github |
|
247 | 250 | $github_controller = new \App\Http\Controllers\Github\GithubController(); |
248 | 251 | $relese = $github_controller->listRepositories($owner, $repository, $order_id); |
249 | 252 |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | // $r = $mailchimp->updateSubscriberForFreeProduct($email, $product); |
118 | 118 | // } |
119 | 119 | |
120 | - } catch (\Exception $ex) { |
|
120 | + } catch (\Exception $ex) { |
|
121 | 121 | dd($ex); |
122 | - Bugsnag::notifyException($ex); |
|
123 | - app('log')->error($ex->getMessage()); |
|
124 | - throw new \Exception('Can not Generate Order'); |
|
125 | - } |
|
122 | + Bugsnag::notifyException($ex); |
|
123 | + app('log')->error($ex->getMessage()); |
|
124 | + throw new \Exception('Can not Generate Order'); |
|
125 | + } |
|
126 | 126 | |
127 | 127 | |
128 | 128 | throw new \Exception('Can not Generate Order'); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $data = $template->data; |
280 | 280 | $replace = [ |
281 | 281 | 'name' => $user->first_name.' '.$user->last_name, |
282 | - 'serialkeyurl'=> $myaccounturl, |
|
282 | + 'serialkeyurl'=> $myaccounturl, |
|
283 | 283 | 'downloadurl' => $downloadurl, |
284 | 284 | 'invoiceurl' => $invoiceurl, |
285 | 285 | 'product' => $product, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function getIfItemPresent($item, $invoiceid, $user_id, $order_status) |
82 | 82 | { |
83 | 83 | |
84 | - try{ |
|
84 | + try { |
|
85 | 85 | |
86 | 86 | $product = $this->product->where('name', $item->product_name)->first()->id; |
87 | 87 | $version = $this->product->where('name', $item->product_name)->first()->version; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | //Get Version from Product Upload Table |
90 | 90 | $version = $this->product_upload->where('product_id', $product)->pluck('version')->first(); |
91 | 91 | } |
92 | - $serial_key = $this->generateSerialKey($product,$item->agents);//Send Product Id and Agents to generate Serial Key |
|
92 | + $serial_key = $this->generateSerialKey($product, $item->agents); //Send Product Id and Agents to generate Serial Key |
|
93 | 93 | $domain = $item->domain; |
94 | 94 | $plan_id = $this->plan($item->id); |
95 | 95 | $order = $this->order->create([ |
@@ -81,7 +81,7 @@ |
||
81 | 81 | public function getIfItemPresent($item, $invoiceid, $user_id, $order_status) |
82 | 82 | { |
83 | 83 | |
84 | - try{ |
|
84 | + try { |
|
85 | 85 | |
86 | 86 | $product = $this->product->where('name', $item->product_name)->first()->id; |
87 | 87 | $version = $this->product->where('name', $item->product_name)->first()->version; |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | $this->domain($domain, $join); |
50 | 50 | |
51 | 51 | $join = $join->orderBy('created_at', 'desc') |
52 | - ->select( |
|
53 | - 'orders.id', |
|
54 | - 'orders.created_at', |
|
55 | - 'client', |
|
52 | + ->select( |
|
53 | + 'orders.id', |
|
54 | + 'orders.created_at', |
|
55 | + 'client', |
|
56 | 56 | 'price_override', |
57 | - 'order_status', |
|
58 | - 'product', |
|
59 | - 'number', |
|
60 | - 'serial_key' |
|
61 | - ); |
|
57 | + 'order_status', |
|
58 | + 'product', |
|
59 | + 'number', |
|
60 | + 'serial_key' |
|
61 | + ); |
|
62 | 62 | |
63 | 63 | return $join; |
64 | 64 | } catch (\Exception $ex) { |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | case '1': |
269 | 269 | $lastFour = '000'.$agents; |
270 | 270 | break; |
271 | - case '2': |
|
271 | + case '2': |
|
272 | 272 | |
273 | 273 | $lastFour = '00'.$agents; |
274 | - break; |
|
275 | - case '3': |
|
274 | + break; |
|
275 | + case '3': |
|
276 | 276 | $lastFour = '0'.$agents; |
277 | - break; |
|
278 | - case '4': |
|
277 | + break; |
|
278 | + case '4': |
|
279 | 279 | $lastFour = $agents; |
280 | 280 | |
281 | - break; |
|
281 | + break; |
|
282 | 282 | default: |
283 | 283 | $lastFour = '0000'; |
284 | 284 | break; |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till); |
128 | 128 | |
129 | 129 | return \DataTables::of($query->take(100)) |
130 | - ->setTotalRecords($query->count()) |
|
130 | + ->setTotalRecords($query->count()) |
|
131 | 131 | |
132 | - ->addColumn('checkbox', function ($model) { |
|
133 | - return "<input type='checkbox' class='invoice_checkbox' |
|
132 | + ->addColumn('checkbox', function ($model) { |
|
133 | + return "<input type='checkbox' class='invoice_checkbox' |
|
134 | 134 | value=".$model->id.' name=select[] id=check>'; |
135 | - }) |
|
135 | + }) |
|
136 | 136 | ->addColumn('user_id', function ($model) { |
137 | 137 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
138 | 138 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
142 | 142 | }) |
143 | - ->addColumn('number', function ($model) { |
|
144 | - return ucfirst($model->number); |
|
145 | - }) |
|
143 | + ->addColumn('number', function ($model) { |
|
144 | + return ucfirst($model->number); |
|
145 | + }) |
|
146 | 146 | |
147 | 147 | ->addColumn('date', function ($model) { |
148 | 148 | $date = ($model->created_at); |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | return $date; |
151 | 151 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
152 | 152 | }) |
153 | - ->addColumn('grand_total', function ($model) { |
|
154 | - return ucfirst($model->number); |
|
155 | - }) |
|
156 | - ->addColumn('status', function ($model) { |
|
157 | - return ucfirst($model->status); |
|
158 | - }) |
|
153 | + ->addColumn('grand_total', function ($model) { |
|
154 | + return ucfirst($model->number); |
|
155 | + }) |
|
156 | + ->addColumn('status', function ($model) { |
|
157 | + return ucfirst($model->status); |
|
158 | + }) |
|
159 | 159 | |
160 | 160 | ->addColumn('action', function ($model) { |
161 | 161 | $action = ''; |
@@ -173,30 +173,30 @@ discard block |
||
173 | 173 | style='color:white;'> </i> View</a>" |
174 | 174 | ." $action"; |
175 | 175 | }) |
176 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
177 | - $sql = 'first_name like ?'; |
|
178 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
179 | - }) |
|
176 | + ->filterColumn('user_id', function ($query, $keyword) { |
|
177 | + $sql = 'first_name like ?'; |
|
178 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
179 | + }) |
|
180 | 180 | |
181 | - ->filterColumn('status', function ($query, $keyword) { |
|
182 | - $sql = 'status like ?'; |
|
183 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
184 | - }) |
|
181 | + ->filterColumn('status', function ($query, $keyword) { |
|
182 | + $sql = 'status like ?'; |
|
183 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
184 | + }) |
|
185 | 185 | |
186 | 186 | ->filterColumn('number', function ($query, $keyword) { |
187 | 187 | $sql = 'number like ?'; |
188 | 188 | $query->whereRaw($sql, ["%{$keyword}%"]); |
189 | 189 | }) |
190 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
191 | - $sql = 'grand_total like ?'; |
|
192 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
193 | - }) |
|
194 | - ->filterColumn('date', function ($query, $keyword) { |
|
195 | - $sql = 'date like ?'; |
|
196 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
197 | - }) |
|
198 | - |
|
199 | - ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
190 | + ->filterColumn('grand_total', function ($query, $keyword) { |
|
191 | + $sql = 'grand_total like ?'; |
|
192 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
193 | + }) |
|
194 | + ->filterColumn('date', function ($query, $keyword) { |
|
195 | + $sql = 'date like ?'; |
|
196 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
197 | + }) |
|
198 | + |
|
199 | + ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
200 | 200 | ->make(true); |
201 | 201 | } |
202 | 202 | |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | } |
309 | 309 | $symbol = $attributes[0]['currency']['symbol']; |
310 | 310 | $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number, |
311 | - 'date' => $date, 'grand_total' => $grand_total, 'status' => 'pending', |
|
312 | - 'currency' => $symbol, ]); |
|
311 | + 'date' => $date, 'grand_total' => $grand_total, 'status' => 'pending', |
|
312 | + 'currency' => $symbol, ]); |
|
313 | 313 | foreach (\Cart::getContent() as $cart) { |
314 | 314 | $this->createInvoiceItems($invoice->id, $cart); |
315 | 315 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'currency' => $currency, 'status' => 'pending', 'description' => $description, ]); |
437 | 437 | |
438 | 438 | $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid, |
439 | - $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
|
439 | + $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
|
440 | 440 | $result = $this->getMessage($items, $user_id); |
441 | 441 | } catch (\Exception $ex) { |
442 | 442 | app('log')->info($ex->getMessage()); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
542 | 542 | |
543 | 543 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
544 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
544 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
545 | 545 | //other tax is available and tax is not enabled |
546 | 546 | if ($taxClassId) { |
547 | 547 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | foreach ($taxes as $key => $tax) { |
610 | 610 | if ($taxes[0]) { |
611 | 611 | $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1, |
612 | - 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
613 | - 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
614 | - 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
615 | - 'origin_state' => $origin_state, ]; |
|
612 | + 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
613 | + 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
614 | + 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
615 | + 'origin_state' => $origin_state, ]; |
|
616 | 616 | |
617 | 617 | $rate = $tax->rate; |
618 | 618 | |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | return view('themes.default1.invoice.payment', |
687 | - compact('invoice_status', 'payment_status', |
|
688 | - 'payment_method', 'invoice_id', 'domain', 'invoice', 'userid')); |
|
687 | + compact('invoice_status', 'payment_status', |
|
688 | + 'payment_method', 'invoice_id', 'domain', 'invoice', 'userid')); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | return redirect()->back(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $from = $request->input('from'); |
107 | 107 | $till = $request->input('till'); |
108 | 108 | |
109 | - return view('themes.default1.invoice.index', compact('name','invoice_no','status','currencies','currency_id','from', |
|
109 | + return view('themes.default1.invoice.index', compact('name', 'invoice_no', 'status', 'currencies', 'currency_id', 'from', |
|
110 | 110 | |
111 | 111 | 'till')); |
112 | 112 | } catch (\Exception $ex) { |
@@ -129,35 +129,35 @@ discard block |
||
129 | 129 | return \DataTables::of($query->take(100)) |
130 | 130 | ->setTotalRecords($query->count()) |
131 | 131 | |
132 | - ->addColumn('checkbox', function ($model) { |
|
132 | + ->addColumn('checkbox', function($model) { |
|
133 | 133 | return "<input type='checkbox' class='invoice_checkbox' |
134 | 134 | value=".$model->id.' name=select[] id=check>'; |
135 | 135 | }) |
136 | - ->addColumn('user_id', function ($model) { |
|
136 | + ->addColumn('user_id', function($model) { |
|
137 | 137 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
138 | 138 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
139 | 139 | $id = $this->user->where('id', $model->user_id)->first()->id; |
140 | 140 | |
141 | 141 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
142 | 142 | }) |
143 | - ->addColumn('number', function ($model) { |
|
143 | + ->addColumn('number', function($model) { |
|
144 | 144 | return ucfirst($model->number); |
145 | 145 | }) |
146 | 146 | |
147 | - ->addColumn('date', function ($model) { |
|
147 | + ->addColumn('date', function($model) { |
|
148 | 148 | $date = ($model->created_at); |
149 | 149 | |
150 | 150 | return $date; |
151 | 151 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
152 | 152 | }) |
153 | - ->addColumn('grand_total', function ($model) { |
|
153 | + ->addColumn('grand_total', function($model) { |
|
154 | 154 | return ucfirst($model->number); |
155 | 155 | }) |
156 | - ->addColumn('status', function ($model) { |
|
156 | + ->addColumn('status', function($model) { |
|
157 | 157 | return ucfirst($model->status); |
158 | 158 | }) |
159 | 159 | |
160 | - ->addColumn('action', function ($model) { |
|
160 | + ->addColumn('action', function($model) { |
|
161 | 161 | $action = ''; |
162 | 162 | |
163 | 163 | $check = $this->checkExecution($model->id); |
@@ -173,25 +173,25 @@ discard block |
||
173 | 173 | style='color:white;'> </i> View</a>" |
174 | 174 | ." $action"; |
175 | 175 | }) |
176 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
176 | + ->filterColumn('user_id', function($query, $keyword) { |
|
177 | 177 | $sql = 'first_name like ?'; |
178 | 178 | $query->whereRaw($sql, ["%{$keyword}%"]); |
179 | 179 | }) |
180 | 180 | |
181 | - ->filterColumn('status', function ($query, $keyword) { |
|
181 | + ->filterColumn('status', function($query, $keyword) { |
|
182 | 182 | $sql = 'status like ?'; |
183 | 183 | $query->whereRaw($sql, ["%{$keyword}%"]); |
184 | 184 | }) |
185 | 185 | |
186 | - ->filterColumn('number', function ($query, $keyword) { |
|
186 | + ->filterColumn('number', function($query, $keyword) { |
|
187 | 187 | $sql = 'number like ?'; |
188 | 188 | $query->whereRaw($sql, ["%{$keyword}%"]); |
189 | 189 | }) |
190 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
190 | + ->filterColumn('grand_total', function($query, $keyword) { |
|
191 | 191 | $sql = 'grand_total like ?'; |
192 | 192 | $query->whereRaw($sql, ["%{$keyword}%"]); |
193 | 193 | }) |
194 | - ->filterColumn('date', function ($query, $keyword) { |
|
194 | + ->filterColumn('date', function($query, $keyword) { |
|
195 | 195 | $sql = 'date like ?'; |
196 | 196 | $query->whereRaw($sql, ["%{$keyword}%"]); |
197 | 197 | }) |
@@ -382,16 +382,19 @@ discard block |
||
382 | 382 | } |
383 | 383 | $productid = $request->input('product'); |
384 | 384 | $plan = $request->input('plan'); |
385 | - if (!$agents) {//If agents is not received in the request in the case when 'modify agent' is not allowed for the Product,get the no of Agents from the Plan Table. |
|
385 | + if (!$agents) { |
|
386 | +//If agents is not received in the request in the case when 'modify agent' is not allowed for the Product,get the no of Agents from the Plan Table. |
|
386 | 387 | $planForAgent = Product::find($productid)->planRelation->find($plan); |
387 | - if ($planForAgent) {//If Plan Exists For the Product ie not a Product without Plan |
|
388 | + if ($planForAgent) { |
|
389 | +//If Plan Exists For the Product ie not a Product without Plan |
|
388 | 390 | $noOfAgents = $planForAgent->planPrice->first()->no_of_agents; |
389 | 391 | $agents = $noOfAgents ? $noOfAgents : 0; //If no. of Agents is specified then that,else 0(Unlimited Agents) |
390 | 392 | } else { |
391 | 393 | $agents = 0; |
392 | 394 | } |
393 | 395 | } |
394 | - if (!$qty) {//If quantity is not received in the request in the case when 'modify quantity' is not allowed for the Product,get the Product qUANTITY from the Plan Table. |
|
396 | + if (!$qty) { |
|
397 | +//If quantity is not received in the request in the case when 'modify quantity' is not allowed for the Product,get the Product qUANTITY from the Plan Table. |
|
395 | 398 | $planForQty = Product::find($productid)->planRelation->find($plan); |
396 | 399 | if ($planForQty) { |
397 | 400 | $quantity = Product::find($productid)->planRelation->find($plan)->planPrice->first()->product_quantity; |
@@ -538,7 +541,8 @@ discard block |
||
538 | 541 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
539 | 542 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
540 | 543 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
541 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
544 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
545 | +//if tax_enable is 0 |
|
542 | 546 | |
543 | 547 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
544 | 548 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -547,13 +551,15 @@ discard block |
||
547 | 551 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
548 | 552 | $taxs = $rate['taxes']; |
549 | 553 | $rate = $rate['rate']; |
550 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
554 | + } elseif ($geoip_country != 'IN') { |
|
555 | +//In case of other country |
|
551 | 556 | // when tax is available and tax is not enabled(Applicable |
552 | 557 | //when Global Tax class for any country and state is not there) |
553 | 558 | |
554 | 559 | $taxClassId = Tax::where('state', $geoip_state) |
555 | 560 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
556 | - if ($taxClassId) { //if state equals the user State |
|
561 | + if ($taxClassId) { |
|
562 | +//if state equals the user State |
|
557 | 563 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
558 | 564 | $taxs = $rate['taxes']; |
559 | 565 | $rate = $rate['rate']; |
@@ -595,11 +601,13 @@ discard block |
||
595 | 601 | $i_gst = 0; |
596 | 602 | $ut_gst = 0; |
597 | 603 | $state_code = ''; |
598 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
604 | + if ($user_state != '') { |
|
605 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
599 | 606 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
600 | 607 | $taxes = $tax['taxes']; |
601 | 608 | $value = $tax['value']; |
602 | - } else {//If user from other Country |
|
609 | + } else { |
|
610 | +//If user from other Country |
|
603 | 611 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
604 | 612 | $taxes = $tax['taxes']; |
605 | 613 | $value = $tax['value']; |
@@ -125,7 +125,7 @@ |
||
125 | 125 | ]); |
126 | 126 | $this->createOrderInvoiceRelation($orderid, $invoice->id); |
127 | 127 | $items = $controller->createInvoiceItemsByAdmin($invoice->id, $product->id, |
128 | - $code, $cost, $currency, $qty = 1, $agents); |
|
128 | + $code, $cost, $currency, $qty = 1, $agents); |
|
129 | 129 | |
130 | 130 | return $items; |
131 | 131 | } catch (Exception $ex) { |