@@ -251,7 +251,7 @@ |
||
| 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(); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | ], [ |
| 119 | 119 | 'domain.*.required' => 'Please provide Domain name', |
| 120 | 120 | //'domain.*.url' => 'Domain name is not valid', |
| 121 | - ]); |
|
| 121 | + ]); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | try { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $items = \Cart::getContent(); |
| 329 | 329 | foreach ($items as $item) { |
| 330 | 330 | |
| 331 | - //this is product |
|
| 331 | + //this is product |
|
| 332 | 332 | $id = $item->id; |
| 333 | 333 | $this->AddProductToOrder($id); |
| 334 | 334 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $ends_at = ''; |
| 389 | 389 | } |
| 390 | 390 | $this->subscription->create(['user_id' => \Auth::user()->id, |
| 391 | - 'plan_id' => $planid, 'order_id' => $orderid, 'ends_at' => $ends_at, ]); |
|
| 391 | + 'plan_id' => $planid, 'order_id' => $orderid, 'ends_at' => $ends_at, ]); |
|
| 392 | 392 | } catch (\Exception $ex) { |
| 393 | 393 | app('log')->useDailyFiles(storage_path().'/logs/laravel.log'); |
| 394 | 394 | app('log')->info($ex->getMessage()); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $invoiceItem = $this->invoiceItem->create(['invoice_id' => $invoiceid, |
| 443 | 443 | 'product_name' => $product_name, 'regular_price' => $regular_price, |
| 444 | 444 | 'quantity' => $quantity, 'tax_name' => $tax_name, |
| 445 | - 'tax_percentage' => $tax_percentage, 'subtotal' => $subtotal, ]); |
|
| 445 | + 'tax_percentage' => $tax_percentage, 'subtotal' => $subtotal, ]); |
|
| 446 | 446 | } catch (\Exception $ex) { |
| 447 | 447 | app('log')->useDailyFiles(storage_path().'/logs/laravel.log'); |
| 448 | 448 | app('log')->info($ex->getMessage()); |
@@ -192,149 +192,149 @@ discard block |
||
| 192 | 192 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 193 | 193 | |
| 194 | 194 | if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
| 195 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 196 | - |
|
| 197 | - $state_code = ''; |
|
| 198 | - $c_gst = ''; |
|
| 199 | - $s_gst = ''; |
|
| 200 | - $i_gst = ''; |
|
| 201 | - $ut_gst = ''; |
|
| 202 | - $value = ''; |
|
| 203 | - $rate = ''; |
|
| 204 | - $status = 1; |
|
| 205 | - |
|
| 206 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 207 | - $c_gst = $user_state->c_gst; |
|
| 208 | - $s_gst = $user_state->s_gst; |
|
| 209 | - $i_gst = $user_state->i_gst; |
|
| 210 | - $ut_gst = $user_state->ut_gst; |
|
| 211 | - $state_code = $user_state->state_code; |
|
| 212 | - |
|
| 213 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 214 | - $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 195 | + if ($tax_enable == 1) {//If GST is Enabled |
|
| 196 | + |
|
| 197 | + $state_code = ''; |
|
| 198 | + $c_gst = ''; |
|
| 199 | + $s_gst = ''; |
|
| 200 | + $i_gst = ''; |
|
| 201 | + $ut_gst = ''; |
|
| 202 | + $value = ''; |
|
| 203 | + $rate = ''; |
|
| 204 | + $status = 1; |
|
| 205 | + |
|
| 206 | + if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 207 | + $c_gst = $user_state->c_gst; |
|
| 208 | + $s_gst = $user_state->s_gst; |
|
| 209 | + $i_gst = $user_state->i_gst; |
|
| 210 | + $ut_gst = $user_state->ut_gst; |
|
| 211 | + $state_code = $user_state->state_code; |
|
| 212 | + |
|
| 213 | + if ($state_code == $origin_state) {//If user and origin state are same |
|
| 214 | + $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
|
| 215 | 215 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 216 | 216 | |
| 217 | - $taxes = $rateForSameState['taxes']; |
|
| 218 | - $status = $rateForSameState['status']; |
|
| 219 | - $value = $rateForSameState['value']; |
|
| 220 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 221 | - $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 217 | + $taxes = $rateForSameState['taxes']; |
|
| 218 | + $status = $rateForSameState['status']; |
|
| 219 | + $value = $rateForSameState['value']; |
|
| 220 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 221 | + $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
|
| 222 | 222 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 223 | - $taxes = $rateForOtherState['taxes']; |
|
| 224 | - $status = $rateForOtherState['status']; |
|
| 225 | - $value = $rateForOtherState['value']; |
|
| 226 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 227 | - $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 223 | + $taxes = $rateForOtherState['taxes']; |
|
| 224 | + $status = $rateForOtherState['status']; |
|
| 225 | + $value = $rateForOtherState['value']; |
|
| 226 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 227 | + $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
|
| 228 | 228 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 229 | - $taxes = $rateForUnionTerritory['taxes']; |
|
| 230 | - $status = $rateForUnionTerritory['status']; |
|
| 231 | - $value = $rateForUnionTerritory['value']; |
|
| 232 | - } |
|
| 233 | - } else {//If user from other Country |
|
| 234 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 235 | - ->orWhere('country', $geoip_country) |
|
| 236 | - ->pluck('tax_classes_id')->first(); |
|
| 237 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 238 | - $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 229 | + $taxes = $rateForUnionTerritory['taxes']; |
|
| 230 | + $status = $rateForUnionTerritory['status']; |
|
| 231 | + $value = $rateForUnionTerritory['value']; |
|
| 232 | + } |
|
| 233 | + } else {//If user from other Country |
|
| 234 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 235 | + ->orWhere('country', $geoip_country) |
|
| 236 | + ->pluck('tax_classes_id')->first(); |
|
| 237 | + if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 238 | + $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
|
| 239 | 239 | $productid, $status); |
| 240 | - $taxes = $taxForSpecificCountry['taxes']; |
|
| 241 | - $status = $taxForSpecificCountry['status']; |
|
| 242 | - $value = $taxForSpecificCountry['value']; |
|
| 243 | - $rate = $taxForSpecificCountry['value']; |
|
| 244 | - } else {//if Tax is selected for Any Country Any State |
|
| 245 | - $taxClassId = Tax::where('country', '') |
|
| 246 | - ->where('state', 'Any State') |
|
| 247 | - ->pluck('tax_classes_id')->first(); |
|
| 248 | - if ($taxClassId) { |
|
| 249 | - $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 250 | - $taxes = $taxForAnyCountry['taxes']; |
|
| 251 | - $status = $taxForAnyCountry['status']; |
|
| 252 | - $value = $taxForAnyCountry['value']; |
|
| 253 | - $rate = $taxForAnyCountry['value']; |
|
| 254 | - } else { |
|
| 255 | - $taxes = [0]; |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - foreach ($taxes as $key => $tax) { |
|
| 240 | + $taxes = $taxForSpecificCountry['taxes']; |
|
| 241 | + $status = $taxForSpecificCountry['status']; |
|
| 242 | + $value = $taxForSpecificCountry['value']; |
|
| 243 | + $rate = $taxForSpecificCountry['value']; |
|
| 244 | + } else {//if Tax is selected for Any Country Any State |
|
| 245 | + $taxClassId = Tax::where('country', '') |
|
| 246 | + ->where('state', 'Any State') |
|
| 247 | + ->pluck('tax_classes_id')->first(); |
|
| 248 | + if ($taxClassId) { |
|
| 249 | + $taxForAnyCountry = $this->getTaxForAnyCountry($taxClassId, $productid, $status); |
|
| 250 | + $taxes = $taxForAnyCountry['taxes']; |
|
| 251 | + $status = $taxForAnyCountry['status']; |
|
| 252 | + $value = $taxForAnyCountry['value']; |
|
| 253 | + $rate = $taxForAnyCountry['value']; |
|
| 254 | + } else { |
|
| 255 | + $taxes = [0]; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + foreach ($taxes as $key => $tax) { |
|
| 260 | 260 | |
| 261 | 261 | //All the da a attribute that is sent to the checkout Page if tax_compound=0 |
| 262 | - if ($taxes[0]) { |
|
| 263 | - $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 264 | - 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 262 | + if ($taxes[0]) { |
|
| 263 | + $tax_attribute[$key] = ['name' => $tax->name, 'c_gst'=>$c_gst, |
|
| 264 | + 's_gst' => $s_gst, 'i_gst'=>$i_gst, 'ut_gst'=>$ut_gst, |
|
| 265 | 265 | 'state' => $state_code, 'origin_state'=>$origin_state, |
| 266 | - 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 266 | + 'tax_enable' => $tax_enable, 'rate'=>$value, 'status'=>$status, ]; |
|
| 267 | 267 | |
| 268 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 268 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 269 | 269 | |
| 270 | 270 | 'name' => 'no compound', |
| 271 | 271 | 'type' => 'tax', |
| 272 | 272 | 'target' => 'item', |
| 273 | 273 | 'value' => $value, |
| 274 | - ]); |
|
| 275 | - } else { |
|
| 276 | - $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 277 | - $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 278 | - 'name' => 'null', |
|
| 279 | - 'type' => 'tax', |
|
| 280 | - 'target' => 'item', |
|
| 281 | - 'value' => '0%', |
|
| 282 | - ]); |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 286 | - $status = 1; |
|
| 287 | - if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 288 | - $taxClassId = Tax::where('country', '') |
|
| 289 | - ->where('state', 'Any State') |
|
| 290 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 291 | - // other tax is available and tax is not enabled |
|
| 292 | - if ($taxClassId) { |
|
| 293 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 294 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 295 | - if ($value == 0) { |
|
| 296 | - $status = 0; |
|
| 297 | - } |
|
| 298 | - $rate = $value; |
|
| 299 | - foreach ($taxes as $key => $tax) { |
|
| 300 | - $tax_attribute[$key] = ['name' => $tax->name, |
|
| 301 | - 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 302 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 274 | + ]); |
|
| 275 | + } else { |
|
| 276 | + $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
|
| 277 | + $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
|
| 278 | + 'name' => 'null', |
|
| 279 | + 'type' => 'tax', |
|
| 280 | + 'target' => 'item', |
|
| 281 | + 'value' => '0%', |
|
| 282 | + ]); |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 286 | + $status = 1; |
|
| 287 | + if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
|
| 288 | + $taxClassId = Tax::where('country', '') |
|
| 289 | + ->where('state', 'Any State') |
|
| 290 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 291 | + // other tax is available and tax is not enabled |
|
| 292 | + if ($taxClassId) { |
|
| 293 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 294 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 295 | + if ($value == 0) { |
|
| 296 | + $status = 0; |
|
| 297 | + } |
|
| 298 | + $rate = $value; |
|
| 299 | + foreach ($taxes as $key => $tax) { |
|
| 300 | + $tax_attribute[$key] = ['name' => $tax->name, |
|
| 301 | + 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 302 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 303 | 303 | |
| 304 | 304 | 'name' => $tax->name, |
| 305 | 305 | 'type' => 'tax', |
| 306 | 306 | 'target' => 'item', |
| 307 | 307 | 'value' => $value, |
| 308 | 308 | ]); |
| 309 | - } |
|
| 310 | - } else {//In case of other country |
|
| 311 | - //when tax is available and tax is not enabled |
|
| 312 | - //(Applicable when Global Tax class for any country and state is not there) |
|
| 313 | - $taxClassId = Tax::where('state', $geoip_state) |
|
| 314 | - ->orWhere('country', $geoip_country) |
|
| 315 | - ->pluck('tax_classes_id')->first(); |
|
| 316 | - if ($taxClassId) { //if state equals the user State |
|
| 317 | - $taxes = $this->getTaxByPriority($taxClassId); |
|
| 318 | - $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 319 | - if ($value == '') { |
|
| 320 | - $status = 0; |
|
| 321 | - } |
|
| 322 | - $rate = $value; |
|
| 323 | - } |
|
| 324 | - foreach ($taxes as $key => $tax) { |
|
| 325 | - $tax_attribute[$key] = ['name' => $tax->name, |
|
| 326 | - 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 327 | - $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 309 | + } |
|
| 310 | + } else {//In case of other country |
|
| 311 | + //when tax is available and tax is not enabled |
|
| 312 | + //(Applicable when Global Tax class for any country and state is not there) |
|
| 313 | + $taxClassId = Tax::where('state', $geoip_state) |
|
| 314 | + ->orWhere('country', $geoip_country) |
|
| 315 | + ->pluck('tax_classes_id')->first(); |
|
| 316 | + if ($taxClassId) { //if state equals the user State |
|
| 317 | + $taxes = $this->getTaxByPriority($taxClassId); |
|
| 318 | + $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
|
| 319 | + if ($value == '') { |
|
| 320 | + $status = 0; |
|
| 321 | + } |
|
| 322 | + $rate = $value; |
|
| 323 | + } |
|
| 324 | + foreach ($taxes as $key => $tax) { |
|
| 325 | + $tax_attribute[$key] = ['name' => $tax->name, |
|
| 326 | + 'rate' => $value, 'tax_enable'=>0, 'status' => $status, ]; |
|
| 327 | + $taxCondition[$key] = new \Darryldecode\Cart\CartCondition([ |
|
| 328 | 328 | |
| 329 | 329 | 'name' => $tax->name, |
| 330 | 330 | 'type' => 'tax', |
| 331 | 331 | 'target' => 'item', |
| 332 | 332 | 'value' => $value, |
| 333 | 333 | ]); |
| 334 | - } |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - } |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | 338 | } else { |
| 339 | 339 | $tax_attribute[0] = ['name' => 'null', 'rate' => 0, 'tax_enable' =>0]; |
| 340 | 340 | $taxCondition[0] = new \Darryldecode\Cart\CartCondition([ |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $value = ''; |
| 414 | 414 | $value = $taxes->toArray()[0]['active'] ? |
| 415 | 415 | (TaxProductRelation::where('product_id', $productid) |
| 416 | - ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 416 | + ->where('tax_class_id', $taxClassId)->count() ? $ut_gst + $c_gst.'%' : 0) : 0; |
|
| 417 | 417 | |
| 418 | 418 | return $value; |
| 419 | 419 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $otherRate = 0; |
| 431 | 431 | $status = $taxes->toArray()[0]['active']; |
| 432 | 432 | if ($status && (TaxProductRelation::where('product_id', $productid) |
| 433 | - ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 433 | + ->where('tax_class_id', $taxClassId)->count() > 0)) { |
|
| 434 | 434 | $otherRate = Tax::where('tax_classes_id', $taxClassId)->first()->rate; |
| 435 | 435 | } |
| 436 | 436 | $value = $otherRate.'%'; |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | if ($subregion) { |
| 712 | 712 | $result = ['id' => $subregion->state_subdivision_code, |
| 713 | 713 | |
| 714 | - 'name' => $subregion->state_subdivision_name, ]; |
|
| 714 | + 'name' => $subregion->state_subdivision_name, ]; |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | return $result; |
@@ -30,30 +30,30 @@ |
||
| 30 | 30 | public function getPages() |
| 31 | 31 | { |
| 32 | 32 | return \DataTables::of($this->page->get()) |
| 33 | - ->addColumn('checkbox', function ($model) { |
|
| 33 | + ->addColumn('checkbox', function($model) { |
|
| 34 | 34 | return "<input type='checkbox' class='page_checkbox' |
| 35 | 35 | value=".$model->id.' name=select[] id=check>'; |
| 36 | 36 | }) |
| 37 | - ->addColumn('name', function ($model) { |
|
| 37 | + ->addColumn('name', function($model) { |
|
| 38 | 38 | return ucfirst($model->name); |
| 39 | 39 | }) |
| 40 | - ->addColumn('url', function ($model) { |
|
| 40 | + ->addColumn('url', function($model) { |
|
| 41 | 41 | return $model->url; |
| 42 | 42 | }) |
| 43 | - ->addColumn('created_at', function ($model) { |
|
| 43 | + ->addColumn('created_at', function($model) { |
|
| 44 | 44 | return $model->created_at; |
| 45 | 45 | }) |
| 46 | 46 | |
| 47 | - ->addColumn('content', function ($model) { |
|
| 47 | + ->addColumn('content', function($model) { |
|
| 48 | 48 | return str_limit($model->content, 10, '...'); |
| 49 | 49 | }) |
| 50 | - ->addColumn('action', function ($model) { |
|
| 50 | + ->addColumn('action', function($model) { |
|
| 51 | 51 | return '<a href='.url('pages/'.$model->id.'/edit') |
| 52 | 52 | ." class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' |
| 53 | 53 | style='color:white;'> </i> Edit</a>"; |
| 54 | 54 | }) |
| 55 | 55 | |
| 56 | - ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 56 | + ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 57 | 57 | ->make(true); |
| 58 | 58 | // ->searchColumns('name', 'content') |
| 59 | 59 | // ->orderColumns('name') |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | style='color:white;'> </i> Edit</a>"; |
| 54 | 54 | }) |
| 55 | 55 | |
| 56 | - ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 56 | + ->rawColumns(['checkbox', 'name', 'url', 'created_at', 'content', 'action']) |
|
| 57 | 57 | ->make(true); |
| 58 | 58 | // ->searchColumns('name', 'content') |
| 59 | 59 | // ->orderColumns('name') |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | //servicedesk |
| 327 | 327 | $sevice_desk_products = $product->where('id', '!=', 1) |
| 328 | 328 | ->where('category', '=', 'servicedesk') |
| 329 | - ->where('hidden', '=', '0') |
|
| 329 | + ->where('hidden', '=', '0') |
|
| 330 | 330 | ->orderBy('created_at', 'asc') |
| 331 | 331 | ->get() |
| 332 | 332 | ->toArray(); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $from = $request->input('from'); |
| 105 | 105 | $till = $request->input('till'); |
| 106 | 106 | |
| 107 | - return view('themes.default1.invoice.index', compact('name','invoice_no','status','currencies','currency_id','from', |
|
| 107 | + return view('themes.default1.invoice.index', compact('name', 'invoice_no', 'status', 'currencies', 'currency_id', 'from', |
|
| 108 | 108 | |
| 109 | 109 | 'till')); |
| 110 | 110 | } catch (\Exception $ex) { |
@@ -127,35 +127,35 @@ discard block |
||
| 127 | 127 | return \DataTables::of($query->take(100)) |
| 128 | 128 | ->setTotalRecords($query->count()) |
| 129 | 129 | |
| 130 | - ->addColumn('checkbox', function ($model) { |
|
| 130 | + ->addColumn('checkbox', function($model) { |
|
| 131 | 131 | return "<input type='checkbox' class='invoice_checkbox' |
| 132 | 132 | value=".$model->id.' name=select[] id=check>'; |
| 133 | 133 | }) |
| 134 | - ->addColumn('user_id', function ($model) { |
|
| 134 | + ->addColumn('user_id', function($model) { |
|
| 135 | 135 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 136 | 136 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
| 137 | 137 | $id = $this->user->where('id', $model->user_id)->first()->id; |
| 138 | 138 | |
| 139 | 139 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 140 | 140 | }) |
| 141 | - ->addColumn('number', function ($model) { |
|
| 141 | + ->addColumn('number', function($model) { |
|
| 142 | 142 | return ucfirst($model->number); |
| 143 | 143 | }) |
| 144 | 144 | |
| 145 | - ->addColumn('date', function ($model) { |
|
| 145 | + ->addColumn('date', function($model) { |
|
| 146 | 146 | $date = ($model->created_at); |
| 147 | 147 | |
| 148 | 148 | return $date; |
| 149 | 149 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 150 | 150 | }) |
| 151 | - ->addColumn('grand_total', function ($model) { |
|
| 151 | + ->addColumn('grand_total', function($model) { |
|
| 152 | 152 | return ucfirst($model->number); |
| 153 | 153 | }) |
| 154 | - ->addColumn('status', function ($model) { |
|
| 154 | + ->addColumn('status', function($model) { |
|
| 155 | 155 | return ucfirst($model->status); |
| 156 | 156 | }) |
| 157 | 157 | |
| 158 | - ->addColumn('action', function ($model) { |
|
| 158 | + ->addColumn('action', function($model) { |
|
| 159 | 159 | $action = ''; |
| 160 | 160 | |
| 161 | 161 | $check = $this->checkExecution($model->id); |
@@ -171,25 +171,25 @@ discard block |
||
| 171 | 171 | style='color:white;'> </i> View</a>" |
| 172 | 172 | ." $action"; |
| 173 | 173 | }) |
| 174 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
| 174 | + ->filterColumn('user_id', function($query, $keyword) { |
|
| 175 | 175 | $sql = 'first_name like ?'; |
| 176 | 176 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 177 | 177 | }) |
| 178 | 178 | |
| 179 | - ->filterColumn('status', function ($query, $keyword) { |
|
| 179 | + ->filterColumn('status', function($query, $keyword) { |
|
| 180 | 180 | $sql = 'status like ?'; |
| 181 | 181 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 182 | 182 | }) |
| 183 | 183 | |
| 184 | - ->filterColumn('number', function ($query, $keyword) { |
|
| 184 | + ->filterColumn('number', function($query, $keyword) { |
|
| 185 | 185 | $sql = 'number like ?'; |
| 186 | 186 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 187 | 187 | }) |
| 188 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 188 | + ->filterColumn('grand_total', function($query, $keyword) { |
|
| 189 | 189 | $sql = 'grand_total like ?'; |
| 190 | 190 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 191 | 191 | }) |
| 192 | - ->filterColumn('date', function ($query, $keyword) { |
|
| 192 | + ->filterColumn('date', function($query, $keyword) { |
|
| 193 | 193 | $sql = 'date like ?'; |
| 194 | 194 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 195 | 195 | }) |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $join = $join->select('id', 'user_id', 'number', 'date', 'grand_total', 'currency', 'status', 'created_at'); |
| 235 | 235 | |
| 236 | 236 | $join = $join->orderBy('created_at', 'desc') |
| 237 | - ->select('invoices.id','first_name','invoices.created_at', |
|
| 237 | + ->select('invoices.id', 'first_name', 'invoices.created_at', |
|
| 238 | 238 | 'invoices.currency', 'user_id', 'number', 'status'); |
| 239 | 239 | |
| 240 | 240 | return $join; |
@@ -183,7 +183,7 @@ discard block |
||
| 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 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $orders = $order->where('client', $clientid)->get(); |
| 281 | 281 | |
| 282 | 282 | return view('themes.default1.invoice.editPayment', compact('amountReceived','clientid', 'client', 'invoices', 'orders', |
| 283 | - 'invoiceSum', 'amountReceived', 'pendingAmount', 'currency')); |
|
| 283 | + 'invoiceSum', 'amountReceived', 'pendingAmount', 'currency')); |
|
| 284 | 284 | } catch (Exception $e) { |
| 285 | 285 | Bugsnag::notifyException($e); |
| 286 | 286 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $currency = $client->currency; |
| 35 | 35 | $orders = $order->where('client', $clientid)->get(); |
| 36 | 36 | |
| 37 | - return view('themes.default1.invoice.newpayment', compact('clientid', 'client', 'invoices', 'orders', |
|
| 37 | + return view('themes.default1.invoice.newpayment', compact('clientid', 'client', 'invoices', 'orders', |
|
| 38 | 38 | 'invoiceSum', 'amountReceived', 'pendingAmount', 'currency')); |
| 39 | 39 | } catch (Exception $ex) { |
| 40 | 40 | return redirect()->back()->with('fails', $ex->getMessage()); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $invoicAmount = $request->invoiceAmount; |
| 111 | 111 | $amtToCredit = $request->amtToCredit; |
| 112 | 112 | $payment_status = 'success'; |
| 113 | - $payment = $this->multiplePayment($clientid,$invoiceChecked, $payment_method, |
|
| 113 | + $payment = $this->multiplePayment($clientid, $invoiceChecked, $payment_method, |
|
| 114 | 114 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
| 115 | 115 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
| 116 | 116 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - public function multiplePayment($clientid,$invoiceChecked, $payment_method, |
|
| 131 | + public function multiplePayment($clientid, $invoiceChecked, $payment_method, |
|
| 132 | 132 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
| 133 | 133 | { |
| 134 | 134 | try { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $invoicAmount = $request->invoiceAmount; |
| 193 | 193 | $amtToCredit = $request->amtToCredit; |
| 194 | 194 | $payment_status = 'success'; |
| 195 | - $payment = $this->updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
|
| 195 | + $payment = $this->updatePaymentByInvoice($clientid, $invoiceChecked, $payment_method, |
|
| 196 | 196 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
| 197 | 197 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
| 198 | 198 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
|
| 209 | + public function updatePaymentByInvoice($clientid, $invoiceChecked, $payment_method, |
|
| 210 | 210 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
| 211 | 211 | { |
| 212 | 212 | try { |
@@ -133,7 +133,8 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | try { |
| 135 | 135 | foreach ($invoiceChecked as $key => $value) { |
| 136 | - if ($key != 0) {//If Payment is linked to Invoice |
|
| 136 | + if ($key != 0) { |
|
| 137 | +//If Payment is linked to Invoice |
|
| 137 | 138 | $invoice = Invoice::find($value); |
| 138 | 139 | $invoice_status = 'pending'; |
| 139 | 140 | $payment = Payment::where('invoice_id', $value)->create([ |
@@ -157,7 +158,8 @@ discard block |
||
| 157 | 158 | $invoice->status = $invoice_status; |
| 158 | 159 | $invoice->save(); |
| 159 | 160 | } |
| 160 | - } elseif (count($invoiceChecked) == 1 || $amtToCredit > 0) {//If Payment is not linked to any invoice and is to be credited to User Accunt |
|
| 161 | + } elseif (count($invoiceChecked) == 1 || $amtToCredit > 0) { |
|
| 162 | +//If Payment is not linked to any invoice and is to be credited to User Accunt |
|
| 161 | 163 | $payment = Payment::create([ |
| 162 | 164 | 'invoice_id' => $value, |
| 163 | 165 | 'user_id' => $clientid, |
@@ -224,7 +226,8 @@ discard block |
||
| 224 | 226 | try { |
| 225 | 227 | $sum = 0; |
| 226 | 228 | foreach ($invoiceChecked as $key => $value) { |
| 227 | - if ($key != 0) {//If Payment is linked to Invoice |
|
| 229 | + if ($key != 0) { |
|
| 230 | +//If Payment is linked to Invoice |
|
| 228 | 231 | $invoice = Invoice::find($value); |
| 229 | 232 | Payment::where('user_id', $clientid)->where('invoice_id', 0)->update(['amt_to_credit'=>$amtToCredit]); |
| 230 | 233 | $invoice_status = 'pending'; |