Please enter a quantity."; $send = "no"; } else { $qty_err[$i]=''; } if ($part_num[$i] == '') { $part_err[$i]="
Please enter a valid part number."; $send = "no"; } else { $part_err[$i]=''; } if ($reason[$i] == '') { $reason_err[$i]="
Please select a reason for return."; $send = "no"; } else { $reason_err[$i]=''; } } if (!$order_number) { $order_err = "
Please enter your order number."; $send = "no"; } if (!$first_name) { $first_err = "
Please enter your first name."; $send = "no"; } if (!$last_name) { $last_err = "
Please enter your last name."; $send = "no"; } if (!trim($email)) { $email_err='
Please supply your email address.'; $send = "no"; } elseif (!is_valid_email($email)) { $email_err='
You must supply a complete, valid email address, i.e. joe@aol.com'; $send = "no"; } if ($send != "no") { $db->query(sprintf("INSERT INTO e2u_rga_returns (order_number, issue_date, first_name, last_name, company, email, comments) VALUES ('%s', date_trunc('day', timestamp 'now'), '%s', '%s', '%s', '%s', '%s')",$order_number, pg_escape_string($first_name), pg_escape_string($last_name), pg_escape_string($company), $email, pg_escape_string($comments))); foreach ($qty as $row => $qtynum) { if ($qtynum != '') { $rga_id = $db->query_fetch_array("select last_value from e2u_rga_returns_id_seq", 'last_value'); foreach ($rga_id as $id => $menu) { $db->query(sprintf("insert into e2u_rga_return_items (rga_id, qty, part_num, description, price, reason) values ('%d','%d','%s','%s','%d','%s')", $id, trim($qty[$row]), pg_escape_string($part_num[$row]), pg_escape_string($description[$row]), $price[$row], pg_escape_string($reason[$row]))); } } } $subject = "E2U RGA Form"; $msg = "Order #: $order_number\n"; $msg .= "Issue Date: $issue_date\n"; $msg .= "Name: $first_name $last_name\n"; $msg .= "Company: $company\n"; $msg .= "Email: $email\n\n"; foreach ($qty as $row => $qtynum) { if ($qtynum != '') { $msg .= "Qty: $qty[$row]\n"; $msg .= "Item to be Returned: $part_num[$row]\n"; $msg .= "Description: $description[$row]\n"; $msg .= "Price: $price[$row]\n"; $msg .= "Reason: $reason[$row]\n\n"; } } $msg .= "\nComments: $comments\n"; $to = "customerservice@equipment2u.com"; $to .= ", $email"; $mailheaders = "From: customerservice@equipment2u.com\n"; mail($to, $subject, $msg, $mailheaders); $msg = nl2br($msg); print "

Your RGA has been processed.
Click Here to print this for records.

Return Goods Authorization

Order Number: $order_number
Customer Information: $first_name $last_name
Comany:$company
Email:$email

List the items you are returning.

"; for ($i=0 ; $i<5; $i++) { print ""; } print "
Qty Part # Description Price Reason for Return
$qty[$i] $part_num[$i] $description[$i] $price[$i] $reason[$i]
Comments:
$comments
"; } else if ($send == "no") { display_form(); } } page_footer(); function display_form() { global $num_rows, $qty_err, $part_err, $reason_err, $order_err, $first_err, $last_err, $email_err; $order_number=$_REQUEST['order_number']; $first_name=$_REQUEST['first_name']; $last_name=$_REQUEST['last_name']; $company=$_REQUEST['company']; $email=$_REQUEST['email']; $qty = $_POST['qty']; $part_num = $_POST['part_num']; $description = $_POST['description']; $price = $_POST['price']; $reason = $_POST['reason']; $send = $_REQUET['send']; $comments=$_REQUEST['comments']; print "

Return Goods Authorization

Order Number: $order_err
Customer Information:
First Name$first_err

Last Name$last_err

Company Name

Email$email_err

List the items you are returning. Select the return code that best describes the reason for your return.

"; for ($i=0; $i<5; $i++) { printf("", $qty_err[$i], $part_err[$i], $reason[$i]=='Customer Error'?' selected':'', $reason[$i]=='E2U Info Error'?' selected':'', $reason[$i]=='Defective/Damaged Item'?' selected':'', $reason[$i]=='E2U Shipping Error'?' selected':'', $reason[$i]=='Freight Damage'?' selected':'', $reason[$i]=='Warranty Evaluation'?' selected':'', $reason[$i]=='Repair Evaluation'?' selected':'', $reason[$i]=='Price Correction'?' selected':'', $reason[$i]=='Exchange'?' selected':'', $reason_err[$i]); } $num_rows = $_REQUEST['row']; print "
Qty Part # Description Price Reason for Return
%s %s %s
Comments: Please describe the condition of defective or damaged goods you are returning.
By clicking Submit I accept all the terms and conditions
of Equipment2U.com's Return Policy.
"; } function error_check() { } ?>