Location: PHPKode > projects > Phpgw Time Tracking Add On App > timetrack/newcustomer.php
<?php
  /**************************************************************************\
  * phpgwtimetrack - phpGroupWare addon application                          *
  * http://phpgwtimetrack.sourceforge.net                                    *
  * Written by Robert Schader <hide@address.com>                         *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

  /* $Id: newcustomer.php,v 1.5 2001/01/12 22:14:47 rschader Exp $ */

if($submit) {
  $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
}

  $phpgw_info["flags"]["enable_nextmatchs_class"] = "True";
  $phpgw_info["flags"]["currentapp"] = "timetrack";

  include("../header.inc.php");

if($submit)
 {
  if($cust_active == "True") {
   // Set active flag to Y
   $active = "Y";
  } else {
   $active = "N";
  }

  // I should add a check here later to make sure the company_name doesn't already exist.
  $sql = "INSERT INTO customers (company_name,website,ftpsite,industry_type,status,software,"
	. "lastjobnum,lastjobfinished,busrelationship,notes,active) "
	. "VALUES ('" . addslashes($company_name)
	. "','" .addslashes($website)
	. "','" . addslashes($ftpsite)
	. "','" . addslashes($industry_type)
	. "','" . addslashes($status)
	. "','" . addslashes($software)
	. "','" . addslashes($lastjobnum)
	. "','" . addslashes($lastjobfinished)
	. "','" . addslashes($busrelationship)
	. "','" . addslashes($notes) 
	. "','" . $active
	. "')";

  //echo $sql;
  $phpgw->db->query($sql);
  echo '<script LANGUAGE="JavaScript">';
  echo 'window.location="' . $phpgw->link("customers.php") . '"';
  echo '</script>';
 }
else
 {
  ?>

   <center>
   <form method="POST" name="addcust" action="<?php echo $phpgw->link();?>">
   <p><table border=0 width=60%>

    <tr>
     <th colspan="2" align="center">Add Customer</th>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Company Name"); ?></td>
     <td width="70%"><input name="company_name" value="<?php echo $company_name; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Web Site"); ?></td>
     <td width="70%"><input name="website" value="<?php echo $website; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("FTP Site"); ?></td>
     <td width="70%"><input name="ftpsite" value="<?php echo $ftpsite; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Industry Type"); ?></td>
     <td width="60%"><input name="industry_type" value="<?php echo $industry_type; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Status"); ?></td>
     <td width="70%"><input name="status" value="<?php echo $status; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Software"); ?></td>
     <td width="70%"><input name="software" value="<?php echo $software; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Last Job"); ?></td>
     <td width="70%"><input name="lastjobnum" value="<?php echo $lastjobnum; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Date Finished"); ?></td>
     <td width="70%"><input name="lastjobfinished" value="<?php echo $lastjobfinished; ?>"></td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Relationship"); ?></td>
     <td width="70%"><input name="busrelationship" value="<?php echo $busrelationship; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Active Jobs"); ?></td>
     <td width="60%"><input type="checkbox" name="cust_active" value="True"
       <?php
          if($cust_active == "Y") echo " CHECKED";
           echo "></td>";
       ?>
     </td>
    </tr>

    <tr>
     <td width="30%"><?php echo lang("Notes"); ?></td>
     <td width="70%"><textarea  name="notes" cols="40" rows="4"
        wrap="virtual"><?php echo $notes; ?></textarea></td>
    </tr>

    <tr>
     <td colspan="2">&nbsp;</td>
    </tr>

    <tr>
      <td colspan=2>
      <input type="submit" name="submit" value="<?php echo lang("update"); ?>">
      </td>
    </tr>

    </table>
   </form>
   </center>

<?php
  $phpgw->common->phpgw_footer();
 }
?>
Return current item: Phpgw Time Tracking Add On App