update
This commit is contained in:
parent
6a3fc45e04
commit
be12b73d78
@ -12,41 +12,48 @@
|
|||||||
use app\common\model\finance\FinanceReceiptRecord;
|
use app\common\model\finance\FinanceReceiptRecord;
|
||||||
use app\common\model\project\Project;
|
use app\common\model\project\Project;
|
||||||
use app\common\model\supplier\Supplier;
|
use app\common\model\supplier\Supplier;
|
||||||
|
use think\App;
|
||||||
|
|
||||||
class FinancePaymentReceiptDifferenceController extends BaseAdminController
|
class FinancePaymentReceiptDifferenceController extends BaseAdminController
|
||||||
{
|
{
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
parent::__construct($app);
|
||||||
|
bcscale(2);
|
||||||
|
}
|
||||||
|
|
||||||
//采购付款与收票差异
|
//采购付款与收票差异
|
||||||
public function procure(): \think\response\Json
|
public function procure(): \think\response\Json
|
||||||
{
|
{
|
||||||
$params = $this->request->get(['page_no','page_size','contract_no','project_id']);
|
$params = $this->request->get(['page_no', 'page_size', 'contract_no', 'project_id']);
|
||||||
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
||||||
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
||||||
$where = [];
|
$where = [];
|
||||||
if(isset($params['project_id']) && $params['project_id']){
|
if (isset($params['project_id']) && $params['project_id']) {
|
||||||
$where[] = ['project_id','=',$params['project_id']];
|
$where[] = ['project_id', '=', $params['project_id']];
|
||||||
}
|
}
|
||||||
if(isset($params['contract_no']) && $params['contract_no']){
|
if (isset($params['contract_no']) && $params['contract_no']) {
|
||||||
$where[] = ['contract_no','like','%'.$params['contract_no'].'%'];
|
$where[] = ['contract_no', 'like', '%' . $params['contract_no'] . '%'];
|
||||||
}
|
}
|
||||||
$data = ProcurementContract::field('id,supplier_id,project_id,contract_no,signing_date')->where($where)->page($pageNo,$pageSize)
|
$data = ProcurementContract::field('id,supplier_id,project_id,contract_no,signing_date')->where($where)->page($pageNo, $pageSize)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function ($item) {
|
||||||
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
$project = Project::field('name,project_code')->where('id', $item['project_id'])->findOrEmpty();
|
||||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$item['supplier_id'])->findOrEmpty();
|
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $item['supplier_id'])->findOrEmpty();
|
||||||
$item['project_name'] = $project['name'];
|
$item['project_name'] = $project['name'];
|
||||||
$item['project_code'] = $project['project_code'];
|
$item['project_code'] = $project['project_code'];
|
||||||
$item['supplier_name'] = $supplier['supplier_name'];
|
$item['supplier_name'] = $supplier['supplier_name'];
|
||||||
$item['supplier_code'] = $supplier['supplier_code'];
|
$item['supplier_code'] = $supplier['supplier_code'];
|
||||||
//合同金额
|
//合同金额
|
||||||
$item['contract_amount'] = ProcurementContractDetail::where('contract_id',$item['id'])->sum('amount_including_tax');
|
$item['contract_amount'] = ProcurementContractDetail::where('contract_id', $item['id'])->sum('amount_including_tax');
|
||||||
//已付款金额
|
//已付款金额
|
||||||
$item['has_payment_amount'] = FinancePaymentPlan::where('contract_id',$item['id'])->where('contract_type',1)->sum('amount');
|
$item['has_payment_amount'] = FinancePaymentPlan::where('contract_id', $item['id'])->where('contract_type', 1)->sum('amount');
|
||||||
//已收票金额
|
//已收票金额
|
||||||
$item['has_receipt_amount'] = FinanceReceiptRecord::where('contract_id',$item['id'])->where('contract_type',1)->sum('invoice_amount');
|
$item['has_receipt_amount'] = FinanceReceiptRecord::where('contract_id', $item['id'])->where('contract_type', 1)->sum('invoice_amount');
|
||||||
//收票未付款
|
//收票未付款
|
||||||
$item['has_receipt_not_payment_amount'] = ($item['has_receipt_amount'] - $item['has_payment_amount']) <= 0 ? 0 : $item['has_receipt_amount'] - $item['has_payment_amount'];
|
$item['has_receipt_not_payment_amount'] = max(bcsub($item['has_receipt_amount'], $item['has_payment_amount']), 0);
|
||||||
//付款未收票
|
//付款未收票
|
||||||
$item['has_payment_not_receipt_amount'] = ($item['has_payment_amount'] - $item['has_receipt_amount']) <= 0 ? 0 : $item['has_payment_amount'] - $item['has_receipt_amount'];
|
$item['has_payment_not_receipt_amount'] = max(bcsub($item['has_payment_amount'], $item['has_receipt_amount']), 0);
|
||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$count = ProcurementContract::field('id')->where($where)->count();
|
$count = ProcurementContract::field('id')->where($where)->count();
|
||||||
@ -56,45 +63,45 @@
|
|||||||
'page_size' => $pageSize,
|
'page_size' => $pageSize,
|
||||||
'lists' => $data
|
'lists' => $data
|
||||||
];
|
];
|
||||||
return $this->success('请求成功',$result);
|
return $this->success('请求成功', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//分包付款与收票差异
|
//分包付款与收票差异
|
||||||
public function subcontract(): \think\response\Json
|
public function subcontract(): \think\response\Json
|
||||||
{
|
{
|
||||||
$params = $this->request->get(['page_no','page_size','contract_no','project_id']);
|
$params = $this->request->get(['page_no', 'page_size', 'contract_no', 'project_id']);
|
||||||
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
||||||
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
||||||
$where = [];
|
$where = [];
|
||||||
if(isset($params['project_id']) && $params['project_id']){
|
if (isset($params['project_id']) && $params['project_id']) {
|
||||||
$where[] = ['project_id','=',$params['project_id']];
|
$where[] = ['project_id', '=', $params['project_id']];
|
||||||
}
|
}
|
||||||
if(isset($params['contract_no']) && $params['contract_no']){
|
if (isset($params['contract_no']) && $params['contract_no']) {
|
||||||
$where[] = ['contract_no','like','%'.$params['contract_no'].'%'];
|
$where[] = ['contract_no', 'like', '%' . $params['contract_no'] . '%'];
|
||||||
}
|
}
|
||||||
$data = SubcontractingContract::field('id,supplier_id,project_id,contract_no,signing_date')->where($where)->page($pageNo,$pageSize)
|
$data = SubcontractingContract::field('id,supplier_id,project_id,contract_no,signing_date')->where($where)->page($pageNo, $pageSize)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function ($item) {
|
||||||
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
$project = Project::field('name,project_code')->where('id', $item['project_id'])->findOrEmpty();
|
||||||
$supplier = Supplier::field('supplier_name,supplier_code')->where('id',$item['supplier_id'])->findOrEmpty();
|
$supplier = Supplier::field('supplier_name,supplier_code')->where('id', $item['supplier_id'])->findOrEmpty();
|
||||||
$item['project_name'] = $project['name'];
|
$item['project_name'] = $project['name'];
|
||||||
$item['project_code'] = $project['project_code'];
|
$item['project_code'] = $project['project_code'];
|
||||||
$item['supplier_name'] = $supplier['supplier_name'];
|
$item['supplier_name'] = $supplier['supplier_name'];
|
||||||
$item['supplier_code'] = $supplier['supplier_code'];
|
$item['supplier_code'] = $supplier['supplier_code'];
|
||||||
//合同金额
|
//合同金额
|
||||||
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id',$item['id'])->sum('amount_including_tax');
|
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id', $item['id'])->sum('amount_including_tax');
|
||||||
//洽商金额
|
//洽商金额
|
||||||
$negotiate_amount = SubcontractingContractNegotiation::where('subcontracting_contract_id',$item['id'])->sum('negotiation_amount');
|
$negotiate_amount = SubcontractingContractNegotiation::where('subcontracting_contract_id', $item['id'])->sum('negotiation_amount');
|
||||||
//实际合同金额
|
//实际合同金额
|
||||||
$item['contract_amount'] = $item['contract_amount'] + $negotiate_amount;
|
$item['contract_amount'] = $item['contract_amount'] + $negotiate_amount;
|
||||||
//已付款金额
|
//已付款金额
|
||||||
$item['has_payment_amount'] = FinancePaymentPlan::where('contract_id',$item['id'])->where('contract_type',2)->sum('amount');
|
$item['has_payment_amount'] = FinancePaymentPlan::where('contract_id', $item['id'])->where('contract_type', 2)->sum('amount');
|
||||||
//已收票金额
|
//已收票金额
|
||||||
$item['has_receipt_amount'] = FinanceReceiptRecord::where('contract_id',$item['id'])->where('contract_type',2)->sum('invoice_amount');
|
$item['has_receipt_amount'] = FinanceReceiptRecord::where('contract_id', $item['id'])->where('contract_type', 2)->sum('invoice_amount');
|
||||||
//收票未付款
|
//收票未付款
|
||||||
$item['has_receipt_not_payment_amount'] = ($item['has_receipt_amount'] - $item['has_payment_amount']) <= 0 ? 0 : $item['has_receipt_amount'] - $item['has_payment_amount'];
|
$item['has_receipt_not_payment_amount'] = max(bcsub($item['has_receipt_amount'], $item['has_payment_amount']), 0);
|
||||||
//付款未收票
|
//付款未收票
|
||||||
$item['has_payment_not_receipt_amount'] = ($item['has_payment_amount'] - $item['has_receipt_amount']) <= 0 ? 0 : $item['has_payment_amount'] - $item['has_receipt_amount'];
|
$item['has_payment_not_receipt_amount'] = max(bcsub($item['has_payment_amount'], $item['has_receipt_amount']), 0);
|
||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
$count = SubcontractingContract::field('id')->where($where)->count();
|
$count = SubcontractingContract::field('id')->where($where)->count();
|
||||||
@ -104,6 +111,6 @@
|
|||||||
'page_size' => $pageSize,
|
'page_size' => $pageSize,
|
||||||
'lists' => $data
|
'lists' => $data
|
||||||
];
|
];
|
||||||
return $this->success('请求成功',$result);
|
return $this->success('请求成功', $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,37 +14,38 @@
|
|||||||
{
|
{
|
||||||
public function lists(): \think\response\Json
|
public function lists(): \think\response\Json
|
||||||
{
|
{
|
||||||
$params = $this->request->get(['page_no','page_size','contract_code','project_id']);
|
bcscale(2);
|
||||||
|
$params = $this->request->get(['page_no', 'page_size', 'contract_code', 'project_id']);
|
||||||
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
|
||||||
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
|
||||||
$where = [];
|
$where = [];
|
||||||
if(isset($params['project_id']) && $params['project_id']){
|
if (isset($params['project_id']) && $params['project_id']) {
|
||||||
$where[] = ['project_id','=',$params['project_id']];
|
$where[] = ['project_id', '=', $params['project_id']];
|
||||||
}
|
}
|
||||||
if(isset($params['contract_code']) && $params['contract_code']){
|
if (isset($params['contract_code']) && $params['contract_code']) {
|
||||||
$where[] = ['contract_code','like','%'.$params['contract_code'].'%'];
|
$where[] = ['contract_code', 'like', '%' . $params['contract_code'] . '%'];
|
||||||
}
|
}
|
||||||
$data = Contract::field('id,project_id,contract_code,contract_name,contract_date,amount')->where($where)
|
$data = Contract::field('id,project_id,contract_code,contract_name,contract_date,amount')->where($where)
|
||||||
->page($pageNo,$pageSize)
|
->page($pageNo, $pageSize)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function($item){
|
->select()->each(function ($item) {
|
||||||
$project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty();
|
$project = Project::field('custom_id,name,project_code')->where('id', $item['project_id'])->findOrEmpty();
|
||||||
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
|
$custom = Custom::field('name')->where('id', $project['custom_id'])->findOrEmpty();
|
||||||
$item['project_name'] = $project['name'];
|
$item['project_name'] = $project['name'];
|
||||||
$item['project_code'] = $project['project_code'];
|
$item['project_code'] = $project['project_code'];
|
||||||
$item['custom_name'] = $custom['name'];
|
$item['custom_name'] = $custom['name'];
|
||||||
//合同洽商金额
|
//合同洽商金额
|
||||||
$negotiate_amount = ContractNegotiation::where('contract_id',$item['id'])->sum('negotiation_amount');
|
$negotiate_amount = ContractNegotiation::where('contract_id', $item['id'])->sum('negotiation_amount');
|
||||||
//合同实际金额
|
//合同实际金额
|
||||||
$item['contract_amount'] = $item['amount'] + $negotiate_amount;
|
$item['contract_amount'] = $item['amount'] + $negotiate_amount;
|
||||||
//已回款金额
|
//已回款金额
|
||||||
$item['has_refund_amount'] = FinanceReturnedRecord::where('contract_id',$item['id'])->sum('amount');
|
$item['has_refund_amount'] = FinanceReturnedRecord::where('contract_id', $item['id'])->sum('amount');
|
||||||
//已开票金额
|
//已开票金额
|
||||||
$item['has_invoice_amount'] = FinanceInvoiceApply::where('contract_id',$item['id'])->sum('invoicing_amount');
|
$item['has_invoice_amount'] = FinanceInvoiceApply::where('contract_id', $item['id'])->sum('invoicing_amount');
|
||||||
//开票未回款
|
//开票未回款
|
||||||
$item['has_invoice_not_refund_amount'] = ($item['has_invoice_amount'] - $item['has_refund_amount']) <= 0 ? 0 : $item['has_invoice_amount'] - $item['has_refund_amount'];
|
$item['has_invoice_not_refund_amount'] = max(bcsub($item['has_invoice_amount'], $item['has_refund_amount']), 0);
|
||||||
//回款未开票
|
//回款未开票
|
||||||
$item['has_refund_not_invoice_amount'] = ($item['has_refund_amount'] - $item['has_invoice_amount']) <= 0 ? 0 : $item['has_refund_amount'] - $item['has_invoice_amount'];
|
$item['has_refund_not_invoice_amount'] = max(bcsub($item['has_refund_amount'], $item['has_invoice_amount']), 0);
|
||||||
unset($item['amount']);
|
unset($item['amount']);
|
||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
@ -55,6 +56,6 @@
|
|||||||
'page_size' => $pageSize,
|
'page_size' => $pageSize,
|
||||||
'lists' => $data
|
'lists' => $data
|
||||||
];
|
];
|
||||||
return $this->success('请求成功',$result);
|
return $this->success('请求成功', $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user