@@ -84,7 +84,8 @@ discard block |
||
| 84 | 84 | $getProductId = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=search |
| 85 | 85 | &search_type=product&search_keyword=$product_sku"); |
| 86 | 86 | $details = json_decode($getProductId); |
| 87 | - if ($details->api_error_detected == 0 && is_array($details->page_message)) {//This is not true if Product_sku is updated |
|
| 87 | + if ($details->api_error_detected == 0 && is_array($details->page_message)) { |
|
| 88 | +//This is not true if Product_sku is updated |
|
| 88 | 89 | $productId = $details->page_message[0]->product_id; |
| 89 | 90 | } |
| 90 | 91 | |
@@ -120,7 +121,8 @@ discard block |
||
| 120 | 121 | &search_type=client&search_keyword=$email"); |
| 121 | 122 | |
| 122 | 123 | $details = json_decode($getUserId); |
| 123 | - if ($details->api_error_detected == 0 && is_array($details->page_message)) {//This is not true if email is updated |
|
| 124 | + if ($details->api_error_detected == 0 && is_array($details->page_message)) { |
|
| 125 | +//This is not true if email is updated |
|
| 124 | 126 | $userId = $details->page_message[0]->client_id; |
| 125 | 127 | } |
| 126 | 128 | |
@@ -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 == '') { |
@@ -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 | } |
@@ -128,7 +129,8 @@ discard block |
||
| 128 | 129 | $attributes[] = $item->attributes; |
| 129 | 130 | $cart_currency = $attributes[0]['currency']['currency']; |
| 130 | 131 | \Session::put('currency', $cart_currency); |
| 131 | - if (\Auth::user()) {//If User is Loggen in and his currency changes after logginng in then remove his previous order from cart |
|
| 132 | + if (\Auth::user()) { |
|
| 133 | +//If User is Loggen in and his currency changes after logginng in then remove his previous order from cart |
|
| 132 | 134 | $currency = \Auth::user()->currency; |
| 133 | 135 | if ($cart_currency != $currency) { |
| 134 | 136 | $id = $item->id; |
@@ -175,8 +177,10 @@ discard block |
||
| 175 | 177 | $user_state = TaxByState::where('state_code', $geoip_state)->first(); |
| 176 | 178 | $origin_state = $this->setting->first()->state; //Get the State of origin |
| 177 | 179 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 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, |
@@ -219,7 +223,8 @@ discard block |
||
| 219 | 223 | ]); |
| 220 | 224 | } |
| 221 | 225 | } |
| 222 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 and other tax is available |
|
| 226 | + } elseif ($tax_enable == 0) { |
|
| 227 | +//If Tax enable is 0 and other tax is available |
|
| 223 | 228 | |
| 224 | 229 | $details = $this->whenOtherTaxAvailableAndTaxNotEnable($tax_class_id, $productid, $geoip_state, $geoip_country); |
| 225 | 230 | |
@@ -395,7 +400,8 @@ discard block |
||
| 395 | 400 | try { |
| 396 | 401 | $currency = Setting::find(1)->default_currency; |
| 397 | 402 | $currency_symbol = Setting::find(1)->default_symbol; |
| 398 | - if (!\Auth::user()) {//When user is not logged in |
|
| 403 | + if (!\Auth::user()) { |
|
| 404 | +//When user is not logged in |
|
| 399 | 405 | $cont = new \App\Http\Controllers\Front\PageController(); |
| 400 | 406 | $location = $cont->getLocation(); |
| 401 | 407 | $country = self::findCountryByGeoip($location['iso_code']); |
@@ -410,7 +416,8 @@ discard block |
||
| 410 | 416 | $currency = \Auth::user()->currency; |
| 411 | 417 | $currency_symbol = \Auth::user()->currency_symbol; |
| 412 | 418 | } |
| 413 | - if ($userid != '') {//For Admin Panel Clients |
|
| 419 | + if ($userid != '') { |
|
| 420 | +//For Admin Panel Clients |
|
| 414 | 421 | $currencyAndSymbol = self::getCurrency($userid); |
| 415 | 422 | $currency = $currencyAndSymbol['currency']; |
| 416 | 423 | $currency_symbol = $currencyAndSymbol['symbol']; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $orders = $order->where('client', $clientid)->get(); |
| 38 | 38 | |
| 39 | 39 | return view('themes.default1.invoice.newpayment', compact('clientid', 'client', 'invoices', 'orders', |
| 40 | - 'invoiceSum', 'amountReceived', 'pendingAmount', 'currency', 'symbol')); |
|
| 40 | + 'invoiceSum', 'amountReceived', 'pendingAmount', 'currency', 'symbol')); |
|
| 41 | 41 | } catch (Exception $ex) { |
| 42 | 42 | return redirect()->back()->with('fails', $ex->getMessage()); |
| 43 | 43 | } |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | public function postNewPayment($clientid, Request $request) |
| 47 | 47 | { |
| 48 | 48 | $this->validate($request, [ |
| 49 | - 'payment_date' => 'required', |
|
| 50 | - 'payment_method'=> 'required', |
|
| 51 | - 'amount' => 'required', |
|
| 49 | + 'payment_date' => 'required', |
|
| 50 | + 'payment_method'=> 'required', |
|
| 51 | + 'amount' => 'required', |
|
| 52 | 52 | ]); |
| 53 | 53 | |
| 54 | 54 | try { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $amtToCredit = $request->amtToCredit; |
| 114 | 114 | $payment_status = 'success'; |
| 115 | 115 | $payment = $this->multiplePayment($clientid,$invoiceChecked, $payment_method, |
| 116 | - $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
|
| 116 | + $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
|
| 117 | 117 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
| 118 | 118 | |
| 119 | 119 | return response()->json($response); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function multiplePayment($clientid,$invoiceChecked, $payment_method, |
| 133 | - $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
|
| 133 | + $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
|
| 134 | 134 | { |
| 135 | 135 | try { |
| 136 | 136 | foreach ($invoiceChecked as $key => $value) { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $amtToCredit = $request->amtToCredit; |
| 212 | 212 | $payment_status = 'success'; |
| 213 | 213 | $payment = $this->updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
| 214 | - $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
|
| 214 | + $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
|
| 215 | 215 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
| 216 | 216 | |
| 217 | 217 | return response()->json($response); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
| 228 | - $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
|
| 228 | + $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
|
| 229 | 229 | { |
| 230 | 230 | try { |
| 231 | 231 | $sum = 0; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | if ($key != 0) {//If Payment is linked to Invoice |
| 234 | 234 | $invoice = Invoice::find($value); |
| 235 | 235 | Payment::where('user_id', $clientid)->where('invoice_id', 0) |
| 236 | - ->update(['amt_to_credit'=>$amtToCredit]); |
|
| 236 | + ->update(['amt_to_credit'=>$amtToCredit]); |
|
| 237 | 237 | $invoice_status = 'pending'; |
| 238 | 238 | $payment = Payment::create([ |
| 239 | 239 | 'invoice_id' => $value, |
@@ -134,7 +134,8 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | try { |
| 136 | 136 | foreach ($invoiceChecked as $key => $value) { |
| 137 | - if ($key != 0) {//If Payment is linked to Invoice |
|
| 137 | + if ($key != 0) { |
|
| 138 | +//If Payment is linked to Invoice |
|
| 138 | 139 | $invoice = Invoice::find($value); |
| 139 | 140 | $invoice_status = 'pending'; |
| 140 | 141 | $payment = Payment::where('invoice_id', $value)->create([ |
@@ -159,7 +160,8 @@ discard block |
||
| 159 | 160 | $invoice->status = $invoice_status; |
| 160 | 161 | $invoice->save(); |
| 161 | 162 | } |
| 162 | - } elseif (count($invoiceChecked) == 1 || $amtToCredit > 0) {//If Payment is not linked to any invoice and is to be credited to User Accunt |
|
| 163 | + } elseif (count($invoiceChecked) == 1 || $amtToCredit > 0) { |
|
| 164 | +//If Payment is not linked to any invoice and is to be credited to User Accunt |
|
| 163 | 165 | $totalExtraSum = Payment::where('user_id', $clientid)->where('invoice_id', 0) |
| 164 | 166 | ->pluck('amt_to_credit')->first(); //Get the total Extra Amt Paid |
| 165 | 167 | if ($totalExtraSum) { |
@@ -230,7 +232,8 @@ discard block |
||
| 230 | 232 | try { |
| 231 | 233 | $sum = 0; |
| 232 | 234 | foreach ($invoiceChecked as $key => $value) { |
| 233 | - if ($key != 0) {//If Payment is linked to Invoice |
|
| 235 | + if ($key != 0) { |
|
| 236 | +//If Payment is linked to Invoice |
|
| 234 | 237 | $invoice = Invoice::find($value); |
| 235 | 238 | Payment::where('user_id', $clientid)->where('invoice_id', 0) |
| 236 | 239 | ->update(['amt_to_credit'=>$amtToCredit]); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $symbol = Currency::where('code', $currency)->pluck('symbol')->first(); |
| 37 | 37 | $orders = $order->where('client', $clientid)->get(); |
| 38 | 38 | |
| 39 | - return view('themes.default1.invoice.newpayment', compact('clientid', 'client', 'invoices', 'orders', |
|
| 39 | + return view('themes.default1.invoice.newpayment', compact('clientid', 'client', 'invoices', 'orders', |
|
| 40 | 40 | 'invoiceSum', 'amountReceived', 'pendingAmount', 'currency', 'symbol')); |
| 41 | 41 | } catch (Exception $ex) { |
| 42 | 42 | return redirect()->back()->with('fails', $ex->getMessage()); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $totalSum = array_sum($payment); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - return view('themes.default1.invoice.editInvoice', compact('userid','date','invoiceid', 'invoice', 'totalSum')); |
|
| 77 | + return view('themes.default1.invoice.editInvoice', compact('userid', 'date', 'invoiceid', 'invoice', 'totalSum')); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function postEdit($invoiceid, Request $request) |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $invoicAmount = $request->invoiceAmount; |
| 116 | 116 | $amtToCredit = $request->amtToCredit; |
| 117 | 117 | $payment_status = 'success'; |
| 118 | - $payment = $this->multiplePayment($clientid,$invoiceChecked, $payment_method, |
|
| 118 | + $payment = $this->multiplePayment($clientid, $invoiceChecked, $payment_method, |
|
| 119 | 119 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
| 120 | 120 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
| 121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - public function multiplePayment($clientid,$invoiceChecked, $payment_method, |
|
| 135 | + public function multiplePayment($clientid, $invoiceChecked, $payment_method, |
|
| 136 | 136 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
| 137 | 137 | { |
| 138 | 138 | try { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $invoicAmount = $request->invoiceAmount; |
| 214 | 214 | $amtToCredit = $request->amtToCredit; |
| 215 | 215 | $payment_status = 'success'; |
| 216 | - $payment = $this->updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
|
| 216 | + $payment = $this->updatePaymentByInvoice($clientid, $invoiceChecked, $payment_method, |
|
| 217 | 217 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
| 218 | 218 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
| 219 | 219 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - public function updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
|
| 230 | + public function updatePaymentByInvoice($clientid, $invoiceChecked, $payment_method, |
|
| 231 | 231 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
| 232 | 232 | { |
| 233 | 233 | try { |
@@ -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, |