add hidden account, cart insert/delete

add hidden account support
add delete/payout buttons to carts
add backend product sales with pdf export
add frontend product sales with pdf export
add frontend ticket sales with pdf export
This commit is contained in:
2016-01-03 18:29:39 +01:00
parent 62bcb7ff27
commit 595f663820
43 changed files with 2154 additions and 24 deletions

View File

@@ -0,0 +1,29 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model common\models\TransferSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?= Html::a(
Yii::t('frontend/transfer', 'Export PDF'),
Url::to(['sale-pdf' ,
Html::getInputName($model, "start") => Html::getAttributeValue($model, "start"),
Html::getInputName($model, "end") =>Html::getAttributeValue($model, "end"),
Html::getInputName($model, "id_account") => Html::getAttributeValue($model, "id_account"),
Html::getInputName($model, "id_user") => Html::getAttributeValue($model, "id_user"),
Html::getInputName($model, "category") => Html::getAttributeValue($model, "category"),
Html::getInputName($model, "id_product") => Html::getAttributeValue($model, "id_product"),
Html::getInputName($model, "status") => Html::getAttributeValue($model, "status"),
] ),
['class' => 'btn btn-primary'])
?>

View File

@@ -0,0 +1,142 @@
<?php
use yii\helpers\Html;
use common\models\Account;
use common\models\User;
use common\models\ProductCategory;
use common\models\Product;
use common\models\Transfer;
?>
<style>
td,th{
padding: 3px;
}
.table-summary td.count {
text-align: right;
}
.table-summary td.money {
text-align: right;
}
.table-filter th{
text-align: left;
}
</style>
<div class="container">
<?php
// ////////////////////////
// Termék eladás
// //////////////////////
?>
<h3>Termék eladások</h3>
<table class="table-filter">
<tr>
<th><?php echo Html::encode($searchModel->getAttributeLabel('start')) ?></th>
<td><?php echo Html::getAttributeValue($searchModel, "start")?></td>
<th><?php echo Html::encode($searchModel->getAttributeLabel('end')) ?></th>
<td><?php echo Html::getAttributeValue($searchModel, "end")?></td>
</tr>
<tr>
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_account')) ?></th>
<td><?php if ( empty($searchModel->id_account) ){
echo"Mind" ;
}else{
$account = Account::findOne($searchModel->id_account) ;
if ( $account != null ){
echo $account->name;
}
}?></td>
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_user')) ?></th>
<td><?php if ( empty($searchModel->id_user) ){
echo"Mind" ;
}else{
$user = User::findOne($searchModel->id_user) ;
if ( $user != null ){
echo $user->username;
}
}?></td>
</tr>
<tr>
<th><?php echo Html::encode($searchModel->getAttributeLabel('category')) ?></th>
<td><?php if ( empty($searchModel->category) ){
echo"Mind" ;
}else{
$category = ProductCategory::findOne($searchModel->category) ;
if ( $category != null ){
echo $category->name;
}
}?></td>
<th><?php echo Html::encode($searchModel->getAttributeLabel('id_product')) ?></th>
<td><?php if ( empty($searchModel->id_product) ){
echo"Mind" ;
}else{
$product = Product::findOne($searchModel->id_product) ;
if ( $product != null ){
echo $product->name;
}
}?></td>
</tr>
<tr>
<th><?php echo Html::encode($searchModel->getAttributeLabel('status')) ?></th>
<td><?php if ( empty($searchModel->status) ){
echo"Mind" ;
}else{
$statuses = Transfer::statuses();
$status = "";
if (array_key_exists($searchModel->status, $statuses) ){
echo $statuses[$searchModel->status];
}
}?></td>
</tr>
</table>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->productMoney; ?> Ft
</div>
</div>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>T</th>
<th>Kiadva</th>
<th>Fizetve</th>
<th>Kassza</th>
<th>Felhasználó</th>
<!-- <th>Vásárló</th> -->
<th>Kategória</th>
<th>Termék</th>
<th>Egység ár</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ($searchModel->products as $p ){?>
<tr>
<td><?php echo "#".$p['id_transfer']?> </td>
<td><?php echo $p['product_created_at']?> </td>
<td><?php echo $p['product_paid_at']?> </td>
<td><?php echo $p['account_name']?> </td>
<td><?php echo $p['user_name']?> </td>
<td><?php echo $p['product_category_name'] ?></td>
<td><?php echo $p['product_name'] ?></td>
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
<td class='count'><?php echo $p['product_count']?> Db</td>
<td class='money'><?php echo $p['product_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
if (count ( $searchModel->products ) == 0) {
?>
Nincs találat
<?php
}
?>
</div>

View File

@@ -0,0 +1,77 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\DatePicker;
use frontend\components\HtmlHelper;
use common\models\Transfer;
use kartik\widgets\DateTimePicker;
/* @var $this yii\web\View */
/* @var $model common\models\TransferSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$accountOptions = ['' =>'Mind']+ HtmlHelper::mkAccountOptions( $model->accounts );
$userOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->users,'id','username');
$productOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productOptions,'id_product','name');
$productCategoryOptions = ['' => 'Mind'] + HtmlHelper::mkOptions($model->productCategories,'id_product_category','name');
$transferStatusOptions = ['' => 'Mind'] + Transfer::statuses();
?>
<div class="transfer-search">
<?php $form = ActiveForm::begin([
'action' => ['sale'],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'category')->dropDownList($productCategoryOptions) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'id_product')->dropDownList($productOptions) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'status')->dropDownList($transferStatusOptions) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/transfer', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,115 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ListView;
use yii\base\Widget;
/* @var $this yii\web\View */
/* @var $searchModel common\models\TransferSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t ( 'frontend/transfer', 'Product sale detailed' );
$this->params ['breadcrumbs'] [] = $this->title;
?>
<style>
.dl-transfer {
margin-bottom: 0px;
}
.item-transfer {
border: 1px solid #b4b4b4;
margin-top: 12px;
padding-top: 6px;
padding-bottom: 6px;
}
td.count, td.money {
text-align: right;
}
td.name {
width: 600px;
}
.table-category-product td.name {
width: 600px;
}
.table-category-product td.count {
text-align: right;
}
.table-category-product td.money {
text-align: right;
}
</style>
<div class="transfer-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search_sale', ['model' => $searchModel]); ?>
<?php echo $this->render('_export_btn_sale', ['model' => $searchModel]); ?>
<div>
<?php
// ////////////////////////
// Termék eladás
// //////////////////////
?>
<h3>Termék eladások</h3>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen: <?php echo $searchModel->productMoney; ?> Ft
</div>
</div>
<table class="table table-bordered table-striped table-summary">
<thead>
<tr>
<th>Tranzakció</th>
<th>Kiadva</th>
<th>Fizetve</th>
<th>Kassza</th>
<th>Felhasználó</th>
<th>Vásárló</th>
<th>Kategória</th>
<th>Termék</th>
<th>Egység ár</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ($searchModel->products as $p ){?>
<tr>
<td><?php echo "#".$p['id_transfer']?> </td>
<td><?php echo $p['product_created_at']?> </td>
<td><?php echo $p['product_paid_at']?> </td>
<td><?php echo $p['account_name']?> </td>
<td><?php echo $p['user_name']?> </td>
<td><?php echo $p['customer_name']?> </td>
<td><?php echo $p['product_category_name'] ?></td>
<td><?php echo $p['product_name'] ?></td>
<td class='money'><?php echo $p['product_item_price']?> Ft</td>
<td class='count'><?php echo $p['product_count']?> Db</td>
<td class='money'><?php echo $p['product_money']?> FT</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
if (count ( $searchModel->products ) == 0) {
?>
Nincs találat
<?php
}
?>
</div>
</div>