@@ -475,7 +475,8 @@ discard block |
||
| 475 | 475 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 476 | 476 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 477 | 477 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 478 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 478 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 479 | +//if tax_enable is 0 |
|
| 479 | 480 | |
| 480 | 481 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 481 | 482 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -484,13 +485,15 @@ discard block |
||
| 484 | 485 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 485 | 486 | $taxs = $rate['taxes']; |
| 486 | 487 | $rate = $rate['rate']; |
| 487 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 488 | + } elseif ($geoip_country != 'IN') { |
|
| 489 | +//In case of other country |
|
| 488 | 490 | // when tax is available and tax is not enabled(Applicable |
| 489 | 491 | //when Global Tax class for any country and state is not there) |
| 490 | 492 | |
| 491 | 493 | $taxClassId = Tax::where('state', $geoip_state) |
| 492 | 494 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 493 | - if ($taxClassId) { //if state equals the user State |
|
| 495 | + if ($taxClassId) { |
|
| 496 | +//if state equals the user State |
|
| 494 | 497 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 495 | 498 | $taxs = $rate['taxes']; |
| 496 | 499 | $rate = $rate['rate']; |
@@ -533,11 +536,13 @@ discard block |
||
| 533 | 536 | $i_gst = 0; |
| 534 | 537 | $ut_gst = 0; |
| 535 | 538 | $state_code = ''; |
| 536 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 539 | + if ($user_state != '') { |
|
| 540 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 537 | 541 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 538 | 542 | $taxes = $tax['taxes']; |
| 539 | 543 | $value = $tax['value']; |
| 540 | - } else {//If user from other Country |
|
| 544 | + } else { |
|
| 545 | +//If user from other Country |
|
| 541 | 546 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 542 | 547 | $taxes = $tax['taxes']; |
| 543 | 548 | $value = $tax['value']; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $state_code = $user_state->state_code; |
| 31 | 31 | if ($state_code == $origin_state) {//If user and origin state are same |
| 32 | 32 | $taxClassId = TaxClass::where('name', 'Intra State GST') |
| 33 | - ->pluck('id')->toArray(); //Get the class Id of state |
|
| 33 | + ->pluck('id')->toArray(); //Get the class Id of state |
|
| 34 | 34 | if ($taxClassId) { |
| 35 | 35 | $taxes = $cartController->getTaxByPriority($taxClassId); |
| 36 | 36 | $value = $cartController->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
@@ -216,21 +216,21 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | - * Check if Session has Code and Value of Code |
|
| 220 | - * |
|
| 221 | - * @author Ashutosh Pathak <[email protected]> |
|
| 222 | - * |
|
| 223 | - * @date 2019-02-22T13:10:50+0530 |
|
| 224 | - * |
|
| 225 | - * @return array |
|
| 226 | - */ |
|
| 219 | + * Check if Session has Code and Value of Code |
|
| 220 | + * |
|
| 221 | + * @author Ashutosh Pathak <[email protected]> |
|
| 222 | + * |
|
| 223 | + * @date 2019-02-22T13:10:50+0530 |
|
| 224 | + * |
|
| 225 | + * @return array |
|
| 226 | + */ |
|
| 227 | 227 | protected function getCodeFromSession() |
| 228 | 228 | { |
| 229 | 229 | $code = ''; |
| 230 | 230 | $codevalue = ''; |
| 231 | - if(\Session::has('code')){//If coupon code is applied get it here from Session |
|
| 232 | - $code = \Session::get('code'); |
|
| 233 | - $codevalue = \Session::get('codevalue'); |
|
| 231 | + if(\Session::has('code')){//If coupon code is applied get it here from Session |
|
| 232 | + $code = \Session::get('code'); |
|
| 233 | + $codevalue = \Session::get('codevalue'); |
|
| 234 | 234 | } |
| 235 | 235 | return ['code'=> $code , 'codevalue'=>$codevalue] ; |
| 236 | 236 | } |
@@ -228,10 +228,10 @@ |
||
| 228 | 228 | { |
| 229 | 229 | $code = ''; |
| 230 | 230 | $codevalue = ''; |
| 231 | - if(\Session::has('code')){//If coupon code is applied get it here from Session |
|
| 231 | + if (\Session::has('code')) {//If coupon code is applied get it here from Session |
|
| 232 | 232 | $code = \Session::get('code'); |
| 233 | 233 | $codevalue = \Session::get('codevalue'); |
| 234 | 234 | } |
| 235 | - return ['code'=> $code , 'codevalue'=>$codevalue] ; |
|
| 235 | + return ['code'=> $code, 'codevalue'=>$codevalue]; |
|
| 236 | 236 | } |
| 237 | 237 | } |
@@ -28,7 +28,8 @@ discard block |
||
| 28 | 28 | $i_gst = $user_state->i_gst; |
| 29 | 29 | $ut_gst = $user_state->ut_gst; |
| 30 | 30 | $state_code = $user_state->state_code; |
| 31 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 31 | + if ($state_code == $origin_state) { |
|
| 32 | +//If user and origin state are same |
|
| 32 | 33 | $taxClassId = TaxClass::where('name', 'Intra State GST') |
| 33 | 34 | ->pluck('id')->toArray(); //Get the class Id of state |
| 34 | 35 | if ($taxClassId) { |
@@ -37,7 +38,8 @@ discard block |
||
| 37 | 38 | } else { |
| 38 | 39 | $taxes = [0]; |
| 39 | 40 | } |
| 40 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 41 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 42 | +//If user is from other state |
|
| 41 | 43 | $taxClassId = TaxClass::where('name', 'Inter State GST') |
| 42 | 44 | ->pluck('id')->toArray(); //Get the class Id of state |
| 43 | 45 | if ($taxClassId) { |
@@ -46,7 +48,8 @@ discard block |
||
| 46 | 48 | } else { |
| 47 | 49 | $taxes = [0]; |
| 48 | 50 | } |
| 49 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 51 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 52 | +//if user from Union Territory |
|
| 50 | 53 | $taxClassId = TaxClass::where('name', 'Union Territory GST') |
| 51 | 54 | ->pluck('id')->toArray(); //Get the class Id of state |
| 52 | 55 | if ($taxClassId) { |
@@ -71,13 +74,15 @@ discard block |
||
| 71 | 74 | ->pluck('tax_classes_id')->first(); |
| 72 | 75 | $value = ''; |
| 73 | 76 | $rate = ''; |
| 74 | - if ($taxClassId) { //if state equals the user State |
|
| 77 | + if ($taxClassId) { |
|
| 78 | +//if state equals the user State |
|
| 75 | 79 | $taxes = $cartController->getTaxByPriority($taxClassId); |
| 76 | 80 | |
| 77 | 81 | // $taxes = $this->cartController::getTaxByPriority($taxClassId); |
| 78 | 82 | $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
| 79 | 83 | $rate = $value; |
| 80 | - } else {//if Tax is selected for Any State Any Country |
|
| 84 | + } else { |
|
| 85 | +//if Tax is selected for Any State Any Country |
|
| 81 | 86 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
| 82 | 87 | if ($taxClassId) { |
| 83 | 88 | $taxes = $cartController->getTaxByPriority($taxClassId); |
@@ -224,11 +229,12 @@ discard block |
||
| 224 | 229 | * |
| 225 | 230 | * @return array |
| 226 | 231 | */ |
| 227 | - protected function getCodeFromSession() |
|
| 232 | + protected function getCodeFromSession() |
|
| 228 | 233 | { |
| 229 | 234 | $code = ''; |
| 230 | 235 | $codevalue = ''; |
| 231 | - if(\Session::has('code')){//If coupon code is applied get it here from Session |
|
| 236 | + if(\Session::has('code')) { |
|
| 237 | +//If coupon code is applied get it here from Session |
|
| 232 | 238 | $code = \Session::get('code'); |
| 233 | 239 | $codevalue = \Session::get('codevalue'); |
| 234 | 240 | } |