예제 #1
0
use kartik\money\MaskMoney;
use kartik\widgets\Select2;
use kartik\widgets\SwitchInput;
use kartik\datetime\DateTimePicker;
use amilna\yes\models\Payment;
/* @var $this yii\web\View */
/* @var $model amilna\cap\models\Transaction */
/* @var $form yii\widgets\ActiveForm */
$this->title = 'Invoice ' . $model->reference;
//$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$data = json_decode($model->data);
$customer = $data->customer;
$shipping = isset($data->shipping) ? json_decode($data->shipping) : null;
$cart = isset($data->cart) && $data->cart != "null" ? json_decode($data->cart) : [];
$payment = isset($data->payment) ? Payment::findOne($data->payment) : false;
$module = Yii::$app->getModule('yes');
$company = '<strong>' . $module->company["name"] . '</strong><br>
		' . $module->company["address"] . '<br>
		' . Yii::t("app", "Phones") . ': ' . $module->company["phone"] . '<br/>
		' . Yii::t("app", "Email") . ': <a href="mailto:' . $model->toHex($module->company["email"]) . '">' . str_replace("@", " [AT] ", $module->company["email"]) . '</a>';
$subject = '<strong>' . Html::encode($customer->name) . '</strong><br>
		' . Html::encode($customer->address) . '<br>
		' . ($shipping != null ? Html::encode($shipping->city . ', ' . $shipping->area) . '<br>' : '') . '
		' . Yii::t("app", "Phones") . ': ' . Html::encode($customer->phones) . '<br/>
		' . (isset($customer->email) ? Yii::t("app", "Email") . ': <a href="mailto:' . $model->toHex($customer->email) . '">' . str_replace("@", " [AT] ", $customer->email) : "") . '</a>';
?>

<h1><small><?php 
echo Html::encode($this->title);
?>
 /**
  * Finds the Payment model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Payment the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Payment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }