@@ -435,7 +435,7 @@ |
||
| 435 | 435 | |
| 436 | 436 | StatusSetting::where('id', 1)->update(['recaptcha_status'=>$status]); |
| 437 | 437 | ApiKey::where('id', 1)->update(['nocaptcha_sitekey'=> $nocaptcha_sitekey, |
| 438 | - 'captcha_secretCheck' => $captcha_secretCheck, ]); |
|
| 438 | + 'captcha_secretCheck' => $captcha_secretCheck, ]); |
|
| 439 | 439 | |
| 440 | 440 | return ['message' => 'success', 'update'=>'Recaptcha Settings Updated']; |
| 441 | 441 | } |
@@ -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, |
@@ -302,37 +302,37 @@ discard block |
||
| 302 | 302 | $query = $this->advanceSearch($from, $till, $delFrom, $delTill); |
| 303 | 303 | |
| 304 | 304 | return \DataTables::of($query->take(50)) |
| 305 | - ->setTotalRecords($query->count()) |
|
| 306 | - ->addColumn('checkbox', function ($model) { |
|
| 307 | - return "<input type='checkbox' class='activity' value=".$model->id.' name=select[] id=check>'; |
|
| 308 | - }) |
|
| 309 | - ->addColumn('name', function ($model) { |
|
| 310 | - return ucfirst($model->log_name); |
|
| 311 | - }) |
|
| 312 | - ->addColumn('description', function ($model) { |
|
| 313 | - return ucfirst($model->description); |
|
| 314 | - }) |
|
| 315 | - ->addColumn('username', function ($model) { |
|
| 316 | - $causer_id = $model->causer_id; |
|
| 317 | - $names = User::where('id', $causer_id)->pluck('last_name', 'first_name'); |
|
| 318 | - foreach ($names as $key => $value) { |
|
| 319 | - $fullName = $key.' '.$value; |
|
| 320 | - |
|
| 321 | - return $fullName; |
|
| 322 | - } |
|
| 323 | - }) |
|
| 324 | - ->addColumn('role', function ($model) { |
|
| 325 | - $causer_id = $model->causer_id; |
|
| 326 | - $role = User::where('id', $causer_id)->pluck('role'); |
|
| 327 | - |
|
| 328 | - return json_decode($role); |
|
| 329 | - }) |
|
| 330 | - ->addColumn('new', function ($model) { |
|
| 331 | - $properties = ($model->properties); |
|
| 332 | - $newEntry = $this->getNewEntry($properties, $model); |
|
| 333 | - |
|
| 334 | - return $newEntry; |
|
| 335 | - }) |
|
| 305 | + ->setTotalRecords($query->count()) |
|
| 306 | + ->addColumn('checkbox', function ($model) { |
|
| 307 | + return "<input type='checkbox' class='activity' value=".$model->id.' name=select[] id=check>'; |
|
| 308 | + }) |
|
| 309 | + ->addColumn('name', function ($model) { |
|
| 310 | + return ucfirst($model->log_name); |
|
| 311 | + }) |
|
| 312 | + ->addColumn('description', function ($model) { |
|
| 313 | + return ucfirst($model->description); |
|
| 314 | + }) |
|
| 315 | + ->addColumn('username', function ($model) { |
|
| 316 | + $causer_id = $model->causer_id; |
|
| 317 | + $names = User::where('id', $causer_id)->pluck('last_name', 'first_name'); |
|
| 318 | + foreach ($names as $key => $value) { |
|
| 319 | + $fullName = $key.' '.$value; |
|
| 320 | + |
|
| 321 | + return $fullName; |
|
| 322 | + } |
|
| 323 | + }) |
|
| 324 | + ->addColumn('role', function ($model) { |
|
| 325 | + $causer_id = $model->causer_id; |
|
| 326 | + $role = User::where('id', $causer_id)->pluck('role'); |
|
| 327 | + |
|
| 328 | + return json_decode($role); |
|
| 329 | + }) |
|
| 330 | + ->addColumn('new', function ($model) { |
|
| 331 | + $properties = ($model->properties); |
|
| 332 | + $newEntry = $this->getNewEntry($properties, $model); |
|
| 333 | + |
|
| 334 | + return $newEntry; |
|
| 335 | + }) |
|
| 336 | 336 | ->addColumn('old', function ($model) { |
| 337 | 337 | $data = ($model->properties); |
| 338 | 338 | $oldEntry = $this->getOldEntry($data, $model); |
@@ -376,42 +376,42 @@ discard block |
||
| 376 | 376 | $email_log = \DB::table('email_log')->orderBy('date', 'desc')->get(); |
| 377 | 377 | |
| 378 | 378 | return\ DataTables::of($email_log) |
| 379 | - ->addColumn('checkbox', function ($model) { |
|
| 380 | - return "<input type='checkbox' class='email' value=".$model->id.' name=select[] id=check>'; |
|
| 381 | - }) |
|
| 382 | - ->addColumn('date', function ($model) { |
|
| 383 | - $date = $model->date; |
|
| 384 | - if ($date) { |
|
| 385 | - $date1 = new \DateTime($date); |
|
| 386 | - $tz = \Auth::user()->timezone()->first()->name; |
|
| 387 | - $date1->setTimezone(new \DateTimeZone($tz)); |
|
| 388 | - $finalDate = $date1->format('M j, Y, g:i a '); |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - return $finalDate; |
|
| 392 | - }) |
|
| 393 | - ->addColumn('from', function ($model) { |
|
| 394 | - $from = Markdown::convertToHtml($model->from); |
|
| 395 | - |
|
| 396 | - return $from; |
|
| 397 | - }) |
|
| 398 | - ->addColumn('to', function ($model) { |
|
| 399 | - $to = Markdown::convertToHtml($model->to); |
|
| 400 | - |
|
| 401 | - return $to; |
|
| 402 | - }) |
|
| 403 | - |
|
| 404 | - ->addColumn('subject', function ($model) { |
|
| 405 | - return ucfirst($model->subject); |
|
| 406 | - }) |
|
| 379 | + ->addColumn('checkbox', function ($model) { |
|
| 380 | + return "<input type='checkbox' class='email' value=".$model->id.' name=select[] id=check>'; |
|
| 381 | + }) |
|
| 382 | + ->addColumn('date', function ($model) { |
|
| 383 | + $date = $model->date; |
|
| 384 | + if ($date) { |
|
| 385 | + $date1 = new \DateTime($date); |
|
| 386 | + $tz = \Auth::user()->timezone()->first()->name; |
|
| 387 | + $date1->setTimezone(new \DateTimeZone($tz)); |
|
| 388 | + $finalDate = $date1->format('M j, Y, g:i a '); |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + return $finalDate; |
|
| 392 | + }) |
|
| 393 | + ->addColumn('from', function ($model) { |
|
| 394 | + $from = Markdown::convertToHtml($model->from); |
|
| 395 | + |
|
| 396 | + return $from; |
|
| 397 | + }) |
|
| 398 | + ->addColumn('to', function ($model) { |
|
| 399 | + $to = Markdown::convertToHtml($model->to); |
|
| 400 | + |
|
| 401 | + return $to; |
|
| 402 | + }) |
|
| 403 | + |
|
| 404 | + ->addColumn('subject', function ($model) { |
|
| 405 | + return ucfirst($model->subject); |
|
| 406 | + }) |
|
| 407 | 407 | // ->addColumn('headers', function ($model) { |
| 408 | 408 | // $headers = Markdown::convertToHtml(ucfirst($model->headers)); |
| 409 | 409 | |
| 410 | 410 | // return $headers; |
| 411 | 411 | // }) |
| 412 | - ->addColumn('status', function ($model) { |
|
| 413 | - return ucfirst($model->status); |
|
| 414 | - }) |
|
| 412 | + ->addColumn('status', function ($model) { |
|
| 413 | + return ucfirst($model->status); |
|
| 414 | + }) |
|
| 415 | 415 | |
| 416 | 416 | ->rawColumns(['checkbox', 'date', 'from', 'to', |
| 417 | 417 | 'bcc', 'subject', 'status', ]) |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | value=".$model->id.' name=select[] id=check>'; |
| 123 | 123 | }) |
| 124 | 124 | |
| 125 | - ->addColumn('name', function ($model) { |
|
| 126 | - return $model->name; |
|
| 127 | - }) |
|
| 125 | + ->addColumn('name', function ($model) { |
|
| 126 | + return $model->name; |
|
| 127 | + }) |
|
| 128 | 128 | ->addColumn('type', function ($model) { |
| 129 | 129 | return $this->type->where('id', $model->type)->first()->name; |
| 130 | 130 | }) |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | public function mailing($from, $to, $data, $subject, $replace = [], |
| 271 | - $type = '', $fromname = '', $toname = '', $cc = [], $attach = []) |
|
| 271 | + $type = '', $fromname = '', $toname = '', $cc = [], $attach = []) |
|
| 272 | 272 | { |
| 273 | 273 | try { |
| 274 | 274 | $transform = []; |
@@ -301,10 +301,10 @@ discard block |
||
| 301 | 301 | 'date' => date('Y-m-d H:i:s'), |
| 302 | 302 | 'from' => $from, |
| 303 | 303 | 'to' => $to, |
| 304 | - 'subject' => $subject, |
|
| 304 | + 'subject' => $subject, |
|
| 305 | 305 | 'body' => $data, |
| 306 | 306 | 'status' => 'success', |
| 307 | - ]); |
|
| 307 | + ]); |
|
| 308 | 308 | |
| 309 | 309 | return 'success'; |
| 310 | 310 | } catch (\Exception $ex) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | 'date' => date('Y-m-d H:i:s'), |
| 313 | 313 | 'from' => $from, |
| 314 | 314 | 'to' => $to, |
| 315 | - 'subject' => $subject, |
|
| 315 | + 'subject' => $subject, |
|
| 316 | 316 | 'body' => $data, |
| 317 | 317 | 'status' => 'failed', |
| 318 | 318 | ]); |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | ->addColumn('name', function ($model) { |
| 126 | 126 | return ucfirst($model->name); |
| 127 | 127 | }) |
| 128 | - ->addColumn('image', function ($model) { |
|
| 129 | - // return $model->image; |
|
| 130 | - return "<img src= '$model->image' + height=\"80\"/>"; |
|
| 131 | - }) |
|
| 128 | + ->addColumn('image', function ($model) { |
|
| 129 | + // return $model->image; |
|
| 130 | + return "<img src= '$model->image' + height=\"80\"/>"; |
|
| 131 | + }) |
|
| 132 | 132 | ->addColumn('type', function ($model) { |
| 133 | 133 | if ($this->type->where('id', $model->type)->first()) { |
| 134 | 134 | return $this->type->where('id', $model->type)->first()->name; |
@@ -173,11 +173,11 @@ discard block |
||
| 173 | 173 | $this->validate( |
| 174 | 174 | $request, |
| 175 | 175 | [ |
| 176 | - 'producttitle' => 'required', |
|
| 176 | + 'producttitle' => 'required', |
|
| 177 | 177 | 'version' => 'required', |
| 178 | - 'filename' => 'required', |
|
| 179 | - ], |
|
| 180 | - ['filename.required' => 'Please Uplaod A file', |
|
| 178 | + 'filename' => 'required', |
|
| 179 | + ], |
|
| 180 | + ['filename.required' => 'Please Uplaod A file', |
|
| 181 | 181 | ] |
| 182 | 182 | ); |
| 183 | 183 | |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till); |
| 130 | 130 | |
| 131 | 131 | return \DataTables::of($query->take(100)) |
| 132 | - ->setTotalRecords($query->count()) |
|
| 132 | + ->setTotalRecords($query->count()) |
|
| 133 | 133 | |
| 134 | - ->addColumn('checkbox', function ($model) { |
|
| 135 | - return "<input type='checkbox' class='invoice_checkbox' |
|
| 134 | + ->addColumn('checkbox', function ($model) { |
|
| 135 | + return "<input type='checkbox' class='invoice_checkbox' |
|
| 136 | 136 | value=".$model->id.' name=select[] id=check>'; |
| 137 | - }) |
|
| 137 | + }) |
|
| 138 | 138 | ->addColumn('user_id', function ($model) { |
| 139 | 139 | $first = $this->user->where('id', $model->user_id)->first()->first_name; |
| 140 | 140 | $last = $this->user->where('id', $model->user_id)->first()->last_name; |
@@ -142,9 +142,9 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>'; |
| 144 | 144 | }) |
| 145 | - ->addColumn('number', function ($model) { |
|
| 146 | - return ucfirst($model->number); |
|
| 147 | - }) |
|
| 145 | + ->addColumn('number', function ($model) { |
|
| 146 | + return ucfirst($model->number); |
|
| 147 | + }) |
|
| 148 | 148 | |
| 149 | 149 | ->addColumn('date', function ($model) { |
| 150 | 150 | $date = ($model->created_at); |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | return $date; |
| 153 | 153 | // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m'); |
| 154 | 154 | }) |
| 155 | - ->addColumn('grand_total', function ($model) { |
|
| 156 | - return $model->grand_total; |
|
| 157 | - }) |
|
| 158 | - ->addColumn('status', function ($model) { |
|
| 159 | - return ucfirst($model->status); |
|
| 160 | - }) |
|
| 155 | + ->addColumn('grand_total', function ($model) { |
|
| 156 | + return $model->grand_total; |
|
| 157 | + }) |
|
| 158 | + ->addColumn('status', function ($model) { |
|
| 159 | + return ucfirst($model->status); |
|
| 160 | + }) |
|
| 161 | 161 | |
| 162 | 162 | ->addColumn('action', function ($model) { |
| 163 | 163 | $action = ''; |
@@ -175,30 +175,30 @@ discard block |
||
| 175 | 175 | style='color:white;'> </i> View</a>" |
| 176 | 176 | ." $action"; |
| 177 | 177 | }) |
| 178 | - ->filterColumn('user_id', function ($query, $keyword) { |
|
| 179 | - $sql = 'first_name like ?'; |
|
| 180 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 181 | - }) |
|
| 178 | + ->filterColumn('user_id', function ($query, $keyword) { |
|
| 179 | + $sql = 'first_name like ?'; |
|
| 180 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 181 | + }) |
|
| 182 | 182 | |
| 183 | - ->filterColumn('status', function ($query, $keyword) { |
|
| 184 | - $sql = 'status like ?'; |
|
| 185 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 186 | - }) |
|
| 183 | + ->filterColumn('status', function ($query, $keyword) { |
|
| 184 | + $sql = 'status like ?'; |
|
| 185 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 186 | + }) |
|
| 187 | 187 | |
| 188 | 188 | ->filterColumn('number', function ($query, $keyword) { |
| 189 | 189 | $sql = 'number like ?'; |
| 190 | 190 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 191 | 191 | }) |
| 192 | - ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 193 | - $sql = 'grand_total like ?'; |
|
| 194 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 195 | - }) |
|
| 196 | - ->filterColumn('date', function ($query, $keyword) { |
|
| 197 | - $sql = 'date like ?'; |
|
| 198 | - $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 199 | - }) |
|
| 200 | - |
|
| 201 | - ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 192 | + ->filterColumn('grand_total', function ($query, $keyword) { |
|
| 193 | + $sql = 'grand_total like ?'; |
|
| 194 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 195 | + }) |
|
| 196 | + ->filterColumn('date', function ($query, $keyword) { |
|
| 197 | + $sql = 'date like ?'; |
|
| 198 | + $query->whereRaw($sql, ["%{$keyword}%"]); |
|
| 199 | + }) |
|
| 200 | + |
|
| 201 | + ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action']) |
|
| 202 | 202 | ->make(true); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $symbol = $attributes[0]['currency']['symbol']; |
| 298 | 298 | $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number, |
| 299 | - 'date' => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending', |
|
| 300 | - 'currency' => \Auth::user()->currency, ]); |
|
| 299 | + 'date' => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending', |
|
| 300 | + 'currency' => \Auth::user()->currency, ]); |
|
| 301 | 301 | foreach (\Cart::getContent() as $cart) { |
| 302 | 302 | $this->createInvoiceItems($invoice->id, $cart, $codevalue); |
| 303 | 303 | } |
@@ -420,11 +420,11 @@ discard block |
||
| 420 | 420 | $grand_total = \App\Http\Controllers\Front\CartController::rounding($grand_total); |
| 421 | 421 | |
| 422 | 422 | $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date, |
| 423 | - 'coupon_code' => $code, 'discount'=>$codeValue, |
|
| 423 | + 'coupon_code' => $code, 'discount'=>$codeValue, |
|
| 424 | 424 | 'grand_total' => $grand_total, 'currency' => $currency, 'status' => $status, 'description' => $description, ]); |
| 425 | 425 | |
| 426 | 426 | $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid, |
| 427 | - $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
|
| 427 | + $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate); |
|
| 428 | 428 | $result = $this->getMessage($items, $user_id); |
| 429 | 429 | } catch (\Exception $ex) { |
| 430 | 430 | app('log')->info($ex->getMessage()); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
| 501 | 501 | |
| 502 | 502 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 503 | - ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 503 | + ->pluck('tax_classes_id')->first(); //In case of India when |
|
| 504 | 504 | //other tax is available and tax is not enabled |
| 505 | 505 | if ($taxClassId) { |
| 506 | 506 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
@@ -568,10 +568,10 @@ discard block |
||
| 568 | 568 | foreach ($taxes as $key => $tax) { |
| 569 | 569 | if ($taxes[0]) { |
| 570 | 570 | $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1, |
| 571 | - 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 572 | - 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 573 | - 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 574 | - 'origin_state' => $origin_state, ]; |
|
| 571 | + 'name2' => $name2, 'name3' => $name3, 'name4' => $name4, |
|
| 572 | + 'rate' => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst, |
|
| 573 | + 'rate3' => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code, |
|
| 574 | + 'origin_state' => $origin_state, ]; |
|
| 575 | 575 | |
| 576 | 576 | $rate = $tax->rate; |
| 577 | 577 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ." class='btn btn-sm btn-primary btn-xs'><i class='fa fa-edit' |
| 88 | 88 | style='color:white;'> </i> Edit</a>"; |
| 89 | 89 | }) |
| 90 | - ->rawColumns(['checkbox', 'code', 'products', 'action']) |
|
| 90 | + ->rawColumns(['checkbox', 'code', 'products', 'action']) |
|
| 91 | 91 | |
| 92 | 92 | ->make(true); |
| 93 | 93 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | 'price' => $value, |
| 284 | 284 | 'conditions' => $coupon, |
| 285 | 285 | |
| 286 | - // new item price, price can also be a string format like so: '98.67' |
|
| 286 | + // new item price, price can also be a string format like so: '98.67' |
|
| 287 | 287 | ]); |
| 288 | 288 | \Session::put('usage', 1); |
| 289 | 289 | \Session::put('code', $promo->code); |
@@ -32,32 +32,32 @@ discard block |
||
| 32 | 32 | ->addColumn('total', function ($model) use ($client) { |
| 33 | 33 | return currency_format($model->grand_total, $code = $client->currency); |
| 34 | 34 | }) |
| 35 | - ->addColumn('paid', function ($model) use ($client) { |
|
| 36 | - $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get(); |
|
| 37 | - $c = count($payment); |
|
| 38 | - $sum = 0; |
|
| 39 | - |
|
| 40 | - for ($i = 0; $i <= $c - 1; $i++) { |
|
| 41 | - $sum = $sum + $payment[$i]->amount; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - return currency_format($sum, $code = $client->currency); |
|
| 45 | - }) |
|
| 46 | - ->addColumn('balance', function ($model) use ($client) { |
|
| 47 | - $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get(); |
|
| 48 | - $c = count($payment); |
|
| 49 | - $sum = 0; |
|
| 50 | - |
|
| 51 | - for ($i = 0; $i <= $c - 1; $i++) { |
|
| 52 | - $sum = $sum + $payment[$i]->amount; |
|
| 53 | - } |
|
| 54 | - $pendingAmount = ($model->grand_total) - ($sum); |
|
| 55 | - |
|
| 56 | - return currency_format($pendingAmount, $code = $client->currency); |
|
| 57 | - }) |
|
| 58 | - ->addColumn('status', function ($model) { |
|
| 59 | - return $model->status; |
|
| 60 | - }) |
|
| 35 | + ->addColumn('paid', function ($model) use ($client) { |
|
| 36 | + $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get(); |
|
| 37 | + $c = count($payment); |
|
| 38 | + $sum = 0; |
|
| 39 | + |
|
| 40 | + for ($i = 0; $i <= $c - 1; $i++) { |
|
| 41 | + $sum = $sum + $payment[$i]->amount; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + return currency_format($sum, $code = $client->currency); |
|
| 45 | + }) |
|
| 46 | + ->addColumn('balance', function ($model) use ($client) { |
|
| 47 | + $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get(); |
|
| 48 | + $c = count($payment); |
|
| 49 | + $sum = 0; |
|
| 50 | + |
|
| 51 | + for ($i = 0; $i <= $c - 1; $i++) { |
|
| 52 | + $sum = $sum + $payment[$i]->amount; |
|
| 53 | + } |
|
| 54 | + $pendingAmount = ($model->grand_total) - ($sum); |
|
| 55 | + |
|
| 56 | + return currency_format($pendingAmount, $code = $client->currency); |
|
| 57 | + }) |
|
| 58 | + ->addColumn('status', function ($model) { |
|
| 59 | + return $model->status; |
|
| 60 | + }) |
|
| 61 | 61 | ->addColumn('action', function ($model) { |
| 62 | 62 | $action = ''; |
| 63 | 63 | $cont = new \App\Http\Controllers\Order\TaxRatesAndCodeExpiryController(); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | style='color:white;'> </i> View</a>" |
| 79 | 79 | ." $editAction $action"; |
| 80 | 80 | }) |
| 81 | - ->rawColumns(['checkbox', 'date', 'invoice_no', 'total', 'paid', 'balance', 'status', 'action']) |
|
| 81 | + ->rawColumns(['checkbox', 'date', 'invoice_no', 'total', 'paid', 'balance', 'status', 'action']) |
|
| 82 | 82 | ->make(true); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | return $number; |
| 108 | 108 | }) |
| 109 | - ->addColumn('total', function ($model) use ($client) { |
|
| 110 | - $price = currency_format($model->price_override, $code = $client->currency); |
|
| 109 | + ->addColumn('total', function ($model) use ($client) { |
|
| 110 | + $price = currency_format($model->price_override, $code = $client->currency); |
|
| 111 | 111 | |
| 112 | - return $price; |
|
| 113 | - }) |
|
| 114 | - ->addColumn('status', function ($model) { |
|
| 115 | - $status = $model->order_status; |
|
| 112 | + return $price; |
|
| 113 | + }) |
|
| 114 | + ->addColumn('status', function ($model) { |
|
| 115 | + $status = $model->order_status; |
|
| 116 | 116 | |
| 117 | - return $status; |
|
| 118 | - }) |
|
| 117 | + return $status; |
|
| 118 | + }) |
|
| 119 | 119 | ->addColumn('action', function ($model) { |
| 120 | 120 | return '<a href='.url('orders/'.$model->id)." |
| 121 | 121 | class='btn btn-sm btn-primary btn-xs'><i class='fa fa-eye' |
@@ -151,27 +151,27 @@ discard block |
||
| 151 | 151 | return $model->payment_method; |
| 152 | 152 | }) |
| 153 | 153 | |
| 154 | - ->addColumn('total', function ($model) use ($client, $extraAmt) { |
|
| 155 | - if ($model->invoice_id == 0) { |
|
| 156 | - $amount = currency_format($extraAmt, $code = $client->currency); |
|
| 157 | - } else { |
|
| 158 | - $amount = currency_format($model->amount, $code = $client->currency); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - return $amount; |
|
| 162 | - }) |
|
| 163 | - ->addColumn('status', function ($model) { |
|
| 164 | - return ucfirst($model->payment_status); |
|
| 165 | - }) |
|
| 166 | - |
|
| 167 | - ->addColumn('action', function ($model) { |
|
| 168 | - '<input type="hidden" class="paymentid" value="{{$model->id}}">'; |
|
| 169 | - if ($model->invoice_id == 0) { |
|
| 170 | - return '<a href='.url('payments/'.$model->id.'/edit/')." class='btn btn-sm btn-primary btn-xs'> <i class='fa fa-edit' style='color:white;'> </i> Edit</a>"; |
|
| 171 | - } else { |
|
| 172 | - return '--'; |
|
| 173 | - } |
|
| 174 | - }) |
|
| 154 | + ->addColumn('total', function ($model) use ($client, $extraAmt) { |
|
| 155 | + if ($model->invoice_id == 0) { |
|
| 156 | + $amount = currency_format($extraAmt, $code = $client->currency); |
|
| 157 | + } else { |
|
| 158 | + $amount = currency_format($model->amount, $code = $client->currency); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + return $amount; |
|
| 162 | + }) |
|
| 163 | + ->addColumn('status', function ($model) { |
|
| 164 | + return ucfirst($model->payment_status); |
|
| 165 | + }) |
|
| 166 | + |
|
| 167 | + ->addColumn('action', function ($model) { |
|
| 168 | + '<input type="hidden" class="paymentid" value="{{$model->id}}">'; |
|
| 169 | + if ($model->invoice_id == 0) { |
|
| 170 | + return '<a href='.url('payments/'.$model->id.'/edit/')." class='btn btn-sm btn-primary btn-xs'> <i class='fa fa-edit' style='color:white;'> </i> Edit</a>"; |
|
| 171 | + } else { |
|
| 172 | + return '--'; |
|
| 173 | + } |
|
| 174 | + }) |
|
| 175 | 175 | |
| 176 | 176 | ->rawColumns(['checkbox', 'invoice_no', 'date', 'payment_method', 'total', 'status', 'action']) |
| 177 | 177 | |