</div> <?php ActiveForm::end(); ?> </div> <div class="receipt-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php $columns = [['attribute' => 'bukmark_code', 'label' => 'Código', 'value' => 'product.bukmark_code', 'options' => ['style' => 'width: 100px;']], ['attribute' => 'product_id', 'value' => 'product.title', 'filter' => Html::activeDropDownList($searchModel, 'product_id', Product::getDropdownData(), ['class' => 'form-control', 'prompt' => 'Elegir producto']), 'enableSorting' => false], ['label' => 'Cliente', 'value' => 'estimate.client.name', 'filter' => Html::activeDropDownList($searchModel, 'client_id', Client::getIdNameArray(), ['class' => 'form-control', 'prompt' => 'Nombre'])], ['attribute' => 'estimate.receipt.created_date', 'format' => 'date', 'filter' => false], ['attribute' => 'quantity'], ['label' => 'Total', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->quantitySubtotal, Currency::CURRENCY_ARS); }, 'options' => ['style' => 'width: 150px;']]]; ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $columns]); ?> <?php echo ExportMenu::widget(['dataProvider' => $exportDataProvider, 'target' => ExportMenu::TARGET_SELF, 'showConfirmAlert' => false, 'filename' => 'resumen', 'columns' => $columns]); ?> </div>
/* @var $searchModel app\models\EstimateSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Presupuestos'; $this->params['breadcrumbs'][] = $this->title; EstimateIndexAsset::register($this); ?> <div class="estimate-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <div style="float: right"> <h3>Valor dólar: <?php echo Currency::format(Currency::getUsToArs(), Currency::CURRENCY_ARS); ?> </h3> </div> <p> <?php echo Html::a('Crear presupuesto', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['pjax' => true, 'pjaxSettings' => ['options' => ['id' => 'estimates-gridview']], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $index, $widget, $grid) { return ['style' => "background-color:{$model->statusColor};"]; }, 'columns' => [['attribute' => 'id', 'label' => 'Número', 'options' => ['style' => 'width: 100px;']], ['label' => 'Cliente', 'value' => 'client.name', 'filter' => Html::activeTextInput($searchModel, 'clientName', ['class' => 'form-control'])], 'title', ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'status', 'label' => 'Estado', 'value' => 'statusLabel', 'filter' => Html::activeDropDownList($searchModel, 'status', Estimate::statusLabels(), ['class' => 'form-control', 'prompt' => 'Estado']), 'editableOptions' => ['inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => Estimate::statusLabels()], 'refreshGrid' => true, 'options' => ['style' => 'width: 160px;']], ['attribute' => 'request_date', 'format' => 'date', 'filter' => false, 'options' => ['style' => 'width: 125px;']], ['attribute' => 'sent_date', 'format' => 'date', 'filter' => false, 'options' => ['style' => 'width: 125px;']], ['label' => 'Muestra', 'filter' => Html::activeCheckbox($searchModel, 'sampleDelivered', ['label' => '']), 'value' => function ($model, $key, $index, $column) { return $model->entriesWithSampleDeliveredCount > 0 ? 'Si' : 'No';
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'variant_price', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->variant_price, $model->variant_currency); }, 'editableOptions' => function ($model, $key, $index) { return ['formOptions' => ['enableClientValidation' => false], 'inputFieldConfig' => ['inputOptions' => ['value' => Yii::$app->formatter->asDecimal($model->variant_price, 2)]]]; }, 'refreshGrid' => true, 'filter' => false], ['label' => 'Suma', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->cost, Currency::CURRENCY_ARS); }], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'utility', 'value' => $percentageDisplayFunction, 'editableOptions' => function ($model, $key, $index) use($percentageDisplayFunction) { return ['formOptions' => ['enableClientValidation' => false], 'inputFieldConfig' => ['inputOptions' => ['value' => call_user_func($percentageDisplayFunction, $model, $key, $index, 'utility')]]]; }, 'refreshGrid' => true, 'filter' => false], ['label' => 'Subtotal', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->subtotal, Currency::CURRENCY_ARS); }], ['label' => 'Subt. x cant.', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->quantitySubtotal, Currency::CURRENCY_ARS); }]]; if ($user->admin) { $marginColumn = ['label' => 'Margen', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->utilityMargin, Currency::CURRENCY_ARS); }]; array_push($columns, $marginColumn); } $sampleColumn = ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Muestra', 'options' => ['style' => 'width: 70px;'], 'template' => '{checkSample}', 'buttons' => ['checkSample' => function ($url, $model, $key) { $options = array_merge(['title' => 'Muestra entregada', 'aria-label' => 'Muetra entregada']); $icon = $model->sample_delivered ? 'glyphicon-check' : 'glyphicon-unchecked'; return Html::a('<span class="glyphicon ' . $icon . '"></span>', $url, $options); }], 'urlCreator' => function ($action, $model, $key, $index) { $url = ['']; switch ($action) { case 'checkSample': $url = ['check-entry-sample', 'id' => $model->id, 'check' => !$model->sample_delivered, 'page' => Yii::$app->request->getQueryParam('page', null)]; break; } return Url::to($url);
use yii\helpers\Html; use yii\widgets\DetailView; use app\models\Currency; /* @var $this yii\web\View */ /* @var $model app\models\Receipt */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => 'Facturas', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="receipt-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a('Editar', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a('Eliminar', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => '¿Estas seguro de eliminar este elemento?', 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['label' => 'Cliente', 'value' => $model->estimate->client->name], ['label' => 'Presupuesto', 'value' => $model->estimate->title], 'number', ['attribute' => 'created_date', 'format' => 'date'], ['label' => 'Tipo', 'value' => $model->typeLabel], ['label' => 'Estado', 'value' => $model->statusLabel], ['label' => 'Neto', 'value' => Currency::format($model->estimate->total_checked, Currency::CURRENCY_ARS)], ['attribute' => 'iva', 'value' => $model->iva / 100, 'format' => ['percent', 2]], ['label' => 'Bruto', 'value' => Currency::format($model->gross, Currency::CURRENCY_ARS)]]]); ?> </div>
<?php foreach ($group as $entry) { ?> <div style="float: left; margin: 0; width: 58%; height: 1px;"> <?php echo $entry->description; ?> </div> <div style="float: left; margin: 0; width: 25%; text-align: center; height: 1px;"> <?php echo $entry->quantity; ?> </div> <div style="float: left; margin: 0; text-align: center; height: 1px;"> <?php echo Currency::format($entry->subtotal, Currency::CURRENCY_ARS); ?> </div> <?php } ?> </div> <?php } ?> </div> </div> <?php if (++$i < $qGroups) { ?>
<?php ActiveForm::end(); ?> </div> <div class="receipt-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'options' => ['style' => 'width: 100px;']], ['label' => 'Cliente', 'value' => 'estimate.client.name', 'filter' => Html::activeDropDownList($searchModel, 'client_id', Client::getIdNameArray(), ['class' => 'form-control', 'prompt' => 'Nombre'])], ['label' => 'Presupuesto', 'value' => 'estimate.title'], 'number', ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'status', 'label' => 'Estado', 'value' => 'statusLabel', 'filter' => Html::activeDropDownList($searchModel, 'status', Receipt::statusLabels(), ['class' => 'form-control', 'prompt' => 'Estado']), 'editableOptions' => ['inputType' => Editable::INPUT_DROPDOWN_LIST, 'data' => Receipt::statusLabels()]], ['attribute' => 'created_date', 'format' => 'date', 'filter' => false], ['class' => 'yii\\grid\\ActionColumn']]]); ?> <?php echo ExportMenu::widget(['dataProvider' => $exportDataProvider, 'target' => ExportMenu::TARGET_SELF, 'showConfirmAlert' => false, 'filename' => 'facturas', 'columns' => [['attribute' => 'created_date', 'format' => 'date', 'filter' => false], ['attribute' => 'type', 'value' => 'typeLabel'], ['attribute' => 'number', 'label' => 'Factura Nro'], ['label' => 'Cliente', 'value' => 'estimate.client.name'], ['label' => 'CUIT', 'value' => 'estimate.client.cuit'], ['label' => 'Facturación Neta', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->estimate->total_checked, Currency::CURRENCY_ARS); }], ['label' => 'IVA', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->IVATotal, Currency::CURRENCY_ARS); }], ['label' => 'Facturación Bruta', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->gross, Currency::CURRENCY_ARS); }], ['label' => 'Utilidad', 'value' => function ($model, $key, $index, $column) { return Currency::format($model->estimate->total_checked - $model->estimate->cost_checked, Currency::CURRENCY_ARS); }], ['label' => 'Porcentaje', 'value' => null], ['label' => 'Productos', 'value' => 'products'], ['label' => 'Estado', 'value' => 'statusLabel'], ['label' => 'Recibo Nro', 'value' => null]]]); ?> </div>