<?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 
     as ProductName,
     Quantity  from [Order Details] where OrderID= " . $LastOrderID;
    if (!empty($_POST['prntype'])) {
        $SQlStrLIST .= " and [Action]='" . $_POST['prntype'] . "'";
    }
    $SQlStrLIST .= " Order by UserCode";
    //die( $SQlStrLIST);
    $Line1=0;
    $values = $orders->query($SQlStrLIST);
    if (is_iterable($values)) {
        foreach ($values as $pOrdersDetailsLIST) {
            $Line1++;
            $pOrdersDetailsLIST['UserCode']    = loadFromMssql($pOrdersDetailsLIST['UserCode']);
            $pOrdersDetailsLIST['ProductName'] = loadFromMssql($pOrdersDetailsLIST['ProductName']);
            echo str_pad($pOrdersDetailsLIST['Quantity'],5,' ',STR_PAD_BOTH). " x ".$pOrdersDetailsLIST['ProductName'].'<br>' ; 
        }
    }
}
?>