|
|
|
@ -3,6 +3,7 @@ |
|
|
|
namespace app\controller\admin; |
|
|
|
|
|
|
|
use app\model\InvoiceHead; |
|
|
|
use app\util\ReturnCode; |
|
|
|
use think\Response; |
|
|
|
use app\model\InvoiceIssuance as InvoiceIssuanceModel; |
|
|
|
|
|
|
|
@ -50,7 +51,7 @@ class InvoiceIssuance extends Base |
|
|
|
->field($field) |
|
|
|
->paginate(['page' => $start, 'list_rows' => $limit])->each(function ($item, $key) use ($InvoiceHead) { |
|
|
|
|
|
|
|
$item->project_itle = InvoiceIssuanceModel::$projectArr[$item->project_id] ?? ''; |
|
|
|
$item->project_itle = InvoiceIssuanceModel::$projectArr[$item->project_id] ?? ''; |
|
|
|
$item->status = InvoiceIssuanceModel::$statusArr[$item->status] ?? ''; |
|
|
|
$item->merge = $item->merge ? '合并' : '不合并'; |
|
|
|
$item->expire_time = $item->expire_time ? date("Y-m", $item->expire_time) : ''; |
|
|
|
@ -64,7 +65,7 @@ class InvoiceIssuance extends Base |
|
|
|
$item->head_type = InvoiceHead::$typeArr[$InvoiceHeadRes['type']]; |
|
|
|
$item->head_title = $InvoiceHeadRes['title']; |
|
|
|
} |
|
|
|
unset($item->invoice_head_id,$item->project_id); |
|
|
|
unset($item->invoice_head_id, $item->project_id); |
|
|
|
})->toArray(); |
|
|
|
$listInfo = $listObj['data']; |
|
|
|
|
|
|
|
@ -94,4 +95,29 @@ class InvoiceIssuance extends Base |
|
|
|
return $this->buildSuccess($keyArr); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
* 发票申请作废 |
|
|
|
* @return Response |
|
|
|
*/ |
|
|
|
public function cancel(): Response |
|
|
|
{ |
|
|
|
try { |
|
|
|
$id = $this->request->get('id', ''); |
|
|
|
if (!$id) { |
|
|
|
throw new \Exception('缺少必要参数'); |
|
|
|
} |
|
|
|
$InvoiceIssuance = (new InvoiceIssuanceModel())->where('id', $id)->find(); |
|
|
|
if ($InvoiceIssuance['status'] == 3) { |
|
|
|
throw new \Exception('已开票,无法作废'); |
|
|
|
} |
|
|
|
$data = ['status' => 4]; |
|
|
|
$result = $InvoiceIssuance->save($data); |
|
|
|
if (!$result) { |
|
|
|
throw new \Exception('作废失败'); |
|
|
|
} |
|
|
|
return $this->buildSuccess(); |
|
|
|
} catch (\Exception $e) { |
|
|
|
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, $e->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|