Completed
Push — development ( b05d80...193319 )
by Ashutosh
30:40 queued 20:44
created
app/Http/Controllers/Order/InvoiceController.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
         $query = $this->advanceSearch($name, $invoice_no, $currency, $status, $from, $till);
131 131
 
132 132
         return \DataTables::of($query->take(100))
133
-         ->setTotalRecords($query->count())
133
+            ->setTotalRecords($query->count())
134 134
 
135
-         ->addColumn('checkbox', function ($model) {
136
-             return "<input type='checkbox' class='invoice_checkbox' 
135
+            ->addColumn('checkbox', function ($model) {
136
+                return "<input type='checkbox' class='invoice_checkbox' 
137 137
                             value=".$model->id.' name=select[] id=check>';
138
-         })
138
+            })
139 139
                         ->addColumn('user_id', function ($model) {
140 140
                             $first = $this->user->where('id', $model->user_id)->first()->first_name;
141 141
                             $last = $this->user->where('id', $model->user_id)->first()->last_name;
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 
144 144
                             return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>';
145 145
                         })
146
-                         ->addColumn('number', function ($model) {
147
-                             return ucfirst($model->number);
148
-                         })
146
+                            ->addColumn('number', function ($model) {
147
+                                return ucfirst($model->number);
148
+                            })
149 149
 
150 150
                         ->addColumn('date', function ($model) {
151 151
                             $date = ($model->created_at);
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
                             return $date;
154 154
                             // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m');
155 155
                         })
156
-                         ->addColumn('grand_total', function ($model) {
157
-                             return currency_format($model->grand_total, $code = $model->currency);
158
-                         })
159
-                          ->addColumn('status', function ($model) {
160
-                              return ucfirst($model->status);
161
-                          })
156
+                            ->addColumn('grand_total', function ($model) {
157
+                                return currency_format($model->grand_total, $code = $model->currency);
158
+                            })
159
+                            ->addColumn('status', function ($model) {
160
+                                return ucfirst($model->status);
161
+                            })
162 162
 
163 163
                         ->addColumn('action', function ($model) {
164 164
                             $action = '';
@@ -176,30 +176,30 @@  discard block
 block discarded – undo
176 176
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>"
177 177
                                     ."   $action";
178 178
                         })
179
-                         ->filterColumn('user_id', function ($query, $keyword) {
180
-                             $sql = 'first_name like ?';
181
-                             $query->whereRaw($sql, ["%{$keyword}%"]);
182
-                         })
179
+                            ->filterColumn('user_id', function ($query, $keyword) {
180
+                                $sql = 'first_name like ?';
181
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
182
+                            })
183 183
 
184
-                          ->filterColumn('status', function ($query, $keyword) {
185
-                              $sql = 'status like ?';
186
-                              $query->whereRaw($sql, ["%{$keyword}%"]);
187
-                          })
184
+                            ->filterColumn('status', function ($query, $keyword) {
185
+                                $sql = 'status like ?';
186
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
187
+                            })
188 188
 
189 189
                         ->filterColumn('number', function ($query, $keyword) {
190 190
                             $sql = 'number like ?';
191 191
                             $query->whereRaw($sql, ["%{$keyword}%"]);
192 192
                         })
193
-                         ->filterColumn('grand_total', function ($query, $keyword) {
194
-                             $sql = 'grand_total like ?';
195
-                             $query->whereRaw($sql, ["%{$keyword}%"]);
196
-                         })
197
-                          ->filterColumn('date', function ($query, $keyword) {
198
-                              $sql = 'date like ?';
199
-                              $query->whereRaw($sql, ["%{$keyword}%"]);
200
-                          })
201
-
202
-                         ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action'])
193
+                            ->filterColumn('grand_total', function ($query, $keyword) {
194
+                                $sql = 'grand_total like ?';
195
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
196
+                            })
197
+                            ->filterColumn('date', function ($query, $keyword) {
198
+                                $sql = 'date like ?';
199
+                                $query->whereRaw($sql, ["%{$keyword}%"]);
200
+                            })
201
+
202
+                            ->rawColumns(['checkbox', 'user_id', 'number', 'date', 'grand_total', 'status', 'action'])
203 203
                         ->make(true);
204 204
     }
205 205
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
                 $attributes[] = $item->attributes;
293 293
             }
294 294
             $invoice = $this->invoice->create(['user_id' => $user_id, 'number' => $number,
295
-             'date'                                      => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending',
296
-             'currency'                                  => \Auth::user()->currency, ]);
295
+                'date'                                      => $date, 'discount'=>$codevalue, 'grand_total' => $grand_total, 'coupon_code'=>$code, 'status' => 'pending',
296
+                'currency'                                  => \Auth::user()->currency, ]);
297 297
 
298 298
             foreach (\Cart::getContent() as $cart) {
299 299
                 $this->createInvoiceItems($invoice->id, $cart, $codevalue);
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
             $grand_total = \App\Http\Controllers\Front\CartController::rounding($grand_total);
415 415
 
416 416
             $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date,
417
-             'coupon_code'                        => $code, 'discount'=>$codeValue,
417
+                'coupon_code'                        => $code, 'discount'=>$codeValue,
418 418
                 'grand_total'                     => $grand_total,  'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
419 419
 
420 420
             $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid,
421
-             $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
421
+                $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
422 422
             $result = $this->getMessage($items, $user_id);
423 423
         } catch (\Exception $ex) {
424 424
             app('log')->info($ex->getMessage());
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0
497 497
 
498 498
                         $taxClassId = Tax::where('country', '')->where('state', 'Any State')
499
-                     ->pluck('tax_classes_id')->first(); //In case of India when
499
+                        ->pluck('tax_classes_id')->first(); //In case of India when
500 500
                         //other tax is available and tax is not enabled
501 501
                         if ($taxClassId) {
502 502
                             $rate = $this->getTotalRate($taxClassId, $productid, $taxs);
@@ -565,10 +565,10 @@  discard block
 block discarded – undo
565 565
         foreach ($taxes as $key => $tax) {
566 566
             if ($taxes[0]) {
567 567
                 $tax_attribute[$key] = ['name' => $tax->name, 'name1' => $name1,
568
-                 'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
569
-                 'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
570
-                 'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
571
-                  'origin_state'               => $origin_state, ];
568
+                    'name2'                       => $name2, 'name3' => $name3, 'name4' => $name4,
569
+                    'rate'                        => $value, 'rate1'=>$c_gst, 'rate2'=>$s_gst,
570
+                    'rate3'                       => $i_gst, 'rate4'=>$ut_gst, 'state'=>$state_code,
571
+                    'origin_state'               => $origin_state, ];
572 572
 
573 573
                 $rate = $tax->rate;
574 574
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             $from = $request->input('from');
110 110
             $till = $request->input('till');
111 111
 
112
-            return view('themes.default1.invoice.index', compact('name','invoice_no','status','currencies','currency_id','from',
112
+            return view('themes.default1.invoice.index', compact('name', 'invoice_no', 'status', 'currencies', 'currency_id', 'from',
113 113
 
114 114
                 'till'));
115 115
         } catch (\Exception $ex) {
@@ -132,35 +132,35 @@  discard block
 block discarded – undo
132 132
         return \DataTables::of($query->take(100))
133 133
          ->setTotalRecords($query->count())
134 134
 
135
-         ->addColumn('checkbox', function ($model) {
135
+         ->addColumn('checkbox', function($model) {
136 136
              return "<input type='checkbox' class='invoice_checkbox' 
137 137
                             value=".$model->id.' name=select[] id=check>';
138 138
          })
139
-                        ->addColumn('user_id', function ($model) {
139
+                        ->addColumn('user_id', function($model) {
140 140
                             $first = $this->user->where('id', $model->user_id)->first()->first_name;
141 141
                             $last = $this->user->where('id', $model->user_id)->first()->last_name;
142 142
                             $id = $this->user->where('id', $model->user_id)->first()->id;
143 143
 
144 144
                             return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'</a>';
145 145
                         })
146
-                         ->addColumn('number', function ($model) {
146
+                         ->addColumn('number', function($model) {
147 147
                              return ucfirst($model->number);
148 148
                          })
149 149
 
150
-                        ->addColumn('date', function ($model) {
150
+                        ->addColumn('date', function($model) {
151 151
                             $date = ($model->created_at);
152 152
 
153 153
                             return $date;
154 154
                             // return "<span style='display:none'>$model->id</span>".$date->format('l, F j, Y H:m');
155 155
                         })
156
-                         ->addColumn('grand_total', function ($model) {
156
+                         ->addColumn('grand_total', function($model) {
157 157
                              return currency_format($model->grand_total, $code = $model->currency);
158 158
                          })
159
-                          ->addColumn('status', function ($model) {
159
+                          ->addColumn('status', function($model) {
160 160
                               return ucfirst($model->status);
161 161
                           })
162 162
 
163
-                        ->addColumn('action', function ($model) {
163
+                        ->addColumn('action', function($model) {
164 164
                             $action = '';
165 165
 
166 166
                             $check = $this->checkExecution($model->id);
@@ -176,25 +176,25 @@  discard block
 block discarded – undo
176 176
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>"
177 177
                                     ."   $action";
178 178
                         })
179
-                         ->filterColumn('user_id', function ($query, $keyword) {
179
+                         ->filterColumn('user_id', function($query, $keyword) {
180 180
                              $sql = 'first_name like ?';
181 181
                              $query->whereRaw($sql, ["%{$keyword}%"]);
182 182
                          })
183 183
 
184
-                          ->filterColumn('status', function ($query, $keyword) {
184
+                          ->filterColumn('status', function($query, $keyword) {
185 185
                               $sql = 'status like ?';
186 186
                               $query->whereRaw($sql, ["%{$keyword}%"]);
187 187
                           })
188 188
 
189
-                        ->filterColumn('number', function ($query, $keyword) {
189
+                        ->filterColumn('number', function($query, $keyword) {
190 190
                             $sql = 'number like ?';
191 191
                             $query->whereRaw($sql, ["%{$keyword}%"]);
192 192
                         })
193
-                         ->filterColumn('grand_total', function ($query, $keyword) {
193
+                         ->filterColumn('grand_total', function($query, $keyword) {
194 194
                              $sql = 'grand_total like ?';
195 195
                              $query->whereRaw($sql, ["%{$keyword}%"]);
196 196
                          })
197
-                          ->filterColumn('date', function ($query, $keyword) {
197
+                          ->filterColumn('date', function($query, $keyword) {
198 198
                               $sql = 'date like ?';
199 199
                               $query->whereRaw($sql, ["%{$keyword}%"]);
200 200
                           })
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
             $invoice = Invoice::create(['user_id' => $user_id, 'number' => $number, 'date' => $date,
417 417
              'coupon_code'                        => $code, 'discount'=>$codeValue,
418
-                'grand_total'                     => $grand_total,  'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
418
+                'grand_total'                     => $grand_total, 'currency'  => $currency, 'status' => $status, 'description' => $description, ]);
419 419
 
420 420
             $items = $this->createInvoiceItemsByAdmin($invoice->id, $productid,
421 421
              $code, $total, $currency, $qty, $agents, $plan, $user_id, $tax_name, $tax_rate);
Please login to merge, or discard this patch.