@@ -12,7 +12,7 @@ |
||
| 12 | 12 | protected $fillable = ['tax_enable', 'inclusive', 'shop_inclusive', 'cart_inclusive', 'rounding', 'Gst_no']; |
| 13 | 13 | protected static $logName = 'Tax Class'; |
| 14 | 14 | protected static $logAttributes = ['tax_enable', 'inclusive', |
| 15 | - 'shop_inclusive', 'cart_inclusive', 'rounding', 'Gst_no']; |
|
| 15 | + 'shop_inclusive', 'cart_inclusive', 'rounding', 'Gst_no']; |
|
| 16 | 16 | protected static $logOnlyDirty = true; |
| 17 | 17 | |
| 18 | 18 | public function getDescriptionForEvent(string $eventName): string |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $items = ['id' => $id, 'name' => $productName, 'price' => $actualPrice, |
| 241 | - 'quantity' => $qty, 'attributes' => ['currency' => [[$currency]]]]; |
|
| 241 | + 'quantity' => $qty, 'attributes' => ['currency' => [[$currency]]]]; |
|
| 242 | 242 | $items = array_merge($items, $taxConditions); |
| 243 | 243 | |
| 244 | 244 | return $items; |
@@ -367,9 +367,9 @@ discard block |
||
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - /** |
|
| 371 | - * @throws \Exception |
|
| 372 | - */ |
|
| 370 | + /** |
|
| 371 | + * @throws \Exception |
|
| 372 | + */ |
|
| 373 | 373 | public function removePlanSession() |
| 374 | 374 | { |
| 375 | 375 | try { |
@@ -197,147 +197,147 @@ discard block |
||
| 197 | 197 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 198 | 198 | |
| 199 | 199 | if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
| 200 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 201 | - |
|
| 202 | - $state_code = ''; |
|
| 203 | - $c_gst = ''; |
|
| 204 | - $s_gst = ''; |
|
| 205 | - $i_gst = ''; |
|
| 206 | - $ut_gst = ''; |
|
| 207 | - $value = ''; |
|
| 208 | - $rate = ''; |
|
| 209 | - $status = 1; |
|
| 210 | - |
|
| 211 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 212 | - $c_gst = $user_state->c_gst; |
|
| 213 | - $s_gst = $user_state->s_gst; |
|
| 214 | - $i_gst = $user_state->i_gst; |
|
| 215 | - $ut_gst = $user_state->ut_gst; |
|
| 216 | - $state_code = $user_state->state_code; |
|
| 217 | - |
|
| 218 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 219 | - $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 200 | + if ($tax_enable == 1) {//If GST is Enabled |
|
| 201 | + |
|
| 202 | + $state_code = ''; |
|
| 203 | + $c_gst = ''; |
|
| 204 | + $s_gst = ''; |
|
| 205 | + $i_gst = ''; |
|
| 206 | + $ut_gst = ''; |
|
| 207 | + $value = ''; |
|
| 208 | + $rate = ''; |
|
| 209 | + $status = 1; |
|
| 210 | + |
|
| 211 | + if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 212 | + $c_gst = $user_state->c_gst; |
|
| 213 | + $s_gst = $user_state->s_gst; |
|
| 214 | + $i_gst = $user_state->i_gst; |
|
| 215 | + $ut_gst = $user_state->ut_gst; |
|
| 216 | + $state_code = $user_state->state_code; |
|
| 217 | + |
|
| 218 | + if ($state_code == $origin_state) {//If user and origin state are same |
|
| 219 | + $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 220 | 220 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 221 | 221 | |
| 222 | - $taxes = $rateForSameState['taxes']; |
|
| 223 | - $status = $rateForSameState['status']; |
|
| 224 | - $value = $rateForSameState['value']; |
|
| 225 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 226 | - $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 222 | + $taxes = $rateForSameState['taxes']; |
|
| 223 | + $status = $rateForSameState['status']; |
|
| 224 | + $value = $rateForSameState['value']; |
|
| 225 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 226 | + $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 227 | 227 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 228 | - $taxes = $rateForOtherState['taxes']; |
|
| 229 | - $status = $rateForOtherState['status']; |
|
| 230 | - $value = $rateForOtherState['value']; |
|
| 231 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 232 | - $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 228 | + $taxes = $rateForOtherState['taxes']; |
|
| 229 | + $status = $rateForOtherState['status']; |
|
| 230 | + $value = $rateForOtherState['value']; |
|
| 231 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 232 | + $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 233 | 233 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 234 | - $taxes = $rateForUnionTerritory['taxes']; |
|
| 235 | - $status = $rateForUnionTerritory['status']; |
|
| 236 | - $value = $rateForUnionTerritory['value']; |
|
| 237 | - } |
|
| 238 | - } else {//If user from other Country |
|
| 239 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 240 | - ->orWhere('country', $geoip_country) |
|
| 241 | - ->pluck('tax_classes_id')->first(); |
|
| 242 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 243 | - $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 234 | + $taxes = $rateForUnionTerritory['taxes']; |
|
| 235 | + $status = $rateForUnionTerritory['status']; |
|
| 236 | + $value = $rateForUnionTerritory['value']; |
|
| 237 | + } |
|
| 238 | + } else {//If user from other Country |
|
| 239 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 240 | + ->orWhere('country', $geoip_country) |
|
| 241 | + ->pluck('tax_classes_id')->first(); |
|
| 242 | + if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 243 | + $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 244 | 244 | $productid, $status); |
| 245 | - $taxes = $taxForSpecificCountry['taxes']; |
|
| 246 | - $status = $taxForSpecificCountry['status']; |
|
| 247 | - $value = $taxForSpecificCountry['value']; |
|
| 248 | - $rate = $taxForSpecificCountry['value']; |
|
| 249 | - } else {//if Tax is selected for Any Country Any State |
|
| 250 | - $taxClassId = Tax::where('country', '') |
|
| 251 | - ->where('state', 'Any State') |
|
| 252 | - ->pluck('tax_classes_id')->first(); |
|
| 253 | - if ($taxClassId) { |
|
| 254 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 255 | - $taxes = $taxForAnyCountry['taxes']; |
|
| 256 | - $status = $taxForAnyCountry['status']; |
|
| 257 | - $value = $taxForAnyCountry['value']; |
|
| 258 | - $rate = $taxForAnyCountry['value']; |
|
| 259 | - } else { |
|
| 260 | - $taxes = [0]; |
|
| 261 | - } |
|
| 262 | - } |
|
| 263 | - } |
|
| 264 | - foreach ($taxes as $key => $tax) { |
|
| 245 | + $taxes = $taxForSpecificCountry['taxes']; |
|
| 246 | + $status = $taxForSpecificCountry['status']; |
|
| 247 | + $value = $taxForSpecificCountry['value']; |
|
| 248 | + $rate = $taxForSpecificCountry['value']; |
|
| 249 | + } else {//if Tax is selected for Any Country Any State |
|
| 250 | + $taxClassId = Tax::where('country', '') |
|
| 251 | + ->where('state', 'Any State') |
|
| 252 | + ->pluck('tax_classes_id')->first(); |
|
| 253 | + if ($taxClassId) { |
|
| 254 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 255 | + $taxes = $taxForAnyCountry['taxes']; |
|
| 256 | + $status = $taxForAnyCountry['status']; |
|
| 257 | + $value = $taxForAnyCountry['value']; |
|
| 258 | + $rate = $taxForAnyCountry['value']; |
|
| 259 | + } else { |
|
| 260 | + $taxes = [0]; |
|
| 261 | + } |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + foreach ($taxes as $key => $tax) { |
|
| 265 | 265 | |
| 266 | 266 | //All the da a attribute that is sent to the checkout Page if tax_compound=0 |
| 267 | - if ($taxes[0]) { |
|
| 268 | - $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 269 | - 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 267 | + if ($taxes[0]) { |
|
| 268 | + $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 269 | + 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 270 | 270 | 'state' => $state_code, 'origin_state'=>$origin_state, |
| 271 | - 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 271 | + 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 272 | 272 | |
| 273 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 273 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 274 | 274 | |
| 275 | 275 | 'name' => 'no compound', |
| 276 | 276 | 'type' => 'tax', |
| 277 | 277 | 'target' => 'item', |
| 278 | 278 | 'value' => $value, |
| 279 | - ]); |
|
| 280 | - } else { |
|
| 281 | - $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 282 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 283 | - 'name' => 'null', |
|
| 284 | - 'type' => 'tax', |
|
| 285 | - 'target' => 'item', |
|
| 286 | - 'value' => '0%', |
|
| 287 | - ]); |
|
| 288 | - } |
|
| 289 | - } |
|
| 290 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 291 | - $status = 1; |
|
| 292 | - if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 293 | - $taxClassId = Tax::where('country', '') |
|
| 294 | - ->where('state', 'Any State') |
|
| 295 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 296 | - // other tax is available and tax is not enabled |
|
| 297 | - if ($taxClassId) { |
|
| 298 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 299 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 300 | - if ($value == 0) { |
|
| 301 | - $status = 0; |
|
| 302 | - } |
|
| 303 | - $rate = $value; |
|
| 304 | - foreach ($taxes as $key => $tax) { |
|
| 305 | - $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 306 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 279 | + ]); |
|
| 280 | + } else { |
|
| 281 | + $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 282 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 283 | + 'name' => 'null', |
|
| 284 | + 'type' => 'tax', |
|
| 285 | + 'target' => 'item', |
|
| 286 | + 'value' => '0%', |
|
| 287 | + ]); |
|
| 288 | + } |
|
| 289 | + } |
|
| 290 | + } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 291 | + $status = 1; |
|
| 292 | + if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 293 | + $taxClassId = Tax::where('country', '') |
|
| 294 | + ->where('state', 'Any State') |
|
| 295 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 296 | + // other tax is available and tax is not enabled |
|
| 297 | + if ($taxClassId) { |
|
| 298 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 299 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 300 | + if ($value == 0) { |
|
| 301 | + $status = 0; |
|
| 302 | + } |
|
| 303 | + $rate = $value; |
|
| 304 | + foreach ($taxes as $key => $tax) { |
|
| 305 | + $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 306 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 307 | 307 | |
| 308 | 308 | 'name' => $tax->name, |
| 309 | 309 | 'type' => 'tax', |
| 310 | 310 | 'target' => 'item', |
| 311 | 311 | 'value' => $value, |
| 312 | 312 | ]); |
| 313 | - } |
|
| 314 | - } else {//In case of other country |
|
| 315 | - //when tax is available and tax is not enabled |
|
| 316 | - //(Applicable when Global Tax class for any country and state is not there) |
|
| 317 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 318 | - ->orWhere('country', $geoip_country) |
|
| 319 | - ->pluck('tax_classes_id')->first(); |
|
| 320 | - if ($taxClassId) { //if state equals the user State |
|
| 321 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 322 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 323 | - if ($value == '') { |
|
| 324 | - $status = 0; |
|
| 325 | - } |
|
| 326 | - $rate = $value; |
|
| 327 | - } |
|
| 328 | - foreach ($taxes as $key => $tax) { |
|
| 329 | - $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 330 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 313 | + } |
|
| 314 | + } else {//In case of other country |
|
| 315 | + //when tax is available and tax is not enabled |
|
| 316 | + //(Applicable when Global Tax class for any country and state is not there) |
|
| 317 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 318 | + ->orWhere('country', $geoip_country) |
|
| 319 | + ->pluck('tax_classes_id')->first(); |
|
| 320 | + if ($taxClassId) { //if state equals the user State |
|
| 321 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 322 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 323 | + if ($value == '') { |
|
| 324 | + $status = 0; |
|
| 325 | + } |
|
| 326 | + $rate = $value; |
|
| 327 | + } |
|
| 328 | + foreach ($taxes as $key => $tax) { |
|
| 329 | + $tax_attribute[$key] = ['name' => $tax->name, 'rate' => $value, 'tax_enable'=>0, 'status' => $status]; |
|
| 330 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 331 | 331 | |
| 332 | 332 | 'name' => $tax->name, |
| 333 | 333 | 'type' => 'tax', |
| 334 | 334 | 'target' => 'item', |
| 335 | 335 | 'value' => $value, |
| 336 | 336 | ]); |
| 337 | - } |
|
| 338 | - } |
|
| 339 | - } |
|
| 340 | - } |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | 341 | } else { |
| 342 | 342 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
| 343 | 343 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $value = ''; |
| 417 | 417 | $value = $taxes->toArray()[0]['active'] ? |
| 418 | 418 | (TaxProductRelation::where('product_id', $productid) |
| 419 | - ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 419 | + ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 420 | 420 | |
| 421 | 421 | return $value; |
| 422 | 422 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $otherRate = 0; |
| 436 | 436 | $status = $taxes->toArray()[0]['active']; |
| 437 | 437 | if ($status && (TaxProductRelation::where('product_id', $productid) |
| 438 | - ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 438 | + ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 439 | 439 | $otherRate = Tax::where('tax_classes_id', $taxClassId)->first()->rate; |
| 440 | 440 | } |
| 441 | 441 | |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | $subregion = \App\Model\Common\State::where('state_subdivision_code', $code)->first(); |
| 725 | 725 | if ($subregion) { |
| 726 | 726 | $result = ['id' => $subregion->state_subdivision_code, |
| 727 | - 'name' => $subregion->state_subdivision_name]; |
|
| 727 | + 'name' => $subregion->state_subdivision_name]; |
|
| 728 | 728 | } |
| 729 | 729 | } |
| 730 | 730 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return $model->number; |
| 83 | 83 | }) |
| 84 | 84 | ->addColumn('date', function ($model) { |
| 85 | - $date = $model->created_at; |
|
| 85 | + $date = $model->created_at; |
|
| 86 | 86 | |
| 87 | 87 | return $date; |
| 88 | 88 | // $myobject->created_at->timezone($this->auth->user()->timezone); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | try { |
| 131 | 131 | $versions = ProductUpload::where('product_id', $productid) |
| 132 | 132 | ->select('id', 'product_id', 'version', |
| 133 | - 'title', 'description', 'file', 'created_at')->get(); |
|
| 133 | + 'title', 'description', 'file', 'created_at')->get(); |
|
| 134 | 134 | |
| 135 | 135 | return \DataTables::of($versions) |
| 136 | 136 | ->addColumn('id', function ($versions) { |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | return $model->grand_total; |
| 393 | 393 | }) |
| 394 | 394 | ->rawColumns(['checkbox', 'number', 'total', |
| 395 | - 'payment_method', 'payment_status', 'created_at', ]) |
|
| 395 | + 'payment_method', 'payment_status', 'created_at', ]) |
|
| 396 | 396 | ->make(true); |
| 397 | 397 | } catch (Exception $ex) { |
| 398 | 398 | Bugsnag::notifyException($ex); |
@@ -418,17 +418,17 @@ discard block |
||
| 418 | 418 | ->addColumn('number', function ($model) { |
| 419 | 419 | return $model->invoice()->first()->number; |
| 420 | 420 | }) |
| 421 | - ->addColumn('total', function ($model) { |
|
| 422 | - return $model->amount; |
|
| 423 | - }) |
|
| 424 | - ->addColumn('created_at', function ($model) { |
|
| 425 | - $date1 = new DateTime($model->created_at); |
|
| 426 | - $tz = \Auth::user()->timezone()->first()->name; |
|
| 427 | - $date1->setTimezone(new DateTimeZone($tz)); |
|
| 428 | - $date = $date1->format('M j, Y, g:i a'); |
|
| 429 | - |
|
| 430 | - return $date; |
|
| 431 | - }) |
|
| 421 | + ->addColumn('total', function ($model) { |
|
| 422 | + return $model->amount; |
|
| 423 | + }) |
|
| 424 | + ->addColumn('created_at', function ($model) { |
|
| 425 | + $date1 = new DateTime($model->created_at); |
|
| 426 | + $tz = \Auth::user()->timezone()->first()->name; |
|
| 427 | + $date1->setTimezone(new DateTimeZone($tz)); |
|
| 428 | + $date = $date1->format('M j, Y, g:i a'); |
|
| 429 | + |
|
| 430 | + return $date; |
|
| 431 | + }) |
|
| 432 | 432 | |
| 433 | 433 | ->addColumn('payment_method', 'payment_status', 'created_at') |
| 434 | 434 | |
@@ -78,20 +78,20 @@ discard block |
||
| 78 | 78 | ->select('number', 'created_at', 'grand_total', 'id', 'status'); |
| 79 | 79 | |
| 80 | 80 | return \DataTables::of($invoices->get()) |
| 81 | - ->addColumn('number', function ($model) { |
|
| 81 | + ->addColumn('number', function($model) { |
|
| 82 | 82 | return $model->number; |
| 83 | 83 | }) |
| 84 | - ->addColumn('date', function ($model) { |
|
| 84 | + ->addColumn('date', function($model) { |
|
| 85 | 85 | $date = $model->created_at; |
| 86 | 86 | |
| 87 | 87 | return $date; |
| 88 | 88 | // $myobject->created_at->timezone($this->auth->user()->timezone); |
| 89 | 89 | }) |
| 90 | 90 | // ->showColumns('created_at') |
| 91 | - ->addColumn('total', function ($model) { |
|
| 91 | + ->addColumn('total', function($model) { |
|
| 92 | 92 | return $model->grand_total; |
| 93 | 93 | }) |
| 94 | - ->addColumn('Action', function ($model) { |
|
| 94 | + ->addColumn('Action', function($model) { |
|
| 95 | 95 | $status = $model->status; |
| 96 | 96 | $payment = ''; |
| 97 | 97 | if ($status == 'Pending' && $model->grand_total > 0) { |
@@ -133,19 +133,19 @@ discard block |
||
| 133 | 133 | 'title', 'description', 'file', 'created_at')->get(); |
| 134 | 134 | |
| 135 | 135 | return \DataTables::of($versions) |
| 136 | - ->addColumn('id', function ($versions) { |
|
| 136 | + ->addColumn('id', function($versions) { |
|
| 137 | 137 | return ucfirst($versions->id); |
| 138 | 138 | }) |
| 139 | - ->addColumn('version', function ($versions) { |
|
| 139 | + ->addColumn('version', function($versions) { |
|
| 140 | 140 | return ucfirst($versions->version); |
| 141 | 141 | }) |
| 142 | - ->addColumn('title', function ($versions) { |
|
| 142 | + ->addColumn('title', function($versions) { |
|
| 143 | 143 | return ucfirst($versions->title); |
| 144 | 144 | }) |
| 145 | - ->addColumn('description', function ($versions) { |
|
| 145 | + ->addColumn('description', function($versions) { |
|
| 146 | 146 | return ucfirst($versions->description); |
| 147 | 147 | }) |
| 148 | - ->addColumn('file', function ($versions) use ($clientid, $invoiceid, $productid) { |
|
| 148 | + ->addColumn('file', function($versions) use ($clientid, $invoiceid, $productid) { |
|
| 149 | 149 | $invoice_id = Invoice::where('number', $invoiceid)->pluck('id')->first(); |
| 150 | 150 | $order = Order::where('invoice_id', '=', $invoice_id)->first(); |
| 151 | 151 | $order_id = $order->id; |
@@ -194,18 +194,18 @@ discard block |
||
| 194 | 194 | $link = (array_slice($link, 0, 10, true)); |
| 195 | 195 | |
| 196 | 196 | return \DataTables::of($link) |
| 197 | - ->addColumn('version', function ($link) { |
|
| 197 | + ->addColumn('version', function($link) { |
|
| 198 | 198 | return ucfirst($link['tag_name']); |
| 199 | 199 | }) |
| 200 | - ->addColumn('name', function ($link) { |
|
| 200 | + ->addColumn('name', function($link) { |
|
| 201 | 201 | return ucfirst($link['name']); |
| 202 | 202 | }) |
| 203 | - ->addColumn('description', function ($link) { |
|
| 203 | + ->addColumn('description', function($link) { |
|
| 204 | 204 | $markdown = Markdown::convertToHtml(ucfirst($link['body'])); |
| 205 | 205 | |
| 206 | 206 | return $markdown; |
| 207 | 207 | }) |
| 208 | - ->addColumn('file', function ($link) use ($invoiceid, $productid) { |
|
| 208 | + ->addColumn('file', function($link) use ($invoiceid, $productid) { |
|
| 209 | 209 | $order = Order::where('invoice_id', '=', $invoiceid)->first(); |
| 210 | 210 | $order_id = $order->id; |
| 211 | 211 | $orderEndDate = Subscription::select('ends_at')->where('product_id', $productid)->where('order_id', $order_id)->first(); |
@@ -251,20 +251,20 @@ discard block |
||
| 251 | 251 | $orders = Order::where('client', \Auth::user()->id); |
| 252 | 252 | |
| 253 | 253 | return \DataTables::of($orders->get()) |
| 254 | - ->addColumn('id', function ($model) { |
|
| 254 | + ->addColumn('id', function($model) { |
|
| 255 | 255 | return $model->id; |
| 256 | 256 | }) |
| 257 | - ->addColumn('product_name', function ($model) { |
|
| 257 | + ->addColumn('product_name', function($model) { |
|
| 258 | 258 | return $model->product()->first()->name; |
| 259 | 259 | }) |
| 260 | - ->addColumn('expiry', function ($model) { |
|
| 260 | + ->addColumn('expiry', function($model) { |
|
| 261 | 261 | $tz = \Auth::user()->timezone()->first()->name; |
| 262 | 262 | $end = $this->getExpiryDate($model); |
| 263 | 263 | |
| 264 | 264 | return $end; |
| 265 | 265 | }) |
| 266 | 266 | |
| 267 | - ->addColumn('Action', function ($model) { |
|
| 267 | + ->addColumn('Action', function($model) { |
|
| 268 | 268 | $sub = $model->subscription()->first(); |
| 269 | 269 | $order = Order::where('id', $model->id)->select('product')->first(); |
| 270 | 270 | $productid = $order->product; |
@@ -378,17 +378,17 @@ discard block |
||
| 378 | 378 | ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at'); |
| 379 | 379 | |
| 380 | 380 | return \DataTables::of($payments->get()) |
| 381 | - ->addColumn('checkbox', function ($model) { |
|
| 381 | + ->addColumn('checkbox', function($model) { |
|
| 382 | 382 | if (\Input::get('client') != 'true') { |
| 383 | 383 | return "<input type='checkbox' class='payment_checkbox' |
| 384 | 384 | value=".$model->id.' name=select[] id=check>'; |
| 385 | 385 | } |
| 386 | 386 | }) |
| 387 | - ->addColumn('number', function ($model) { |
|
| 387 | + ->addColumn('number', function($model) { |
|
| 388 | 388 | return $model->invoice()->first()->number; |
| 389 | 389 | }) |
| 390 | 390 | ->addColumn('amount', 'payment_method', 'payment_status', 'created_at') |
| 391 | - ->addColumn('total', function ($model) { |
|
| 391 | + ->addColumn('total', function($model) { |
|
| 392 | 392 | return $model->grand_total; |
| 393 | 393 | }) |
| 394 | 394 | ->rawColumns(['checkbox', 'number', 'total', |
@@ -415,13 +415,13 @@ discard block |
||
| 415 | 415 | ->select('id', 'invoice_id', 'user_id', 'payment_method', 'payment_status', 'created_at', 'amount'); |
| 416 | 416 | //dd(\Input::all()); |
| 417 | 417 | return \DataTables::of($payments->get()) |
| 418 | - ->addColumn('number', function ($model) { |
|
| 418 | + ->addColumn('number', function($model) { |
|
| 419 | 419 | return $model->invoice()->first()->number; |
| 420 | 420 | }) |
| 421 | - ->addColumn('total', function ($model) { |
|
| 421 | + ->addColumn('total', function($model) { |
|
| 422 | 422 | return $model->amount; |
| 423 | 423 | }) |
| 424 | - ->addColumn('created_at', function ($model) { |
|
| 424 | + ->addColumn('created_at', function($model) { |
|
| 425 | 425 | $date1 = new DateTime($model->created_at); |
| 426 | 426 | $tz = \Auth::user()->timezone()->first()->name; |
| 427 | 427 | $date1->setTimezone(new DateTimeZone($tz)); |
@@ -245,13 +245,13 @@ |
||
| 245 | 245 | return view('themes.default1.front.postCheckout', |
| 246 | 246 | compact('amount', 'invoice_no', ' invoiceid', ' payment_method', |
| 247 | 247 | 'phone', 'invoice', 'items', 'product', 'paynow', 'attributes', |
| 248 | - 'rzp_key','rzp_secret','apilayer_key')); |
|
| 248 | + 'rzp_key', 'rzp_secret', 'apilayer_key')); |
|
| 249 | 249 | } else { |
| 250 | 250 | $action = $this->checkoutAction($invoice); |
| 251 | 251 | $check_product_category = $this->product($invoiceid); |
| 252 | 252 | $url = ''; |
| 253 | 253 | if ($check_product_category->category) { |
| 254 | - $url = view('themes.default1.front.postCheckoutTemplate', compact('invoice','date', |
|
| 254 | + $url = view('themes.default1.front.postCheckoutTemplate', compact('invoice', 'date', |
|
| 255 | 255 | 'product', 'items', 'attributes', 'state'))->render(); |
| 256 | 256 | } |
| 257 | 257 | \Cart::clear(); |
@@ -151,8 +151,8 @@ |
||
| 151 | 151 | $user_id = $this->order->find($orderid)->client; |
| 152 | 152 | $this->subscription->create(['user_id' => $user_id, |
| 153 | 153 | 'plan_id' => $planid, 'order_id' => $orderid, 'ends_at' => $ends_at, |
| 154 | - 'version' => $version, 'product_id' =>$product]); |
|
| 155 | - } |
|
| 154 | + 'version' => $version, 'product_id' =>$product]); |
|
| 155 | + } |
|
| 156 | 156 | } catch (\Exception $ex) { |
| 157 | 157 | Bugsnag::notifyException($ex); |
| 158 | 158 | |
@@ -120,21 +120,21 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 122 | 122 | }) |
| 123 | - ->addColumn('number', function ($model) { |
|
| 124 | - return ucfirst($model->number); |
|
| 125 | - }) |
|
| 123 | + ->addColumn('number', function ($model) { |
|
| 124 | + return ucfirst($model->number); |
|
| 125 | + }) |
|
| 126 | 126 | |
| 127 | 127 | ->addColumn('date', function ($model) { |
| 128 | 128 | $date = date_create($model->created_at); |
| 129 | 129 | |
| 130 | 130 | return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 131 | 131 | }) |
| 132 | - ->addColumn('grand_total', function ($model) { |
|
| 133 | - return ucfirst($model->number); |
|
| 134 | - }) |
|
| 135 | - ->addColumn('status', function ($model) { |
|
| 136 | - return ucfirst($model->status); |
|
| 137 | - }) |
|
| 132 | + ->addColumn('grand_total', function ($model) { |
|
| 133 | + return ucfirst($model->number); |
|
| 134 | + }) |
|
| 135 | + ->addColumn('status', function ($model) { |
|
| 136 | + return ucfirst($model->status); |
|
| 137 | + }) |
|
| 138 | 138 | |
| 139 | 139 | ->addColumn('action', function ($model) { |
| 140 | 140 | $action = ''; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ." $action"; |
| 149 | 149 | }) |
| 150 | 150 | |
| 151 | - ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 151 | + ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 152 | 152 | ->make(true); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -471,8 +471,8 @@ discard block |
||
| 471 | 471 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
| 472 | 472 | |
| 473 | 473 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 474 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 475 | - //other tax is available and tax is not enabled |
|
| 474 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 475 | + //other tax is available and tax is not enabled |
|
| 476 | 476 | if ($taxClassId) { |
| 477 | 477 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 478 | 478 | $taxs = $rate['taxes']; |
@@ -539,10 +539,10 @@ discard block |
||
| 539 | 539 | foreach ($taxes as $key => $tax) { |
| 540 | 540 | if ($taxes[0]) { |
| 541 | 541 | $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1, |
| 542 | - 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 543 | - 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 544 | - 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 545 | - 'origin_state' => $origin_state, ]; |
|
| 542 | + 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 543 | + 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 544 | + 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 545 | + 'origin_state' => $origin_state, ]; |
|
| 546 | 546 | |
| 547 | 547 | $rate = $tax->rate; |
| 548 | 548 | |
@@ -747,8 +747,8 @@ discard block |
||
| 747 | 747 | } |
| 748 | 748 | |
| 749 | 749 | return view('themes.default1.invoice.payment', |
| 750 | - compact('invoice_status', 'payment_status', |
|
| 751 | - 'payment_method', 'invoice_id', 'domain', 'invoice')); |
|
| 750 | + compact('invoice_status', 'payment_status', |
|
| 751 | + 'payment_method', 'invoice_id', 'domain', 'invoice')); |
|
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | return redirect()->back(); |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | case 1: |
| 787 | 787 | $percentage = $price * ($value / 100); |
| 788 | 788 | |
| 789 | - return $price - $percentage; |
|
| 789 | + return $price - $percentage; |
|
| 790 | 790 | case 2: |
| 791 | 791 | return $price - $value; |
| 792 | 792 | case 3: |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | $payment_date = \Carbon\Carbon::now()->toDateTimeString(); |
| 805 | 805 | $amount = $grand_total; |
| 806 | 806 | $paymentRenewal = $this->updateInvoicePayment($invoiceid, $payment_method, |
| 807 | - $payment_status, $payment_date, $amount); |
|
| 807 | + $payment_status, $payment_date, $amount); |
|
| 808 | 808 | |
| 809 | 809 | return redirect()->back()->with('success', 'Payment Accepted Successfully'); |
| 810 | 810 | } catch (\Exception $ex) { |
@@ -468,7 +468,8 @@ discard block |
||
| 468 | 468 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 469 | 469 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 470 | 470 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 471 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 471 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 472 | +//if tax_enable is 0 |
|
| 472 | 473 | |
| 473 | 474 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 474 | 475 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -477,12 +478,14 @@ discard block |
||
| 477 | 478 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 478 | 479 | $taxs = $rate['taxes']; |
| 479 | 480 | $rate = $rate['rate']; |
| 480 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 481 | + } elseif ($geoip_country != 'IN') { |
|
| 482 | +//In case of other country |
|
| 481 | 483 | // when tax is available and tax is not enabled(Applicable |
| 482 | 484 | //when Global Tax class for any country and state is not there) |
| 483 | 485 | |
| 484 | 486 | $taxClassId = Tax::where('state', $geoip_state)->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 485 | - if ($taxClassId) { //if state equals the user State |
|
| 487 | + if ($taxClassId) { |
|
| 488 | +//if state equals the user State |
|
| 486 | 489 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 487 | 490 | $taxs = $rate['taxes']; |
| 488 | 491 | $rate = $rate['rate']; |
@@ -525,11 +528,13 @@ discard block |
||
| 525 | 528 | $i_gst = 0; |
| 526 | 529 | $ut_gst = 0; |
| 527 | 530 | $state_code = ''; |
| 528 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 531 | + if ($user_state != '') { |
|
| 532 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 529 | 533 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 530 | 534 | $taxes = $tax['taxes']; |
| 531 | 535 | $value = $tax['value']; |
| 532 | - } else {//If user from other Country |
|
| 536 | + } else { |
|
| 537 | +//If user from other Country |
|
| 533 | 538 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 534 | 539 | $taxes = $tax['taxes']; |
| 535 | 540 | $value = $tax['value']; |
@@ -183,7 +183,7 @@ |
||
| 183 | 183 | '<td style="border-bottom: 1px solid#ccc; color: #333; |
| 184 | 184 | font-family: Arial,sans-serif; font-size: 14px; line-height: 20px; |
| 185 | 185 | padding: 15px 8px;" valign="top">'.$this->currency($invoiceid).' ' |
| 186 | - .$item->subtotal.'</td>'. |
|
| 186 | + .$item->subtotal.'</td>'. |
|
| 187 | 187 | '</tr>'; |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | ]); |
| 116 | 116 | $this->createOrderInvoiceRelation($orderid, $invoice->id); |
| 117 | 117 | $items = $controller->createInvoiceItemsByAdmin($invoice->id, $product->id, |
| 118 | - $code, $product_cost, $currency, $qty = 1); |
|
| 118 | + $code, $product_cost, $currency, $qty = 1); |
|
| 119 | 119 | |
| 120 | 120 | return $items; |
| 121 | 121 | } catch (Exception $ex) { |