Problem getting invoice data.
Error: ".mysql_error()."

"); }else{ $row = mysql_fetch_array($newinv); $ID = $row['ID']; $invnu = $row['invnum']; $invnum = $invnu + 0; $CID = $row['CID']; $RID = $row['RID']; $rep = $row['rep']; $rep_email = $row['rep_email']; $rec_co = $row['rec_co']; $rec_name = $row['rec_name']; $rec_address = $row['rec_address']; $rec_city = $row['rec_city']; $rec_state = $row['rec_state']; $rec_zip = $row['rec_zip']; $rec_phone = $row['rec_phone']; $ponum = $row['ponum']; $terms = $row['terms']; $due = $row['due']; $chunk_due = chunk_split($due, 2, ':'); $chunk_arrd = explode(":", $chunk_due); $doit = $chunk_arrd[2].'/'.$chunk_arrd[3].'/'.$chunk_arrd[0].$chunk_arrd[1]; $project = $row['project']; $dtnum = $row['dtnum']; $special = $row['special']; } $getprod = mysql_query("SELECT invnum,prod_name,prod_desc,prod_qty,prod_price,prod_unit FROM inv_prod WHERE invnum='$invnum' ORDER BY prod_name"); if(!$getprod){ echo("

Could not retrieve Product Information
".mysql_error()."

"); }else{ while($rop = mysql_fetch_array($getprod)){ $prod_name[] = $rop['prod_name']; $prod_desc[] = $rop['prod_desc']; $prod_q = $rop['prod_qty']; $prod_qty[] = $prod_q; $prod_pr = $rop['prod_price']; $prod_price[] = $prod_pr; $prod_unit[] = $rop['prod_unit']; $prod_amount[] = $prod_pr * $prod_q; } } }//if there is an invnum mysql_select_db('ecosmar_contacts', $dbcnx); $contact = mysql_query("SELECT first_Name,Name,Company,Address,City,State,ZipCode FROM con_main WHERE ID='$CID'"); if(!$contact){ echo("

Problem getting contact data.
Error: ".mysql_error()."

"); }else{ $rowc = mysql_fetch_array($contact); $first_Name = $rowc['first_Name']; $Name = $rowc['Name']; $Company = $rowc['Company']; $Address = $rowc['Address']; $City = $rowc['City']; $State = $rowc['State']; $ZipCode = $rowc['ZipCode']; $customer = "$Company
$first_Name $Name
$Address
$City, $State $ZipCode
$email
$Phone
$FAX"; $c_ship = "$Company
$first_Name $Name
$Address
$City, $State $ZipCode
$Phone"; $shipto = "$rec_co
$rec_name
$rec_address
$rec_city, $rec_state $rec_zip
$rec_phone"; } $right = "So"; ?>

Eco-$mart, Inc.
4411 Bee Ridge Road #344
Sarasota, FL 34233
PH. 888-329-2705   FX: 941-377-9460
www.ecosmartinc.com

Quote
Date Invoice #
   
Representative
 
Bill To: Ship To:
P.O. Number Terms Est. Delivery Project
       
" . "" . "" . ""); $i = $i + 1; }//BIG WHILE i is less than prodcount ?>
Item Code Description QTY Price Unit Total
$prod_name[$i]$prod_desc[$i]" . "$counted" . "$prod_price[$i]$prod_unit[$i]$$formamount" . "
Product Shipping Subtotal $" . $subtotal . "

"); ?>
$value){ $prod_out[] = $value; $getship = mysql_query("SELECT carrier,charge FROM inv_ship WHERE invnum='$invnum' and prod_name='$value'"); if(!$getship){ echo("

Trouble retrieving shipping information.
Error: ".mysql_error()."

"); }else{ $rog = mysql_fetch_array($getship); $carrier = $rog['carrier']; $charge = $rog['charge']; echo("" . "" . ""); $shiptotal[] = $charge; } }//4each }//f hite s b mysql_select_db('ecosmar_products', $dbcnx); $i = 0; while($i < $prod_count){ if(!in_array($prod_name[$i],$prod_out)){ $getem = @mysql_query("SELECT id,productname,type,o_country,o_city,o_code,weight_lb,fixed_price,minimum,percent_of_sale FROM shipping WHERE productname='$prod_name[$i]'"); if(!$getem){ echo('

Error retrieving Shipping Data.
' . 'Error: '. mysql_error(). '

'); }else{ $shipit = mysql_fetch_array($getem); $id = $shipit['id']; $productname = $shipit['productname']; $type = $shipit['type']; if($type == ""){ $type = 'Best'; } $o_country = $shipit['o_country']; $o_city = $shipit['o_city']; $o_code = $shipit['o_code']; $weight_lb = $shipit['weight_lb']; $shiptypeone[] = $type; $fixed_price = $shipit['fixed_price']; $minimum = $shipit['minimum']; $percent_of_sale = $shipit['percent_of_sale']; if($id ==""){ $shipman[] = $i; }elseif($type == 'UPS'){ $upsman[] = $i; $upso_code[] = $o_code; $ups_weight[] = $weight_lb; }else{ if($fixed_price != 0){ $shipcharge = $fixed_price * $prod_qty[$i]; }elseif($percent_of_sale > 0){ $shipcharge = $full_amount[$i] * $percent_of_sale; } if($minimum > 0 AND $shipcharge < $minimum){ $shipcharge = $minimum; } $shipwrit = sprintf("%01.2f", $shipcharge); echo("" . "" . ""); $shiptotal[] = $shipcharge; }//id is blank }//elsefromgetem }//ifin array product $i = $i+1; }//BIG WHILE $shipit = array_sum($shiptotal); $shipprice = sprintf("%01.2f", $shipit); $shipcheck = count($shipman); $upscheck = count($upsman); if($shipcheck > 0 or $upscheck > 0){ echo("" . "" . ""); $a = 0; while($a < $upscheck){ $b = $upsman[$a]; echo("" . "" . ""); $a = $a + 1; } foreach($shipman as $value){ echo("" . "" . ""); } }else{ echo(""); } if($hite == "b"){ mysql_select_db('ecosmar_inv', $dbcnx); $taxi = mysql_query("SELECT tax FROM ecoinvoice WHERE invnum='$invnum'"); if(!$taxi){ echo("

Could not get tax information.
Error: ".mysql_error()."

"); }else{ $rot = mysql_fetch_array($taxi); $tax = $rot['tax']; } $payo = mysql_query("SELECT amount,type,trans,dtnum FROM inv_pay WHERE invnum='$invnum'"); if(!$payo){ echo("

Could not get payment information.
Error: ".mysql_error()."

"); }else{ $tis = mysql_fetch_array($payo); $pamount = $tis['amount']; $ptype = $tis['type']; $ptrans = $tis['trans']; } }//ifhiteisb ?>
Shipping Charges
QTY Product Carrier Charge
$prod_qty[$key] $value $carrier $charge 
$prod_qty[$i] $productname $type $shipwrit 
Shipping Subtotal:$$shipprice 
Complete the following shipping information.
$prod_qty[$b] $prod_name[$b] UPS Calculator" . "UPS" . "
$prod_qty[$value] $prod_name[$value] 
Total Shipping Charges$$shipprice 
Sales Tax
Enter Sales Tax Per Cent.
 %
Payments/Credits
Please enter credits or payments. Type: " . "
Trans ID#: " . "
Amount: " . "

"); ?>


" . "" . "" . "" . "" . ""); $i = $i + 1; } ?>