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 slct() { # Accounts Drop down selections db_connect(); $sql = "SELECT * FROM bankacct WHERE btype != 'int' AND div = '" . USER_DIV . "'"; $bnkRs = db_exec($sql); if (pg_numrows($bnkRs) < 1) { return "<li class='err'> There are no local bank accounts found.\n\t\t<p><input type='button' onClick='JavaScript:history.back();' value='« Correct Selection'>"; } $banks = "<select name='bankid'>"; while ($bnk = pg_fetch_array($bnkRs)) { $banks .= "<option value='{$bnk['bankid']}'>{$bnk['accname']} - {$bnk['bankname']}</option>"; } $banks .= "</select>"; $sql = "SELECT * FROM bankacct WHERE btype = 'int' AND div = '" . USER_DIV . "'"; $fbnkRs = db_exec($sql); if (pg_numrows($fbnkRs) < 1) { return "\n\t\t\t<li class='err'>No foreign bank accounts were found.</li>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='bankacct-new.php'>Add Bank Account</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='bank-pay-add.php'>Add Bank Payment</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='bank-recpt-add.php'>Add Bank Receipt</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='cashbook-view.php'>View Cash Book</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>"; } $fbanks = "<select name='fbankid'>"; while ($fbnk = pg_fetch_array($fbnkRs)) { $fbanks .= "<option value='{$fbnk['bankid']}'>{$fbnk['accname']} - {$fbnk['bankname']}</option>"; } $fbanks .= "</select>"; # ttype array $ttypearr = array("loc" => "From Local To Foreign", "int" => "From Foreign To Local"); $ttypesel = extlib_mksel("ttype", $ttypearr); # layout $slct = "\n\t\t<h3>Bank Transfer</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='add'>\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>Local Bank Account</td>\n\t\t\t\t<td valign='center'>{$banks}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Foreign Bank Account</td>\n\t\t\t\t<td>{$fbanks}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Transfer Type</td>\n\t\t\t\t<td>{$ttypesel}</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='button' value='< Cancel' onClick='javascript:history.back();'></td>\n\t\t\t\t<td valign='center'><input type='submit' value='Confirm >'></td>\n\t\t\t</tr>\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 $slct; }
function slctOpt() { global $TYPES, $YEARS; $typesel = extlib_mksel("budtype", $TYPES); $fromyrsel = extlib_cpsel("fromyr", $YEARS, YR_DB); $toyrsel = extlib_cpsel("toyr", $YEARS, YR_DB); // Options Layout $Opts = "<center>\n\t<h3> New Yearly Budget </h3>\n\t<form action='" . SELF . "' method=post name=form>\n\t<input type=hidden name=key value=details>\n\t<table " . TMPL_tblDflts . " align=center>\n\t\t<tr>\n\t\t\t<th colspan=3>Details</th>\n\t\t</tr>\n\t\t<tr class='bg-odd'>\n\t\t\t<td>Budget Name</td>\n\t\t\t<td><input type=text size=30 name=budname></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th colspan=3>Options</th>\n\t\t</tr>\n\t\t<tr class='bg-odd'>\n\t\t\t<td>Budget For</td>\n\t\t\t<td>\n\t\t\t\t<input type=radio name=budfor value=cost checked=yes>Cost Centers \n\t\t\t\t<input type=radio name=budfor value=acc>Accounts\n\t\t\t</td>\n\t\t<tr class='bg-even'>\n\t\t\t<td>Budget Type</td>\n\t\t\t<td>{$typesel}</td>\n\t\t</tr>\n\t\t<tr class='bg-odd'>\n\t\t\t<td>Budget Year</td>\n\t\t\t<td>{$fromyrsel} to {$toyrsel}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align=right>\n\t\t\t\t<input type=submit value='Continue »'>\n\t\t\t</td>\n\t\t</tr>\n\t</table></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 enterdet() { // $edate = ext_dateEntry("e"); db_connect(); # Query server $sql = "SELECT * FROM costcenters WHERE div = '" . USER_DIV . "' ORDER BY centername ASC"; $ccRslt = db_exec($sql) or errDie("Unable to retrieve Cost centers from database."); $ccenters = ""; for ($i = 0; $cc = pg_fetch_array($ccRslt); $i++) { $ccenters .= "\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><input type='hidden' name='ccids[]' value='{$cc['ccid']}'>{$cc['centername']} ({$cc['centercode']}) </td>\r\n\t\t\t\t\t<td align='right'>" . CUR . " <input type='text' name='ccamts[]' size='8' value='0'></td>\r\n\t\t\t\t</tr>"; } $typearr = array("dt" => "Income", "ct" => "Expense"); $typesel = extlib_mksel("trantype", $typearr); $enter = "\r\n\t\t\t<h3>Allocate amount to Cost Centers</h3>\r\n\t\t\t<form action='" . SELF . "' method='POST'>\r\n\t\t\t\t<input type='hidden' name='key' value='confirm'>\r\n\t\t\t<table " . TMPL_tblDflts . " width='300'>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th>Field</th>\r\n\t\t\t\t\t<th>Value</th>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td>" . REQ . "Entry Type</td>\r\n\t\t\t\t\t<td>{$typesel}</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td>Date</td>\r\n\t\t\t\t\t<td nowrap>" . mkDateSelect("date") . "</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td>Description</td>\r\n\t\t\t\t\t<td><textarea cols='18' rows='3' name='descrip'></textarea></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t" . TBL_BR . "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th>Cost Center</th>\r\n\t\t\t\t\t<th>Total Amount</th>\r\n\t\t\t\t</tr>\r\n\t\t\t\t{$ccenters}\r\n\t\t\t\t" . TBL_BR . "\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td colspan='2' align='center'><input type='submit' value='Confirm »'></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>\r\n\t\t\t</form>\r\n\t\t\t<p>\r\n\t\t\t<table " . TMPL_tblDflts . " width='15%'>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='costcenter-add.php'>Add Cost Center</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='costcenter-view.php'>View Cost Center</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>"; return $enter; }
function slct($errors = "") { # check if setting exists db_connect(); $sql = "SELECT value FROM set WHERE label = 'DEF_WH' AND div = '" . USER_DIV . "'"; $Rslt = db_exec($sql) or errDie("Unable to check database for existing settings."); if (pg_numrows($Rslt) > 0) { $set = pg_fetch_array($Rslt); $whid = $set['value']; } else { $whid = 0; } # Select warehouse db_conn("exten"); $whs = "<select name='whid'>"; $sql = "SELECT * FROM warehouses WHERE div = '" . USER_DIV . "' ORDER BY whname ASC"; $whRslt = db_exec($sql); if (pg_numrows($whRslt) < 1) { return "There are no Stores found in Cubit."; } else { while ($wh = pg_fetch_array($whRslt)) { if ($wh['whid'] == $whid) { $sel = "selected"; } else { $sel = ""; } $whs .= "<option value='{$wh['whid']}' {$sel}>({$wh['whno']}) {$wh['whname']}</option>"; } } $whs .= "</select>"; # drop downs $fldsarr = array("catname" => "Category", "classname" => "Classification", "supstkcod" => "Supplier Stock Code", "stkcod" => "Stock Code", "stkdes" => "Stock Description"); $flds = extlib_mksel("fld", $fldsarr); //layout $slct = "\n\t\t<h3>Search Stock</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='view'>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'{$errors}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Key Details</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Select Store</td>\n\t\t\t\t<td valign='center'>{$whs}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Search By</td>\n\t\t\t\t<td valign='center'>{$flds}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Search Key</td>\n\t\t\t\t<td valign='center'><input type='text' name='skey' size='20'></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><br></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Sort By</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='radio' name='sortby' value='normal' checked='yes'> Normal</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='radio' name='sortby' value='cat'> Category</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='radio' name='sortby' value='class'> Classification</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><br></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td align='right'><input type='submit' value='View »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>\n\t\t<p>\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\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='stock-add.php'>Add Stock</a></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='stock-view.php'>View Stock</a></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\n\t\t\t</tr>\n\t\t</table>"; return $slct; }