Completed
Push — development ( 26d9cf...abf04d )
by Ashutosh
09:30
created
app/Http/Controllers/Order/InvoiceController.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
175 175
                             style='color:white;'> </i>&nbsp;&nbsp;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
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 
294 294
             $symbol = $attributes[0]['currency']['symbol'];
295 295
             $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number,
296
-             'date'                                      => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending',
297
-             'currency'                                  => \Auth::user()->currency, ]);
296
+                'date'                                      => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending',
297
+                'currency'                                  => \Auth::user()->currency, ]);
298 298
             foreach (\Cart::getContent() as $cart) {
299 299
                 $this->createInvoiceItems($invoice->id, $cart, $codevalue);
300 300
             }
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
     {
323 323
         $code = '';
324 324
         $codevalue = '';
325
-         if(\Session::has('code')){//If coupon code is applied get it here from Session
326
-              $code = \Session::get('code');
327
-              $codevalue = \Session::get('codevalue');
325
+            if(\Session::has('code')){//If coupon code is applied get it here from Session
326
+                $code = \Session::get('code');
327
+                $codevalue = \Session::get('codevalue');
328 328
             }
329 329
             return ['code'=> $code , 'codevalue'=>$codevalue] ; 
330 330
     }
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
             $grand_total = \App\Http\Controllers\Front\CartController::rounding($grand_total);
434 434
 
435 435
             $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date,
436
-             'coupon_code'                        => $code, 'discount'=>$codeValue,
436
+                'coupon_code'                        => $code, 'discount'=>$codeValue,
437 437
                 'grand_total'                     => $grand_total,  'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
438 438
 
439 439
             $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid,
440
-             $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
440
+                $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
441 441
             $result = $this->getMessage($items, $user_id);
442 442
         } catch (\Exception $ex) {
443 443
             app('log')->info($ex->getMessage());
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                 } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0
514 514
 
515 515
                     $taxClassId = Tax::where('country', '')->where('state', 'Any State')
516
-                     ->pluck('tax_classes_id')->first(); //In case of India when
516
+                        ->pluck('tax_classes_id')->first(); //In case of India when
517 517
                     //other tax is available and tax is not enabled
518 518
                     if ($taxClassId) {
519 519
                         $rate = $this->getTotalRate($taxClassId, $productid, $taxs);
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
         foreach ($taxes as $key => $tax) {
582 582
             if ($taxes[0]) {
583 583
                 $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1,
584
-                 'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
585
-                 'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
586
-                 'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
587
-                  'origin_state'               => $origin_state, ];
584
+                    'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
585
+                    'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
586
+                    'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
587
+                    'origin_state'               => $origin_state, ];
588 588
 
589 589
                 $rate = $tax->rate;
590 590
 
Please login to merge, or discard this patch.