I'm picking up using arrays, I need to check values and make decisions depending on what I find in the listing.
id | volume_total | volume_entregue | volume_restante
1 15 10 5
2 10 10 0
My problem is the following in this listing:
-
If all of the extant lines are (zero), then
$status = 'Todos Entregues'
-
If all of the extant lines are equal to full_volume, then
$status = 'Nenhum entregue'
-
If on one line, the volume of the total is (zero), and on another line, the amount of the volume is equal to or less than the total_ volume, then
$status ='Entrega Parcial'
I can not formulate if's in this schema.
<?php
include "mysql.php";
$id = 13;
$sql = mysql_query ("SELECT * FROM ped_vendas_item WHERE id = '$id' ");
while ($r = mysql_fetch_array($sql)){
$volume_entregue[] =$r['volume_entregue'];
$volume_total[] = $r['volume_total'];
$volume_restante[] = $r['volume_restante'];
}
if ($volume_restante > 0 and $volume_restante == $volume_total) {
$status = "Todos Entregues";
} elseif ($volume_restante == 0){
$status = "Nenhum";
} elseif ($volume_restante > 0 and $volume_restante < $volume_total){
$status = "Entrega Parcial";
}
Image below, to get a sense of what the listing looks like.
Type: There can be multiple items where some of these can be delivered to the customer in whole or in part or even a list item can not be delivered. I need to take control of it.