Completed
Branch feature-dynamic-fields (cdebc1)
by Ashutosh
10:20
created
app/Http/Controllers/Order/InvoiceController.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -475,7 +475,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'];
Please login to merge, or discard this patch.
app/Http/Controllers/Front/CartController.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
                 if (count($tax_class_id) > 0) {//If the product is allowed for tax (Check in tax_product relation table)
179 179
                     if ($tax_enable == 1) {//If GST is Enabled
180 180
 
181
-                         $details = $this->getDetailsWhenUserStateIsIndian(
182
-                             $user_state,
183
-                             $origin_state,
184
-                             $productid,
185
-                             $geoip_state,
186
-                             $geoip_country
187
-                         );
181
+                            $details = $this->getDetailsWhenUserStateIsIndian(
182
+                                $user_state,
183
+                                $origin_state,
184
+                                $productid,
185
+                                $geoip_state,
186
+                                $geoip_country
187
+                            );
188 188
 
189 189
                         $c_gst = $details['cgst'];
190 190
                         $s_gst = $details['sgst'];
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
                             if ($taxes[0]) {
204 204
                                 $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst,
205 205
 
206
-                               's_gst'         => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst,
206
+                                's_gst'         => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst,
207 207
                                 'state'        => $state_code, 'origin_state'=>$origin_state,
208
-                                 'tax_enable'  => $tax_enable, 'rate'=>$value, 'status'=>$status, ];
208
+                                    'tax_enable'  => $tax_enable, 'rate'=>$value, 'status'=>$status, ];
209 209
 
210 210
                                 $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
211 211
                                             'name'   => 'no compound', 'type'   => 'tax',
212 212
                                             'target' => 'item', 'value'  => $value,
213
-                                          ]);
213
+                                            ]);
214 214
                             } else {
215 215
                                 $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0];
216 216
                                 $taxCondition[0] = new \Darryldecode\Cart\CartCondition([
217
-                                           'name'   => 'null', 'type'   => 'tax',
218
-                                           'target' => 'item', 'value'  => '0%',
219
-                                           'rate'   => 0, 'tax_enable' =>0,
220
-                                         ]);
217
+                                            'name'   => 'null', 'type'   => 'tax',
218
+                                            'target' => 'item', 'value'  => '0%',
219
+                                            'rate'   => 0, 'tax_enable' =>0,
220
+                                            ]);
221 221
                             }
222 222
                         }
223 223
                     } elseif ($tax_enable == 0) {//If Tax enable is 0 and other tax is available
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             $subregion = \App\Model\Common\State::where('state_subdivision_code', $code)->first();
377 377
             if ($subregion) {
378 378
                 $result = ['id' => $subregion->state_subdivision_code,
379
-                 'name'         => $subregion->state_subdivision_name, ];
379
+                    'name'         => $subregion->state_subdivision_name, ];
380 380
             }
381 381
 
382 382
             return $result;
Please login to merge, or discard this patch.
app/Traits/CoupCodeAndInvoiceSearch.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -406,10 +406,12 @@  discard block
 block discarded – undo
406 406
 
407 407
     public function getAgents($agents, $productid, $plan)
408 408
     {
409
-        if (!$agents) {//If agents is not received in the request in the case when
409
+        if (!$agents) {
410
+//If agents is not received in the request in the case when
410 411
             // 'modify agent' is not allowed for the Product,get the no of Agents from the Plan Table.
411 412
             $planForAgent = Product::find($productid)->planRelation->find($plan);
412
-            if ($planForAgent) {//If Plan Exists For the Product ie not a Product without Plan
413
+            if ($planForAgent) {
414
+//If Plan Exists For the Product ie not a Product without Plan
413 415
                 $noOfAgents = $planForAgent->planPrice->first()->no_of_agents;
414 416
                 $agents = $noOfAgents ? $noOfAgents : 0; //If no. of Agents is specified then that,else 0(Unlimited Agents)
415 417
             } else {
@@ -422,7 +424,8 @@  discard block
 block discarded – undo
422 424
 
423 425
     public function getQuantity($qty, $productid, $plan)
424 426
     {
425
-        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.
427
+        if (!$qty) {
428
+//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.
426 429
             $planForQty = Product::find($productid)->planRelation->find($plan);
427 430
             if ($planForQty) {
428 431
                 $quantity = Product::find($productid)->planRelation->find($plan)->planPrice->first()->product_quantity;
Please login to merge, or discard this patch.