<?php
include_once 'init-lite.php';
if (empty($_REQUEST['OrderID']))
    $FinOrderID = $LastOrderID;
else
    $FinOrderID = $_REQUEST['OrderID'];
if (!empty($FinOrderID)) {
    $SQlStrLIST = "select  UserCode,ProductName 
        + case when Remark is null or Remark='' then '' else + '#' + Remark end 
        + case when [action] is null or [action]='' then '' else + '$' + [action] end
     as ProductName,
     Quantity  from [Order Details] where OrderID= " . $LastOrderID;
    if (!empty($_POST['prntype']) && $_POST['prntype']=='Cook') {
        $SQlStrLIST .= " and [Action] like '" . $_POST['prntype'] . "%'";
	}else if (!empty($_POST['prntype'])) {
        $SQlStrLIST .= " and [Action]='" . $_POST['prntype'] . "'";
    }
    $SQlStrLIST .= " Order by OrderID";
    //echo $SQlStrLIST;
    $Line1=0;
    $values = $orders->query($SQlStrLIST);
    if (is_iterable($values)) {
        echo '<table width="100%"   class="ui-responsive ui-shadow"  id="myTable" data-role="table"  data-filter="true" data-input="#myFilter"               data-autodividers="true"  data-mode="columntoggle:none">';
        echo '<tbody>';
        foreach ($values as $pOrdersDetailsLIST) {
            $Line1++;
            $pOrdersDetailsLIST['UserCode']    = loadFromMssql($pOrdersDetailsLIST['UserCode']);
            $pOrdersDetailsLIST['ProductName'] = loadFromMssql($pOrdersDetailsLIST['ProductName']);
            echo '<tr> <td align="left" valign="top">';
            echo $pOrdersDetailsLIST['Quantity'] . " x " . $pOrdersDetailsLIST['ProductName'];
            echo ' </td></tr>';
        }
        echo '</tbody>';
        echo '</table>';
    }
}
?>