本文整理汇总了PHP中format_bankaccount函数的典型用法代码示例。如果您正苦于以下问题:PHP format_bankaccount函数的具体用法?PHP format_bankaccount怎么用?PHP format_bankaccount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_bankaccount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main_form
protected function main_form($x, $y)
{
$balance = $this->data['balance'] < 0 ? -$this->data['balance'] : $this->data['balance'];
$font_size = 14;
$lineh = 25;
$x += ConfigHelper::getConfig('finances.leftmargin', 0, true);
$y += ConfigHelper::getConfig('finances.bottommargin', 0, true);
$y += 275;
$this->backend->addText($x, $y, $font_size, $this->data['d_name']);
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, trim($this->data['d_zip'] . ' ' . $this->data['d_city'] . ' ' . $this->data['d_address']));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, format_bankaccount(bankaccount($this->data['id'], $this->data['account'])));
$y -= $lineh;
$this->backend->addText($x + 220, $y, $font_size, sprintf('%.2f', $balance));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, trans('$a dollars $b cents', to_words(floor($balance)), to_words(round(($balance - floor($balance)) * 100))));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, $this->truncate($this->data['customername']));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, $this->truncate(trim($this->data['zip'] . ' ' . $this->data['city'] . ' ' . $this->data['address'])));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, ConfigHelper::getConfig('finances.pay_title', trans('Not set')));
$y -= $lineh;
$this->backend->addText($x, $y, $font_size, trans('Customer ID: $a', sprintf('%04d', $this->data['id'])));
}
示例2: note_recipient
public function note_recipient()
{
$oldy = $this->backend->GetY();
$recipient = '<b>' . trans('Note recipient:') . '</b><br>';
$recipient .= $this->data['name'] . '<br>';
$recipient .= $this->data['address'] . '<br>';
$recipient .= $this->data['zip'] . ' ' . $this->data['city'] . '<br>';
if ($this->data['ten']) {
$recipient .= trans('TEN') . ': ' . $this->data['ten'] . '<br>';
} elseif ($this->data['ssn']) {
$recipient .= trans('SSN') . ': ' . $this->data['ssn'] . '<br>';
}
$this->backend->SetFont('arial', '', 10);
$this->backend->writeHTMLCell(80, '', 125, 50, $recipient, 0, 1, 0, true, 'L');
$y = $this->backend->GetY();
if (ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.customer_bankaccount', true))) {
$bankaccount = trans('Bank account:') . ' <b>' . format_bankaccount(bankaccount($this->data['customerid'], $this->data['account'])) . '</b>';
$this->backend->SetFont('arial', 'B', 8);
$this->backend->writeHTMLCell('', '', 125, $oldy + round(($y - $oldy - 8) / 2), $bankaccount, 0, 1, 0, true, 'L');
}
if (ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.customer_credentials', true))) {
$pin = '<b>' . trans('Customer ID: $a', sprintf('%04d', $this->data['customerid'])) . '</b><br>';
$pin .= '<b>PIN: ' . sprintf('%04d', $this->data['customerpin']) . '</b><br>';
$this->backend->SetFont('arial', 'B', 8);
$this->backend->writeHTMLCell('', '', 125, $oldy + round(($y - $oldy) / 2), $pin, 0, 1, 0, true, 'L');
}
$this->backend->SetY($y);
}
示例3: invoice_main_form_fill
function invoice_main_form_fill($x, $y, $scale)
{
global $pdf, $invoice;
$pdf->setlinestyle(1);
$pdf->line(7 * $scale + $x, 724 * $scale + $y, 7 * $scale + $x, 694 * $scale + $y);
$pdf->line(7 * $scale + $x, 724 * $scale + $y, 37 * $scale + $x, 724 * $scale + $y);
$pdf->line(970 * $scale + $x, 724 * $scale + $y, 970 * $scale + $x, 694 * $scale + $y);
$pdf->line(970 * $scale + $x, 724 * $scale + $y, 940 * $scale + $x, 724 * $scale + $y);
$pdf->line(7 * $scale + $x, 172 * $scale + $y, 7 * $scale + $x, 202 * $scale + $y);
$pdf->line(7 * $scale + $x, 172 * $scale + $y, 37 * $scale + $x, 172 * $scale + $y);
$name = $invoice['division_name'];
$address = $invoice['division_address'];
$zip = $invoice['division_zip'];
$city = $invoice['division_city'];
$account = bankaccount($invoice['customerid'], $invoice['account']);
text_autosize(15 * $scale + $x, 680 * $scale + $y, 30 * $scale, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $name), 950 * $scale);
text_autosize(15 * $scale + $x, 617 * $scale + $y, 30 * $scale, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $address . " " . $zip . " " . $city), 950 * $scale);
text_autosize(15 * $scale + $x, 555 * $scale + $y, 30 * $scale, format_bankaccount($account), 950 * $scale);
$pdf->addtext(330 * $scale + $x, 495 * $scale + $y, 30 * $scale, 'X');
text_autosize(550 * $scale + $x, 495 * $scale + $y, 30 * $scale, "*" . number_format($invoice['total'], 2, ',', '') . "*", 400 * $scale);
text_autosize(15 * $scale + $x, 434 * $scale + $y, 30 * $scale, iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('$a dollars $b cents', to_words(floor($invoice['total'])), to_words(round(($invoice['total'] - floor($invoice['total'])) * 100)))), 950 * $scale);
text_autosize(15 * $scale + $x, 372 * $scale + $y, 30 * $scale, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $invoice['name']), 950 * $scale);
text_autosize(15 * $scale + $x, 312 * $scale + $y, 30 * $scale, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $invoice['address'] . " " . $invoice['zip'] . " " . $invoice['city']), 950 * $scale);
$tmp = docnumber($invoice['number'], $invoice['template'], $invoice['cdate']);
text_autosize(15 * $scale + $x, 250 * $scale + $y, 30 * $scale, iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Payment for invoice No. $a', $tmp)), 950 * $scale);
}
示例4: main_fill
protected function main_fill($x, $y, $scale)
{
if (ConfigHelper::checkConfig('finances.control_lines')) {
$this->backend->line(7 * $scale + $x, 115 * $scale + $y, 7 * $scale + $x, 145 * $scale + $y);
$this->backend->line(7 * $scale + $x, 115 * $scale + $y, 37 * $scale + $x, 115 * $scale + $y);
$this->backend->line(978 * $scale + $x, 115 * $scale + $y, 978 * $scale + $x, 145 * $scale + $y);
$this->backend->line(978 * $scale + $x, 115 * $scale + $y, 948 * $scale + $x, 115 * $scale + $y);
$this->backend->line(7 * $scale + $x, 726 * $scale + $y, 7 * $scale + $x, 696 * $scale + $y);
$this->backend->line(7 * $scale + $x, 726 * $scale + $y, 37 * $scale + $x, 726 * $scale + $y);
$this->backend->line(978 * $scale + $x, 726 * $scale + $y, 978 * $scale + $x, 696 * $scale + $y);
$this->backend->line(978 * $scale + $x, 726 * $scale + $y, 948 * $scale + $x, 726 * $scale + $y);
}
$this->backend->addtext(15 * $scale + $x, 680 * $scale + $y, 30 * $scale, $this->data['d_name']);
$this->backend->addtext(15 * $scale + $x, 617 * $scale + $y, 30 * $scale, $this->data['d_address'] . ' ' . $this->data['d_zip'] . ' ' . $this->data['d_city']);
$this->backend->addtext(15 * $scale + $x, 555 * $scale + $y, 30 * $scale, format_bankaccount(bankaccount($this->data['id'], $this->data['account'])));
$this->backend->addtext(550 * $scale + $x, 497 * $scale + $y, 30 * $scale, number_format($this->data['total'], 2, ',', ''));
$this->backend->addtext(15 * $scale + $x, 375 * $scale + $y, 30 * $scale, $this->data['customername']);
$this->backend->addtext(15 * $scale + $x, 315 * $scale + $y, 30 * $scale, $this->data['address'] . '; ' . $this->data['zip'] . ' ' . $this->data['city']);
$this->backend->addtext(15 * $scale + $x, 250 * $scale + $y, 30 * $scale, trans('Payment for invoice No. $a', $this->data['t_number']));
}
示例5: format_customer_account
function format_customer_account($contact)
{
return format_bankaccount($contact['contact']);
}
示例6: lms_current_user
WHERE e.userid = lms_current_user() AND a.customerid = d.customerid)' . ' ORDER BY CEIL(d.cdate/86400), d.id', array($_GET['from'], $_GET['to'], DOC_DNOTE));
if (!$ids) {
$SESSION->close();
die;
}
$count = sizeof($ids);
$i = 0;
foreach ($ids as $idx => $noteid) {
$note = $LMS->GetNoteContent($noteid);
if ($count == 1) {
$docnumber = docnumber($note['number'], $note['template'], $note['cdate']);
}
$note['division_header'] = str_replace('%bankaccount', format_bankaccount(bankaccount($note['customerid'], $note['account'])), $note['division_header']);
$document->Draw($note);
}
} elseif ($note = $LMS->GetNoteContent($_GET['id'])) {
$docnumber = $number = docnumber($note['number'], $note['template'], $note['cdate']);
$layout['pagetitle'] = trans('Debit Note No. $a', $number);
$note['last'] = TRUE;
$note['division_header'] = str_replace('%bankaccount', format_bankaccount(bankaccount($note['customerid'], $note['account'])), $note['division_header']);
$document->Draw($note);
} else {
$SESSION->redirect('?m=notelist');
}
if (!is_null($attachment_name) && isset($docnumber)) {
$attachment_name = str_replace('%number', $docnumber, $attachment_name);
$attachment_name = preg_replace('/[^[:alnum:]_\\.]/i', '_', $attachment_name);
} else {
$attachment_name = 'invoices.' . ($note_type == 'pdf' ? 'pdf' : 'html');
}
$document->WriteToBrowser($attachment_name);
示例7: invoice_footnote
protected function invoice_footnote($x, $y, $width, $font_size)
{
if (!empty($this->data['division_footer'])) {
$y = $y - $this->backend->getFontHeight($font_size);
//$y = $y - $this->backend->text_align_left($x, $y, $font_size, '<b>' . trans('Notes:') . '</b>');
$tmp = $this->data['division_footer'];
$accounts = array(bankaccount($this->data['customerid'], $this->data['account']));
if (ConfigHelper::checkConfig('invoices.show_all_accounts')) {
$accounts = array_merge($accounts, $this->data['bankaccounts']);
}
foreach ($accounts as &$account) {
$account = format_bankaccount($account);
}
$tmp = str_replace('%bankaccount', implode("\n", $accounts), $tmp);
$tmp = preg_split('/\\r?\\n/', $tmp);
foreach ($tmp as $line) {
$y = $this->backend->text_wrap($x, $y, $width, $font_size, $line, "full");
}
}
}
示例8: invoice_footnote
protected function invoice_footnote()
{
if (!empty($this->data['division_footer'])) {
$this->backend->Ln(7);
//$this->backend->SetFont('arial', 'B', 10);
//$this->backend->Write(0, trans('Notes:'), '', 0, 'L', true, 0, false, false, 0);
$tmp = $this->data['division_footer'];
$accounts = array(bankaccount($this->data['customerid'], $this->data['account']));
if (ConfigHelper::checkConfig('invoices.show_all_accounts')) {
$accounts = array_merge($accounts, $this->data['bankaccounts']);
}
foreach ($accounts as &$account) {
$account = format_bankaccount($account);
}
$tmp = str_replace('%bankaccount', implode("\n", $accounts), $tmp);
$this->backend->SetFont('arial', '', 8);
$h = $this->backend->getStringHeight(0, $tmp);
$tmp = mb_ereg_replace('\\r?\\n', '<br>', $tmp);
$this->backend->writeHTMLCell(0, 0, '', 188 - $h, $tmp, 0, 1, 0, true, 'C');
}
}
示例9: BodyVars
function BodyVars(&$body, $data)
{
global $LMS, $LANGDEFS;
$body = str_replace('%customer', $data['customername'], $body);
$body = str_replace('%balance', $data['balance'], $body);
$body = str_replace('%cid', $data['id'], $body);
$body = str_replace('%pin', $data['pin'], $body);
if (strpos($body, '%bankaccount') !== false) {
$body = str_replace('%bankaccount', format_bankaccount(bankaccount($data['id'])), $body);
}
if (!(strpos($body, '%last_10_in_a_table') === FALSE)) {
$last10 = '';
if ($last10_array = $LMS->DB->GetAll('SELECT comment, time, value
FROM cash WHERE customerid = ?
ORDER BY time DESC LIMIT 10', array($data['id']))) {
foreach ($last10_array as $r) {
$last10 .= date("Y/m/d | ", $r['time']);
$last10 .= sprintf("%20s | ", sprintf($LANGDEFS[$LMS->ui_lang]['money_format'], $r['value']));
$last10 .= $r['comment'] . "\n";
}
}
$body = str_replace('%last_10_in_a_table', $last10, $body);
}
}
示例10: foreach
if ($customerinfo['messengers']) {
foreach ($customerinfo['messengers'] as $idx => $val) {
$customerinfo['uid'][$idx] = $val['uid'];
}
}
if (empty($customerinfo['contacts'])) {
$customerinfo['contacts'][] = array();
}
if (empty($customerinfo['emails'])) {
$customerinfo['emails'][] = array();
}
if (empty($customerinfo['accounts'])) {
$customerinfo['accounts'][] = array();
} else {
foreach ($customerinfo['accounts'] as &$account) {
$account['account'] = format_bankaccount($account['account']);
}
}
}
$layout['pagetitle'] = trans('Customer Edit: $a', $customerinfo['customername']);
$SESSION->save('backto', $_SERVER['QUERY_STRING']);
$customerid = $customerinfo['id'];
include MODULES_DIR . '/customer.inc.php';
}
$LMS->InitXajax();
$hook_data = $LMS->executeHook('customeredit_before_display', array('customerinfo' => $customerinfo, 'smarty' => $SMARTY));
$customerinfo = $hook_data['customerinfo'];
$SMARTY->assign('xajax', $LMS->RunXajax());
$SMARTY->assign('customerinfo', $customerinfo);
$SMARTY->assign('cstateslist', $LMS->GetCountryStates());
$SMARTY->assign('countrieslist', $LMS->GetCountries());
示例11: GetInvoiceContent
function GetInvoiceContent($invoiceid)
{
global $PAYTYPES;
$result = $this->DB->GetRow('SELECT d.id, d.number, d.name, d.customerid, d.type,
d.userid, d.address, d.zip, d.city, d.countryid, cn.name AS country,
d.ten, d.ssn, d.cdate, d.sdate, d.paytime, d.paytype, d.numberplanid,
d.closed, d.reference, d.reason, d.divisionid,
(SELECT name FROM users WHERE id = d.userid) AS user, n.template,
d.div_name AS division_name, d.div_name AS division_shortname, d.div_shortname AS division_shortnames,
d.div_address AS division_address, d.div_zip AS division_zip,
d.div_city AS division_city, d.div_countryid AS division_countryid,
d.div_ten AS division_ten, d.div_regon AS division_regon, d.div_account AS account,
d.div_inv_header AS division_header, d.div_inv_footer AS division_footer,
d.div_inv_author AS division_author, d.div_inv_cplace AS division_cplace,
d.fullnumber AS fullnumber,d.version, d.templatetype, d.templatefile, d.sdateview, d.urllogofile, d.print_balance_info,
c.pin AS customerpin, c.divisionid AS current_divisionid,
d.post_name, d.post_address, d.post_zip, d.post_city,
c.invoice_name, c.invoice_address, c.invoice_zip, c.invoice_city, c.invoice_countryid, c.invoice_ten
FROM documents d
JOIN customers c ON (c.id = d.customerid)
LEFT JOIN countries cn ON (cn.id = d.countryid)
LEFT JOIN numberplans n ON (d.numberplanid = n.id)
WHERE d.id = ? AND (d.type = ? OR d.type = ? OR d.type = ?)', array($invoiceid, DOC_INVOICE, DOC_CNOTE, DOC_INVOICE_PRO));
if ($result) {
$result['pdiscount'] = 0;
$result['vdiscount'] = 0;
$result['totalbase'] = 0;
$result['totaltax'] = 0;
$result['total'] = 0;
if ($result['version'] != '2' && ($firma = $this->DB->getrow('SELECT shortname,name,address,city,zip,ten,account,inv_header,inv_footer,inv_author,inv_cplace
FROM divisions WHERE id = ? LIMIT 1;', array($result['divisionid'])))) {
if (empty($result['division_name'])) {
$result['division_name'] = $firma['name'];
}
if (empty($result['division_shortname'])) {
$result['division_shortname'] = $firma['name'];
}
if (empty($result['division_address'])) {
$result['division_address'] = $firma['address'];
}
if (empty($result['division_zip'])) {
$result['division_zip'] = $firma['zip'];
}
if (empty($result['division_city'])) {
$result['division_city'] = $firma['city'];
}
if (empty($result['division_ten'])) {
$result['division_ten'] = $firma['ten'];
}
if (empty($result['account'])) {
$result['account'] = $firma['account'];
}
if (empty($result['division_header'])) {
$result['division_header'] = $firma['inv_header'];
}
if (empty($result['division_footer'])) {
$result['division_footer'] = $firma['inv_footer'];
}
if (empty($result['division_author'])) {
$result['division_author'] = $firma['inv_author'];
}
if (empty($result['division_cplace'])) {
$result['division_cplace'] = $firma['inv_cplace'];
}
}
if ($result['reference'] && $result['type'] != DOC_INVOICE_PRO) {
$result['invoice'] = $this->GetInvoiceContent($result['reference']);
}
if (!$result['division_header']) {
$result['division_header'] = $result['division_name'] . "\n" . $result['division_address'] . "\n" . $result['division_zip'] . ' ' . $result['division_city'] . ($result['division_countryid'] && $result['countryid'] && $result['division_countryid'] != $result['countryid'] ? "\n" . trans($this->GetCountryName($result['division_countryid'])) : '') . ($result['division_ten'] != '' ? "\n" . trans('TEN') . ' ' . $result['division_ten'] : '') . ($result['account'] != '' ? "\n" . "Nr konta: " . format_bankaccount(bankaccount($result['customerid'], $result['account'])) : '');
}
if ($result['content'] = $this->DB->GetAll('SELECT invoicecontents.value AS value,
itemid, taxid, taxes.value AS taxvalue, taxes.label AS taxlabel,
prodid, content, count, invoicecontents.description AS description,
tariffid, itemid, pdiscount, vdiscount
FROM invoicecontents
LEFT JOIN taxes ON taxid = taxes.id
WHERE docid=?
ORDER BY itemid', array($invoiceid))) {
foreach ($result['content'] as $idx => $row) {
if (isset($result['invoice'])) {
$row['value'] += $result['invoice']['content'][$idx]['value'];
$row['count'] += $result['invoice']['content'][$idx]['count'];
}
$result['content'][$idx]['basevalue'] = round($row['value'] / (100 + $row['taxvalue']) * 100, 2);
$result['content'][$idx]['total'] = round($row['value'] * $row['count'], 2);
$result['content'][$idx]['totalbase'] = round($result['content'][$idx]['total'] / (100 + $row['taxvalue']) * 100, 2);
$result['content'][$idx]['totaltax'] = round($result['content'][$idx]['total'] - $result['content'][$idx]['totalbase'], 2);
$result['content'][$idx]['value'] = $row['value'];
$result['content'][$idx]['count'] = $row['count'];
if (isset($result['taxest'][$row['taxvalue']])) {
$result['taxest'][$row['taxvalue']]['base'] += $result['content'][$idx]['totalbase'];
$result['taxest'][$row['taxvalue']]['total'] += $result['content'][$idx]['total'];
$result['taxest'][$row['taxvalue']]['tax'] += $result['content'][$idx]['totaltax'];
} else {
$result['taxest'][$row['taxvalue']]['base'] = $result['content'][$idx]['totalbase'];
$result['taxest'][$row['taxvalue']]['total'] = $result['content'][$idx]['total'];
$result['taxest'][$row['taxvalue']]['tax'] = $result['content'][$idx]['totaltax'];
$result['taxest'][$row['taxvalue']]['taxlabel'] = $row['taxlabel'];
}
//.........这里部分代码省略.........
示例12: parse_data
function parse_data($id, $tresc, $customer)
{
global $LMS, $LANGDEFS;
$tresc = preg_replace("/\\%dzis/", date("d/m/Y"), $tresc);
$tresc = preg_replace("/\\%balance/", sprintf("%6.2f", $customer['balance']), $tresc);
$tresc = preg_replace("/\\%bankaccount/", format_bankaccount($customer['bankaccount']), $tresc);
if (!(strpos($tresc, '%last_10_in_a_table') === FALSE)) {
$last10 = '';
if ($last10_array = $LMS->DB->GetAll('SELECT comment, time, value
FROM cash WHERE customerid = ?
ORDER BY time DESC LIMIT 10', array($customer['id']))) {
foreach ($last10_array as $r) {
$last10 .= date("Y/m/d | ", $r['time']);
$last10 .= sprintf("%20s | ", sprintf($LANGDEFS[$LMS->ui_lang]['money_format'], $r['value']));
$last10 .= $r['comment'] . "\n";
}
}
$tresc = str_replace('%last_10_in_a_table', $last10, $tresc);
}
return $tresc;
}
示例13: strftime
} else {
$customerinfo = $LMS->GetCustomer($_GET['id']);
$customerinfo['cutoffstopindefinitely'] = 0;
if ($customerinfo['cutoffstop']) {
if ($customerinfo['cutoffstop'] == intval(pow(2, 31) - 1)) {
$customerinfo['cutoffstop'] = 0;
$customerinfo['cutoffstopindefinitely'] = 1;
} else {
$customerinfo['cutoffstop'] = strftime('%Y/%m/%d', $customerinfo['cutoffstop']);
}
} else {
$customerinfo['cutoffstop'] = 0;
}
if (!empty($customerinfo['accounts'])) {
foreach ($customerinfo['accounts'] as &$account) {
$account['contact'] = format_bankaccount($account['contact']);
}
}
}
$layout['pagetitle'] = trans('Customer Edit: $a', $customerinfo['customername']);
$SESSION->save('backto', $_SERVER['QUERY_STRING']);
$customerid = $customerinfo['id'];
include MODULES_DIR . '/customer.inc.php';
}
$LMS->InitXajax();
$hook_data = $LMS->executeHook('customeredit_before_display', array('customerinfo' => $customerinfo, 'smarty' => $SMARTY));
$customerinfo = $hook_data['customerinfo'];
$SMARTY->assign('xajax', $LMS->RunXajax());
$SMARTY->assign('customerinfo', $customerinfo);
$SMARTY->assign('cstateslist', $LMS->GetCountryStates());
$SMARTY->assign('countrieslist', $LMS->GetCountries());
示例14: invoice_footnote_v2
function invoice_footnote_v2() {
global $pdf, $invoice;
if (!empty($invoice['division_footer'])) {
$pdf->Ln(5);
$tmp = $invoice['division_footer'];
$account = format_bankaccount(bankaccount($invoice['customerid'], $invoice['account']));
$tmp = str_replace('%bankaccount', $account, $tmp);
$pdf->SetFont('arial', '', 7);
$h = $pdf->getStringHeight(0, $tmp);
$tmp = mb_ereg_replace('\r?\n', '<br>', $tmp);
if ($invoice['templatefile']=='standard')
$pdf->writeHTMLCell(0, 0, '', '', $tmp, 0, 1, 0, true, 'C');
else
$pdf->writeHTMLCell(0, 0, '', 188 - $h, $tmp, 0, 1, 0, true, 'C');
}
}
示例15: parse_customer_data
function parse_customer_data($data, $row)
{
global $DB;
$amount = -$row['balance'];
$data = preg_replace("/\\%bankaccount/", format_bankaccount(bankaccount($row['id'], $row['account'])), $data);
$data = preg_replace("/\\%b/", $amount, $data);
$data = preg_replace("/\\%date-y/", strftime("%Y"), $data);
$data = preg_replace("/\\%date-m/", strftime("%m"), $data);
$data = preg_replace("/\\%date_month_name/", strftime("%B"), $data);
$deadline = $row['cdate'] + $row['paytime'] * 86400;
$data = preg_replace("/\\%deadline-y/", strftime("%Y", $deadline), $data);
$data = preg_replace("/\\%deadline-m/", strftime("%m", $deadline), $data);
$data = preg_replace("/\\%deadline-d/", strftime("%d", $deadline), $data);
$data = preg_replace("/\\%B/", $row['balance'], $data);
$data = preg_replace("/\\%saldo/", moneyf($row['balance']), $data);
$data = preg_replace("/\\%pin/", $row['pin'], $data);
$data = preg_replace("/\\%cid/", $row['id'], $data);
if (preg_match("/\\%abonament/", $data)) {
$saldo = $DB->GetOne("SELECT SUM(value)\n\t\t\tFROM assignments, tariffs\n\t\t\tWHERE tariffid = tariffs.id AND customerid = ?\n\t\t\t\tAND (datefrom <= {$currtime} OR datefrom = 0)\n\t\t\t\tAND (dateto > {$currtime} OR dateto = 0)\n\t\t\t\tAND ((datefrom < dateto) OR (datefrom = 0 AND datefrom = 0))", array($row['id']));
$data = preg_replace("/\\%abonament/", $saldo, $data);
}
// invoices, debit notes
$data = preg_replace("/\\%invoice/", $row['doc_number'], $data);
$data = preg_replace("/\\%number/", $row['doc_number'], $data);
$data = preg_replace("/\\%value/", $row['value'], $data);
$data = preg_replace("/\\%cdate-y/", strftime("%Y", $row['cdate']), $data);
$data = preg_replace("/\\%cdate-m/", strftime("%m", $row['cdate']), $data);
$data = preg_replace("/\\%cdate-d/", strftime("%d", $row['cdate']), $data);
list($now_y, $now_m) = explode('/', strftime("%Y/%m", time()));
$data = preg_replace("/\\%lastday/", strftime("%d", mktime(12, 0, 0, $now_m + 1, 0, $now_y)), $data);
return $data;
}