<?php
if($row->date_required == ""){
$date_required = "-";
}else{
$date_required = $this->common_lib->date_display_format($row->date_required,false);
}
if($row->promising_date == ""){
$promising_date = "-";
}else{
$promising_date = $this->common_lib->date_display_format($row->promising_date,false);
}
if($row->performance_date == ""){
$performance_date = "-";
}else{
$performance_date = $this->common_lib->date_display_format($row->performance_date,false);
}
$vendor_total_stock = 0;
$vendor_stock_required = $row->vendor_stock_required;
$vendor_stock_dates = $row->vendor_stock_dates;
$vendor_order_id = $row->vendor_order_id;
$vendor_stock_required_data = explode(",",$vendor_stock_required);
$vendor_stock_dates_data = explode(",",$vendor_stock_dates);
$vendor_order_id_data = explode(",",$vendor_order_id);
$vendor_order_i = 0;
$vendor_button_text = "";
foreach($vendor_stock_required_data as $stock){
if($stock > 0){
if(strtotime($row->date_required) > strtotime($vendor_stock_dates_data[$vendor_order_i])){
}
$vendor_total_stock += $stock;
$vendor_button_text .= "
<div class='row' style='margin-bottom:2px;'>
<div class='col-xs-7'><b>".
$this->common_lib->fSafeNum($stock). "</b> on ".$this->common_lib->date_display_format($vendor_stock_dates_data[$vendor_order_i],false)."
</div>
<div class='col-xs-5'>
<a href=\"#vendor_order_receive_qty\" data-id=\"".$this->common_lib->encode($vendor_order_id_data[$vendor_order_i])."\" type=\"button\" id=\"\" class=\"btn btn-primary btn-sm open-vendor-qty-receiver\" >receive</a>
</div>
</div>";
}
$vendor_order_i++;
}
$bNeedToOrder = false;
$size_available = $this->common_lib->fSafeNum($row->size_available + $vendor_total_stock) - $this->common_lib->fSafeNum($row->quantity_left);
$available_class_type = "text-success";
$class = "text-success";
if($row->quantity_left > $this->common_lib->fSafeNum($row->size_available + $vendor_total_stock)){
$class = "text-danger";
}
if($size_available < 0){
$available_class_type = "text-danger";
$bNeedToOrder = true;
}
if($bNeedToOrder){
$vendor_button_text .= '<a href="#vendor_order_modal" data-id="'.$this->common_lib->encode($row->size_id."~".$row->product_id).'" type="button" id="" class="btn btn-danger btn-sm open-vendor-order" >need to order</a>';
}
?>
<tr class="<?php echo $row->product_id ?><?php echo $row->size ?>">
<td>
<b><?php echo $row->sku ?></b><!--br><?php echo $row->product_name ?>--><br />
<b><code>Size: <?php echo $row->size ?></code></b><br />
<?php echo $row->color ?>
</td>
<td><b><?php echo $this->common_lib->fSafeNum($row->total_shipped) ?></b></td>
<td class="<?php echo $class ?>"><b><?php echo $row->quantity_left ?></b></td>
<td><b><?php echo $this->common_lib->fSafeNum($row->size_available) ?></b></td>
<td>
<?php echo $vendor_button_text;?>
</td>
<td class="<?php echo $available_class_type ?>"><b><?php echo $this->common_lib->fSafeNum($size_available) ?></b></td>
<?php
if(false){
?>
<td class="text-center">
<a href="#" data-row="<?php echo $row->product_id ?><?php echo $row->size ?>" data-placement="left" class=" tooltips toggle-hide-size" data-toggle="tooltip" title="Click here to show only same matching style"><i class="fa fa-eye"></i></a>
</td>
<?php
}
?>
</tr>
@KyuuKazami