📄 control.inc
字号:
<?php
include_once "functions.inc";
//-----------------------------------------------------------------
//
//-----------------------------------------------------------------
function build_combo_from_table( $conn, $label, $tblname, $fldname1, $fldname2, $selname, $data=null )
{
$fname = $name."_name";
$resx = mysql_query( "Select `$fldname1`,`$fldname2` from `$tblname` order by `$fldname2`;", $conn );
echo "<td>$label</td><td><select name='$selname'>\n";
$no = 0;
while ( $irow = mysql_fetch_assoc( $resx ) )
{
if ( $no ) echo "<option value='";
else {
if ( $data==null ) {
$first = $irow[ "$fldname1" ];
echo "<option Selected value='";
++$no;
}
else {
if ( $data==$irow[ "$fldname1" ] ) {
$first = $irow[ "$fldname1" ];
echo "<option Selected value='";
++$no;
}
else {
echo "<option value='";
}
}
}
echo $irow[ "$fldname2" ],"'>",$irow[ "$fldname2" ]," </option>";
}
echo "</select></td>\r\n";
return $first;
}
// used by pay-adv, ....
function build_combo_from_table1( $conn, $label, $tblname, $fldname1, $fldname2, $selname )
{
$fname = $name."_name";
$resx = mysql_query( "Select `$fldname1`,`$fldname2` from `$tblname` order by `$fldname2`;", $conn );
echo "<td>$label</td><td><select name='$selname'>\n";
$no = 0;
while ( $irow = mysql_fetch_assoc( $resx ) )
{
if ( $no ) echo "<option value='";
else {
$first = $irow[ "$fldname1" ];
echo "<option Selected value='";
++$no;
}
echo $irow[ "$fldname1" ],"'>",$irow[ "$fldname2" ]," </option>";
}
echo "</select></td>\r\n";
return $first;
}
//-----------------------------------------------------------------
//
//-----------------------------------------------------------------
function combo_payee( $conn, $label, $tblname, $fldname1, $fldname2, $selname, $choice=0 )
{
$fname = $name."_name";
$resx = mysql_query( "Select `$fldname1`,`$fldname2` from `$tblname` order by `$fldname2`;", $conn );
echo "<td>$label</td><td><select name='$selname' onchange=' PayeeSelect(); ' >\n";
$no = 0;
while ( $irow = mysql_fetch_assoc( $resx ) )
{
if ( $no == 0 ) {
$first = $irow[ "$fldname1" ];
++$no;
}
if ( $choice!=$irow[ "$fldname1" ] ) echo "<option value='";
else {
$first = $irow[ "$fldname1" ];
echo "<option Selected value='";
}
echo $irow[ "$fldname1" ],"'>",$irow[ "$fldname2" ]," </option>";
}
echo "</select></td>\r\n";
return $first;
}
//-----------------------------------------------------------------
//
//-----------------------------------------------------------------
function payroll_date_from_table( $conn, $flag=0 )
{
$resx = mysql_query( "Select `Payroll Date` from payroll_header Group by `Payroll Date` Order by `Payroll Date` Desc;", $conn );
if ( $flag ) {
echo "<td>Month-End process date </td>";
}
else {
echo "<td>Payroll process date </td>";
}
echo "<td><select name='PayrollDate'>\n";
$no = 0;
while ( $irow = mysql_fetch_assoc( $resx ) )
{
if ( $no ) echo "<option value='";
else {
$first = $irow[ 'Payroll Date' ];
echo "<option Selected value='";
++$no;
}
echo $irow['Payroll Date'],"'>",ConvertDate($irow['Payroll Date'])," </option>";
}
echo "</select></td>\r\n";
return $first;
}
//-----------------------------------------------------------------
// build ratio-button
//-----------------------------------------------------------------
function build_ratio( $option, $tname )
{
echo "<table align='center'><tr><td>";
foreach ( $option as $item ) {
echo "<input type='radio' value='",$item[0],"' name='$tname' /> $item[1] ";
}
echo "</td></tr></table>\r\n";
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -