@@ -318,11 +318,12 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @return array |
| 320 | 320 | */ |
| 321 | - protected function getCodeFromSession() |
|
| 321 | + protected function getCodeFromSession() |
|
| 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 | } |
@@ -510,7 +511,8 @@ discard block |
||
| 510 | 511 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 511 | 512 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 512 | 513 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 513 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 514 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 515 | +//if tax_enable is 0 |
|
| 514 | 516 | |
| 515 | 517 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 516 | 518 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -519,13 +521,15 @@ discard block |
||
| 519 | 521 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 520 | 522 | $taxs = $rate['taxes']; |
| 521 | 523 | $rate = $rate['rate']; |
| 522 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 524 | + } elseif ($geoip_country != 'IN') { |
|
| 525 | +//In case of other country |
|
| 523 | 526 | // when tax is available and tax is not enabled(Applicable |
| 524 | 527 | //when Global Tax class for any country and state is not there) |
| 525 | 528 | |
| 526 | 529 | $taxClassId = Tax::where('state', $geoip_state) |
| 527 | 530 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 528 | - if ($taxClassId) { //if state equals the user State |
|
| 531 | + if ($taxClassId) { |
|
| 532 | +//if state equals the user State |
|
| 529 | 533 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 530 | 534 | $taxs = $rate['taxes']; |
| 531 | 535 | $rate = $rate['rate']; |
@@ -567,11 +571,13 @@ discard block |
||
| 567 | 571 | $i_gst = 0; |
| 568 | 572 | $ut_gst = 0; |
| 569 | 573 | $state_code = ''; |
| 570 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 574 | + if ($user_state != '') { |
|
| 575 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 571 | 576 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 572 | 577 | $taxes = $tax['taxes']; |
| 573 | 578 | $value = $tax['value']; |
| 574 | - } else {//If user from other Country |
|
| 579 | + } else { |
|
| 580 | +//If user from other Country |
|
| 575 | 581 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 576 | 582 | $taxes = $tax['taxes']; |
| 577 | 583 | $value = $tax['value']; |
@@ -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); |