public function init() { $uid = get_uid(false); $reqvs = sbr_meta::getUserReqvs($uid); $form_type = @$reqvs['form_type']; $rez_type = @$reqvs['rez_type']; if ($form_type) { $reqvs = $reqvs[$form_type]; if ($rez_type == sbr::RT_RU) { $reqvs_data = array(array('label' => 'ИНН', 'value' => @$reqvs['inn']), array('label' => 'КПП', 'value' => @$reqvs['kpp'], 'padbot' => 10), array('label' => 'Расчетный счет', 'value' => @$reqvs['bank_rs']), array('label' => 'Банк', 'value' => @$reqvs['bank_name']), array('label' => 'Корр.счет', 'value' => @$reqvs['bank_ks']), array('label' => 'БИК банка', 'value' => @$reqvs['bank_bik']), array('label' => 'ИНН банка', 'value' => @$reqvs['bank_inn'])); } else { $reqvs_data = array(array('label' => 'Расчетный счет', 'value' => @$reqvs['bank_rs']), array('label' => 'Банк', 'value' => @$reqvs['bank_name']), array('label' => 'Уполномоченный Банк', 'value' => @$reqvs['bank_rf_name']), array('label' => 'Корр.счет вашего банка в уполномоченном банке', 'value' => @$reqvs['bank_rf_ks']), array('label' => 'БИК уполномоченного банка', 'value' => @$reqvs['bank_rf_bik']), array('label' => 'ИНН уполномоченного банка', 'value' => @$reqvs['bank_rf_inn'])); } } else { $this->stopRender(); return; } $options = array('popup_title' => 'Формирование счета', 'payments' => array(self::PAYMENT_TYPE_BANK => array('title' => 'Сформировать счет', 'class' => '', 'wait' => 'Идет создание счета')), 'reqvs' => $reqvs_data, 'rt_ru' => $rez_type == sbr::RT_RU); require_once 'forms/BillInvoiceForm.php'; $form = new BillInvoiceForm(); $this->setContent($form->render()); /* $this->addWaitMessageForAll( //только индикатор ); */ parent::init($options); }
/** * Выставяем счет оплаты по безналу * * @param string $type - тип платежа (тут всегда bank) * @param array $data * @return \xajaxResponse */ function quickPaymentBillinvoiceBank($type, $data) { $objResponse =& new xajaxResponse(); $uid = get_uid(false); if ($uid <= 0) { return $objResponse; } $form = new BillInvoiceForm(); if (!$form->isValid($data)) { $params = addslashes(urldecode(http_build_query($form->getAllMessages('<br/>')))); $objResponse->script("\n var qp = window.quick_ext_payment_factory.getQuickPayment('billinvoice');\n if(qp) qp.showElementsError('{$params}');\n "); return $objResponse; } $sum = $form->getValue('sum'); try { $doc = new DocGenBill(); $file = $doc->generateBankInvoice($uid, @$_SESSION['login'], $sum); } catch (Exception $e) { $objResponse->script("\n var qp = quick_ext_payment_factory.getQuickPayment('billinvoice');\n if(qp) qp.show_error('{$e->getMessage()} Попробуйте еще раз.');\n "); return $objResponse; } $link = WDCPREFIX . '/' . $file->path . $file->name; $objResponse->script(" \n \n var template = \$('bill_invoice_template').get('html');\n if(template) {\n template = template.replace('{link}','{$link}');\n template = template.replace('{name}','{$file->original_name}'); \n template = template.replace('{num}','{$doc->getField('id')}'); \n \$('bill_invoice_create').addClass('b-layout_hide'); \n \$('bill_invoice_remove').set('html', template).removeClass('b-layout_hide'); \n }\n \n var qp = quick_ext_payment_factory.getQuickPayment('billinvoice');\n if(qp) qp.close_popup();\n "); return $objResponse; }