Completed
Pull Request — development (#727)
by Ashutosh
18:52 queued 09:21
created
app/Http/Controllers/Order/InvoiceController.php 1 patch
Indentation   +40 added lines, -40 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
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.