public static function getDataWithWithVoucherID($voucher_id, $type = null) { $data = FiPaymentVoucherDetail::model()->findAllByAttributes(array('voucher_id' => $voucher_id)); $json = ''; if ($data && count($data) > 0) { foreach ($data as $itemDetail) { $attributes = $itemDetail->attributes; $json[] = json_encode($attributes); } if ($type == null) { if (count($json) > 0) { $json = implode(',', $json); } } } return $json; }
public function actionPrintvoucher($id) { $model = MyFormat::loadModelByClass($id, 'FiPaymentVoucher'); if ($model) { $dataTmp = FiPaymentVoucherDetail::getDataWithWithVoucherID($id, 'type'); } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } $this->render('payment_vouchers/print_voucher', array('actions' => $this->listActionsCanAccess, 'model' => $model, 'dataTmp' => $dataTmp)); }