79 lines
2.5 KiB
PHP
79 lines
2.5 KiB
PHP
<?php
|
||
|
||
namespace app\commands;
|
||
|
||
use yii\console\Controller;
|
||
use yii\console\ExitCode;
|
||
|
||
use app\models\Invoice;
|
||
|
||
class TestController extends Controller
|
||
{
|
||
public function actionInvoice($buyer = 123123, $order = 0)
|
||
{
|
||
// Генерация счета
|
||
Invoice::generate($order, $this->renderPartial('/invoice/order/pattern', [
|
||
'buyer' => [
|
||
'id' => $buyer,
|
||
'info' => 'Неизвестно'
|
||
],
|
||
'order' => [
|
||
'id' => $order,
|
||
'date' => time(),
|
||
'entries' => [
|
||
[
|
||
'title' => 'Тестовое вхождение',
|
||
'amount' => [
|
||
'value' => 1,
|
||
'unit' => 'шт'
|
||
],
|
||
'cost' => [
|
||
'value' => 1000,
|
||
'unit' => 'руб'
|
||
],
|
||
'type' => 'supply'
|
||
],
|
||
[
|
||
'title' => 'Тестовое вхождение',
|
||
'amount' => [
|
||
'value' => 1,
|
||
'unit' => 'шт'
|
||
],
|
||
'cost' => [
|
||
'value' => 1000,
|
||
'unit' => 'руб'
|
||
],
|
||
'type' => 'supply'
|
||
],
|
||
[
|
||
'title' => 'Тестовое вхождение',
|
||
'amount' => [
|
||
'value' => 1,
|
||
'unit' => 'шт'
|
||
],
|
||
'cost' => [
|
||
'value' => 1000,
|
||
'unit' => 'руб'
|
||
],
|
||
'type' => 'supply'
|
||
],
|
||
[
|
||
'title' => 'Тестовое вхождение',
|
||
'amount' => [
|
||
'value' => 5,
|
||
'unit' => 'шт'
|
||
],
|
||
'cost' => [
|
||
'value' => 1000,
|
||
'unit' => 'руб'
|
||
],
|
||
'type' => 'supply'
|
||
]
|
||
]
|
||
]
|
||
]));
|
||
|
||
return ExitCode::OK;
|
||
}
|
||
}
|