|
|
@@ -167,47 +167,59 @@ class BillsController extends Controller
|
|
|
$model = $this->findModel($id);
|
|
|
|
|
|
$type = $model->type;
|
|
|
- $percent_g = 0.015;
|
|
|
- $percent_r = 0.0015;
|
|
|
- $amount_vat = $amount = $type == 'guarantee'
|
|
|
- ? $percent_g*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 )
|
|
|
- : $percent_r*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 );
|
|
|
- if (isset($model->auction->lot) ? $model->auction->lot->nds : 0) {
|
|
|
- $amount = $amount/1.2*1;
|
|
|
+ if($type == 'guarantee'){
|
|
|
+ $percent_g = 0.015;
|
|
|
+ $percent_r = 0.0015;
|
|
|
+ $amount_vat = $amount = $type == 'guarantee'
|
|
|
+ ? $percent_g*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 )
|
|
|
+ : $percent_r*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 );
|
|
|
+ if (isset($model->auction->lot) ? $model->auction->lot->nds : 0) {
|
|
|
+ $amount = $amount/1.2*1;
|
|
|
+ } else {
|
|
|
+ $amount_vat *= 1.2;
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'billid' => $model->id,
|
|
|
+ 'date' => date('m.d.Y'),
|
|
|
+ 'userfio' => (empty($model->profile->fio) ? $model->profile->member : $model->profile->fio),
|
|
|
+ 'summ' => $amount_vat,
|
|
|
+ 'letters' => Yii::$app->num2text->moneyFormatted($amount_vat),
|
|
|
+ 'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
|
|
|
+ 'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
|
|
|
+ 'nopdv' => ($amount_vat - ($amount_vat / 100 * 20)),
|
|
|
+ 'ypdv' => ($amount_vat / 100 * 20)
|
|
|
+
|
|
|
+ // 'auctionID' => $model->auction->id,
|
|
|
+ // 'date' => date('d-m-Y'),
|
|
|
+ // 'inn' => $model->profile->inn,
|
|
|
+ // 'zkpo' => $model->profile->zkpo,
|
|
|
+ // 'uAddress' => $model->profile->u_address,
|
|
|
+ // 'bank' => $model->requisite->bank,
|
|
|
+ // 'payAccount' => $model->requisite->account,
|
|
|
+ // 'phone' => $model->profile->phone,
|
|
|
+ // 'fax' => $model->profile->fax,
|
|
|
+ // 'firmaFull' => $model->profile->firma_full,
|
|
|
+ // 'billType' => $type == 'guarantee'? 'Гарантійний внесок': 'Регістраційний внесок',
|
|
|
+ // 'amountString' => num2str($amount_vat),
|
|
|
+ // 'amountVat' => $amount_vat,
|
|
|
+ // 'amount' => $amount,
|
|
|
+ // 'vat' => $model->auction->lot->nds ? 'з ПДВ' : 'без ПДВ',
|
|
|
+ ];
|
|
|
} else {
|
|
|
- $amount_vat *= 1.2;
|
|
|
+ $amount_vat = 100.00;
|
|
|
+ $data = [
|
|
|
+ 'billid' => $model->id,
|
|
|
+ 'date' => date('m.d.Y'),
|
|
|
+ 'userfio' => (empty($model->profile->fio) ? $model->profile->member : $model->profile->fio),
|
|
|
+ 'summ' => $amount_vat + 20,
|
|
|
+ 'letters' => Yii::$app->num2text->moneyFormatted($amount_vat+20),
|
|
|
+ 'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
|
|
|
+ 'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
|
|
|
+ 'nopdv' => $amount_vat,
|
|
|
+ 'ypdv' => ($amount_vat / 100 * 20)
|
|
|
+ ];
|
|
|
}
|
|
|
-
|
|
|
- $data = [
|
|
|
- 'billid' => $model->id,
|
|
|
- 'date' => date('m.d.Y'),
|
|
|
- 'userfio' => (empty($model->profile->fio) ? 'Не знайдено' : $model->profile->fio),
|
|
|
- 'summ' => $amount_vat,
|
|
|
- 'letters' => Yii::$app->num2text->moneyFormatted($amount_vat),
|
|
|
- 'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
|
|
|
- 'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
|
|
|
- 'nopdv' => ($amount_vat - ($amount_vat / 100 * 20)),
|
|
|
- 'ypdv' => ($amount_vat / 100 * 20)
|
|
|
-
|
|
|
- // 'auctionID' => $model->auction->id,
|
|
|
- // 'date' => date('d-m-Y'),
|
|
|
- // 'inn' => $model->profile->inn,
|
|
|
- // 'zkpo' => $model->profile->zkpo,
|
|
|
- // 'uAddress' => $model->profile->u_address,
|
|
|
- // 'bank' => $model->requisite->bank,
|
|
|
- // 'payAccount' => $model->requisite->account,
|
|
|
- // 'phone' => $model->profile->phone,
|
|
|
- // 'fax' => $model->profile->fax,
|
|
|
- // 'firmaFull' => $model->profile->firma_full,
|
|
|
- // 'billType' => $type == 'guarantee'? 'Гарантійний внесок': 'Регістраційний внесок',
|
|
|
- // 'amountString' => num2str($amount_vat),
|
|
|
- // 'amountVat' => $amount_vat,
|
|
|
- // 'amount' => $amount,
|
|
|
- // 'vat' => $model->auction->lot->nds ? 'з ПДВ' : 'без ПДВ',
|
|
|
- ];
|
|
|
-
|
|
|
- // print_r($data);
|
|
|
- // exit;
|
|
|
|
|
|
$filename = templater()->process(
|
|
|
$data,
|