1234567891011121314151617181920212223242526272829 |
- <?php /** Created by Anton on 11.02.2020. */
- require '../yiiInit.php';
- $inventoryNum = Yii::$app->request->post('inventoryNum');
- $desc = Yii::$app->request->post('desc');
- $company = (int)Yii::$app->request->post('company');
- $user = (int)Yii::$app->request->post('user');
- $tmc = \app\models\entity\Tmc::findOne(['inventory_num' => $inventoryNum, 'company' => $company]);
- if (!$tmc) {
- die('Устройство не найдено');
- }
- $now = (new \DateTime())->format('Y-m-d H:i:s');
- $tmc->write_off_date = $now;
- $tmc->status = \app\models\entity\TmcStatus::TMC_STATUS_DECOMMISSION;
- $tmc->save();
- $log = new \app\models\entity\Log();
- $log->receipt_date = $now;
- $log->employee = $user;
- $log->tmc = $tmc->id;
- $log->note = $desc;
- $log->save();
- Yii::$app->response->redirect(yii\helpers\Url::to($_SERVER['HTTP_REFERER']))->send();
|