<?php include("config/config.php"); 
$sql = "select a.vendor_id,a.vendor_group,a.vendor_type,a.name,a.code,b.address_id,b.address,b.address_2,b.address_3,b.country,b.state_code,b.state, "
        . " a.cin_number,a.stn_number,b.gst_number,b.gst_type,b.is_sez, "
        ." b.city,b.city_code,b.pin,b.fax,b.email,b.website,a.ceo,a.ceo_email_id,a.ceo_phone, " 
        ." a.contact_designation,a.contact_person,a.contact_person_phone,a.pan_number,b.phone, "
        . " a.contact_person_email_id from master_vendors as a inner join master_vendors_address as b on a.vendor_id = b.vendor_id"
        . " where a.vendor_id = '".$db_cust->escape($_REQUEST['vendor_id'])."'";
$record = $db_cust->query_first($sql);

$country_sql = "select id,countryRegionId,LongName,ShortName from master_country order by ShortName asc";
$result = $db_cust->query($country_sql);

?>
<style type="text/css">
.form-horizontal .controls {
    margin-left: 140px !important;
    
}
.form-horizontal .control-group {
    margin-bottom:10px !important;
}
.u_error label.error {
    margin-left: 0px !important;
    }
</style>
<form class="form-horizontal" name="frm_edit" id="frm_edit" onsubmit="return false;"> 
<input type="hidden" id="hid_session_user_id" name="hid_session_user_id" value="<?php echo $_SESSION['biz_user_id']; ?>" />
<input type="hidden" id="hid_update_vendor_id" name="hid_update_vendor_id" value="<?php echo $_REQUEST['vendor_id']; ?>" />
<input type="hidden" id="hid_address_id" name="hid_address_id" value="<?php echo $record['address_id']; ?>" />
    <fieldset>
	<div class="acc_setting_wall" style="margin-left:0px;width:100%;">
		<h2 style="border-bottom: 1px solid #e1e1e1;color: #525252;font-size: 12px;line-height: 16px;margin-bottom: 10px;padding-bottom: 3px;text-transform: uppercase;width: 100%;">Edit Customer</h2>
	</div>
    <table style="width:100%;">
            <tr>
                <?php
                $group_mem_checked = "";
                $group_non_checked = "";
                if($record['vendor_group']=="NONMEM"){
                    echo $group_mem_checked = "checked";
                }else if($record['vendor_group']=="NONMEMFORE"){
                    $group_non_checked = "checked";
                }
                ?>
                <td>
                    <div class="control-group" style="float:left; margin-left: 0px;width:100%;">
                        <label for="name" class="control-label">Customer Group&nbsp;&nbsp;<font color="red">*</font></label>
                        <div class="controls">
                            <input style="float:left;" <?php echo $group_mem_checked; ?> <?php if(empty($group_checked)) { echo 'checked'; } ?> type="radio" id="group_nonmem" name="vendor_group" value="NONMEM"/><label for="group_nonmem" style="float:left;margin-left:7px;font-weight:normal;">Non Member</label>
                            <input style="float:left;margin-left:10px;" <?php echo $group_non_checked; ?> type="radio" id="group_nonmemfore" name="vendor_group" value="NONMEMFORE"/><label for="group_nonmemfore" style="float:left;margin-left:7px;font-weight:normal;">Non Member Foreign</label>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="control-group" style="float:left; margin-left: 0px;width:100%;">
                        <label for="name" class="control-label">Customer Name&nbsp;&nbsp;<font color="red">*</font></label>
                        <div class="controls">
                            <input style="width:270px;" type="text" id="name" name="name" class="input-xlarge" value="<?php echo $record['name']; ?>" />
                        </div>
                    </div>
                </td>
                <td>
                    <div class="control-group">
                        <label for="ceo" class="control-label">PAN Card Number&nbsp;&nbsp;<font color="red"></font></label>
                        <div class="controls">
                            <input style="width:270px;" type="text" id="pan_number" name="pan_number" class="input-xlarge" value="<?php echo $record['pan_number']; ?>" />
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <div class="control-group" style="float:left;width:100%;">
                        <label for="ceo" class="control-label">CIN Number&nbsp;&nbsp;<font color="red"></font></label>
                        <div class="controls">
                            <input style="width:270px;" type="text" id="cin_number" name="cin_number" class="input-xlarge" value="<?php echo $record['cin_number']; ?>" />
                        </div>
                    </div>
                </td>
                <td valign="top">
                    <div style="clear:both;"></div>
                    <div class="control-group" style="">   
                        <label for="ceo" class="control-label">Service Tax Number&nbsp;&nbsp;<font color="red"></font></label>
                            <div class="controls">
                                <input style="width:270px;" type="text" id="stn_number" name="stn_number" class="input-xlarge" value="<?php echo $record['stn_number']; ?>" />
                            </div> 
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="top">
                        <div class="control-group" style="">   
                            <label for="ceo" class="control-label">GST Type</label>
                            <div class="controls">
                                <div class="field switch">
                                    <input type="radio" id="gst_type_1" name="gst_type" class="type_select" checked value="1" style="display:none;"/>
                                    <input type="radio" id="gst_type_2" name="gst_type" class="type_select" value="2" style="display:none;"/>
                                    <label for="radio_1" data-type="1" class="cb-enable <?php if($record['gst_type']==1){echo 'selected'; } ?>" style="display:block;"><span>Custom GST</span></label>
                                    <label for="radio_2" data-type="1" class="cb-disable <?php if($record['gst_type']==2){echo 'selected'; } ?>" style="display:block;"><span>GST</span></label>
                                </div>
                            </div> 
                        </div>
                </td>
                <td>
                    <div class="control-group" style="">   
                        <label for="ceo" class="control-label">GST Number</label>
                        <div class="controls">
                            <input style="width:270px;" type="text" id="gst_number" name="gst_number" class="input-xlarge" value="<?php echo $record['gst_number']; ?>" />
                        </div> 
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="top">
                        <div class="control-group" style="">   
                            <label for="is_sez" class="control-label">Is SEZ?<br /><span style="font-size:9px;">(Special Economic Zone)</span></label>
                            <div class="controls">
                                <div class="field switch">
                                    <input type="radio" id="is_sez_1" name="is_sez" class="type_select" value="0" style="display:none;"/>
                                    <input type="radio" id="is_sez_2" name="is_sez" class="type_select" checked value="1" style="display:none;"/>
                                    <label for="is_sez_1" data-type="2" class="cb-enable <?php if($record['is_sez']==0){echo 'selected'; } ?>" style="display:block;"><span>No</span></label>
                                    <label for="is_sez_2" data-type="2" class="cb-disable <?php if($record['is_sez']==1){echo 'selected'; } ?>" style="display:block;"><span>Yes</span></label>
                                </div>
                            </div> 
                        </div>
                </td>
                <td>
                        <div class="control-group">
                        <label for="ceo" class="control-label">CEO</label>
                        <div class="controls">
                            <input type="text" id="ceo" name="ceo" class="input-xlarge" value="<?php echo $record['ceo']; ?>" />
                        </div>
                    </div>
                    </td>
            </tr>
            <tr>
                
                    <td>
                        <div class="control-group">
                        <label for="ceo" class="control-label">CEO Email Id</label>
                        <div class="controls">
                            <input type="text" id="ceo_email_id" name="ceo_email_id" class="input-xlarge" value="<?php echo $record['ceo_email_id']; ?>" />
                        </div>
                    </div>
                    </td>
                    <td>
                        <div class="control-group">
                        <label for="ceo" class="control-label">CEO Phone #</label>
                        <div class="controls">
                            <input type="text" id="ceo_phone" name="ceo_phone" class="input-xlarge" value="<?php echo $record['ceo_phone']; ?>" />
                        </div>
                    </div>
                    </td>
            </tr>
            <tr>
                
                    <td>
                        <div class="control-group">

                        <label for="ceo" class="control-label">Contact Person</label>
                        <div class="controls">
                            <input type="text" id="contact_person" name="contact_person" class="input-xlarge" value="<?php echo $record['contact_person']; ?>" />
                        </div>
                    </div>
                    </td>
                    <td>
                    <div class="control-group">    

                        <label for="ceo" class="control-label">Designation</label>
                        <div class="controls">
                            <input type="text" id="contact_designation" name="contact_designation" class="input-xlarge" value="<?php echo $record['contact_designation']; ?>" />
                        </div> 
                    </div>
                    </td>
            </tr>
            <tr>
                
                
                    <td>
                        <div class="control-group">                                           
                        <label for="ceo" class="control-label">Contact Person Email Id</label>
                        <div class="controls">
                            <input type="text" style="width:270px;" id="contact_person_email_id" name="contact_person_email_id" class="input-xlarge" value="<?php echo $record['contact_person_email_id']; ?>" />
                        </div>
                    </div>
                    </td>   
                    <td>
                    <div class="control-group">  
                        <label for="ceo" class="control-label">Direct Line/Mobile</label>
                        <div class="controls">
                            <input type="text" id="contact_person_phone" name="contact_person_phone" class="input-xlarge" value="<?php echo $record['contact_person_phone']; ?>" /> 
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <div class="clearfix clear"></div>
        <div class="acc_setting_wall" style="margin-left:0px;width:100%;">
		<h2 style="border-bottom: 1px solid #e1e1e1;color: #525252;font-size: 12px;line-height: 16px;margin-bottom: 10px;padding-bottom: 3px;text-transform: uppercase;width: 100%;">Address Details</h2>
	</div>
        <table width="100%">
            <tr>
            <td>
                    <div style="clear:both;"></div>
                    <div class="control-group">
                        <label for="address" class="control-label">Address 1&nbsp;&nbsp;<font color="red">*</font></label>
                        <div class="controls">
                            <textarea type="text" id="address" name="address" class="input-xlarge" style="height:50px;width:270px;resize:vertical;"><?php echo $record['address']; ?></textarea>
                            <label class="error" id="js_add_err" for="address" generated="true" style="padding-left:9px;"></label>
                            <div style="clear:both"></div><div id="address_err" style="padding-left:9px;width:270px;padding-left:9px;width:270px;font-size:11px;font-weight:500;"></div>
                        </div>
                    </div>

                </td>
                <td>
                    <div style="clear:both;"></div>
                    <div class="control-group">
                        <label for="address" class="control-label">Address 2&nbsp;&nbsp;<font color="red"></font></label>
                        <div class="controls">
                            <textarea type="text" id="address_2" name="address_2" class="input-xlarge" style="height:50px;width:270px;resize:vertical;"><?php echo $record['address_2']; ?></textarea>
                            <label class="error" id="js_add_err_2" for="address_2" generated="true" style="padding-left:9px;"></label>
                            <div style="clear:both"></div><div id="address_err_2" style="padding-left:9px;width:270px;padding-left:9px;width:270px;font-size:11px;font-weight:500;"></div>
                        </div>
                    </div>

                </td>
                
            </tr>
            <tr>
                 <td>
                    <div style="clear:both;"></div>
                    <div class="control-group">
                        <label for="address" class="control-label">Address 3&nbsp;&nbsp;<font color="red"></font></label>
                        <div class="controls">
                            <textarea type="text" id="address_3" name="address_3" class="input-xlarge" style="height:50px;width:270px;resize:vertical;"><?php echo $record['address_3']; ?></textarea>
                            <label class="error" id="js_add_err_3" for="address_3" generated="true" style="padding-left:9px;"></label>
                            <div style="clear:both"></div><div id="address_err_3" style="padding-left:9px;width:270px;padding-left:9px;width:270px;font-size:11px;font-weight:500;"></div>
                        </div>
                    </div>

                </td>
                <td>
                    <div class="control-group" style="float:left;width:100%;"> 
                         <label for="category" class="control-label">City&nbsp;&nbsp;<font color="red"></font></label>                        
                        <div class="controls" id="indian_city_div"> 
                            <span id="city_val"> 
                                <input type="text" id="city" name="city" class="input-medium" value="<?php echo $record['city']; ?>" placeholder="City" />
                            </span> 
                            <span id="pin_val"> 
                                <input type="text" id="city_code" name="city_code" class="input-small" placeholder="City Code" value="<?php echo $record['city_code']; ?>" style="width:106px;" />
                            </span>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="control-group">
                        <label for="state" class="control-label">State<font color="red"></font></label>                        
                        <div class="controls" id="state_div">
                            <div style="display:inline;float:left;">                           
                                <input type="text" id="state" name="state" class="input-medium" value="<?php echo $record['state']; ?>" placeholder="State"/> 
                            </div>
                            <div style="display:inline;float:left;margin-left:3px;">                           
                                <input style="width:106px;" type="text" id="state_code" name="state_code" class="input-small" value="<?php echo $record['state_code']; ?>" placeholder="State Code"/> 
                            </div>
                        </div>
                    </div>
                </td><td>
                    <div class="control-group">
                        <label for="country" class="control-label">Country&nbsp;&nbsp;<font color="red">*</font></label>
                        <div class="controls">
                            <select id="country" name="country" style="width:280px;">
                                <option value="">Please select</option>
                                <?php while($rec = $db_cust->fetch_array($result)) { ?>
                                    <option <?php if($record['country'] == $rec['countryRegionId']) { echo 'selected'; } ?> value="<?php echo $rec['countryRegionId']; ?>"><?php echo $rec['ShortName']; ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="control-group">
                        <label for="phone" class="control-label">Pincode</label>
                        <div class="controls">
                            <input style="width:270px;" type="text" id="pincode" name="pincode" class="input-xlarge" value="<?php echo $record['pin']; ?>" />
                        </div>
                    </div>
                </td><td>
                    <div class="control-group">
                        <label for="phone" class="control-label">Phone&nbsp;&nbsp;<font color="red">*</font></label>
                        <div class="controls">
                            <input style="width:270px;" type="text" id="phone" name="phone" class="input-xlarge" value="<?php echo $record['phone']; ?>" />
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td><div class="control-group">
                        <label for="fax" class="control-label">Fax</label>
                        <div class="controls">
                            <input type="text" id="fax" name="fax" class="input-xlarge" value="<?php echo $record['fax']; ?>" />
                        </div>
                    </div>
                </td><td>
                     <div class="control-group">
                        <label for="email" class="control-label">Email</label>
                        <div class="controls">
                            <input type="text" style="width:270px;" id="email_id" name="email_id" class="input-xlarge" value="<?php echo $record['email']; ?>" />
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                   <div class="control-group">
                        <label for="website" class="control-label">Website</label>
                        <div class="controls">
                            <input type="text" id="website" name="website" class="input-xlarge" value="<?php echo $record['website']; ?>" />
                        </div>
                    </div>
                </td>
        </table>
	<div class="control-group">
            <div class="controls" style="margin-left:150px !important;display:block;">
                <button class="btn btn-gebo" id="btn_edit" name="btn_edit" type="button" onclick="update();" >Save</button>
                <button class="btn" onclick="go_to_list()" type="button">Cancel</button>
            </div>
        </div>
        <br />
        <p style="font-size: 11px;"><b>Note:</b> Custom GST number valid only for 90 days.</p>
    </fieldset>
	</form>
	<script  type="text/javascript" language="javascript" src="<?php echo CUSTOMERS_URL ?>js/vendors_validation.js?v=1.6"></script>