Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvsuo-pc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhilin
lvsuo-pc
Commits
690278f5
Commit
690278f5
authored
Dec 03, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
270d2697
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
211 additions
and
18 deletions
+211
-18
app/Admin/Actions/ReceivedInvoicedExcel.php
+70
-0
app/Admin/Controllers/ReceivePaymentController.php
+51
-12
app/Admin/Extensions/ReceivedInvoicedExport.php
+79
-0
app/Admin/Repositories/LawyerInvoicedPaymentCollect.php
+5
-3
app/Admin/Repositories/LawyerReceivePaymentCollect.php
+5
-3
app/Admin/routes.php
+1
-0
No files found.
app/Admin/Actions/ReceivedInvoicedExcel.php
0 → 100644
View file @
690278f5
<?php
namespace
App\Admin\Actions
;
use
App\Command\Log
;
use
Dcat\Admin\Actions\Action
;
use
Dcat\Admin\Actions\Response
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Storage
;
/**
* 导出 汇总表
* Class DownloadTemplate
*
* @package App\Admin\Actions
*/
class
ReceivedInvoicedExcel
extends
Action
{
protected
$request_param
=
[];
protected
$request_filename
=
''
;
protected
$title
=
''
;
/**
* 接收参数
*/
public
function
__construct
(
$param
=
[],
$filename
=
''
,
$title
=
''
)
{
$this
->
request_param
=
$param
;
$this
->
request_filename
=
$filename
;
parent
::
__construct
(
$title
);
$this
->
title
=
$title
;
}
//protected $title = '<button class="btn btn-primary"><i class="feather icon-download"></i> 下载模板</button>';
/**
* 按钮文本
*
* @return string|void
*/
public
function
title
()
{
return
'<button class="btn btn-primary"><i class="feather icon-download"></i> '
.
$this
->
title
.
'</button>'
;
}
/**
* Handle the action request.
*
* @return Response
*/
public
function
handle
(
Request
$request
)
{
$param
=
$request
->
get
(
'param'
);
$filename
=
$request
->
get
(
'filename'
);
//调用导出接口
return
$this
->
response
()
->
download
(
'/received-invoiced-Export?filename='
.
$filename
.
'¶m='
.
json_encode
(
$param
)
.
'&_export_=1'
);
}
public
function
parameters
()
{
return
[
'mode'
=>
''
,
'param'
=>
$this
->
request_param
,
'filename'
=>
$this
->
request_filename
,
'title'
=>
$this
->
title
,
];
}
}
app/Admin/Controllers/ReceivePaymentController.php
View file @
690278f5
...
@@ -16,6 +16,10 @@
...
@@ -16,6 +16,10 @@
use
App\Models\CovenantReceivePayment
as
ModelCovenantReceivePayment
;
use
App\Models\CovenantReceivePayment
as
ModelCovenantReceivePayment
;
use
App\Admin\Repositories\LawyerReceivePaymentCollect
;
use
App\Admin\Repositories\LawyerReceivePaymentCollect
;
use
App\Admin\Repositories\LawyerInvoicedPaymentCollect
;
use
App\Admin\Repositories\LawyerInvoicedPaymentCollect
;
use
App\Admin\Actions\ReceivedInvoicedExcel
;
use
Illuminate\Http\Request
;
use
Maatwebsite\Excel\Facades\Excel
;
use
App\Admin\Extensions\ReceivedInvoicedExport
;
class
ReceivePaymentController
extends
Controller
class
ReceivePaymentController
extends
Controller
{
{
...
@@ -45,7 +49,16 @@ public function index(Content $content)
...
@@ -45,7 +49,16 @@ public function index(Content $content)
});
});
//文字信息
//文字信息
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$grid
,
$lawyerID
)
{
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$grid
,
$lawyerID
,
$year
)
{
//导出按钮
// 获取筛选条件
$param
=
[
'search'
=>
[
'lawyer_id'
=>
$lawyerID
,
'year'
=>
$year
,
'rtype'
=>
1
]
];
// 导出
$filename
=
'已收款汇总表'
;
$tools
->
append
(
new
ReceivedInvoicedExcel
(
$param
,
$filename
,
'导出'
));
//文字展示
$fullname
=
$number
=
''
;
$fullname
=
$number
=
''
;
if
(
$lawyerID
)
{
if
(
$lawyerID
)
{
$obj
=
ModelsLawyer
::
find
(
$lawyerID
);
$obj
=
ModelsLawyer
::
find
(
$lawyerID
);
...
@@ -57,11 +70,11 @@ public function index(Content $content)
...
@@ -57,11 +70,11 @@ public function index(Content $content)
$tools
->
append
(
$card_info
);
$tools
->
append
(
$card_info
);
});
});
$grid
->
export
()
->
disableExportAll
();
//
$grid->export()->disableExportAll();
$grid
->
export
()
->
disableExportSelectedRow
();
//
$grid->export()->disableExportSelectedRow();
$grid
->
export
()
->
rows
(
function
(
$rows
)
{
//
$grid->export()->rows(function ($rows) {
return
$rows
;
//
return $rows;
});
//
});
});
});
...
@@ -89,7 +102,16 @@ public function index(Content $content)
...
@@ -89,7 +102,16 @@ public function index(Content $content)
});
});
//文字信息
//文字信息
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$grid
,
$lawyerID
)
{
$grid
->
tools
(
function
(
Grid\Tools
$tools
)
use
(
$grid
,
$lawyerID
,
$year
)
{
//导出按钮
// 获取筛选条件
$param
=
[
'search'
=>
[
'lawyer_id'
=>
$lawyerID
,
'year'
=>
$year
,
'rtype'
=>
2
]
];
// 导出
$filename
=
'已开票汇总表'
;
$tools
->
append
(
new
ReceivedInvoicedExcel
(
$param
,
$filename
,
'导出'
));
//文字展示
$fullname
=
$number
=
''
;
$fullname
=
$number
=
''
;
if
(
$lawyerID
)
{
if
(
$lawyerID
)
{
$obj
=
ModelsLawyer
::
find
(
$lawyerID
);
$obj
=
ModelsLawyer
::
find
(
$lawyerID
);
...
@@ -101,11 +123,12 @@ public function index(Content $content)
...
@@ -101,11 +123,12 @@ public function index(Content $content)
$tools
->
append
(
$card_info
);
$tools
->
append
(
$card_info
);
});
});
$grid
->
export
()
->
disableExportAll
();
// $grid->export()->disableExportAll();
$grid
->
export
()
->
disableExportSelectedRow
();
// $grid->export()->disableExportSelectedRow();
$grid
->
export
()
->
rows
(
function
(
$rows
)
{
// $grid->export()->rows(function ($rows) {
return
$rows
;
// return $rows;
});
// });
});
});
...
@@ -114,4 +137,20 @@ public function index(Content $content)
...
@@ -114,4 +137,20 @@ public function index(Content $content)
return
$content
->
body
(
$tab
);
return
$content
->
body
(
$tab
);
}
}
/**
* 导出
*
* @param Request $request
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public
function
receivedInvoicedExport
(
Request
$request
)
{
$filename
=
$request
->
get
(
'filename'
);
$param
=
json_decode
(
$request
->
get
(
'param'
));
ob_end_clean
();
return
Excel
::
download
(
new
ReceivedInvoicedExport
(
$param
),
$filename
.
'.xlsx'
);
}
}
}
app/Admin/Extensions/ReceivedInvoicedExport.php
0 → 100644
View file @
690278f5
<?php
namespace
App\Admin\Extensions
;
use
App\Command\Log
;
use
Illuminate\Support\Facades\DB
;
use
Maatwebsite\Excel\Concerns\FromCollection
;
use
Maatwebsite\Excel\Concerns\WithHeadings
;
use
App\Models\CovenantReceivePayment
as
ModelsCovenantReceivePayment
;
class
ReceivedInvoicedExport
implements
FromCollection
,
WithHeadings
{
private
$row
;
private
$data
;
private
$headings
;
/**
* TaskDataExcelExpoter constructor.
* @param array $param 筛选条件
* @param array $data 数据
* @param array $headings 表头
*/
public
function
__construct
(
$param
=
[],
$data
=
[],
$headings
=
[])
{
$param
=
json_decode
(
json_encode
(
$param
),
true
);
$year
=
$param
[
'search'
][
'year'
]
??
date
(
"Y"
);
$nowyear
=
date
(
"Y"
);
$monthNum
=
(
$year
&&
$year
<
$nowyear
)
?
12
:
date
(
'm'
);
//表头设定
for
(
$i
=
1
;
$i
<=
$monthNum
;
$i
++
)
{
$tmp
[
$i
]
=
$i
.
'月'
;
}
$header
=
$tmp
;
$headings
=
[
$header
];
$data
=
$this
->
getList
(
$param
);
$this
->
headings
=
$headings
;
$this
->
data
=
$data
;
}
public
function
headings
()
:
array
{
return
$this
->
headings
;
}
public
function
collection
()
{
return
collect
(
$this
->
data
);
}
// 获取列表数据
public
function
getList
(
$param
)
{
$param
=
json_decode
(
json_encode
(
$param
),
true
);
$lawyer_id
=
$param
[
'search'
][
'lawyer_id'
]
??
0
;
$rtype
=
$param
[
'search'
][
'rtype'
]
??
1
;
$year
=
$param
[
'search'
][
'year'
]
??
date
(
"Y"
);
$data
=
[];
$nowyear
=
date
(
"Y"
);
$monthNum
=
(
$year
&&
$year
<
$nowyear
)
?
12
:
date
(
'm'
);
for
(
$i
=
1
;
$i
<=
$monthNum
;
$i
++
)
{
if
(
$rtype
==
1
)
{
//已收款
$amount
=
ModelsCovenantReceivePayment
::
where
([
'rtype'
=>
$rtype
,
'lawyer_id'
=>
$lawyer_id
,
'year'
=>
$year
,
'month'
=>
$i
])
->
sum
(
'received_amount'
);
}
else
{
//已开票
$amount
=
ModelsCovenantReceivePayment
::
where
([
'rtype'
=>
$rtype
,
'lawyer_id'
=>
$lawyer_id
,
'year'
=>
$year
,
'month'
=>
$i
])
->
sum
(
'invoiced_money'
);
}
$data
[
$i
]
=
$amount
;
}
return
[
$data
];
return
$data
;
}
}
app/Admin/Repositories/LawyerInvoicedPaymentCollect.php
View file @
690278f5
...
@@ -21,10 +21,11 @@ public function get(Grid\Model $model)
...
@@ -21,10 +21,11 @@ public function get(Grid\Model $model)
{
{
// 获取筛选条件
// 获取筛选条件
$year
=
$model
->
filter
()
->
input
(
'year'
);
$year
=
$model
->
filter
()
->
input
(
'year'
);
$lawyer_id
=
$model
->
filter
()
->
input
(
'no'
);
$param
=
[
$param
=
[
'search'
=>
[
'search'
=>
[
'year'
=>
$year
'year'
=>
$year
,
'lawyer_id'
=>
$lawyer_id
]
]
];
];
...
@@ -37,12 +38,13 @@ public function getList(array $param)
...
@@ -37,12 +38,13 @@ public function getList(array $param)
{
{
$year
=
$param
[
'search'
][
'year'
]
??
''
;
$year
=
$param
[
'search'
][
'year'
]
??
''
;
$lawyer_id
=
$param
[
'search'
][
'lawyer_id'
]
??
0
;
$nowyear
=
date
(
"Y"
);
$nowyear
=
date
(
"Y"
);
$monthNum
=
(
$year
&&
$year
<
$nowyear
)
?
12
:
date
(
'm'
);
$monthNum
=
(
$year
&&
$year
<
$nowyear
)
?
12
:
date
(
'm'
);
$data
=
[];
$data
=
[];
for
(
$i
=
1
;
$i
<=
$monthNum
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
$monthNum
;
$i
++
)
{
$received_amount
=
ModelsCovenantReceivePayment
::
where
([
'rtype'
=>
2
,
'year'
=>
$year
,
'month'
=>
$i
])
->
sum
(
'invoiced_money'
);
$received_amount
=
ModelsCovenantReceivePayment
::
where
([
'rtype'
=>
2
,
'
lawyer_id'
=>
$lawyer_id
,
'
year'
=>
$year
,
'month'
=>
$i
])
->
sum
(
'invoiced_money'
);
$data
[
$i
]
=
$received_amount
;
$data
[
$i
]
=
$received_amount
;
}
}
...
...
app/Admin/Repositories/LawyerReceivePaymentCollect.php
View file @
690278f5
...
@@ -21,10 +21,11 @@ public function get(Grid\Model $model)
...
@@ -21,10 +21,11 @@ public function get(Grid\Model $model)
{
{
// 获取筛选条件
// 获取筛选条件
$year
=
$model
->
filter
()
->
input
(
'year'
);
$year
=
$model
->
filter
()
->
input
(
'year'
);
$lawyer_id
=
$model
->
filter
()
->
input
(
'no'
);
$param
=
[
$param
=
[
'search'
=>
[
'search'
=>
[
'year'
=>
$year
'year'
=>
$year
,
'lawyer_id'
=>
$lawyer_id
]
]
];
];
...
@@ -37,12 +38,13 @@ public function getList(array $param)
...
@@ -37,12 +38,13 @@ public function getList(array $param)
{
{
$year
=
$param
[
'search'
][
'year'
]
??
''
;
$year
=
$param
[
'search'
][
'year'
]
??
''
;
$lawyer_id
=
$param
[
'search'
][
'lawyer_id'
]
??
0
;
$nowyear
=
date
(
"Y"
);
$nowyear
=
date
(
"Y"
);
$monthNum
=
(
$year
&&
$year
<
$nowyear
)
?
12
:
date
(
'm'
);
$monthNum
=
(
$year
&&
$year
<
$nowyear
)
?
12
:
date
(
'm'
);
$data
=
[];
$data
=
[];
for
(
$i
=
1
;
$i
<=
$monthNum
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
$monthNum
;
$i
++
)
{
$received_amount
=
ModelsCovenantReceivePayment
::
where
([
'rtype'
=>
1
,
'year'
=>
$year
,
'month'
=>
$i
])
->
sum
(
'received_amount'
);
$received_amount
=
ModelsCovenantReceivePayment
::
where
([
'rtype'
=>
1
,
'
lawyer_id'
=>
$lawyer_id
,
'
year'
=>
$year
,
'month'
=>
$i
])
->
sum
(
'received_amount'
);
$data
[
$i
]
=
$received_amount
;
$data
[
$i
]
=
$received_amount
;
}
}
...
...
app/Admin/routes.php
View file @
690278f5
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
$router
->
resource
(
'lawyer_income'
,
'LawyerIncomeController'
);
//律师创收表
$router
->
resource
(
'lawyer_income'
,
'LawyerIncomeController'
);
//律师创收表
$router
->
resource
(
'receive_payment'
,
'ReceivePaymentController'
);
//已收款/已开票汇总
$router
->
resource
(
'receive_payment'
,
'ReceivePaymentController'
);
//已收款/已开票汇总
Route
::
get
(
'received-invoiced-Export'
,
'ReceivePaymentController@receivedInvoicedExport'
);
//开票汇总导出
$router
->
resource
(
'lawyer-covenant-income'
,
'LawyerCovenantIncomeController'
);
//创收收款表
$router
->
resource
(
'lawyer-covenant-income'
,
'LawyerCovenantIncomeController'
);
//创收收款表
...
...
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