return $value; } $new_customer = SelectNewCustomer(); //foreach ($new_customer as $customer) { // $check_company_name = checkcomp($customer['comp_name']); // if (count($check_company_name) < 1) { // $query = "INSERT INTO sohorepro_company SET // comp_name = '" . $customer['comp_name'] . "', // comp_contact_name = '" . $customer['comp_contact_name'] . "', // comp_contact_email = '" . $customer['comp_contact_email'] . "', // comp_contact_phone = '" . $customer['comp_contact_phone'] . "', // comp_contact_fax = '" . $customer['comp_contact_fax'] . "', // comp_business_address1 = '" . $customer['comp_business_address1'] . "', // comp_business_address2 = '" . $customer['comp_business_address2'] . "', // comp_business_address3 = '" . $customer['comp_business_address3'] . "', // comp_city = '" . $customer['comp_city'] . "', // comp_state = '" . $customer['comp_state'] . "', // comp_zipcode = '" . $customer['comp_zipcode'] . "', // status = '" . $customer['status'] . "' "; // mysql_query($query); // } // //} foreach ($new_customer as $customer) { $check_company_name = checkcomp($customer['comp_name']); $comp_name = compName($customer['comp_name']); if (count($check_company_name) < 1) { $query = "INSERT INTO sohorepro_address SET comp_id = '" . $comp_name . "',\n company_name = '" . $customer['company_name'] . "',\n contact_name = '" . $customer['comp_contact_name'] . "',\n address_1 = '" . $customer['comp_business_address1'] . "',\n address_2 = '" . $customer['comp_business_address1'] . "',\n city = '" . $customer['status'] . "',\n state = '" . $customer['status'] . "',\n zip = '" . $customer['status'] . "', \n attention_to = '" . $customer['status'] . "',\n type = '1' "; mysql_query($query); } }
} } //Address Book Data Insert ---End--- //Customer Data Insert ---Start--- for($i=1;$i<=$data->sheets[0]['numRows'];$i++) { $customer_fname = " "; $customer_lname = " "; $customer_contactname = mysql_real_escape_string($data->sheets[0]['cells'][$i][3]); $customer_email = $data->sheets[0]['cells'][$i][29]; $check_customer_email = checkMail($customer_email); $customer_company_name = $data->sheets[0]['cells'][$i][2]; $comp_name = compName($customer_company_name); $companyphone = $data->sheets[0]['cells'][$i][10]; $companyfax = $data->sheets[0]['cells'][$i][14]; $billing_add1 = $data->sheets[0]['cells'][$i][5]; $billing_add2 = $data->sheets[0]['cells'][$i][6]; $billing_city = $data->sheets[0]['cells'][$i][7]; $billing_state = $data->sheets[0]['cells'][$i][8]; $bill_state_val = State_Val($billing_state); $billing_zip = $data->sheets[0]['cells'][$i][9]; $invoice_type = $data->sheets[0]['cells'][$i][18]; $billing_frequency = $data->sheets[0]['cells'][$i][19]; $account_status = $data->sheets[0]['cells'][$i][20]; $status = ($account_status == 'Y')? '1':'0'; $shipping_comp_name = " "; $shipping_add1 = $data->sheets[0]['cells'][$i][21]; $shipping_city = $data->sheets[0]['cells'][$i][22];
} //Delete Favorites if (isset($_POST['fav_item_delete_comp']) && $_POST['fav_item_delete_comp'] != '') { $fav_item_delete_comp = $_POST['fav_item_delete_comp']; $delete_fav = "DELETE FROM sohorepro_favorites WHERE comp_id = '" . $fav_item_delete_comp . "' AND delete_id = '1' "; $result = mysql_query($delete_fav); if ($result) { echo '1'; } else { echo '0'; } } //Assign Order To Another Customer if (isset($_POST['change_cus_order']) && $_POST['change_cus_order'] != '') { $Customer_name_orders = $_POST['customer_name']; $customer_id = compName($Customer_name_orders); $current_cus_id = $_POST['current_cus_id']; $cus_manager = GetCusManager($customer_id); $delete_fav = "UPDATE sohorepro_order_master SET customer_company = '" . $customer_id . "', customer_name = '" . $cus_manager . "', customer_company_name = '" . $Customer_name_orders . "' WHERE id = '" . $current_cus_id . "' "; $result = mysql_query($delete_fav); if ($result) { echo '1'; } else { echo '0'; } } //Close the Order if (isset($_POST['order_closed_now_id']) && $_POST['order_closed_now_id'] != '') { $order_closed_now_id = $_POST['order_closed_now_id']; $current_status = OrderComment($order_closed_now_id); $close_status = $current_status[0]['closed_status'] == '1' ? '0' : '1';
if($result){ echo '1'.'~'.$company_id; } else { echo '0'; } } //Create New User if Staff Admin Side if(isset($_POST['new_usr_customer']) && $_POST['new_usr_customer'] != '') { $compa_name = $_POST['new_usr_customer']; $user_name_new = $_POST['new_usr_user']; $user_name_mail = $_POST['new_usr_mail']; $new_usr_phone = $_POST['new_usr_phone']; $company_id = compName($compa_name); if($company_id != ''){ $address_insert = "INSERT INTO sohorepro_customers SET cus_contact_name = '".$user_name_new."', cus_email = '".$user_name_mail."', cus_compname= '".$company_id."', cus_contact_phone = '".$new_usr_phone."' "; $result = mysql_query($address_insert); //$_SESSION['new_user_session'] = mysql_insert_id(); } if($result){ echo mysql_insert_id(); } else { echo '0'; } } //User name Check for Users Tab if (isset($_POST['session_cart']) && $_POST['session_cart'] != '') {