Ejemplo n.º 1
0
?>
></input>&nbsp;&nbsp;<input style="font-family:verdana;font-size:10px;" type="button" value="..." onclick="init1()">-->
            <select name="opt_to_month" class="lineborderselect" style="font-size:10px">
			<?php 
func_fill_month($i_to_month);
?>
			  </select>
			<select name="opt_to_day" class="lineborderselect" style="font-size:10px">
			<?php 
func_fill_day($i_to_day);
?>
	
			  </select>
			  <select name="opt_to_year" class="lineborderselect" style="font-size:10px">
			<?php 
func_fill_year($i_to_year);
?>
			  </select>
			  <input type="hidden" name="from_to" size="17" style="font-family: Verdana; font-size: 8pt; border: 1 solid " value="">
			  <input style="font-family:verdana;font-size:10px;" type="button" value="..." onclick="init(380,140,document.exporter.from_to)">
			  </td>   
	    	  </tr>
			<tr><td colspan="2" align="center" valign="middle">
			<table cellpadding="0" cellspacing="0" border="0"width="100%">
				<tr>
				<td height="30" valign="middle" align="left"><font face="verdana" size="1">Company 
                          Type&nbsp;</font></td>
				 <td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="companymode" style="font-family:verdana;font-size:10px;WIDTH: 210px"  onChange="Displaycompanytype();">
					<?php 
print func_select_mailcompanytype($companytype);
?>
    <td height="22" align="right" valign="top" background="images/menutoprightbg.gif"  width="1%" nowrap><img border="0" src="images/menuright.gif" width="10" height="22"></td>
  </tr>
  <tr>
    <td class="lgnbd" colspan="5" height="10">
	
	<form action="" method="GET" name="FrmMerchant" >
  <table border="0"  align="center" cellpadding="2">
    <tr valign="middle" >     
	 <td width="102" align="right"  valign="middle"><select name="cbo_from_month" >
          <?php 
func_fill_month($str_month_from);
?>
      </select></td>
      <td ><select name="cbo_from_year">
          <?php 
func_fill_year($str_year_from, $i_start_year, $i_end_year);
?>
      </select></td>
      <td width="127"><input type="image" name="add" SRC="<?php 
echo $tmpl_dir;
?>
/images/submit.jpg"></td>
    </tr>
	<tr>
	<td colspan="4"><select name="show_rollover" id="show_rollover" >
	  <option value="a" <?php 
echo $show_rollover == 'a' ? "selected" : "";
?>
>Show All </option>
	  <option value="h" <?php 
echo $show_rollover == 'h' ? "selected" : "";
						  <?php 
        if ($str_cancel_status == "N" && $strApprovalStatus == "" && func_is_future_date($strBillDate)) {
            ?>
							   <select name="opt_bill_month" style="font-size:10px">
								<?php 
            func_fill_month($i_bill_month);
            ?>
							   </select>
								<select name="opt_bill_day" class="lineborderselect" style="font-size:10px">
								<?php 
            func_fill_day($i_bill_day);
            ?>
							   </select>
								<select name="opt_bill_year" style="font-size:10px">
								<?php 
            func_fill_year($i_bill_year);
            ?>
							   </select>
							  <?php 
        } else {
            ?>
								<font size='1' face='Verdana, Arial, Helvetica, sans-serif'><?php 
            print $i_bill_month;
            ?>
-<?php 
            print $i_bill_day;
            ?>
-<?php 
            print $i_bill_year;
            ?>
</font>
Ejemplo n.º 4
0
function smart_search_elements($form_elements, $sql_pairs, $name_append = "", $sql_results = "")
{
    foreach ($form_elements as $input => $values) {
        $style = "";
        if (isset($values['style'])) {
            foreach ($values['style'] as $element => $value) {
                $style .= ($style == "" ? "" : " ") . "{$element} = \"{$value}\"";
            }
        }
        $action = "";
        if (isset($values['options']['source']['ajax'])) {
            $action = $values['options']['source']['parameters']['on_action'] . "=\"" . $values['options']['source']['parameters']['ajax_call'] . "(this.value)\"";
        }
        if (isset($values['action'])) {
            $action = $values['action'];
        }
        $this_element = "frm_" . str_replace(".", "_", $input) . ($name_append != "" ? "_" . $name_append : "");
        $display = !isset($values['display']) ? $input : ($values['display'] != "" ? $values['display'] : "");
        $pairs = NULL;
        if (isset($values['options']['source']['script'])) {
            $pairs = $values['options']['source']['script']($values['options']['source']['parameters']);
        }
        if (isset($values['options']['source']['ajax'])) {
            $pairs = $values['options']['source']['ajax']($values['options']['source']['parameters']);
        }
        if (isset($values['options']['source']['pairs'])) {
            $pairs = $sql_pairs[$values['options']['source']['pairs']];
        }
        if ($pairs != NULL) {
            foreach ($pairs as $index => $pair) {
                if (isset($pair['condition_var'])) {
                    if ($sql_results[$pair['condition_var']] != $pair['condition_val']) {
                        $pairs[$index]['disabled'] = true;
                        //unset($pairs[$index]);
                    }
                }
            }
        }
        $options = "";
        switch ($values['input_type']) {
            case "hidden":
                break;
            case "company_search":
                $frm_entity[] = array("input" => "<b>{$display}:</b>\r\n" . genCompanyViewTable('', '', 'full', false));
                break;
            case "select":
                if ($display != "") {
                    $display = "<b>{$display}:</b>\r\n";
                }
                if ($pairs != NULL) {
                    foreach ($pairs as $pair) {
                        $options .= "<option value='" . $pair['value'] . "' " . ($pair['disabled'] ? 'disabled ' : '') . (isset($_REQUEST[$this_element]) && !strcasecmp($_REQUEST[$this_element], $pair['value']) || !isset($_REQUEST[$this_element]) && isset($pair['default']) ? " selected " : "") . ">" . $pair['display'] . "</option>\r\n";
                    }
                }
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => "<select id='{$this_element}' name='{$this_element}' {$style} {$action}>" . $options . "</select>");
                break;
            case "selectmulti":
                if ($display != "") {
                    $display = "<b>{$display}:</b>";
                }
                if ($pairs != NULL) {
                    foreach ($pairs as $pair) {
                        $options .= "<option value=\"" . $pair['value'] . "\"" . (isset($_REQUEST[$this_element]) && smart_verifyFormValue($_REQUEST[$this_element], $pair) ? " selected " : "") . ">" . $pair['display'] . "</option>\r\n";
                    }
                }
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => "<select {$action} {$style} multiple id='{$this_element}' name='" . $this_element . "[]'>" . $options . "</select>");
                break;
            case "radio":
                if ($display != "") {
                    $display = "<b>{$display}:</b>";
                }
                if ($pairs != NULL) {
                    foreach ($pairs as $pair) {
                        $checked = "";
                        if (isset($_REQUEST[$this_element]) && !strcasecmp($_REQUEST[$this_element], $pair['value'])) {
                            $checked = "checked";
                        }
                        if (!isset($_REQUEST[$this_element]) && isset($pair['default'])) {
                            $checked = "checked";
                        }
                        $options .= "<input {$action} {$style} type='radio' id='{$this_element}' name='{$this_element}' value=\"" . $pair['value'] . "\" " . $checked . ">" . $pair['display'] . "</input>\r\n";
                    }
                }
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => $options);
                break;
            case "checkbox":
                if ($display != "") {
                    $display = "<b>{$display}:</b>";
                }
                if ($pairs == NULL) {
                    $options .= "<input {$action} {$style} type='checkbox' id='{$this_element}' name='" . $this_element . "' value=\"" . $values['value'] . "\"" . (isset($_REQUEST[$this_element]) && !strcasecmp($_REQUEST[$this_element], $values['value']) ? " checked " : "") . ">" . $values['display'] . "</input><br>\r\n";
                } else {
                    $chkcnt = 0;
                    foreach ($pairs as $pair) {
                        $checked = "";
                        if (isset($_REQUEST[$this_element]) && smart_verifyFormValue($_REQUEST[$this_element], $pair)) {
                            $checked = "checked";
                        }
                        if (!isset($_REQUEST[$this_element]) && isset($pair['default'])) {
                            $checked = "checked";
                        }
                        $options .= (!($chkcnt++ % 4) && $chkcnt != 1 ? "<BR>" : "") . "<input {$action} {$style} type='checkbox' id='{$this_element}' name='" . $this_element . "[]' value=\"" . $pair['value'] . "\" {$checked}>" . $pair['display'] . "</input>\r\n";
                    }
                }
                if ($pairs != NULL) {
                    $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => $options);
                } else {
                    $frm_entity[] = array("name" => "&nbsp;", "input" => $options);
                }
                break;
            case "between":
                if ($display != "") {
                    $displayb = "<b>{$display} To:</b>";
                } else {
                    $displayb = "";
                }
                if ($display != "") {
                    $display = "<b>{$display} From:</b>";
                }
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => "<input {$action} {$style} type='text' id='" . $this_element . "_to' name='" . $this_element . "_from' value=\"" . (isset($_REQUEST[$this_element . "_from"]) ? $_REQUEST[$this_element . "_from"] : date("Y-m-d 00:00:00")) . "\"></input>");
                $frm_entity[] = array("name" => "{$displayb}&nbsp;", "input" => "<input {$action} {$style} type='text' id='" . $this_element . "_from' name='" . $this_element . "_to' value=\"" . (isset($_REQUEST[$this_element . "_to"]) ? $_REQUEST[$this_element . "_to"] : date("Y-m-d 23:59:59")) . "\"></input>");
                break;
            case "date_simple":
                $sel_month = isset($_REQUEST[$this_element . "_month"]) ? $_REQUEST[$this_element . "_month"] : date("n");
                $sel_year = isset($_REQUEST[$this_element . "_year"]) ? $_REQUEST[$this_element . "_year"] : date("Y");
                $months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "\r\n\t\t\t\t\t\t\tOctober", "November", "December");
                $min_year = !isset($values['min_year']) ? date("Y") - 10 : $values['min_year'];
                $max_year = !isset($values['max_year']) ? date("Y") + 2 : $values['max_year'];
                for ($j = $min_year; $j < $max_year; $j++) {
                    $years[$j] = 1;
                }
                $month_html = "<select name='" . $this_element . "_month'>";
                foreach ($months as $index => $month) {
                    if ($index + 1 != $sel_month) {
                        $month_html .= "<option value='" . ($index + 1) . "'>{$month}</option>";
                    } else {
                        $month_html .= "<option selected value='" . ($index + 1) . "'>{$month}</option>";
                    }
                }
                $month_html .= "</select>";
                $year_html = "<select name='" . $this_element . "_year'>";
                foreach ($years as $year => $value) {
                    if ($sel_year != $year) {
                        $year_html .= "<option value='{$year}'>{$year}</option>";
                    } else {
                        $year_html .= "<option selected value='{$year}'>{$year}</option>";
                    }
                }
                $year_html .= "</select>";
                $frm_entity[] = array("name" => "<b>{$display}&nbsp;</b>", "input" => "{$month_html}&nbsp;{$year_html}");
                break;
            case "date":
                if ($display != "") {
                    $displayb = "<b>{$display} To:</b>";
                } else {
                    $displayb = "";
                }
                if ($display != "") {
                    $display = "<b>{$display} From:</b>";
                }
                if (!isset($values['default_from'])) {
                    $values['default_from'] = time();
                }
                if (!isset($values['default_to'])) {
                    $values['default_to'] = time();
                }
                $from_value = isset($_REQUEST[$this_element . "_from"]) ? $_REQUEST[$this_element . "_from"] : date("n/j/Y", $values['default_from']);
                $to_value = isset($_REQUEST[$this_element . "_to"]) ? $_REQUEST[$this_element . "_to"] : date("n/j/Y", $values['default_to']);
                if ($to_value == "" || $from_value == "") {
                    break;
                }
                $this_time = strtotime($from_value);
                $options_years = func_fill_year(isset($_REQUEST[$this_element . "_from_year"]) ? $_REQUEST[$this_element . "_from_year"] : date("Y", $this_time), true);
                $options_months = func_fill_month(isset($_REQUEST[$this_element . "_from_month"]) ? $_REQUEST[$this_element . "_from_month"] : date("n", $this_time), true);
                $options_days = func_fill_day(isset($_REQUEST[$this_element . "_from_day"]) ? $_REQUEST[$this_element . "_from_day"] : date("j", $this_time), 32, true);
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => "\r\n\t\t\t\t\t\t<script language=\"javascript\">\r\n\t\t\t\t\t\t\tfunction func_returnselectedindex(par_selected)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar dt_new =  new Date();\r\n\t\t\t\t\t\t\t\tvar str_year = dt_new.getFullYear()\r\n\t\t\t\t\t\t\t\tfor(i=2003,j=0;i<str_year+10;i++,j++)\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tif (i==par_selected)\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\treturn j;\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tfunction addvalue(dateSelected,monthSelected,yearSelected,obj_element)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tif (obj_element.name == \"" . $this_element . "_from\")\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_from_day.selectedIndex = dateSelected-1 ;\r\n\t\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_from_month.selectedIndex = monthSelected ;\r\n\t\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_from_year.selectedIndex = func_returnselectedindex(yearSelected) ;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tif (obj_element.name == \"" . $this_element . "_to\")\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_to_day.selectedIndex = dateSelected-1 ;\r\n\t\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_to_month.selectedIndex = monthSelected ;\r\n\t\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_to_year.selectedIndex = func_returnselectedindex(yearSelected) ;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tfunction func_" . $this_element . "_from()\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar year = document.search_form." . $this_element . "_from_year.value;\r\n\t\t\t\t\t\t\t\tvar month = document.search_form." . $this_element . "_from_month.value;\r\n\t\t\t\t\t\t\t\tvar day = document.search_form." . $this_element . "_from_day.value;\r\n\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_from.value = month + '/' + day + '/' + year;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t</script>\r\n\t\t\t\t\t\t<select onChange=\"func_" . $this_element . "_from()\" id=\"" . $this_element . "_from_month\" name=\"" . $this_element . "_from_month\" style=\"font-size:10px\" disableOnSubmit='1' >\r\n\t\t\t\t\t\t{$options_months}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t<select onChange=\"func_" . $this_element . "_from()\" id=\"" . $this_element . "_from_day\" name=\"" . $this_element . "_from_day\" class=\"lineborderselect\" style=\"font-size:10px\" disableOnSubmit='1'>\r\n\t\t\t\t\t\t{$options_days}\r\n\t\t\t\t\t\t</select> \r\n\t\t\t\t\t\t<select onChange=\"func_" . $this_element . "_from()\" id=\"" . $this_element . "_from_year\" name=\"" . $this_element . "_from_year\" style=\"font-size:10px\" disableOnSubmit='1'>\r\n\t\t\t\t\t\t{$options_years}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t<input type=\"hidden\"  id='" . $this_element . "_from' name='" . $this_element . "_from' size=\"17\" value=\"" . $from_value . "\">\r\n\t\t\t\t\t\t<input style=\"font-family:verdana;font-size:10px;\" type=\"button\" value=\"...\" onclick=\"init(\$F('MousePointX'),\$F('MousePointY'),\$('" . $this_element . "_from'))\">\r\n\t\t\t\t\t\t");
                $this_time = strtotime($to_value);
                $options_years = func_fill_year(isset($_REQUEST[$this_element . "_to_year"]) ? $_REQUEST[$this_element . "_to_year"] : date("Y", $this_time), true);
                $options_months = func_fill_month(isset($_REQUEST[$this_element . "_to_month"]) ? $_REQUEST[$this_element . "_to_month"] : date("n", $this_time), true);
                $options_days = func_fill_day(isset($_REQUEST[$this_element . "_to_day"]) ? $_REQUEST[$this_element . "_to_day"] : date("j", $this_time), 32, true);
                $frm_entity[] = array("name" => "{$displayb}&nbsp;", "input" => "\r\n\t\t\t\t\t\t<script language=\"javascript\">\r\n\t\t\t\t\t\t\tfunction func_" . $this_element . "_to()\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tvar year = document.search_form." . $this_element . "_to_year.value;\r\n\t\t\t\t\t\t\t\tvar month = document.search_form." . $this_element . "_to_month.value;\r\n\t\t\t\t\t\t\t\tvar day = document.search_form." . $this_element . "_to_day.value;\r\n\t\t\t\t\t\t\t\tdocument.search_form." . $this_element . "_to.value = month + '/' + day + '/' + year;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t</script>\t\t\t\t\t\t\r\n\t\t\t\t\t\t<select onChange=\"func_" . $this_element . "_to()\" id=\"" . $this_element . "_to_month\" name=\"" . $this_element . "_to_month\" style=\"font-size:10px\" disableOnSubmit='1'>\r\n\t\t\t\t\t\t{$options_months}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t<select onChange=\"func_" . $this_element . "_to()\" id=\"" . $this_element . "_to_day\" name=\"" . $this_element . "_to_day\" class=\"lineborderselect\" style=\"font-size:10px\" disableOnSubmit='1'>\r\n\t\t\t\t\t\t{$options_days}\r\n\t\t\t\t\t\t</select> \r\n\t\t\t\t\t\t<select onChange=\"func_" . $this_element . "_to()\" id=\"" . $this_element . "_to_year\" name=\"" . $this_element . "_to_year\" style=\"font-size:10px\" disableOnSubmit='1'>\r\n\t\t\t\t\t\t{$options_years}\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t\t<input type=\"hidden\"  id='" . $this_element . "_to' name='" . $this_element . "_to' size=\"17\" value=\"" . $to_value . "\">\r\n\t\t\t\t\t\t<input style=\"font-family:verdana;font-size:10px;\" type=\"button\" value=\"...\" onclick=\"init(\$F('MousePointX'),\$F('MousePointY'),\$('" . $this_element . "_to'))\">\r\n\t\t\t\t\t\t");
                break;
            case "textarea":
                if ($display != "") {
                    $display = "<b>{$display}:</b>";
                }
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => "<textarea {$action} {$style} id='{$this_element}' name='{$this_element}' {$style}>" . (isset($_REQUEST[$this_element]) ? $_REQUEST[$this_element] : $values['value']) . "</textarea>");
                break;
            case "text":
            default:
                if ($display != "") {
                    $display = "<b>{$display}:</b>";
                }
                $frm_entity[] = array("name" => "{$display}&nbsp;", "input" => "<input {$action} {$style} type='text' id='{$this_element}' name='{$this_element}' value=\"" . (isset($_REQUEST[$this_element]) ? $_REQUEST[$this_element] : $values['value']) . "\"></input>");
                break;
        }
    }
    return $frm_entity;
}