Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
power
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
254
Issues
254
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pardeep Sahu
power
Commits
a708148c
Commit
a708148c
authored
3 years ago
by
sonu gupta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/dcfFilter' into staging
parents
f13e78c2
7e1fd2ea
Pipeline
#1972
passed with stage
in 35 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
247 additions
and
22 deletions
+247
-22
app/Http/Controllers/AdminController.php
app/Http/Controllers/AdminController.php
+40
-1
app/Http/Controllers/AsmController.php
app/Http/Controllers/AsmController.php
+38
-1
app/Http/Controllers/RsmController.php
app/Http/Controllers/RsmController.php
+36
-1
app/Http/Controllers/SseController.php
app/Http/Controllers/SseController.php
+38
-1
resources/views/admin/dcf_report.blade.php
resources/views/admin/dcf_report.blade.php
+27
-9
resources/views/asm/dcf_report.blade.php
resources/views/asm/dcf_report.blade.php
+22
-3
resources/views/rsm/dcf_report.blade.php
resources/views/rsm/dcf_report.blade.php
+23
-3
resources/views/sse/dcf_report.blade.php
resources/views/sse/dcf_report.blade.php
+23
-3
No files found.
app/Http/Controllers/AdminController.php
View file @
a708148c
...
...
@@ -6953,7 +6953,40 @@ class AdminController extends Controller
$year = $monthYear[0];
$month = $monthYear[1];
$model = array();
$dealers = DB::table('users')->where('role', 2)->where('id', '!=', 58)->orderBy('name', 'ASC')->get();
$dealers = DB::table('users')->where('role', 2)
->where('id', '!=', 58)
->where('status',1);
if (!empty(request()->firm)) {
$dealers = $dealers->where('firm_id',request()->firm);
}
if (!empty(request()->brand)) {
$brandFilterDealer = DB::table('dealer_templates')
// ->select('template_id')
->join('treatments','dealer_templates.template_id','treatments.temp_id')
->join('products_treatments','treatments.id','products_treatments.tre_id')
->join('products','products_treatments.pro_id','products.id')
// ->select('treatments.id as treatment_id')
// ->limit(10)
->where('products.brand_id', request()->brand)
->groupBy('dealer_templates.dealer_id')
->select('dealer_templates.dealer_id')
->get()->toArray();
$brandFilterDealerArray= array_map(function($value){
// dd($value->dealer_id);
return $value->dealer_id;
},$brandFilterDealer);
// dd($brandFilterDealerArray);
$dealers = $dealers->whereIn('id',$brandFilterDealerArray);
}
$dealers =$dealers->orderBy('name', 'ASC')->get();
// dd($dealers);
if (!empty($dealers) && @count($dealers) > 0) {
return Excel::create('DCF_' . date("d-M-Y"), function ($excel) use ($dealers, $search, $month, $year) {
foreach ($dealers as $dealerValue) {
...
...
@@ -7119,6 +7152,10 @@ class AdminController extends Controller
/************************************ DCF Report End *******************************/
$firmsList = DB::table('firms')->get();
$brandList = DB::table('product_brands')->get();
Session::put('oldReport', $type);
return view('admin.dcf_report', [
//'result' => $result1,
...
...
@@ -7137,6 +7174,8 @@ class AdminController extends Controller
'oldSelectMonth' => @$search['month1'],
'oldReport' => @$type,
'tabName' => @$search['tabName'],
'firmsList' => @$firmsList,
'brandList' => @$brandList,
]);
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/AsmController.php
View file @
a708148c
...
...
@@ -3407,7 +3407,39 @@ class AsmController extends Controller
$year
=
$monthYear
[
0
];
$month
=
$monthYear
[
1
];
$model
=
array
();
$dealer_ids
=
DB
::
table
(
'users'
)
->
select
(
'id'
,
'name'
,
'reporting_authority'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
])
->
orderBy
(
'id'
,
'DESC'
)
->
get
();
$dealer_ids
=
DB
::
table
(
'users'
)
->
select
(
'id'
,
'name'
,
'firm_id'
,
'reporting_authority'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
]);
if
(
!
empty
(
request
()
->
firm
))
{
$dealer_ids
=
$dealer_ids
->
where
(
'firm_id'
,
request
()
->
firm
);
}
if
(
!
empty
(
request
()
->
brand
))
{
$brandFilterDealer
=
DB
::
table
(
'dealer_templates'
)
// ->select('template_id')
->
join
(
'treatments'
,
'dealer_templates.template_id'
,
'treatments.temp_id'
)
->
join
(
'products_treatments'
,
'treatments.id'
,
'products_treatments.tre_id'
)
->
join
(
'products'
,
'products_treatments.pro_id'
,
'products.id'
)
// ->select('treatments.id as treatment_id')
// ->limit(10)
->
where
(
'products.brand_id'
,
request
()
->
brand
)
->
groupBy
(
'dealer_templates.dealer_id'
)
->
select
(
'dealer_templates.dealer_id'
)
->
get
()
->
toArray
();
$brandFilterDealerArray
=
array_map
(
function
(
$value
){
// dd($value->dealer_id);
return
$value
->
dealer_id
;
},
$brandFilterDealer
);
// dd($brandFilterDealerArray);
$dealer_ids
=
$dealer_ids
->
whereIn
(
'id'
,
$brandFilterDealerArray
);
}
$dealer_ids
=
$dealer_ids
->
orderBy
(
'id'
,
'DESC'
)
->
get
();
// dd($dealer_ids);
$dealers
=
array
();
$d_ids
=
array
();
foreach
(
$dealer_ids
as
$i
=>
$j
)
{
...
...
@@ -3417,6 +3449,7 @@ class AsmController extends Controller
// $d_ids[]=$dealer_ids[$i]->id;
}
}
if
(
!
empty
(
$dealers
)
&&
@
count
(
$dealers
)
>
0
)
{
return
Excel
::
create
(
'DCF_'
.
date
(
"d-M-Y"
),
function
(
$excel
)
use
(
$dealers
,
$search
,
$month
,
$year
)
{
foreach
(
$dealers
as
$dealerValue
)
{
...
...
@@ -3580,6 +3613,8 @@ class AsmController extends Controller
}
/************************************ DCF Report End *******************************/
$firmsList
=
DB
::
table
(
'firms'
)
->
get
();
$brandList
=
DB
::
table
(
'product_brands'
)
->
get
();
Session
::
put
(
'oldReport'
,
$type
);
return
view
(
'asm.dcf_report'
,
[
...
...
@@ -3599,6 +3634,8 @@ class AsmController extends Controller
'oldSelectMonth'
=>
@
$search
[
'month1'
],
'oldReport'
=>
@
$type
,
'tabName'
=>
@
$search
[
'tabName'
],
'firmsList'
=>
@
$firmsList
,
'brandList'
=>
@
$brandList
,
]);
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/RsmController.php
View file @
a708148c
...
...
@@ -2884,7 +2884,38 @@ class RsmController extends Controller
$year
=
$monthYear
[
0
];
$month
=
$monthYear
[
1
];
$model
=
array
();
$dealer_ids
=
DB
::
table
(
'users'
)
->
select
(
'id'
,
'name'
,
'reporting_authority'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
])
->
orderBy
(
'id'
,
'DESC'
)
->
get
();
$dealer_ids
=
DB
::
table
(
'users'
)
->
select
(
'id'
,
'name'
,
'firm_id'
,
'reporting_authority'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
]);
if
(
!
empty
(
request
()
->
firm
))
{
$dealer_ids
=
$dealer_ids
->
where
(
'firm_id'
,
request
()
->
firm
);
}
if
(
!
empty
(
request
()
->
brand
))
{
$brandFilterDealer
=
DB
::
table
(
'dealer_templates'
)
// ->select('template_id')
->
join
(
'treatments'
,
'dealer_templates.template_id'
,
'treatments.temp_id'
)
->
join
(
'products_treatments'
,
'treatments.id'
,
'products_treatments.tre_id'
)
->
join
(
'products'
,
'products_treatments.pro_id'
,
'products.id'
)
// ->select('treatments.id as treatment_id')
// ->limit(10)
->
where
(
'products.brand_id'
,
request
()
->
brand
)
->
groupBy
(
'dealer_templates.dealer_id'
)
->
select
(
'dealer_templates.dealer_id'
)
->
get
()
->
toArray
();
$brandFilterDealerArray
=
array_map
(
function
(
$value
){
// dd($value->dealer_id);
return
$value
->
dealer_id
;
},
$brandFilterDealer
);
// dd($brandFilterDealerArray);
$dealer_ids
=
$dealer_ids
->
whereIn
(
'id'
,
$brandFilterDealerArray
);
}
$dealer_ids
=
$dealer_ids
->
orderBy
(
'id'
,
'DESC'
)
->
get
();
$dealers
=
array
();
$d_ids
=
array
();
foreach
(
$dealer_ids
as
$i
=>
$j
)
{
...
...
@@ -3059,6 +3090,8 @@ class RsmController extends Controller
/************************************ DCF Report End *******************************/
$firmsList
=
DB
::
table
(
'firms'
)
->
get
();
$brandList
=
DB
::
table
(
'product_brands'
)
->
get
();
Session
::
put
(
'oldReport'
,
$type
);
return
view
(
'rsm.dcf_report'
,
[
...
...
@@ -3078,6 +3111,8 @@ class RsmController extends Controller
'oldSelectMonth'
=>
@
$search
[
'month1'
],
'oldReport'
=>
@
$type
,
'tabName'
=>
@
$search
[
'tabName'
],
'firmsList'
=>
@
$firmsList
,
'brandList'
=>
@
$brandList
,
]);
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/SseController.php
View file @
a708148c
...
...
@@ -3383,7 +3383,39 @@ class SseController extends Controller
$year
=
$monthYear
[
0
];
$month
=
$monthYear
[
1
];
$model
=
array
();
$dealer_ids
=
DB
::
table
(
'users'
)
->
select
(
'id'
,
'name'
,
'reporting_authority'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
])
->
orderBy
(
'id'
,
'DESC'
)
->
get
();
$dealer_ids
=
DB
::
table
(
'users'
)
->
select
(
'id'
,
'name'
,
'firm_id'
,
'reporting_authority'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
]);
if
(
!
empty
(
request
()
->
firm
))
{
$dealer_ids
=
$dealer_ids
->
where
(
'firm_id'
,
request
()
->
firm
);
}
if
(
!
empty
(
request
()
->
brand
))
{
$brandFilterDealer
=
DB
::
table
(
'dealer_templates'
)
// ->select('template_id')
->
join
(
'treatments'
,
'dealer_templates.template_id'
,
'treatments.temp_id'
)
->
join
(
'products_treatments'
,
'treatments.id'
,
'products_treatments.tre_id'
)
->
join
(
'products'
,
'products_treatments.pro_id'
,
'products.id'
)
// ->select('treatments.id as treatment_id')
// ->limit(10)
->
where
(
'products.brand_id'
,
request
()
->
brand
)
->
groupBy
(
'dealer_templates.dealer_id'
)
->
select
(
'dealer_templates.dealer_id'
)
->
get
()
->
toArray
();
$brandFilterDealerArray
=
array_map
(
function
(
$value
){
// dd($value->dealer_id);
return
$value
->
dealer_id
;
},
$brandFilterDealer
);
// dd($brandFilterDealerArray);
$dealer_ids
=
$dealer_ids
->
whereIn
(
'id'
,
$brandFilterDealerArray
);
}
$dealer_ids
=
$dealer_ids
->
orderBy
(
'id'
,
'DESC'
)
->
get
();
$dealers
=
array
();
$d_ids
=
array
();
foreach
(
$dealer_ids
as
$i
=>
$j
)
{
...
...
@@ -3558,6 +3590,9 @@ class SseController extends Controller
/************************************ DCF Report End *******************************/
$firmsList
=
DB
::
table
(
'firms'
)
->
get
();
$brandList
=
DB
::
table
(
'product_brands'
)
->
get
();
Session
::
put
(
'oldReport'
,
$type
);
return
view
(
'sse.dcf_report'
,
[
...
...
@@ -3577,6 +3612,8 @@ class SseController extends Controller
'oldSelectMonth'
=>
@
$search
[
'month1'
],
'oldReport'
=>
@
$type
,
'tabName'
=>
@
$search
[
'tabName'
],
'firmsList'
=>
@
$firmsList
,
'brandList'
=>
@
$brandList
,
]);
}
...
...
This diff is collapsed.
Click to expand it.
resources/views/admin/dcf_report.blade.php
View file @
a708148c
...
...
@@ -42,15 +42,33 @@
@
endif
<
form
action
=
""
class
=
""
method
=
"GET"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 col-md-offset-2 col-md-8"
>
<
div
class
=
"input-group form-group report-field col-md-6 col-sm-6 col-xs-12"
style
=
"float: left !important;"
>
<
label
>
Select
Month
</
label
>
<
input
type
=
"text"
id
=
"selectMonth"
name
=
"selectMonth"
placeholder
=
"Select Month"
value
=
""
class
=
"datePicker1 form-control"
autocomplete
=
"off"
/>
</
div
>
<
div
class
=
"form-group report-field col-md-6 col-sm-6 col-xs-12"
style
=
"margin-top:25px;"
>
<
input
class
=
"btn btn-success"
type
=
"submit"
value
=
"Download"
>
</
div
>
<
div
class
=
"input-group form-group report-field col-md-4 col-sm-4 col-xs-12"
style
=
"float: left !important;"
>
<
label
>
Select
Month
</
label
>
<
input
type
=
"text"
id
=
"selectMonth"
name
=
"selectMonth"
placeholder
=
"Select Month"
value
=
""
class
=
"datePicker1 form-control"
autocomplete
=
"off"
/>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Firms
</
label
>
<
select
name
=
"firm"
class
=
"form-control"
id
=
"firm"
>
<
option
value
=
""
>
Select
Firms
</
option
>
@
foreach
(
$firmsList
as
$firm
)
<
option
value
=
"
{
{$firm->id}
}
"
@
if
(
@
$oldFirm
==
$firm
->
id
)
{{
'selected'
}}
@
endif
>
{{
$firm
->
firm_name
}}
</
option
>
@
endforeach
</
select
>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Brands
</
label
>
<
select
class
=
"form-control"
id
=
"brand"
name
=
"brand"
>
<
option
value
=
""
>
Select
Brand
</
option
>
@
foreach
(
$brandList
as
$value
)
<
option
{{(
@
request
()
->
brand
==
$value
->
id
)
?
'selected'
:
''
}}
value
=
"
{
{$value->id}}">{{$value->brand_name}
}
</option>
@endforeach
</select>
</div>
<div class="
form
-
group
report
-
field
col
-
md
-
6
col
-
sm
-
6
col
-
xs
-
12
" style="
margin
-
top
:
25
px
;
">
<input class="
btn
btn
-
success
" type="
submit
" value="
Download
">
</div>
</div>
</form>
...
...
This diff is collapsed.
Click to expand it.
resources/views/asm/dcf_report.blade.php
View file @
a708148c
...
...
@@ -42,16 +42,35 @@
@
endif
<
form
action
=
""
class
=
""
method
=
"GET"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 col-md-offset-2 col-md-8"
>
<
div
class
=
"input-group form-group report-field col-md-6 col-sm-6 col-xs-12"
style
=
"float: left !important;"
>
<
div
class
=
"input-group form-group report-field col-md-4 col-sm-4 col-xs-12"
style
=
"float: left !important;"
>
<
label
>
Select
Month
</
label
>
<
input
type
=
"text"
id
=
"selectMonth"
name
=
"selectMonth"
placeholder
=
"Select Month"
value
=
""
class
=
"datePicker1 form-control"
autocomplete
=
"off"
/>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Firms
</
label
>
<
select
name
=
"firm"
class
=
"form-control"
id
=
"firm"
>
<
option
value
=
""
>
Select
Firms
</
option
>
@
foreach
(
$firmsList
as
$firm
)
<
option
value
=
"
{
{$firm->id}
}
"
@
if
(
@
$oldFirm
==
$firm
->
id
)
{{
'selected'
}}
@
endif
>
{{
$firm
->
firm_name
}}
</
option
>
@
endforeach
</
select
>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Brands
</
label
>
<
select
class
=
"form-control"
id
=
"brand"
name
=
"brand"
>
<
option
value
=
""
>
Select
Brand
</
option
>
@
foreach
(
$brandList
as
$value
)
<
option
{{(
@
request
()
->
brand
==
$value
->
id
)
?
'selected'
:
''
}}
value
=
"
{
{$value->id}}">{{$value->brand_name}
}
</option>
@endforeach
</select>
</div>
<div class="
form
-
group
report
-
field
col
-
md
-
6
col
-
sm
-
6
col
-
xs
-
12
" style="
margin
-
top
:
25
px
;
">
<input class="
btn
btn
-
success
" type="
submit
" value="
Download
">
</div>
</
div
>
</div>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
resources/views/rsm/dcf_report.blade.php
View file @
a708148c
...
...
@@ -42,16 +42,36 @@
@
endif
<
form
action
=
""
class
=
""
method
=
"GET"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 col-md-offset-2 col-md-8"
>
<
div
class
=
"input-group form-group report-field col-md-6 col-sm-6 col-xs-12"
style
=
"float: left !important;"
>
<
div
class
=
"input-group form-group report-field col-md-4 col-sm-4 col-xs-12"
style
=
"float: left !important;"
>
<
label
>
Select
Month
</
label
>
<
input
type
=
"text"
id
=
"selectMonth"
name
=
"selectMonth"
placeholder
=
"Select Month"
value
=
""
class
=
"datePicker1 form-control"
autocomplete
=
"off"
/>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Firms
</
label
>
<
select
name
=
"firm"
class
=
"form-control"
id
=
"firm"
>
<
option
value
=
""
>
Select
Firms
</
option
>
@
foreach
(
$firmsList
as
$firm
)
<
option
value
=
"
{
{$firm->id}
}
"
@
if
(
@
$oldFirm
==
$firm
->
id
)
{{
'selected'
}}
@
endif
>
{{
$firm
->
firm_name
}}
</
option
>
@
endforeach
</
select
>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Brands
</
label
>
<
select
class
=
"form-control"
id
=
"brand"
name
=
"brand"
>
<
option
value
=
""
>
Select
Brand
</
option
>
@
foreach
(
$brandList
as
$value
)
<
option
{{(
@
request
()
->
brand
==
$value
->
id
)
?
'selected'
:
''
}}
value
=
"
{
{$value->id}}">{{$value->brand_name}
}
</option>
@endforeach
</select>
</div>
<div class="
form
-
group
report
-
field
col
-
md
-
6
col
-
sm
-
6
col
-
xs
-
12
" style="
margin
-
top
:
25
px
;
">
<input class="
btn
btn
-
success
" type="
submit
" value="
Download
">
</div>
</
div
>
</div>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
resources/views/sse/dcf_report.blade.php
View file @
a708148c
...
...
@@ -42,16 +42,36 @@
@
endif
<
form
action
=
""
class
=
""
method
=
"GET"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 col-md-offset-2 col-md-8"
>
<
div
class
=
"input-group form-group report-field col-md-6 col-sm-6 col-xs-12"
style
=
"float: left !important;"
>
<
div
class
=
"input-group form-group report-field col-md-4 col-sm-4 col-xs-12"
style
=
"float: left !important;"
>
<
label
>
Select
Month
</
label
>
<
input
type
=
"text"
id
=
"selectMonth"
name
=
"selectMonth"
placeholder
=
"Select Month"
value
=
""
class
=
"datePicker1 form-control"
autocomplete
=
"off"
/>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Firms
</
label
>
<
select
name
=
"firm"
class
=
"form-control"
id
=
"firm"
>
<
option
value
=
""
>
Select
Firms
</
option
>
@
foreach
(
$firmsList
as
$firm
)
<
option
value
=
"
{
{$firm->id}
}
"
@
if
(
@
$oldFirm
==
$firm
->
id
)
{{
'selected'
}}
@
endif
>
{{
$firm
->
firm_name
}}
</
option
>
@
endforeach
</
select
>
</
div
>
<
div
class
=
"form-group report-field col-md-4 col-sm-4 col-xs-12"
>
<
label
>
Brands
</
label
>
<
select
class
=
"form-control"
id
=
"brand"
name
=
"brand"
>
<
option
value
=
""
>
Select
Brand
</
option
>
@
foreach
(
$brandList
as
$value
)
<
option
{{(
@
request
()
->
brand
==
$value
->
id
)
?
'selected'
:
''
}}
value
=
"
{
{$value->id}}">{{$value->brand_name}
}
</option>
@endforeach
</select>
</div>
<div class="
form
-
group
report
-
field
col
-
md
-
6
col
-
sm
-
6
col
-
xs
-
12
" style="
margin
-
top
:
25
px
;
">
<input class="
btn
btn
-
success
" type="
submit
" value="
Download
">
</div>
</
div
>
</div>
</form>
</div>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment