@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | return\ DataTables::of($new_product) |
| 109 | 109 | // return \Datatable::collection($this->product->select('id', 'name', 'type', 'group')->where('id', '!=', 1)->get()) |
| 110 | - ->addColumn('checkbox', function ($model) { |
|
| 110 | + ->addColumn('checkbox', function($model) { |
|
| 111 | 111 | return "<input type='checkbox' class='product_checkbox' value=".$model->id.' name=select[] id=check>'; |
| 112 | 112 | }) |
| 113 | - ->addColumn('name', function ($model) { |
|
| 113 | + ->addColumn('name', function($model) { |
|
| 114 | 114 | return ucfirst($model->name); |
| 115 | 115 | }) |
| 116 | - ->addColumn('type', function ($model) { |
|
| 116 | + ->addColumn('type', function($model) { |
|
| 117 | 117 | //dd($model->type()); |
| 118 | 118 | if ($this->type->where('id', $model->type)->first()) { |
| 119 | 119 | return $this->type->where('id', $model->type)->first()->name; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return 'Not available'; |
| 122 | 122 | } |
| 123 | 123 | }) |
| 124 | - ->addColumn('group', function ($model) { |
|
| 124 | + ->addColumn('group', function($model) { |
|
| 125 | 125 | //dd($model->type()); |
| 126 | 126 | if ($this->group->where('id', $model->group)->first()) { |
| 127 | 127 | return $this->group->where('id', $model->group)->first()->name; |
@@ -129,21 +129,21 @@ discard block |
||
| 129 | 129 | return 'Not available'; |
| 130 | 130 | } |
| 131 | 131 | }) |
| 132 | - ->addColumn('price', function ($model) { |
|
| 132 | + ->addColumn('price', function($model) { |
|
| 133 | 133 | if ($this->price->where('product_id', $model->id)->first()) { |
| 134 | 134 | return $this->price->where('product_id', $model->id)->first()->price; |
| 135 | 135 | } else { |
| 136 | 136 | return 'Not available'; |
| 137 | 137 | } |
| 138 | 138 | }) |
| 139 | - ->addColumn('currency', function ($model) { |
|
| 139 | + ->addColumn('currency', function($model) { |
|
| 140 | 140 | if ($this->price->where('product_id', $model->id)->first()) { |
| 141 | 141 | return $this->price->where('product_id', $model->id)->first()->currency; |
| 142 | 142 | } else { |
| 143 | 143 | return 'Not available'; |
| 144 | 144 | } |
| 145 | 145 | }) |
| 146 | - ->addColumn('Action', function ($model) { |
|
| 146 | + ->addColumn('Action', function($model) { |
|
| 147 | 147 | $url = ''; |
| 148 | 148 | if ($model->type == 2) { |
| 149 | 149 | $url = '<a href='.url('product/download/'.$model->id)." class='btn btn-sm btn-primary btn-xs'><i class='fa fa-download' style='color:white;'> </i> Download</a>"; |
@@ -166,28 +166,28 @@ discard block |
||
| 166 | 166 | $new_upload = ProductUpload::where('product_id', '=', $id)->select('id', 'product_id', 'title', 'description', 'version', 'file')->get(); |
| 167 | 167 | |
| 168 | 168 | return \DataTables::of($new_upload) |
| 169 | - ->addColumn('checkbox', function ($model) { |
|
| 169 | + ->addColumn('checkbox', function($model) { |
|
| 170 | 170 | return "<input type='checkbox' class='upload_checkbox' value=".$model->id.' name=select[] id=checks>'; |
| 171 | 171 | }) |
| 172 | 172 | |
| 173 | - ->addColumn('product_id', function ($model) { |
|
| 173 | + ->addColumn('product_id', function($model) { |
|
| 174 | 174 | return ucfirst($this->product->where('id', $model->product_id)->first()->name); |
| 175 | 175 | }) |
| 176 | 176 | |
| 177 | - ->addColumn('title', function ($model) { |
|
| 177 | + ->addColumn('title', function($model) { |
|
| 178 | 178 | return ucfirst($model->title); |
| 179 | 179 | }) |
| 180 | - ->addColumn('description', function ($model) { |
|
| 180 | + ->addColumn('description', function($model) { |
|
| 181 | 181 | return ucfirst($model->description); |
| 182 | 182 | }) |
| 183 | - ->addColumn('version', function ($model) { |
|
| 183 | + ->addColumn('version', function($model) { |
|
| 184 | 184 | return $model->version; |
| 185 | 185 | }) |
| 186 | 186 | |
| 187 | - ->addColumn('file', function ($model) { |
|
| 187 | + ->addColumn('file', function($model) { |
|
| 188 | 188 | return $model->file; |
| 189 | 189 | }) |
| 190 | - ->addColumn('action', function ($model) { |
|
| 190 | + ->addColumn('action', function($model) { |
|
| 191 | 191 | return '<a href='.('#edit-upload-option/'.$model->id).' class=" btn btn-sm btn-primary " data-title="'.$model->title.'" data-description="'.$model->description.'" data-version="'.$model->version.'" data-id="'.$model->id.'" onclick="openEditPopup(this)" >Edit</a>'; |
| 192 | 192 | }) |
| 193 | 193 | ->rawcolumns(['checkbox', 'product_id', 'title', 'description', 'version', 'file', 'action']) |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $newTax->product_id = $product_id; |
| 450 | 450 | $newTax->tax_class_id = $tax; |
| 451 | 451 | $newTax->save(); |
| 452 | - return ; |
|
| 452 | + return; |
|
| 453 | 453 | |
| 454 | 454 | } |
| 455 | 455 | } |
@@ -189,131 +189,131 @@ discard block |
||
| 189 | 189 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 190 | 190 | |
| 191 | 191 | if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
| 192 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 193 | - |
|
| 194 | - $state_code = ''; |
|
| 195 | - $c_gst = ''; |
|
| 196 | - $s_gst = ''; |
|
| 197 | - $i_gst = ''; |
|
| 198 | - $ut_gst = ''; |
|
| 199 | - $value = ''; |
|
| 200 | - $rate = ''; |
|
| 201 | - $status = 1; |
|
| 202 | - |
|
| 203 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 192 | + if ($tax_enable == 1) {//If GST is Enabled |
|
| 193 | + |
|
| 194 | + $state_code = ''; |
|
| 195 | + $c_gst = ''; |
|
| 196 | + $s_gst = ''; |
|
| 197 | + $i_gst = ''; |
|
| 198 | + $ut_gst = ''; |
|
| 199 | + $value = ''; |
|
| 200 | + $rate = ''; |
|
| 201 | + $status = 1; |
|
| 202 | + |
|
| 203 | + if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 204 | 204 | $c_gst = $user_state->c_gst; |
| 205 | - $s_gst = $user_state->s_gst; |
|
| 206 | - $i_gst = $user_state->i_gst; |
|
| 207 | - $ut_gst = $user_state->ut_gst; |
|
| 208 | - $state_code = $user_state->state_code; |
|
| 209 | - |
|
| 210 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 211 | - $rateForSameState = $this->getTaxWhenIndianSameState($user_state,$origin_state,$productid,$c_gst,$s_gst,$state_code,$status); |
|
| 212 | - |
|
| 213 | - $taxes = $rateForSameState['taxes']; |
|
| 214 | - $status = $rateForSameState['status']; |
|
| 215 | - $value = $rateForSameState['value']; |
|
| 216 | - } |
|
| 205 | + $s_gst = $user_state->s_gst; |
|
| 206 | + $i_gst = $user_state->i_gst; |
|
| 207 | + $ut_gst = $user_state->ut_gst; |
|
| 208 | + $state_code = $user_state->state_code; |
|
| 209 | + |
|
| 210 | + if ($state_code == $origin_state) {//If user and origin state are same |
|
| 211 | + $rateForSameState = $this->getTaxWhenIndianSameState($user_state,$origin_state,$productid,$c_gst,$s_gst,$state_code,$status); |
|
| 212 | + |
|
| 213 | + $taxes = $rateForSameState['taxes']; |
|
| 214 | + $status = $rateForSameState['status']; |
|
| 215 | + $value = $rateForSameState['value']; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
| 219 | - $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state,$origin_state,$productid,$i_gst,$state_code,$status); |
|
| 220 | - $taxes = $rateForOtherState['taxes']; |
|
| 221 | - $status = $rateForOtherState['status']; |
|
| 222 | - $value = $rateForOtherState['value']; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 226 | - $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state,$origin_state,$productid,$c_gst, $ut_gst,$state_code,$status); |
|
| 227 | - $taxes = $rateForUnionTerritory['taxes']; |
|
| 228 | - $status = $rateForUnionTerritory['status']; |
|
| 229 | - $value = $rateForUnionTerritory['value']; |
|
| 219 | + $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state,$origin_state,$productid,$i_gst,$state_code,$status); |
|
| 220 | + $taxes = $rateForOtherState['taxes']; |
|
| 221 | + $status = $rateForOtherState['status']; |
|
| 222 | + $value = $rateForOtherState['value']; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 226 | + $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state,$origin_state,$productid,$c_gst, $ut_gst,$state_code,$status); |
|
| 227 | + $taxes = $rateForUnionTerritory['taxes']; |
|
| 228 | + $status = $rateForUnionTerritory['status']; |
|
| 229 | + $value = $rateForUnionTerritory['value']; |
|
| 230 | 230 | |
| 231 | - } |
|
| 232 | - } else {//If user from other Country |
|
| 233 | - $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
|
| 234 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 231 | + } |
|
| 232 | + } else {//If user from other Country |
|
| 233 | + $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
|
| 234 | + if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 235 | 235 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId,$productid,$status); |
| 236 | 236 | $taxes = $taxForSpecificCountry['taxes'] ; $status= $taxForSpecificCountry['status']; |
| 237 | 237 | $value = $taxForSpecificCountry['value'] ; $rate= $taxForSpecificCountry['value']; |
| 238 | - } else {//if Tax is selected for Any Country Any State |
|
| 239 | - $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
|
| 240 | - if ($taxClassId) { |
|
| 241 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
|
| 242 | - $taxes = $taxForAnyCountry['taxes'] ; $status= $taxForAnyCountry['status']; |
|
| 243 | - $value = $taxForAnyCountry['value'] ; $rate= $taxForAnyCountry['value']; |
|
| 244 | - } else { |
|
| 245 | - $taxes = [0]; |
|
| 246 | - |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - } |
|
| 250 | - foreach ($taxes as $key => $tax) { |
|
| 238 | + } else {//if Tax is selected for Any Country Any State |
|
| 239 | + $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
|
| 240 | + if ($taxClassId) { |
|
| 241 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
|
| 242 | + $taxes = $taxForAnyCountry['taxes'] ; $status= $taxForAnyCountry['status']; |
|
| 243 | + $value = $taxForAnyCountry['value'] ; $rate= $taxForAnyCountry['value']; |
|
| 244 | + } else { |
|
| 245 | + $taxes = [0]; |
|
| 246 | + |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | + foreach ($taxes as $key => $tax) { |
|
| 251 | 251 | |
| 252 | 252 | //All the da a attribute that is sent to the checkout Page if tax_compound=0 |
| 253 | - if ($taxes[0]) { |
|
| 254 | - $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, 's_gst'=>$s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, 'state'=>$state_code, 'origin_state'=>$origin_state, 'tax_enable'=>$tax_enable, 'rate'=>$value, 'status'=>$status]; |
|
| 253 | + if ($taxes[0]) { |
|
| 254 | + $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, 's_gst'=>$s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, 'state'=>$state_code, 'origin_state'=>$origin_state, 'tax_enable'=>$tax_enable, 'rate'=>$value, 'status'=>$status]; |
|
| 255 | 255 | |
| 256 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 256 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 257 | 257 | |
| 258 | 258 | 'name' => 'no compound', |
| 259 | 259 | 'type' => 'tax', |
| 260 | 260 | 'target' => 'item', |
| 261 | 261 | 'value' => $value, |
| 262 | - ]); |
|
| 263 | - } else { |
|
| 264 | - $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 265 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 266 | - 'name' => 'null', |
|
| 267 | - 'type' => 'tax', |
|
| 268 | - 'target' => 'item', |
|
| 269 | - 'value' => '0%', |
|
| 270 | - ]); |
|
| 271 | - } |
|
| 272 | - } |
|
| 273 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 274 | - $status = 1; |
|
| 275 | - if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 276 | - $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 |
|
| 277 | - if ($taxClassId) { |
|
| 278 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 279 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 280 | - if ($value == 0) { |
|
| 281 | - $status = 0; |
|
| 282 | - } |
|
| 283 | - $rate = $value; |
|
| 284 | - foreach ($taxes as $key => $tax) { |
|
| 285 | - $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 286 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 262 | + ]); |
|
| 263 | + } else { |
|
| 264 | + $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 265 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 266 | + 'name' => 'null', |
|
| 267 | + 'type' => 'tax', |
|
| 268 | + 'target' => 'item', |
|
| 269 | + 'value' => '0%', |
|
| 270 | + ]); |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | + } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 274 | + $status = 1; |
|
| 275 | + if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 276 | + $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 |
|
| 277 | + if ($taxClassId) { |
|
| 278 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 279 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 280 | + if ($value == 0) { |
|
| 281 | + $status = 0; |
|
| 282 | + } |
|
| 283 | + $rate = $value; |
|
| 284 | + foreach ($taxes as $key => $tax) { |
|
| 285 | + $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 286 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 287 | 287 | |
| 288 | 288 | 'name' => $tax->name, |
| 289 | 289 | 'type' => 'tax', |
| 290 | 290 | 'target' => 'item', |
| 291 | 291 | 'value' => $value, |
| 292 | 292 | ]); |
| 293 | - } |
|
| 294 | - } else {//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) |
|
| 295 | - $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
|
| 296 | - if ($taxClassId) { //if state equals the user State |
|
| 297 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 298 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 299 | - if ($value == '') { |
|
| 300 | - $status = 0; |
|
| 301 | - } |
|
| 302 | - $rate = $value; |
|
| 303 | - } |
|
| 304 | - foreach ($taxes as $key => $tax) { |
|
| 305 | - $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 306 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 293 | + } |
|
| 294 | + } else {//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) |
|
| 295 | + $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
|
| 296 | + if ($taxClassId) { //if state equals the user State |
|
| 297 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 298 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 299 | + if ($value == '') { |
|
| 300 | + $status = 0; |
|
| 301 | + } |
|
| 302 | + $rate = $value; |
|
| 303 | + } |
|
| 304 | + foreach ($taxes as $key => $tax) { |
|
| 305 | + $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 306 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 307 | 307 | |
| 308 | 308 | 'name' => $tax->name, |
| 309 | 309 | 'type' => 'tax', |
| 310 | 310 | 'target' => 'item', |
| 311 | 311 | 'value' => $value, |
| 312 | 312 | ]); |
| 313 | - } |
|
| 314 | - } |
|
| 315 | - } |
|
| 316 | - } |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | 317 | } else { |
| 318 | 318 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
| 319 | 319 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | return ['conditions' => $taxCondition, 'attributes' => ['tax' => $tax_attribute, 'currency' => $currency_attribute]]; |
| 331 | 331 | } catch (\Exception $ex) { |
| 332 | - Bugsnag::notifyException($ex); |
|
| 333 | - throw new \Exception('Can not check the tax'); |
|
| 332 | + Bugsnag::notifyException($ex); |
|
| 333 | + throw new \Exception('Can not check the tax'); |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $state_code = $user_state->state_code; |
| 209 | 209 | |
| 210 | 210 | if ($state_code == $origin_state) {//If user and origin state are same |
| 211 | - $rateForSameState = $this->getTaxWhenIndianSameState($user_state,$origin_state,$productid,$c_gst,$s_gst,$state_code,$status); |
|
| 211 | + $rateForSameState = $this->getTaxWhenIndianSameState($user_state, $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
|
| 212 | 212 | |
| 213 | 213 | $taxes = $rateForSameState['taxes']; |
| 214 | 214 | $status = $rateForSameState['status']; |
@@ -216,14 +216,14 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
| 219 | - $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state,$origin_state,$productid,$i_gst,$state_code,$status); |
|
| 219 | + $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, $origin_state, $productid, $i_gst, $state_code, $status); |
|
| 220 | 220 | $taxes = $rateForOtherState['taxes']; |
| 221 | 221 | $status = $rateForOtherState['status']; |
| 222 | 222 | $value = $rateForOtherState['value']; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
| 226 | - $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state,$origin_state,$productid,$c_gst, $ut_gst,$state_code,$status); |
|
| 226 | + $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
|
| 227 | 227 | $taxes = $rateForUnionTerritory['taxes']; |
| 228 | 228 | $status = $rateForUnionTerritory['status']; |
| 229 | 229 | $value = $rateForUnionTerritory['value']; |
@@ -232,15 +232,15 @@ discard block |
||
| 232 | 232 | } else {//If user from other Country |
| 233 | 233 | $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 234 | 234 | if ($taxClassId) { //if state equals the user State or country equals user country |
| 235 | - $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId,$productid,$status); |
|
| 236 | - $taxes = $taxForSpecificCountry['taxes'] ; $status= $taxForSpecificCountry['status']; |
|
| 237 | - $value = $taxForSpecificCountry['value'] ; $rate= $taxForSpecificCountry['value']; |
|
| 235 | + $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, $productid, $status); |
|
| 236 | + $taxes = $taxForSpecificCountry['taxes']; $status = $taxForSpecificCountry['status']; |
|
| 237 | + $value = $taxForSpecificCountry['value']; $rate = $taxForSpecificCountry['value']; |
|
| 238 | 238 | } else {//if Tax is selected for Any Country Any State |
| 239 | 239 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
| 240 | 240 | if ($taxClassId) { |
| 241 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
|
| 242 | - $taxes = $taxForAnyCountry['taxes'] ; $status= $taxForAnyCountry['status']; |
|
| 243 | - $value = $taxForAnyCountry['value'] ; $rate= $taxForAnyCountry['value']; |
|
| 241 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 242 | + $taxes = $taxForAnyCountry['taxes']; $status = $taxForAnyCountry['status']; |
|
| 243 | + $value = $taxForAnyCountry['value']; $rate = $taxForAnyCountry['value']; |
|
| 244 | 244 | } else { |
| 245 | 245 | $taxes = [0]; |
| 246 | 246 | |
@@ -188,8 +188,10 @@ discard block |
||
| 188 | 188 | $origin_state = $this->setting->first()->state; //Get the State of origin |
| 189 | 189 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 190 | 190 | |
| 191 | - if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
|
| 192 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 191 | + if ($tax_class_id) { |
|
| 192 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
| 193 | + if ($tax_enable == 1) { |
|
| 194 | +//If GST is Enabled |
|
| 193 | 195 | |
| 194 | 196 | $state_code = ''; |
| 195 | 197 | $c_gst = ''; |
@@ -200,42 +202,45 @@ discard block |
||
| 200 | 202 | $rate = ''; |
| 201 | 203 | $status = 1; |
| 202 | 204 | |
| 203 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 205 | + if ($user_state != '') { |
|
| 206 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 204 | 207 | $c_gst = $user_state->c_gst; |
| 205 | 208 | $s_gst = $user_state->s_gst; |
| 206 | 209 | $i_gst = $user_state->i_gst; |
| 207 | 210 | $ut_gst = $user_state->ut_gst; |
| 208 | 211 | $state_code = $user_state->state_code; |
| 209 | 212 | |
| 210 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 213 | + if ($state_code == $origin_state) { |
|
| 214 | +//If user and origin state are same |
|
| 211 | 215 | $rateForSameState = $this->getTaxWhenIndianSameState($user_state,$origin_state,$productid,$c_gst,$s_gst,$state_code,$status); |
| 212 | 216 | |
| 213 | 217 | $taxes = $rateForSameState['taxes']; |
| 214 | 218 | $status = $rateForSameState['status']; |
| 215 | 219 | $value = $rateForSameState['value']; |
| 216 | - } |
|
| 217 | - |
|
| 218 | - elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 220 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 221 | +//If user is from other state |
|
| 219 | 222 | $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state,$origin_state,$productid,$i_gst,$state_code,$status); |
| 220 | 223 | $taxes = $rateForOtherState['taxes']; |
| 221 | 224 | $status = $rateForOtherState['status']; |
| 222 | 225 | $value = $rateForOtherState['value']; |
| 223 | - } |
|
| 224 | - |
|
| 225 | - elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 226 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 227 | +//if user from Union Territory |
|
| 226 | 228 | $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state,$origin_state,$productid,$c_gst, $ut_gst,$state_code,$status); |
| 227 | 229 | $taxes = $rateForUnionTerritory['taxes']; |
| 228 | 230 | $status = $rateForUnionTerritory['status']; |
| 229 | 231 | $value = $rateForUnionTerritory['value']; |
| 230 | 232 | |
| 231 | 233 | } |
| 232 | - } else {//If user from other Country |
|
| 234 | + } else { |
|
| 235 | +//If user from other Country |
|
| 233 | 236 | $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 234 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 237 | + if ($taxClassId) { |
|
| 238 | +//if state equals the user State or country equals user country |
|
| 235 | 239 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId,$productid,$status); |
| 236 | 240 | $taxes = $taxForSpecificCountry['taxes'] ; $status= $taxForSpecificCountry['status']; |
| 237 | 241 | $value = $taxForSpecificCountry['value'] ; $rate= $taxForSpecificCountry['value']; |
| 238 | - } else {//if Tax is selected for Any Country Any State |
|
| 242 | + } else { |
|
| 243 | +//if Tax is selected for Any Country Any State |
|
| 239 | 244 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
| 240 | 245 | if ($taxClassId) { |
| 241 | 246 | $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
@@ -270,7 +275,8 @@ discard block |
||
| 270 | 275 | ]); |
| 271 | 276 | } |
| 272 | 277 | } |
| 273 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 278 | + } elseif ($tax_enable == 0) { |
|
| 279 | +//If Tax enable is 0 |
|
| 274 | 280 | $status = 1; |
| 275 | 281 | if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
| 276 | 282 | $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 |
@@ -291,9 +297,11 @@ discard block |
||
| 291 | 297 | 'value' => $value, |
| 292 | 298 | ]); |
| 293 | 299 | } |
| 294 | - } else {//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) |
|
| 300 | + } else { |
|
| 301 | +//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) |
|
| 295 | 302 | $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 296 | - if ($taxClassId) { //if state equals the user State |
|
| 303 | + if ($taxClassId) { |
|
| 304 | +//if state equals the user State |
|
| 297 | 305 | $taxes = $this->getTaxByPriority($taxClassId); |
| 298 | 306 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 299 | 307 | if ($value == '') { |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | $geoip_country = ''; |
| 200 | 200 | if (\Auth::user()) { |
| 201 | 201 | $geoip_country = \Auth::user()->country; |
| 202 | - } |
|
| 203 | - if ($geoip_country == '') { |
|
| 202 | + } |
|
| 203 | + if ($geoip_country == '') { |
|
| 204 | 204 | $geoip_country = \App\Http\Controllers\Front\CartController::findCountryByGeoip($country_iso); |
| 205 | 205 | } |
| 206 | 206 | return $geoip_country; |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | public function getGeoipState($state_code) |
| 210 | 210 | { |
| 211 | - $geoip_state = ''; |
|
| 212 | - $geoip_state_array = \App\Http\Controllers\Front\CartController::getStateByCode($state_code); |
|
| 213 | - if (\Auth::user()) { |
|
| 211 | + $geoip_state = ''; |
|
| 212 | + $geoip_state_array = \App\Http\Controllers\Front\CartController::getStateByCode($state_code); |
|
| 213 | + if (\Auth::user()) { |
|
| 214 | 214 | $geoip_state = \Auth::user()->state; |
| 215 | 215 | } |
| 216 | 216 | if ($geoip_state == '') { |
@@ -222,49 +222,49 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | - * When from same Indian State |
|
| 226 | - */ |
|
| 225 | + * When from same Indian State |
|
| 226 | + */ |
|
| 227 | 227 | public function getTaxWhenIndianSameState($user_state,$origin_state,$productid,$c_gst,$s_gst,$state_code,$status) |
| 228 | 228 | { |
| 229 | - $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 230 | - if ($taxClassId) { |
|
| 231 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 232 | - $value = $this->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
|
| 229 | + $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 230 | + if ($taxClassId) { |
|
| 231 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 232 | + $value = $this->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
|
| 233 | 233 | |
| 234 | - if ($value == '') { |
|
| 235 | - $status = 0; |
|
| 236 | - } |
|
| 237 | - } else { |
|
| 238 | - $taxes = [0]; |
|
| 239 | - $value =''; |
|
| 240 | - } |
|
| 234 | + if ($value == '') { |
|
| 235 | + $status = 0; |
|
| 236 | + } |
|
| 237 | + } else { |
|
| 238 | + $taxes = [0]; |
|
| 239 | + $value =''; |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 242 | + return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | - * When from other Indian State |
|
| 248 | - */ |
|
| 247 | + * When from other Indian State |
|
| 248 | + */ |
|
| 249 | 249 | public function getTaxWhenIndianOtherState($user_state,$origin_state,$productid,$i_gst,$state_code,$status) |
| 250 | 250 | { |
| 251 | - $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 252 | - if ($taxClassId) { |
|
| 253 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 254 | - $value = $this->getValueForOtherState($productid, $i_gst, $taxClassId, $taxes); |
|
| 255 | - if ($value == '') { |
|
| 256 | - $status = 0; |
|
| 257 | - } |
|
| 258 | - } else { |
|
| 259 | - $taxes = [0]; |
|
| 260 | - $value =''; |
|
| 261 | - } |
|
| 262 | - return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 251 | + $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 252 | + if ($taxClassId) { |
|
| 253 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 254 | + $value = $this->getValueForOtherState($productid, $i_gst, $taxClassId, $taxes); |
|
| 255 | + if ($value == '') { |
|
| 256 | + $status = 0; |
|
| 257 | + } |
|
| 258 | + } else { |
|
| 259 | + $taxes = [0]; |
|
| 260 | + $value =''; |
|
| 261 | + } |
|
| 262 | + return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * When from Union Territory |
|
| 267 | - */ |
|
| 265 | + /** |
|
| 266 | + * When from Union Territory |
|
| 267 | + */ |
|
| 268 | 268 | public function getTaxWhenUnionTerritory($user_state,$origin_state,$productid,$c_gst, $ut_gst,$state_code,$status) |
| 269 | 269 | { |
| 270 | 270 | $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id of state |
@@ -276,37 +276,37 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | } else { |
| 278 | 278 | $taxes = [0]; |
| 279 | - $value =''; |
|
| 279 | + $value =''; |
|
| 280 | 280 | } |
| 281 | - return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 281 | + return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - /** |
|
| 285 | - * When from Other Country and tax is applied for that country or state |
|
| 286 | - */ |
|
| 287 | - public function getTaxForSpecificCountry($taxClassId,$productid,$status) |
|
| 288 | - { |
|
| 289 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 290 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 291 | - if ($value == '') { |
|
| 292 | - $status = 0; |
|
| 293 | - } |
|
| 294 | - $rate = $value; |
|
| 295 | - return ['taxes'=>$taxes , 'status'=>$status,'value'=>$value,'rate'=>$value]; |
|
| 296 | - } |
|
| 284 | + /** |
|
| 285 | + * When from Other Country and tax is applied for that country or state |
|
| 286 | + */ |
|
| 287 | + public function getTaxForSpecificCountry($taxClassId,$productid,$status) |
|
| 288 | + { |
|
| 289 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 290 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 291 | + if ($value == '') { |
|
| 292 | + $status = 0; |
|
| 293 | + } |
|
| 294 | + $rate = $value; |
|
| 295 | + return ['taxes'=>$taxes , 'status'=>$status,'value'=>$value,'rate'=>$value]; |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - /** |
|
| 299 | - * When from Other Country and tax is applied for Any country and state |
|
| 300 | - */ |
|
| 301 | - public function getTaxForAnyCountry($taxClassId,$productid,$status) |
|
| 302 | - { |
|
| 303 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
|
| 304 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 305 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 306 | - if ($value == '') { |
|
| 307 | - $status = 0; |
|
| 308 | - } |
|
| 309 | - $rate = $value; |
|
| 310 | - return ['taxes'=>$taxes , 'status'=>$status,'value'=>$value,'rate'=>$value]; |
|
| 311 | - } |
|
| 298 | + /** |
|
| 299 | + * When from Other Country and tax is applied for Any country and state |
|
| 300 | + */ |
|
| 301 | + public function getTaxForAnyCountry($taxClassId,$productid,$status) |
|
| 302 | + { |
|
| 303 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
|
| 304 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 305 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 306 | + if ($value == '') { |
|
| 307 | + $status = 0; |
|
| 308 | + } |
|
| 309 | + $rate = $value; |
|
| 310 | + return ['taxes'=>$taxes , 'status'=>$status,'value'=>$value,'rate'=>$value]; |
|
| 311 | + } |
|
| 312 | 312 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** |
| 225 | 225 | * When from same Indian State |
| 226 | 226 | */ |
| 227 | - public function getTaxWhenIndianSameState($user_state,$origin_state,$productid,$c_gst,$s_gst,$state_code,$status) |
|
| 227 | + public function getTaxWhenIndianSameState($user_state, $origin_state, $productid, $c_gst, $s_gst, $state_code, $status) |
|
| 228 | 228 | { |
| 229 | 229 | $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
| 230 | 230 | if ($taxClassId) { |
@@ -236,17 +236,17 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | } else { |
| 238 | 238 | $taxes = [0]; |
| 239 | - $value =''; |
|
| 239 | + $value = ''; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 242 | + return ['taxes'=>$taxes, 'status'=>$status, 'value'=>$value]; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * When from other Indian State |
| 248 | 248 | */ |
| 249 | - public function getTaxWhenIndianOtherState($user_state,$origin_state,$productid,$i_gst,$state_code,$status) |
|
| 249 | + public function getTaxWhenIndianOtherState($user_state, $origin_state, $productid, $i_gst, $state_code, $status) |
|
| 250 | 250 | { |
| 251 | 251 | $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id of state |
| 252 | 252 | if ($taxClassId) { |
@@ -257,15 +257,15 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | } else { |
| 259 | 259 | $taxes = [0]; |
| 260 | - $value =''; |
|
| 260 | + $value = ''; |
|
| 261 | 261 | } |
| 262 | - return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 262 | + return ['taxes'=>$taxes, 'status'=>$status, 'value'=>$value]; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * When from Union Territory |
| 267 | 267 | */ |
| 268 | - public function getTaxWhenUnionTerritory($user_state,$origin_state,$productid,$c_gst, $ut_gst,$state_code,$status) |
|
| 268 | + public function getTaxWhenUnionTerritory($user_state, $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status) |
|
| 269 | 269 | { |
| 270 | 270 | $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id of state |
| 271 | 271 | if ($taxClassId) { |
@@ -276,15 +276,15 @@ discard block |
||
| 276 | 276 | } |
| 277 | 277 | } else { |
| 278 | 278 | $taxes = [0]; |
| 279 | - $value =''; |
|
| 279 | + $value = ''; |
|
| 280 | 280 | } |
| 281 | - return ['taxes'=>$taxes,'status'=>$status,'value'=>$value]; |
|
| 281 | + return ['taxes'=>$taxes, 'status'=>$status, 'value'=>$value]; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | 285 | * When from Other Country and tax is applied for that country or state |
| 286 | 286 | */ |
| 287 | - public function getTaxForSpecificCountry($taxClassId,$productid,$status) |
|
| 287 | + public function getTaxForSpecificCountry($taxClassId, $productid, $status) |
|
| 288 | 288 | { |
| 289 | 289 | $taxes = $this->getTaxByPriority($taxClassId); |
| 290 | 290 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
@@ -292,21 +292,21 @@ discard block |
||
| 292 | 292 | $status = 0; |
| 293 | 293 | } |
| 294 | 294 | $rate = $value; |
| 295 | - return ['taxes'=>$taxes , 'status'=>$status,'value'=>$value,'rate'=>$value]; |
|
| 295 | + return ['taxes'=>$taxes, 'status'=>$status, 'value'=>$value, 'rate'=>$value]; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * When from Other Country and tax is applied for Any country and state |
| 300 | 300 | */ |
| 301 | - public function getTaxForAnyCountry($taxClassId,$productid,$status) |
|
| 301 | + public function getTaxForAnyCountry($taxClassId, $productid, $status) |
|
| 302 | 302 | { |
| 303 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId,$productid,$status); |
|
| 303 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 304 | 304 | $taxes = $this->getTaxByPriority($taxClassId); |
| 305 | 305 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 306 | 306 | if ($value == '') { |
| 307 | 307 | $status = 0; |
| 308 | 308 | } |
| 309 | 309 | $rate = $value; |
| 310 | - return ['taxes'=>$taxes , 'status'=>$status,'value'=>$value,'rate'=>$value]; |
|
| 310 | + return ['taxes'=>$taxes, 'status'=>$status, 'value'=>$value, 'rate'=>$value]; |
|
| 311 | 311 | } |
| 312 | 312 | } |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | |
| 104 | 104 | public function getState($stateCode) |
| 105 | 105 | { |
| 106 | - if (\Auth::user()->country != 'IN') { |
|
| 106 | + if (\Auth::user()->country != 'IN') { |
|
| 107 | 107 | $state = State::where('state_subdivision_code', $stateCode)->pluck('state_subdivision_name')->first(); |
| 108 | 108 | } else { |
| 109 | 109 | $state = TaxByState::where('state_code', \Auth::user()->state)->pluck('state')->first(); |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | \Cart::clear(); |
| 124 | 124 | $status = 'success'; |
| 125 | - $message = view('themes.default1.front.postPaymentTemplate', compact('invoice','date','order', |
|
| 126 | - 'product','invoiceItem'))->render(); |
|
| 125 | + $message = view('themes.default1.front.postPaymentTemplate', compact('invoice', 'date', 'order', |
|
| 126 | + 'product', 'invoiceItem'))->render(); |
|
| 127 | 127 | return ['status'=>$status, 'message'=>$message]; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | \Cart::clear(); |
| 142 | 142 | $status = 'success'; |
| 143 | 143 | |
| 144 | - $message =view('themes.default1.front.postRenewTemplate', compact('invoice','date','order', |
|
| 145 | - 'product','invoiceItem'))->render(); |
|
| 144 | + $message = view('themes.default1.front.postRenewTemplate', compact('invoice', 'date', 'order', |
|
| 145 | + 'product', 'invoiceItem'))->render(); |
|
| 146 | 146 | return ['status'=>$status, 'message'=>$message]; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -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 = date_create($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 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
| 473 | 473 | |
| 474 | 474 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 475 | - ->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled |
|
| 475 | + ->pluck('tax_classes_id')->first(); //In case of India when other tax is available and tax is not enabled |
|
| 476 | 476 | if ($taxClassId) { |
| 477 | 477 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 478 | 478 | $taxs = $rate['taxes']; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $fromdate = date_create($from); |
| 28 | 28 | $from = date_format($fromdate, 'Y-m-d H:m:i'); |
| 29 | 29 | $tills = date('Y-m-d H:m:i'); |
| 30 | - $tillDate = $this->getTillDate($from,$till,$tills); |
|
| 30 | + $tillDate = $this->getTillDate($from,$till,$tills); |
|
| 31 | 31 | $join = $join->whereBetween('orders.created_at', [$from, $tillDate]); |
| 32 | 32 | } |
| 33 | 33 | if ($till) { |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function getTillDate($from,$till,$tills) |
| 53 | 53 | { |
| 54 | - if ($till) |
|
| 55 | - { |
|
| 54 | + if ($till) |
|
| 55 | + { |
|
| 56 | 56 | $todate = date_create($till); |
| 57 | 57 | $tills = date_format($todate, 'Y-m-d H:m:i'); |
| 58 | - } |
|
| 59 | - return $tills; |
|
| 58 | + } |
|
| 59 | + return $tills; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function getFromDate($from,$froms) |
| 63 | 63 | { |
| 64 | - if ($from) { |
|
| 64 | + if ($from) { |
|
| 65 | 65 | $fromdate = date_create($from); |
| 66 | 66 | $froms = date_format($fromdate, 'Y-m-d H:m:i'); |
| 67 | 67 | } |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | - * Create orders. |
|
| 73 | - * |
|
| 74 | - * @param Request $request |
|
| 75 | - * |
|
| 76 | - * @return type |
|
| 77 | - */ |
|
| 72 | + * Create orders. |
|
| 73 | + * |
|
| 74 | + * @param Request $request |
|
| 75 | + * |
|
| 76 | + * @return type |
|
| 77 | + */ |
|
| 78 | 78 | public function orderExecute(Request $request) |
| 79 | 79 | { |
| 80 | 80 | try { |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * generating serial key if product type is downloadable. |
|
| 97 | - * |
|
| 98 | - * @param type $product_type |
|
| 99 | - * |
|
| 100 | - * @throws \Exception |
|
| 101 | - * |
|
| 102 | - * @return type |
|
| 103 | - */ |
|
| 95 | + /** |
|
| 96 | + * generating serial key if product type is downloadable. |
|
| 97 | + * |
|
| 98 | + * @param type $product_type |
|
| 99 | + * |
|
| 100 | + * @throws \Exception |
|
| 101 | + * |
|
| 102 | + * @return type |
|
| 103 | + */ |
|
| 104 | 104 | public function generateSerialKey($product_type) |
| 105 | 105 | { |
| 106 | 106 | try { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $str = str_random(16); |
| 109 | 109 | $str = strtoupper($str); |
| 110 | 110 | $str = Crypt::encrypt($str); |
| 111 | - return $str; |
|
| 111 | + return $str; |
|
| 112 | 112 | } |
| 113 | 113 | } catch (\Exception $ex) { |
| 114 | 114 | Bugsnag::notifyException($ex); |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | $fromdate = date_create($from); |
| 28 | 28 | $from = date_format($fromdate, 'Y-m-d H:m:i'); |
| 29 | 29 | $tills = date('Y-m-d H:m:i'); |
| 30 | - $tillDate = $this->getTillDate($from,$till,$tills); |
|
| 30 | + $tillDate = $this->getTillDate($from, $till, $tills); |
|
| 31 | 31 | $join = $join->whereBetween('orders.created_at', [$from, $tillDate]); |
| 32 | 32 | } |
| 33 | 33 | if ($till) { |
| 34 | 34 | $tilldate = date_create($till); |
| 35 | 35 | $till = date_format($tilldate, 'Y-m-d H:m:i'); |
| 36 | 36 | $froms = Order::first()->created_at; |
| 37 | - $fromDate = $this->getFromDate($from,$froms); |
|
| 37 | + $fromDate = $this->getFromDate($from, $froms); |
|
| 38 | 38 | $join = $join->whereBetween('orders.created_at', [$fromDate, $till]); |
| 39 | 39 | } |
| 40 | 40 | if ($domain) { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | return $join; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getTillDate($from,$till,$tills) |
|
| 52 | + public function getTillDate($from, $till, $tills) |
|
| 53 | 53 | { |
| 54 | 54 | if ($till) |
| 55 | 55 | { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return $tills; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function getFromDate($from,$froms) |
|
| 62 | + public function getFromDate($from, $froms) |
|
| 63 | 63 | { |
| 64 | 64 | if ($from) { |
| 65 | 65 | $fromdate = date_create($from); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | class ExtendedOrderController extends Controller |
| 12 | 12 | { |
| 13 | 13 | public function advanceSearch($order_no = '', $product_id = '', $expiry = '', $from = '', $till = '', $domain = '') |
| 14 | - { |
|
| 14 | + { |
|
| 15 | 15 | $join = Order::leftJoin('subscriptions', 'orders.id', '=', 'subscriptions.order_id'); |
| 16 | 16 | if ($order_no) { |
| 17 | 17 | $join = $join->where('number', $order_no); |
@@ -51,8 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | public function getTillDate($from,$till,$tills) |
| 53 | 53 | { |
| 54 | - if ($till) |
|
| 55 | - { |
|
| 54 | + if ($till) { |
|
| 56 | 55 | $todate = date_create($till); |
| 57 | 56 | $tills = date_format($todate, 'Y-m-d H:m:i'); |
| 58 | 57 | } |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | $ut_gst = $user_state->ut_gst; |
| 84 | 84 | $state_code = $user_state->state_code; |
| 85 | 85 | if ($state_code == $origin_state) {//If user and origin state are same |
| 86 | - $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 87 | - if ($taxClassId) { |
|
| 88 | - $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 89 | - $value = $cartController->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
|
| 90 | - } else { |
|
| 91 | - $taxes = [0]; |
|
| 92 | - } |
|
| 86 | + $taxClassId = TaxClass::where('name', 'Intra State GST')->pluck('id')->toArray(); //Get the class Id of state |
|
| 87 | + if ($taxClassId) { |
|
| 88 | + $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 89 | + $value = $cartController->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
|
| 90 | + } else { |
|
| 91 | + $taxes = [0]; |
|
| 92 | + } |
|
| 93 | 93 | } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
| 94 | 94 | |
| 95 | 95 | $taxClassId = TaxClass::where('name', 'Inter State GST')->pluck('id')->toArray(); //Get the class Id of state |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
| 103 | 103 | $taxClassId = TaxClass::where('name', 'Union Territory GST')->pluck('id')->toArray(); //Get the class Id of state |
| 104 | - if ($taxClassId) { |
|
| 105 | - $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 106 | - $value = $cartController->getValueForUnionTerritory($productid, $c_gst, $ut_gst, $taxClassId, $taxes); |
|
| 107 | - } else { |
|
| 108 | - $taxes = [0]; |
|
| 109 | - } |
|
| 104 | + if ($taxClassId) { |
|
| 105 | + $taxes = $cartController->getTaxByPriority($taxClassId); |
|
| 106 | + $value = $cartController->getValueForUnionTerritory($productid, $c_gst, $ut_gst, $taxClassId, $taxes); |
|
| 107 | + } else { |
|
| 108 | + $taxes = [0]; |
|
| 109 | + } |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | return ['taxes'=>$taxes, 'value'=>$value]; |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | case 1: |
| 279 | 279 | $percentage = $price * ($value / 100); |
| 280 | 280 | |
| 281 | - return $price - $percentage; |
|
| 281 | + return $price - $percentage; |
|
| 282 | 282 | case 2: |
| 283 | 283 | return $price - $value; |
| 284 | 284 | case 3: |
@@ -238,7 +238,7 @@ |
||
| 238 | 238 | { |
| 239 | 239 | try { |
| 240 | 240 | if ($code != '') { |
| 241 | - $promotion =Promotin::where('code', $code)->first(); |
|
| 241 | + $promotion = Promotin::where('code', $code)->first(); |
|
| 242 | 242 | $start = $promotion->start; |
| 243 | 243 | $end = $promotion->expiry; |
| 244 | 244 | $now = \Carbon\Carbon::now(); |