@@ -32,7 +32,7 @@ |
||
32 | 32 | $state_code = $user_state->state_code; |
33 | 33 | if ($state_code == $origin_state) {//If user and origin state are same |
34 | 34 | $taxClassId = TaxClass::where('name', 'Intra State GST') |
35 | - ->pluck('id')->toArray(); //Get the class Id of state |
|
35 | + ->pluck('id')->toArray(); //Get the class Id of state |
|
36 | 36 | if ($taxClassId) { |
37 | 37 | $taxes = $cartController->getTaxByPriority($taxClassId); |
38 | 38 | $value = $cartController->getValueForSameState($productid, $c_gst, $s_gst, $taxClassId, $taxes); |
@@ -28,7 +28,8 @@ discard block |
||
28 | 28 | $i_gst = $user_state->i_gst; |
29 | 29 | $ut_gst = $user_state->ut_gst; |
30 | 30 | $state_code = $user_state->state_code; |
31 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
31 | + if ($state_code == $origin_state) { |
|
32 | +//If user and origin state are same |
|
32 | 33 | $taxClassId = TaxClass::where('name', 'Intra State GST') |
33 | 34 | ->pluck('id')->toArray(); //Get the class Id of state |
34 | 35 | if ($taxClassId) { |
@@ -37,7 +38,8 @@ discard block |
||
37 | 38 | } else { |
38 | 39 | $taxes = [0]; |
39 | 40 | } |
40 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
41 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
42 | +//If user is from other state |
|
41 | 43 | $taxClassId = TaxClass::where('name', 'Inter State GST') |
42 | 44 | ->pluck('id')->toArray(); //Get the class Id of state |
43 | 45 | if ($taxClassId) { |
@@ -46,7 +48,8 @@ discard block |
||
46 | 48 | } else { |
47 | 49 | $taxes = [0]; |
48 | 50 | } |
49 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
51 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
52 | +//if user from Union Territory |
|
50 | 53 | $taxClassId = TaxClass::where('name', 'Union Territory GST') |
51 | 54 | ->pluck('id')->toArray(); //Get the class Id of state |
52 | 55 | if ($taxClassId) { |
@@ -71,13 +74,15 @@ discard block |
||
71 | 74 | ->pluck('tax_classes_id')->first(); |
72 | 75 | $value = ''; |
73 | 76 | $rate = ''; |
74 | - if ($taxClassId) { //if state equals the user State |
|
77 | + if ($taxClassId) { |
|
78 | +//if state equals the user State |
|
75 | 79 | $taxes = $cartController->getTaxByPriority($taxClassId); |
76 | 80 | |
77 | 81 | // $taxes = $this->cartController::getTaxByPriority($taxClassId); |
78 | 82 | $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
79 | 83 | $rate = $value; |
80 | - } else {//if Tax is selected for Any State Any Country |
|
84 | + } else { |
|
85 | +//if Tax is selected for Any State Any Country |
|
81 | 86 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
82 | 87 | if ($taxClassId) { |
83 | 88 | $taxes = $cartController->getTaxByPriority($taxClassId); |
@@ -228,7 +233,8 @@ discard block |
||
228 | 233 | { |
229 | 234 | $code = ''; |
230 | 235 | $codevalue = ''; |
231 | - if (\Session::has('code')) {//If coupon code is applied get it here from Session |
|
236 | + if (\Session::has('code')) { |
|
237 | +//If coupon code is applied get it here from Session |
|
232 | 238 | $code = \Session::get('code'); |
233 | 239 | $codevalue = \Session::get('codevalue'); |
234 | 240 | } |
@@ -35,20 +35,20 @@ |
||
35 | 35 | $social = $this->social->get(); |
36 | 36 | |
37 | 37 | return \DataTables::of($social) |
38 | - ->addColumn('#', function ($model) { |
|
38 | + ->addColumn('#', function($model) { |
|
39 | 39 | return "<input type='checkbox' value=".$model->id.' name=select[] id=check>'; |
40 | 40 | }) |
41 | - ->addColumn('name', function ($model) { |
|
41 | + ->addColumn('name', function($model) { |
|
42 | 42 | return $model->name; |
43 | 43 | }) |
44 | - ->addColumn('class', function ($model) { |
|
44 | + ->addColumn('class', function($model) { |
|
45 | 45 | return $model->class; |
46 | 46 | }) |
47 | - ->addColumn('link', function ($model) { |
|
47 | + ->addColumn('link', function($model) { |
|
48 | 48 | return $model->link; |
49 | 49 | }) |
50 | 50 | // ->showColumns('name', 'class', 'link') |
51 | - ->addColumn('action', function ($model) { |
|
51 | + ->addColumn('action', function($model) { |
|
52 | 52 | return '<a href='.url('social-media/'.$model->id.'/edit') |
53 | 53 | ." class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' |
54 | 54 | style='color:white;'> </i> Edit</a>"; |
@@ -168,9 +168,9 @@ |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | return \DataTables::of($invoices->get()) |
171 | - ->addColumn('number', function ($model) { |
|
172 | - return $model->number; |
|
173 | - }) |
|
171 | + ->addColumn('number', function ($model) { |
|
172 | + return $model->number; |
|
173 | + }) |
|
174 | 174 | ->addColumn('products', function ($model) { |
175 | 175 | $invoice = $this->invoice->find($model->id); |
176 | 176 | $products = $invoice->invoiceItem()->pluck('product_name')->toArray(); |
@@ -36,7 +36,8 @@ |
||
36 | 36 | $productCheck = $orders->product() |
37 | 37 | ->select('github_owner', 'github_repository', 'type') |
38 | 38 | ->where('id', $orders->product)->first(); |
39 | - if ($permissions['downloadPermission'] == 1) { //If the Product has doownlaod permission |
|
39 | + if ($permissions['downloadPermission'] == 1) { |
|
40 | +//If the Product has doownlaod permission |
|
40 | 41 | if (!$productCheck->github_owner == '' && !$productCheck->github_repository == '') { |
41 | 42 | $listUrl = $this->downloadGithubPopup($orders->client, $orders->invoice()->first()->id, $productid); |
42 | 43 | } else { |
@@ -201,27 +201,27 @@ |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | return \DataTables::of($invoices->get()) |
204 | - ->addColumn('number', function ($model) { |
|
204 | + ->addColumn('number', function($model) { |
|
205 | 205 | return $model->number; |
206 | 206 | }) |
207 | - ->addColumn('products', function ($model) { |
|
207 | + ->addColumn('products', function($model) { |
|
208 | 208 | $invoice = $this->invoice->find($model->id); |
209 | 209 | $products = $invoice->invoiceItem()->pluck('product_name')->toArray(); |
210 | 210 | |
211 | 211 | return ucfirst(implode(',', $products)); |
212 | 212 | }) |
213 | - ->addColumn('date', function ($model) { |
|
213 | + ->addColumn('date', function($model) { |
|
214 | 214 | $date = date_create($model->created_at); |
215 | 215 | |
216 | 216 | return date_format($date, 'M j, Y, g:i a'); |
217 | 217 | }) |
218 | - ->addColumn('total', function ($model) { |
|
218 | + ->addColumn('total', function($model) { |
|
219 | 219 | return currency_format($model->grand_total, $code = $model->currency); |
220 | 220 | }) |
221 | - ->addColumn('status', function ($model) { |
|
221 | + ->addColumn('status', function($model) { |
|
222 | 222 | return ucfirst($model->status); |
223 | 223 | }) |
224 | - ->addColumn('action', function ($model) { |
|
224 | + ->addColumn('action', function($model) { |
|
225 | 225 | if (\Auth::user()->role == 'admin') { |
226 | 226 | $url = '/invoices/show?invoiceid='.$model->id; |
227 | 227 | } else { |
@@ -56,21 +56,21 @@ |
||
56 | 56 | $allCategories = $this->productCategory->select('id', 'category_name')->get(); |
57 | 57 | |
58 | 58 | return \DataTables::of($allCategories) |
59 | - ->addColumn('checkbox', function ($model) { |
|
60 | - return "<input type='checkbox' class='category_checkbox' |
|
59 | + ->addColumn('checkbox', function ($model) { |
|
60 | + return "<input type='checkbox' class='category_checkbox' |
|
61 | 61 | value=".$model->id.' name=select[] id=check>'; |
62 | - }) |
|
63 | - ->addColumn('category_name', function ($model) { |
|
64 | - return ucfirst($model->category_name); |
|
65 | - }) |
|
66 | - ->addColumn('action', function ($model) { |
|
67 | - return "<p><button data-toggle='modal' |
|
62 | + }) |
|
63 | + ->addColumn('category_name', function ($model) { |
|
64 | + return ucfirst($model->category_name); |
|
65 | + }) |
|
66 | + ->addColumn('action', function ($model) { |
|
67 | + return "<p><button data-toggle='modal' |
|
68 | 68 | data-id=".$model->id." data-name= '$model->category_name' |
69 | 69 | class='btn btn-sm btn-primary btn-xs editCat'><i class='fa fa-edit' |
70 | 70 | style='color:white;'> </i> Edit</button> </p>"; |
71 | - }) |
|
72 | - ->rawColumns(['checkbox', 'category_name', 'action']) |
|
73 | - ->make(true); |
|
71 | + }) |
|
72 | + ->rawColumns(['checkbox', 'category_name', 'action']) |
|
73 | + ->make(true); |
|
74 | 74 | } catch (\Exception $ex) { |
75 | 75 | return redirect()->back()->with('fails', $ex->getMessage()); |
76 | 76 | } |
@@ -56,14 +56,14 @@ |
||
56 | 56 | $allCategories = $this->productCategory->select('id', 'category_name')->get(); |
57 | 57 | |
58 | 58 | return \DataTables::of($allCategories) |
59 | - ->addColumn('checkbox', function ($model) { |
|
59 | + ->addColumn('checkbox', function($model) { |
|
60 | 60 | return "<input type='checkbox' class='category_checkbox' |
61 | 61 | value=".$model->id.' name=select[] id=check>'; |
62 | 62 | }) |
63 | - ->addColumn('category_name', function ($model) { |
|
63 | + ->addColumn('category_name', function($model) { |
|
64 | 64 | return ucfirst($model->category_name); |
65 | 65 | }) |
66 | - ->addColumn('action', function ($model) { |
|
66 | + ->addColumn('action', function($model) { |
|
67 | 67 | return "<p><button data-toggle='modal' |
68 | 68 | data-id=".$model->id." data-name= '$model->category_name' |
69 | 69 | class='btn btn-sm btn-primary btn-xs editCat'><i class='fa fa-edit' |
@@ -34,21 +34,21 @@ |
||
34 | 34 | $allTypes = $this->productType->select('id', 'name')->get(); |
35 | 35 | |
36 | 36 | return \DataTables::of($allTypes) |
37 | - ->addColumn('checkbox', function ($model) { |
|
38 | - return "<input type='checkbox' class='type_checkbox' |
|
37 | + ->addColumn('checkbox', function ($model) { |
|
38 | + return "<input type='checkbox' class='type_checkbox' |
|
39 | 39 | value=".$model->id.' name=select[] id=check>'; |
40 | - }) |
|
41 | - ->addColumn('type_name', function ($model) { |
|
42 | - return ucfirst($model->name); |
|
43 | - }) |
|
44 | - ->addColumn('action', function ($model) { |
|
45 | - return "<p><button data-toggle='modal' |
|
40 | + }) |
|
41 | + ->addColumn('type_name', function ($model) { |
|
42 | + return ucfirst($model->name); |
|
43 | + }) |
|
44 | + ->addColumn('action', function ($model) { |
|
45 | + return "<p><button data-toggle='modal' |
|
46 | 46 | data-id=".$model->id." data-name= '$model->name' |
47 | 47 | class='btn btn-sm btn-primary btn-xs editType'><i class='fa fa-edit' |
48 | 48 | style='color:white;'> </i> Edit</button> </p>"; |
49 | - }) |
|
50 | - ->rawColumns(['checkbox', 'type_name', 'action']) |
|
51 | - ->make(true); |
|
49 | + }) |
|
50 | + ->rawColumns(['checkbox', 'type_name', 'action']) |
|
51 | + ->make(true); |
|
52 | 52 | } catch (\Exception $ex) { |
53 | 53 | Bugsnag::notifyException($ex); |
54 | 54 |
@@ -34,14 +34,14 @@ |
||
34 | 34 | $allTypes = $this->productType->select('id', 'name')->get(); |
35 | 35 | |
36 | 36 | return \DataTables::of($allTypes) |
37 | - ->addColumn('checkbox', function ($model) { |
|
37 | + ->addColumn('checkbox', function($model) { |
|
38 | 38 | return "<input type='checkbox' class='type_checkbox' |
39 | 39 | value=".$model->id.' name=select[] id=check>'; |
40 | 40 | }) |
41 | - ->addColumn('type_name', function ($model) { |
|
41 | + ->addColumn('type_name', function($model) { |
|
42 | 42 | return ucfirst($model->name); |
43 | 43 | }) |
44 | - ->addColumn('action', function ($model) { |
|
44 | + ->addColumn('action', function($model) { |
|
45 | 45 | return "<p><button data-toggle='modal' |
46 | 46 | data-id=".$model->id." data-name= '$model->name' |
47 | 47 | class='btn btn-sm btn-primary btn-xs editType'><i class='fa fa-edit' |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | protected $table = 'payments'; |
10 | 10 | protected $fillable = ['parent_id', 'invoice_id', 'amount', |
11 | - 'payment_method', 'user_id', 'payment_status', 'created_at', 'amt_to_credit', ]; |
|
11 | + 'payment_method', 'user_id', 'payment_status', 'created_at', 'amt_to_credit', ]; |
|
12 | 12 | |
13 | 13 | public function invoice() |
14 | 14 | { |
@@ -36,9 +36,9 @@ |
||
36 | 36 | value=".$model->id.' name=select[] id=check>'; |
37 | 37 | }) |
38 | 38 | |
39 | - ->addColumn('name', function ($model) { |
|
40 | - return $model->name; |
|
41 | - }) |
|
39 | + ->addColumn('name', function ($model) { |
|
40 | + return $model->name; |
|
41 | + }) |
|
42 | 42 | |
43 | 43 | ->addColumn('action', function ($model) { |
44 | 44 | return '<a href='.url('chat/'.$model->id.'/edit'). |
@@ -32,21 +32,21 @@ |
||
32 | 32 | { |
33 | 33 | try { |
34 | 34 | return \DataTables::of($this->script->get()) |
35 | - ->addColumn('checkbox', function ($model) { |
|
35 | + ->addColumn('checkbox', function($model) { |
|
36 | 36 | return "<input type='checkbox' class='chat_checkbox' |
37 | 37 | value=".$model->id.' name=select[] id=check>'; |
38 | 38 | }) |
39 | 39 | |
40 | - ->addColumn('name', function ($model) { |
|
40 | + ->addColumn('name', function($model) { |
|
41 | 41 | return $model->name; |
42 | 42 | }) |
43 | 43 | |
44 | - ->addColumn('action', function ($model) { |
|
44 | + ->addColumn('action', function($model) { |
|
45 | 45 | return '<a href='.url('chat/'.$model->id.'/edit'). |
46 | 46 | " class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' |
47 | 47 | style='color:white;'> </i> Edit</a>"; |
48 | 48 | }) |
49 | - ->rawColumns(['checkbox', 'name', 'action']) |
|
49 | + ->rawColumns(['checkbox', 'name', 'action']) |
|
50 | 50 | ->make(true); |
51 | 51 | } catch (\Exception $ex) { |
52 | 52 | return redirect()->back()->with('fails', $ex->getMessage()); |
@@ -31,19 +31,19 @@ |
||
31 | 31 | public function getPages() |
32 | 32 | { |
33 | 33 | return \DataTables::of($this->widget->get()) |
34 | - ->addColumn('checkbox', function ($model) { |
|
35 | - return "<input type='checkbox' class='widget_checkbox' |
|
34 | + ->addColumn('checkbox', function ($model) { |
|
35 | + return "<input type='checkbox' class='widget_checkbox' |
|
36 | 36 | value=".$model->id.' name=select[] id=check>'; |
37 | - }) |
|
38 | - ->addColumn('name', function ($model) { |
|
39 | - return ucfirst($model->name); |
|
40 | - }) |
|
37 | + }) |
|
38 | + ->addColumn('name', function ($model) { |
|
39 | + return ucfirst($model->name); |
|
40 | + }) |
|
41 | 41 | ->addColumn('type', function ($model) { |
42 | 42 | return $model->type; |
43 | 43 | }) |
44 | - ->addColumn('created_at', function ($model) { |
|
45 | - return $model->created_at; |
|
46 | - }) |
|
44 | + ->addColumn('created_at', function ($model) { |
|
45 | + return $model->created_at; |
|
46 | + }) |
|
47 | 47 | // ->showColumns('name', 'type', 'created_at') |
48 | 48 | ->addColumn('content', function ($model) { |
49 | 49 | return str_limit($model->content, 10, '...'); |
@@ -31,24 +31,24 @@ |
||
31 | 31 | public function getPages() |
32 | 32 | { |
33 | 33 | return \DataTables::of($this->widget->get()) |
34 | - ->addColumn('checkbox', function ($model) { |
|
34 | + ->addColumn('checkbox', function($model) { |
|
35 | 35 | return "<input type='checkbox' class='widget_checkbox' |
36 | 36 | value=".$model->id.' name=select[] id=check>'; |
37 | 37 | }) |
38 | - ->addColumn('name', function ($model) { |
|
38 | + ->addColumn('name', function($model) { |
|
39 | 39 | return ucfirst($model->name); |
40 | 40 | }) |
41 | - ->addColumn('type', function ($model) { |
|
41 | + ->addColumn('type', function($model) { |
|
42 | 42 | return $model->type; |
43 | 43 | }) |
44 | - ->addColumn('created_at', function ($model) { |
|
44 | + ->addColumn('created_at', function($model) { |
|
45 | 45 | return $model->created_at; |
46 | 46 | }) |
47 | 47 | // ->showColumns('name', 'type', 'created_at') |
48 | - ->addColumn('content', function ($model) { |
|
48 | + ->addColumn('content', function($model) { |
|
49 | 49 | return str_limit($model->content, 10, '...'); |
50 | 50 | }) |
51 | - ->addColumn('action', function ($model) { |
|
51 | + ->addColumn('action', function($model) { |
|
52 | 52 | return '<a href='.url('widgets/'.$model->id.'/edit')." |
53 | 53 | class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' |
54 | 54 | style='color:white;'> </i> Edit</a>"; |
@@ -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()); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $invoicAmount = $request->invoiceAmount; |
113 | 113 | $amtToCredit = $request->amtToCredit; |
114 | 114 | $payment_status = 'success'; |
115 | - $payment = $this->multiplePayment($clientid,$invoiceChecked, $payment_method, |
|
115 | + $payment = $this->multiplePayment($clientid, $invoiceChecked, $payment_method, |
|
116 | 116 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
117 | 117 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
118 | 118 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | - public function multiplePayment($clientid,$invoiceChecked, $payment_method, |
|
132 | + public function multiplePayment($clientid, $invoiceChecked, $payment_method, |
|
133 | 133 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
134 | 134 | { |
135 | 135 | try { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $invoicAmount = $request->invoiceAmount; |
205 | 205 | $amtToCredit = $request->amtToCredit; |
206 | 206 | $payment_status = 'success'; |
207 | - $payment = $this->updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
|
207 | + $payment = $this->updatePaymentByInvoice($clientid, $invoiceChecked, $payment_method, |
|
208 | 208 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status); |
209 | 209 | $response = ['type' => 'success', 'message' => 'Payment Updated Successfully']; |
210 | 210 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | - public function updatePaymentByInvoice($clientid,$invoiceChecked, $payment_method, |
|
221 | + public function updatePaymentByInvoice($clientid, $invoiceChecked, $payment_method, |
|
222 | 222 | $payment_date, $totalAmt, $invoicAmount, $amtToCredit, $payment_status) |
223 | 223 | { |
224 | 224 | try { |
@@ -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]); |