<?php require("../config/config.php"); 

$update_vendor_id = $_POST['hid_update_vendor_id'];
$address_id = $_POST['hid_address_id'];

$data['vendor_group'] = $_POST['vendor_group'];
$data["name"] = $_POST['name'];
$data["cin_number"] = $_POST['cin_number'];
$data["stn_number"] = $_POST['stn_number'];

$data["ceo"] = $_POST['ceo'];
$data["ceo_email_id"] = $_POST['ceo_email_id'];
$data["ceo_phone"] = $_POST['ceo_phone'];
$data["contact_person"] = $_POST['contact_person'];
$data["contact_designation"] = $_POST['contact_designation'];
$data["contact_person_email_id"] = $_POST['contact_person_email_id'];
$data["contact_person_phone"] = $_POST['contact_person_phone'];

$data["pan_number"] = $_POST['pan_number'];

$data["updated_ts"] = "NOW()";
$data["updated_by"] = $_REQUEST['user_id'];


$db_cust->query_update("master_vendors", $data, "vendor_id=" . $update_vendor_id);

/* address part */
$address["is_sez"] = $_POST['is_sez'];
$address["gst_type"] = $_POST['gst_type'];
$address["gst_number"] = $_POST['gst_number'];

$address["address"] = $_POST['address'];
$address["address_2"] = $_POST['address_2'];
$address["address_3"] = $_POST['address_3'];
$address["state"] = $_POST['state'];
$address["state_code"] = $_POST['state_code'];
$address["city"] = $_POST['city'];
$address["city_code"] = $_POST['city_code'];
$address["country"] = $_POST['country'];
$address["pin"] = $_POST['pincode'];
$address["phone"] = $_POST['phone'];
$address["fax"] = $_POST['fax'];
$address["email"] = $_POST['email_id'];
$address["website"] = $_POST['website'];

$db_cust->query_update("master_vendors_address", $address, "vendor_id=" . $update_vendor_id." and address_id='".$address_id."'");

$sql = "select code,vendor_from from master_vendors where vendor_id='".$update_vendor_id."'";
$result = $db_cust->query_first($sql);

$data['code'] = $result['code'];
$data['vendor_from'] = $result['vendor_from'];

pushingCustomer(array_merge($data,$address)); 

unset($data);

$db_cust->close();

echo "success";
?>
