@@ -47,7 +47,8 @@ |
||
47 | 47 | if ($url) { |
48 | 48 | $content = \Cart::getContent(); |
49 | 49 | $currency = (\Session::get('currency')); |
50 | - if (\Auth::user()->currency != $currency['currency']) {//If user currency is not equal to the cart currency then redirect to default url and clear his cart items and let the customer add the Product again so that the tax could be calculated properly |
|
50 | + if (\Auth::user()->currency != $currency['currency']) { |
|
51 | +//If user currency is not equal to the cart currency then redirect to default url and clear his cart items and let the customer add the Product again so that the tax could be calculated properly |
|
51 | 52 | foreach ($content as $key => $item) { |
52 | 53 | $id = $item->id; |
53 | 54 | Cart::remove($id); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | 'user_id', 'plan_id', 'order_id', 'deny_after_subscription', 'version', 'product_id', 'support_ends_at', ]; |
16 | 16 | protected $dates = ['ends_at']; |
17 | 17 | protected static $logName = 'Subscription'; |
18 | - protected static $logAttributes = ['ends_at', 'update_ends_at', 'support_ends_at', 'user_id', 'plan_id', 'order_id', 'version', 'product_id']; |
|
18 | + protected static $logAttributes = ['ends_at', 'update_ends_at', 'support_ends_at', 'user_id', 'plan_id', 'order_id', 'version', 'product_id']; |
|
19 | 19 | protected static $logOnlyDirty = true; |
20 | 20 | |
21 | 21 | public function getDescriptionForEvent(string $eventName): string |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $value = ''; |
171 | 171 | $value = $taxes->toArray()[0]['active'] ? |
172 | 172 | (TaxProductRelation::where('product_id', $productid) |
173 | - ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
173 | + ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
174 | 174 | |
175 | 175 | return $value; |
176 | 176 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $otherRate = 0; |
188 | 188 | $status = $taxes->toArray()[0]['active']; |
189 | 189 | if ($status && (TaxProductRelation::where('product_id', $productid) |
190 | - ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
190 | + ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
191 | 191 | $otherRate = Tax::where('tax_classes_id', $taxClassId)->first()->rate; |
192 | 192 | } |
193 | 193 | $value = $otherRate.'%'; |
@@ -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 == '') { |
@@ -125,7 +125,7 @@ |
||
125 | 125 | ]); |
126 | 126 | $this->createOrderInvoiceRelation($orderid, $invoice->id); |
127 | 127 | $items = $controller->createInvoiceItemsByAdmin($invoice->id, $product->id, |
128 | - $code, $cost, $currency, $qty = 1, $agents); |
|
128 | + $code, $cost, $currency, $qty = 1, $agents); |
|
129 | 129 | |
130 | 130 | return $items; |
131 | 131 | } catch (Exception $ex) { |
@@ -90,10 +90,12 @@ discard block |
||
90 | 90 | |
91 | 91 | public function getAgents($agents, $productid, $plan) |
92 | 92 | { |
93 | - if (!$agents) {//If agents is not received in the request in the case when |
|
93 | + if (!$agents) { |
|
94 | +//If agents is not received in the request in the case when |
|
94 | 95 | // 'modify agent' is not allowed for the Product,get the no of Agents from the Plan Table. |
95 | 96 | $planForAgent = Product::find($productid)->planRelation->find($plan); |
96 | - if ($planForAgent) {//If Plan Exists For the Product ie not a Product without Plan |
|
97 | + if ($planForAgent) { |
|
98 | +//If Plan Exists For the Product ie not a Product without Plan |
|
97 | 99 | $noOfAgents = $planForAgent->planPrice->first()->no_of_agents; |
98 | 100 | $agents = $noOfAgents ? $noOfAgents : 0; //If no. of Agents is specified then that,else 0(Unlimited Agents) |
99 | 101 | } else { |
@@ -106,7 +108,8 @@ discard block |
||
106 | 108 | |
107 | 109 | public function getQuantity($qty, $productid, $plan) |
108 | 110 | { |
109 | - 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. |
|
111 | + if (!$qty) { |
|
112 | +//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. |
|
110 | 113 | $planForQty = Product::find($productid)->planRelation->find($plan); |
111 | 114 | if ($planForQty) { |
112 | 115 | $quantity = Product::find($productid)->planRelation->find($plan)->planPrice->first()->product_quantity; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $paymentid = $request->input('id'); |
29 | 29 | $creditAmtUserId = $this->payment->where('id', $paymentid)->value('user_id'); |
30 | 30 | $creditAmt = $this->payment->where('user_id', $creditAmtUserId) |
31 | - ->where('invoice_id', '=', 0)->value('amt_to_credit'); |
|
31 | + ->where('invoice_id', '=', 0)->value('amt_to_credit'); |
|
32 | 32 | $invoices = $invoice->where('user_id', $creditAmtUserId)->orderBy('created_at', 'desc')->get(); |
33 | 33 | $cltCont = new \App\Http\Controllers\User\ClientController(); |
34 | 34 | $invoiceSum = $cltCont->getTotalInvoice($invoices); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $payment_method, |
62 | 62 | $invoiceid, |
63 | 63 | $amount, |
64 | - $parent_id = '', |
|
64 | + $parent_id = '', |
|
65 | 65 | $userid = '', |
66 | 66 | $payment_status = 'pending' |
67 | 67 | ) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $paymentRenewal = $this->updateInvoicePayment( |
160 | 160 | $invoiceid, |
161 | 161 | $payment_method, |
162 | - $payment_status, |
|
162 | + $payment_status, |
|
163 | 163 | $payment_date, |
164 | 164 | $amount |
165 | 165 | ); |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | |
218 | 218 | return view( |
219 | 219 | 'themes.default1.invoice.payment', |
220 | - compact( |
|
221 | - 'invoice_status', |
|
222 | - 'payment_status', |
|
223 | - 'payment_method', |
|
224 | - 'invoice_id', |
|
225 | - 'domain', |
|
226 | - 'invoice', |
|
227 | - 'userid' |
|
228 | - ) |
|
220 | + compact( |
|
221 | + 'invoice_status', |
|
222 | + 'payment_status', |
|
223 | + 'payment_method', |
|
224 | + 'invoice_id', |
|
225 | + 'domain', |
|
226 | + 'invoice', |
|
227 | + 'userid' |
|
228 | + ) |
|
229 | 229 | ); |
230 | 230 | } |
231 | 231 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function editUpdateExpiry(Request $request) |
23 | 23 | { |
24 | 24 | $this->validate($request, [ |
25 | - 'date' => 'required', |
|
25 | + 'date' => 'required', |
|
26 | 26 | ]); |
27 | 27 | |
28 | 28 | try { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function editLicenseExpiry(Request $request) |
68 | 68 | { |
69 | 69 | $this->validate($request, [ |
70 | - 'date' => 'required', |
|
70 | + 'date' => 'required', |
|
71 | 71 | ]); |
72 | 72 | |
73 | 73 | try { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function editSupportExpiry(Request $request) |
113 | 113 | { |
114 | 114 | $this->validate($request, [ |
115 | - 'date' => 'required', |
|
115 | + 'date' => 'required', |
|
116 | 116 | ]); |
117 | 117 | |
118 | 118 | try { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $status = $request->input('status'); |
61 | 61 | |
62 | 62 | return view('themes.default1.common.dashboard', compact('allowedCurrencies1','allowedCurrencies2','currency1Symbol','currency2Symbol','totalSalesCurrency2', 'totalSalesCurrency1', 'yearlySalesCurrency2', 'yearlySalesCurrency1', 'monthlySalesCurrency2', 'monthlySalesCurrency1', 'users','count_users', 'arraylists', 'productSoldlists','orders','subscriptions','invoices', 'products', 'arrayCountList', 'pendingPaymentCurrency2', 'pendingPaymentCurrency1', 'status','startSubscriptionDate', |
63 | - 'endSubscriptionDate')); |
|
63 | + 'endSubscriptionDate')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | // dd($currentYear,$currentMonth ); |
158 | 158 | $total = Invoice::whereYear('created_at', '=', $currentYear)->whereMonth('created_at', '=', $currentMonth) |
159 | 159 | ->where('currency', $allowedCurrencies1) |
160 | - ->where('status', '=', 'success') |
|
160 | + ->where('status', '=', 'success') |
|
161 | 161 | ->pluck('grand_total')->all(); |
162 | 162 | $grandTotal = array_sum($total); |
163 | 163 | |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | public function getAllUsers() |
205 | 205 | { |
206 | 206 | $allUsers = User::orderBy('created_at', 'desc')->where('active', 1)->where('mobile_verified', 1) |
207 | - ->take(20) |
|
208 | - ->get() |
|
209 | - ->toArray(); |
|
207 | + ->take(20) |
|
208 | + ->get() |
|
209 | + ->toArray(); |
|
210 | 210 | |
211 | 211 | return $allUsers; |
212 | 212 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $dayUtc = new Carbon('-30 days'); |
242 | 242 | $minus30Day = $dayUtc->toDateTimeString(); |
243 | 243 | $recentOrders = Order::where('created_at', '>', $minus30Day)->orderBy('created_at', 'desc') |
244 | - ->where('price_override', '>', 0)->get(); |
|
244 | + ->where('price_override', '>', 0)->get(); |
|
245 | 245 | |
246 | 246 | return $recentOrders; |
247 | 247 | } |
@@ -59,7 +59,7 @@ |
||
59 | 59 | $endSubscriptionDate = date('Y-m-d', strtotime('+3 months')); |
60 | 60 | $status = $request->input('status'); |
61 | 61 | |
62 | - return view('themes.default1.common.dashboard', compact('allowedCurrencies1','allowedCurrencies2','currency1Symbol','currency2Symbol','totalSalesCurrency2', 'totalSalesCurrency1', 'yearlySalesCurrency2', 'yearlySalesCurrency1', 'monthlySalesCurrency2', 'monthlySalesCurrency1', 'users','count_users', 'arraylists', 'productSoldlists','orders','subscriptions','invoices', 'products', 'arrayCountList', 'pendingPaymentCurrency2', 'pendingPaymentCurrency1', 'status','startSubscriptionDate', |
|
62 | + return view('themes.default1.common.dashboard', compact('allowedCurrencies1', 'allowedCurrencies2', 'currency1Symbol', 'currency2Symbol', 'totalSalesCurrency2', 'totalSalesCurrency1', 'yearlySalesCurrency2', 'yearlySalesCurrency1', 'monthlySalesCurrency2', 'monthlySalesCurrency1', 'users', 'count_users', 'arraylists', 'productSoldlists', 'orders', 'subscriptions', 'invoices', 'products', 'arrayCountList', 'pendingPaymentCurrency2', 'pendingPaymentCurrency1', 'status', 'startSubscriptionDate', |
|
63 | 63 | 'endSubscriptionDate')); |
64 | 64 | } |
65 | 65 |
@@ -178,13 +178,13 @@ discard block |
||
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 | $c_gst = $details['cgst']; |
189 | 189 | $s_gst = $details['sgst']; |
190 | 190 | $i_gst = $details['igst']; |
@@ -202,21 +202,21 @@ discard block |
||
202 | 202 | if ($taxes[0]) { |
203 | 203 | $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
204 | 204 | |
205 | - 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
205 | + 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
206 | 206 | 'state' => $state_code, 'origin_state'=>$origin_state, |
207 | - 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
207 | + 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
208 | 208 | |
209 | 209 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
210 | 210 | 'name' => 'no compound', 'type' => 'tax', |
211 | 211 | 'target' => 'item', 'value' => $value, |
212 | - ]); |
|
212 | + ]); |
|
213 | 213 | } else { |
214 | 214 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
215 | 215 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
216 | - 'name' => 'null', 'type' => 'tax', |
|
217 | - 'target' => 'item', 'value' => '0%', |
|
218 | - 'rate' => 0, 'tax_enable' =>0, |
|
219 | - ]); |
|
216 | + 'name' => 'null', 'type' => 'tax', |
|
217 | + 'target' => 'item', 'value' => '0%', |
|
218 | + 'rate' => 0, 'tax_enable' =>0, |
|
219 | + ]); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } elseif ($tax_enable == 0) {//If Tax enable is 0 and other tax is available |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | $subregion = \App\Model\Common\State::where('state_subdivision_code', $code)->first(); |
353 | 353 | if ($subregion) { |
354 | 354 | $result = ['id' => $subregion->state_subdivision_code, |
355 | - 'name' => $subregion->state_subdivision_name, ]; |
|
355 | + 'name' => $subregion->state_subdivision_name, ]; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | return $result; |
@@ -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; |
@@ -174,8 +176,10 @@ discard block |
||
174 | 176 | $user_state = TaxByState::where('state_code', $geoip_state)->first(); |
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 | - if (count($tax_class_id) > 0) {//If the product is allowed for tax (Check in tax_product relation table) |
|
178 | - if ($tax_enable == 1) {//If GST is Enabled |
|
179 | + if (count($tax_class_id) > 0) { |
|
180 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
181 | + if ($tax_enable == 1) { |
|
182 | +//If GST is Enabled |
|
179 | 183 | |
180 | 184 | $details = $this->getDetailsWhenUserStateIsIndian( |
181 | 185 | $user_state, |
@@ -218,7 +222,8 @@ discard block |
||
218 | 222 | ]); |
219 | 223 | } |
220 | 224 | } |
221 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 and other tax is available |
|
225 | + } elseif ($tax_enable == 0) { |
|
226 | +//If Tax enable is 0 and other tax is available |
|
222 | 227 | |
223 | 228 | $details = $this->whenOtherTaxAvailableAndTaxNotEnable($tax_class_id, $productid, $geoip_state, $geoip_country); |
224 | 229 | |
@@ -394,7 +399,8 @@ discard block |
||
394 | 399 | try { |
395 | 400 | $currency = Setting::find(1)->default_currency; |
396 | 401 | $currency_symbol = Setting::find(1)->default_symbol; |
397 | - if (!\Auth::user()) {//When user is not logged in |
|
402 | + if (!\Auth::user()) { |
|
403 | +//When user is not logged in |
|
398 | 404 | $cont = new \App\Http\Controllers\Front\PageController(); |
399 | 405 | $location = $cont->getLocation(); |
400 | 406 | $country = self::findCountryByGeoip($location['iso_code']); |
@@ -409,7 +415,8 @@ discard block |
||
409 | 415 | $currency = \Auth::user()->currency; |
410 | 416 | $currency_symbol = \Auth::user()->currency_symbol; |
411 | 417 | } |
412 | - if ($userid != '') {//For Admin Panel Clients |
|
418 | + if ($userid != '') { |
|
419 | +//For Admin Panel Clients |
|
413 | 420 | $currencyAndSymbol = self::getCurrency($userid); |
414 | 421 | $currency = $currencyAndSymbol['currency']; |
415 | 422 | $currency_symbol = $currencyAndSymbol['symbol']; |
@@ -275,7 +275,7 @@ |
||
275 | 275 | $data = $template->data; |
276 | 276 | $replace = [ |
277 | 277 | 'name' => $user->first_name.' '.$user->last_name, |
278 | - 'serialkeyurl' => $myaccounturl, |
|
278 | + 'serialkeyurl' => $myaccounturl, |
|
279 | 279 | 'downloadurl' => $downloadurl, |
280 | 280 | 'invoiceurl' => $invoiceurl, |
281 | 281 | 'product' => $product, |