Anyone who knows yii2

Hi, i started to try and learn yii2 this past week and i managed to build something, but it’s confusing for me so i want to pay someone to help me out because i’ve been stuck for like three days now.

My problem:

I want a software that is used to check wether the trucks driver is able to come in and load his truck. Basically i have three main tables, driver, vehicle and invoices, and the archive table which is where i show values to all of them.

  • So, driver comes in, you put his id num into the system and the system first checks if he has already loaded up that day, if so, he can’t pass.
  • Then you input his vehicle licenseplate which will lookup his vehicle in the system and find the maximum capacity his truck can carry. Then you load all the invoices he has given you, each invoice has a invoice number, invoice date, and invoice load amount for. You have to then sum all of the invoice load amount for that were put in the dynamic form fields and compare it to that vehicles maximum capacity, if it is greater then he can’t pass.

What i have:

My controller:

Code:

<?php
namespace appcontrollers;

use Yii;
use yiiwebResponse;
use yiiwidgetsActiveForm;
use appmodelsArchive;
use appmodelsArchiveSearch;
use appmodelsInvoices;
use appmodelsModel;
use yiiwebController;
use yiiwebNotFoundHttpException;
use yiifiltersVerbFilter;

/**
&nbsp;* ArchiveController implements the CRUD actions for Archive model.
&nbsp;*/
class ArchiveController extends Controller
{
&nbsp; &nbsp; public function behaviors()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'verbs' => [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'class' => VerbFilter::className(),
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'actions' => [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'delete' => ['post'],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ],
&nbsp; &nbsp; &nbsp; &nbsp; ];
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Lists all Archive models.
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionIndex()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $searchModel = new ArchiveSearch();
&nbsp; &nbsp; &nbsp; &nbsp; $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

&nbsp; &nbsp; &nbsp; &nbsp; return $this->render('index', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'searchModel' => $searchModel,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'dataProvider' => $dataProvider,
&nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Displays a single Archive model.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionView($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return $this->render('view', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $this->findModel($id),
&nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Creates a new Archive model.
&nbsp; &nbsp; * If creation is successful, the browser will be redirected to the 'view' page.
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionCreate()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $model = new Archive();
&nbsp; &nbsp; &nbsp; &nbsp; $modelsInvoices = [new Invoices];

&nbsp; &nbsp; &nbsp; &nbsp; $modelsInvoices = Model::createMultiple(Invoices::classname());
&nbsp; &nbsp; &nbsp; &nbsp; Model::loadMultiple($modelsInvoices, Yii::$app->request->post());

&nbsp; &nbsp; &nbsp; if (Yii::$app->request->isAjax) {

&nbsp; &nbsp; &nbsp; &nbsp; Yii::$app->response->format = Response::FORMAT_JSON;
&nbsp; &nbsp; &nbsp; &nbsp; return ActiveForm::validateMultiple($modelsInvoices);
&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; elseif (Yii::$app->request->isAjax && $model->load($_POST))
&nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Yii::$app->response->format ='json';
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return yiiwidgetsActiveForm::validate($model);
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; elseif ($model->load(Yii::$app->request->post()) && $model->save())
&nbsp; &nbsp; &nbsp; &nbsp; {

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //$modelsInvoices = Model::createMultiple(Invoices::classname());
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Model::loadMultiple($modelsInvoices, Yii::$app->request->post());

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /*if (Yii::$app->request->isAjax) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Yii::$app->response->format = Response::FORMAT_JSON;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return ArrayHelper::merge(
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveForm::validateMultiple($modelsInvoices),
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ActiveForm::validate($model)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }*/

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // validate all models
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $valid = $model->validate();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $valid = Model::validateMultiple($modelsInvoices) && $valid;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($valid) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $transaction = Yii::$app->db->beginTransaction();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($flag = $model->save(false)) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach ($modelsInvoices as $modelInvoices)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $modelInvoices->archive_id = $model->id;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (! ($flag = $modelInvoices->save(false))) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $transaction->rollBack();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($flag) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $transaction->commit();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->redirect(['view', 'id' => $model->id]);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception $e) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $transaction->rollBack();
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->render('create', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $model,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'modelsInvoices' => (empty($modelsInvoices)) ? [new Invoices] : $modelsInvoices
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Updates an existing Archive model.
&nbsp; &nbsp; * If update is successful, the browser will be redirected to the 'view' page.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionUpdate($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $model = $this->findModel($id);

&nbsp; &nbsp; &nbsp; &nbsp; if ($model->load(Yii::$app->request->post()) && $model->save()) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->redirect(['view', 'id' => $model->id]);
&nbsp; &nbsp; &nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->render('update', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $model,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Deletes an existing Archive model.
&nbsp; &nbsp; * If deletion is successful, the browser will be redirected to the 'index' page.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionDelete($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $this->findModel($id)->delete();

&nbsp; &nbsp; &nbsp; &nbsp; return $this->redirect(['index']);
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Finds the Archive model based on its primary key value.
&nbsp; &nbsp; * If the model is not found, a 404 HTTP exception will be thrown.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return Archive the loaded model
&nbsp; &nbsp; * @throws NotFoundHttpException if the model cannot be found
&nbsp; &nbsp; */
&nbsp; &nbsp; protected function findModel($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; if (($model = Archive::findOne($id)) !== null) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $model;
&nbsp; &nbsp; &nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new NotFoundHttpException('The requested page does not exist.');
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }
}


My invoices model

Code:

<?php
namespace appcontrollers;

use Yii;
use appmodelsInvoices;
use appmodelsInvoicesSearch;
use yiiwebController;
use yiiwebNotFoundHttpException;
use yiifiltersVerbFilter;

/**
&nbsp;* InvoicesController implements the CRUD actions for Invoices model.
&nbsp;*/
class InvoicesController extends Controller
{
&nbsp; &nbsp; public function behaviors()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'verbs' => [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'class' => VerbFilter::className(),
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'actions' => [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'delete' => ['post'],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ],
&nbsp; &nbsp; &nbsp; &nbsp; ];
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Lists all Invoices models.
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionIndex()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $searchModel = new InvoicesSearch();
&nbsp; &nbsp; &nbsp; &nbsp; $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

&nbsp; &nbsp; &nbsp; &nbsp; return $this->render('index', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'searchModel' => $searchModel,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'dataProvider' => $dataProvider,
&nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Displays a single Invoices model.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionView($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return $this->render('view', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $this->findModel($id),
&nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Creates a new Invoices model.
&nbsp; &nbsp; * If creation is successful, the browser will be redirected to the 'view' page.
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionCreate()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $model = new Invoices();

&nbsp; &nbsp; &nbsp; &nbsp; if ($model->load(Yii::$app->request->post()) && $model->save()) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->redirect(['view', 'id' => $model->id]);
&nbsp; &nbsp; &nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->render('create', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $model,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Updates an existing Invoices model.
&nbsp; &nbsp; * If update is successful, the browser will be redirected to the 'view' page.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionUpdate($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $model = $this->findModel($id);

&nbsp; &nbsp; &nbsp; &nbsp; if ($model->load(Yii::$app->request->post()) && $model->save()) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->redirect(['view', 'id' => $model->id]);
&nbsp; &nbsp; &nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->render('update', [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $model,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]);
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Deletes an existing Invoices model.
&nbsp; &nbsp; * If deletion is successful, the browser will be redirected to the 'index' page.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return mixed
&nbsp; &nbsp; */
&nbsp; &nbsp; public function actionDelete($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; $this->findModel($id)->delete();

&nbsp; &nbsp; &nbsp; &nbsp; return $this->redirect(['index']);
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * Finds the Invoices model based on its primary key value.
&nbsp; &nbsp; * If the model is not found, a 404 HTTP exception will be thrown.
&nbsp; &nbsp; * @param integer $id
&nbsp; &nbsp; * @return Invoices the loaded model
&nbsp; &nbsp; * @throws NotFoundHttpException if the model cannot be found
&nbsp; &nbsp; */
&nbsp; &nbsp; protected function findModel($id)
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; if (($model = Invoices::findOne($id)) !== null) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $model;
&nbsp; &nbsp; &nbsp; &nbsp; } else {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new NotFoundHttpException('The requested page does not exist.');
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }
}


My view:

Code:

<?php

use yiihelpersHtml;
use yiiwidgetsActiveForm;
use yiihelpersArrayHelper;
use wbragancadynamicformDynamicFormWidget;
use appmodelsDrivers;
use appmodelsVehicles;
use appmodelsInvoices;
use dosamigosdatepickerDatePicker;
use kartikselect2Select2;
use yiibootstrapModal;
use yiihelpersUrl;
/* @var $this yiiwebView */
/* @var $model appmodelsArchive */
/* @var $form yiiwidgetsActiveForm */
?>

<div class=&quot;archive-form&quot;>

&nbsp; &nbsp; <?php $form = ActiveForm::begin(['id' => 'dynamic-form']); ?>
&nbsp; &nbsp; <?= $form->field($model, 'driver_identitynum')->widget(Select2::classname(), [
&nbsp; &nbsp; 'data' => ArrayHelper::map(Drivers::find()->all(),'driver_identitynum', 'fullname'),
&nbsp; &nbsp; 'language' => 'en',
&nbsp; &nbsp; 'options' => ['placeholder' => 'Ingrese el numero de cedula...'],
&nbsp; &nbsp; 'pluginOptions' => [
&nbsp; &nbsp; &nbsp; &nbsp; 'allowClear' => true],
&nbsp; &nbsp; ]); ?>

&nbsp; &nbsp; &nbsp; &nbsp; <div align=&quot;right&quot;><?= Html::a('Add driver', ['/drivers/create'],
&nbsp; &nbsp; &nbsp; ['target'=>'_blank']); ?>
&nbsp; &nbsp; &nbsp; </div>

&nbsp; &nbsp; <?= $form->field($model, 'vehicle_lp')->widget(Select2::classname(), [
&nbsp; &nbsp; 'data' => ArrayHelper::map(Vehicles::find()->all(),'vehicle_lp', 'fulltruck'),
&nbsp; &nbsp; 'language' => 'en',
&nbsp; &nbsp; 'options' => ['placeholder' => 'Ingrese la placa del vehiculo...'],
&nbsp; &nbsp; 'pluginOptions' => [
&nbsp; &nbsp; &nbsp; &nbsp; 'allowClear' => true
&nbsp; &nbsp; ],
&nbsp; &nbsp; ]); ?>

&nbsp; &nbsp; <div align=&quot;right&quot;><?= Html::a('Add vehicle', ['/vehicles/create'],
&nbsp; &nbsp; &nbsp; ['target'=>'_blank']); ?>
&nbsp; &nbsp; &nbsp; </div>

&nbsp; <div class=&quot;row&quot;> <div class=&quot;panel panel-default&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-heading&quot;><h4><i class=&quot;glyphicon glyphicon-envelope&quot;></i>Facturas</h4></div>
&nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-body&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php DynamicFormWidget::begin([
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus &quot;_&quot; [A-Za-z0-9_]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'widgetBody' => '.container-items', // required: css class selector
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'widgetItem' => '.item', // required: css class
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'limit' => 4, // the maximum times, an element can be cloned (default 999)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'min' => 1, // 0 or 1 (default 1)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'insertButton' => '.add-item', // css class
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'deleteButton' => '.remove-item', // css class
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'model' => $modelsInvoices[0],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'formId' => 'dynamic-form',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'formFields' => [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'invoice_number',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'invoice_loadamount',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'invoice_date',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]); ?>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;container-items&quot;><!-- widgetContainer -->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php foreach ($modelsInvoices as $i => $modelInvoices): ?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;item panel panel-default&quot;><!-- widgetBody -->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-heading&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <h3 class=&quot;panel-title pull-left&quot;>Facturas</h3>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;pull-right&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;button&quot; class=&quot;add-item btn btn-success btn-xs&quot;><i class=&quot;glyphicon glyphicon-plus&quot;></i></button>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;button&quot; class=&quot;remove-item btn btn-danger btn-xs&quot;><i class=&quot;glyphicon glyphicon-minus&quot;></i></button>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;clearfix&quot;></div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-body&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // necessary for update action.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (! $modelInvoices->isNewRecord) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo Html::activeHiddenInput($modelInvoices, &quot;[{$i}]id&quot;);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;row&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?= $form->field($modelInvoices, &quot;[{$i}]invoice_number&quot;)->textInput(['maxlength' => true]) ?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?= $form->field($modelInvoices, &quot;[{$i}]invoice_loadamount&quot;)->textInput(['maxlength' => true]) ?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?= $form->field($modelInvoices, &quot;[{$i}]invoice_date&quot;, ['enableAjaxValidation' => true])->widget(DatePicker::className(), [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // inline too, not bad
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'inline' => false,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // modify template for custom rendering
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //'template' => '<div class=&quot;well well-sm&quot; style=&quot;background-color: #fff; width:250px&quot;>{input}</div>',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'options' => ['class' => 'form-control picker'],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'clientOptions' => [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'autoclose' => true,
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'format' => 'dd-mm-yyyy'

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ]);?>

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><!-- .row -->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;row&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php endforeach; ?>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php DynamicFormWidget::end(); ?>
&nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; </div>
</div>

&nbsp; &nbsp; <div class=&quot;form-group&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
&nbsp; &nbsp; </div>

&nbsp; &nbsp; <?php ActiveForm::end(); ?>

</div>


My vehicle model:

Code:

<?php

namespace appmodels;

use Yii;

/**
&nbsp;* This is the model class for table &quot;vehicles&quot;.
&nbsp;*
&nbsp;* @property integer $vehicle_id
&nbsp;* @property string $vehicle_model
&nbsp;* @property string $vehicle_lp
&nbsp;* @property string $vehicle_maxcap
&nbsp;*/
class Vehicles extends yiidbActiveRecord
{
&nbsp; &nbsp; /**
&nbsp; &nbsp; * @inheritdoc
&nbsp; &nbsp; */
&nbsp; &nbsp; public static function tableName()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return 'vehicles';
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * @inheritdoc
&nbsp; &nbsp; */
&nbsp; &nbsp; public function rules()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [['vehicle_model', 'vehicle_lp', 'vehicle_maxcap'], 'required'],
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [['vehicle_model', 'vehicle_lp', 'vehicle_maxcap'], 'string', 'max' => 100]
&nbsp; &nbsp; &nbsp; &nbsp; ];
&nbsp; &nbsp; }

&nbsp; &nbsp; /**
&nbsp; &nbsp; * @inheritdoc
&nbsp; &nbsp; */
&nbsp; &nbsp; public function attributeLabels()
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; return [
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vehicle_id' => 'Vehicle ID',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vehicle_model' => 'Vehicle Model',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vehicle_lp' => 'Vehicle Lp',
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'vehicle_maxcap' => 'Vehicle Maxcap',
&nbsp; &nbsp; &nbsp; &nbsp; ];
&nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; public function getfullTruck()
&nbsp; &nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return $this->vehicle_lp.' - '.$this->vehicle_model.' - '.$this->vehicle_maxcap.'kgs';
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;

}


Generated html that screen:

Code:





























































































































































































































































































































































<!DOCTYPE html>
<html lang=&quot;en-US&quot;>
<head>
&nbsp; &nbsp; <meta charset=&quot;UTF-8&quot;>
&nbsp; &nbsp; <meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;>
&nbsp; &nbsp; <meta name=&quot;csrf-param&quot; content=&quot;_csrf&quot;>
&nbsp; &nbsp; <meta name=&quot;csrf-token&quot; content=&quot;bUtnd1ZQaVcHAhYOLig9Bz4iEAUfMgwnLyAgPm8RITAdGyw1MmFcMA==&quot;>
&nbsp; &nbsp; <title>Create Archive</title>
&nbsp; &nbsp; <link href=&quot;/assets/8512d577/css/bootstrap.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/assets/afb84787/css/kv-widgets.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/assets/a4ad9a4f/css/select2.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/assets/a4ad9a4f/css/select2-addl.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/assets/a4ad9a4f/css/select2-krajee.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/assets/74a094c5/css/bootstrap-datepicker3.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/css/site.css&quot; rel=&quot;stylesheet&quot;>
<link href=&quot;/assets/ac90f1d5/toolbar.css&quot; rel=&quot;stylesheet&quot;>
<script type=&quot;text/javascript&quot;>var s2options_d6851687 = {&quot;themeCss&quot;:&quot;.select2-container--krajee&quot;,&quot;sizeCss&quot;:&quot;&quot;,&quot;doReset&quot;:true,&quot;doToggle&quot;:false,&quot;doOrder&quot;:false};
var select2_398645a8 = {&quot;allowClear&quot;:true,&quot;theme&quot;:&quot;krajee&quot;,&quot;width&quot;:&quot;100%&quot;,&quot;placeholder&quot;:&quot;Ingrese el numero de cedula...&quot;,&quot;language&quot;:&quot;en&quot;};
var select2_8df6b337 = {&quot;allowClear&quot;:true,&quot;theme&quot;:&quot;krajee&quot;,&quot;width&quot;:&quot;100%&quot;,&quot;placeholder&quot;:&quot;Ingrese la placa del vehiculo...&quot;,&quot;language&quot;:&quot;en&quot;};
var dynamicform_5fb553de = {&quot;widgetContainer&quot;:&quot;dynamicform_wrapper&quot;,&quot;widgetBody&quot;:&quot;.container-items&quot;,&quot;widgetItem&quot;:&quot;.item&quot;,&quot;limit&quot;:4,&quot;insertButton&quot;:&quot;.add-item&quot;,&quot;deleteButton&quot;:&quot;.remove-item&quot;,&quot;insertPosition&quot;:&quot;bottom&quot;,&quot;formId&quot;:&quot;dynamic-form&quot;,&quot;min&quot;:1,&quot;fields&quot;:[{&quot;id&quot;:&quot;invoices-{}-invoice_number&quot;,&quot;name&quot;:&quot;Invoices[{}][invoice_number]&quot;},{&quot;id&quot;:&quot;invoices-{}-invoice_loadamount&quot;,&quot;name&quot;:&quot;Invoices[{}][invoice_loadamount]&quot;},{&quot;id&quot;:&quot;invoices-{}-invoice_date&quot;,&quot;name&quot;:&quot;Invoices[{}][invoice_date]&quot;}],&quot;template&quot;:&quot;<div class=&quot;item panel panel-default&quot;><!-- widgetBody -->n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-heading&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <h3 class=&quot;panel-title pull-left&quot;>Facturas</h3>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;pull-right&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;button&quot; class=&quot;add-item btn btn-success btn-xs&quot;><i class=&quot;glyphicon glyphicon-plus&quot;></i></button>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;button&quot; class=&quot;remove-item btn btn-danger btn-xs&quot;><i class=&quot;glyphicon glyphicon-minus&quot;></i></button>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;clearfix&quot;></div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-body&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;row&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;form-group field-invoices-0-invoice_number required&quot;>n<label class=&quot;control-label&quot; for=&quot;invoices-0-invoice_number&quot;>Numero de factura:</label>n<input type=&quot;text&quot; id=&quot;invoices-0-invoice_number&quot; class=&quot;form-control&quot; name=&quot;Invoices[0][invoice_number]&quot; maxlength=&quot;100&quot;><div class=&quot;help-block&quot;></div>n</div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;form-group field-invoices-0-invoice_loadamount required&quot;>n<label class=&quot;control-label&quot; for=&quot;invoices-0-invoice_loadamount&quot;>Carga de la factura(kgs):</label>n<input type=&quot;text&quot; id=&quot;invoices-0-invoice_loadamount&quot; class=&quot;form-control&quot; name=&quot;Invoices[0][invoice_loadamount]&quot; maxlength=&quot;100&quot;><div class=&quot;help-block&quot;></div>n</div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;form-group field-invoices-0-invoice_date required&quot;>n<label class=&quot;control-label&quot; for=&quot;invoices-0-invoice_date&quot;>Fecha de emision de la factura:</label>n<div class=&quot;input-group date&quot;><input type=&quot;text&quot; id=&quot;invoices-0-invoice_date&quot; class=&quot;form-control picker&quot; name=&quot;Invoices[0][invoice_date]&quot;><span class=&quot;input-group-addon&quot;><i class=&quot;glyphicon glyphicon-calendar&quot;></i></span></div>nn<div class=&quot;help-block&quot;></div>n</div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><!-- .row -->n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;row&quot;>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>&quot;};
</script></head>
<body>
<div class=&quot;wrap&quot;>
&nbsp; &nbsp; <nav id=&quot;w0&quot; class=&quot;navbar-inverse navbar-fixed-top navbar&quot; role=&quot;navigation&quot;><div class=&quot;container&quot;><div class=&quot;navbar-header&quot;><button type=&quot;button&quot; class=&quot;navbar-toggle&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#w0-collapse&quot;><span class=&quot;sr-only&quot;>Toggle navigation</span>
<span class=&quot;icon-bar&quot;></span>
<span class=&quot;icon-bar&quot;></span>
<span class=&quot;icon-bar&quot;></span></button><a class=&quot;navbar-brand&quot; href=&quot;/&quot;>ANCA</a></div><div id=&quot;w0-collapse&quot; class=&quot;collapse navbar-collapse&quot;><ul id=&quot;w1&quot; class=&quot;navbar-nav navbar-right nav&quot;><li><a href=&quot;/invoices/index&quot;>Ingresos recientes</a></li>
<li class=&quot;active&quot;><a href=&quot;/archive/create&quot;>Registrar ingreso</a></li>
<li><a href=&quot;/print&quot;>Imprimir reporte</a></li>
<li><a href=&quot;/site/login&quot;>Login</a></li></ul></div></div></nav>
&nbsp; &nbsp; <div class=&quot;container&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; <ul class=&quot;breadcrumb&quot;><li><a href=&quot;/&quot;>Home</a></li>
<li><a href=&quot;/archive/index&quot;>Archives</a></li>
<li class=&quot;active&quot;>Create Archive</li>
</ul>&nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;archive-create&quot;>
&nbsp; &nbsp; <h1>Create Archive</h1>
<div class=&quot;archive-form&quot;>
&nbsp; &nbsp; <form id=&quot;dynamic-form&quot; action=&quot;/archive/create&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;_csrf&quot; value=&quot;bUtnd1ZQaVcHAhYOLig9Bz4iEAUfMgwnLyAgPm8RITAdGyw1MmFcMA==&quot;>&nbsp; &nbsp; <div class=&quot;form-group field-archive-driver_identitynum required&quot;>
<label class=&quot;control-label&quot; for=&quot;archive-driver_identitynum&quot;>Driver ID</label>
<div class=&quot;kv-plugin-loading loading-archive-driver_identitynum&quot;>&nbsp;</div><select id=&quot;archive-driver_identitynum&quot; class=&quot;form-control&quot; name=&quot;Archive[driver_identitynum]&quot; data-s2-options=&quot;s2options_d6851687&quot; data-krajee-select2=&quot;select2_398645a8&quot; style=&quot;display:none&quot;>
<option value=&quot;&quot;>Ingrese el numero de cedula...</option>
<option value=&quot;20387788&quot;>20387788 - Richard Teran </option>
<option value=&quot;2657895&quot;>2657895 - Rich Ter </option>
</select>
<div class=&quot;help-block&quot;></div>
</div>
&nbsp; &nbsp; &nbsp; &nbsp; <div align=&quot;right&quot;><a href=&quot;/drivers/create&quot; target=&quot;_blank&quot;>Add driver</a>
&nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; <div class=&quot;form-group field-archive-vehicle_lp required&quot;>
<label class=&quot;control-label&quot; for=&quot;archive-vehicle_lp&quot;>Vehicle Licenseplate</label>
<div class=&quot;kv-plugin-loading loading-archive-vehicle_lp&quot;>&nbsp;</div><select id=&quot;archive-vehicle_lp&quot; class=&quot;form-control&quot; name=&quot;Archive[vehicle_lp]&quot; data-s2-options=&quot;s2options_d6851687&quot; data-krajee-select2=&quot;select2_8df6b337&quot; style=&quot;display:none&quot;>
<option value=&quot;&quot;>Ingrese la placa del vehiculo...</option>
<option value=&quot;LSX213&quot;>LSX213 - FORD - 6000kgs</option>
<option value=&quot;LOS231&quot;>LOS231 - CHEVROLET - 5000kgs</option>
</select>
<div class=&quot;help-block&quot;></div>
</div>
&nbsp; &nbsp; <div align=&quot;right&quot;><a href=&quot;/vehicles/create&quot; target=&quot;_blank&quot;>Add vehicle</a>
&nbsp; &nbsp; &nbsp; </div>
&nbsp; <div class=&quot;row&quot;> <div class=&quot;panel panel-default&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-heading&quot;><h4><i class=&quot;glyphicon glyphicon-envelope&quot;></i>Facturas</h4></div>
&nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-body&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;dynamicform_wrapper&quot; data-dynamicform=&quot;dynamicform_5fb553de&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;container-items&quot;><!-- widgetContainer -->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;item panel panel-default&quot;><!-- widgetBody -->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-heading&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <h3 class=&quot;panel-title pull-left&quot;>Facturas</h3>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;pull-right&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;button&quot; class=&quot;add-item btn btn-success btn-xs&quot;><i class=&quot;glyphicon glyphicon-plus&quot;></i></button>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;button&quot; class=&quot;remove-item btn btn-danger btn-xs&quot;><i class=&quot;glyphicon glyphicon-minus&quot;></i></button>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;clearfix&quot;></div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;panel-body&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;row&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;form-group field-invoices-0-invoice_number required&quot;>
<label class=&quot;control-label&quot; for=&quot;invoices-0-invoice_number&quot;>Numero de factura:</label>
<input type=&quot;text&quot; id=&quot;invoices-0-invoice_number&quot; class=&quot;form-control&quot; name=&quot;Invoices[0][invoice_number]&quot; maxlength=&quot;100&quot;>
<div class=&quot;help-block&quot;></div>
</div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;form-group field-invoices-0-invoice_loadamount required&quot;>
<label class=&quot;control-label&quot; for=&quot;invoices-0-invoice_loadamount&quot;>Carga de la factura(kgs):</label>
<input type=&quot;text&quot; id=&quot;invoices-0-invoice_loadamount&quot; class=&quot;form-control&quot; name=&quot;Invoices[0][invoice_loadamount]&quot; maxlength=&quot;100&quot;>
<div class=&quot;help-block&quot;></div>
</div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;col-sm-6&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;form-group field-invoices-0-invoice_date required&quot;>
<label class=&quot;control-label&quot; for=&quot;invoices-0-invoice_date&quot;>Fecha de emision de la factura:</label>
<div class=&quot;input-group date&quot;><input type=&quot;text&quot; id=&quot;invoices-0-invoice_date&quot; class=&quot;form-control picker&quot; name=&quot;Invoices[0][invoice_date]&quot;><span class=&quot;input-group-addon&quot;><i class=&quot;glyphicon glyphicon-calendar&quot;></i></span></div>
<div class=&quot;help-block&quot;></div>
</div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div><!-- .row -->
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=&quot;row&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; </div>
&nbsp; &nbsp; </div>
</div>
&nbsp; &nbsp; <div class=&quot;form-group&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; <button type=&quot;submit&quot; class=&quot;btn btn-success&quot;>Create</button>&nbsp; &nbsp; </div>
&nbsp; &nbsp; </form>
</div>
</div>
&nbsp; &nbsp; </div>
</div>
<footer class=&quot;footer&quot;>
&nbsp; &nbsp; <div class=&quot;container&quot;>
&nbsp; &nbsp; &nbsp; &nbsp; <p class=&quot;pull-left&quot;>&copy; ANCA2016</p>
&nbsp; &nbsp; &nbsp; &nbsp; <p class=&quot;pull-right&quot;>Powered by <a href=&quot;http://www.yiiframework.com/&quot; rel=&quot;external&quot;>Yii Framework</a></p>
&nbsp; &nbsp; </div>
</footer>
<div id=&quot;yii-debug-toolbar&quot; data-url=&quot;/debug/default/toolbar?tag=572cad27b9a34&quot; style=&quot;display:none&quot; class=&quot;yii-debug-toolbar-bottom&quot;></div><script src=&quot;/assets/86454f8c/jquery.js&quot;></script>
<script src=&quot;/assets/7f9ec565/yii.js&quot;></script>
<script src=&quot;/assets/a4ad9a4f/js/select2.full.js&quot;></script>
<script src=&quot;/assets/a4ad9a4f/js/select2-krajee.js&quot;></script>
<script src=&quot;/assets/7f9ec565/yii.validation.js&quot;></script>
<script src=&quot;/assets/8512d577/js/bootstrap.js&quot;></script>
<script src=&quot;/assets/74a094c5/js/bootstrap-datepicker.js&quot;></script>
<script src=&quot;/assets/7f9ec565/yii.activeForm.js&quot;></script>
<script src=&quot;/assets/f998bed3/yii2-dynamic-form.js&quot;></script>
<script src=&quot;/assets/ac90f1d5/toolbar.js&quot;></script>
<script type=&quot;text/javascript&quot;>jQuery(document).ready(function () {
if (jQuery('#archive-driver_identitynum').data('select2')) { jQuery('#archive-driver_identitynum').select2('destroy'); }
jQuery.when(jQuery('#archive-driver_identitynum').select2(select2_398645a8)).done(initS2Loading('archive-driver_identitynum','s2options_d6851687'));
if (jQuery('#archive-vehicle_lp').data('select2')) { jQuery('#archive-vehicle_lp').select2('destroy'); }
jQuery.when(jQuery('#archive-vehicle_lp').select2(select2_8df6b337)).done(initS2Loading('archive-vehicle_lp','s2options_d6851687'));
;jQuery('#invoices-0-invoice_date').parent().datepicker({&quot;autoclose&quot;:true,&quot;format&quot;:&quot;dd-mm-yyyy&quot;});
jQuery(&quot;#dynamic-form&quot;).yiiDynamicForm(dynamicform_5fb553de);
jQuery(&quot;#dynamic-form&quot;).on(&quot;click&quot;, &quot;.add-item&quot;, function(e) {
&nbsp; &nbsp; e.preventDefault();
&nbsp; &nbsp; jQuery(&quot;.dynamicform_wrapper&quot;).triggerHandler(&quot;beforeInsert&quot;, [jQuery(this)]);
&nbsp; &nbsp; jQuery(&quot;.dynamicform_wrapper&quot;).yiiDynamicForm(&quot;addItem&quot;, dynamicform_5fb553de, e, jQuery(this));
});
jQuery(&quot;#dynamic-form&quot;).on(&quot;click&quot;, &quot;.remove-item&quot;, function(e) {
&nbsp; &nbsp; e.preventDefault();
&nbsp; &nbsp; jQuery(&quot;.dynamicform_wrapper&quot;).yiiDynamicForm(&quot;deleteItem&quot;, dynamicform_5fb553de, e, jQuery(this));
});
jQuery('#dynamic-form').yiiActiveForm([{&quot;id&quot;:&quot;archive-driver_identitynum&quot;,&quot;name&quot;:&quot;driver_identitynum&quot;,&quot;container&quot;:&quot;.field-archive-driver_identitynum&quot;,&quot;input&quot;:&quot;#archive-driver_identitynum&quot;,&quot;validate&quot;:function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {&quot;message&quot;:&quot;Driver ID cannot be blank.&quot;});yii.validation.string(value, messages, {&quot;message&quot;:&quot;Driver ID must be a string.&quot;,&quot;max&quot;:100,&quot;tooLong&quot;:&quot;Driver ID should contain at most 100 characters.&quot;,&quot;skipOnEmpty&quot;:1});}},{&quot;id&quot;:&quot;archive-vehicle_lp&quot;,&quot;name&quot;:&quot;vehicle_lp&quot;,&quot;container&quot;:&quot;.field-archive-vehicle_lp&quot;,&quot;input&quot;:&quot;#archive-vehicle_lp&quot;,&quot;validate&quot;:function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {&quot;message&quot;:&quot;Vehicle Licenseplate cannot be blank.&quot;});yii.validation.string(value, messages, {&quot;message&quot;:&quot;Vehicle Licenseplate must be a string.&quot;,&quot;max&quot;:100,&quot;tooLong&quot;:&quot;Vehicle Licenseplate should contain at most 100 characters.&quot;,&quot;skipOnEmpty&quot;:1});}},{&quot;id&quot;:&quot;invoices-0-invoice_number&quot;,&quot;name&quot;:&quot;[0]invoice_number&quot;,&quot;container&quot;:&quot;.field-invoices-0-invoice_number&quot;,&quot;input&quot;:&quot;#invoices-0-invoice_number&quot;,&quot;validate&quot;:function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {&quot;message&quot;:&quot;Numero de factura: cannot be blank.&quot;});yii.validation.string(value, messages, {&quot;message&quot;:&quot;Numero de factura: must be a string.&quot;,&quot;max&quot;:100,&quot;tooLong&quot;:&quot;Numero de factura: should contain at most 100 characters.&quot;,&quot;skipOnEmpty&quot;:1});}},{&quot;id&quot;:&quot;invoices-0-invoice_loadamount&quot;,&quot;name&quot;:&quot;[0]invoice_loadamount&quot;,&quot;container&quot;:&quot;.field-invoices-0-invoice_loadamount&quot;,&quot;input&quot;:&quot;#invoices-0-invoice_loadamount&quot;,&quot;validate&quot;:function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {&quot;message&quot;:&quot;Carga de la factura(kgs): cannot be blank.&quot;});yii.validation.string(value, messages, {&quot;message&quot;:&quot;Carga de la factura(kgs): must be a string.&quot;,&quot;max&quot;:100,&quot;tooLong&quot;:&quot;Carga de la factura(kgs): should contain at most 100 characters.&quot;,&quot;skipOnEmpty&quot;:1});}},{&quot;id&quot;:&quot;invoices-0-invoice_date&quot;,&quot;name&quot;:&quot;[0]invoice_date&quot;,&quot;container&quot;:&quot;.field-invoices-0-invoice_date&quot;,&quot;input&quot;:&quot;#invoices-0-invoice_date&quot;,&quot;enableAjaxValidation&quot;:true,&quot;validate&quot;:function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {&quot;message&quot;:&quot;Fecha de emision de la factura: cannot be blank.&quot;});yii.validation.string(value, messages, {&quot;message&quot;:&quot;Fecha de emision de la factura: must be a string.&quot;,&quot;max&quot;:100,&quot;tooLong&quot;:&quot;Fecha de emision de la factura: should contain at most 100 characters.&quot;,&quot;skipOnEmpty&quot;:1});}}], []);
});</script></body>
</html>


mmm.png

enoKw.png

I asked for help and this was someones reply, i’ve tried his suggestion but didn’t work, i guess i didn’t do it right.

Code:


As you can see from the HTML <input type=&quot;text&quot; id=&quot;invoices-0-invoice_loadamount&quot; class=&quot;form-control&quot; name=&quot;Invoices[0][invoice_loadamount]&quot; maxlength=&quot;100&quot;> the loadamount input field is like this. So on the controller side either create function or update function will receive post data as $_POST['Invoices'] as an array like
array(
&nbsp; &nbsp; &quot;0&quot;=>array(&quot;invoice_number&quot; => &quot;132412&quot;, &quot;invoice_loadamount&quot; =>&quot;34.00&quot;, &quot;invoice_date&quot; =>&quot;2015-03-04&quot;),
&nbsp; &nbsp; &quot;1&quot;=>array(&quot;invoice_number&quot; => &quot;352223&quot;, &quot;invoice_loadamount&quot; =>&quot;233.00&quot;, &quot;invoice_date&quot; =>&quot;2016-03-04&quot;),
&nbsp; &nbsp; ...
);where 0, 1 represents each form added. In your case form one, form two etc.
What you need to do is just loop through the array you get from the array. Like this:
if (Yii::$app->request->isPost) {
&nbsp; &nbsp; $data = Yii::$app->request->post();
&nbsp; &nbsp; $invoices = $data['Invoices'];
&nbsp; &nbsp; $total = 0;
&nbsp; &nbsp; if(sizeof($invoices) > 0){
&nbsp; &nbsp; &nbsp; &nbsp; foreach($invoices as $one_invoice){
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $one_loadamount =&nbsp; floatval($one_invoice['invoice_loadamount']);
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $total += $one_loadamount;
&nbsp; &nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; }
&nbsp; &nbsp; //then you get the total amount as $total
}for problem 2, you can then (assume that you already have the vehicle_id).
$vehicle = Vehicles::find()->where(['id'=>$vehicle_id])->one();
if($total > $vehicle->maxcap){
&nbsp; &nbsp; Yii::$app->getSession()->setFlash('danger', 'Total is larger than max cap');
}Since the second problem depends on a specific vehicles, you need to get its id first.


Attached Images
  • File Type: png enoKw.png (32.5 KB)
  • File Type: png mmm.png (15.5 KB)