protected function setVariableValues() { parent::setVariableValues(); $this->setVariable('invoice', $this->payout->getInvoice()); $this->setVariable('affiliatenote', $this->payout->getAffiliateNote()); $this->setVariable('amount', $this->payout->getAmountAsText()); $this->setVariable('invoicenumber', $this->payout->getInvoiceNumber()); }
/** * * @service affiliate_invoice read * @param $fields */ public function previewInvoice(Gpf_Rpc_Params $params) { $form = new Gpf_Rpc_Form($params); $user = new Pap_Affiliates_User(); $applyVat = $form->getFieldValue('applyVat'); $payoutInvoice = $form->getFieldValue('payoutInvoice'); $user->setId($form->getFieldValue('userid')); try { $user->load(); } catch (Gpf_Exception $e) { $this->invoiceHtml = $this->_("You have to select user"); return $this; } $currency = Pap_Common_Utils_CurrencyUtils::getDefaultCurrency(); $payout = new Pap_Common_Payout($user, $currency, 1, 123456); $payout->setApplyVat($applyVat); $payout->generateInvoice($payoutInvoice); $this->invoiceHtml = $payout->getInvoice(); return $this; }
protected function setVariableValues() { parent::setVariableValues(); $this->setVariable('payment', $this->payout->getAmountAsText()); $this->setVariable('payoutcurrency', $this->payout->getCurrency()->getSymbol()); $this->setVariable('invoicenumber', $this->payout->getInvoiceNumber()); if ($this->payout->getPayoutOption() != null) { $this->setVariable('payoutmethod', Gpf_Lang::_localizeRuntime($this->payout->getPayoutOption()->getName(), $this->getRecipientLanguage())); } }
/** * @param Gpf_Data_Row $row */ private function addVATData(Gpf_Data_Row $row) { try { $user = new Pap_Common_User(); $user->setId($row->get('userid')); $user->load(); } catch (Gpf_Exception $e) { $row->add('vat', $this->_('N/A')); $row->add('amounttopay', $this->_('N/A')); return; } $currency = Pap_Common_Utils_CurrencyUtils::getDefaultCurrency(); $payout = new Pap_Common_Payout($user, $currency, $row->get(Pap_Db_Table_Transactions::COMMISSION), null); if (!$payout->getApplyVat()) { $row->add('vat', $this->_('N/A')); $row->add('amounttopay', $row->get(Pap_Db_Table_Transactions::COMMISSION)); return; } $row->add('vat', $payout->getVatPercentage() . ' %'); $row->add('amounttopay', $payout->getAmountWithVat()); }
private function markTransactionsAsPaid(Pap_Common_Payout $payout) { $update = new Gpf_SqlBuilder_UpdateBuilder(); $update->set->add(Pap_Db_Table_Transactions::PAYOUT_STATUS, Pap_Common_Transaction::PAYOUT_PAID); $update->set->add(Pap_Db_Table_Transactions::PAYOUTHISTORY_ID, $payout->getPayoutHistoryId()); $update->from->add(Pap_Db_Table_Transactions::getName()); $update->where->add(Pap_Db_Table_Transactions::USER_ID, "=", $payout->getUserId()); $update->where->add(Pap_Db_Table_Transactions::PAYOUTHISTORY_ID, '=', Pap_Common_Transaction::PAYMENT_PENDING_ID); $update->execute(); }