Completed
Push — development ( b7f899...27ba1a )
by Ashutosh
11:31
created
app/Http/Controllers/Order/InvoiceController.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
         $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till);
126 126
 
127 127
         return \DataTables::of($query->take(100))
128
-         ->setTotalRecords($query->count())
128
+            ->setTotalRecords($query->count())
129 129
 
130
-         ->addColumn('checkbox', function ($model) {
131
-             return "<input type='checkbox' class='invoice_checkbox' 
130
+            ->addColumn('checkbox', function ($model) {
131
+                return "<input type='checkbox' class='invoice_checkbox' 
132 132
                             value=".$model->id.' name=select[] id=check>';
133
-         })
133
+            })
134 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;
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
                             return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>';
140 140
                         })
141
-                         ->addColumn('number', function ($model) {
142
-                             return ucfirst($model->number);
143
-                         })
141
+                            ->addColumn('number', function ($model) {
142
+                                return ucfirst($model->number);
143
+                            })
144 144
 
145 145
                         ->addColumn('date', function ($model) {
146 146
                             $date = ($model->created_at);
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
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) {
152
-                             return ucfirst($model->number);
153
-                         })
154
-                          ->addColumn('status', function ($model) {
155
-                              return ucfirst($model->status);
156
-                          })
151
+                            ->addColumn('grand_total', function ($model) {
152
+                                return ucfirst($model->number);
153
+                            })
154
+                            ->addColumn('status', function ($model) {
155
+                                return ucfirst($model->status);
156
+                            })
157 157
 
158 158
                         ->addColumn('action', function ($model) {
159 159
                             $action = '';
@@ -171,30 +171,30 @@  discard block
 block discarded – undo
171 171
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>"
172 172
                                     ."   $action";
173 173
                         })
174
-                         ->filterColumn('user_id', function ($query, $keyword) {
175
-                             $sql = 'first_name like ?';
176
-                             $query->whereRaw($sql, ["%{$keyword}%"]);
177
-                         })
174
+                            ->filterColumn('user_id', function ($query, $keyword) {
175
+                                $sql = 'first_name like ?';
176
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
177
+                            })
178 178
 
179
-                          ->filterColumn('status', function ($query, $keyword) {
180
-                              $sql = 'status like ?';
181
-                              $query->whereRaw($sql, ["%{$keyword}%"]);
182
-                          })
179
+                            ->filterColumn('status', function ($query, $keyword) {
180
+                                $sql = 'status like ?';
181
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
182
+                            })
183 183
 
184 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) {
189
-                             $sql = 'grand_total like ?';
190
-                             $query->whereRaw($sql, ["%{$keyword}%"]);
191
-                         })
192
-                          ->filterColumn('date', function ($query, $keyword) {
193
-                              $sql = 'date like ?';
194
-                              $query->whereRaw($sql, ["%{$keyword}%"]);
195
-                          })
196
-
197
-                         ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action'])
188
+                            ->filterColumn('grand_total', function ($query, $keyword) {
189
+                                $sql = 'grand_total like ?';
190
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
191
+                            })
192
+                            ->filterColumn('date', function ($query, $keyword) {
193
+                                $sql = 'date like ?';
194
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
195
+                            })
196
+
197
+                            ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action'])
198 198
                         ->make(true);
199 199
     }
200 200
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
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;
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
             $symbol = $attributes[0]['currency'][0]['code'];
425 425
             //dd($symbol);
426 426
             $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number,
427
-             'date'                                      => $date, 'grand_total' => $grand_total, 'status' => 'pending',
428
-             'currency'                                  => $symbol, ]);
427
+                'date'                                      => $date, 'grand_total' => $grand_total, 'status' => 'pending',
428
+                'currency'                                  => $symbol, ]);
429 429
 
430 430
             foreach (\Cart::getContent() as $cart) {
431 431
                 $this->createInvoiceItems($invoice->id, $cart);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                 'currency'                        => $currency, 'status' => 'pending', 'description' => $description, ]);
531 531
 
532 532
             $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid,
533
-             $code, $total, $currency, $qty, $plan, $user_id, $tax_name, $tax_rate);
533
+                $code, $total, $currency, $qty, $plan, $user_id, $tax_name, $tax_rate);
534 534
             $result = $this->getMessage($items, $user_id);
535 535
         } catch (\Exception $ex) {
536 536
             dd($ex);
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                 } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0
683 683
 
684 684
                     $taxClassId = Tax::where('country', '')->where('state', 'Any State')
685
-                     ->pluck('tax_classes_id')->first(); //In case of India when
685
+                        ->pluck('tax_classes_id')->first(); //In case of India when
686 686
                     //other tax is available and tax is not enabled
687 687
                     if ($taxClassId) {
688 688
                         $rate = $this->getTotalRate($taxClassId, $productid, $taxs);
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
         foreach ($taxes as $key => $tax) {
751 751
             if ($taxes[0]) {
752 752
                 $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1,
753
-                 'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
754
-                 'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
755
-                 'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
756
-                  'origin_state'               => $origin_state, ];
753
+                    'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
754
+                    'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
755
+                    'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
756
+                    'origin_state'               => $origin_state, ];
757 757
 
758 758
                 $rate = $tax->rate;
759 759
 
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
                 }
964 964
 
965 965
                 return view('themes.default1.invoice.payment',
966
-                 compact('invoice_status', 'payment_status',
967
-                  'payment_method', 'invoice_id', 'domain', 'invoice', 'userid'));
966
+                    compact('invoice_status', 'payment_status',
967
+                    'payment_method', 'invoice_id', 'domain', 'invoice', 'userid'));
968 968
             }
969 969
 
970 970
             return redirect()->back();
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
                 case 1:
1004 1004
                     $percentage = $price * ($value / 100);
1005 1005
 
1006
-                     return $price - $percentage;
1006
+                        return $price - $percentage;
1007 1007
                 case 2:
1008 1008
                     return $price - $value;
1009 1009
                 case 3:
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
             $payment_date = \Carbon\Carbon::now()->toDateTimeString();
1036 1036
             $amount = $grand_total;
1037 1037
             $paymentRenewal = $this->updateInvoicePayment($invoiceid, $payment_method,
1038
-             $payment_status, $payment_date, $amount);
1038
+                $payment_status, $payment_date, $amount);
1039 1039
 
1040 1040
             return redirect()->back()->with('success', 'Payment Accepted Successfully');
1041 1041
         } catch (\Exception $ex) {
Please login to merge, or discard this patch.
app/Http/Controllers/Front/ClientController.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         try {
130 130
             $versions = ProductUpload::where('product_id', $productid)
131 131
             ->select('id', 'product_id', 'version',
132
-             'title', 'description', 'file', 'created_at')->get();
132
+                'title', 'description', 'file', 'created_at')->get();
133 133
             $countVersions = count($versions);
134 134
             $countExpiry = 0;
135 135
             $invoice_id = Invoice::where('number', $invoiceid)->pluck('id')->first();
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 
138 138
             $order_id = $order->id;
139 139
             $endDate = Subscription::select('ends_at')
140
-                 ->where('product_id', $productid)->where('order_id', $order_id)->first();
140
+                    ->where('product_id', $productid)->where('order_id', $order_id)->first();
141 141
             if ($endDate){
142 142
             foreach ($versions as $version) {
143 143
                 if ($version->created_at->toDateTimeString()
144
-               < $endDate->ends_at->toDateTimeString()) {
144
+                < $endDate->ends_at->toDateTimeString()) {
145 145
                     $countExpiry = $countExpiry + 1;
146 146
                 }
147 147
             }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
             $bussinesses = \App\Model\Common\Bussiness::pluck('name', 'short')->toArray();
394 394
 
395 395
             return view('themes.default1.front.clients.profile',
396
-             compact('user', 'timezones', 'state', 'states', 'bussinesses'));
396
+                compact('user', 'timezones', 'state', 'states', 'bussinesses'));
397 397
         } catch (Exception $ex) {
398 398
             Bugsnag::notifyException($ex);
399 399
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
                                 return $model->grand_total;
473 473
                             })
474 474
                             ->rawColumns(['checkbox', 'number', 'total',
475
-                             'payment_method', 'payment_status', 'created_at', ])
475
+                                'payment_method', 'payment_status', 'created_at', ])
476 476
                             ->make(true);
477 477
         } catch (Exception $ex) {
478 478
             Bugsnag::notifyException($ex);
@@ -498,17 +498,17 @@  discard block
 block discarded – undo
498 498
                             ->addColumn('number', function ($model) {
499 499
                                 return $model->invoice()->first()->number;
500 500
                             })
501
-                              ->addColumn('total', function ($model) {
502
-                                  return $model->amount;
503
-                              })
504
-                               ->addColumn('created_at', function ($model) {
505
-                                   $date1 = new DateTime($model->created_at);
506
-                                   $tz = \Auth::user()->timezone()->first()->name;
507
-                                   $date1->setTimezone(new DateTimeZone($tz));
508
-                                   $date = $date1->format('M j, Y, g:i a');
509
-
510
-                                   return $date;
511
-                               })
501
+                                ->addColumn('total', function ($model) {
502
+                                    return $model->amount;
503
+                                })
504
+                                ->addColumn('created_at', function ($model) {
505
+                                    $date1 = new DateTime($model->created_at);
506
+                                    $tz = \Auth::user()->timezone()->first()->name;
507
+                                    $date1->setTimezone(new DateTimeZone($tz));
508
+                                    $date = $date1->format('M j, Y, g:i a');
509
+
510
+                                    return $date;
511
+                                })
512 512
 
513 513
                             ->addColumn('payment_method', 'payment_status', 'created_at')
514 514
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
                     ->select('number', 'created_at', 'grand_total', 'id', 'status');
78 78
 
79 79
             return \DataTables::of($invoices->get())
80
-                            ->addColumn('number', function ($model) {
80
+                            ->addColumn('number', function($model) {
81 81
                                 return $model->number;
82 82
                             })
83
-                            ->addColumn('date', function ($model) {
83
+                            ->addColumn('date', function($model) {
84 84
                                 $date = $model->created_at;
85 85
 
86 86
                                 return $date;
87 87
                                 // $myobject->created_at->timezone($this->auth->user()->timezone);
88 88
                             })
89 89
                             // ->showColumns('created_at')
90
-                            ->addColumn('total', function ($model) {
90
+                            ->addColumn('total', function($model) {
91 91
                                 return $model->grand_total;
92 92
                             })
93
-                            ->addColumn('Action', function ($model) {
93
+                            ->addColumn('Action', function($model) {
94 94
                                 $status = $model->status;
95 95
                                 $payment = '';
96 96
                                 if ($status == 'Pending' && $model->grand_total > 0) {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $order_id = $order->id;
139 139
             $endDate = Subscription::select('ends_at')
140 140
                  ->where('product_id', $productid)->where('order_id', $order_id)->first();
141
-            if ($endDate){
141
+            if ($endDate) {
142 142
             foreach ($versions as $version) {
143 143
                 if ($version->created_at->toDateTimeString()
144 144
                < $endDate->ends_at->toDateTimeString()) {
@@ -148,19 +148,19 @@  discard block
 block discarded – undo
148 148
         }
149 149
 
150 150
             return \DataTables::of($versions)
151
-                            ->addColumn('id', function ($versions) {
151
+                            ->addColumn('id', function($versions) {
152 152
                                 return ucfirst($versions->id);
153 153
                             })
154
-                            ->addColumn('version', function ($versions) {
154
+                            ->addColumn('version', function($versions) {
155 155
                                 return ucfirst($versions->version);
156 156
                             })
157
-                            ->addColumn('title', function ($versions) {
157
+                            ->addColumn('title', function($versions) {
158 158
                                 return ucfirst($versions->title);
159 159
                             })
160
-                            ->addColumn('description', function ($versions) {
160
+                            ->addColumn('description', function($versions) {
161 161
                                 return ucfirst($versions->description);
162 162
                             })
163
-                            ->addColumn('file', function ($versions) use ($countExpiry, $countVersions,$clientid, $invoiceid, $productid) {
163
+                            ->addColumn('file', function($versions) use ($countExpiry, $countVersions, $clientid, $invoiceid, $productid) {
164 164
                                 $invoice_id = Invoice::where('number', $invoiceid)->pluck('id')->first();
165 165
                                 $order = Order::where('invoice_id', '=', $invoice_id)->first();
166 166
                                 $order_id = $order->id;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             $order_id = $order->id;
253 253
             $orderEndDate = Subscription::select('ends_at')
254 254
                         ->where('product_id', $productid)->where('order_id', $order_id)->first();
255
-            if ($orderEndDate){
255
+            if ($orderEndDate) {
256 256
             foreach ($link as $lin) {
257 257
                 if (strtotime($lin['created_at']) < strtotime($orderEndDate->ends_at)) {
258 258
                     $countExpiry = $countExpiry + 1;
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
         }
262 262
 
263 263
             return \DataTables::of($link)
264
-                            ->addColumn('version', function ($link) {
264
+                            ->addColumn('version', function($link) {
265 265
                                 return ucfirst($link['tag_name']);
266 266
                             })
267
-                            ->addColumn('name', function ($link) {
267
+                            ->addColumn('name', function($link) {
268 268
                                 return ucfirst($link['name']);
269 269
                             })
270
-                            ->addColumn('description', function ($link) {
270
+                            ->addColumn('description', function($link) {
271 271
                                 $markdown = Markdown::convertToHtml(ucfirst($link['body']));
272 272
 
273 273
                                 return $markdown;
274 274
                             })
275
-                            ->addColumn('file', function ($link) use ($countExpiry,$countVersions,$invoiceid, $productid) {
275
+                            ->addColumn('file', function($link) use ($countExpiry, $countVersions, $invoiceid, $productid) {
276 276
                                 $order = Order::where('invoice_id', '=', $invoiceid)->first();
277 277
                                 $order_id = $order->id;
278 278
                                 $orderEndDate = Subscription::select('ends_at')
@@ -319,20 +319,20 @@  discard block
 block discarded – undo
319 319
             $orders = Order::where('client', \Auth::user()->id);
320 320
 
321 321
             return \DataTables::of($orders->get())
322
-                            ->addColumn('id', function ($model) {
322
+                            ->addColumn('id', function($model) {
323 323
                                 return $model->id;
324 324
                             })
325
-                            ->addColumn('product_name', function ($model) {
325
+                            ->addColumn('product_name', function($model) {
326 326
                                 return $model->product()->first()->name;
327 327
                             })
328
-                            ->addColumn('expiry', function ($model) {
328
+                            ->addColumn('expiry', function($model) {
329 329
                                 $tz = \Auth::user()->timezone()->first()->name;
330 330
                                 $end = $this->getExpiryDate($model);
331 331
 
332 332
                                 return $end;
333 333
                             })
334 334
 
335
-                            ->addColumn('Action', function ($model) {
335
+                            ->addColumn('Action', function($model) {
336 336
                                 $sub = $model->subscription()->first();
337 337
                                 $order = Order::where('id', $model->id)->select('product')->first();
338 338
                                 $productid = $order->product;
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
                     ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at');
459 459
 
460 460
             return \DataTables::of($payments->get())
461
-                            ->addColumn('checkbox', function ($model) {
461
+                            ->addColumn('checkbox', function($model) {
462 462
                                 if (\Input::get('client') != 'true') {
463 463
                                     return "<input type='checkbox' class='payment_checkbox' 
464 464
                                     value=".$model->id.' name=select[] id=check>';
465 465
                                 }
466 466
                             })
467
-                            ->addColumn('number', function ($model) {
467
+                            ->addColumn('number', function($model) {
468 468
                                 return $model->invoice()->first()->number;
469 469
                             })
470 470
                             ->addColumn('amount', 'payment_method', 'payment_status', 'created_at')
471
-                            ->addColumn('total', function ($model) {
471
+                            ->addColumn('total', function($model) {
472 472
                                 return $model->grand_total;
473 473
                             })
474 474
                             ->rawColumns(['checkbox', 'number', 'total',
@@ -495,13 +495,13 @@  discard block
 block discarded – undo
495 495
                     ->select('id', 'invoice_id', 'user_id', 'payment_method', 'payment_status', 'created_at', 'amount');
496 496
             //dd(\Input::all());
497 497
             return \DataTables::of($payments->get())
498
-                            ->addColumn('number', function ($model) {
498
+                            ->addColumn('number', function($model) {
499 499
                                 return $model->invoice()->first()->number;
500 500
                             })
501
-                              ->addColumn('total', function ($model) {
501
+                              ->addColumn('total', function($model) {
502 502
                                   return $model->amount;
503 503
                               })
504
-                               ->addColumn('created_at', function ($model) {
504
+                               ->addColumn('created_at', function($model) {
505 505
                                    $date1 = new DateTime($model->created_at);
506 506
                                    $tz = \Auth::user()->timezone()->first()->name;
507 507
                                    $date1->setTimezone(new DateTimeZone($tz));
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $order_id = $order->id;
139 139
             $endDate = Subscription::select('ends_at')
140 140
                  ->where('product_id', $productid)->where('order_id', $order_id)->first();
141
-            if ($endDate){
141
+            if ($endDate) {
142 142
             foreach ($versions as $version) {
143 143
                 if ($version->created_at->toDateTimeString()
144 144
                < $endDate->ends_at->toDateTimeString()) {
@@ -170,11 +170,13 @@  discard block
 block discarded – undo
170 170
 
171 171
                                 //if product has expiry date ie sunscriptioon is generated
172 172
                                 if ($endDate) {
173
-                                    if ($getDownloadCondition == 1) {//Perpetual download till expiry selected
173
+                                    if ($getDownloadCondition == 1) {
174
+//Perpetual download till expiry selected
174 175
                                         $getDownload = $this->whenDownloadTillExpiry($endDate, $productid, $versions, $clientid, $invoiceid);
175 176
 
176 177
                                         return $getDownload;
177
-                                    } elseif ($getDownloadCondition == 0) {//When download retires after subscription
178
+                                    } elseif ($getDownloadCondition == 0) {
179
+//When download retires after subscription
178 180
 
179 181
                                         $getDownload = $this->whenDownloadExpiresAfterExpiry($countExpiry, $countVersions, $endDate, $productid, $versions, $clientid, $invoiceid);
180 182
 
@@ -252,7 +254,7 @@  discard block
 block discarded – undo
252 254
             $order_id = $order->id;
253 255
             $orderEndDate = Subscription::select('ends_at')
254 256
                         ->where('product_id', $productid)->where('order_id', $order_id)->first();
255
-            if ($orderEndDate){
257
+            if ($orderEndDate) {
256 258
             foreach ($link as $lin) {
257 259
                 if (strtotime($lin['created_at']) < strtotime($orderEndDate->ends_at)) {
258 260
                     $countExpiry = $countExpiry + 1;
Please login to merge, or discard this patch.