add reception account transfer/mixed
This commit is contained in:
@@ -27,7 +27,8 @@ class AccountStateController extends Controller {
|
||||
'index',
|
||||
'open',
|
||||
'close',
|
||||
'view'
|
||||
'view' ,
|
||||
'mixed'
|
||||
],
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
@@ -301,4 +302,63 @@ class AccountStateController extends Controller {
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function actionMixed($id){
|
||||
$accountState = $this->findModel ( $id );
|
||||
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
|
||||
$details = null;
|
||||
|
||||
if ($accountState->isTypeClose ()) {
|
||||
|
||||
$prev;
|
||||
if ($accountState->type == AccountState::TYPE_CLOSE) {
|
||||
if (isset ( $accountState->prev_state )) {
|
||||
$prev = AccountState::findOne ( $accountState->prev_state );
|
||||
}
|
||||
if (isset ( $prev )) {
|
||||
$accountState->start_date = $prev->created_at;
|
||||
}
|
||||
}
|
||||
$details = new DailyListing ();
|
||||
$details->loadAccountState ( $accountState );
|
||||
|
||||
$details->readTotalEasy ();
|
||||
$details->readTotalDetailed ();
|
||||
$details->readTotalMedium ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($output == 'pdf') {
|
||||
$user = User::findOne(\Yii::$app->user->id);
|
||||
$mpdf=new \mPDF('utf-8', 'A4');
|
||||
$mpdf->useSubstitutions=false;
|
||||
$mpdf->simpleTables = true;
|
||||
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
|
||||
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||
|
||||
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
|
||||
$mpdf->WriteHTML($stylesheet,1);
|
||||
|
||||
$stylesheet = file_get_contents( \Yii::getAlias('@frontend'.'/web/css/account_close.css')); // external css
|
||||
$mpdf->WriteHTML($stylesheet,1);
|
||||
|
||||
|
||||
$mpdf->WriteHTML($this->renderPartial("@frontend/views/account-state/mixed_pdf", [
|
||||
'model' => $accountState,
|
||||
'details' => $details
|
||||
]));
|
||||
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
|
||||
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
|
||||
$fn= $type .$dt.".pdf";
|
||||
$mpdf->Output($fn, 'D');
|
||||
exit();
|
||||
|
||||
}
|
||||
return $this->render ( 'mixed', [
|
||||
'model' => $accountState,
|
||||
'details' => $details
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user