新增汇款承兑
This commit is contained in:
parent
d93bc1738e
commit
bc81d40912
108
app/adminapi/controller/bill/AcceptanceBillController.php
Normal file
108
app/adminapi/controller/bill/AcceptanceBillController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\bill;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\bill\AcceptanceBillLists;
|
||||
use app\adminapi\logic\bill\AcceptanceBillLogic;
|
||||
use app\adminapi\validate\bill\AcceptanceBillValidate;
|
||||
|
||||
|
||||
/**
|
||||
* AcceptanceBill控制器
|
||||
* Class AcceptanceBillController
|
||||
* @package app\adminapi\controller\bill
|
||||
*/
|
||||
class AcceptanceBillController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new AcceptanceBillLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new AcceptanceBillValidate())->post()->goCheck('add');
|
||||
$result = AcceptanceBillLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AcceptanceBillLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new AcceptanceBillValidate())->post()->goCheck('edit');
|
||||
$result = AcceptanceBillLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AcceptanceBillLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new AcceptanceBillValidate())->post()->goCheck('delete');
|
||||
AcceptanceBillLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new AcceptanceBillValidate())->goCheck('detail');
|
||||
$result = AcceptanceBillLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
98
app/adminapi/lists/bill/AcceptanceBillLists.php
Normal file
98
app/adminapi/lists/bill/AcceptanceBillLists.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\bill;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\bill\AcceptanceBill;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* AcceptanceBill列表
|
||||
* Class AcceptanceBillLists
|
||||
* @package app\adminapi\listsbill
|
||||
*/
|
||||
class AcceptanceBillLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['ab.org_id', 'ab.dept_id', 'ab.customer_id', 'ab.project_id', 'ab.contract_id', 'ab.bill_sn', 'ab.bank_account_id', 'ab.bill_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return Db::name('AcceptanceBill')->alias('ab')
|
||||
->where($this->searchWhere)
|
||||
->whereNull('ab.delete_time')
|
||||
->leftJoin('orgs o','o.id = ab.org_id')
|
||||
->leftJoin('dept d','d.id = ab.dept_id')
|
||||
->leftJoin('project p','p.id = ab.project_id')
|
||||
->leftJoin('contract c','c.id = ab.contract_id')
|
||||
->leftJoin('custom ct','ct.id = ab.customer_id')
|
||||
->field('ap.*, d.name as dept_name, o.name as org_name, , p.name as project_name, c.contract_code, c.contract_name')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['ap.id' => 'desc'])
|
||||
->select()->each(function($item, $key){
|
||||
//关联数据后续添加
|
||||
$item['supplier_name'] = '供应商名称';
|
||||
$item['approve_no'] = '付款单号';
|
||||
$item['approve_step'] = '流程步骤';
|
||||
$item['approve_settle_status'] = 1;
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return Db::name('AcceptanceBill')->alias('ab')
|
||||
->where($this->searchWhere)
|
||||
->whereNull('ab.delete_time')
|
||||
->leftJoin('orgs o','o.id = ab.org_id')
|
||||
->leftJoin('dept d','d.id = ab.dept_id')
|
||||
->leftJoin('project p','p.id = ab.project_id')
|
||||
->leftJoin('contract c','c.id = ab.contract_id')
|
||||
->leftJoin('custom ct','ct.id = ab.customer_id')->count();
|
||||
}
|
||||
|
||||
}
|
@ -127,6 +127,8 @@ class AdministrativePaymentsLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return AdministrativePayments::findOrEmpty($params['id'])->toArray();
|
||||
$administrativePayments = AdministrativePayments::findOrEmpty($params['id']);
|
||||
$administrativePayments->contract;
|
||||
return $administrativePayments->toArray();
|
||||
}
|
||||
}
|
140
app/adminapi/logic/bill/AcceptanceBillLogic.php
Normal file
140
app/adminapi/logic/bill/AcceptanceBillLogic.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\bill;
|
||||
|
||||
|
||||
use app\common\model\bill\AcceptanceBill;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* AcceptanceBill逻辑
|
||||
* Class AcceptanceBillLogic
|
||||
* @package app\adminapi\logic\bill
|
||||
*/
|
||||
class AcceptanceBillLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
AcceptanceBill::create([
|
||||
'org_id' => $params['org_id'] ?? 0,
|
||||
'dept_id' => $params['dept_id'] ?? 0,
|
||||
'customer_id' => $params['customer_id'] ?? 0,
|
||||
'project_id' => $params['project_id'] ?? 0,
|
||||
'contract_id' => $params['contract_id'] ?? 0,
|
||||
'receipt_date' => $params['receipt_date'] ?? '',
|
||||
'bill_sn' => $params['bill_sn'] ?? '',
|
||||
'bank_account_id' => $params['bank_account_id'] ?? 0,
|
||||
'bill_type' => $params['bill_type'] ?? 0,
|
||||
'draft_acceptance_bank' => $params['draft_acceptance_bank'] ?? '',
|
||||
'bill_due_date' => $params['bill_due_date'] ?? '',
|
||||
'receipt_amount' => $params['receipt_amount'] ?? 0,
|
||||
'receipt_amount_daxie' => $params['receipt_amount_daxie'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
AcceptanceBill::where('id', $params['id'])->update([
|
||||
'org_id' => $params['org_id'] ?? 0,
|
||||
'dept_id' => $params['dept_id'] ?? 0,
|
||||
'customer_id' => $params['customer_id'] ?? 0,
|
||||
'project_id' => $params['project_id'] ?? 0,
|
||||
'contract_id' => $params['contract_id'] ?? 0,
|
||||
'receipt_date' => $params['receipt_date'] ?? '',
|
||||
'bill_sn' => $params['bill_sn'] ?? '',
|
||||
'bank_account_id' => $params['bank_account_id'] ?? 0,
|
||||
'bill_type' => $params['bill_type'] ?? 0,
|
||||
'draft_acceptance_bank' => $params['draft_acceptance_bank'] ?? '',
|
||||
'bill_due_date' => $params['bill_due_date'] ?? '',
|
||||
'receipt_amount' => $params['receipt_amount'] ?? 0,
|
||||
'receipt_amount_daxie' => $params['receipt_amount_daxie'] ?? '',
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return AcceptanceBill::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$acceptanceBill = AcceptanceBill::findOrEmpty($params['id']);
|
||||
$acceptanceBill->custom;
|
||||
$acceptanceBill->project;
|
||||
$acceptanceBill->org;
|
||||
$acceptanceBill->dept;
|
||||
$acceptanceBill->contract;
|
||||
return $acceptanceBill->toArray();
|
||||
}
|
||||
}
|
116
app/adminapi/validate/bill/AcceptanceBillValidate.php
Normal file
116
app/adminapi/validate/bill/AcceptanceBillValidate.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\bill;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* AcceptanceBill验证器
|
||||
* Class AcceptanceBillValidate
|
||||
* @package app\adminapi\validate\bill
|
||||
*/
|
||||
class AcceptanceBillValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'org_id' => 'require',
|
||||
'dept_id' => 'require',
|
||||
'customer_id' => 'require',
|
||||
'project_id' => 'require',
|
||||
'contract_id' => 'require',
|
||||
'receipt_date' => 'require',
|
||||
'bill_sn' => 'require',
|
||||
'bank_account_id' => 'require',
|
||||
'bill_type' => 'require',
|
||||
'draft_acceptance_bank' => 'require',
|
||||
'receipt_amount' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'org_id' => '组织id',
|
||||
'dept_id' => '部门id',
|
||||
'customer_id' => '客户id',
|
||||
'project_id' => '项目id',
|
||||
'contract_id' => '销售合同id',
|
||||
'receipt_date' => '收票日期',
|
||||
'bill_sn' => '票据编号',
|
||||
'bank_account_id' => '收票银行id',
|
||||
'bill_type' => '汇票类型',
|
||||
'draft_acceptance_bank' => '汇票承兑银行',
|
||||
'receipt_amount' => '收款金额',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return AcceptanceBillValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['org_id','dept_id','customer_id','project_id','contract_id','receipt_date','bill_sn','bank_account_id','bill_type','draft_acceptance_bank','receipt_amount']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return AcceptanceBillValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','org_id','dept_id','customer_id','project_id','contract_id','receipt_date','bill_sn','bank_account_id','bill_type','draft_acceptance_bank','receipt_amount']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return AcceptanceBillValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return AcceptanceBillValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
83
app/common/model/bill/AcceptanceBill.php
Normal file
83
app/common/model/bill/AcceptanceBill.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\bill;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* AcceptanceBill模型
|
||||
* Class AcceptanceBill
|
||||
* @package app\common\model\bill
|
||||
*/
|
||||
class AcceptanceBill extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'acceptance_bill';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* @notes 关联custom
|
||||
* @return \think\model\relation\HasOne
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function custom()
|
||||
{
|
||||
return $this->hasOne(\app\common\model\custom\Custom::class, 'id', 'customer_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联project
|
||||
* @return \think\model\relation\HasOne
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function project()
|
||||
{
|
||||
return $this->hasOne(\app\common\model\project\Project::class, 'id', 'project_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联org
|
||||
* @return \think\model\relation\HasOne
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function org()
|
||||
{
|
||||
return $this->hasOne(\app\common\model\dept\Orgs::class, 'id', 'org_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 关联dept
|
||||
* @return \think\model\relation\HasOne
|
||||
* @author likeadmin
|
||||
* @date 2023/12/19 15:18
|
||||
*/
|
||||
public function dept()
|
||||
{
|
||||
return $this->hasOne(\app\common\model\dept\Dept::class, 'id', 'dept_id');
|
||||
}
|
||||
|
||||
public function contract()
|
||||
{
|
||||
return $this->hasOne(\app\common\model\contract\Contract::class, 'id', 'contract_id');
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user