'; echo ''; echo ''; echo '
Customer Details
'; ########################### ## EDIT CUSTOMER DETAILS ## ########################### if (!$_POST['Submit']) { $postFlag = $_GET['id']; echo ""; if ($_GET['type'] == 'new') { echo ''; $chosenScript = '(function( $ ) { $.widget( "ui.combobox", { _create: function() { var self = this, select = this.element, selected = select.children( ":selected" ), value = selected.val() && (selected.text().length > 1) ? selected.text() : ""; var input = this.input = $( "" ) .insertAfter( select ) .val( value ) .autocomplete({ delay: 400, minLength: 2, source: function( request, response ) { $.ajax({ url: "customer-search.php", data: request, success: function(src) { customers = $.parseJSON(src); response($.map( customers, function(item) { var text = item.label; if (item.id) return { id: item.id, label: text, value: text, option: $(select).find("option[value=" + item.id + "]").first().get(0) }; })); } }); }, select: function( event, ui ) { ui.item.option.selected = true; self._trigger( "selected", event, { item: ui.item.option }); $(select).trigger("change"); } }) .addClass( "ui-widget ui-widget-content ui-corner-left" ); input.data( "autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .data( "item.autocomplete", item ) .append( "" + item.label + "" ) .appendTo( ul ); }; }, destroy: function() { this.input.remove(); this.element.show(); $.Widget.prototype.destroy.call( this ); } }); })( jQuery ); jQuery(document).ready(function($) { $("#customer-name-select").combobox(); $("#customer-name-select").bind("change", function(){ if($(this).val() == "0") $("#form_customer_det").attr("action","customer_details.php?id=&type=new"); else $("#form_customer_det").attr("action","customer_details.php?id="+$(this).val()+"&type=new"); $("#delete_customer").css("display","block"); $("#form_customer_det").submit(); }); });'; echo ''; $chosenStyle = ' .ui-autocomplete { max-height: 300px; overflow-y: auto; overflow-x: hidden; } .ui-autocomplete-input{ /*margin-left: 20px; display:none;*/ display: block; margin-top: 20px; border-radius: 5px; } * html .ui-autocomplete { height: 300px; } '; echo ''; $info = customer_information($_POST['customer_name']); if($_GET['id'] ==''){ $info = array(); } } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; /*echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "";*/ echo ''; echo ""; echo "
    '; $db=dbconnect(); $sql="select *, CONCAT(fname, ' ', lname) AS aggregated_name from `customer` ORDER BY aggregated_name ASC"; $sql = "select fname, lname, CONCAT(fname, ' ', lname) AS aggregated_name, SUBSTRING_INDEX(GROUP_CONCAT(id ORDER BY id DESC), ',', 1) AS id from `customer` GROUP BY fname, lname, street, title, department, city, state, zip, phone, mobile, email, fax, status, step, product, date, baseunit, proj_desc, amount, days_to_ship, amount_2, conditions, payment_terms, comments, ordered, callback, company, request, saved_step, add2, city2, state2, zip2, email2, phone2, mobile2, fax2, is_deleted, interested_in ORDER BY aggregated_name ASC "; $rst=mysqli_query($db,$sql); echo ''; if(!empty($postFlag)){ echo ' Delete this Customer'; //echo ' New Inquiry to this Customer'; } echo '
    First Name:
    Last Name:
    Company:
    Title:
    Department:
    Business:
    Address:
    City:
    State:
    Zip:
    Email
    Phone
    Mobile
    Fax
    CC (Spot 1)
    Name:
    Company:
    Telephone:
    Mobile:
    E-mail:
    CC (Spot 2)
    Name:
    Company:
    Telephone:
    Mobile:
    E-mail:
    CC (Spot 3)
    Name:
    Company:
    Telephone:
    Mobile:
    E-mail:
    CC (Spot 4)
    Name:
    Company:
    Telephone:
    Mobile:
    E-mail:
    Home
    Address:
    City:
    State:
    Zip:
    Email
    Phone
    Mobile
    Fax
    Comments
    "; echo ""; echo "
    "; echo ""; } if ($_POST['Submit']) { $db=dbconnect(); if ($_POST['id'] == '') { $timenow = time(); $modify = date('Y-m-d',$timenow); $sql="select max(id) as maxid from `customer`"; $rst=mysqli_query($db,$sql); $maxid=mysqli_fetch_row($rst); $newid=$maxid[0]+1; $insertQ = "INSERT into customer (id,fname,lname,email,street,company,title,department,city,state,zip,phone,mobile,fax,comments,step,date,request,add2,city2,state2,zip2,email2,phone2,mobile2,fax2,modified) VALUES ('".$newid."','".$_POST['fname']."','".$_POST['lname']."','".$_POST['email']."','".$_POST['street']."','".$_POST['company']."','".$_POST['title']."','".$_POST['department']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."','".$_POST['mobile']."','".$_POST['fax']."','".$_POST['comments']."','1',NOW(''),'Manually Added','".$_POST['add2']."','".$_POST['city2']."','".$_POST['state2']."','".$_POST['zip2']."','".$_POST['email2']."','".$_POST['phone2']."','".$_POST['mobile2']."','".$_POST['fax2']."','".$modify."')"; $insertR = mysqli_query($db,$insertQ) or die ("Error in query: $insertQ. " . mysqli_error()); $insertsQ = "INSERT into customer_history (id,step) VALUES ('".$newid."','1')"; $insertsR = mysqli_query($db,$insertsQ) or die ("Error in query: $insertsQ. " . mysqli_error()); $sql = 'INSERT INTO `customer_qoute_copy` (`customer_id`, `name`, `company`, `phone`, `mobile`, `email`) VALUES ('. $newid .', "'. $_POST['name_spot1'] .'", "'. $_POST['company_spot1'] .'", "'. $_POST['phone_spot1'] .'", "'. $_POST['mobile_spot1'] .'", "'. $_POST['email_spot1'] .'"), ('. $newid .', "'. $_POST['name_spot2'] .'", "'. $_POST['company_spot2'] .'", "'. $_POST['phone_spot2'] .'", "'. $_POST['mobile_spot2'] .'", "'. $_POST['email_spot2'] .'"), ('. $newid .', "'. $_POST['name_spot3'] .'", "'. $_POST['company_spot3'] .'", "'. $_POST['phone_spot3'] .'", "'. $_POST['mobile_spot3'] .'", "'. $_POST['email_spot3'] .'"), ('. $newid .', "'. $_POST['name_spot4'] .'", "'. $_POST['company_spot4'] .'", "'. $_POST['phone_spot4'] .'", "'. $_POST['mobile_spot4'] .'", "'. $_POST['email_spot4'] .'");'; $query = mysqli_query($db,$sql) or die ("Error in query: $sql. " . mysqli_error()); } else { $timenow = time(); $modify = date('Y-m-d',$timenow); // UPDATE THE ORDER TOTAL IN THE CUSTOMERS FIELD // $custQ = "UPDATE customer SET fname = '".$_POST['fname']."', lname = '".$_POST['lname']."', company = '".$_POST['company']."', title = '".$_POST['title']."', department = '".$_POST['department']."', street = '".$_POST['street']."', city = '".$_POST['city']."', state = '".$_POST['state']."', zip = '".$_POST['zip']."', phone = '".$_POST['phone']."', mobile = '".$_POST['mobile']."', email = '".$_POST['email']."', fax = '".$_POST['fax']."', add2 = '".$_POST['add2']."', city2 = '".$_POST['city2']."', state2 = '".$_POST['state2']."', zip2 = '".$_POST['zip2']."', phone2 = '".$_POST['phone2']."', mobile2 = '".$_POST['mobile2']."', email2 = '".$_POST['email2']."', fax2 = '".$_POST['fax2']."', step = '1', comments = '".$_POST['comments']."', modified = '".$modify."' WHERE id = '".$_POST['id']."'"; $custR=mysqli_query($db,$custQ) or die ("Error in query: $custQ. " . mysqli_error()); $sql = 'DELETE FROM `customer_qoute_copy` WHERE `id`='. $_POST['id'] .';'; $query = mysqli_query($db,$sql) or die ("Error in query: $sql. " . mysqli_error()); $sql = 'INSERT INTO `customer_qoute_copy` (`customer_id`, `name`, `company`, `phone`, `mobile`, `email`) VALUES ('. $_POST['id'] .', "'. $_POST['name_spot1'] .'", "'. $_POST['company_spot1'] .'", "'. $_POST['phone_spot1'] .'", "'. $_POST['mobile_spot1'] .'", "'. $_POST['email_spot1'] .'"), ('. $_POST['id'] .', "'. $_POST['name_spot2'] .'", "'. $_POST['company_spot2'] .'", "'. $_POST['phone_spot2'] .'", "'. $_POST['mobile_spot2'] .'", "'. $_POST['email_spot2'] .'"), ('. $_POST['id'] .', "'. $_POST['name_spot3'] .'", "'. $_POST['company_spot3'] .'", "'. $_POST['phone_spot3'] .'", "'. $_POST['mobile_spot3'] .'", "'. $_POST['email_spot3'] .'"), ('. $_POST['id'] .', "'. $_POST['name_spot4'] .'", "'. $_POST['company_spot4'] .'", "'. $_POST['phone_spot4'] .'", "'. $_POST['mobile_spot4'] .'", "'. $_POST['email_spot4'] .'");'; $query = mysqli_query($db,$sql) or die ("Error in query: $sql. " . mysqli_error()); } echo ""; echo '