Merge pull request 'update' (#173) from zhangwei into dev

Reviewed-on: #173
This commit is contained in:
weiz 2024-01-15 13:55:55 +08:00
commit 4433439c64
3 changed files with 48 additions and 1 deletions

View File

@ -52,6 +52,7 @@ class CustomerDemandSolutionController extends BaseAdminController
public function add()
{
$params = (new CustomerDemandSolutionValidate())->post()->goCheck('add');
halt($params);
$result = CustomerDemandSolutionLogic::add($params,$this->adminId);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);

View File

@ -0,0 +1,46 @@
<?php
namespace app\adminapi\controller\finance;
use app\adminapi\controller\BaseAdminController;
use app\common\model\contract\Contract;
use app\common\model\contract\ContractNegotiation;
use app\common\model\custom\Custom;
use app\common\model\finance\FinanceInvoiceApply;
use app\common\model\finance\FinanceReturnedRecord;
use app\common\model\project\Project;
class FinanceRefundInvoiceDifferenceController extends BaseAdminController
{
public function lists() {
$params = $this->request->get(['page_no','page_size']);
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$where = [];
$data = Contract::field('id,project_id,contract_code,contract_name,contract_date,amount')->where($where)
->page($pageNo,$pageSize)
->order(['id' => 'desc'])
->select()->each(function($item){
$project = Project::field('custom_id,name,project_code')->where('id',$item['project_id'])->findOrEmpty();
$custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty();
$item['project_name'] = $project['name'];
$item['project_code'] = $project['project_code'];
$item['custom_name'] = $custom['name'];
//合同洽商金额
$negotiate_amount = ContractNegotiation::where('contract_id',$item['id'])->sum('negotiation_amount');
//合同实际金额
$item['contract_amount'] = $item['amount'] + $negotiate_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_not_refund_amount'] = ($item['has_invoice_amount'] - $item['has_refund_amount']) <= 0 ? 0 : $item['has_invoice_amount'] - $item['has_refund_amount'];
//回款未开票
$item['has_refund_not_invoice_amount'] = ($item['has_refund_amount'] - $item['has_invoice_amount']) <= 0 ? 0 : $item['has_refund_amount'] - $item['has_invoice_amount'];
unset($item['amount']);
return $item;
})->toArray();
halt($data);
}
}

View File

@ -146,7 +146,7 @@ class CustomerDemandSolutionValidate extends BaseValidate
public function checkAnnex($value): bool|string
{
if(!empty($value) && $value != '' && $value != '[]'){
if(!empty($value) && $value != ''){
$annex = $value;//json_decode($value,true);
if(empty($annex) || !is_array($annex)){
return '附件格式错误';