<?php
// - acinfo.php
session_start();
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once "main.php";
Logger::configure('log4php.xml');
$log = Logger::getLogger('acinfo');
global $db, $defaultHomeLink;
$comz = $_SESSION['comnum'];

if ($_GET['submitType']=='cust') {
    $zid = $_GET['id'];
    $comz = $_SESSION['comnum'];
    $result = bill_get_customer($_SESSION['comnum'], $_GET['id']);
    $result1 = bill_get_lcharge($_SESSION['comnum'], $_GET['id']);
    $result2 = bill_get_lpayment($_SESSION['comnum'], $_GET['id']);
//print_r($result);
    if (count($result)>0) {
        echo '<h3>Account Detail Page for: '.$result[0]['name'].'  - Account #:'.$result[0]['account'].'</h3>';
?>
    <table border="1" cellpadding="2" cellspacing="0">
        <tr>
            <td>Billing Name</td>
            <td><?php echo $result[0]['name']?></td>
            <td>Owner Name</td>
            <td><?php echo $result[0]['oname']?></td>
            <td>Account Number</td>
            <td><?php echo $result[0]['account']?></td>
        </tr>
        <tr>
            <td>Address</td>
            <td><?php echo $result[0]['addr']?></td>
            <td>Owner Address</td>
            <td><?php echo $result[0]['oaddr']?></td>
            <td>Meter Serial Number</td>
            <td><?php echo $result[0]['meternum']?></td>
        </tr>
        <tr>
            <td>Address 1</td>
            <td><?php echo $result[0]['addr1']?></td>
            <td>Owner Address 1</td>
            <td><?php echo $result[0]['oaddr1']?></td>
            <td>Physical Address</td>
            <td><?php echo $result[0]['maddr']?></td>
        </tr>
        <tr>
            <td>City</td>
            <td><?php echo $result[0]['city']?></td>
            <td>Owner City</td>
            <td><?php echo $result[0]['ocity']?></td>
            <td>Meter Latitude</td>
            <td><?php echo $result[0]['lat']?></td>
        </tr>
        <tr>
            <td>State</td>
            <td><?php echo $result[0]['state']?></td>
            <td>Owner State</td>
            <td><?php echo $result[0]['ostate']?></td>
            <td>Meter Longitude</td>
            <td><?php echo $result[0]['lon']?></td>
        </tr>
        <tr>
            <td>Zip</td>
            <td><?php echo $result[0]['zip']?></td>
            <td>Owner Zip</td>
            <td><?php echo $result[0]['ozip']?></td>
            <td>Customer Type</td>
            <td>
            <?php if ($result[0]['ctype']==6){
                    echo 'Bill to All Addresses';
               } else if ($result[0]['ctype']==2){
                    echo 'Bill to Both mail'; 
               } else if ($result[0]['ctype']==3){
                    echo 'Bill to Billing email';  
               } else if ($result[0]['ctype']==4){
                    echo 'Bill to Both email';
               } else if ($result[0]['ctype']==5){
                    echo 'Bill to Both Billing'; 
               } else {
                    echo 'Bill to Billing mail';
               } ?>
            </td>
        </tr>
        <tr>
            <td>Billing Email</td>
            <td><?php echo $result[0]['bill_email']?></td>
            <td>Owner Email</td>
            <td><?php echo $result[0]['oemail']?></td>
            <td>Account Active</td>
            <td>
            <?php if ($result[0]['active']==1){
                    echo '<font color="green">Active</font>'; 
               } else {
                    echo '<font color="red">Not Active</font>';}?>
            </td>
        </tr>
        <tr>
            <td>Billing Phone</td>
            <td><?php echo $result[0]['phone']?></td>
            <td>Owner Phone</td>
            <td><?php echo $result[0]['ophone']?></td>
            <td>Web User Name</td>
            <td><?php echo $result[0]['customer_username']?></td>
        </tr>
        <tr>
            <td>Billing Phone 2</td>
            <td><?php echo $result[0]['phone1']?></td>
            <td></td>
            <td></td>
            <td></td>
            <td><?php echo $result[0]['customer_password']?></td>
        </tr>
        <tr>
            <td>Read Order</td>
            <td><?php echo $result[0]['rorder']?></td>
            <td></td>
            <td></td>
            <td style="background-color: yellowgreen;">Last Charge</td>
            <td style="background-color: yellowgreen;"><b>$<?php echo $result1[0]['bamount']?></b></td>
        </tr>
        <tr>
            <td style="background-color: yellowgreen;">Last Month Read</td>
            <td style="background-color: yellowgreen;"><?php echo $result[0]['lmread']?></td>
            <td style="background-color: yellowgreen;">Last Read</td>
            <td style="background-color: yellowgreen;"><?php echo $result[0]['lread']?></td>
            <td style="background-color: yellowgreen;">Last Credit</td>
            <td style="background-color: yellowgreen;"><b>$<?php echo $result2[0]['pamount']?></b></td>
            
        </tr>
        <tr>
            <td style="background-color: yellowgreen;">Last Month Usage</td>
            <td style="background-color: yellowgreen;"><?php echo $result[0]['lmuse']?></td>
            <td style="background-color: yellowgreen;">Last Usage</td>
            <td style="background-color: yellowgreen;"><?php echo $result[0]['luse']?></td>
            <td style="background-color: yellowgreen;">Account Balance</td>
            <td style="background-color: yellowgreen;"><b>$<?php echo $result[0]['abalance']?></b></td>
        </tr>
    </table>
    <table>
        <tr>
            <td>Account Note : <?php echo $result[0]['anote']?></td>
        </tr>
    </table>
    <table>
        <tr>
            <td>
                <button type="button" value="editaccount" onClick="dynamic_Select('includes/acinfo.php', '#accinfo','ZyUpdate', <?php echo $result[0]['account'];?>,'0');">Edit Account</button>
                <button type="button" title="Assign or change rate codes assigned to this customer." value="Assign Rates" onClick="dynamic_Select('includes/rateinfo.php', '#accinfo','rates', <?php echo $result[0]['account'];?>,'0');">Assign or Edit Rate Codes</button>
                <button title="Click to print an Account Detail Report" type="button" value="GoAccount" onClick="window.open('includes/acreports.php?submitType=cust&id='+$('#combobox').val(),'_blank');return false;">Printable Detail Report</button>
            </td>
        </tr>
        <tr>   
            <td>
                <button type="button" title="These notes are permanent and cannot be edited or deleted." value="Add xCharge" onClick="dynamic_Select('includes/acinfo.php', '#accinfo', 'notes', <?php echo $result[0]['account'];?>,'0')">Notes</button>
                <button type="button" title="Work Orders for this customer." value="Add sCharge" onClick="dynamic_Select('includes/acinfo.php', '#accinfo', 'worder', <?php echo $result[0]['account'];?>,'0')">Work Orders</button>
                <button type="button" title="Add a miscellaneous charge to this customer." value="Add Charge" onClick="dynamic_Select('includes/payinfo.php', '#accinfo', 'charge', <?php echo $result[0]['account'];?>,'0')">Add Misc Charge</button>
                <button type="button" title="Add a payment to this account." value="Add Payment" onClick="dynamic_Select('includes/payinfo.php', '#accinfo', 'payment', <?php echo $result[0]['account'];?>,'0')">Add Payment\Credit</button>
            </td>
        </tr>
    </table>            
<?php
    } else {
        echo '<script>alert("Account was not found");</script>';   
    }
} 
else if ($_GET['submitType']=='notes') {
    $result = bill_get_notes($_SESSION['comnum'], $_GET['account']);
    extract($result);
?>    
  <table border=1>
      <tr>
          <th>Date</th>
          <th>Title</th>
          <th>Note</th>
      </tr>   
<?php  
    for ($i=0;$i<count($result);$i++) {
        $res1 = $result[$i];
        echo '<tr><td>'.$res1['dateapp'].'</td><td>'.$res1['title'].'</td><td>'.$res1['other'].'</td></tr>';
    }
?>
    <tr>
        <td><button type="button" value="Add Note" onClick="dynamic_Select('includes/nninfo.php', '#accinfo', 'cust',<?php echo $_GET['account'];?>,<?php echo $_SESSION['comnum'];?>)">Add Note</button>
        </td>
    </tr>
    </table>
<?php
} 
else if ($_GET['submitType']=='worder') {
    $result = bill_get_worders($_SESSION['comnum'], $_GET['account']);
    extract($result);
?>  
    <h4>Click on the Work Order ID to view or edit the work order.</h4>
    <table cellpadding="3" cellspacing="1" border="1" style="text-align:center;">
        <tr>
            <th>Work Order ID</th>
            <th>Entered Date</th>
            <th>Completed Date</th>
            <th>Last Updated Date</th>
            <th>Description of Problem</th>
        </tr>
<?php   
    for ($i=0;$i<count($result);$i++) {
        $res1 = $result[$i];
?>
        <tr><td><a href="#" style="font-size:18px" onclick="dynamic_Select('includes/nwoinfo.php','#accinfo','Edit',<?php echo $res1['account'].','.$_GET['id'];?>);return false;"><font color="blue"><?php echo $res1['id'];?></font></a></td><td>
        <?php date('m/d/Y', strtotime($res1['rdate']));?></td><td><?php date('m/d/Y', strtotime($res1['cdate']));?></td><td><?php date('m/d/Y', strtotime($res1['udate']));?></td><td><?php echo $res1['rinfo1']?></td></tr>
<?php
        }         
?>
        <tr>
            <td><button type="button" value="Add worder" onClick="dynamic_Select('includes/nwoinfo.php', '#accinfo','cust', <?php echo $_GET['account'];?>,<?php echo $_SESSION['comnum'];?>)">Add Work Order</button></td>
            <td><button type="button" title="Print list of this accounts work orders." value="Add sCharge" onClick="window.open('includes/woprint.php?submitType=list&id=<?php echo $_GET['account'];?>', '_blank'); return false;">Print This List</button></td>
        </tr>
    </table>
<?php
} 
else if ($_GET['submitType']=='ZyUpdate') {
    $result = bill_get_customer($_SESSION['comnum'], $_GET['id']);
?>
    <script>
        function setType(type)
        {
            //formName is the name of your form
            document.accinform.submitType.value = type;
        }
    </script>
    <form name="accinform" action="#" onsubmit="jQuery.ajax({url:'includes/acinfo.php', data: jQuery(this).serialize(), cache: false, success: function(data){jQuery('#accinfo').html(data);}});return false;">
    <table border="1">
        <tr>
            <td><label for="name">Billing Name</label></td>
            <td><input type="text" name="name" id="name" value="<?php echo $result[0]['name']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="oname">Owner Name</label></td>
            <td><input type="text" name="oname" id="oname" value="<?php echo $result[0]['oname']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="account">Account Number</label></td>
            <td><input type="text" name="account" id="account" value="<?php echo $result[0]['account']?>" disabled="disabled"></td>
        </tr>
        <tr>
            <td><label for="addr">Address</label></td>
            <td><input type="text" name="addr" id="addr" value="<?php echo $result[0]['addr']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="oaddr">Owner Address</label></td>
            <td><input type="text" name="oaddr" id="oaddr" value="<?php echo $result[0]['oaddr']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="meternum">Meter Serial Number</label></td>
            <td><input type="text" name="meternum" id="meternum" value="<?php echo $result[0]['meternum']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
        </tr>
        <tr>
            <td><label for="addr1">Address 1</label></td>
            <td><input type="text" name="addr1" id="addr1" value="<?php echo $result[0]['addr1']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="oaddr1">Owner Address 1</label></td>
            <td><input type="text" name="oaddr1" id="oaddr1" value="<?php echo $result[0]['oaddr1']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="maddr">Physical Address</label></td>
            <td><input type="text" name="maddr" id="maddr" value="<?php echo $result[0]['maddr']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
        </tr>
        <tr>
            <td><label for="city">City</label></td>
            <td><input type="text" name="city" id="city" value="<?php echo $result[0]['city']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="ocity">Owner City</label></td>
            <td><input type="text" name="ocity" id="ocity" value="<?php echo $result[0]['ocity']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="lat">Meter Latitude</label></td>
            <td><input type="text" name="lat" id="lat" value="<?php echo $result[0]['lat']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
        </tr>
        <tr>
            <td><label for="state">State</label></td>
            <td><input type="text" name="state" id="state" value="<?php echo $result[0]['state']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>> </td>
            <td><label for="ostate">Owner State</label></td>
            <td><input type="text" name="ostate" id="ostate" value="<?php echo $result[0]['ostate']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>> </td>
            <td><label for="lon">Meter Longitude</label></td>
            <td><input type="text" name="lon" id="lon" value="<?php echo $result[0]['lon']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
        </tr>
        <tr>
            <td><label for="zip">Zip</label></td>
            <td><input type="text" name="zip" id="zip" value="<?php echo $result[0]['zip']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>> </td>
            <td><label for="ozip">Owner Zip</label></td>
            <td><input type="text" name="ozip" id="ozip" value="<?php echo $result[0]['ozip']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>> </td>
            <td><label for="ctype">Customer Type</label></td>
            <td><select name="ctype" id="ctype" tabindex=24>
                <?php if ($result[0]['ctype']==6){
                        echo '<option value="1">Bill to Billing mail</option>'; 
                        echo '<option value="2">Bill to Both mail</option>';
                        echo '<option value="3">Bill to Billing email</option>';
                        echo '<option value="4">Bill to Both email</option>';
                        echo '<option value="5">Bill to Both Billing</option>';
                        echo '<option selected="ctype" value="6">Bill to All Addresses</option>';
                   } else if ($result[0]['ctype']==2){
                        echo '<option value="1">Bill to Billing mail</option>'; 
                        echo '<option selected="ctype" value="2">Bill to Both mail</option>';
                        echo '<option value="3">Bill to Billing email</option>';
                        echo '<option value="4">Bill to Both email</option>';
                        echo '<option value="5">Bill to Both Billing</option>';
                        echo '<option value="6">Bill to All Addresses</option>'; 
                   } else if ($result[0]['ctype']==3){
                        echo '<option value="1">Bill to Billing mail</option>'; 
                        echo '<option value="2">Bill to Both mail</option>';
                        echo '<option selected="ctype" value="3">Bill to Billing email</option>';
                        echo '<option value="4">Bill to Both email</option>';
                        echo '<option value="5">Bill to Both Billing</option>';
                        echo '<option value="6">Bill to All Addresses</option>';  
                   } else if ($result[0]['ctype']==4){
                        echo '<option value="1">Bill to Billing mail</option>'; 
                        echo '<option value="2">Bill to Both mail</option>';
                        echo '<option value="3">Bill to Billing email</option>';
                        echo '<option selected="ctype" value="4">Bill to Both email</option>';
                        echo '<option value="5">Bill to Both Billing</option>';
                        echo '<option value="6">Bill to All Addresses</option>';
                   } else if ($result[0]['ctype']==5){
                        echo '<option value="1">Bill to Billing mail</option>'; 
                        echo '<option value="2">Bill to Both mail</option>';
                        echo '<option value="3">Bill to Billing email</option>';
                        echo '<option value="4">Bill to Both email</option>';
                        echo '<option selected="ctype" value="5">Bill to Both Billing</option>';
                        echo '<option value="6">Bill to All Addresses</option>'; 
                   } else {
                        echo '<option value="2">Bill to Both mail</option>';
                        echo '<option value="3">Bill to Billing email</option>';
                        echo '<option value="4">Bill to Both email</option>';
                        echo '<option value="5">Bill to Both Billing</option>';
                        echo '<option value="6">Bill to All Addresses</option>';
                        echo '<option selected="selected" value="1">Bill to Billing mail</option>';
                   }
                ?>    
                </select>
            </td>
        </tr>
        <tr>
            <td><label for="bill_email">Billing Email</label></td>
            <td><input type="text" name="bill_email" id="bill_email" value="<?php echo $result[0]['bill_email']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="oemail">Owner Email</label></td>
            <td><input type="text" name="oemail" id="oemail" value="<?php echo $result[0]['oemail']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly""';}?>></td>
            <td><label for="active">Account Active</label></td>
            <td><select name="active" id="active">
                <?php if ($result[0]['active']==1){
                        echo '<option value="0">Not Active</option>';
                        echo '<option selected="selected" value="1">Active</option>';
                   } else {
                        echo '<option selected="selected" value="0">Not Active</option>';
                        echo '<option value="1">Active</option>';
                   }
                ?>
                </select>
            </td>
        </tr>
        <tr>
            <td><label for="phone">Billing Phone</label></td>
            <td><input type="text" name="phone" id="phone" value="<?php echo $result[0]['phone']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="ophone">Owner Phone</label></td>
            <td><input type="text" name="ophone" id="ophone" value="<?php echo $result[0]['ophone']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="rorder">Read Order</label></td>
            <td><input title="The read order should be book.order example - 2.105 more info on the meter reorder screen" type="text" name="rorder" id="rorder" value="<?php echo $result[0]['rorder']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
        </tr>
        <tr>
            <td><label for="phone1">Billing Phone 2</label></td>
            <td><input type="text" name="phone1" id="phone1" value="<?php echo $result[0]['phone1']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="customer_username">Web User Name</label></td>
            <td><input type="text" name="customer_username" id="customer_username" value="<?php echo $result[0]['customer_username']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
            <td><label for="customer_password">Web User Password</label></td>
            <td><input type="password" name="customer_password" id="customer_username" value="<?php echo $result[0]['customer_username']?>" <?php if ($_SESSION['access']>3){ echo 'readonly="readonly"';}?>></td>
        </tr>                
    </table>
    <table>
        <tr>
            <td><label for="anote">Account Note</label></td>
            <td><input type="text" title="This note is editable at any time and only shows up here." size="109" name="anote" id="anote" value="<?php echo $result[0]['anote']?>"></td>
        </tr>
        <tr>
            <td><input type="hidden" name="submitType">
                <input type="hidden" name="zcomnum" value="<?php echo $comz; ?>">
                <input type="hidden" name="id" value="<?php echo $result[0]['account']?>">
                <input type="submit" title="Any change made above will be updated by pressing this button." onclick="setType('cUpdate')" value="Update Account"/>
            </td>
            <td></td>
        </tr>
    </table>
</form>
<?php
} 
else if ($_GET['submitType']=='payment') {
    $resultxyz = $result = bill_get_customer($_SESSION['comnum'], $_GET['id']); 
    if (count($resultxyz)>0) {
        $resultx = bill_get_ptypes($_SESSION['comnum']);
        $resulty = bill_get_pctypes($_SESSION['comnum']);
        $result = bill_get_bill_history($_SESSION['comnum'], $_GET['id']);
        //print_r($resultx);
        //print_r($resulty);
        echo '<h3>Audit Page for: '.$resultxyz[0]['name'].' Account #:'.$resultxyz[0]['account'].'</h3>';
        echo '<table border=1><tr><th>Date</th><th>Type</th><th>Debit Amount</th><th>Credit Amount'.'</th><th>Usage</th><th>Reference</th><th>Note</th><th>Balance</th></tr>';
        extract($result);
        for ($i=0;$i<count($result);$i++) {
            $res1 = $result[$i];
            if ($res1['pamount']>0) {
                for ($ix=0;$ix<count($resultx);$ix++){
                    $res2 = $resultx[$ix];
                    if ($res2['id']==$res1['type']){
                        $zxy1 = $res2['name']; 
                    }   
                }
                echo '<tr style="background-color: yellowgreen;"><td>'.$res1['date'].'</td><td>'.$zxy1.'</td><td>'.$res1['bamount'].
                    '</td><td>'.$res1['pamount'].'</td><td>'.$res1['usage'].'</td><td>'.$res1['ref1'].
                    '</td><td>'.$res1['note1'].'</td><td>'.$res1['balance'].'</td></tr>';   
            } else if ($res1['bamount']>0) {
                for ($iz=0;$iz<count($resulty);$iz++){
                    $res2 = $resulty[$iz];
                    if ($res2['id']==$res1['type']){
                        $zxy2 = $res2['name']; 
                    }   
                }
                echo '<tr style="background-color: LavenderBlush;"><td>'.$res1['date'].'</td><td>'.$zxy2.'</td><td>'.$res1['bamount'].
                    '</td><td>'.$res1['pamount'].'</td><td>'.$res1['usage'].'</td><td>'.$res1['ref1'].
                    '</td><td>'.$res1['note1'].'</td><td>'.$res1['balance'].'</td></tr>';   
            } else {
                echo '<tr><td>'.$res1['date'].'</td><td>'.$res1['type'].'</td><td>'.$res1['bamount'].
                    '</td><td>'.$res1['pamount'].'</td><td>'.$res1['usage'].'</td><td>'.$res1['ref1'].
                    '</td><td>'.$res1['note1'].'</td><td>'.$res1['balance'].'</td></tr>';
            }
        }
?>
        <table>
            <tr>
                <td><button type="button" title="Add a miscellaneous charge to this customer." value="Add Charge" onClick="dynamic_Select('includes/payinfo.php', '#accinfo', 'charge', <?php echo $_GET['id'];?>,'0')">Add Misc Charge</button></td>
                <td><button type="button" title="Add a payment to this account." value="Add Payment/Credit" onClick="dynamic_Select('includes/payinfo.php', '#accinfo', 'payment', <?php echo $_GET['id'];?>,'0')">Add Payment\Credit</button></td>
                <td><button title="Click to print an Account Audit Report" type="button" value="GoAccount" onClick="window.open('includes/acreports.php?submitType=audit&id='+$('#combobox').val(), '_blank'); return false;">Printable Audit Report</button></td>
            <tr>
        </table>
<?php
   } else  {
        echo '<script>alert("Account was not found");</script>';   
   }
} 
else if ($_GET['submitType']=='cUpdate') {
    if (bill_checkuser($_GET['customer_username'],$_GET['id']) and $_GET['customer_username'] <> '') {
        echo '<script>alert("Someone already has this Web Username");</script>'; 
    } else {    
    $result = bill_update_customer($_GET['name'], $_GET['anote'], $_GET['addr'], $_GET['addr1'], $_GET['city'],
            $_GET['state'], $_GET['zip'], $_GET['phone'], $_GET['phone1'], $_GET['active'], $_GET['bill_email'],
            $_GET['oname'], $_GET['oaddr'], $_GET['oaddr1'], $_GET['ocity'], $_GET['ostate'], $_GET['ozip'],
            $_GET['ophone'], $_GET['maddr'], $_GET['lat'], $_GET['lon'], $_GET['ctype'], $_GET['oemail'],
            $_GET['rorder'], $_GET['customer_username'], md5 ($_GET['customer_password']), $_GET['id']);
    if ($result) {
     echo '<script type=text/javascript>alert("Account updated successfully!");</script>';   
    $log->info($_GET['submitType'].' - user = '.$_SESSION['user'].' - '.$_SESSION['comnum'].' = '.$_GET['id']);
    }
    }
?>
    <script>dynamic_Select('includes/acinfo.php', '#accinfo','cust', <?php echo $_GET['cid'];?>, <?php echo $_SESSION['comnum']?>);</script>
<?php
}
?>