function get_range($err = "") { $blocked_range_from = getCSetting("BLOCKED_FROM"); $blocked_range_to = getCSetting("BLOCKED_TO"); if (!isset($blocked_range_from) or strlen($blocked_range_from) < 1) { $blocked_range_from = date("Y-m-d"); } if (!isset($blocked_range_to) or strlen($blocked_range_to) < 1) { $blocked_range_to = date("Y-m-d"); } $from_arr = explode("-", $blocked_range_from); $to_arr = explode("-", $blocked_range_to); $from_year = $from_arr[0]; $from_month = $from_arr[1]; $from_day = $from_arr[2]; $to_year = $to_arr[0]; $to_month = $to_arr[1]; $to_day = $to_arr[2]; // $from_year = substr ($blocked_range_from,0,4); // $from_month = substr ($blocked_range_from,5,2); // $from_day = substr ($blocked_range_from,8,2); // // $to_year = substr ($blocked_range_to,0,4); // $to_month = substr ($blocked_range_to,5,2); // $to_day = substr ($blocked_range_to,8,2); $display = "\n\t\t<h4>Set Date Range to Block Transactions In</h4>\n\t\t{$err}\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>From Date</th>\n\t\t\t\t<th>To Date</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td align='right' colspan='2'><input type='submit' value='Save Setting'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>"; return $display; }
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; }
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; }
function slctOpt($errors = "") { global $_POST; extract($_POST); $fields = array(); $fields["budname"] = "Financial Budget"; foreach ($fields as $var_name => $value) { if (!isset(${$var_name})) { ${$var_name} = $value; } } global $BUDFOR, $TYPES, $PERIODS; global $MONPRD, $PRDMON; $typesel = extlib_mksel("budtype", $TYPES); $fromprdsel = extlib_cpsel("fromprd", $PERIODS, $PRDMON[1]); $toprdsel = extlib_cpsel("toprd", $PERIODS, $PRDMON[12]); if ($budname == "Financial Budget") { $bud_fin = "checked"; $bud_spec = ""; } else { $bud_fin = ""; $bud_spec = "checked"; } // Options Layout $Opts = "<center>\n\t<h3> New Monthly Budget</h3>\n\t<form action='" . SELF . "' method=post name=form>\n\t<input type=hidden name=key value=details>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' align=center>\n\t<tr>\n\t\t<td>{$errors}</td>\n\t</tr>\n\t<tr>\n\t\t<th colspan=3>Details</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Budget</td>\n\t\t<td>\n\t\t\t<input type='radio' name='budname' value='Financial Budget' {$bud_fin}>Financial Budget<b> | </b>\n\t\t\t<input type='radio' name='budname' value='Special Budget' {$bud_spec}>Special Budget\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan='3'><hr /></td>\n\t</tr>\n\t<tr>\n\t\t<th colspan=3>Create Budget</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Budget For</td>\n\t\t<td>\n\t\t\t<input type=radio name=budfor value=cost>Cost Centers \n\t\t\t<input type=radio name=budfor value=acc checked=yes>Accounts\n\t\t</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Budget Type</td>\n\t\t<td>{$typesel}</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Budget Period</td>\n\t\t<td>{$fromprdsel} to {$toprdsel}</td>\n\t</tr>"; if (PYR_DB) { $Opts .= "<tr class='" . bg_class() . "'>\n\t\t\t<td>Use Previous Year Figures</td>\n\t\t\t<td><input type='checkbox' name='import' /></td>\n\t\t</tr>\n\t\t" . TBL_BR . "\n\t\t<tr>\n\t\t\t<th colspan='3'>'Use Previous Year Figures' Options</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='3' class='err'>This option is only used to create a budget for accounts,\n\t\t\t\tnot Cost Centers.</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>Increase Percentage</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' name='incperc' size='3' value='0' /> %\n\t\t\t\t<span class='err'>Use negative value for decrease.</span>\n\t\t\t</td>\n\t\t</tr>"; } $Opts .= "\n\t" . TBL_BR . "\n\t<tr>\n\t\t<td align=right><input type=button value='« Back' onClick='javascript:history.back()'></td>\n\t\t<td align=right><input type=submit value='Continue »'></td>\n\t</tr>\n\t</table>\n\t</form>\n\t<p>\n\t<table border=0 cellpadding='2' cellspacing='1' width=15%>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<tr class='bg-odd'><td align=center><a href='budget-view.php'>View Budgets</td></tr>\n\t\t<tr class='bg-odd'><td align=center><a href='../main.php'>Main Menu</td></tr>\n\t</table>"; return $Opts; }
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> <b>To</b> </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; }
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> <b>To</b> </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; }
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; }
function show_branches($active_search = FALSE) { db_connect(); $get_branches = "SELECT * FROM branches_data ORDER BY branch_name"; $run_branches = db_exec($get_branches) or errDie("Unable to get branch information."); if (pg_numrows($run_branches) < 1) { $listing = "\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td colspan='7'>No Branches Found.</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t"; } else { $listing = ""; while ($barr = pg_fetch_array($run_branches)) { if ($active_search == FALSE) { $status = "Unknown"; } else { if ($connect_test = @fsockopen("{$barr['branch_ip']}", 80, $errno, $errstr, 4)) { #online ... $status = "Online"; } else { $status = "Offline"; } } $get_username = "******"; $run_username = db_exec($get_username) or errDie("Unable to get user information."); if (pg_numrows($run_username) < 1) { } $listing .= "\n\t\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t\t<td>{$barr['branch_name']}</td>\n\t\t\t\t\t\t\t\t<td>" . nl2br($barr['branch_desc']) . "</td>\n\t\t\t\t\t\t\t\t<td>{$barr['branch_username']}</td>\n\t\t\t\t\t\t\t\t<td>{$barr['branch_contact']}</td>\n\t\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t\t<td>{$barr['branch_ip']}</td>\n\t\t\t\t\t\t\t\t<td>{$status}</td>\n\t\t\t\t\t\t\t\t<td><a href='branches-rem.php?bid={$barr['id']}'>Remove</a></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t"; } } $display = "\n\t\t\t\t\t<h3>Current Branches on Cubit</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<input type='hidden' name='key' value='confirm'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Branch Name</th>\n\t\t\t\t\t\t\t<th>Branch Description</th>\n\t\t\t\t\t\t\t<th>Branch Username</th>\n\t\t\t\t\t\t\t<th>Branch Contact</th>\n\t\t\t\t\t\t\t<th>Local Username</th>\n\t\t\t\t\t\t\t<th>Branch IP</th>\n\t\t\t\t\t\t\t<th>Status</th>\n\t\t\t\t\t\t\t<th>Remove</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t{$listing}\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><input type='submit' value='Update Status'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</form>\n\t\t\t\t\t</table>\n\t\t\t\t"; return $display; }
function display() { extract($_REQUEST); if (user_is_admin(USER_ID)) { $user_id = $_REQUEST["user_id"]; } else { $user_id = USER_ID; } // Retrieve user information $sql = "SELECT * FROM cubit.users WHERE userid='{$user_id}'"; $user_rslt = db_exec($sql) or errDie("Unable to retrieve user."); $user_data = pg_fetch_array($user_rslt); define("SECONDS_IN_7_DAYS", 604800); $seven_days = date("Y-m-d", time() + SECONDS_IN_7_DAYS); // Retrieve orders for expired orders and orders that will expire within // 7 days $sql = "SELECT * FROM cubit.sorders\n\t\t\tWHERE ddate<'{$seven_days}' AND accepted='n' AND done='y'\n\t\t\t\tAND username='******'username']}'\n\t\t\tORDER BY ddate DESC"; $sorder_rslt = db_exec($sql) or errDie("Unable to retrieve sales orders."); $sorder_out = ""; while ($sorder_data = pg_fetch_array($sorder_rslt)) { $sorder_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$sorder_data['ddate']}</td>\n\t\t\t\t<td>{$sorder_data['odate']}</td>\n\t\t\t\t<td>{$sorder_data['cusname']} {$sorder_data['surname']}</td>\n\t\t\t\t<td>{$sorder_data['ordno']}</td>\n\t\t\t\t<td>{$sorder_data['cusname']}</td>\n\t\t\t\t<td>" . CUR . "{$sorder_data['discount']}</td>\n\t\t\t\t<td>" . CUR . "{$sorder_data['total']}</td>\n\t\t\t</tr>"; } if (empty($sorder_out)) { $sorder_out = "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='7'>No items found</td>\n\t\t</tr>"; } $OUTPUT = "\n\t\t<center>\n\t\t<h3>Sales Orders Past Due/Delivery Date</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Due Date</th>\n\t\t\t\t<th>Sales Order Date</th>\n\t\t\t\t<th>Customer</th>\n\t\t\t\t<th>Sales Order No</th>\n\t\t\t\t<th>Customer Order No</th>\n\t\t\t\t<th>Discount</th>\n\t\t\t\t<th>Total</th>\n\t\t\t</tr>\n\t\t\t{$sorder_out}\n\t\t</table>\n\t\t</center>"; return $OUTPUT; }
function printcheq() { // Set up table to display in $OUTPUT = "<h3>View Cheque Records</h3>\r\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n <form action='../bank/bank-bankall.php' method=post>\r\n <tr><th>Bank Name</th><th>Account Name</th><th>Date</th><th>Paid to/Received from</th><th>Description</th><th>Transaction Type</th><th>Amount</th><th>Account paid<br>/received from</th></tr>"; // Connect to database db_Connect(); $sql = "SELECT * FROM cashbook WHERE cheqnum > 0 and banked='no' AND div = '" . USER_DIV . "' ORDER BY date DESC"; $accntRslt = db_exec($sql) or errDie("ERROR: Unable to retrieve bank cheqque transaction details from database.", SELF); $numrows = pg_numrows($accntRslt); if ($numrows < 1) { $OUTPUT = "<li class=err> There are no outstanding bank cheque Records yet in Cubit."; require "../template.php"; } # display all bank cheques for ($i = 0; $i < $numrows; $i++) { $accnt = pg_fetch_array($accntRslt, $i); # get account name for account involved $accRslt = get("core", "accname", "accounts", "accid", $accnt['accinv']); $acc = pg_fetch_array($accRslt); # get account name for bank account db_connect(); $sql = "SELECT accname,bankname FROM bankacct WHERE bankid= '{$accnt['bankid']}' AND div = '" . USER_DIV . "'"; $bankRslt = db_exec($sql); $bank = pg_fetch_array($bankRslt); $OUTPUT .= "<tr class='" . bg_class() . "'><td>{$bank['bankname']}</td><td align=center>{$bank['accname']}</td><td align=center>{$accnt['date']}</td><td align=center>{$accnt['name']}</td><td>{$accnt['descript']}</td><td align=center>{$accnt['trantype']}</td><td align=center>" . CUR . " {$accnt['amount']}<td align=center>{$acc['accname']}</td></td>"; if ($accnt['banked'] == "no") { $OUTPUT .= "<td><input type=checkbox name='bank[]' value='{$accnt['cashid']}'> <a href='../bank/bank-bank.php?cashid={$accnt['cashid']}'>Bank</td><td><a href='../bank/cheq-cancel.php?cashid={$accnt['cashid']}'>Cancel</td></tr>"; } else { $OUTPUT .= "</tr>"; } } $OUTPUT .= "<tr><td colspan=8><br></td><td colspan=2><input type=submit value='Bank all selected'></td></tr></form></table>"; // all template to display the info and die require "../template.php"; }
function printDep() { # Set up table to display in $printDep = "\n\t\t<h3>View Employee Departments</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Department</th>\n\t\t\t\t<th colspan='2'>Options</th>\n\t\t\t</tr>"; # connect to database db_connect(); # Query server $i = 0; $sql = "SELECT * FROM departments ORDER BY department ASC"; $depRslt = db_exec($sql) or errDie("Unable to retrieve employee departments from database."); if (pg_numrows($depRslt) < 1) { return "<li>There are no employee departments in Cubit.</li>"; } while ($dep = pg_fetch_array($depRslt)) { $printDep .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'>{$dep['department']}</td>\n\t\t\t\t<td><a href='empdepartment-edit.php?id={$dep['id']}'>Edit</a></td>"; $sql = "SELECT * FROM employees WHERE department='{$dep['id']}'"; $depRslt = db_exec($sql) or ereDie("Unable to retrieve employee departments from database."); if (pg_numrows($depRslt) < 1) { $printDep .= "<td><a href='empdepartment-rem.php?id={$dep['id']}'>Remove</a></td></tr>"; } else { $printDep .= "</tr>"; } $i++; } $printDep .= "\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='empdepartment-add.php'>Add Employee Department</a></td>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>"; return $printDep; }
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 invid, invnum, customers.surname, hire_invid,\r\n\t\t\t\textract('epoch' FROM reprint_invoices.odate) AS e_date\r\n\t\t\t\tFROM hire.reprint_invoices\r\n\t\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\t\tON reprint_invoices.cusnum=customers.cusnum\r\n\t\t\tWHERE reprint_invoices.odate BETWEEN '{$from_date}' AND '{$to_date}'\r\n\t\t\tORDER BY invnum DESC"; $reprint_rslt = db_exec($sql) or errDie("Unable to retrieve reprints."); $reprint_out = ""; while ($reprint_data = pg_fetch_array($reprint_rslt)) { if (!$reprint_data["invnum"]) { continue; } $reprint_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>H{$reprint_data['invnum']}" . rrev($reprint_data["invid"]) . "</td>\r\n\t\t\t<td>{$reprint_data['surname']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $reprint_data["e_date"]) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='javascript:printer" . "(\"hire/hire_note_reprint.php?invid={$reprint_data['invid']}\")'>\r\n\t\t\t\t\tReprint\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($reprint_out)) { $reprint_out = "\r\n\t\t<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>View Hire Note Reprints</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></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> <b>To</b> </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>Hire No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Date</th>\r\n\t\t\t<th>Reprint</th>\r\n\t\t</tr>\r\n\t\t{$reprint_out}\r\n\t</table>"; return $OUTPUT; }
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 = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); // Retrieve hires $sql = "\r\n\tSELECT *,\r\n\t\t(SELECT username FROM cubit.users WHERE userid=user_id) AS username,\r\n\t\t(SELECT surname FROM cubit.customers WHERE cusnum=cust_id) AS surname,\r\n\t\t(SELECT cusname FROM cubit.customers WHERE cusnum=cust_id) AS cusname,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM from_time)) AS e_from,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM to_time)) AS e_to\r\n\tFROM hire.hires\r\n\tWHERE from_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59' OR\r\n\t\tto_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59'\r\n\tORDER BY e_from ASC"; $hire_rslt = db_exec($sql) or errDie("Unable to retrieve hires."); $hire_out = ""; while ($hire_data = pg_fetch_array($hire_rslt)) { $time = date("d-m-Y G:i:s", $hire_data["e_from"]); $hire_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$time}</td>\r\n\t\t\t<td>{$hire_data['inv_id']}</td>\r\n\t\t\t<td>{$hire_data['username']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='../cust-det.php?cusnum={$hire_data['cust_id']}'>\r\n\t\t\t\t\t{$hire_data['cusname']} {$hire_data['surname']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($hire_out)) { $hire_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>"; } if (empty($invoice_out)) { $invoice_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Daily 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><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>HIRES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$hire_out}\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>INVOICES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$invoice_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function printInv() { # Set up table to display in $printCallout = "\r\n\t<h3>View Call Out Documents For Invoicing.</h3>\r\n\t<table border='0' cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Department</th><th>Call Out Person</th><th>Job No.</th><th>Service Date</th><th>Customer Name</th><th colspan='6'>Options</th></tr>"; # connect to database db_connect(); # Query server $i = 0; $sql = "SELECT * FROM callout_docs WHERE accepted != 'c' AND done = 'y' AND div = '" . USER_DIV . "' AND invoiced != 'yes' ORDER BY calloutid DESC"; $calloutRslt = db_exec($sql) or errDie("Unable to retrieve call out documents from database."); if (pg_numrows($calloutRslt) < 1) { $printCallout = "<li>No previous call out documents."; } else { while ($callout = pg_fetch_array($calloutRslt)) { # format date $callout['odate'] = explode("-", $callout['odate']); $callout['odate'] = $callout['odate'][2] . "-" . $callout['odate'][1] . "-" . $callout['odate'][0]; #check if this doc has been uploaded $get_doc = "SELECT * FROM callout_docs_scanned WHERE calloutid = '{$callout['calloutid']}' AND div = '" . USER_DIV . "'"; $run_doc = db_exec($get_doc) or errDie("Unable to get call out document information"); if (pg_numrows($run_doc) < 1) { $uploaddoc = "<td colspan='2'><a href='callout-uploaddoc.php?calloutid={$callout['calloutid']}'>Upload Scanned Document</a></td>"; } else { $uploaddoc = "<td><a href='callout-uploaddoc.php?calloutid={$callout['calloutid']}'>Change Uploaded Document</a></td><td><a href='images/callout-showdoc.php?calloutid={$callout['calloutid']}'>View Document</a></td>"; } $printCallout .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td>{$callout['deptname']}</td>\r\n\t\t\t\t\t<td>{$callout['calloutp']}</td>\r\n\t\t\t\t\t<td>{$callout['calloutid']}</td>\r\n\t\t\t\t\t<td align=center>{$callout['odate']}</td>\r\n\t\t\t\t\t<td>{$callout['cusname']} {$callout['surname']}</td>\r\n\t\t\t\t\t<td><a href='callout-new.php?calloutid={$callout['calloutid']}&cont=true&letters=&done='>Edit</a></td>\r\n\t\t\t\t\t<td><a href='callout-cancel.php?calloutid={$callout['calloutid']}'>Cancel</a></td>\r\n\t\t\t\t\t<td><a href='callout-print.php?calloutid={$callout['calloutid']}' target='_blank'>Print</a></td>\r\n\t\t\t\t\t{$uploaddoc}\r\n\t\t\t\t\t<td><a href='callout-invoiced.php?calloutid={$callout['calloutid']}'>Complete (Invoiced)</a></td>\r\n\t\t\t\t</tr>"; $i++; } } // Layout $printCallout .= "\r\n\t\t\t</table>\r\n\t\t\t<p>\r\n\t\t\t<table border='0' cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t\t\t<tr><td><br></td></tr>\r\n\t\t\t\t<tr><th>Quick Links</th></tr>\r\n\t\t\t\t<tr class='datacell'><td align='center'><a href='cust-credit-stockinv.php'>New Invoice</a></td></tr>\r\n\t\t\t\t<tr class='datacell'><td align='center'><a href='callout-new.php'>New Call Out Document</td></tr>\r\n\t\t\t\t<tr class='datacell'><td align='center'><a href='main.php'>Main Menu</td></tr>\r\n\t\t\t</table>"; return $printCallout; }
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> </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; }
function display() { extract($_REQUEST); $fields = array(); $fields["search"] = ""; extract($fields, EXTR_SKIP); if (is_numeric($search)) { $invnum_w = "OR invnum='{$search}'"; } else { $invnum_w = ""; } $sql = "SELECT invid, invnum, cusname, total, hire_invid, accepted, hire_invnum\r\n\t\t\tFROM cubit.nons_invoices\r\n\t\t\tWHERE done='y' AND hire_invid>0 AND cusname ILIKE '%{$search}%' {$invnum_w}"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve hire invoices."); $inv_out = ""; while ($inv_data = pg_fetch_array($inv_rslt)) { if ($inv_data["accepted"] != "note") { $cnote = "\r\n\t\t\t<td>\r\n\t\t\t\t<a href='hire-invoice-note.php?invid={$inv_data['invid']}'>\r\n\t\t\t\t\tCredit Note\r\n\t\t\t\t</a>\r\n\t\t\t</td>"; } else { $cnote = "<td> </td>"; } $inv_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='javascript:printer(\"hire/hire_note_reprint.php?invid={$inv_data['hire_invid']}\")'>\r\n\t\t\t\t\tH{$inv_data['hire_invnum']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>{$inv_data['invnum']}</td>\r\n\t\t\t<td>{$inv_data['cusname']}</td>\r\n\t\t\t<td>" . CUR . sprint($inv_data["total"]) . "</td>\r\n\t\t\t<td><a href='javascript:popupOpen(\"nons-invoice-reprint.php?invid={$inv_data['invid']}\")'>Reprint</a></td>\r\n\t\t\t{$cnote}\r\n\t\t</tr>"; } if (empty($inv_out)) { $inv_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'><li>Please enter customer name or hire no.</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<h3>View Hire Invoices</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='2'>Enter Hire No or Customer Name</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><input type='text' name='search' value='{$search}' /></td>\r\n\t\t\t<td><input type='submit' value='Search' style='width: 100%' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Total</th>\r\n\t\t\t<th colspan='2'>Options</th>\r\n\t\t</tr>\r\n\t\t{$inv_out}\r\n\t</table>"; return $OUTPUT; }
function edit() { extract($_GET); if (isset($id)) { $subinfo = new dbSelect("subsistence", "cubit", array("where" => wgrp(m("id", "{$id}")))); $subinfo->run(); if ($subinfo->num_rows() > 0) { extract($subinfo->fetch_array(), EXTR_SKIP); } } $fields = array("name" => "", "in_republic" => "yes", "meals" => "yes", "accid" => false); foreach ($fields as $fname => $val) { if (!isset(${$fname})) { ${$fname} = $val; } } /* no accid is set, use salaries and wages */ if ($accid === false) { $swacc = qryAccountsName("Salaries and Wages", "accid"); $accid = $swacc["accid"]; } $bg = 0; $OUT = "\n\t<h3>Define Subsistence Allowance</h3>\n\t<li class='err'>The selection on this window will create a Subsistence Allowance\n\twith the specified properties. To assign this subsistence to an employee you\n\twill need to edit the employee, and on the 'Calculate Salary' window\n\tfill out the employee specific information involving the Subsistence Allowance.</li>\n\t<form method='get' action='" . SELF . "'>\n\t<input type='hidden' name='key' value='write'>\n\t" . (isset($id) ? "<input type='hidden' name='id' value='{$id}'" : "") . "\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<th colspan='2'>Details</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Name:</td>\n\t\t<td><input type='text' name='name' value='{$name}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>In Republic (ZA):</td>\n\t\t<td>\n\t\t\t<select name='in_republic'>\n\t\t\t\t<option value='yes' " . ($in_republic != "no" ? "selected" : "") . ">Yes</option>\n\t\t\t\t<option value='no' " . ($in_republic == "no" ? "selected" : "") . ">No</option>\n\t\t\t</select>\n\t\t</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Employee pays for own Meals:</td>\n\t\t<td>\n\t\t\t<select name='meals'>\n\t\t\t\t<option value='yes' " . ($meals != "no" ? "selected" : "") . ">Yes</option>\n\t\t\t\t<option value='no' " . ($meals == "no" ? "selected" : "") . ">No</option>\n\t\t\t</select>\n\t\t</td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Account:</td>\n\t\t<td>" . finAccList("accid", false, $accid) . "</td>\n\t\t<td class='err'>Select an account where the expense must be debited to.</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan='2' align='right'><input type='submit' value='Next'></td>\n\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t<tr>\n\t\t<td>\n\t\t\t<u><b>Subsistence allowance</b></u>\n\t\t\t<p>\n\t\t\tThe income tax provides that there shall not be included in the\n\t\t\ttaxable income of any person, any amount paid or granted by a\n\t\t\tprincipal as a reimbursement of, or as an advance for, the\n\t\t\texpenditure incurred or to be incurred by the employee - where\n\t\t\tthat employee must produce proof to that employer that such\n\t\t\texpenditure was wholly incurred and must account to that employer\n\t\t\tfor that expenditure.\n\t\t\t</p><p>\n\t\t\tFor the purpose of the above provision an employee shall be deemed\n\t\t\tto have actually incurred expenditure:\n\t\t\t<li>Where the employee proves to the Commissioner the amount of\n\t\t\tthe expenses incurred by him in respect of accommodation, meals or\n\t\t\tother incidental costs, the amount so actually incurred but\n\t\t\tlimited to the amount of the allowance or advance paid or granted\n\t\t\tto meet those expenses; or</li>\n\t\t\t<li>For each day or part of a day in the period during which that\n\t\t\temployee is absent from his or her usual place of residence, an\n\t\t\tamount in respect of meals and other incidental costs, or\n\t\t\tincidental costs only, determined by the Minister for the relevant\n\t\t\tyear of assessment by way of notice in The Gazette but limited to\n\t\t\tthe amount of the allowance paid or granted to meet those\n\t\t\texpenses.\n\t\t\t</p><p>\n\t\t\tAccording to the regulations published in The Gazette the\n\t\t\tfollowing amounts will be deemted to have been expended by an\n\t\t\temployee to whom an allowance or advance has been granted or paid:\n\t\t\t<li>Where the accommodation to which that allowance or advance\n\t\t\trelate is the Republic and that allowance or the advance is paid\n\t\t\tor granted to defray Incidental costs only, an amount equal to R93\n\t\t\tper day; or<br />\n\t\t\tThe cost of meals and incidental costs, an amount equal to R303\n\t\t\tper day; or</li>\n\t\t\t<li>Where the accommodation to which that allowance or advance\n\t\t\trelates is outside the Republic and that the allowance or advance\n\t\t\tis paid or granted to defray the cost of meals and incidental\n\t\t\tcosts, an amount equal to U.S. \$215 per day.</li>\n\t\t</td>\n\t</tr>\n\t</table>"; return $OUT; }
function confirm($_POST) { # get vars extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($dept, "string", 1, 50, "Invalid User Department."); # display errors, if any if ($v->isError()) { $theseErrors = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $theseErrors .= "-" . $e["msg"] . "<br>"; } $Errors = "\n \t<tr>\n \t\t<td class='err' colspan='2'>{$theseErrors}</td>\n \t</tr>\n\t\t\t<tr><td colspan='2'><br></td></tr>"; return enter($dept, $Errors); } $confirm = "\n\t\t<h3>Add User Department</h3>\n\t\t<h4>Confirm entry</h4>\n\t\t<table " . TMPL_tblDflts . " width='300'>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t<input type='hidden' name='dept' value='{$dept}'>\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>User Department</td>\n\t\t\t\t<td>{$dept}</td>\n\t\t\t</tr>\n\t\t\t<tr><td colspan='2'><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Select Permissions</th>\n\t\t\t</tr>"; // list scripts db_connect(); $sql = "SELECT DISTINCT name, script FROM scripts ORDER BY script"; $rslt = db_exec($sql); $i = 0; while ($scr = pg_fetch_array($rslt)) { $confirm .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2' nowrap><input type='checkbox' name='perm[]' value='{$scr['name']}'>" . strtoupper($scr['script']) . "</td>\n\t\t\t</tr>"; $i++; } $confirm .= "\n\t\t\t<tr>\n\t\t\t\t<td align='right' colspan='3'><input type='submit' value='Add Dept »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>"; return $confirm; }
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; }
function confirm($catid) { # validate input require_lib("validate"); $v = new validate(); $v->isOk($id, "num", 1, 50, "Invalid Employee Department 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 departments WHERE id = '{$id}'"; $depRslt = db_exec($sql) or errDie("Unable to access database.", SELF); if (pg_numrows($depRslt) < 1) { return "<li> Invalid Employee Department ID."; } else { $dep = pg_fetch_array($depRslt); } # get stock vars extract($dep); // Layout $confirm = "<h3>Remove Employee Department</h3>\n\t\t<h4>Confirm entry</h4>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type=hidden name=key value=rem>\n\t\t\t<input type=hidden name=id value='{$id}'>\n\t\t\t<tr><th width=40%>Field</th><th width=60%>Value</th></tr>\n\t\t\t<tr class='" . bg_class() . "'><td>Department</td><td>{$department}</td></tr>\n\t\t\t<tr><td align=right><input type=button value='« Back' onClick='javascript:history.back()'></td><td align=left><input type=submit value='Confirm »'></td></tr>\n\t\t</form>\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . " width='100'>\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class='" . bg_class() . "'><td><a href='empdepartment-view.php'>View Employee Departments</a></td></tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>"; return $confirm; }
function display() { extract($_REQUEST); $fields = array(); $fields["section_id"] = 0; $fields["id"] = 0; extract($fields, EXTR_SKIP); // Create the sections dropdown $sql = "SELECT * FROM cubit.today_sections ORDER BY name ASC"; $section_rslt = db_exec($sql) or errDie("Unable to retrieve section."); $section_sel = "\n\t\t<select name='section_id' onchange='javascript:document.form.submit()' style='width: 100%'>\n\t\t\t<option value='0'>[None]</option>"; while ($section_data = pg_fetch_array($section_rslt)) { if ($section_id == $section_data["id"]) { $sel = "selected"; } else { $sel = ""; } $section_sel .= "<option value='{$section_data['id']}' {$sel}>{$section_data['name']}</option>"; } // Retrieve the section if ($section_id) { $sql = "SELECT * FROM cubit.today_sections WHERE id='{$section_id}'"; $section_rslt = db_exec($sql) or errDie("Unable to retrieve section."); $section_data = pg_fetch_array($section_rslt); $section_name = $section_data["name"]; $sql = "SELECT * FROM {$section_data['table_name']} ORDER BY {$section_data['title_column']} ASC"; $id_rslt = db_exec($sql) or errDie("Unable to retieve {$section_data['name']}"); $id_sel = "\n\t\t\t<select name='id' onchange='javascript:document.form.submit()' style='width: 100%'>\n\t\t\t\t<option value='0'>[None]</option>"; while ($id_data = pg_fetch_array($id_rslt)) { if ($id == $id_data[$section_data["id_column"]]) { $sel = "selected"; } else { $sel = ""; } $id_sel .= "\n\t\t\t\t<option value='" . $id_data[$section_data["id_column"]] . "' {$sel}>\n\t\t\t\t\t" . $id_data[$section_data["title_column"]] . "\n\t\t\t\t</option>"; } $id_sel .= "</select>"; } else { $section_name = ""; $id_sel = "Please Select a Section"; } $OUTPUT = "\n\t\t<h3>{$section_name} Brought Forward Dates</h3>\n\t\t<form method='POST' action='" . SELF . "' name='form' />\n\t\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t\t<tr>\n\t\t\t\t<th>Section</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$section_sel}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$id_sel}</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<p></p>"; if ($section_id && $id) { // if section id already exists section_data should be available // retrieve the title $sql = "\n\t\t\tSELECT {$section_data['title_column']} \n\t\t\tFROM {$section_data['table_name']} \n\t\t\tWHERE {$section_data['id_column']}='{$id}'"; $title_rslt = db_exec($sql) or errDie("Unable to retrieve title."); $title = pg_fetch_result($title_rslt, 0); $sql = "\n\t\t\tSELECT *,extract('epoch' FROM date) as e_date \n\t\t\tFROM cubit.today \n\t\t\tWHERE section_id='{$section_id}' AND title='{$title}' AND user_id='" . USER_ID . "' \n\t\t\tORDER BY id DESC"; $today_rslt = db_exec($sql) or errDie("Unable to retrieve today entries."); $today_out = ""; while ($today_data = pg_fetch_array($today_rslt)) { $date = date("d-m-Y", $today_data["e_date"]); $today_out .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td nowrap>{$date}</td>\n\t\t\t\t\t<td>{$today_data['info']}</td>\n\t\t\t\t\t<td align='center'>\n\t\t\t\t\t\t<input type='checkbox' name='rem' value='{$today_data['id']}'\n\t\t\t\t\t\tonchange='javascript:document.remfrm.submit()' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } $OUTPUT .= "\n\t\t\t<table cellpadding='5' cellspacing='0' class='shtable'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t<th>Info</th>\n\t\t\t\t\t<th>Options</th>\n\t\t\t\t</tr>\n\t\t\t<form method='POST' action='" . SELF . "'>\n\t\t\t\t<input type='hidden' name='section_id' value='{$section_id}' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td nowrap>" . mkDateSelect("date") . "</td>\n\t\t\t\t\t<td><input type='text' name='info' style='width: 100%' /></td>\n\t\t\t\t\t<td><input type='submit' name='key' value='Add' style='width:100%' /></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t<form method='post' action='" . SELF . "' name='remfrm' />\n\t\t\t\t<input type='hidden' name='section_id' value='{$section_id}' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />\n\t\t\t\t<input type='hidden' name='key' value='remove' />\n\t\t\t\t{$today_out}\n\t\t\t</form>\n\t\t\t</table>"; } $OUTPUT .= "\n\t\t<p></p>\n\t\t<a href='today.php' style='font-size: 12pt; font-weight: bold;'>Today Action Display</a><br><br>" . mkQuickLinks(ql("../crmsystem/leads_list.php", "Return To View Leads")); return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["search"] = ""; extract($fields, EXTR_SKIP); $sql = "SELECT *,extract('epoch' FROM timestamp) as e_time FROM hire.hires\r\n\tORDER BY timestamp DESC"; $hire_rslt = db_exec($sql) or errDie("Unable to retrieve hires."); $hire_out = ""; while ($hire_data = pg_fetch_array($hire_rslt)) { // Retrieve customer $sql = "SELECT * FROM cubit.customers WHERE cusnum='{$hire_data['cust_id']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customer."); $cust_data = pg_fetch_array($cust_rslt); // Retrieve stock $sql = "SELECT * FROM cubit.stock WHERE stkid='{$hire_data['old_id']}'"; $stock_rslt = db_exec($sql) or errDie("Unable to retrieve stock."); $stock_data = pg_fetch_array($stock_rslt); $time = date("d-m-Y G:i:s", $hire_data["e_time"]); $hires_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$time}</td>\r\n\t\t\t<td>{$cust_data['surname']}</td>\r\n\t\t\t<td>{$stock_data['stkcod']}</td>\r\n\t\t\t<td>{$hire_data['units']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='hire-invoice-new.php?invid={$hire_data['inv_id']}&cont=1&edit=1'>\r\n\t\t\t\t\tEdit\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($hires_out)) { $hires_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='7'>No items on hire.</td>\r\n\t\t</tr>"; } if (isset($added)) { $message = "<li class='err'>Item/s successfully hired out.</li>"; } else { $message = ""; } $OUTPUT = "<h3>View Hire</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t</table>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<td colspan='7'>{$message}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Stock</th>\r\n\t\t\t<th>Units</th>\r\n\t\t\t<th colspan='3'>Options</th>\r\n\t\t</tr>\r\n\t\t{$hires_out}\r\n\t</table>"; return $OUTPUT; }
function write_details($_POST) { extract($_POST); # validate input require_lib("validate"); $v = new validate(); $v->isOk($branch_ip, "url", 1, 50, "Invalid Branch IP."); $v->isOk($branch_company, "url", 4, 4, "Invalid Branch Company Code."); $v->isOk($branch_username, "string", 1, 50, "Invalid Branch Username."); // $v->isOk ($branch_password, "url", 1, 50, "Invalid Branch Password."); // $v->isOk ($branch_passwordconfirm, "url", 1, 50, "Invalid Branch Password."); // $v->isOk ($branch_ip, "url", 1, 50, "Invalid Branch IP."); if ($branch_password != $branch_passwordconfirm) { $v->addError($branch_password, "Passwords do not match."); } # display errors, if any if ($v->isError()) { $confirmCust = ""; $errors = $v->getErrors(); foreach ($errors as $e) { $confirmCust .= "<li class='err'>" . $e["msg"] . "</li>"; } return get_details($_POST, $confirmCust); } db_connect(); $add_sql = "\n\t\tINSERT INTO branches_data (\n\t\t\tbranch_name, branch_desc, branch_contact, branch_ip, \n\t\t\tdate_added, last_online, branch_username, branch_password, \n\t\t\tlast_login_from, branch_localuser, branch_company\n\t\t) VALUES (\n\t\t\t'{$branch_name}', '{$branch_desc}', '{$branch_contact}', '{$branch_ip}', \n\t\t\t'now', '1990-01-01', '{$branch_username}', md5('{$branch_password}'), \n\t\t\t'1990-01-01', '{$branch_localuser}', '{$branch_company}'\n\t\t)"; $run_add = pg_exec($add_sql) or errDie("Unable to add branch information."); $display = "\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Branch Added</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Branch Has Been Added.</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t"; return $display; }
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}"; if (isset($id)) { $where = "AND doc_id='{$id}'"; } else { $where = ""; } $sql = "SELECT *,extract('epoch' FROM timestamp) AS e_time FROM cubit.document_movement\n\tWHERE (timestamp BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59') {$where} ORDER BY timestamp DESC"; $dm_rslt = db_exec($sql) or errDie("Unable to retrieve document movement"); $dm_out = ""; while ($dm_data = pg_fetch_array($dm_rslt)) { $bgcolor = bgcolorg(); $dm_out .= "<tr class='" . bg_class() . "'>\n\t\t\t<td>" . date("d-m-Y G:i:s", $dm_data["e_time"]) . "</td>\n\t\t\t<td>{$dm_data['doc_id']}</td>\n\t\t\t<td>{$dm_data['project']}</td>\n\t\t\t<td>{$dm_data['area']}</td>\n\t\t\t<td>{$dm_data['discipline']}</td>\n\t\t\t<td>{$dm_data['doc_type']}</td>\n\t\t\t<td>{$dm_data['revision']}</td>\n\t\t\t<td>{$dm_data['drawing_num']}</td>\n\t\t\t<td>{$dm_data['sheet_num']}</td>\n\t\t\t<td>{$dm_data['title']}</td>\n\t\t\t<td>{$dm_data['location']}</td>\n\t\t\t<td>{$dm_data['contract']}</td>\n\t\t\t<td>{$dm_data['contractor']}</td>\n\t\t\t<td>{$dm_data['code']}</td>\n\t\t\t<td>{$dm_data['issue_for']}</td>\n\t\t\t<td>{$dm_data['qs']}</td>\n\t\t\t<td>{$dm_data['status']}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='20'>{$dm_data['movement_description']}</td>\n\t\t</tr>"; } if (empty($dm_out)) { $dm_out = "<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='20'><li>No results found.</li></td>\n\t\t</tr>"; } $OUTPUT = "<center>\n\t<h3>Document Movement 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><b>To</b></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>Time</th>\n\t\t\t<th>Record Number</th>\n\t\t\t<th>Project</th>\n\t\t\t<th>Area</th>\n\t\t\t<th>Discipline</th>\n\t\t\t<th>Document Type</th>\n\t\t\t<th>Revision</th>\n\t\t\t<th>Drawing Number</th>\n\t\t\t<th>Sheet Number</th>\n\t\t\t<th>Title</th>\n\t\t\t<th>Location</th>\n\t\t\t<th>Contract</th>\n\t\t\t<th>Contractor</th>\n\t\t\t<th>Code</th>\n\t\t\t<th>Issue For</th>\n\t\t\t<th>QS</th>\n\t\t\t<th>Status</th>\n\t\t</tr>\n\t\t{$dm_out}\n\t</table>"; return $OUTPUT; }
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; }
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; }
function confirm($_GET) { extract($_GET); $id += 0; db_conn('crm'); $Sl = "SELECT * FROM teams WHERE id='{$id}'"; $Ry = db_exec($Sl) or errDie("Unable to get team info."); if (pg_numrows($Ry) < 1) { return "Invalid team."; } $teamdata = pg_fetch_array($Ry); $Sl = "SELECT * FROM crms WHERE div='" . USER_DIV . "'"; $Ry = db_exec($Sl) or errDie("Unable to get data."); while ($cdata = pg_fetch_array($Ry)) { $teams = explode("|", $cdata['teams']); if (in_array($id, $teams)) { return "You Cannot remove this team, {$cdata['name']} is still allocated to it."; } } $Sl = "SELECT * FROM crms WHERE div='" . USER_DIV . "' AND teamid='{$id}'"; $Ry = db_exec($Sl) or errDie("Unable to get data."); if (pg_num_rows($Ry) > 0) { $cdata = pg_fetch_array($Ry); return "You Cannot remove this team, {$cdata['name']} still has it set as its default."; } $out = "\r\n\t\t\t\t<h3>Remove Cubit Team</h3>\r\n\t\t\t\t<form action='" . SELF . "' method='POST'>\r\n\t\t\t\t\t<input type='hidden' name='key' value='remove'>\r\n\t\t\t\t\t<input type='hidden' name='id' value='{$id}'>\r\n\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th colspan='2'>Team Details</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Team Name</td>\r\n\t\t\t\t\t\t<td>{$teamdata['name']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t\t<td>Description</td>\r\n\t\t\t\t\t\t<td>{$teamdata['des']}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Remove »'></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</form>\r\n\t\t\t\t</table>"; return $out; }
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; }
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; }
function printQuo() { # Set up table to display in $printQuo = "\n <h3>Incomplete POS Quotes</h3>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><th>Username</th><th>Department</th><th>Sales Person</th><th>Quote No.</th><th>Quote Date</th><th>Customer Name</th><th>Order No</th><th>Grand Total</th><th>Balance</th><th colspan=3>Options</th></tr>"; # connect to database db_connect(); # Query server $i = 0; $sql = "SELECT * FROM pos_quotes WHERE done = 'n' 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 incomplete quotes."; } else { while ($quo = pg_fetch_array($quoRslt)) { # get department db_conn("exten"); $sql = "SELECT * FROM departments WHERE deptid = '{$quo['deptid']}' AND div = '" . USER_DIV . "'"; $deptRslt = db_exec($sql); if (pg_numrows($deptRslt) < 1) { $dept['deptname'] = "<i class=err>Not Found</i>"; } else { $dept = pg_fetch_array($deptRslt); } # format date $quo['odate'] = explode("-", $quo['odate']); $quo['odate'] = $quo['odate'][2] . "-" . $quo['odate'][1] . "-" . $quo['odate'][0]; $printQuo .= "<tr class='" . bg_class() . "'><td>{$quo['username']}</td><td>{$dept['deptname']}</td><td>{$quo['salespn']}</td><td>{$quo['quoid']}</td><td align=center>{$quo['odate']}</td><td>{$quo['cusname']}</td><td align=right>{$quo['ordno']}</td><td>" . CUR . " {$quo['total']}</td>\n\t\t\t\t<td>" . CUR . " {$quo['balance']}</td>\n\t\t\t\t<td><a href='pos-quote-new.php?quoid={$quo['quoid']}&cont=true&done='>Continue</a></td>\n\t\t\t\t<td><a href='pos-quote-unf-cancel.php?quoid={$quo['quoid']}'>Cancel</a></td></tr>"; $i++; } } // Layout $printQuo .= "</table>\n <p>\n <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n <tr><td><br></td></tr>\n <tr><th>Quick Links</th></tr>\n\t\t<tr class=datacell><td><a href='pos-quote-canc-view.php'>View Cancelled POS Quotes</td></tr>\n <tr class=datacell><td><a href='pos-quote-new.php'>New POS Quote</td></tr>\n <tr class=datacell><td><a href='main.php'>Main Menu</td></tr>\n </table>"; return $printQuo; }