本文整理汇总了PHP中invoice::collect方法的典型用法代码示例。如果您正苦于以下问题:PHP invoice::collect方法的具体用法?PHP invoice::collect怎么用?PHP invoice::collect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invoice
的用法示例。
在下文中一共展示了invoice::collect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cacheInvoiceFees
/**
* Calculates invoice fees and stores it in panel_users,
* according to details in billing_service_categories.
*
* @param int The mode
* @param int Userid to begin with Subject, eg tablename.
* @param int Number of Users we should handle in this run
* @param int Single userid we should focus on.
* @return array Results like current invoice fees etc.
*
* @author Former03 GmbH :: Florian Lippert <flo@syscp.org>
*/
function cacheInvoiceFees($mode = 0, $begin = null, $count = null, $userid = null)
{
global $db;
$returnval = array();
$service_categories_result = $db->query('SELECT * FROM `' . getModeDetails($mode, 'TABLE_BILLING_SERVICE_CATEGORIES', 'table') . '` ORDER BY `id` ASC');
while ($service_categories_row = $db->fetch_array($service_categories_result)) {
$service_categories[$service_categories_row['category_name']] = $service_categories_row;
if ($service_categories_row['category_cachefield'] != '') {
$zeroUpdates[$service_categories_row['category_cachefield']] = 0;
}
}
if ($userid !== null && intval($userid) !== 0) {
$userSelection = " WHERE `" . getModeDetails($mode, 'TABLE_PANEL_USERS', 'key') . "` = '" . $userid . "' ";
} else {
$userSelection = '';
}
if ($begin !== null && intval($count) !== 0) {
$limit = ' LIMIT ' . intval($begin) . ', ' . intval($count);
} else {
$limit = '';
}
$users = $db->query("SELECT * FROM `" . getModeDetails($mode, 'TABLE_PANEL_USERS', 'table') . "` " . $userSelection . ' ' . $limit);
while ($user = $db->fetch_array($users)) {
if (!isset($user['customer_categories_once'])) {
$user['customer_categories_once'] = '';
}
if (!isset($user['customer_categories_period'])) {
$user['customer_categories_period'] = '';
}
$myInvoice = new invoice($db, $mode, explode('-', $user['customer_categories_once']), explode('-', $user['customer_categories_period']));
if ($myInvoice->collect($user[getModeDetails($mode, 'TABLE_PANEL_USERS', 'key')]) === true) {
$total_fee_taxed = 0;
$myUpdates = $zeroUpdates;
$total_fees_array = $myInvoice->getTotalFee($lng);
foreach ($total_fees_array as $service_type => $total_fee_array) {
if (isset($service_categories[$service_type]) && isset($service_categories[$service_type]['category_cachefield']) && $service_categories[$service_type]['category_cachefield'] != '') {
$myUpdates[$service_categories[$service_type]['category_cachefield']] = $total_fee_array['total_fee_taxed'];
$total_fee_taxed += $total_fee_array['total_fee_taxed'];
}
}
$updates = '';
foreach ($myUpdates as $myField => $myValue) {
$updates .= ', `' . $myField . '` = \'' . $myValue . '\' ';
}
$db->query('UPDATE `' . getModeDetails($mode, 'TABLE_PANEL_USERS', 'table') . '` SET `invoice_fee` = \'' . $total_fee_taxed . '\' ' . $updates . ' WHERE `' . getModeDetails($mode, 'TABLE_PANEL_USERS', 'key') . '` = \'' . $user[getModeDetails($mode, 'TABLE_PANEL_USERS', 'key')] . '\' ');
$returnval[$user[getModeDetails($mode, 'TABLE_PANEL_USERS', 'key')]] = $myUpdates;
$returnval[$user[getModeDetails($mode, 'TABLE_PANEL_USERS', 'key')]]['total'] = $total_fee_taxed;
$returnval[$user[getModeDetails($mode, 'TABLE_PANEL_USERS', 'key')]]['loginname'] = $user['loginname'];
}
}
return $returnval;
}
示例2: intval
$state = intval($_POST['state']);
}
$myInvoice = new invoice(&$db, $mode, explode('-', $user['customer_categories_once']), explode('-', $user['customer_categories_period']));
if ($myInvoice->collect($id, true) === true) {
$invoiceXmlString = $myInvoice->exportXml($lng, $invoice_number);
$invoiceXml = new SimpleXMLElement($invoiceXmlString);
$db->query('INSERT INTO `' . getModeDetails($mode, 'TABLE_BILLING_INVOICES', 'table') . '` (`' . getModeDetails($mode, 'TABLE_BILLING_INVOICES', 'key') . '`, `xml`, `invoice_date`, `invoice_number`, `state`, `state_change`, `total_fee`, `total_fee_taxed`) VALUES(\'' . $db->escape($id) . '\', \'' . $db->escape($invoiceXmlString) . '\', \'' . $db->escape(date('Y-m-d')) . '\', \'' . $db->escape($invoice_number) . '\', \'' . $db->escape($state) . '\', \'' . time() . '\', \'' . $db->escape((string) $invoiceXml->total_fee[0]) . '\', \'' . $db->escape((string) $invoiceXml->total_fee_taxed[0]) . '\' ) ');
if (preg_match('/^' . strtr($lng['invoice']['invoicenumbertemplate'], array('/' => '\\/', '{number}' => '(\\d+)', '{year}' => date('Y'), '{month}' => date('m'), '{day}' => date('d'))) . '$/', $invoice_number, $invoicenumber_count)) {
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = \'' . (int) $invoicenumber_count[1] . '\' WHERE `settinggroup` = \'billing\' AND `varname` = \'invoicenumber_count\'');
}
}
cacheInvoiceFees($mode, null, null, $id);
redirectTo($filename, array('s' => $s, 'mode' => $mode, 'page' => 'overview'));
} else {
$invoice_states_option = '';
foreach ($lng['invoice']['states'] as $stateid => $statename) {
$invoice_states_option .= makeoption($statename, $stateid, $result['state'], true);
}
eval("echo \"" . getTemplate("billing/openinvoices_invoice_fix") . "\";");
}
}
if ($action == 'preview') {
$myInvoice = new invoice(&$db, $mode, explode('-', $user['customer_categories_once']), explode('-', $user['customer_categories_period']));
if ($myInvoice->collect($id) === true) {
$invoice = new pdfInvoice();
$invoice->processData($myInvoice->exportXml($lng, $lng['invoice']['preview']), $lng);
$invoice->outputBrowser();
}
}
}
}