本文整理汇总了PHP中grp函数的典型用法代码示例。如果您正苦于以下问题:PHP grp函数的具体用法?PHP grp怎么用?PHP grp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
function write(&$frm)
{
if (isset($_REQUEST["btn_back"])) {
return enter($frm);
}
if ($frm->validate("write")) {
return confirm($frm);
}
$upd = new dbUpdate("suppstock", "cubit");
$del = new dbDelete("suppstock", "cubit");
foreach ($_REQUEST["stkcod"] as $suppid => $stkcod) {
if (empty($stkcod)) {
$del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$del->run();
continue;
}
$cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkcod", $stkcod));
$upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$upd->run(DB_REPLACE);
}
foreach ($_REQUEST["stkdes"] as $suppid => $stkdes) {
if (empty($stkcod)) {
$del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$del->run();
continue;
}
$cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkdes", $stkdes));
$upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$upd->run(DB_REPLACE);
}
$OUT = "<script>window.close();</script>";
return $OUT;
}
示例2: printLea
function printLea($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($f_day, "num", 1, 2, "Invalid from Date day.");
$v->isOk($f_month, "num", 1, 2, "Invalid from Date month.");
$v->isOk($f_year, "num", 1, 4, "Invalid from Date Year.");
$v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
$v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
$v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
# mix dates
$fromdate = $f_year . "-" . $f_month . "-" . $f_day;
$todate = $to_year . "-" . $to_month . "-" . $to_day;
$v->isOk($fromdate, "date", 1, 1, "Invalid from date.");
$v->isOk($todate, "date", 1, 1, "Invalid to date.");
if ($v->isError()) {
$err = $v->genErrors();
return $err;
}
if (isset($empnum)) {
$OUTPUT = genslip($empnum, $fromdate, $todate);
} else {
$OUTPUT = "";
$qry = new dbSelect("employees", "cubit", grp(m("cols", "empnum"), m("where", "div='" . USER_DIV . "'")));
$qry->run();
while ($row = $qry->fetch_array()) {
$OUTPUT .= paged(genslip($row["empnum"], $fromdate, $todate));
}
}
require "../tmpl-print.php";
}
示例3: bal
function bal($id)
{
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 20, "Invalid Cash Flow Statement number.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "<li class=err>" . $e["msg"];
}
$theseErrors .= "<p><input type=button onClick='JavaScript:history.back();' value='« Correct submission'>";
return $theseErrors;
}
# connect to core DB
core_connect();
# get the Trial Balance
$cf = new dbSelect("save_cashflow", "core", grp(m("cols", "output, date_trunc('day', gentime) as gentime"), m("where", "id='{$id}'")));
$cf->run();
if ($cf->num_rows() < 1) {
return "<center><li> Invalid Cash Flow Statement Number.</li></center>";
}
$stmnt = $cf->fetch_array();
$OUTPUT = base64_decode($stmnt['output']);
if (isset($_GET["xls"])) {
$cftime = preg_replace("/ 00:00.*/", "", $stmnt["gentime"]);
require_lib("xls");
Stream("cashflow-{$cftime}", $OUTPUT);
} else {
require "../tmpl-print.php";
}
}
示例4: write
function write(&$frm)
{
if ($frm->validate("write")) {
return edit($frm);
}
$cols = grp(m("value", $_POST["print_dialog"]));
$qry = new dbUpdate("settings", "cubit", $cols, "constant='PRINT_DIALOG'");
$qry->run(DB_UPDATE);
$OUT = "\n\t<h3>Printing Options</h3>\n\tSuccessfully saved printing options.";
return $OUT;
}
示例5: write
function write()
{
extract($_GET);
if (!isset($id)) {
$id = 0;
}
$cols = grp(m("name", $name), m("in_republic", $in_republic), m("meals", $meals), m("accid", $accid), m("div", USER_DIV));
$subs = new dbUpdate("subsistence", "cubit", $cols, "id='{$id}'");
$subs->run(DB_REPLACE);
$OUT = "\n\t<h3>Define Subsistence Allowance</h3>\n\tSuccessfully created/updated subsistence allowance.";
return $OUT;
}
示例6: locateSupplier
/**
* locates a supplier by name, if not found creates and returns id
*
* @param string $name company name
* @return int
*/
function locateSupplier($name)
{
$qry = new dbSelect("suppliers", "cubit", grp(m("cols", "supid"), m("where", "lower(supname)=lower('{$name}')")));
$qry->run();
if ($qry->num_rows() > 0) {
$id = $qry->fetch_result();
} else {
// insert into new supps
$id = -1;
}
$qry->free();
return $id;
}
示例7: write
function write($frm)
{
/* @var $frm cForm */
if ($frm->validate("confirm")) {
return edit($frm);
}
/* point of sale message at the bottom of the slip */
$cols = grp(m("value", $_POST["posmsg"]));
$upd = new dbUpdate("settings", "cubit", $cols, "constant='POSMSG'");
$upd->run(DB_UPDATE);
$OUT = "\n\t<h3>Point of Sale Settings</h3>\n\t\n\tSuccessfully updated.<br />";
return $OUT;
}
示例8: check_messages
function check_messages()
{
$qry = new dbSelect("req", "cubit", grp(m("cols", "1"), m("where", "recipient='" . USER_NAME . "' AND alerted IS NULL")));
$qry->run();
if ($qry->num_rows() == 0) {
return "NO MESSAGES";
} else {
$cols = grp(m("alerted", "1"));
$upd = new dbUpdate("req", "cubit", $cols, "recipient='" . USER_NAME . "'");
$upd->run(DB_UPDATE);
$qry->setOpt(grp(m("where", "recipient='" . USER_NAME . "' AND viewed='0'")));
$qry->run();
return "MSGS: " . $qry->num_rows();
}
}
示例9: writesal
function writesal($frm)
{
if ($frm->validate("writesal")) {
return entersal($frm);
}
extract($_POST);
$upd = new dbUpdate("salpaid", "cubit", false);
foreach ($sal as $payid => $salrate) {
$cols = grp(m("salrate", $salrate), isset($hrs[$payid]) ? m("hours", $hrs[$payid]) : false);
$upd->setOpt($cols, "id='{$payid}'");
$upd->run(DB_UPDATE);
}
$OUT = "\n\t<h3>Previous Employee Salary Information</h3>\n\tSuccessfully updated employee payslip information.";
return $OUT;
}
示例10: write
function write($frm)
{
if (isset($_REQUEST["btn_back"])) {
return select($frm);
}
/* @var $frm cForm */
if ($frm->validate("confirm")) {
return confirm($frm);
}
$cols = grp(m("value", $_REQUEST["emp_year"]));
$upd = new dbUpdate("settings", "cubit", $cols, "constant='EMP_TAXYEAR'");
$upd->run(DB_UPDATE);
$OUT = "\n\t<h3>Active Tax Year</h3>\n\tSuccessfully updated active Tax Year to {$_REQUEST['emp_year']}";
return $OUT;
}
示例11: buildlist
function buildlist(&$frm)
{
if (!isset($_GET["cusnum"])) {
invalid_use();
}
$cust = qryCustomer($_GET["cusnum"]);
$qry = new dbSelect("plist_prices", "exten", grp(m("where", "listid='{$cust['pricelist']}' AND div='" . USER_DIV . "'")));
$qry->run();
$pli = array();
$pli_noshow = array();
while ($row = $qry->fetch_array()) {
if ($row["show"] == "Yes") {
$pli[$row["stkid"]] = $row["price"];
} else {
$pli_noshow[$row["stkid"]] = $row["price"];
}
}
$qry = new dbSelect("stock", "cubit", grp(m("where", "div='" . USER_DIV . "'")));
$qry->run();
$plist = "";
while ($row = $qry->fetch_array()) {
if (isset($pli_noshow[$row["stkid"]])) {
continue;
}
if (isset($pli[$row["stkid"]])) {
$price = $pli[$row["stkid"]];
} else {
$price = $row["selamt"];
}
$desc = preg_replace("/,/", "", $row["stkdes"]);
$plist .= "{$row['stkcod']},{$price},{$desc}\n";
}
/* @var $frm cForm */
$frm->setFormParm("post", "../emailsave_page.php");
$frm->setkey("sendmails");
$frm->add_hidden("emailsavepage_key", "sendmails", "string");
$frm->add_hidden("emailsavepage_action", "email", "string");
$frm->add_hidden("emailsavepage_content", base64_encode($plist), "string");
$frm->add_hidden("emailsavepage_mime", "text/plain", "string");
$frm->add_hidden("emailsavepage_subject", "Pricelist from " . COMP_NAME, "string");
$frm->add_hidden("emailsavepage_name", "pricelist.csv", "string");
$frm->add_heading("Sending Pricelist to Customer");
$frm->add_layout("\n\t\t<tr %bgc>\n\t\t\t<td>Customer:</td>\n\t\t\t<td>{$cust['surname']}</td>\n\t\t</tr>\n\t\t<tr %bgc>\n\t\t\t<td>%disp[0]</td>\n\t\t\t<td>%fld[0]</td>\n\t\t</tr>");
$frm->add_hidden("surnames[{$cust['cusnum']}]", $cust["surname"], "string");
$frm->add_text("E-mail", "emailcust[{$cust['cusnum']}]", $cust["email"], "string", "1:255");
return $frm->getfrm_input();
}
示例12: write
function write()
{
extract($_POST);
$qry = new dbSelect("config", "trh", grp(m("where", "readonly='f'")));
$qry->run();
$upd = new dbUpdate("config", "trh");
while ($row = $qry->fetch_array()) {
if (isset(${$row["name"]})) {
$cols = grp(m("value", ${$row["name"]}["value"]));
$upd->setOpt($cols, "name='{$row['name']}'");
$upd->run(DB_UPDATE);
}
}
r2sListRestore("trh_comminit");
$OUT = "\n\t<h3>Transactioning Configuration</h3>\n\tSuccessfully updated configuration.";
return $OUT;
}
示例13: printComp
function printComp()
{
$OUT = "\n <h3>View Companies</h3>\n <table " . TMPL_tblDflts . ">\n <tr>\n \t<th>Company Code</th>\n \t<th>Company Name</th>\n \t<th>Status</th>\n \t<th>Options</th>\n </tr>";
$qry = new dbSelect("companies", DB_MCUBIT, grp(m("order", "name ASC")));
$qry->run();
$i = 0;
while ($comp = $qry->fetch_array()) {
$bgcolor = bgcolor($i);
$status = ucfirst($comp["status"]);
$OUT .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$comp['code']}</td>\n\t\t\t<td>{$comp['name']}</td>\n\t\t\t<td>{$status}</td>";
if ($comp["status"] == "removed") {
$OUT .= "\n\t\t\t<td><a href='company-rem.php?key=recover&code={$comp['code']}'>Recover</a></td>";
}
$OUT .= "\n\t\t\t<td><a href='company-rem.php?key=confirm&perm=t&code={$comp['code']}'>" . ($comp["status"] == "removed" ? "Remove Permanently (CAN NOT BE RECOVERED)" : "Remove") . "</a></td>\n\t\t</tr>";
}
$OUT .= "\n\t</table>" . mkQuickLinks(ql("company-new.php", "Add New Company"));
return $OUT;
}
示例14: write
function write()
{
extract($_POST);
require_lib("validate");
$v = new validate();
$v->isOk($salespno, "num", 1, 10, "Invalid Sales Person number.");
$v->isOk($salesp, "string", 1, 255, "Invalid Sales Person name.");
if ($v->isError()) {
return $v->genErrors();
}
$cols = grp(m("salespno", $salespno), m("salesp", $salesp), m("com", $com), m("div", USER_DIV));
$qry = new dbUpdate("salespeople", "exten", $cols);
$qry->run(DB_INSERT);
if ($qry->affected() < 1) {
return "<li class=err>Unable to add sales person to Cubit.";
}
$write = "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th>Sales Person added to system</th>\n\t</tr>\n\t<tr class='text'><td>New Sales Person <b>{$salesp}</b>, has been\n\t\tsuccessfully added to the system.</td>\n\t</tr>\n\t</table>";
return $write;
}
示例15: view
function view()
{
// Connect to database
core_Connect();
// Query server
$cf = new dbSelect("save_cashflow", "core", grp(m("where", "div='" . USER_DIV . "'")));
$cf->run();
if ($cf->num_rows() < 1) {
$OUTPUT = "<li> There are no saved Cash Flow Statements.";
} else {
// Set up table to display in
$OUTPUT = "\n\t\t<h3>View Saved Cash Flow Statements</h3>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=300>\n\t\t<tr>\n\t\t\t<th>Statement No.</th>\n\t\t\t<th>Generated</th>\n\t\t\t<th colspan=2>Options</th>\n\t\t</tr>";
// display all statements
while ($stmnt = $cf->fetch_array()) {
$OUTPUT .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stmnt['id']}({$stmnt['des']})</td>\n\t\t\t\t<td>{$stmnt['gentime']}</td>\n\t\t\t\t<td><a target='_blank' href='cash-flow-print.php?id={$stmnt['id']}'>Print</a></td>\n\t\t\t\t<td><a href='cash-flow-print.php?id={$stmnt['id']}&xls=t'>Spreadsheet</a></td>\n\t\t\t</tr>";
}
$OUTPUT .= "</table>";
}
$OUTPUT .= "\n\t<p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class=datacell><td><a href='index-reports.php'>Financials</a></td></tr>\n\t<tr class=datacell><td><a href='index-reports-stmnt.php'>Current Year Financial Statements</a></td></tr>\n\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\n\t</table>";
// call template to display the info and die
return $OUTPUT;
}