@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | $i_gst = $user_state->i_gst; |
| 22 | 22 | $ut_gst = $user_state->ut_gst; |
| 23 | 23 | $state_code = $user_state->state_code; |
| 24 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 24 | + if ($state_code == $origin_state) { |
|
| 25 | +//If user and origin state are same |
|
| 25 | 26 | $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
| 26 | 27 | if ($taxClassId) { |
| 27 | 28 | $taxes = $cartController->getTaxByPriority($taxClassId); |
@@ -29,7 +30,8 @@ discard block |
||
| 29 | 30 | } else { |
| 30 | 31 | $taxes = [0]; |
| 31 | 32 | } |
| 32 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 33 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 34 | +//If user is from other state |
|
| 33 | 35 | |
| 34 | 36 | $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id of state |
| 35 | 37 | if ($taxClassId) { |
@@ -38,7 +40,8 @@ discard block |
||
| 38 | 40 | } else { |
| 39 | 41 | $taxes = [0]; |
| 40 | 42 | } |
| 41 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 43 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 44 | +//if user from Union Territory |
|
| 42 | 45 | $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id of state |
| 43 | 46 | if ($taxClassId) { |
| 44 | 47 | $taxes = $cartController->getTaxByPriority($taxClassId); |
@@ -60,14 +63,16 @@ discard block |
||
| 60 | 63 | $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 61 | 64 | $value = ''; |
| 62 | 65 | $rate = ''; |
| 63 | - if ($taxClassId) { //if state equals the user State |
|
| 66 | + if ($taxClassId) { |
|
| 67 | +//if state equals the user State |
|
| 64 | 68 | |
| 65 | 69 | $taxes = $cartController->getTaxByPriority($taxClassId); |
| 66 | 70 | |
| 67 | 71 | // $taxes = $this->cartController::getTaxByPriority($taxClassId); |
| 68 | 72 | $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
| 69 | 73 | $rate = $value; |
| 70 | - } else {//if Tax is selected for Any State Any Country |
|
| 74 | + } else { |
|
| 75 | +//if Tax is selected for Any State Any Country |
|
| 71 | 76 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
| 72 | 77 | if ($taxClassId) { |
| 73 | 78 | $taxes = $cartController->getTaxByPriority($taxClassId); |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | $ut_gst = $user_state->ut_gst; |
| 86 | 86 | $state_code = $user_state->state_code; |
| 87 | 87 | if ($state_code == $origin_state) {//If user and origin state are same |
| 88 | - $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 89 | - if ($taxClassId) { |
|
| 90 | - $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 91 | - $value = $cartController->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
|
| 92 | - } else { |
|
| 93 | - $taxes = [0]; |
|
| 94 | - } |
|
| 88 | + $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 89 | + if ($taxClassId) { |
|
| 90 | + $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 91 | + $value = $cartController->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
|
| 92 | + } else { |
|
| 93 | + $taxes = [0]; |
|
| 94 | + } |
|
| 95 | 95 | } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
| 96 | 96 | |
| 97 | 97 | $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id of state |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
| 105 | 105 | $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id of state |
| 106 | - if ($taxClassId) { |
|
| 107 | - $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 108 | - $value = $cartController->getValueForUnionTerritory($productid, $c_gst, $ut_gst, $taxClassId, $taxes); |
|
| 109 | - } else { |
|
| 110 | - $taxes = [0]; |
|
| 111 | - } |
|
| 106 | + if ($taxClassId) { |
|
| 107 | + $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 108 | + $value = $cartController->getValueForUnionTerritory($productid, $c_gst, $ut_gst, $taxClassId, $taxes); |
|
| 109 | + } else { |
|
| 110 | + $taxes = [0]; |
|
| 111 | + } |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | return ['taxes'=>$taxes, 'value'=>$value]; |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | public function getTaxWhenState($user_state, $productid, $origin_state) |
| 78 | 78 | { |
| 79 | 79 | $taxes = array(); |
| 80 | - $value= array(); |
|
| 80 | + $value = array(); |
|
| 81 | 81 | $cartController = new CartController(); |
| 82 | 82 | $c_gst = $user_state->c_gst; |
| 83 | 83 | $s_gst = $user_state->s_gst; |
@@ -253,17 +253,4 @@ |
||
| 253 | 253 | <!-- this row will not appear when printing --> |
| 254 | 254 | <div class="row no-print"> |
| 255 | 255 | <div class="col-xs-12"> |
| 256 | - <a href="{{url('pdf?invoiceid='.$invoice->id)}}"><button class="btn btn-primary pull-right" style="margin-right: 5px;"><i class="fa fa-download"></i> Generate PDF</button></a> |
|
| 257 | - </div> |
|
| 258 | - </div> |
|
| 259 | - </section><!-- /.content --> |
|
| 260 | - |
|
| 261 | - |
|
| 262 | - </div> |
|
| 263 | - </div> |
|
| 264 | - </div> |
|
| 265 | -</div> |
|
| 266 | - |
|
| 267 | - |
|
| 268 | - |
|
| 269 | -@stop |
|
| 270 | 256 | \ No newline at end of file |
| 257 | + <a href="{{url('pdf?invoiceid='.$invoice->id |
|
| 271 | 258 | \ No newline at end of file |
@@ -253,17 +253,4 @@ |
||
| 253 | 253 | <!-- this row will not appear when printing --> |
| 254 | 254 | <div class="row no-print"> |
| 255 | 255 | <div class="col-xs-12"> |
| 256 | - <a href="{{url('pdf?invoiceid='.$invoice->id)}}"><button class="btn btn-primary pull-right" style="margin-right: 5px;"><i class="fa fa-download"></i> Generate PDF</button></a> |
|
| 257 | - </div> |
|
| 258 | - </div> |
|
| 259 | - </section><!-- /.content --> |
|
| 260 | - |
|
| 261 | - |
|
| 262 | - </div> |
|
| 263 | - </div> |
|
| 264 | - </div> |
|
| 265 | -</div> |
|
| 266 | - |
|
| 267 | - |
|
| 268 | - |
|
| 269 | -@stop |
|
| 270 | 256 | \ No newline at end of file |
| 257 | + <a href="{{url('pdf?invoiceid='.$invoice->id |
|
| 271 | 258 | \ No newline at end of file |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | <div class="col-md-12"> |
| 44 | 44 | |
| 45 | 45 | <?php $set = App\Model\Common\Setting::where('id', '1')->first(); ?> |
| 46 | - <?php $gst = App\Model\Payment\TaxOption::where('id', '1')->first(); ?> |
|
| 46 | + <?php $gst = App\Model\Payment\TaxOption::where('id', '1')->first(); ?> |
|
| 47 | 47 | |
| 48 | 48 | <!-- Main content --> |
| 49 | 49 | <section class="invoice"> |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | </ul> |
| 141 | 141 | </td> |
| 142 | 142 | <?php |
| 143 | - $data=($item->discount)?$item->discount:'No discounts'; |
|
| 143 | + $data = ($item->discount) ? $item->discount : 'No discounts'; |
|
| 144 | 144 | ?> |
| 145 | 145 | <td> |
| 146 | 146 | {{$data}} |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $tax_name = explode(',', $name); |
| 176 | 176 | $tax_percentage = explode(',', $rate); |
| 177 | 177 | } |
| 178 | -<<<<<<< HEAD |
|
| 178 | +<< << <<< HEAD |
|
| 179 | 179 | ?> |
| 180 | 180 | @for($i=0;$i < count($tax_name);$i++) |
| 181 | 181 | ======= |
@@ -253,17 +253,4 @@ discard block |
||
| 253 | 253 | <!-- this row will not appear when printing --> |
| 254 | 254 | <div class="row no-print"> |
| 255 | 255 | <div class="col-xs-12"> |
| 256 | - <a href="{{url('pdf?invoiceid='.$invoice->id)}}"><button class="btn btn-primary pull-right" style="margin-right: 5px;"><i class="fa fa-download"></i> Generate PDF</button></a> |
|
| 257 | - </div> |
|
| 258 | - </div> |
|
| 259 | - </section><!-- /.content --> |
|
| 260 | - |
|
| 261 | - |
|
| 262 | - </div> |
|
| 263 | - </div> |
|
| 264 | - </div> |
|
| 265 | -</div> |
|
| 266 | - |
|
| 267 | - |
|
| 268 | - |
|
| 269 | -@stop |
|
| 270 | 256 | \ No newline at end of file |
| 257 | + <a href="{{url('pdf?invoiceid='.$invoice->id |
|
| 271 | 258 | \ No newline at end of file |
@@ -253,17 +253,4 @@ |
||
| 253 | 253 | <!-- this row will not appear when printing --> |
| 254 | 254 | <div class="row no-print"> |
| 255 | 255 | <div class="col-xs-12"> |
| 256 | - <a href="{{url('pdf?invoiceid='.$invoice->id)}}"><button class="btn btn-primary pull-right" style="margin-right: 5px;"><i class="fa fa-download"></i> Generate PDF</button></a> |
|
| 257 | - </div> |
|
| 258 | - </div> |
|
| 259 | - </section><!-- /.content --> |
|
| 260 | - |
|
| 261 | - |
|
| 262 | - </div> |
|
| 263 | - </div> |
|
| 264 | - </div> |
|
| 265 | -</div> |
|
| 266 | - |
|
| 267 | - |
|
| 268 | - |
|
| 269 | -@stop |
|
| 270 | 256 | \ No newline at end of file |
| 257 | + <a href="{{url('pdf?invoiceid='.$invoice->id |
|
| 271 | 258 | \ No newline at end of file |
@@ -253,17 +253,4 @@ |
||
| 253 | 253 | <!-- this row will not appear when printing --> |
| 254 | 254 | <div class="row no-print"> |
| 255 | 255 | <div class="col-xs-12"> |
| 256 | - <a href="{{url('pdf?invoiceid='.$invoice->id)}}"><button class="btn btn-primary pull-right" style="margin-right: 5px;"><i class="fa fa-download"></i> Generate PDF</button></a> |
|
| 257 | - </div> |
|
| 258 | - </div> |
|
| 259 | - </section><!-- /.content --> |
|
| 260 | - |
|
| 261 | - |
|
| 262 | - </div> |
|
| 263 | - </div> |
|
| 264 | - </div> |
|
| 265 | -</div> |
|
| 266 | - |
|
| 267 | - |
|
| 268 | - |
|
| 269 | -@stop |
|
| 270 | 256 | \ No newline at end of file |
| 257 | + <a href="{{url('pdf?invoiceid='.$invoice->id |
|
| 271 | 258 | \ No newline at end of file |
@@ -213,8 +213,8 @@ |
||
| 213 | 213 | $geoip_state = ''; |
| 214 | 214 | $geoip_state_array = \App\Http\Controllers\Front\CartController::getStateByCode($state_code); |
| 215 | 215 | if (\Auth::user()->role =='admin') { |
| 216 | - $geoip_state = $user_state; |
|
| 217 | - }else{ |
|
| 216 | + $geoip_state = $user_state; |
|
| 217 | + }else{ |
|
| 218 | 218 | $geoip_state = \Auth::user()->state; |
| 219 | 219 | } |
| 220 | 220 | if ($geoip_state == '') { |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - public function getGeoipCountry($country_iso,$user_country='') |
|
| 195 | + public function getGeoipCountry($country_iso, $user_country = '') |
|
| 196 | 196 | { |
| 197 | 197 | $geoip_country = ''; |
| 198 | - if (\Auth::user()->role='admin') { |
|
| 198 | + if (\Auth::user()->role = 'admin') { |
|
| 199 | 199 | $geoip_country = $user_country; |
| 200 | - }else{ |
|
| 200 | + } else { |
|
| 201 | 201 | $geoip_country = \Auth::user()->country; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | return $geoip_country; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - public function getGeoipState($state_code,$user_state='') |
|
| 211 | + public function getGeoipState($state_code, $user_state = '') |
|
| 212 | 212 | { |
| 213 | 213 | $geoip_state = ''; |
| 214 | 214 | $geoip_state_array = \App\Http\Controllers\Front\CartController::getStateByCode($state_code); |
| 215 | - if (\Auth::user()->role =='admin') { |
|
| 215 | + if (\Auth::user()->role == 'admin') { |
|
| 216 | 216 | $geoip_state = $user_state; |
| 217 | - }else{ |
|
| 217 | + } else { |
|
| 218 | 218 | $geoip_state = \Auth::user()->state; |
| 219 | 219 | } |
| 220 | 220 | if ($geoip_state == '') { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $geoip_country = ''; |
| 198 | 198 | if (\Auth::user()->role='admin') { |
| 199 | 199 | $geoip_country = $user_country; |
| 200 | - }else{ |
|
| 200 | + } else { |
|
| 201 | 201 | $geoip_country = \Auth::user()->country; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | public function getGeoipState($state_code,$user_state='') |
| 212 | - { |
|
| 212 | + { |
|
| 213 | 213 | $geoip_state = ''; |
| 214 | 214 | $geoip_state_array = \App\Http\Controllers\Front\CartController::getStateByCode($state_code); |
| 215 | 215 | if (\Auth::user()->role =='admin') { |
| 216 | 216 | $geoip_state = $user_state; |
| 217 | - }else{ |
|
| 217 | + } else { |
|
| 218 | 218 | $geoip_state = \Auth::user()->state; |
| 219 | 219 | } |
| 220 | 220 | if ($geoip_state == '') { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - public function checkTax($productid,$user_state='',$user_country='') |
|
| 187 | + public function checkTax($productid, $user_state = '', $user_country = '') |
|
| 188 | 188 | { |
| 189 | 189 | try { |
| 190 | 190 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | $mobile_code = \App\Http\Controllers\Front\CartController::getMobileCodeByIso($location['countryCode']); |
| 220 | 220 | $country_iso = $location['countryCode']; |
| 221 | 221 | |
| 222 | - $geoip_country = $this->getGeoipCountry($country_iso,$user_country); |
|
| 223 | - $geoip_state = $this->getGeoipState($state_code,$user_state); |
|
| 222 | + $geoip_country = $this->getGeoipCountry($country_iso, $user_country); |
|
| 223 | + $geoip_state = $this->getGeoipState($state_code, $user_state); |
|
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
@@ -106,27 +106,27 @@ discard block |
||
| 106 | 106 | public function getTaxTable() |
| 107 | 107 | { |
| 108 | 108 | return \DataTables::of(TaxByState::select('id', 'state', 'c_gst', 's_gst', 'i_gst', 'ut_gst')->get()) |
| 109 | - ->addColumn('id', function ($model) { |
|
| 110 | - return $model->id; |
|
| 111 | - }) |
|
| 112 | - |
|
| 113 | - ->addColumn('state', function ($model) { |
|
| 114 | - return ucfirst($model->state); |
|
| 115 | - }) |
|
| 116 | - ->addColumn('c_gst', function ($model) { |
|
| 117 | - return ucfirst($model->c_gst); |
|
| 118 | - }) |
|
| 119 | - ->addColumn('s_gst', function ($model) { |
|
| 120 | - return ucfirst($model->s_gst); |
|
| 121 | - }) |
|
| 122 | - ->addColumn('i_gst', function ($model) { |
|
| 123 | - return ucfirst($model->i_gst); |
|
| 124 | - }) |
|
| 125 | - ->addColumn('ut_gst', function ($model) { |
|
| 126 | - return ucfirst($model->ut_gst); |
|
| 127 | - }) |
|
| 128 | - ->rawColumns(['id', 'state', 'c_gst', 's_gst', 'i_gst', 'ut_gst']) |
|
| 129 | - ->make(true); |
|
| 109 | + ->addColumn('id', function ($model) { |
|
| 110 | + return $model->id; |
|
| 111 | + }) |
|
| 112 | + |
|
| 113 | + ->addColumn('state', function ($model) { |
|
| 114 | + return ucfirst($model->state); |
|
| 115 | + }) |
|
| 116 | + ->addColumn('c_gst', function ($model) { |
|
| 117 | + return ucfirst($model->c_gst); |
|
| 118 | + }) |
|
| 119 | + ->addColumn('s_gst', function ($model) { |
|
| 120 | + return ucfirst($model->s_gst); |
|
| 121 | + }) |
|
| 122 | + ->addColumn('i_gst', function ($model) { |
|
| 123 | + return ucfirst($model->i_gst); |
|
| 124 | + }) |
|
| 125 | + ->addColumn('ut_gst', function ($model) { |
|
| 126 | + return ucfirst($model->ut_gst); |
|
| 127 | + }) |
|
| 128 | + ->rawColumns(['id', 'state', 'c_gst', 's_gst', 'i_gst', 'ut_gst']) |
|
| 129 | + ->make(true); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | |
| 186 | - return view('themes.default1.payment.tax.edit', |
|
| 186 | + return view('themes.default1.payment.tax.edit', |
|
| 187 | 187 | compact('tax', 'classes', 'txClass', 'states', 'state', |
| 188 | 188 | |
| 189 | 189 | 'defaultValue')); |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function options(Request $request) |
| 343 | 343 | { |
| 344 | - if($request->input('name') == 'Others'){ |
|
| 344 | + if($request->input('name') == 'Others'){ |
|
| 345 | 345 | // if($request->) |
| 346 | 346 | $this->validate($request, [ |
| 347 | 347 | 'rate' => 'required', |
@@ -70,33 +70,33 @@ discard block |
||
| 70 | 70 | public function getTax() |
| 71 | 71 | { |
| 72 | 72 | return \DataTables::of($this->tax->select('id', 'tax_classes_id', 'name', 'country', 'state', 'rate')->get()) |
| 73 | - ->addColumn('checkbox', function ($model) { |
|
| 73 | + ->addColumn('checkbox', function($model) { |
|
| 74 | 74 | return "<input type='checkbox' class='tax_checkbox' value=".$model->id.' name=select[] id=check>'; |
| 75 | 75 | }) |
| 76 | - ->addColumn('tax_classes_id', function ($model) { |
|
| 76 | + ->addColumn('tax_classes_id', function($model) { |
|
| 77 | 77 | return ucfirst($this->tax_class->where('id', $model->tax_classes_id)->first()->name); |
| 78 | 78 | }) |
| 79 | - ->addColumn('name', function ($model) { |
|
| 79 | + ->addColumn('name', function($model) { |
|
| 80 | 80 | return ucfirst($model->name); |
| 81 | 81 | }) |
| 82 | 82 | |
| 83 | 83 | // ->showColumns('name', 'level') |
| 84 | - ->addColumn('country', function ($model) { |
|
| 84 | + ->addColumn('country', function($model) { |
|
| 85 | 85 | if ($this->country->where('country_code_char2', $model->country)->first()) { |
| 86 | 86 | return ucfirst($this->country->where('country_code_char2', $model->country)->first()->country_name); |
| 87 | 87 | } |
| 88 | 88 | }) |
| 89 | - ->addColumn('state', function ($model) { |
|
| 89 | + ->addColumn('state', function($model) { |
|
| 90 | 90 | if ($this->state->where('state_subdivision_code', $model->state)->first()) { |
| 91 | 91 | return $this->state->where('state_subdivision_code', $model->state)->first()->state_subdivision_name; |
| 92 | 92 | } |
| 93 | 93 | }) |
| 94 | - ->addColumn('rate', function ($model) { |
|
| 94 | + ->addColumn('rate', function($model) { |
|
| 95 | 95 | return $model->rate; |
| 96 | 96 | }) |
| 97 | 97 | |
| 98 | 98 | // ->showColumns('rate') |
| 99 | - ->addColumn('action', function ($model) { |
|
| 99 | + ->addColumn('action', function($model) { |
|
| 100 | 100 | return '<a href='.url('tax/'.$model->id.'/edit')." class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' style='color:white;'> </i> Edit</a>"; |
| 101 | 101 | }) |
| 102 | 102 | ->rawColumns(['checkbox', 'tax_classes_id', 'name', 'country', 'state', 'rate', 'action']) |
@@ -106,26 +106,26 @@ discard block |
||
| 106 | 106 | public function getTaxTable() |
| 107 | 107 | { |
| 108 | 108 | return \DataTables::of(TaxByState::select('id', 'state', 'c_gst', 's_gst', 'i_gst', 'ut_gst')->get()) |
| 109 | - ->addColumn('id', function ($model) { |
|
| 109 | + ->addColumn('id', function($model) { |
|
| 110 | 110 | return $model->id; |
| 111 | 111 | }) |
| 112 | 112 | |
| 113 | - ->addColumn('state', function ($model) { |
|
| 113 | + ->addColumn('state', function($model) { |
|
| 114 | 114 | return ucfirst($model->state); |
| 115 | 115 | }) |
| 116 | - ->addColumn('c_gst', function ($model) { |
|
| 116 | + ->addColumn('c_gst', function($model) { |
|
| 117 | 117 | return ucfirst($model->c_gst); |
| 118 | 118 | }) |
| 119 | - ->addColumn('s_gst', function ($model) { |
|
| 119 | + ->addColumn('s_gst', function($model) { |
|
| 120 | 120 | return ucfirst($model->s_gst); |
| 121 | 121 | }) |
| 122 | - ->addColumn('i_gst', function ($model) { |
|
| 122 | + ->addColumn('i_gst', function($model) { |
|
| 123 | 123 | return ucfirst($model->i_gst); |
| 124 | 124 | }) |
| 125 | - ->addColumn('ut_gst', function ($model) { |
|
| 125 | + ->addColumn('ut_gst', function($model) { |
|
| 126 | 126 | return ucfirst($model->ut_gst); |
| 127 | 127 | }) |
| 128 | - ->rawColumns(['id', 'state', 'c_gst', 's_gst', 'i_gst', 'ut_gst']) |
|
| 128 | + ->rawColumns(['id', 'state', 'c_gst', 's_gst', 'i_gst', 'ut_gst']) |
|
| 129 | 129 | ->make(true); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | public function options(Request $request) |
| 343 | 343 | { |
| 344 | - if($request->input('name') == 'Others'){ |
|
| 344 | + if ($request->input('name') == 'Others') { |
|
| 345 | 345 | // if($request->) |
| 346 | 346 | $this->validate($request, [ |
| 347 | 347 | 'rate' => 'required', |
@@ -341,7 +341,7 @@ |
||
| 341 | 341 | */ |
| 342 | 342 | public function options(Request $request) |
| 343 | 343 | { |
| 344 | - if($request->input('name') == 'Others'){ |
|
| 344 | + if($request->input('name') == 'Others') { |
|
| 345 | 345 | // if($request->) |
| 346 | 346 | $this->validate($request, [ |
| 347 | 347 | 'rate' => 'required', |
@@ -120,21 +120,21 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 122 | 122 | }) |
| 123 | - ->addColumn('number', function ($model) { |
|
| 124 | - return ucfirst($model->number); |
|
| 125 | - }) |
|
| 123 | + ->addColumn('number', function ($model) { |
|
| 124 | + return ucfirst($model->number); |
|
| 125 | + }) |
|
| 126 | 126 | |
| 127 | 127 | ->addColumn('date', function ($model) { |
| 128 | 128 | $date = $model->created_at; |
| 129 | 129 | |
| 130 | 130 | return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 131 | 131 | }) |
| 132 | - ->addColumn('grand_total', function ($model) { |
|
| 133 | - return ucfirst($model->number); |
|
| 134 | - }) |
|
| 135 | - ->addColumn('status', function ($model) { |
|
| 136 | - return ucfirst($model->status); |
|
| 137 | - }) |
|
| 132 | + ->addColumn('grand_total', function ($model) { |
|
| 133 | + return ucfirst($model->number); |
|
| 134 | + }) |
|
| 135 | + ->addColumn('status', function ($model) { |
|
| 136 | + return ucfirst($model->status); |
|
| 137 | + }) |
|
| 138 | 138 | |
| 139 | 139 | ->addColumn('action', function ($model) { |
| 140 | 140 | $action = ''; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ." $action"; |
| 149 | 149 | }) |
| 150 | 150 | |
| 151 | - ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 151 | + ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 152 | 152 | ->make(true); |
| 153 | 153 | |
| 154 | 154 | // ->searchColumns('date', 'user_id', 'number', 'grand_total', 'status') |
@@ -667,36 +667,36 @@ discard block |
||
| 667 | 667 | // dd($rate); |
| 668 | 668 | $taxs = ([$rate['taxs']['0']['name'], $rate['taxs']['0']['rate']]); |
| 669 | 669 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
| 670 | - $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled |
|
| 671 | - if ($taxClassId) { |
|
| 672 | - $taxs = $cartController->getTaxByPriority($taxClassId); |
|
| 673 | - $value = $cartController->getValueForOthers($productid, $taxClassId, $taxs); |
|
| 674 | - if ($value == 0) { |
|
| 675 | - $status = 0; |
|
| 676 | - } |
|
| 677 | - $rate = $value; |
|
| 678 | - } elseif ($geoip_country != 'IN') {//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there) |
|
| 679 | - |
|
| 680 | - $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
|
| 681 | - |
|
| 682 | - // $taxClassId =Tax::where('country','!=','IN')->where(function($q) use($geoip_state,$geoip_country){ |
|
| 683 | - // $q->where('state', $geoip_state)->orWhere('country', $geoip_country); |
|
| 684 | - // })->pluck('tax_classes_id')->first(); |
|
| 685 | - |
|
| 686 | - // dd($taxClassId); |
|
| 687 | - if ($taxClassId) { //if state equals the user State |
|
| 688 | - $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 689 | - $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 690 | - if ($value == '') { |
|
| 691 | - $status = 0; |
|
| 692 | - } |
|
| 693 | - $rate = $value; |
|
| 694 | - } |
|
| 695 | - $taxs = ([$taxes[0]['name'], $taxes[0]['rate']]); |
|
| 696 | - // dd($taxs); |
|
| 697 | - // $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 670 | + $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled |
|
| 671 | + if ($taxClassId) { |
|
| 672 | + $taxs = $cartController->getTaxByPriority($taxClassId); |
|
| 673 | + $value = $cartController->getValueForOthers($productid, $taxClassId, $taxs); |
|
| 674 | + if ($value == 0) { |
|
| 675 | + $status = 0; |
|
| 676 | + } |
|
| 677 | + $rate = $value; |
|
| 678 | + } elseif ($geoip_country != 'IN') {//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there) |
|
| 679 | + |
|
| 680 | + $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
|
| 681 | + |
|
| 682 | + // $taxClassId =Tax::where('country','!=','IN')->where(function($q) use($geoip_state,$geoip_country){ |
|
| 683 | + // $q->where('state', $geoip_state)->orWhere('country', $geoip_country); |
|
| 684 | + // })->pluck('tax_classes_id')->first(); |
|
| 685 | + |
|
| 686 | + // dd($taxClassId); |
|
| 687 | + if ($taxClassId) { //if state equals the user State |
|
| 688 | + $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 689 | + $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 690 | + if ($value == '') { |
|
| 691 | + $status = 0; |
|
| 692 | + } |
|
| 693 | + $rate = $value; |
|
| 694 | + } |
|
| 695 | + $taxs = ([$taxes[0]['name'], $taxes[0]['rate']]); |
|
| 696 | + // dd($taxs); |
|
| 697 | + // $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 698 | 698 | // $tax_value = '0%'; |
| 699 | - } |
|
| 699 | + } |
|
| 700 | 700 | $taxs = ([$taxs[0]['name'], $taxs[0]['rate']]); |
| 701 | 701 | } else { |
| 702 | 702 | $taxs = ([$taxs[0]['name'], $taxs[0]['rate']]); |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 737 | 737 | $taxes = $tax['taxes']; |
| 738 | 738 | $value = $tax['value']; |
| 739 | - } else {//If user from other Country |
|
| 739 | + } else {//If user from other Country |
|
| 740 | 740 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 741 | 741 | $taxes = $tax['taxes']; |
| 742 | 742 | $value = $tax['value']; |
@@ -666,7 +666,8 @@ discard block |
||
| 666 | 666 | $rate = $this->getRate($productid, $taxs[0], $userid); |
| 667 | 667 | // dd($rate); |
| 668 | 668 | $taxs = ([$rate['taxs']['0']['name'], $rate['taxs']['0']['rate']]); |
| 669 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 669 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 670 | +//if tax_enable is 0 |
|
| 670 | 671 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled |
| 671 | 672 | if ($taxClassId) { |
| 672 | 673 | $taxs = $cartController->getTaxByPriority($taxClassId); |
@@ -675,7 +676,8 @@ discard block |
||
| 675 | 676 | $status = 0; |
| 676 | 677 | } |
| 677 | 678 | $rate = $value; |
| 678 | - } elseif ($geoip_country != 'IN') {//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there) |
|
| 679 | + } elseif ($geoip_country != 'IN') { |
|
| 680 | +//In case of other country when tax is available and tax is not enabled(Applicable when Global Tax class for any country and state is not there) |
|
| 679 | 681 | |
| 680 | 682 | $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 681 | 683 | |
@@ -684,7 +686,8 @@ discard block |
||
| 684 | 686 | // })->pluck('tax_classes_id')->first(); |
| 685 | 687 | |
| 686 | 688 | // dd($taxClassId); |
| 687 | - if ($taxClassId) { //if state equals the user State |
|
| 689 | + if ($taxClassId) { |
|
| 690 | +//if state equals the user State |
|
| 688 | 691 | $taxes = $cartController->getTaxByPriority($taxClassId); |
| 689 | 692 | $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
| 690 | 693 | if ($value == '') { |
@@ -731,12 +734,14 @@ discard block |
||
| 731 | 734 | $i_gst = 0; |
| 732 | 735 | $ut_gst = 0; |
| 733 | 736 | $state_code = ''; |
| 734 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 737 | + if ($user_state != '') { |
|
| 738 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 735 | 739 | |
| 736 | 740 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 737 | 741 | $taxes = $tax['taxes']; |
| 738 | 742 | $value = $tax['value']; |
| 739 | - } else {//If user from other Country |
|
| 743 | + } else { |
|
| 744 | +//If user from other Country |
|
| 740 | 745 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 741 | 746 | $taxes = $tax['taxes']; |
| 742 | 747 | $value = $tax['value']; |