Диплом: Автоматизация планирования потребностей в производственных мощностях для ООО "МПЗ Богородский" 2

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
147
$sender = '';
if (empty($movement->idCounterparty) == false)
$sender = $movement->idCounterparty->title;
$receiver = $settings->organization_title . ', ' . $settings-
>organization_address;
$payer = $receiver;
}
else
{
$sender = $settings->organization_title . ', ' . $settings-
>organization_address;
$receiver = '';
if (empty($movement->idCounterparty) == false)
$receiver = $movement->idCounterparty->title . ', ' .
$movement->idCounterparty->address;
$payer = $receiver;
}
$this->SetHeader ('Транспортная_накладная_' . $movement->id .
'.xls');
return $this->renderPartial('transport-invoice', [
'movement' => $movement,
'movement_product' => $movement_product,
'settings' => $settings,
'sender' => $sender,
'receiver' => $receiver,
148
]);
}
public function actionMovementInvoice($id_movement)
{
$movement = MovementController::findModel($id_movement);
$movement_product = $movement->movementProducts;
$settings = SettingsController::findModel();
$sender = '';
$receiver = '';
if ($movement->id_movement_type == 1)
{
$invoice_name = 'Приходная накладная № ' . $movement-
>id;
$worksheet_name = 'Приходная накладная';
$receiver = $movement->idUser->titleShort;
}
else
{
$invoice_name = 'Расходная накладная № ' . $movement-
>id;
$worksheet_name = 'Расходная накладная';
$sender = $movement->idUser->titleShort;
}
$this->SetHeader ('Накладная_' . $movement->id . '.xls');
return $this->renderPartial('movement-invoice', [
'movement' => $movement,
149
'movement_product' => $movement_product,
'settings' => $settings,
'invoice_name' => $invoice_name,
'worksheet_name' => $worksheet_name,
'sender' => $sender,
'receiver' => $receiver,
]);
}
public function actionRegistry()
{
$products = \app\models\Product::find()->all();
$settings = SettingsController::findModel();
$this->SetHeader ('Реестр.xls');
return $this->renderPartial('registry', [
'products' => $products,
'settings' => $settings,
]);
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\PackType;
150
use app\models\PackTypeSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
/**
* PackTypeController implements the CRUD actions for PackType model.
*/
class PackTypeController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' =>
[
[
'actions' => ['index', 'view', 'create',
'update', 'delete'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule,
$action)
151
{
return Yii::$app->user->identity-
>IsAdmin;
}
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all PackType models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new PackTypeSearch();
$dataProvider = $searchModel->search(Yii::$app->request-
>queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
152
]);
}
/**
* Displays a single PackType model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new PackType model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new PackType();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('create', [
'model' => $model,
]);
153
}
}
/**
* Updates an existing PackType model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing PackType model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
154
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the PackType model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return PackType the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = PackType::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not
exist.');
}
}
}
<?php
namespace app\controllers;
use Yii;
use app\models\Product;
use app\models\ProductSearch;
use yii\web\Controller;
155
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\filters\AccessControl;
/**
* ProductController implements the CRUD actions for Product model.
*/
class ProductController extends Controller
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' =>
[
[
'actions' => ['index', 'view', 'create',
'update', 'delete'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule,
$action)
{
156
return Yii::$app->user->identity-
>IsAdmin;
}
],
],
],
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Product models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new ProductSearch();
$dataProvider = $searchModel->search(Yii::$app->request-
>queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)