コード例 #1
0
function confirm($cashid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($cashid, "num", 1, 20, "Invalid Reference number.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>" . $e["msg"];
        }
        $confirm .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirm;
    }
    # Connect to database
    db_Connect();
    $sql = "SELECT * FROM pettycashbook WHERE cashid = '{$cashid}' AND div = '" . USER_DIV . "'";
    $cashRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve cashbook entry details from database.", SELF);
    if (pg_numrows($cashRslt) < 1) {
        $OUTPUT = "<li clss=err>Requisistion not found in Cubit.";
        return $OUTPUT;
    }
    $cash = pg_fetch_array($cashRslt);
    # Get account name for the account involved
    $accRslt = get("core", "accname,accnum,topacc", "accounts", "accid", $cash['accid']);
    $acc = pg_fetch_array($accRslt);
    // Layout
    $confirm = "<h3>Cancel Requisistion</h3>\r\n\t<h4>Confirm entry</h4>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=cancel>\r\n\t<input type=hidden name=cashid value='{$cash['cashid']}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Date</td><td>{$cash['date']}</td></tr>\r\n\t<tr class='bg-even'><td>Paid to</td><td>{$cash['name']}</td></tr>\r\n\t<tr class='bg-odd'><td>Details</td><td><pre>{$cash['det']}</pre></td></tr>\r\n\t<tr class='bg-even'><td>Amount</td><td>" . CUR . " {$cash['amount']}</td></tr>\r\n\t<tr class='bg-odd'><td>Account</td><td>{$acc['topacc']}/{$acc['accnum']} - {$acc['accname']}</td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td\t><input type=button value='&laquo Back' onClick='javascript:history.back()'></td><td align=right><input type=submit value='Cancel &raquo'></td></tr>\r\n\t</table></form>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='pettycashbook-view.php'>View Petty Cash Requisitions</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $confirm;
}
コード例 #2
0
function edit($div)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($div, "num", 1, 50, "Invalid branch id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>{$e['msg']}</li>";
        }
        return $confirm;
    }
    # Select Branch
    db_connect();
    $sql = "SELECT * FROM branches WHERE div = '{$div}'";
    $branRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($branRslt) < 1) {
        return "<li> Invalid Branch ID.";
    } else {
        $bran = pg_fetch_array($branRslt);
    }
    // layout
    $edit = "<h3>Edit Branch Branch</h3>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=confirm>\r\n\t<input type=hidden name=div value='{$div}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Branch code</td><td><input type=text size=20 name='brancod' value='{$bran['brancod']}'></td></tr>\r\n\t<tr class='bg-even'><td>" . REQ . "Branch name</td></td><td><input type=text size=20 name='branname' value='{$bran['branname']}'></td></tr>\r\n\t<tr class='bg-odd'><td valign=top>Details</td><td><textarea cols=18 rows=5 name='brandet'>{$bran['brandet']}</textarea></td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td></td><td align=right><input type=submit value='Confirm &raquo'></td></tr>\r\n\t</form>\r\n\t</table>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='admin-branview.php'>View Branches</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $edit;
}
コード例 #3
0
 /**
  * Get a row from the RecordSet.
  *
  * Case $row is set, return that row, case else, return the next row.
  *
  * @param int $row Row to return, defaults to next.
  * @param int $type Type of array to return (RS_ROW_NUM | RS_ROW_ASSOC | RS_ROW_BOTH).
  * @return array Returns the row from the RecordSet, or FALSE if EOF.
  */
 function Row($row = -1, $type = RS_ROW_ASSOC)
 {
     if ($row != -1) {
         $this->row = $row + 1;
         switch ($type) {
             case RS_ROW_NUM:
                 return pg_fetch_row($this->result, $this->row - 1);
                 break;
             case RS_ROW_ASSOC:
                 return pg_fetch_assoc($this->result, $this->row - 1);
                 break;
             case RS_ROW_BOTH:
                 return pg_fetch_array($this->result, $this->row - 1);
                 break;
         }
         return FALSE;
     }
     $this->row++;
     switch ($type) {
         case RS_ROW_NUM:
             return pg_fetch_row($this->result);
             break;
         case RS_ROW_ASSOC:
             return pg_fetch_assoc($this->result);
             break;
         case RS_ROW_BOTH:
             return pg_fetch_array($this->result);
             break;
     }
     return FALSE;
 }
コード例 #4
0
function view($_GET)
{
    foreach ($_GET as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($docid, "num", 1, 100, "Invalid num.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class=err>" . $e["msg"];
        }
        $confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    db_conn('cubit');
    $user = USER_NAME;
    # write to db
    $Sql = "SELECT * FROM documents WHERE docid='{$docid}'";
    $Rslt = db_exec($Sql) or errDie("Unable to access database.");
    if (pg_numrows($Rslt) < 1) {
        return "Document not Found";
    }
    $Data = pg_fetch_array($Rslt);
    $view = "<h3>Document details</h3>\r\n<br>\r\n<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n<form action='" . SELF . "' method=post>\r\n<input type=hidden name=key value=confirm>\r\n<input type=hidden name=id value={$docid}>\r\n<tr><th colspan=2>Document details</th></tr>\r\n\t<tr class='bg-odd'><td>Typeid</td><td>{$Data['typeid']}</td></tr>\r\n\t<tr class='bg-odd'><td>TypeName</td><td>{$Data['typename']}</td></tr>\r\n\t<tr class='bg-odd'><td>xin/td><td>{$Data['xin']}</td></tr>\r\n\t<tr class='bg-odd'><td>docref</td><td>{$Data['docref']}</td></tr>\r\n\t<tr class='bg-odd'><td>Date</td><td>{$Data['docdate']}</td></tr>\r\n\t<tr class='bg-even'><td>Docname</td><td align=center>{$Data['docname']}</td></tr>\r\n\t<tr class='bg-odd'><td>File</td><td>{$Data['filename']}</td></tr>\r\n\t<tr class='bg-odd'><td>MimeType</td><td>{$Data['mimetype']}</td></tr>\r\n\t<tr class='bg-even'><td>Description</td><td>{$Data['descrip']}</td></tr>\r\n\t<tr class='bg-odd'><td>Doc</td><td>{$Data['docu']}</td></tr>\r\n\t<tr class='bg-odd'><td>Div</td><td>{$Data['div']}</td></tr> \r\n\t\r\n\t<tr><td colspan=2 align=right><input type=submit value='Remove &raquo;'></td></tr>\r\n</table>\r\n<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='tlist-docview.php'>List Removed Documents</a></td></tr>\r\n        <tr class='bg-odd'><td><a href='tdocadd.php'>Add New Document</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>\r\n  ";
    db_conn('cubit');
    # write to db
    $Sql = "INSERT INTO document(typeid,typename,xin,docref,docdate,docname,filename,mimetype,descrip,docu,div) VALUES ('{$Data['typeid']}','{$Data['typename']}','{$Data['xin']}','{$Data['docref']}','{$Data['docdate']}','{$Data['docname']}','{$Data['filename']}','{$Data['mimetype']}','{$Data['descrip']}','{$Data['docu']}','{$Data['div']}')";
    $Rslt = db_exec($Sql) or errDie("Unable to access database.");
    return view;
}
コード例 #5
0
function display()
{
    $sql = "SELECT * FROM cubit.stock ORDER BY stkcod ASC";
    $stock_rslt = db_exec($sql) or errDie("Unable to retrieve stock.");
    $stock_out = "";
    while ($stock_data = pg_fetch_array($stock_rslt)) {
        // Retrieve units on order
        $sql = "SELECT sum(qty) FROM cubit.sorders_items WHERE stkid='{$stock_data['stkid']}'";
        $order_rslt = db_exec($sql) or errDie("Unable to retrieve orders.");
        $order_qty = pg_fetch_result($order_rslt, 0);
        if (empty($stock_data["minlvl"])) {
            continue;
        }
        if (empty($order_qty)) {
            $order_qty = 0;
        }
        $units = $stock_data["units"] - $order_qty;
        $required = abs($units - $stock_data["minlvl"]);
        // We're not required to purchase this item
        if ($units > $stock_data["minlvl"]) {
            continue;
        }
        $stock_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stock_data['stkcod']}</td>\n\t\t\t\t<td>{$stock_data['stkdes']}</td>\n\t\t\t\t<td align='center'>" . sprint3($stock_data['units']) . "</td>\n\t\t\t\t<td align='center'>" . sprint3($order_qty) . "</td>\n\t\t\t\t<td align='center'>" . sprint3($stock_data['minlvl']) . "</td>\n\t\t\t\t<td align='center'><b>" . sprint3($required) . "</b></td>\n\t\t\t\t<td><a href='purchase-new.php'>Purchase</a></td>\n\t\t\t</tr>";
    }
    if (empty($stock_out)) {
        $stock_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='7'>No items required for purchase.</td>\n\t\t\t</tr>";
    }
    $OUTPUT = "\n\t\t<center>\n\t\t<h3>Required Purchases</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Stock Code</th>\n\t\t\t\t<th>Stock Description</th>\n\t\t\t\t<th>Current Units</th>\n\t\t\t\t<th>Units on Order</th>\n\t\t\t\t<th>Minimum Level</th>\n\t\t\t\t<th>Minimum Required</th>\n\t\t\t\t<th>Options</th>\n\t\t\t</tr>\n\t\t\t{$stock_out}\n\t\t</table>\n\t\t</center>";
    return $OUTPUT;
}
コード例 #6
0
/** Ota tagit tietokannasta
 * @return array
 */
function get_tags()
{
    /* $result_tags array
     * $end_array array
     */
    $dbconn = pg_connect("host=localhost port=5432 dbname=noaa user=noaa password=123");
    $result_tags = pg_query_params($dbconn, 'SELECT question_id, tag
        FROM tags
        WHERE question_id IN
        (
            SELECT question_id
            FROM tags
            WHERE tag = $1
        )
        ORDER BY question_id', array($_GET['tag']));
    while ($tags_and_Qid = pg_fetch_array($result_tags)) {
        // Add the Tag to an array of tags for that question
        $end_array[$tags_and_Qid['question_id']]['tag'][] = $tags_and_Qid['tag'];
    }
    // to check if 0 messages
    if (count($end_array) == 0) {
        header("Location: index.php?" . "no_question_found");
    } else {
        return $end_array;
    }
}
コード例 #7
0
function select($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # Set uppercase
    $ALPHA = strtoupper($alpha);
    # Connect to database
    db_connect();
    # Query server for customer info
    $sql = "SELECT * FROM customers WHERE cusname LIKE '{$alpha}%' OR cusname LIKE '{$ALPHA}%' ORDER BY cusname";
    $prnCustRslt = db_exec($sql) or errDie("Unable to view customers");
    $numrows = pg_numrows($prnCustRslt);
    if ($numrows < 1) {
        return "<li class=err>No customer names starting with <b>{$ALPHA}</b> in database.";
    }
    $select = "<h4>Select a customer</h4>\r\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t\t<tr><th>Customer no.</th><th>Customer name</th></tr>";
    // display customers to choose from
    for ($i = 0; $i < $numrows; $i++) {
        $myCust = pg_fetch_array($prnCustRslt);
        $select .= "<tr class='" . bg_class() . "'><td align=center>{$myCust['cusnum']}</td><td align=center><a href='quote-new.php?cusnum={$myCust['cusnum']}'>{$myCust['cusname']}</a></td></tr>";
    }
    $select .= "</table>\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\r\n\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t<tr bgcolor='#88BBFF'><td><a href='customers-new.php'>New Customer</a></td></tr>\r\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t\t<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
    return $select;
}
コード例 #8
0
function confirmPaye($_GET)
{
    # get vars
    foreach ($_GET as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 20, "Invalid PAYE ID.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class=err>" . $e["msg"];
        }
        $confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    # connect to db
    db_connect();
    # select paye bracket
    $sql = "SELECT * FROM paye WHERE id='{$id}'";
    $payeRslt = db_exec($sql) or errDie("Unable to select PAYE bracket from database.", SELF);
    if (pg_numrows($payeRslt) < 1) {
        return "No PAYE brackets found in database.";
    }
    # get result
    $myPaye = pg_fetch_array($payeRslt);
    $confirmPaye = "\n<h3>Confirm removal of PAYE bracket</h3>\n\n<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n<form action='" . SELF . "' method=post>\n<input type=hidden name=key value=write>\n<input type=hidden name=id value='{$myPaye['id']}'>\n<tr><th>Field</th><th>Value</th></tr>\n<tr class='bg-odd'><td>Minimum gross</td><td align=right>" . CUR . " {$myPaye['min']}</td></tr>\n<tr class='bg-even'><td>Maximum gross</td><td align=right>" . CUR . " {$myPaye['max']}</td></tr>\n<tr class='bg-odd'><td>Percentage</td><td align=right>{$myPaye['percentage']}%</td></tr>\n<tr class='bg-even'><td>Cash amount extra</td><td align=right>" . CUR . " {$myPaye['extra']}</td></tr>\n<tr><td><br></td><td align=right><input type=submit value='Remove PAYE bracket &raquo;'></td></tr>\n</form>\n</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees"));
    return $confirmPaye;
}
コード例 #9
0
function printInv()
{
    # Set up table to display in
    $printQuo = "\n\t\t\t\t\t<h3>View previous POS Quotes</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Department</th>\n\t\t\t\t\t\t\t<th>Sales Person</th>\n\t\t\t\t\t\t\t<th>Quote No.</th>\n\t\t\t\t\t\t\t<th>Quote Date</th>\n\t\t\t\t\t\t\t<th>Customer Name</th>\n\t\t\t\t\t\t\t<th>Order No</th>\n\t\t\t\t\t\t\t<th>Grand Total</th>\n\t\t\t\t\t\t\t<th colspan='6'>Options</th>\n\t\t\t\t\t\t\t<th>Email</th>\n\t\t\t\t\t\t</tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM pos_quotes WHERE accepted != 'c' AND done = 'y' AND div = '" . USER_DIV . "' ORDER BY quoid DESC";
    $quoRslt = db_exec($sql) or errDie("Unable to retrieve quotes from database.");
    if (pg_numrows($quoRslt) < 1) {
        $printQuo = "<li>No previous quotes.</li>";
    } else {
        while ($quo = pg_fetch_array($quoRslt)) {
            # format date
            $quo['odate'] = explode("-", $quo['odate']);
            $quo['odate'] = $quo['odate'][2] . "-" . $quo['odate'][1] . "-" . $quo['odate'][0];
            $printQuo .= "\n\t\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t\t<td>{$quo['deptname']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$quo['salespn']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$quo['quoid']}</td>\n\t\t\t\t\t\t\t\t\t<td align='center'>{$quo['odate']}</td>\n\t\t\t\t\t\t\t\t\t<td>{$quo['cusname']} {$quo['surname']}</td>\n\t\t\t\t\t\t\t\t\t<td align=right>{$quo['ordno']}</td>\n\t\t\t\t\t\t\t\t\t<td>" . CUR . " {$quo['total']}</td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-details.php?quoid={$quo['quoid']}'>Details</a></td>";
            if ($quo['accepted'] == 'n') {
                $printQuo .= "\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-new.php?quoid={$quo['quoid']}&cont=true&done='>Edit</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-cancel.php?quoid={$quo['quoid']}'>Cancel</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-accept.php?quoid={$quo['quoid']}'>Accept</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-print.php?quoid={$quo['quoid']}' target='_blank'>Print</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pdf/pos-quote-pdf-print.php?quoid={$quo['quoid']}' target='_blank'>Print in PDF</a></td>\n\t\t\t\t\t\t\t\t\t<td><input type='checkbox' name='evs[]' value='{$quo['quoid']}'></td>\n\t\t\t\t\t\t\t\t</tr>";
            } else {
                $printQuo .= "\n\t\t\t\t\t\t\t\t\t<td colspan='3'>Accepted</td>\n\t\t\t\t\t\t\t\t\t<td><a href='pos-quote-print.php?quoid={$quo['quoid']}' target='_blank'>Print</a></td>\n\t\t\t\t\t\t\t\t\t<td><a href='pdf/pos-quote-pdf-print.php?quoid={$quo['quoid']}' target='_blank'>Print in PDF</a></td>\n\t\t\t\t\t\t\t\t\t<td><input type='checkbox' name='evs[]' value='{$quo['quoid']}'></td>\n\t\t\t\t\t\t\t\t</tr>";
            }
            $i++;
        }
        $printQuo .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td colspan='14' align='right'><input type='submit' name='key' value='Send Emails'></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
    }
    // Layout
    $printQuo .= "\n\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t\t\t\t<td align='center'><a href='pos-quote-new.php'>New POS Quote</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t\t\t\t<td align='center'><a href='main.php'>Main Menu</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>";
    return $printQuo;
}
コード例 #10
0
function confirm($catid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($catid, "num", 1, 50, "Invalid stock category id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>-" . $e["msg"] . "<br>";
        }
        return $confirm;
    }
    # Select Stock
    db_connect();
    $sql = "SELECT * FROM stockcat WHERE catid = '{$catid}' AND div = '" . USER_DIV . "'";
    $catRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($catRslt) < 1) {
        return "<li> Invalid Stock ID.";
    } else {
        $cat = pg_fetch_array($catRslt);
    }
    # get stock vars
    foreach ($cat as $key => $value) {
        ${$key} = $value;
    }
    // Layout
    $confirm = "<h3>Stock Category</h3>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t<tr><th width=40%>Field</th><th width=60%>Value</th></tr>\n\t\t\t<tr class='bg-odd'><td>Category Code</td><td>{$catcod}</td></tr>\n\t\t\t<tr class='bg-even'><td>Category Name</td></td><td>{$cat}</td></tr>\n\t\t\t<tr class='bg-odd'><td valign=top>Description</td><td><pre>{$descript}</pre></td></tr>\n\t\t</table>\n\t\t<p>\n\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=100>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class='bg-odd'><td><a href='stockcat-edit.php?catid={$catid}'>Edit</a></td></tr>\n\t\t\t<tr class='bg-even'><td><a href='stockcat-view.php'>View Stock Category</a></td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
    return $confirm;
}
コード例 #11
0
function display()
{
    extract($_REQUEST);
    $fields = array();
    $fields["from_year"] = date("Y");
    $fields["from_month"] = date("m");
    $fields["from_day"] = "01";
    $fields["to_year"] = date("Y");
    $fields["to_month"] = date("m");
    $fields["to_day"] = date("d");
    extract($fields, EXTR_SKIP);
    $from_date = "{$from_year}-{$from_month}-{$from_day}";
    $to_date = "{$to_year}-{$to_month}-{$to_day}";
    $sql = "SELECT assets.id, assets.des AS asset_des, asset_svdates.svdate,\r\n\t\t\t\tasset_svdates.des AS sv_des\r\n\t\t\tFROM cubit.asset_svdates\r\n\t\t\t\tLEFT JOIN cubit.assets\r\n\t\t\t\t\tON asset_svdates.asset_id=assets.id\r\n\t\t\tWHERE asset_svdates.svdate BETWEEN '{$from_date}' AND '{$to_date}'";
    $sv_rslt = db_exec($sql) or errDie("Unable to retrieve asset services.");
    $service_out = "";
    while ($sv_data = pg_fetch_array($sv_rslt)) {
        if (empty($sv_data["id"])) {
            continue;
        }
        $service_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$sv_data['asset_des']}</td>\r\n\t\t\t<td>" . getSerial($sv_data["id"]) . "</td>\r\n\t\t\t<td>{$sv_data['sv_des']}</td>\r\n\t\t\t<td>{$sv_data['svdate']}</td>\r\n\t\t</tr>";
    }
    if (empty($service_out)) {
        $service_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results found</li></td>\r\n\t\t</tr>";
    }
    $OUTPUT = "<center>\r\n\t<h3>Service Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td>&nbsp; <b>To</b> &nbsp;</td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Service Description</th>\r\n\t\t\t<th>Service Date</th>\r\n\t\t</tr>\r\n\t\t{$service_out}\r\n\t</table>";
    return $OUTPUT;
}
コード例 #12
0
function posttake_display()
{
    extract($_REQUEST);
    $fields = array();
    $fields["page"] = 1;
    extract($fields, EXTR_SKIP);
    $sql = "\n\t\tSELECT stock.stkid, stock.whid, stkcod, stkdes, bar, adjusted, qty \n\t\tFROM cubit.stock_take \n\t\t\tLEFT JOIN cubit.stock ON stock_take.stkid=stock.stkid \n\t\tWHERE page='{$page}' AND (adjusted='0' OR adjusted IS NULL) \n\t\tORDER BY stkcod ASC, whid";
    $stock_rslt = db_exec($sql) or errDie("Unable to retrieve stock.");
    $stock_out = "";
    while ($stock_data = pg_fetch_array($stock_rslt)) {
        db_conn("exten");
        $get_wh = "SELECT whname FROM warehouses WHERE whid = '{$stock_data['whid']}' LIMIT 1";
        $run_wh = db_exec($get_wh) or errDie("Unable to get warehouse information.");
        if (pg_numrows($run_wh) < 1) {
            $whname = "Default";
        } else {
            $whname = trim(pg_fetch_result($run_wh, 0, 0));
        }
        $stock_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stock_data['bar']}</td>\n\t\t\t\t<td>{$whname}</td>\n\t\t\t\t<td>{$stock_data['stkcod']}</td>\n\t\t\t\t<td>{$stock_data['stkdes']}</td>\n\t\t\t\t<td align='center'><input type='text' name='qty[{$stock_data['stkid']}]' value='{$stock_data['qty']}' size='3' style='text-align: center' /></td>\n\t\t\t\t<td><input type='submit' name='update[{$stock_data['stkid']}]' value='OK' /></td>\n\t\t\t</tr>";
    }
    if (empty($stock_out)) {
        $stock_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='5'>No results found.</td>\n\t\t\t</tr>";
    }
    $OUTPUT = "\n\t\t<center>\n\t\t<h3>Stock Take</h3>\n\t\t<form method='POST' action='" . SELF . "'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Page</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='text' name='page' value='{$page}' size='3' style='font-weight: bold; text-align: center' /></td>\n\t\t\t\t<td><input type='submit' value='OK' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<form method='POST' action='" . SELF . "'>\n\t\t\t<input type='hidden' name='key' value='take_update' />\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Barcode</th>\n\t\t\t\t<th>Store</th>\n\t\t\t\t<th>Stock Code</th>\n\t\t\t\t<th>Stock Description</th>\n\t\t\t\t<th>Quantity</th>\n\t\t\t\t<th>&nbsp;</th>\n\t\t\t</tr>\n\t\t\t{$stock_out}\n\t\t</table>\n\t\t<input type='submit' name='button[adjustments]' value='Adjustments' />\n\t\t</form>\n\t\t</center>";
    return $OUTPUT;
}
コード例 #13
0
function get_current_setting()
{
    db_connect();
    $get_list = "SELECT * FROM non_purchases_account_list";
    $run_list = db_exec($get_list) or errDie("Unable to get account lisit information.");
    if (pg_numrows($run_list) > 0) {
        $account_list = "\n\t\t\t<tr>\n\t\t\t\t<th>Account</th>\n\t\t\t\t<th>Options</th>\n\t\t\t</tr>";
        while ($aarr = pg_fetch_array($run_list)) {
            $account_list .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$aarr['accname']}</td>\n\t\t\t\t\t<td><input type='submit' name='remove[{$aarr['accid']}]' value='Remove'></td>\n\t\t\t\t</tr>";
        }
    }
    $cur_setting = getCsetting("USE_NON_PURCHASES_ACCOUNTS");
    $yes_setting = "";
    $no_setting = "";
    if (!isset($cur_setting) or strlen($cur_setting) < 1) {
        $no_setting = "checked='yes'";
    } else {
        if ($cur_setting == "yes") {
            $yes_setting = "checked";
        } else {
            $no_setting = "checked";
        }
    }
    $display = "\n\t\t<h2>Accounts to Display for Non Stock Purchases</h2>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Use These Accounts Only</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='radio' name='setting' value='yes' {$yes_setting}> Yes\n\t\t\t\t\t<input type='radio' name='setting' value='no' {$no_setting}> No\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td align='right'><input type='submit' name='save' value='Save'></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<br>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Add Account</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'>" . mkAccSelect("newaccount", $newaccount) . " <input type='submit' name='add' value='Add Account'></td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t{$account_list}\n\t\t</table>\n\t\t</form>";
    return $display;
}
コード例 #14
0
function remove($_POST)
{
    extract($_POST);
    $id += 0;
    db_conn('crm');
    $Sl = "SELECT * FROM tokens WHERE id='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to get data from system.");
    if (pg_numrows($Ry) < 1) {
        return "Invalid query.";
    }
    $data = pg_fetch_array($Ry);
    $Sl = "SELECT * FROM token_actions WHERE token='{$id}'";
    $Rs = db_exec($Sl) or errDie("Unable to get data from system.");
    $Sl = "SELECT * FROM archived_actions WHERE token='{$id}'";
    $Ri = db_exec($Sl) or errDie("Unable to get data from system.");
    $Sl = "INSERT INTO closedtokens (tid,userid,username,teamid,cat,catid,openby,opendate,lastdate,csct,csc,name,accnum,\r\n\tcon,tel,cell,fax,email,address,sub,notes,closedate,closeby,closebyid)\r\n\tVALUES ('{$id}','{$data['userid']}','{$data['username']}','{$data['teamid']}','{$data['cat']}','{$data['catid']}','{$data['openby']}',\r\n\t'{$data['opendate']}','{$data['lastdate']}','{$data['csct']}','{$data['csc']}','{$data['name']}','{$data['accnum']}','{$data['con']}',\r\n\t'{$data['tel']}','{$data['cell']}','{$data['fax']}','{$data['email']}','{$data['address']}','{$data['sub']}','{$data['notes']}',\r\n\t'" . date("Y-m-d") . "','" . USER_NAME . "','" . USER_ID . "')";
    $Ry = db_exec($Sl) or errDie("Unable to insert query record.");
    while ($adata = pg_fetch_array($Rs)) {
        $Sl = "INSERT INTO closed_token_actions (token,action,donedate,donetime,doneby,donebyid)\r\n\t\tVALUES ('{$id}','{$adata['action']}','{$adata['donedate']}','{$adata['donetime']}','{$adata['doneby']}','{$adata['donebyid']}')";
        $Ry = db_exec($Sl) or errDie("Unable to insert token action.");
    }
    while ($adata = pg_fetch_array($Ri)) {
        $Sl = "INSERT INTO closed_token_actions (token,action,donedate,donetime,doneby,donebyid)\r\n\t\tVALUES ('{$id}','{$adata['action']}','{$adata['donedate']}','{$adata['donetime']}','{$adata['doneby']}','{$adata['donebyid']}')";
        $Ry = db_exec($Sl) or errDie("Unable to insert token action(archived).");
    }
    $Sl = "DELETE FROM tokens WHERE id='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to remove query.");
    $Sl = "DELETE FROM token_actions WHERE token='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to remove query actions.");
    $Sl = "DELETE FROM archived_actions WHERE token='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to remove archived query actions.");
    header("Location: tokens-manage.php");
    exit;
}
コード例 #15
0
function rem($clasid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($clasid, "num", 1, 50, "Invalid Classification id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>-" . $e["msg"] . "<br>";
        }
        return $confirm;
    }
    # Select Stock
    db_connect();
    $sql = "SELECT * FROM stockclass WHERE clasid = '{$clasid}' AND div = '" . USER_DIV . "'";
    $clasRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($clasRslt) < 1) {
        return "<li> Invalid Category ID.";
    } else {
        $clas = pg_fetch_array($clasRslt);
    }
    $enter = "<h3>Remove Classification</h3>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<input type=hidden name=key value=write>\r\n\t<input type=hidden name=clasid value='{$clas['clasid']}'>\r\n\t<input type=hidden name=classname value='{$clas['classname']}'>\r\n\t<input type=hidden name=classcode value='{$clas['classcode']}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Classification Code</td><td align=center>{$clas['classcode']}</td></tr>\r\n\t<tr class='bg-even'><td>Classification</td><td align=center>{$clas['classname']}</td></tr>\r\n\t<tr><td colspan=2 align=right><input type=submit value='Remove &raquo;'></td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t</table></form>\r\n\t<p>\r\n\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t<tr><th>Quick Links</th></tr>\r\n\t<tr class='bg-odd'><td><a href='stockclass-view.php'>View Classifications</a></td></tr>\r\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $enter;
}
コード例 #16
0
function view_data($_GET)
{
    foreach ($_GET as $key => $value) {
        ${$key} = $value;
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 100, "Invalid num.");
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class=err>" . $e["msg"];
        }
        $confirmCust .= "<p><input type=button onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
        return $confirmCust;
    }
    db_conn('cubit');
    $user = USER_NAME;
    $Sql = "SELECT * FROM cf WHERE (id='{$id}' AND div = '" . USER_DIV . "')";
    $Rslt = db_exec($Sql) or errDie("Unable to access database.");
    if (pg_numrows($Rslt) < 1) {
        return "entry not Found";
    }
    $Data = pg_fetch_array($Rslt);
    foreach ($Data as $key => $value) {
        ${$key} = $value;
    }
    $view_data = "<h3>Confirm cash flow budget entry</h3>\n\t<form action='" . SELF . "' method=post>\n\t<input type=hidden name=key value=confirm>\n\t<input type=hidden name=id value='{$id}'>\n\t<table cellpadding=0 cellspacing=0>\n\t<tr valign=top><td>\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th colspan=2>Asset Details</th></tr>\n\t<tr class='bg-even'><td>Description</td><td>{$description}</td></tr>\n\t<tr class='bg-odd'><td>Date Bought</td><td>{$date}</td></tr>\n\t<tr class='bg-even'><td>Amount</td><td>{$amount}</td></tr>\n\t</table>\n\t</td></tr>\n\t<tr><td valign=bottom><input type=submit value='Remove &raquo;'></td></tr>\n\t</table>\n\t<p>\n\t<table border=0 cellpadding='2' cellspacing='1'>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class='bg-odd'><td><a href='cfe-view.php'>View Assets</a></td></tr>\n\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $view_data;
}
コード例 #17
0
function consultarUsuarioLoginSenha($name, $password, $conn)
{
    $query = "SELECT DISTINCT\n\t\t\t\t\t*\n\t\t\t\t  FROM \n\t\t\t\t\tusuarios u\n\t\t\t\t  WHERE\n\t\t\t\t\tu.nome = '" . $name . "' AND\n\t\t\t\t\tu.senha = '" . $password . "'";
    $queryResut = pg_query($conn, $query);
    $queryResut = pg_fetch_array($queryResut);
    return $queryResut;
}
コード例 #18
0
function printGrp()
{
    # Set up table to display in
    $printGrp = "\r\n    <h3>Asset Groups</h3>\r\n    <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n    <tr><th>Group</th><th>Cost Account</th><th>Accumulated Depreciation Account</th><th>Depreciation Account</th><th colspan=2>Options</th></tr>";
    # connect to database
    db_connect();
    # Query server
    $i = 0;
    $sql = "SELECT * FROM assetgrp WHERE div = '" . USER_DIV . "' ORDER BY grpname ASC";
    $GrpRslt = db_exec($sql) or errDie("Unable to retrieve Asset Groups from database.");
    if (pg_numrows($GrpRslt) < 1) {
        return "\r\n\t\t\t\t<li> There are no Assets Groups in Cubit.</li><br>" . mkQuickLinks(ql("assetgrp-new.php", "Add Asset Group"), ql("assetgrp-view.php", "View Asset Groups"));
    }
    while ($Grp = pg_fetch_array($GrpRslt)) {
        # get ledger account name(cost)
        core_connect();
        $sql = "SELECT accname FROM accounts WHERE accid = '{$Grp['costacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $acccost = pg_fetch_array($accRslt);
        # get ledger account name(accum dep)
        $sql = "SELECT accname FROM accounts WHERE accid = '{$Grp['accdacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $acdacc = pg_fetch_array($accRslt);
        # get ledger account name(dep)
        $sql = "SELECT accname FROM accounts WHERE accid = '{$Grp['depacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $accdep = pg_fetch_array($accRslt);
        # alternate bgcolor
        $printGrp .= "<tr class='" . bg_class() . "'><td>{$Grp['grpname']}</td><td>{$acccost['accname']}</td><td>{$acdacc['accname']}</td><td>{$accdep['accname']}</td><td><a href='assetgrp-edit.php?grpid={$Grp['grpid']}'>Edit</a></td>";
        $printGrp .= "<td><a href='assetgrp-rem.php?grpid={$Grp['grpid']}'>Remove</a></td></tr>";
        $i++;
    }
    $printGrp .= "</table>\r\n    <p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n        <tr><td><br></td></tr>\r\n        <tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='assetgrp-new.php'>Add Asset Group</a></td></tr>\r\n\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t</table>";
    return $printGrp;
}
コード例 #19
0
function edit($id)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 50, "Invalid interest bracket id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>-" . $e["msg"] . "<br>";
        }
        return $confirm;
    }
    db_connect();
    # get info
    $sql = "SELECT * FROM intbracs WHERE id = '{$id}'";
    $intRslt = db_exec($sql) or errDie("Unable to select interest bracket from database.", SELF);
    if (pg_numrows($intRslt) > 0) {
        # get result
        $int = pg_fetch_array($intRslt);
    } else {
        return "Invalid interest bracket ID.";
    }
    $enter = "<h3>Edit Interest bracket</h3>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=confirm>\r\n\t<input type=hidden name=id value='{$id}'>\r\n\t<tr><th>Field</th><th>Value</th></tr>\r\n\t<tr class='bg-odd'><td>Minimum</td><td align=center><table><tr><td>" . CUR . "</td><td><input type=text size=10 name=min value='{$int['min']}' class=right></td></tr></table></td></tr>\r\n\t<tr class='bg-even'><td>Maximum</td><td align=center><table><tr><td>" . CUR . "</td><td><input type=text size=10 name=max value='{$int['max']}' class=right></td></tr></table></td></tr>\r\n\t<tr class='bg-odd'><td>Percentage</td><td align=center><table><tr><td><input type=text size=10 name=percentage value='{$int['percentage']}' class=right></td><td>%</td></tr></table></td></tr>\r\n\t<tr><td><br></td></tr>\r\n\t<tr><td colspan=2 align=right><input type=submit value='Confirm &raquo;'></td></tr>\r\n\t</form>\r\n\t</table>\r\n\t<p>\r\n\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr bgcolor='#88BBFF'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $enter;
}
コード例 #20
0
function printUserLog()
{
    //db connection
    $conn = pg_connect(HOST . " " . DBNAME . " " . USERNAME . " " . PASSWORD) or die('Could not connect: ' . pg_last_error());
    //query the database
    $result = pg_prepare($conn, "getLog", "SELECT * FROM lab8.log\n\t\t\tWHERE username LIKE \$1") or die("getLog prepare fail: " . pg_last_error());
    $result = pg_execute($conn, "getLog", array($_SESSION['user'])) or die("getLog execute fail: " . pg_last_error());
    //Printing results in HTML
    echo "<br>There where <em>" . pg_num_rows($result) . "</em> rows returned<br><br>\n";
    echo "<table class='tablestuff' border='1'>";
    //account for added form row
    echo "<tr>";
    //checking the number of fields return to populate header
    $numFields = pg_num_fields($result);
    //populating the header
    for ($i = 0; $i < $numFields; $i++) {
        $fieldName = pg_field_name($result, $i);
        echo "<th width=\"135\">" . $fieldName . "</th>\n";
    }
    echo "</tr>";
    //populating table with the results
    while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
        echo "\t<tr>\n";
        foreach ($line as $col_value) {
            echo "\t\t<td>{$col_value}</td>\n";
        }
        echo "\t</tr>\n";
    }
    echo "</table>\n";
    // Free resultset
    pg_free_result($result);
    //close connection
    pg_close($conn);
}
コード例 #21
0
function start_maint()
{
    custom_db("cubit");
    pg_exec("VACUUM");
    pg_exec("VACUUM FULL");
    pg_exec("VACUUM ANALYZE");
    pg_exec("REINDEX DATABASE cubit");
    $get_comps = "SELECT * FROM companies WHERE status = 'active'";
    $run_comps = pg_exec($get_comps) or errDie("Unable to get active companies");
    if (pg_numrows($run_comps) < 1) {
        return "<li class='err'>No Active Companies Found To Process.</li>";
    } else {
        #process the blk1 db
        custom_db("cubit_blk1");
        pg_exec("VACUUM");
        pg_exec("VACUUM FULL");
        pg_exec("VACUUM ANALYZE");
        pg_exec("REINDEX DATABASE cubit_blk1");
        #process the active companies
        while ($carr = pg_fetch_array($run_comps)) {
            $company = "cubit_" . $carr['code'];
            custom_db("{$company}");
            pg_exec("VACUUM");
            pg_exec("VACUUM FULL");
            pg_exec("VACUUM ANALYZE");
            pg_exec("REINDEX DATABASE {$company}");
        }
    }
    $display = "\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<td><li class='err'>Process Has Been Completed.</li></td>\r\n\t\t\t</tr>\r\n\t\t</table>";
    return $display;
}
コード例 #22
0
function enter($err)
{
    global $_GET;
    extract($_GET);
    $fields["privilege_owner"] = "";
    $fields["privilege"] = "";
    foreach ($fields as $key => $value) {
        if (!isset(${$key})) {
            ${$key} = $value;
        }
    }
    db_conn("cubit");
    $sql = "SELECT username FROM users ORDER BY username";
    $rslt = db_exec($sql) or errDie("Error reading user list.");
    $users = array();
    $users["0"] = "SELECT USER";
    while ($row = pg_fetch_array($rslt)) {
        $users[$row["username"]] = $row["username"];
    }
    $select_user = extlib_cpsel("privilege_owner", $users, $privilege_owner);
    $select_privilege = "\r\n\t\t<select name=privilege>\r\n\t\t\t<option value='R' " . ($privilege == "R" ? "selected" : "") . ">Read</option>\r\n\t\t\t<option value='W' " . ($privilege == "W" ? "selected" : "") . ">Write</option>\r\n\t\t</select>";
    $OUTPUT = "\r\n\t<h3>Diary Privileges</h3>\r\n\t{$err}\r\n\t<form method=post action='" . SELF . "'>\r\n\t<input type=hidden name=key value=write>\r\n\t<table cellpadding='2' cellspacing='0' class='shtable'>\r\n\t<tr>\r\n\t\t<th colspan=3>Details</th>\r\n\t</tr>\r\n\t<tr class='bg-odd'>\r\n\t\t<td>{$select_user}</td>\r\n\t\t<td colspan=2>{$select_privilege}</td>\r\n\t</tr>\r\n\t<tr>\r\n\t\t<th>Username</th>\r\n\t\t<th>Privilege</th>\r\n\t\t<th>Del</th>\r\n\t</tr>";
    db_conn("cubit");
    $sql = "SELECT * FROM diary_privileges WHERE diary_owner='" . USER_NAME . "'";
    $rslt = db_exec($sql) or errDie("Error reading diary privileges.");
    $i = 1;
    while ($row = pg_fetch_array($rslt)) {
        $OUTPUT .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$row['priv_owner']}</td>\r\n\t\t\t<td>{$row['privilege']}</td>\r\n\t\t\t<td><input type=checkbox name='del[{$row['id']}]'></td>\r\n\t\t</tr>";
    }
    $OUTPUT .= "\r\n\t</table>\r\n\t<p></p>\r\n\t<input type=submit value='Update'>\r\n\t</form>";
    return $OUTPUT;
}
コード例 #23
0
function rem($calloutpid)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($calloutpid, "num", 1, 50, "Invalid Call Out Person id.");
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class=err>-" . $e["msg"] . "<br>";
        }
        return $confirm;
    }
    # Select Stock
    db_conn("exten");
    $sql = "SELECT * FROM calloutpeople WHERE calloutpid = '{$calloutpid}' AND div = '" . USER_DIV . "'";
    $salespRslt = db_exec($sql) or errDie("Unable to access databse.", SELF);
    if (pg_numrows($salespRslt) < 1) {
        return "<li> Invalid Call Out Person ID.";
    } else {
        $calloutp = pg_fetch_array($salespRslt);
    }
    $enter = "\r\n\t\t\t<h3>Confirm Remove Call Out Person</h3>\r\n\t\t\t<form action='" . SELF . "' method='post'>\r\n\t\t\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t\t\t<input type='hidden' name='key' value='write'>\r\n\t\t\t\t<input type='hidden' name='calloutpid' value='{$calloutp['calloutpid']}'>\r\n\t\t\t\t<input type='hidden' name='calloutp' value='{$calloutp['calloutp']}'>\r\n\t\t\t\t<input type='hidden' name='telno' value='{$calloutp['telno']}'>\r\n\t\t\t\t<tr><th>Field</th><th>Value</th></tr>\r\n\t\t\t\t<tr class='bg-odd'><td>Call Out Person</td><td>{$calloutp['calloutp']}</td></tr>\r\n\t\t\t\t<tr class='bg-even'><td>Contact Number</td><td>{$calloutp['telno']}</td></tr>\r\n\t\t\t\t<tr><td><br></td></tr>\r\n\t\t\t\t<tr><td colspan=2 align=right><input type=submit value='Remove &raquo;'></td></tr>\r\n\t\t\t</table></form>\r\n\t\t\t<p>\r\n\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t\t<tr class='bg-odd'><td><a href='calloutp-view.php'>View Call Out Person</a></td></tr>\r\n\t\t\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t\t</table>";
    return $enter;
}
コード例 #24
0
ファイル: db.class_bodega.php プロジェクト: japeto/PollSystem
 public function obtenerArreglo($result)
 {
     if (!is_resource($result)) {
         return false;
     }
     return pg_fetch_array($result);
 }
コード例 #25
0
 public function index()
 {
     /*if($this->client_logon)
     		{*/
     $conn = pg_connect("host=192.168.17.2 port=5432 dbname=sms user=postgres password=dbr4H4514");
     $sql = "SELECT * FROM sentitems";
     $query = pg_query($sql);
     $rows = array();
     $i = 0;
     while ($row = pg_fetch_array($query)) {
         $rows[$i]['destinationnumber'] = $row['destinationnumber'];
         $rows[$i]['textdecoded'] = $row['textdecoded'];
         $rows[$i]['creatorid'] = $row['creatorid'];
         $i++;
     }
     $this->data['items'] = $rows;
     $this->data['title'] = "Log Pengiriman Pesan";
     $this->load->view('v_header', $this->data);
     $this->load->view('v_sms', $this->data);
     $this->load->view('v_footer', $this->data);
     /*}
     		else
     		{
     			redirect('login');
     		}*/
 }
コード例 #26
0
ファイル: DB.php プロジェクト: rczeus/Rapid-Coffee
	function fetch($result=-1)
	{
		if ($result==-1)
			return pg_fetch_array($this->result,NULL,PGSQL_ASSOC);
		
		return pg_fetch_array($result,NULL,PGSQL_ASSOC);
	}
コード例 #27
0
function display()
{
    extract($_REQUEST);
    $fields = array();
    $fields["from_year"] = date("Y");
    $fields["from_month"] = date("m");
    $fields["from_day"] = date("d");
    $fields["to_year"] = date("Y");
    $fields["to_month"] = date("m");
    $fields["to_day"] = date("d");
    extract($fields, EXTR_SKIP);
    $from_date = "{$from_year}-{$from_month}-{$from_day}";
    $to_date = "{$to_year}-{$to_month}-{$to_day}";
    $sql = "\n\tSELECT invnum, cash, cheque, credit, sdate, cusname\n\tFROM cubit.nons_invoices\n\tWHERE sdate BETWEEN '{$from_date}' AND '{$to_date}' AND hire_invnum!='0'";
    $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices.");
    $total_cash = 0;
    $total_cheque = 0;
    $total_credit = 0;
    $inv_out = "";
    while ($inv_data = pg_fetch_array($inv_rslt)) {
        $inv_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$inv_data['sdate']}</td>\n\t\t\t<td align='center'>{$inv_data['invnum']}</td>\n\t\t\t<td>{$inv_data['cusname']}</td>\n\t\t\t<td align='right'>" . sprint($inv_data["cash"]) . "</td>\n\t\t\t<td align='right'>" . sprint($inv_data["cheque"]) . "</td>\n\t\t\t<td align='right'>" . sprint($inv_data["credit"]) . "</td>\n\t\t</tr>";
        $total_cash += $inv_data["cash"];
        $total_cheque += $inv_data["cheque"];
        $total_credit += $inv_data["credit"];
    }
    if (empty($inv_out)) {
        $inv_out = "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='6'><li>No results found.</li></td>\n\t\t</tr>";
    }
    $OUTPUT = "\n\t<center>\n\t<h3>Daily Hire Cashup Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td>&nbsp; <b>To</b> &nbsp;</td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Date</th>\n\t\t\t<th>Invoice No</th>\n\t\t\t<th>Customer</th>\n\t\t\t<th>Cash</th>\n\t\t\t<th>Cheque</th>\n\t\t\t<th>Credit Card</th>\n\t\t</tr>\n\t\t{$inv_out}\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='3'><b>Total</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_cash) . "</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_cheque) . "</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_credit) . "</b></td>\n\t</table>\n\t</center>";
    return $OUTPUT;
}
コード例 #28
0
function OUTPUT($_POST)
{
    extract($_POST);
    $typeid = remval($typeid);
    # Set up table to display in
    $OUTPUT .= "<td valign=top width='33%'>\r\n<table border=0 width='90%'>\r\n<tr><td align=center nowrap><h3>Document Data</h3></td></tr>\r\n<tr><th>Type</th><th>Ref</th><th>Document</th><th>Date</th><th>Description</th><th>Filename</th></tr>";
    if ($typeid != '0') {
        $whe = "AND typeid='{$typeid}' ";
    } else {
        $whe = "";
    }
    # Connect to database
    //db_conn (YR_DB);
    db_conn("yr2");
    # Query server
    $i = 0;
    $sql = "SELECT * FROM documents WHERE div = '" . USER_DIV . "' {$whe} ORDER BY docname ASC";
    $docRslt = db_exec($sql) or errDie("Unable to retrieve Documents from database.");
    if (pg_numrows($docRslt) < 1) {
        return "<li>There are no Documents in Cubit.</li>\r\n\t\t\t <p>\r\n\t\t\t <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t<tr><td><br></td></tr>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docadd.php'>Add Document</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docview.php'>View Documents</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docman-index.php'>Back</a></td></tr>\r\n\t\t</table>";
    }
    while ($doc = pg_fetch_array($docRslt)) {
        $OUTPUT .= "<tr class='" . bg_class() . "'><td>{$doc['typename']}</td><td>{$doc['docref']}</td><td>{$doc['docname']}</td><td>{$doc['docdate']}</td><td>{$doc['descrip']}</td><td>{$doc['filename']}</td><td><a href='docedit.php?docid={$doc['docid']}'>Edit</a></td>";
        $OUTPUT .= "<td><a href='docdload.php?docid={$doc['docid']}'>Download</a></td><td><a href='docrem.php?docid={$doc['docid']}'>Remove</a></td></tr>";
        $i++;
    }
    $OUTPUT .= "</table></td>";
    return $OUTPUT;
}
コード例 #29
0
function do_search()
{
    global $_POST;
    extract($_POST);
    db_connect();
    $search_sql = "SELECT * FROM training WHERE course_name LIKE '%{$search_string}%' OR other_details LIKE '%{$search_string}%' LIMIT 25";
    $run_search = db_exec($search_sql);
    if (pg_numrows($run_search) < 1) {
        $results = "";
    } else {
        $results = "";
        $i = 0;
        while ($tarr = pg_fetch_array($run_search)) {
            $empval = $tarr['empnum'];
            $tarr['empnum'] = $empval + 0;
            #get this employee name
            $get_emp = "SELECT fnames,sname FROM employees WHERE empnum = '{$tarr['empnum']}' LIMIT 1";
            $run_emp = db_exec($get_emp);
            if (pg_numrows($run_emp) < 1) {
                $employee_name = "Unknown";
            } else {
                $earr = pg_fetch_array($run_emp);
                $employee_name = "{$earr['fnames']} {$earr['sname']}";
            }
            $results .= "\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>{$employee_name}</td>\n\t\t\t\t\t\t<td>{$tarr['course_name']}</td>\n\t\t\t\t\t\t<td>{$tarr['date_date']}</td>\n\t\t\t\t\t\t<td>{$tarr['commence_date']}</td>\n\t\t\t\t\t\t<td>{$tarr['completed_date']}</td>\n\t\t\t\t\t\t<td>{$tarr['competent_date']}</td>\n\t\t\t\t\t\t<td>" . nl2br($tarr['other_details']) . "</td>\n\t\t\t\t\t</tr>";
            $i++;
        }
    }
    $display = "\n\t\t\t<h2>Search Results</h2>\n\t\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Employee</th>\n\t\t\t\t\t<th>Course Name</th>\n\t\t\t\t\t<th>Enter Date</th>\n\t\t\t\t\t<th>Start Date</th>\n\t\t\t\t\t<th>End Date</th>\n\t\t\t\t\t<th>Competent Date</th>\n\t\t\t\t\t<th>Other Details</th>\n\t\t\t\t</tr>\n\t\t\t\t{$results}\n\t\t\t</table>\n\t\t";
    return $display;
}
コード例 #30
-1
ファイル: functions.php プロジェクト: nitr0man/fiberms
function PQuery($query)
{
    require "config.php";
    global $connection;
    //error_log( $query );
    //print $query."<br>";
    $res = pg_query($connection, $query);
    if (!$res) {
        //print_r (debug_backtrace());
        list(, $caller) = debug_backtrace(false);
        error_log($caller['function'] . ', ' . $caller['line'] . ": {$query}");
        $result['count'] = 0;
        $result['rows'] = NULL;
        $result['error'] = pg_last_error($connection);
        return $result;
    }
    $result['count'] = pg_num_rows($res);
    $i = 0;
    $rowarr = array();
    while ($row = pg_fetch_array($res, NULL, PGSQL_ASSOC)) {
        $rowarr[$i++] = $row;
    }
    pg_free_result($res);
    $result['rows'] = $rowarr;
    return $result;
}