Odyssey
cuvndr.prg
1 <?php
2  $monLibrary= dirname(__FILE__) . "/../library";
3  $monIncludes= dirname(__FILE__) . "/../includes";
4  require_once("$monLibrary/cu_top.i");
5  require_once("$monLibrary/ck_hticket.i");
6  require_once("$monIncludes/cu_remote_top.prg");
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('act'=>'string','addr1'=>'string','addr2'=>'string',
16 'city'=>'string','comments'=>'string','contact'=>'string','email'=>'string',
17 'fax'=>'string','form_err'=>'string','phone'=>'string','Save'=>'string',
18 'st'=>'string','vc'=>'string','vendcode'=>'string','venddesc'=>'string',
19 'vendvar'=>'string','zip'=>'string','msg'=>'string','Remote_Update'=>'array');
20 
21 dms_import($dms_ok);
22 
23 $vendcode = isset($vendcode) ? $vendcode : "";
24 $venddesc = isset($venddesc) ? $venddesc : "";
25 $vendvar = isset($vendvar) ? $vendvar : "";
26 $addr1 = isset($addr1) ? $addr1 : "";
27 $addr2 = isset($addr2) ? $addr2 : "";
28 $city = isset($city) ? $city : "";
29 $st = isset($st) ? $st : "";
30 $zip = isset($zip) ? $zip : "";
31 $phone = isset($phone) ? $phone : "";
32 $fax = isset($fax) ? $fax : "";
33 $email = isset($email) ? $email : "";
34 $contact = isset($contact) ? $contact : "";
35 $comments = isset($comments) ? $comments : "";
36 
37  if (!isset($act)) $act = "2";
38 
39  switch ($act):
40  case "1": // Edit Cu Vendors
41  cu_header("Edit CU Vendors");
42 ?>
43  <form action="cuvndr.prg?act=3" method="post">
44  <?php
45  $num_rows = 0;
46  if (isset($vc)) {
47  // Connect to the database - get the team information from the database
48  $query = "select *
49  from cuvendors
50  where vendor = '$vc'";
51  $result = db_query($query, $link);
52  // Now fetch the row
53  $cuvndr_row = db_fetch_object($result);
54  $num_rows = db_num_rows($result);
55  }
56  ?>
57  <p>&nbsp;
58  <p>
59  <?php
60  if (isset($form_err) && strlen($form_err) > 0)
61  printf("\n<font color=\"red\">Errors found before saving the information. Please review errors at bottom of screen.\n<p></font>");
62  ?>
63  <center>
64  <table cellpadding="3" cellspacing="0" border="0" width="500" class='dmsbg'><tr><td>
65  <table cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor=white>
66  <tr>
67  <td colspan="2" class="bar" align="center">
68  <?php if($num_rows > 0): ?>
69  EDIT CU VENDOR CODE
70  <?php else: ?>
71  ADD CU VENDOR CODE
72  <?php endif; ?>
73  </td>
74  </tr>
75  <tr>
76  <td nowrap align="right" class="hdr">
77  Vendor Code:
78  </td>
79  <td nowrap class='dtl'>
80  <?php if ($num_rows == 0): ?>
81  <?php
82  $cu_info = "";
83  if ($num_rows > 0) {
84  $cu_info = htmlspecialchars(trim($cuvndr_row->vendor));
85  } else {
86  $cu_info = set_string($vendcode);
87  }
88  ?>
89  <input type="text" name="vendcode" size="15" maxlength="15" value="<?php echo $cu_info ?>">
90  <?php else: ?>
91  <?php echo $cuvndr_row->vendor ?>
92  <input type="hidden" name="vendcode" maxlength="30" value="<?php echo htmlspecialchars(trim($cuvndr_row->vendor)) ?>">
93  <?php endif; ?>
94  </td>
95  </tr>
96  <tr>
97  <td nowrap align="right" class="hdr">
98  Name:
99  </td>
100  <td nowrap class='dtl'>
101  <?php
102  $cu_info = "";
103  if ($num_rows > 0) {
104  $cu_info = htmlspecialchars(trim($cuvndr_row->venddesc));
105  } else {
106  $cu_info = set_string($venddesc);
107  }
108  ?>
109  <input type="text" name="venddesc" size="30" maxlength="30" value="<?php echo $cu_info ?>">
110  </td>
111  </tr>
112  <tr>
113  <td nowrap align="right" class="hdr">
114  Vendor VAR:
115  </td>
116  <td nowrap class='dtl'>
117  <?php
118  $cu_info = "";
119  if ($num_rows > 0) {
120  $cu_info = htmlspecialchars(trim($cuvndr_row->vendvar));
121  } else {
122  $cu_info = set_string($vendvar);
123  }
124  ?>
125  <input type="text" name="vendvar" size="30" maxlength="30" value="<?php echo $cu_info ?>">
126  </td>
127  </tr>
128  <tr>
129  <td nowrap align="right" class="hdr">
130  Address:
131  </td>
132  <td nowrap class='dtl'>
133  <?php
134  $cu_info = "";
135  if ($num_rows > 0) {
136  $cu_info = htmlspecialchars(trim($cuvndr_row->addr1));
137  } else {
138  $cu_info = set_string($addr1);
139  }
140  ?>
141  <input type="text" name="addr1" size="40" maxlength="40" value="<?php echo $cu_info ?>">
142  </td>
143  </tr>
144  <tr>
145  <td nowrap align="right" class="hdr">
146  &nbsp;
147  </td>
148  <td nowrap class='dtl'>
149  <?php
150  $cu_info = "";
151  if ($num_rows > 0) {
152  $cu_info = htmlspecialchars(trim($cuvndr_row->addr2));
153  } else {
154  $cu_info = set_string($addr2);
155  }
156  ?>
157  <input type="text" name="addr2" size="40" maxlength="40" value="<?php echo $cu_info ?>">
158  </td>
159  </tr>
160  <tr>
161  <td nowrap align="right" class="hdr">
162  City:
163  </td>
164  <td nowrap class='dtl'>
165  <?php
166  $cu_info = "";
167  if ($num_rows > 0) {
168  $cu_info = htmlspecialchars(trim($cuvndr_row->city));
169  } else {
170  $cu_info = set_string($city);
171  }
172  ?>
173  <input type="text" name="city" size="25" maxlength="25" value="<?php echo $cu_info ?>">
174  </td>
175  </tr>
176  <tr>
177  <td align="right" nowrap class="hdr">
178  State:
179  </td>
180  <td class='dtl'>
181  <?php
182  $cu_info = "";
183  if ($num_rows > 0) {
184  $cu_info = htmlspecialchars(trim($cuvndr_row->st));
185  } else {
186  $cu_info = set_string($st);
187  }
188 
189  ?>
190  <select name="st" size=1>
191  <OPTION VALUE="">&lt;Select&gt;
192  <OPTION VALUE="AL" <?php if ($cu_info == "AL")echo "SELECTED" ?>> Alabama
193  <OPTION VALUE="AK" <?php if ($cu_info == "AK")echo "SELECTED" ?>> Alaska
194  <OPTION VALUE="AZ" <?php if ($cu_info == "AZ")echo "SELECTED" ?>> Arizona
195  <OPTION VALUE="AR" <?php if ($cu_info == "AR")echo "SELECTED" ?>> Arkansas
196  <OPTION VALUE="CA" <?php if ($cu_info == "CA")echo "SELECTED" ?>> California
197  <OPTION VALUE="CO" <?php if ($cu_info == "CO")echo "SELECTED" ?>> Colorado
198  <OPTION VALUE="CT" <?php if ($cu_info == "CT")echo "SELECTED" ?>> Connecticut
199  <OPTION VALUE="DE" <?php if ($cu_info == "DE")echo "SELECTED" ?>> Delaware
200  <OPTION VALUE="DC" <?php if ($cu_info == "DC")echo "SELECTED" ?>> District of Columbia
201  <OPTION VALUE="FL" <?php if ($cu_info == "FL")echo "SELECTED" ?>> Florida
202  <OPTION VALUE="GA" <?php if ($cu_info == "GA")echo "SELECTED" ?>> Georgia
203  <OPTION VALUE="HI" <?php if ($cu_info == "HI")echo "SELECTED" ?>> Hawaii
204  <OPTION VALUE="ID" <?php if ($cu_info == "ID")echo "SELECTED" ?>> Idaho
205  <OPTION VALUE="IL" <?php if ($cu_info == "IL")echo "SELECTED" ?>> Illinois
206  <OPTION VALUE="IN" <?php if ($cu_info == "IN")echo "SELECTED" ?>> Indiana
207  <OPTION VALUE="IA" <?php if ($cu_info == "IA")echo "SELECTED" ?>> Iowa
208  <OPTION VALUE="KS" <?php if ($cu_info == "KS")echo "SELECTED" ?>> Kansas
209  <OPTION VALUE="KY" <?php if ($cu_info == "KY")echo "SELECTED" ?>> Kentucky
210  <OPTION VALUE="LA" <?php if ($cu_info == "LA")echo "SELECTED" ?>> Louisiana
211  <OPTION VALUE="ME" <?php if ($cu_info == "ME")echo "SELECTED" ?>> Maine
212  <OPTION VALUE="MD" <?php if ($cu_info == "MD")echo "SELECTED" ?>> Maryland
213  <OPTION VALUE="MA" <?php if ($cu_info == "MA")echo "SELECTED" ?>> Massachusetts
214  <OPTION VALUE="MI" <?php if ($cu_info == "MI")echo "SELECTED" ?>> Michigan
215  <OPTION VALUE="MN" <?php if ($cu_info == "MN")echo "SELECTED" ?>> Minnesota
216  <OPTION VALUE="MS" <?php if ($cu_info == "MS")echo "SELECTED" ?>> Mississippi
217  <OPTION VALUE="MO" <?php if ($cu_info == "MO")echo "SELECTED" ?>> Missouri
218  <OPTION VALUE="MT" <?php if ($cu_info == "MT")echo "SELECTED" ?>> Montana
219  <OPTION VALUE="NE" <?php if ($cu_info == "NE")echo "SELECTED" ?>> Nebraska
220  <OPTION VALUE="NV" <?php if ($cu_info == "NV")echo "SELECTED" ?>> Nevada
221  <OPTION VALUE="NH" <?php if ($cu_info == "NH")echo "SELECTED" ?>> New Hampshire
222  <OPTION VALUE="NJ" <?php if ($cu_info == "NJ")echo "SELECTED" ?>> New Jersey
223  <OPTION VALUE="NM" <?php if ($cu_info == "NM")echo "SELECTED" ?>> New Mexico
224  <OPTION VALUE="NY" <?php if ($cu_info == "NY")echo "SELECTED" ?>> New York
225  <OPTION VALUE="NC" <?php if ($cu_info == "NC")echo "SELECTED" ?>> North Carolina
226  <OPTION VALUE="ND" <?php if ($cu_info == "ND")echo "SELECTED" ?>> North Dakota
227  <OPTION VALUE="OH" <?php if ($cu_info == "OH")echo "SELECTED" ?>> Ohio
228  <OPTION VALUE="OK" <?php if ($cu_info == "OK")echo "SELECTED" ?>> Oklahoma
229  <OPTION VALUE="OR" <?php if ($cu_info == "OR")echo "SELECTED" ?>> Oregon
230  <OPTION VALUE="PA" <?php if ($cu_info == "PA")echo "SELECTED" ?>> Pennsylvania
231  <OPTION VALUE="RI" <?php if ($cu_info == "RI")echo "SELECTED" ?>> Rhode Island
232  <OPTION VALUE="SC" <?php if ($cu_info == "SC")echo "SELECTED" ?>> South Carolina
233  <OPTION VALUE="SD" <?php if ($cu_info == "SD")echo "SELECTED" ?>> South Dakota
234  <OPTION VALUE="TN" <?php if ($cu_info == "TN")echo "SELECTED" ?>> Tennessee
235  <OPTION VALUE="TX" <?php if ($cu_info == "TX")echo "SELECTED" ?>> Texas
236  <OPTION VALUE="UT" <?php if ($cu_info == "UT")echo "SELECTED" ?>> Utah
237  <OPTION VALUE="VT" <?php if ($cu_info == "VT")echo "SELECTED" ?>> Vermont
238  <OPTION VALUE="VA" <?php if ($cu_info == "VA")echo "SELECTED" ?>> Virginia
239  <OPTION VALUE="WA" <?php if ($cu_info == "WA")echo "SELECTED" ?>> Washington
240  <OPTION VALUE="WV" <?php if ($cu_info == "WV")echo "SELECTED" ?>> West Virginia
241  <OPTION VALUE="WI" <?php if ($cu_info == "WI")echo "SELECTED" ?>> Wisconsin
242  <OPTION VALUE="WY" <?php if ($cu_info == "WY")echo "SELECTED" ?>> Wyoming
243  <OPTION VALUE="VI" <?php if ($cu_info == "VI")echo "SELECTED" ?>> U.S. Virgin Islands
244  </select>
245  </td>
246  </tr>
247  <tr>
248  <td nowrap align="right" class="hdr">
249  Zip:
250  </td>
251  <td nowrap class='dtl'>
252  <?php
253  $cu_info = "";
254  if ($num_rows > 0) {
255  $cu_info = htmlspecialchars(trim($cuvndr_row->zip));
256  } else {
257  $cu_info = set_string($zip);
258  }
259  ?>
260  <input type="text" name="zip" size="15" maxlength="15" value="<?php echo $cu_info ?>">
261  </td>
262  </tr>
263  <tr>
264  <td nowrap align="right" class="hdr">
265  Phone:
266  </td>
267  <td nowrap class='dtl'>
268  <?php
269  $cu_info = "";
270  if ($num_rows > 0) {
271  $cu_info = htmlspecialchars(trim($cuvndr_row->phone));
272  } else {
273  $cu_info = set_string($phone);
274  }
275  ?>
276  <input type="text" name="phone" size="20" maxlength="20" value="<?php echo $cu_info ?>">
277  </td>
278  </tr>
279  <tr>
280  <td nowrap align="right" class="hdr">
281  Fax:
282  </td>
283  <td nowrap class='dtl'>
284  <?php
285  $cu_info = "";
286  if ($num_rows > 0) {
287  $cu_info = htmlspecialchars(trim($cuvndr_row->fax));
288  } else {
289  $cu_info = set_string($fax);
290  }
291  ?>
292  <input type="text" name="fax" size="20" maxlength="20" value="<?php echo $cu_info ?>">
293  </td>
294  </tr>
295  <tr>
296  <td nowrap align="right" class="hdr">
297  Email:
298  </td>
299  <td nowrap class='dtl'>
300  <?php
301  $cu_info = "";
302  if ($num_rows > 0) {
303  $cu_info = htmlspecialchars(trim($cuvndr_row->email));
304  } else {
305  $cu_info = set_string($email);
306  }
307  ?>
308  <input type="text" name="email" size="40" maxlength="40" value="<?php echo $cu_info ?>">
309  </td>
310  </tr>
311  <tr>
312  <td nowrap align="right" class="hdr">
313  Contact:
314  </td>
315  <td nowrap class='dtl'>
316  <?php
317  $cu_info = "";
318  if ($num_rows > 0) {
319  $cu_info = htmlspecialchars(trim($cuvndr_row->contact));
320  } else {
321  $cu_info = set_string($contact);
322  }
323  ?>
324  <input type="text" name="contact" size="40" maxlength="40" value="<?php echo $cu_info ?>">
325  </td>
326  </tr>
327  <tr>
328  <td nowrap align="right" class="hdr" valign="top">
329  Comments:
330  </td>
331  <td nowrap class='dtl'>
332  <?php
333  $cu_info = "";
334  if ($num_rows > 0) {
335  $cu_info = htmlspecialchars(trim($cuvndr_row->comments));
336  } else {
337  $cu_info = set_string($comments);
338  }
339  ?>
340  <textarea name="comments" rows=5 cols=40 wrap="physical"><?php echo $cu_info; ?></textarea>
341  </td>
342  </tr>
343  <tr>
344  <td class='dtl'>&nbsp;</td>
345  <td nowrap class='dtl'>
346  <?php remote_update_list(); ?>
347  </td>
348  </tr>
349  <tr>
350  <td class='dtl'>&nbsp;</td>
351  <td nowrap class='dtl'>
352  <input type="submit" name="Save" Value="Save">
353  <input type="button" name="Cancel" Value="Cancel" onClick="document.location='cuvndr.prg'">
354  </td>
355  </tr>
356  </table>
357  </td></tr></table>
358 
359  <?php // If the error value is here then print it at the end
360  if (isset($form_err))
361  {
362  echo $form_err;
363  echo "<hr>";
364  }
365  break;
366  case "2":
367  cu_header("CU Vendor Codes");
368  ?>
369  <form>
370 
371  <?php
372  // Connect to the data and retrieve the current list of Home CU Products
373  $query = "SELECT * FROM cuvendors ORDER BY vendor";
374  $prod_result = db_query($query, $link);
375 
376  ?>
377 
378  <!-- Print out the top of the table -->
379 
380  <table border="0" cellpadding="3" cellspacing="0" align="center" class='dmsbg' width="500"><tr><td>
381  <table border="0" cellpadding="1" cellspacing="0" align="center" width="100%" bgcolor=white>
382  <tr>
383  <td colspan="5" class="bar" align="center">
384  CU VENDOR CODES LIST
385  </td>
386  </tr>
387  <?php if (isset($msg)): ?>
388  <tr>
389  <td colspan="5" class="msg" align="center">
390  <?php echo $msg; ?>
391  </td>
392  </tr>
393  <?php endif; ?>
394  <tr>
395  <td class="hdr" align="left">
396  CU Vendor Code
397  </td>
398  <td class="hdr" align="left">
399  Name
400  </td>
401  <td class="hdr" align="left">
402  Contact
403  </td>
404  <td class="hdr" align="left">
405  Phone
406  </td>
407  <td class="hdr" align="center">
408  Select
409  </td>
410  </tr>
411  <?php
412  $RGB = "odd";
413  $row = 0;
414  while ($prod_row = db_fetch_object($prod_result, $row)):
415  $row++;
416  ?>
417  <tr class="<?php echo $RGB; ?>">
418  <td nowrap >
419  <?php echo trim($prod_row->vendor) ?>
420  </td>
421  <td nowrap >
422  <?php echo trim($prod_row->vendvar) ?>
423  </td>
424  <td nowrap>
425  <?php echo trim($prod_row->contact) ?>
426  </td>
427  <td nowrap>
428  <?php echo trim($prod_row->phone) ?>
429  </td>
430  <td nowrap >
431  <a href="cuvndr.prg?act=1&vc=<?php echo trim($prod_row->vendor) ?>">Edit</a>
432  <?php /*&nbsp;|&nbsp;
433  <a href="">Delete</a>
434  */ ?>
435  </td>
436  </tr>
437  <?php
438  $RGB = ($RGB == "odd" ? "even" : "odd");
439  endwhile; ?>
440 
441  <tr>
442  <td colspan="3">
443  <a href="cuvndr.prg?act=1">Add CU Vendor Code</a>
444  &nbsp;|&nbsp;
445  <a href="<?php echo $infourl ?>/hcuadm/cuilist.prg" target="parent">Credit Union List</a>
446  </td>
447  </tr>
448  </table>
449  </td></tr></table>
450 <?php
451  break;
452  case "3":
453  cu_header("Save Vendor Code");
454  // Setup a function to go back to the CU Edit form, if anything went wrong
455  function save_fail($msg){
456  global $vendcode;
457  printf("<script language=\"javascript\">\n");
458  printf("document.forms[0].elements[\"form_err\"].value = '%s';\n", $msg);
459  printf("document.forms[0].action=\"cuvndr?act=1&vc=%s\";\n", $vendcode);
460  printf("document.forms[0].method=\"post\";\n");
461  printf("document.forms[0].submit();\n");
462  printf("</script>");
463  printf("\n</form>\n </body>\n </html>\n");
464  exit();
465  }
466 
467  ?>
468 
469  <form action="cuvndr?act=1" method="post">
470  <?php
471  $errors_found = "No";
472  $err_msg = "";
473 
474 
475  /* VALIDATE THE INFORMATION - whether it's been saved before or NOT
476  After validation fails it will send the information back to the edit form
477  So it looks like it did before, the fail information will be at the bottom of the
478  screen.
479 
480  */
481  $err_msg="";
482 
483  // Now we need to load all the fields from the CU form, and post them back
484  // So the user does not have to press the back button.
485  // Load all the Fields from the previous form into hidden fields on this form
486  ?>
487  <!-- LOAD ALL HIDDEN FIELDS -->
488 
489  <!-- Description -->
490  <input type="hidden" name="vendcode" value="<?php echo set_string($vendcode) ?>">
491  <input type="hidden" name="venddesc" value="<?php echo set_string($venddesc) ?>">
492  <input type="hidden" name="vendvar" value="<?php echo set_string($vendvar) ?>">
493  <input type="hidden" name="addr1" value="<?php echo set_string($addr1) ?>">
494  <input type="hidden" name="addr2" value="<?php echo set_string($addr2) ?>">
495  <input type="hidden" name="city" value="<?php echo set_string($city) ?>">
496  <input type="hidden" name="st" value="<?php echo set_string($st) ?>">
497  <input type="hidden" name="zip" value="<?php echo set_string($zip) ?>">
498  <input type="hidden" name="phone" value="<?php echo set_string($phone) ?>">
499  <input type="hidden" name="fax" value="<?php echo set_string($fax) ?>">
500  <input type="hidden" name="email" value="<?php echo set_string($email) ?>">
501  <input type="hidden" name="contact" value="<?php echo set_string($contact) ?>">
502  <input type="hidden" name="comments" value="<?php echo set_string($comments) ?>">
503 
504  <!-- Create a hidden field for the form error -->
505  <input type="hidden" name="form_err" value="">
506 
507  <?php if (strlen($err_msg) > 0): ?>
508  <?php
509  //If an error was found post the information back to the CU edit form here
510  $form_err = sprintf("<font size=\"+1\">ERROR! Problems with the credit union information found: <BR></font>");
511  $form_err .= sprintf("The following errors will need to be corrected before you will be allowed to save the form.");
512  $form_err .= sprintf("<P> <font color=red>%s</font>", $err_msg);
513  save_fail($form_err);
514  ?>
515  <?php else: ?>
516 
517  <?php
518  // Everything was validated, we now need to save the information, either insert for new or update for edited.
519 
520  $save_sql = "SELECT vendor FROM cuvendors WHERE vendor = '$vendcode'";
521  // Execute the query and find out how many rows are in the query
522  $db_result = db_query($save_sql, $link);
523 
524  $num_rows = db_num_rows($db_result);
525  if ($num_rows > 0 ) {
526  // UPDATE the information into the table
527  $qry_stmt = sprintf("UPDATE cuvendors ");
528  $qry_stmt .= sprintf("SET venddesc ='%s', ",prep_save($venddesc));
529  $qry_stmt .= sprintf("vendvar ='%s', ",prep_save($vendvar));
530  $qry_stmt .= sprintf("addr1 ='%s', ",prep_save($addr1));
531  $qry_stmt .= sprintf("addr2 ='%s', ",prep_save($addr2));
532  $qry_stmt .= sprintf("city ='%s', ",prep_save($city));
533  $qry_stmt .= sprintf("st ='%s', ",prep_save($st));
534  $qry_stmt .= sprintf("zip ='%s', ",prep_save($zip));
535  $qry_stmt .= sprintf("phone ='%s', ",prep_save($phone));
536  $qry_stmt .= sprintf("fax ='%s', ",prep_save($fax));
537  $qry_stmt .= sprintf("email ='%s', ",prep_save($email));
538  $qry_stmt .= sprintf("contact ='%s', ",prep_save($contact));
539  $qry_stmt .= sprintf("comments = '%s' ", prep_save($comments));
540  $qry_stmt .= sprintf("WHERE vendor = '%s'; ",$vendcode);
541  } else {
542  $qry_stmt = sprintf("INSERT INTO cuvendors ");
543  $qry_stmt .= sprintf("(vendor, venddesc, vendvar, addr1, addr2, city, ");
544  $qry_stmt .= sprintf("st, zip, phone, fax, email, contact, comments) ");
545  $qry_stmt .= sprintf(" VALUES (");
546  $qry_stmt .= sprintf("'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'); ",
547  strtoupper(prep_save($vendcode)),
548  prep_save($venddesc),
549  prep_save($vendvar),
550  prep_save($addr1),
551  prep_save($addr2),
552  prep_save($city),
553  prep_save($st),
554  prep_save($zip),
555  prep_save($phone),
556  prep_save($fax),
557  prep_save($email),
558  prep_save($contact),
559  prep_save($comments));
560  }
561  // Now pass the query to the Database
562 
563  if (!($db_result=db_query($qry_stmt, $link))) {
564  // A problem was encoutered with saving the data - report the message
565  $form_err = sprintf("<br>");
566  $form_err .= sprintf("<font face=\"Arial\" size=\"2\">Unable to Save Home CU Vendor Code!</font><br>");
567  save_fail($form_err);
568  } else {
569  printError(sprintf("Vendor Code Saved Successfully.<br>
570  <a href=\"cuvndr.prg?act=2\" target=\"CONTENT\">CU Vendor Code List</a>"));
571 
572  // Only need to do this if at least one remote server was selected
573  if (Remote_Update_Selected()) {
574  // ** NOW CHECK FOR SAVING TO A REMOTE SERVER
575  // ** Add Each field that will be updated
576  Remote_Field_Add("cuvndr", "vendcode", $vendcode);
577  Remote_Field_Add("cuvndr", "venddesc", $venddesc);
578  Remote_Field_Add("cuvndr", "vendvar", $vendvar);
579  Remote_Field_Add("cuvndr", "addr1", $addr1);
580  Remote_Field_Add("cuvndr", "addr2", $addr2);
581  Remote_Field_Add("cuvndr", "city", $city);
582  Remote_Field_Add("cuvndr", "st", $st);
583  Remote_Field_Add("cuvndr", "zip", $zip);
584  Remote_Field_Add("cuvndr", "phone", $phone);
585  Remote_Field_Add("cuvndr", "fax", $fax);
586  Remote_Field_Add("cuvndr", "email", $email);
587  Remote_Field_Add("cuvndr", "contact", $contact);
588  Remote_Field_Add("cuvndr", "comments", $comments);
589 
590  // ** Need to create the url I am going to send to the remote server
591  $Remote_Results = Remote_Update_Send("U", "cuvndr");
592  echo $Remote_Results;
593 
594  }
595  }
596  header ("Location: " . $_SERVER['PHP_SELF'] . "?msg=" . urlencode($Remote_Results));
597 /*
598  print <<< js
599  <script language="javascript">
600  document.location = "cuvndr";
601  </script>
602 js;
603 */
604  ?>
605  <?php endif; ?>
606 
607  <?php
608  break;
609  default:
610  cu_header("Error Displaying Form");
611  print ("<form>");
612  printError("Requested form not found!<br>Cancelling action.");
613  endswitch;
614  ?>
615  </form>
616  </body>
617 </html>
618