Odyssey
view_vend.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 require_once("$monLibrary/cu_pass.i");
6 
7 
8  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
9  // ** Permissions failed
10  // ** redirect to new page
11  header("Location: /hcuadm/hcu_noperm.prg");
12  exit;
13  }
14 
15 $dms_ok=array('vc'=>'string');
16 
17 dms_import($dms_ok);
18 
19  $dbh = $link;
20 
21  //This form will view a vendor's information
22 
23  echo "<table border=0 cellpadding=3 cellspacing=0 width=\"80%\" class=\"dmsbg\"><tr><td>";
24  if (!isset($vc)) {
25  print <<< no_data
26  <table border=0 cellpadding=1 cellspacing=0 width="100%" bgcolor=white>
27  <tr>
28  <td width="100%" align=center>
29  Incorrect Form Information
30  </td>
31  </tr>
32  </table>
33 no_data;
34  exit;
35  }
36 
37  $sql = "SELECT *
38  FROM cuvendors
39  WHERE vendor = '$vc' ";
40 
41  $db_rs = db_query($sql, $dbh);
42 
43  cu_header("Vendor Information");
44  print <<< js_code
45  <script language="javascript">
46  <!--
47  function close_form() {
48  self.close();
49  }
50  -->
51  </script>
52 js_code;
53  if($db_row = db_fetch_array($db_rs)) {
54  // Vendor Code found, view the information
55 
56 
57  // Loop through all values in the array and set them to be html ready
58  foreach ($db_row as $key => $value) {
59  if ($key == 'email') {
60  // For email create a link so it will be a mailing link
61  $db_row[$key] = "<a href=\"mailto:" . trim($db_row['email']) . "\">" . htmlspecialchars(trim($db_row['email'])) . "</a>&nbsp;";
62  } else {
63  $db_row[$key] = htmlspecialchars(trim($value)) . "&nbsp;";
64  }
65  }
66 
67  print <<< form
68  <table border=0 cellpadding=1 cellspacing=0 width="100%" bgcolor=white>
69  <tr>
70  <td colspan="2" align="center" class="bar">
71  Vendor Information
72  </td>
73  </tr>
74  <tr>
75  <td class="hdr" width="30%" nowrap>Vendor Name:</td>
76  <td nowrap width="70%" class='dtl'>{$db_row['venddesc']}</td>
77  </tr>
78  <tr>
79  <tr>
80  <td class="hdr" width="30%" nowrap>VAR Info:</td>
81  <td nowrap width="70%" class='dtl'>{$db_row['vendvar']}</td>
82  </tr>
83  <td class="hdr" nowrap>Addresss:</td>
84  <td nowrap class='dtl'>{$db_row['addr1']}</td>
85  </tr>
86  <tr>
87  <td class="hdr" nowrap>&nbsp;</td>
88  <td nowrap class='dtl'>{$db_row['addr2']}</td>
89  </tr>
90  <tr>
91  <td class="hdr" nowrap>City</td>
92  <td nowrap class='dtl'>{$db_row['city']}</td>
93  </tr>
94  <tr>
95  <td class="hdr" nowrap>State:</td>
96  <td nowrap class='dtl'>{$db_row['st']}</td>
97  </tr>
98  <tr>
99  <td class="hdr" nowrap>Zip:</td>
100  <td nowrap class='dtl'>{$db_row['zip']}</td>
101  </tr>
102  <tr>
103  <td class="hdr" nowrap>Phone:</td>
104  <td nowrap class='dtl'>{$db_row['phone']}</td>
105  </tr>
106  <tr>
107  <td class="hdr" nowrap>Fax:</td>
108  <td nowrap class='dtl'>{$db_row['fax']}</td>
109  </tr>
110  <tr>
111  <td class="hdr" nowrap>Email:</td>
112  <td nowrap class='dtl'>{$db_row['email']}</td>
113  </tr>
114  <tr>
115  <td class="hdr" nowrap>Contact:</td>
116  <td nowrap class='dtl'>{$db_row['contact']}</td>
117  </tr>
118  <tr>
119  <td class="hdr" valign="top" nowrap>Comments:</td>
120  <td class='dtl'>{$db_row['comments']}</td>
121  </tr>
122  <tr>
123  <td colspan="2" align="center" class='dtl'>
124  <a href="javascript:close_form()">Close Window</a>
125  </td>
126  </tr>
127  </table>
128 form;
129  } else {
130  // Vendor code NOT found, show error and exit;
131  print <<< no_data
132  <table border=0 cellpadding=1 cellspacing=0 width="100%" bgcolor=white>
133  <tr>
134  <td width="100%" class="bar" align=center>
135  No Vendor Record
136  </td>
137  </tr>
138  </table>
139 no_data;
140  }
141  echo "</td></tr></table>";
142 ?>