本文整理汇总了PHP中FormLib::get方法的典型用法代码示例。如果您正苦于以下问题:PHP FormLib::get方法的具体用法?PHP FormLib::get怎么用?PHP FormLib::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormLib
的用法示例。
在下文中一共展示了FormLib::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$date1 = $this->form->date1;
$date2 = $this->form->date2;
$deptStart = FormLib::get('deptStart');
$deptEnd = FormLib::get('deptEnd');
$deptMulti = FormLib::get('departments', array());
$include_sales = FormLib::get('includeSales', 0);
$buyer = FormLib::get('buyer', '');
// args/parameters differ with super
// vs regular department
$args = array($date1 . ' 00:00:00', $date2 . ' 23:59:59');
$where = ' 1=1 ';
if ($buyer !== '') {
if ($buyer == -2) {
$where .= ' AND s.superID != 0 ';
} elseif ($buyer != -1) {
$where .= ' AND s.superID=? ';
$args[] = $buyer;
}
}
if ($buyer != -1) {
list($conditional, $args) = DTrans::departmentClause($deptStart, $deptEnd, $deptMulti, $args);
$where .= $conditional;
}
$dlog = DTransactionsModel::selectDlog($date1, $date2);
$query = "SELECT d.upc,\n p.brand,\n p.description,\n d.department,\n t.dept_name,\n SUM(total) AS total,\n SUM(d.cost) AS cost," . DTrans::sumQuantity('d') . " AS qty\n FROM {$dlog} AS d " . DTrans::joinProducts('d', 'p', 'inner') . DTrans::joinDepartments('d', 't');
// join only needed with specific buyer
if ($buyer !== '' && $buyer > -1) {
$query .= 'LEFT JOIN superdepts AS s ON d.department=s.dept_ID ';
} elseif ($buyer !== '' && $buyer == -2) {
$query .= 'LEFT JOIN MasterSuperDepts AS s ON d.department=s.dept_ID ';
}
$query .= "WHERE tdate BETWEEN ? AND ?\n AND {$where}\n AND d.cost <> 0 ";
if ($include_sales != 1) {
$query .= "AND d.discounttype=0 ";
}
$query .= "GROUP BY d.upc,p.description,d.department,t.dept_name\n ORDER BY sum(total) DESC";
$prep = $dbc->prepare_statement($query);
$result = $dbc->exec_statement($query, $args);
$data = array();
$sum_total = 0.0;
$sum_cost = 0.0;
while ($row = $dbc->fetch_row($result)) {
$margin = $row['total'] == 0 ? 0 : ($row['total'] - $row['cost']) / $row['total'] * 100;
$record = array($row['upc'], $row['brand'], $row['description'], $row['department'], $row['dept_name'], sprintf('%.2f', $row['cost']), sprintf('%.2f', $row['total']), sprintf('%.2f', $margin), sprintf('%.2f', $row['qty'] == 0 ? 0 : ($row['total'] - $row['cost']) / $row['qty']));
$sum_total += $row['total'];
$sum_cost += $row['cost'];
$data[] = $record;
}
// go through and add a contribution to margin value
for ($i = 0; $i < count($data); $i++) {
// (item_total - item_cost) / total sales
$contrib = ($data[$i][5] - $data[$i][4]) / $sum_total * 100;
$data[$i][] = sprintf('%.2f', $contrib);
}
return $data;
}
示例2: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$upc = $this->form->upc;
$upc = BarcodeLib::padUPC($upc);
$query = 'SELECT i.sku, i.quantity, i.unitCost, i.caseSize,
i.quantity * i.unitCost * i.caseSize AS ttl,
o.vendorInvoiceID, v.vendorName, o.placedDate
FROM PurchaseOrderItems AS i
LEFT JOIN PurchaseOrder AS o ON i.orderID=o.orderID
LEFT JOIN vendors AS v ON o.vendorID=v.vendorID
WHERE i.internalUPC = ?
AND o.placedDate >= ?
ORDER BY o.placedDate';
$prep = $dbc->prepare($query);
$args = array($upc);
if (FormLib::get('all')) {
$args[] = '1900-01-01 00:00:00';
} else {
$args[] = date('Y-m-d', strtotime('92 days ago'));
}
$result = $dbc->execute($prep, $args);
$data = array();
while ($row = $dbc->fetch_row($result)) {
$record = array($row['placedDate'], $row['vendorName'], $row['vendorInvoiceID'], $row['sku'], $row['quantity'], $row['caseSize'], $row['unitCost'], $row['ttl']);
$data[] = $record;
}
return $data;
}
示例3: fetch_report_data
public function fetch_report_data()
{
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
$dt = FormLib::get('endDate', date('Y-m-d'));
$dividends = new GumDividendsModel($dbc);
$dividends->yearEndDate($dt);
$map = new GumDividendPayoffMapModel($dbc);
$check = new GumPayoffsModel($dbc);
$data = array();
foreach ($dividends->find('card_no') as $dividend) {
$record = array($dividend->card_no(), sprintf('%.2f', $dividend->equityAmount()), $dividend->daysHeld(), sprintf('%.2f%%', $dividend->dividendRate() * 100), sprintf('%.2f', $dividend->dividendAmount()));
$checkID = false;
$map->reset();
$map->gumDividendID($dividend->gumDividendID());
foreach ($map->find('gumPayoffID', true) as $obj) {
$checkID = $obj->gumPayoffID();
}
if (!$checkID) {
$record[] = '?';
} else {
$check->gumPayoffID($checkID);
$check->load();
$record[] = $check->checkNumber();
}
$data[] = $record;
}
return $data;
}
示例4: fetch_report_data
public function fetch_report_data()
{
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
$month = FormLib::get('month', date('n'));
$year = FormLib::get('year', date('Y'));
$end_of_last_month = mktime(0, 0, 0, $month, 0, $year);
$ts = mktime(0, 0, 0, $month, 1, $year);
$end_of_next_month = mktime(0, 0, 0, $month, date('t', $ts), $year);
$end_last_dt = new DateTime(date('Y-m-d', $end_of_last_month));
$end_next_dt = new DateTime(date('Y-m-d', $end_of_next_month));
$loans = new GumLoanAccountsModel($dbc);
$data = array();
foreach ($loans->find('loanDate') as $loan) {
$record = array($loan->accountNumber(), number_format($loan->principal(), 2), number_format($loan->interestRate() * 100, 2) . '%', $loan->termInMonths(), date('Y-m-d', strtotime($loan->loanDate())));
$loanDT = new DateTime(date('Y-m-d', strtotime($loan->loanDate())));
$days1 = $loanDT->diff($end_last_dt)->format('%r%a');
$days2 = $loanDT->diff($end_next_dt)->format('%r%a');
$bal_before = $loan->principal() * pow(1.0 + $loan->interestRate(), $days1 / 365.25);
if ($days1 < 0) {
$bal_before = $loan->principal();
}
$bal_after = $loan->principal() * pow(1.0 + $loan->interestRate(), $days2 / 365.25);
if ($days2 < 0) {
$bal_after = $loan->principal();
}
$record[] = number_format($bal_before, 2);
$record[] = number_format($bal_after, 2);
$record[] = number_format($bal_after - $bal_before, 2);
$data[] = $record;
}
return $data;
}
示例5: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$query_parts = FormLib::standardItemFromWhere();
$query = '
SELECT t.upc,
t.description,
t.department,
d.dept_name,
' . DTrans::sumQuantity('t') . ' AS qty,
SUM(t.total) AS total ' . $query_parts['query'] . ' AND t.memType=?
GROUP BY t.upc,
t.description,
t.department,
d.dept_name
ORDER BY t.upc';
$args = $query_parts['args'];
$args[] = FormLib::get('memtype');
$data = array();
$prep = $dbc->prepare($query);
$res = $dbc->execute($prep, $args);
while ($w = $dbc->fetchRow($res)) {
$data[] = array($w['upc'], $w['description'], $w['department'] . ' ' . $w['dept_name'], sprintf('%.2f', $w['qty']), sprintf('%.2f', $w['total']));
}
return $data;
}
示例6: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$settings = $this->config->get('PLUGIN_SETTINGS');
$dbc->selectDB($settings['ScheduledEmailDB']);
$query = '
SELECT name,
cardNo,
sendDate,
sent,
sentDate,
sentToEmail
FROM ScheduledEmailQueue AS q
LEFT JOIN ScheduledEmailTemplates AS t
ON q.scheduledEmailTemplateID=t.scheduledEmailTemplateID
WHERE 1=1 ';
$args = array();
if (FormLib::get('member') != '') {
$query .= ' AND CardNo=? ';
$args[] = FormLib::get('member');
}
if (FormLib::get('date1') != '' && FormLib::get('date2') != '') {
$query .= ' AND sendDate BETWEEN ? AND ? ';
$args[] = FormLib::get('date1') . ' 00:00:00';
$args[] = FormLib::get('date2') . ' 23:59:59';
}
$prep = $dbc->prepare($query);
$res = $dbc->execute($prep, $args);
$data = array();
while ($w = $dbc->fetchRow($res)) {
$data[] = array($w['sendDate'], $w['name'], $w['cardNo'], $w['sent'] ? 'Yes' : 'No', $w['sentDate'] ? $w['sentDate'] : 'n/a', $w['sentToEmail'] ? $w['sentToEmail'] : 'n/a');
}
return $data;
}
示例7: saveFormData
function saveFormData($memNum)
{
$dbc = $this->db();
/**
Use primary member for default column values
*/
$account = self::getAccount();
if (!$account) {
return "Error: Problem saving household members<br />";
}
$json = array('cardNo' => $memNum, 'customerTypeID' => $account['customerTypeID'], 'memberStatus' => $account['memberStatus'], 'activeStatus' => $account['activeStatus'], 'customers' => array());
$primary = array('discount' => 0, 'staff' => 0, 'lowIncomeBenefits' => 0, 'chargeAllowed' => 0, 'checksAllowed' => 0);
foreach ($account['customers'] as $c) {
if ($c['accountHolder']) {
$primary = $c;
break;
}
}
$fns = FormLib::get_form_value('HouseholdMembers_fn', array());
$lns = FormLib::get_form_value('HouseholdMembers_ln', array());
$ids = FormLib::get('HouseholdMembers_ID', array());
for ($i = 0; $i < count($lns); $i++) {
$json['customers'][] = array('customerID' => $ids[$i], 'firstName' => $fns[$i], 'lastName' => $lns[$i], 'accountHolder' => 0, 'discount' => $primary['discount'], 'staff' => $primary['staff'], 'lowIncomeBenefits' => $primary['lowIncomeBenefits'], 'chargeAllowed' => $primary['chargeAllowed'], 'checksAllowed' => $primary['checksAllowed']);
}
$resp = \COREPOS\Fannie\API\member\MemberREST::post($memNum, $json);
if ($resp['errors'] > 0) {
return "Error: Problem saving household members<br />";
}
return '';
}
示例8: post_id_superID_growth_handler
public function post_id_superID_growth_handler()
{
$lib_class = $this->lib_class;
$dbc = $lib_class::getDB();
$map = $lib_class::getCategoryMap($dbc);
for ($i = 0; $i < count($this->id); $i++) {
if (!isset($this->superID[$i])) {
continue;
}
$map->obfCategoryID($this->id[$i]);
$map->superID($this->superID[$i]);
$map->growthTarget(isset($this->growth[$i]) ? $this->growth[$i] / 100.0 : 0);
$map->save();
}
$delete = FormLib::get('delete', array());
if (is_array($delete)) {
foreach ($delete as $ids) {
list($cat, $super) = explode(':', $ids, 2);
$map->obfCategoryID($cat);
$map->superID($super);
$map->delete();
}
}
header('Location: ' . filter_input(INPUT_SERVER, 'PHP_SELF'));
return false;
}
示例9: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$FANNIE_URL = $this->config->get('URL');
$super = $this->form->submit == "by_sd" ? 1 : 0;
$join = "";
$where = "";
$args = array();
if ($super == 1) {
$superID = FormLib::get('superdept');
$join = "LEFT JOIN superdepts AS s ON d.dept_no=s.dept_ID\n LEFT JOIN superDeptNames AS m ON s.superID=m.superID ";
$where = "s.superID = ?";
$args[] = $superID;
} else {
$d1 = FormLib::get('dept1');
$d2 = FormLib::get('dept2');
$join = " LEFT JOIN MasterSuperDepts AS m ON d.dept_no=m.dept_ID";
$where = "d.dept_no BETWEEN ? AND ?";
$args = array($d1, $d2);
}
$query = $dbc->prepare_statement("SELECT d.dept_no,d.dept_name,d.salesCode,d.margin,\n CASE WHEN d.dept_tax=0 THEN 'NoTax' ELSE t.description END as tax,\n CASE WHEN d.dept_fs=1 THEN 'Yes' ELSE 'No' END as fs,\n m.super_name\n FROM departments AS d \n LEFT JOIN taxrates AS t ON d.dept_tax = t.id \n {$join}\n WHERE {$where}\n ORDER BY d.dept_no");
$result = $dbc->exec_statement($query, $args);
$data = array();
while ($row = $dbc->fetch_row($result)) {
$record = array($row[0], isset($_REQUEST['excel']) ? $row[1] : "<a href=\"{$FANNIE_URL}item/departments/DepartmentEditor.php?did={$row['0']}\">{$row['1']}</a>", $row['super_name'], $row[2], sprintf('%.2f%%', $row[3] * 100), $row[4], $row[5]);
if (empty($row['super_name'])) {
$record['meta'] = FannieReportPage::META_COLOR;
$record['meta_background'] = '#ff9999';
}
$data[] = $record;
}
return $data;
}
示例10: draw_page
public function draw_page()
{
include dirname(__FILE__) . '/../../config.php';
$dbc = FannieDB::get($FANNIE_TRANS_DB);
$id = FormLib::get('id', 0);
$prep = $dbc->prepare('SELECT filetype, filecontents FROM CapturedSignature WHERE capturedSignatureID=?');
$result = $dbc->execute($prep, array($id));
if ($dbc->num_rows($result) > 0) {
$row = $dbc->fetch_row($result);
switch (strtoupper($row['filetype'])) {
case 'BMP':
header('Content-type: image/bmp');
break;
case 'PNG':
header('Content-type: image/png');
break;
case 'JPG':
header('Content-type: image/jpeg');
break;
case 'GIF':
header('Content-type: image/gif');
break;
default:
// Content-type: application/octet-stream
// may be helpful in this scenario but appears
// to be technically incorrect. in any event
// it really should not occur
break;
}
echo $row['filecontents'];
}
}
示例11: post_upc_description_department_cost_price_qty_reason_handler
public function post_upc_description_department_cost_price_qty_reason_handler()
{
global $FANNIE_TRANS_DB, $FANNIE_EMP_NO, $FANNIE_REGISTER_NO;
$dbc = FannieDB::get($FANNIE_TRANS_DB);
$record = DTrans::$DEFAULTS;
$record['emp_no'] = $FANNIE_EMP_NO;
$record['register_no'] = $FANNIE_REGISTER_NO;
$record['trans_no'] = DTrans::getTransNo($dbc, $FANNIE_EMP_NO, $FANNIE_REGISTER_NO);
$record['trans_id'] = 1;
$record['upc'] = $this->upc;
$record['description'] = $this->description;
$record['department'] = $this->department;
$record['trans_type'] = 'I';
$record['quantity'] = $this->qty;
$record['ItemQtty'] = $this->qty;
$record['unitPrice'] = $this->price;
$record['regPrice'] = $this->price;
$record['total'] = $this->qty * $this->price;
$record['cost'] = $this->qty * $this->cost;
$record['numflag'] = $this->reason;
$record['charflag'] = strlen(FormLib::get('type')) > 0 ? strtoupper(substr(FormLib::get('type'), 0, 1)) : '';
$record['trans_status'] = 'Z';
$info = DTrans::parameterize($record, 'datetime', $dbc->now());
$query = 'INSERT INTO dtransactions
(' . $info['columnString'] . ')
VALUES
(' . $info['valueString'] . ')';
$prep = $dbc->prepare($query);
$result = $dbc->execute($prep, $info['arguments']);
header('Location: ' . $_SERVER['PHP_SELF'] . '?msg=1');
return false;
}
示例12: post_handler
public function post_handler()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
$amount = FormLib::get('amount');
$paid = FormLib::get('paid') / 100.0;
$retained = FormLib::get('retained') / 100.0;
$netQ = '
SELECT SUM(p.net_purch) AS ttl
FROM patronage_workingcopy AS p
INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
WHERE c.Type=\'PC\'';
$netR = $dbc->query($netQ);
$netW = $dbc->fetch_row($netR);
$purchases = $netW['ttl'];
$personQ = '
SELECT p.net_purch,
c.cardno
FROM patronage_workingcopy AS p
INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
WHERE c.Type=\'PC\'';
$personR = $dbc->query($personQ);
$this->insertRecords($dbc, $personR, $purchases, $paid, $retained, $amount);
$finishQ = '
INSERT INTO patronage
(cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY)
SELECT
p.cardno, purchase, discounts, rewards, net_purch, tot_pat, cash_pat, equit_pat, FY
FROM patronage_workingcopy AS p
INNER JOIN custdata AS c ON p.cardno=c.CardNo AND c.personNum=1
WHERE c.Type=\'PC\'';
$dbc->query($finishQ);
return true;
}
示例13: fetch_report_data
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$upc = BarcodeLib::padUPC(FormLib::get('upc'));
$date1 = $this->form->date1;
$date2 = $this->form->date2;
$dlog = DTransactionsModel::selectDlog($date1, $date2);
$q = $dbc->prepare("\n SELECT d.card_no,\n sum(quantity) as qty,\n sum(total) as amt\n FROM {$dlog} AS d \n WHERE d.upc=? AND \n tdate BETWEEN ? AND ?\n GROUP BY d.card_no\n ORDER BY d.card_no");
$r = $dbc->exec_statement($q, array($upc, $date1 . ' 00:00:00', $date2 . ' 23:59:59'));
$data = array();
while ($w = $dbc->fetch_row($r)) {
$account = \COREPOS\Fannie\API\member\MemberREST::get($w['card_no']);
if ($account == false) {
continue;
}
$customer = array();
foreach ($account['customers'] as $c) {
if ($c['accountHolder']) {
$customer = $c;
break;
}
}
$record = array($w['card_no'], $customer['lastName'] . ', ' . $customer['firstName'], $account['addressFirstLine'] . ' ' . $account['addressSecondLine'], $account['city'], $account['state'], $account['zip'], $customer['phone'], $customer['altPhone'], $customer['email'], sprintf('%.2f', $w['qty']), sprintf('%.2f', $w['amt']));
$data[] = $record;
}
return $data;
}
示例14: preprocess
public function preprocess()
{
$acct = FormLib::get('id');
$this->header = 'Loan Schedule' . ' : ' . $acct;
$this->title = 'Loan Schedule' . ' : ' . $acct;
return parent::preprocess();
}
示例15: post_download_handler
public function post_download_handler()
{
header('Content-Type: application/ms-excel');
header('Content-Disposition: attachment; filename="PDFasCSV.csv"');
echo FormLib::get('download');
return false;
}