@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till); |
| 130 | 130 | |
| 131 | 131 | return \DataTables::of($query->take(100)) |
| 132 | - ->setTotalRecords($query->count()) |
|
| 132 | + ->setTotalRecords($query->count()) |
|
| 133 | 133 | |
| 134 | - ->addColumn('checkbox', function ($model) { |
|
| 135 | - return "<input type='checkbox' class='invoice_checkbox' |
|
| 134 | + ->addColumn('checkbox', function ($model) { |
|
| 135 | + return "<input type='checkbox' class='invoice_checkbox' |
|
| 136 | 136 | value=".$model->id.' name=select[] id=check>'; |
| 137 | - }) |
|
| 137 | + }) |
|
| 138 | 138 | ->addColumn('user_id', function ($model) { |
| 139 | 139 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 140 | 140 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 144 | 144 | }) |
| 145 | - ->addColumn('number', function ($model) { |
|
| 146 | - return ucfirst($model->number); |
|
| 147 | - }) |
|
| 145 | + ->addColumn('number', function ($model) { |
|
| 146 | + return ucfirst($model->number); |
|
| 147 | + }) |
|
| 148 | 148 | |
| 149 | 149 | ->addColumn('date', function ($model) { |
| 150 | 150 | $date = ($model->created_at); |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | return $date; |
| 153 | 153 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 154 | 154 | }) |
| 155 | - ->addColumn('grand_total', function ($model) { |
|
| 156 | - return $model->grand_total; |
|
| 157 | - }) |
|
| 158 | - ->addColumn('status', function ($model) { |
|
| 159 | - return ucfirst($model->status); |
|
| 160 | - }) |
|
| 155 | + ->addColumn('grand_total', function ($model) { |
|
| 156 | + return $model->grand_total; |
|
| 157 | + }) |
|
| 158 | + ->addColumn('status', function ($model) { |
|
| 159 | + return ucfirst($model->status); |
|
| 160 | + }) |
|
| 161 | 161 | |
| 162 | 162 | ->addColumn('action', function ($model) { |
| 163 | 163 | $action = ''; |
@@ -175,30 +175,30 @@ discard block |
||
| 175 | 175 | style='color:white;'> </i> View</a>" |
| 176 | 176 | ." $action"; |
| 177 | 177 | }) |
| 178 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
| 179 | - $sql = 'first_name like ?'; |
|
| 180 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 181 | - }) |
|
| 178 | + ->filterColumn('user_id', function ($query, $keyword) { |
|
| 179 | + $sql = 'first_name like ?'; |
|
| 180 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 181 | + }) |
|
| 182 | 182 | |
| 183 | - ->filterColumn('status', function ($query, $keyword) { |
|
| 184 | - $sql = 'status like ?'; |
|
| 185 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 186 | - }) |
|
| 183 | + ->filterColumn('status', function ($query, $keyword) { |
|
| 184 | + $sql = 'status like ?'; |
|
| 185 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 186 | + }) |
|
| 187 | 187 | |
| 188 | 188 | ->filterColumn('number', function ($query, $keyword) { |
| 189 | 189 | $sql = 'number like ?'; |
| 190 | 190 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 191 | 191 | }) |
| 192 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 193 | - $sql = 'grand_total like ?'; |
|
| 194 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 195 | - }) |
|
| 196 | - ->filterColumn('date', function ($query, $keyword) { |
|
| 197 | - $sql = 'date like ?'; |
|
| 198 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 199 | - }) |
|
| 200 | - |
|
| 201 | - ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 192 | + ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 193 | + $sql = 'grand_total like ?'; |
|
| 194 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 195 | + }) |
|
| 196 | + ->filterColumn('date', function ($query, $keyword) { |
|
| 197 | + $sql = 'date like ?'; |
|
| 198 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 199 | + }) |
|
| 200 | + |
|
| 201 | + ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 202 | 202 | ->make(true); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $symbol = $attributes[0]['currency']['symbol']; |
| 298 | 298 | $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number, |
| 299 | - 'date' => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending', |
|
| 300 | - 'currency' => \Auth::user()->currency, ]); |
|
| 299 | + 'date' => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending', |
|
| 300 | + 'currency' => \Auth::user()->currency, ]); |
|
| 301 | 301 | foreach (\Cart::getContent() as $cart) { |
| 302 | 302 | $this->createInvoiceItems($invoice->id, $cart, $codevalue); |
| 303 | 303 | } |
@@ -420,11 +420,11 @@ discard block |
||
| 420 | 420 | $grand_total = \App\Http\Controllers\Front\CartController::rounding($grand_total); |
| 421 | 421 | |
| 422 | 422 | $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date, |
| 423 | - 'coupon_code' => $code, 'discount'=>$codeValue, |
|
| 423 | + 'coupon_code' => $code, 'discount'=>$codeValue, |
|
| 424 | 424 | 'grand_total' => $grand_total, 'currency' => $currency, 'status' => $status, 'description' => $description, ]); |
| 425 | 425 | |
| 426 | 426 | $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid, |
| 427 | - $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
|
| 427 | + $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
|
| 428 | 428 | $result = $this->getMessage($items, $user_id); |
| 429 | 429 | } catch (\Exception $ex) { |
| 430 | 430 | app('log')->info($ex->getMessage()); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
| 501 | 501 | |
| 502 | 502 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 503 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 503 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 504 | 504 | //other tax is available and tax is not enabled |
| 505 | 505 | if ($taxClassId) { |
| 506 | 506 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
@@ -568,10 +568,10 @@ discard block |
||
| 568 | 568 | foreach ($taxes as $key => $tax) { |
| 569 | 569 | if ($taxes[0]) { |
| 570 | 570 | $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1, |
| 571 | - 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 572 | - 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 573 | - 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 574 | - 'origin_state' => $origin_state, ]; |
|
| 571 | + 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 572 | + 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 573 | + 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 574 | + 'origin_state' => $origin_state, ]; |
|
| 575 | 575 | |
| 576 | 576 | $rate = $tax->rate; |
| 577 | 577 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $from = $request->input('from'); |
| 109 | 109 | $till = $request->input('till'); |
| 110 | 110 | |
| 111 | - return view('themes.default1.invoice.index', compact('name','invoice_no','status','currencies','currency_id','from', |
|
| 111 | + return view('themes.default1.invoice.index', compact('name', 'invoice_no', 'status', 'currencies', 'currency_id', 'from', |
|
| 112 | 112 | |
| 113 | 113 | 'till')); |
| 114 | 114 | } catch (\Exception $ex) { |
@@ -131,35 +131,35 @@ discard block |
||
| 131 | 131 | return \DataTables::of($query->take(100)) |
| 132 | 132 | ->setTotalRecords($query->count()) |
| 133 | 133 | |
| 134 | - ->addColumn('checkbox', function ($model) { |
|
| 134 | + ->addColumn('checkbox', function($model) { |
|
| 135 | 135 | return "<input type='checkbox' class='invoice_checkbox' |
| 136 | 136 | value=".$model->id.' name=select[] id=check>'; |
| 137 | 137 | }) |
| 138 | - ->addColumn('user_id', function ($model) { |
|
| 138 | + ->addColumn('user_id', function($model) { |
|
| 139 | 139 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 140 | 140 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
| 141 | 141 | $id = $this->user->where('id', $model->user_id)->first()->id; |
| 142 | 142 | |
| 143 | 143 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 144 | 144 | }) |
| 145 | - ->addColumn('number', function ($model) { |
|
| 145 | + ->addColumn('number', function($model) { |
|
| 146 | 146 | return ucfirst($model->number); |
| 147 | 147 | }) |
| 148 | 148 | |
| 149 | - ->addColumn('date', function ($model) { |
|
| 149 | + ->addColumn('date', function($model) { |
|
| 150 | 150 | $date = ($model->created_at); |
| 151 | 151 | |
| 152 | 152 | return $date; |
| 153 | 153 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 154 | 154 | }) |
| 155 | - ->addColumn('grand_total', function ($model) { |
|
| 155 | + ->addColumn('grand_total', function($model) { |
|
| 156 | 156 | return $model->grand_total; |
| 157 | 157 | }) |
| 158 | - ->addColumn('status', function ($model) { |
|
| 158 | + ->addColumn('status', function($model) { |
|
| 159 | 159 | return ucfirst($model->status); |
| 160 | 160 | }) |
| 161 | 161 | |
| 162 | - ->addColumn('action', function ($model) { |
|
| 162 | + ->addColumn('action', function($model) { |
|
| 163 | 163 | $action = ''; |
| 164 | 164 | |
| 165 | 165 | $check = $this->checkExecution($model->id); |
@@ -175,25 +175,25 @@ discard block |
||
| 175 | 175 | style='color:white;'> </i> View</a>" |
| 176 | 176 | ." $action"; |
| 177 | 177 | }) |
| 178 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
| 178 | + ->filterColumn('user_id', function($query, $keyword) { |
|
| 179 | 179 | $sql = 'first_name like ?'; |
| 180 | 180 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 181 | 181 | }) |
| 182 | 182 | |
| 183 | - ->filterColumn('status', function ($query, $keyword) { |
|
| 183 | + ->filterColumn('status', function($query, $keyword) { |
|
| 184 | 184 | $sql = 'status like ?'; |
| 185 | 185 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 186 | 186 | }) |
| 187 | 187 | |
| 188 | - ->filterColumn('number', function ($query, $keyword) { |
|
| 188 | + ->filterColumn('number', function($query, $keyword) { |
|
| 189 | 189 | $sql = 'number like ?'; |
| 190 | 190 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 191 | 191 | }) |
| 192 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 192 | + ->filterColumn('grand_total', function($query, $keyword) { |
|
| 193 | 193 | $sql = 'grand_total like ?'; |
| 194 | 194 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 195 | 195 | }) |
| 196 | - ->filterColumn('date', function ($query, $keyword) { |
|
| 196 | + ->filterColumn('date', function($query, $keyword) { |
|
| 197 | 197 | $sql = 'date like ?'; |
| 198 | 198 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 199 | 199 | }) |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date, |
| 423 | 423 | 'coupon_code' => $code, 'discount'=>$codeValue, |
| 424 | - 'grand_total' => $grand_total, 'currency' => $currency, 'status' => $status, 'description' => $description, ]); |
|
| 424 | + 'grand_total' => $grand_total, 'currency' => $currency, 'status' => $status, 'description' => $description, ]); |
|
| 425 | 425 | |
| 426 | 426 | $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid, |
| 427 | 427 | $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
@@ -322,7 +322,8 @@ discard block |
||
| 322 | 322 | { |
| 323 | 323 | $code = ''; |
| 324 | 324 | $codevalue = ''; |
| 325 | - if (\Session::has('code')) {//If coupon code is applied get it here from Session |
|
| 325 | + if (\Session::has('code')) { |
|
| 326 | +//If coupon code is applied get it here from Session |
|
| 326 | 327 | $code = \Session::get('code'); |
| 327 | 328 | $codevalue = \Session::get('codevalue'); |
| 328 | 329 | } |
@@ -512,7 +513,8 @@ discard block |
||
| 512 | 513 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 513 | 514 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 514 | 515 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 515 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 516 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 517 | +//if tax_enable is 0 |
|
| 516 | 518 | |
| 517 | 519 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 518 | 520 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -521,13 +523,15 @@ discard block |
||
| 521 | 523 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 522 | 524 | $taxs = $rate['taxes']; |
| 523 | 525 | $rate = $rate['rate']; |
| 524 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 526 | + } elseif ($geoip_country != 'IN') { |
|
| 527 | +//In case of other country |
|
| 525 | 528 | // when tax is available and tax is not enabled(Applicable |
| 526 | 529 | //when Global Tax class for any country and state is not there) |
| 527 | 530 | |
| 528 | 531 | $taxClassId = Tax::where('state', $geoip_state) |
| 529 | 532 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 530 | - if ($taxClassId) { //if state equals the user State |
|
| 533 | + if ($taxClassId) { |
|
| 534 | +//if state equals the user State |
|
| 531 | 535 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 532 | 536 | $taxs = $rate['taxes']; |
| 533 | 537 | $rate = $rate['rate']; |
@@ -569,11 +573,13 @@ discard block |
||
| 569 | 573 | $i_gst = 0; |
| 570 | 574 | $ut_gst = 0; |
| 571 | 575 | $state_code = ''; |
| 572 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 576 | + if ($user_state != '') { |
|
| 577 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 573 | 578 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 574 | 579 | $taxes = $tax['taxes']; |
| 575 | 580 | $value = $tax['value']; |
| 576 | - } else {//If user from other Country |
|
| 581 | + } else { |
|
| 582 | +//If user from other Country |
|
| 577 | 583 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 578 | 584 | $taxes = $tax['taxes']; |
| 579 | 585 | $value = $tax['value']; |