@@ -18,24 +18,28 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function getDetailsWhenUserStateIsIndian($user_state, $origin_state, $productid, $geoip_state, $geoip_country, $status = 1) |
| 20 | 20 | { |
| 21 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user,if user from INdia |
|
| 21 | + if ($user_state != '') { |
|
| 22 | +//Get the CGST,SGST,IGST,STATE_CODE of the user,if user from INdia |
|
| 22 | 23 | $c_gst = $user_state->c_gst; |
| 23 | 24 | $s_gst = $user_state->s_gst; |
| 24 | 25 | $i_gst = $user_state->i_gst; |
| 25 | 26 | $ut_gst = $user_state->ut_gst; |
| 26 | 27 | $state_code = $user_state->state_code; |
| 27 | 28 | |
| 28 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 29 | + if ($state_code == $origin_state) { |
|
| 30 | +//If user and origin state are same |
|
| 29 | 31 | $rateForSameState = $this->getTaxWhenIndianSameState($user_state, $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 30 | 32 | $taxes = $rateForSameState['taxes']; |
| 31 | 33 | $status = $rateForSameState['status']; |
| 32 | 34 | $value = $rateForSameState['value']; |
| 33 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 35 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 36 | +//If user is from other state |
|
| 34 | 37 | $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, $origin_state, $productid, $i_gst, $state_code, $status); |
| 35 | 38 | $taxes = $rateForOtherState['taxes']; |
| 36 | 39 | $status = $rateForOtherState['status']; |
| 37 | 40 | $value = $rateForOtherState['value']; |
| 38 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 41 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 42 | +//if user from Union Territory |
|
| 39 | 43 | $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 40 | 44 | $taxes = $rateForUnionTerritory['taxes']; |
| 41 | 45 | $status = $rateForUnionTerritory['status']; |
@@ -56,13 +60,15 @@ discard block |
||
| 56 | 60 | $taxClassId = Tax::where('state', $geoip_state) |
| 57 | 61 | ->orWhere('country', $geoip_country) |
| 58 | 62 | ->pluck('tax_classes_id')->first(); |
| 59 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 63 | + if ($taxClassId) { |
|
| 64 | +//if state equals the user State or country equals user country |
|
| 60 | 65 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, $productid, $status); |
| 61 | 66 | $taxes = $taxForSpecificCountry['taxes']; |
| 62 | 67 | $status = $taxForSpecificCountry['status']; |
| 63 | 68 | $value = $taxForSpecificCountry['value']; |
| 64 | 69 | $rate = $taxForSpecificCountry['value']; |
| 65 | - } else {//if Tax is selected for Any Country Any State |
|
| 70 | + } else { |
|
| 71 | +//if Tax is selected for Any Country Any State |
|
| 66 | 72 | $taxClassId = Tax::where('country', '') |
| 67 | 73 | ->where('state', 'Any State') |
| 68 | 74 | ->pluck('tax_classes_id')->first(); |
@@ -96,13 +102,15 @@ discard block |
||
| 96 | 102 | $status = 0; |
| 97 | 103 | } |
| 98 | 104 | $rate = $value; |
| 99 | - } else {//In case of other country |
|
| 105 | + } else { |
|
| 106 | +//In case of other country |
|
| 100 | 107 | //when tax is available and tax is not enabled |
| 101 | 108 | //(Applicable when Global Tax class for any country and state is not there) |
| 102 | 109 | $taxClassId = Tax::where('state', $geoip_state) |
| 103 | 110 | ->orWhere('country', $geoip_country) |
| 104 | 111 | ->pluck('tax_classes_id')->first(); |
| 105 | - if ($taxClassId) { //if state equals the user State |
|
| 112 | + if ($taxClassId) { |
|
| 113 | +//if state equals the user State |
|
| 106 | 114 | $taxes = $this->getTaxByPriority($taxClassId); |
| 107 | 115 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 108 | 116 | if ($value == '') { |
@@ -169,7 +169,8 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $plan = new Plan(); |
| 171 | 171 | $plans = $plan->where('product', $productid)->pluck('name', 'id')->toArray(); |
| 172 | - if (count($plans) > 0) {//If Plan Exist For A product, Display Dropdown for Plans |
|
| 172 | + if (count($plans) > 0) { |
|
| 173 | +//If Plan Exist For A product, Display Dropdown for Plans |
|
| 173 | 174 | $field = "<div class='col-md-4 form-group'> |
| 174 | 175 | <label class='required'>"./* @scrutinizer ignore-type */ |
| 175 | 176 | \Lang::get('message.subscription').'</label> |
@@ -180,7 +181,8 @@ discard block |
||
| 180 | 181 | ['class' => 'form-control', 'id' => 'plan', 'onchange' => 'getPrice(this.value)'] |
| 181 | 182 | ).' |
| 182 | 183 | </div>'; |
| 183 | - } else {//If No Plan Exist For A Product |
|
| 184 | + } else { |
|
| 185 | +//If No Plan Exist For A Product |
|
| 184 | 186 | $userid = $request->input('user'); |
| 185 | 187 | $price = $controller->cost($productid, $userid); |
| 186 | 188 | } |
@@ -243,7 +245,8 @@ discard block |
||
| 243 | 245 | |
| 244 | 246 | public function getRelease($owner, $repository, $order_id, $file) |
| 245 | 247 | { |
| 246 | - if ($owner && $repository) {//If the Product is downloaded from Github |
|
| 248 | + if ($owner && $repository) { |
|
| 249 | +//If the Product is downloaded from Github |
|
| 247 | 250 | $github_controller = new \App\Http\Controllers\Github\GithubController(); |
| 248 | 251 | $relese = $github_controller->listRepositories($owner, $repository, $order_id); |
| 249 | 252 | |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | public function getIfItemPresent($item, $invoiceid, $user_id, $order_status) |
| 82 | 82 | { |
| 83 | 83 | |
| 84 | - try{ |
|
| 84 | + try { |
|
| 85 | 85 | |
| 86 | 86 | $product = $this->product->where('name', $item->product_name)->first()->id; |
| 87 | 87 | $version = $this->product->where('name', $item->product_name)->first()->version; |
@@ -382,16 +382,19 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | $productid = $request->input('product'); |
| 384 | 384 | $plan = $request->input('plan'); |
| 385 | - if (!$agents) {//If agents is not received in the request in the case when 'modify agent' is not allowed for the Product,get the no of Agents from the Plan Table. |
|
| 385 | + if (!$agents) { |
|
| 386 | +//If agents is not received in the request in the case when 'modify agent' is not allowed for the Product,get the no of Agents from the Plan Table. |
|
| 386 | 387 | $planForAgent = Product::find($productid)->planRelation->find($plan); |
| 387 | - if ($planForAgent) {//If Plan Exists For the Product ie not a Product without Plan |
|
| 388 | + if ($planForAgent) { |
|
| 389 | +//If Plan Exists For the Product ie not a Product without Plan |
|
| 388 | 390 | $noOfAgents = $planForAgent->planPrice->first()->no_of_agents; |
| 389 | 391 | $agents = $noOfAgents ? $noOfAgents : 0; //If no. of Agents is specified then that,else 0(Unlimited Agents) |
| 390 | 392 | } else { |
| 391 | 393 | $agents = 0; |
| 392 | 394 | } |
| 393 | 395 | } |
| 394 | - if (!$qty) {//If quantity is not received in the request in the case when 'modify quantity' is not allowed for the Product,get the Product qUANTITY from the Plan Table. |
|
| 396 | + if (!$qty) { |
|
| 397 | +//If quantity is not received in the request in the case when 'modify quantity' is not allowed for the Product,get the Product qUANTITY from the Plan Table. |
|
| 395 | 398 | $planForQty = Product::find($productid)->planRelation->find($plan); |
| 396 | 399 | if ($planForQty) { |
| 397 | 400 | $quantity = Product::find($productid)->planRelation->find($plan)->planPrice->first()->product_quantity; |
@@ -538,7 +541,8 @@ discard block |
||
| 538 | 541 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 539 | 542 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 540 | 543 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 541 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 544 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 545 | +//if tax_enable is 0 |
|
| 542 | 546 | |
| 543 | 547 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 544 | 548 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -547,13 +551,15 @@ discard block |
||
| 547 | 551 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 548 | 552 | $taxs = $rate['taxes']; |
| 549 | 553 | $rate = $rate['rate']; |
| 550 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 554 | + } elseif ($geoip_country != 'IN') { |
|
| 555 | +//In case of other country |
|
| 551 | 556 | // when tax is available and tax is not enabled(Applicable |
| 552 | 557 | //when Global Tax class for any country and state is not there) |
| 553 | 558 | |
| 554 | 559 | $taxClassId = Tax::where('state', $geoip_state) |
| 555 | 560 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 556 | - if ($taxClassId) { //if state equals the user State |
|
| 561 | + if ($taxClassId) { |
|
| 562 | +//if state equals the user State |
|
| 557 | 563 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 558 | 564 | $taxs = $rate['taxes']; |
| 559 | 565 | $rate = $rate['rate']; |
@@ -595,11 +601,13 @@ discard block |
||
| 595 | 601 | $i_gst = 0; |
| 596 | 602 | $ut_gst = 0; |
| 597 | 603 | $state_code = ''; |
| 598 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 604 | + if ($user_state != '') { |
|
| 605 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 599 | 606 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 600 | 607 | $taxes = $tax['taxes']; |
| 601 | 608 | $value = $tax['value']; |
| 602 | - } else {//If user from other Country |
|
| 609 | + } else { |
|
| 610 | +//If user from other Country |
|
| 603 | 611 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 604 | 612 | $taxes = $tax['taxes']; |
| 605 | 613 | $value = $tax['value']; |
@@ -134,14 +134,16 @@ |
||
| 134 | 134 | $planid = Session::get('plan'); |
| 135 | 135 | } |
| 136 | 136 | $plan = Plan::where('id', $planid)->where('product', $productid)->first(); |
| 137 | - if ($plan) { //Get the Total Plan Cost if the Plan Exists For a Product |
|
| 137 | + if ($plan) { |
|
| 138 | +//Get the Total Plan Cost if the Plan Exists For a Product |
|
| 138 | 139 | $months = 1; |
| 139 | 140 | $cont = new CartController(); |
| 140 | 141 | $currency = $cont->currency($userid); |
| 141 | 142 | $product = Product::find($productid); |
| 142 | 143 | $days = $plan->periods->pluck('days')->first(); |
| 143 | 144 | $price = ($product->planRelation->find($planid)->planPrice->where('currency', $currency['currency'])->first()->add_price); |
| 144 | - if ($days) { //If Period Is defined for a Particular Plan ie no. of Days Generated |
|
| 145 | + if ($days) { |
|
| 146 | +//If Period Is defined for a Particular Plan ie no. of Days Generated |
|
| 145 | 147 | $months = $days >= '365' ? $days / 30 / 12 : $days / 30; |
| 146 | 148 | } |
| 147 | 149 | $finalPrice = str_replace(',', '', $price); |
@@ -96,7 +96,8 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | try { |
| 98 | 98 | $plan = ''; |
| 99 | - if ($request->has('subscription')) {//put he Plan id sent into session variable |
|
| 99 | + if ($request->has('subscription')) { |
|
| 100 | +//put he Plan id sent into session variable |
|
| 100 | 101 | $plan = $request->get('subscription'); |
| 101 | 102 | Session::put('plan', $plan); |
| 102 | 103 | } |
@@ -127,7 +128,8 @@ discard block |
||
| 127 | 128 | foreach ($cartCollection as $item) { |
| 128 | 129 | $attributes[] = $item->attributes; |
| 129 | 130 | $cart_currency = $attributes[0]['currency']['currency']; |
| 130 | - if (\Auth::user()) {//If User is Loggen in and his currency changes after logginng in then remove his previous order from cart |
|
| 131 | + if (\Auth::user()) { |
|
| 132 | +//If User is Loggen in and his currency changes after logginng in then remove his previous order from cart |
|
| 131 | 133 | $currency = \Auth::user()->currency; |
| 132 | 134 | if ($cart_currency != $currency) { |
| 133 | 135 | $id = $item->id; |
@@ -175,8 +177,10 @@ discard block |
||
| 175 | 177 | $origin_state = $this->setting->first()->state; //Get the State of origin |
| 176 | 178 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 177 | 179 | |
| 178 | - if (count($tax_class_id) > 0) {//If the product is allowed for tax (Check in tax_product relation table) |
|
| 179 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 180 | + if (count($tax_class_id) > 0) { |
|
| 181 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
| 182 | + if ($tax_enable == 1) { |
|
| 183 | +//If GST is Enabled |
|
| 180 | 184 | |
| 181 | 185 | $details = $this->getDetailsWhenUserStateIsIndian( |
| 182 | 186 | $user_state, |
@@ -220,7 +224,8 @@ discard block |
||
| 220 | 224 | ]); |
| 221 | 225 | } |
| 222 | 226 | } |
| 223 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 and other tax is available |
|
| 227 | + } elseif ($tax_enable == 0) { |
|
| 228 | +//If Tax enable is 0 and other tax is available |
|
| 224 | 229 | |
| 225 | 230 | $details = $this->whenOtherTaxAvailableAndTaxNotEnable($tax_class_id, $productid, $geoip_state, $geoip_country); |
| 226 | 231 | |
@@ -472,7 +477,8 @@ discard block |
||
| 472 | 477 | try { |
| 473 | 478 | $currency = Setting::find(1)->default_currency; |
| 474 | 479 | $currency_symbol = Setting::find(1)->default_symbol; |
| 475 | - if (!\Auth::user()) {//When user is not logged in |
|
| 480 | + if (!\Auth::user()) { |
|
| 481 | +//When user is not logged in |
|
| 476 | 482 | $cont = new \App\Http\Controllers\Front\PageController(); |
| 477 | 483 | $location = $cont->getLocation(); |
| 478 | 484 | $country = self::findCountryByGeoip($location['iso_code']); |
@@ -487,7 +493,8 @@ discard block |
||
| 487 | 493 | $currency = \Auth::user()->currency; |
| 488 | 494 | $currency_symbol = \Auth::user()->currency_symbol; |
| 489 | 495 | } |
| 490 | - if ($userid != '') {//For Admin Panel Clients |
|
| 496 | + if ($userid != '') { |
|
| 497 | +//For Admin Panel Clients |
|
| 491 | 498 | $currencyAndSymbol = self::getCurrency($userid); |
| 492 | 499 | $currency = $currencyAndSymbol['currency']; |
| 493 | 500 | $currency_symbol = $currencyAndSymbol['symbol']; |