//$data->read('excel_file/test/Ink&Toner.xls'); $data->read('excel_file/'.$fileName); //Company Details Insert --- Start----- for($j=1;$j<=$data->sheets[0]['numRows'];$j++) { $company_name = $data->sheets[0]['cells'][$j][2]; $company_phone = $data->sheets[0]['cells'][$j][10]; $companyfax = $data->sheets[0]['cells'][$j][14]; $bussines_add1 = $data->sheets[0]['cells'][$j][5]; $bussines_add2 = $data->sheets[0]['cells'][$j][6]; $bussines_add3 = $data->sheets[0]['cells'][$j][5]; $business_city = $data->sheets[0]['cells'][$j][7]; $business_state = $data->sheets[0]['cells'][$j][8]; $business_zip = $data->sheets[0]['cells'][$j][9]; $check_company_name = checkcomp($company_name); $account_status = $data->sheets[0]['cells'][$j][20]; $status = ($account_status == 'Y')? '1':'0'; if(count($check_company_name) < 1) { $query="INSERT INTO sohorepro_company SET comp_name = '".$company_name."', comp_contact_phone = '".$company_phone."', comp_contact_fax = '".$companyfax."', comp_business_address1 = '".$bussines_add1."', comp_business_address2 = '".$bussines_add2."', comp_business_address3 = '".$bussines_add3."', comp_city = '".$business_city."', comp_state = '".$business_state."', comp_zipcode = '".$business_zip."', status = '".$status."' "; mysql_query($query);
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); } }
$headers = 'From: "SohoRepro" <*****@*****.**>' . "\r\n"; $headers .= "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $to = $to['email_id']; //$mail_id = '*****@*****.**'; $result_mail = mail($to, $subject, $final_html, $headers); } if ($result_mail) { return '1'; } else { return '0'; } } if (isset($_REQUEST['new_company_add']) == '1') { extract($_POST); $comp_name_exist = checkcomp($reg_compname); if (count($comp_name_exist) > 0) { $result = 'exist'; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../tax_form/" . $_FILES["file"]["name"]); $tax_file_name = $_FILES["file"]["name"]; $sql = "INSERT INTO sohorepro_company SET\n comp_contact_name = '" . $reg_contactname . "',\n comp_contact_email = '" . $reg_contactmail . "',\n comp_name = '" . $reg_compname . "', \n cust_id = '" . $reg_cus_id . "',\n comp_contact_phone = '" . $reg_contphone1 . "',\n comp_contact_fax = '" . $reg_busifax . "',\n comp_business_address1 = '" . $address1 . "',\n comp_business_address2 = '" . $address2 . "',\n comp_business_address3 = '" . $address3 . "', \n comp_room = '" . $reg_busiroom . "',\n comp_suite = '" . $reg_busisuite . "',\n comp_floor = '" . $reg_busifloor . "',\n comp_city = '" . $reg_busicity . "',\n comp_state = '" . $reg_busistate . "',\n comp_zipcode = '" . $reg_busizip . "',\n comp_zipcode_ext = '" . $reg_busizip_ext . "',\n comp_phone1 = '" . $reg_phone1 . "',\n comp_phone2 = '" . $reg_phone2 . "',\n comp_phone3 = '" . $reg_phone3 . "',\n comp_phone4 = '" . $reg_phone4 . "',\n tax_form_resale = '" . $tax_file_name . "',\n tax_exe = '" . $reg_tax . "',\n cus_type = '2' "; $result = mysql_query($sql); //Insert the Primari Billing address for New Company Start $comp_id = mysql_insert_id(); $shipp_state_id = StateId($reg_busistate); $shipp_sql = "INSERT INTO sohorepro_address SET\n comp_id = '" . $comp_id . "',\n company_name = '" . $reg_compname . "',\n contact_name = '" . $reg_contactname . "',\n address_1 = '" . $address1 . "',\n address_2 = '" . $address2 . "',\n address_3 = '" . $address3 . "', \n city = '" . $reg_busicity . "',\n state = '" . $shipp_state_id . "',\n zip = '" . $reg_busizip . "',\n zip_ext = '" . $reg_busizip_ext . "',\n phone = '" . $reg_contphone1 . "',\n attention_to = '" . $reg_contactname . "',\n type = '1',\n prop = '0'"; $inserted_val = mysql_query($shipp_sql); $sql_user = "******" . $reg_contactmail . "',\n cus_pass = '******',\n cus_compname = '" . $comp_id . "', \n cus_contact_name = '" . $reg_contactname . "',\n cus_contact_email = '" . $reg_contactmail . "',\n cus_contact_phone = '" . $reg_contphone1 . "',\n cus_manager = '1',\n cus_status = '1' "; mysql_query($sql_user); //Insert the Primari Billing address for New Company End