本文整理汇总了PHP中sbr_meta::getReservedSbr方法的典型用法代码示例。如果您正苦于以下问题:PHP sbr_meta::getReservedSbr方法的具体用法?PHP sbr_meta::getReservedSbr怎么用?PHP sbr_meta::getReservedSbr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sbr_meta
的用法示例。
在下文中一共展示了sbr_meta::getReservedSbr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseContent
/**
* Обрабатываем данные документа и изменяем их если нужно
*
*/
public function parseContent()
{
if ($this->opened) {
$this->_sharedIndex = $this->zip->locateName($this->_sharedStrings, ZIPARCHIVE::FL_NOCASE);
$this->_sheetIndex = $this->zip->locateName($this->_workSheet, ZIPARCHIVE::FL_NOCASE);
$this->_calcIndex = $this->zip->locateName($this->_calcChain, ZIPARCHIVE::FL_NOCASE);
// $this->_styleIndex = $this->zip->locateName($this->_styles, ZIPARCHIVE::FL_NOCASE);
$this->initDOMDocument('shared', $this->_sharedIndex);
$this->initDOMDocument('sheet', $this->_sheetIndex);
// $this->initDOMDocument('style', $this->_styleIndex);
$this->initDOMDocument('calc', null);
// По формулам создадим новый документ
$pskb = sbr_meta::getReservedSbr($this->period);
$count_rows = count($pskb);
$from_date = date('d.m.Y', strtotime($this->period[0]));
$to_date = date('d.m.Y', strtotime($this->period[1]));
$period = "за период с {$from_date} по {$to_date}";
$this->replaceSharedString(4, $period);
$this->moveFooter($count_rows);
foreach ($pskb as $i => $data) {
$this->setOneRowTable($i, $data);
}
$this->generateFormulaData();
$this->setContentFile($this->_sharedStrings, $this->dom['shared']->saveXML());
$this->setContentFile($this->_workSheet, $this->dom['sheet']->saveXML());
$this->setContentFile($this->_calcChain, $this->dom['calc']->saveXML());
// Все гуд закрываемся
$this->zip->close();
}
}
示例2: parseContent
/**
* Парсим данные документа и изменяем их если нужно.
*
* @param string $content Данные документа (обычно это content.xml из шаблона документа ODT)
*
* @return type
*/
public function parseContent($content)
{
$this->dom = new DOMDocument('1.0');
$this->dom->loadXML($content);
$this->xpath = new DOMXPath($this->dom);
$this->setStyleTable();
$period = $this->xpath->query('//text:p[@text:style-name= "period"]', $this->dom->documentElement)->item(0);
if ($period) {
$from_date = date('d.m.Y', strtotime($this->period[0]));
$to_date = date('d.m.Y', strtotime($this->period[1]));
$new_period = $this->dom->createElement('text:p', iconv('windows-1251', 'utf-8', "за период с {$from_date} по {$to_date}"));
$new_period->setAttribute('text:style-name', 'period');
$period->parentNode->replaceChild($new_period, $period);
}
$table = $this->xpath->query('//table:table[@table:name= "table_test"]', $this->dom->documentElement)->item(0);
$pskb = sbr_meta::getReservedSbr($this->period);
$i = 1;
$sum = 0;
if ($pskb) {
foreach ($pskb as $data) {
$table_row = $this->dom->createElement('table:table-row');
$name_emp = $this->_enc($data['nameCust']);
$sbr_id = $this->_enc("№ {$data['sbr_id']}, " . date('d.m.Y H:i', strtotime($data['covered'])));
$lc_id = $this->_enc("№ {$data['lc_id']}");
$cost = $this->_enc(number_format($data['cost'], 2, ',', ' '));
$table_row->appendChild($this->createTableCell($i));
// п/п
$table_row->appendChild($this->createTableCell($name_emp));
// Наименование Заказчика
$table_row->appendChild($this->createTableCell($sbr_id));
// Соглашение (№, дата)
$table_row->appendChild($this->createTableCell($lc_id));
// Идентификатор аккредитива
$table_row->appendChild($this->createTableCell($cost));
// Сумма резервирования
++$i;
$sum += $data['cost'];
$table->appendChild($table_row);
}
}
// Добавляем Итого
$table_row = $this->dom->createElement('table:table-row');
$table_row->appendChild($this->createTableCell($this->_enc('Итого за отчетный период:'), 4, 'p_1'));
$table_row->appendChild($this->dom->createElement('table:covered-table-cell'));
// Наименование Заказчика
$table_row->appendChild($this->dom->createElement('table:covered-table-cell'));
// Соглашение (№, дата)
$table_row->appendChild($this->dom->createElement('table:covered-table-cell'));
// Идентификатор аккредитива
$table_row->appendChild($this->createTableCell(number_format($sum, 2, ',', ' ')));
// Итого
$table->appendChild($table_row);
return $this->dom->saveXML();
}