Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Trying to update Detailed Monthly reports


Recommended Posts

This is the part of the programing:

 

$o[] = $orders['orders_id'];

for($i=0;$i<sizeof($o);$i++) {

$price = 0;

$cost = 0;

$items_sold = 0;

$prods_query = mysql_query("select op.products_id, op.products_price, op.final_price, op.products_quantity, p.products_cost, op.final_cost from orders_products op, products p where op.orders_id = '" . $o[$i] . "' and op.products_id = p.products_id");

while ($prods = mysql_fetch_array($prods_query)) {

//Changes for Margins Reports 3.1b change product_price, Product_cost to final_price and final_cost //

$p[] = array($prods['products_id'], $prods['products_price'], $prods['products_cost'], $prods['final_price'], $prods['final_cost'], $prods['products_quantity']);

// $p[] = array($prods['products_id'], $prods['products_price'], $prods['products_cost'], $prods['products_quantity']);

if ($prods['final_cost'] == 0.000)(

$cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); //THIS IS LINE 87 in the code.

$price = $price + ($prods['products_price'] * $prods['products_quantity']);

$total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']);

$total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']);

) else (

$cost = $cost + ($prods['final_cost'] * $prods['products_quantity']);

$price = $price + ($prods['final_price'] * $prods['products_quantity']);

$total_price = $total_price + ($prods['final_price'] * $prods['products_quantity']);

$total_cost = $total_cost + ($prods['final_cost'] * $prods['products_quantity']);

)

$items_sold = $items_sold + $prods['products_quantity'];

$total_items_sold = $total_items_sold + $prods['products_quantity'];

}

}

 

I get a parse error at line 87 Unexpected ";"

 

When i remove the if Else statement no problems. But i need this if statement.

 

Can anyone help me ???

 

 

BRuce

Link to comment
Share on other sites

Most coders use curly brackets

 

if ($prods['final_cost'] == 0.000){

$cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); //THIS IS LINE 87 in the code.

$price = $price + ($prods['products_price'] * $prods['products_quantity']);

$total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']);

$total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']);

} else {

$cost = $cost + ($prods['final_cost'] * $prods['products_quantity']);

$price = $price + ($prods['final_price'] * $prods['products_quantity']);

$total_price = $total_price + ($prods['final_price'] * $prods['products_quantity']);

$total_cost = $total_cost + ($prods['final_cost'] * $prods['products_quantity']);

}

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Most coders use curly brackets

 

if ($prods['final_cost'] == 0.000){

$cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); //THIS IS LINE 87 in the code.

$price = $price + ($prods['products_price'] * $prods['products_quantity']);

$total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']);

$total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']);

} else {

$cost = $cost + ($prods['final_cost'] * $prods['products_quantity']);

$price = $price + ($prods['final_price'] * $prods['products_quantity']);

$total_price = $total_price + ($prods['final_price'] * $prods['products_quantity']);

$total_cost = $total_cost + ($prods['final_cost'] * $prods['products_quantity']);

}

 

 

Damn,

 

My eyes are really started to not work.

 

Thanks.

 

Bruce

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...