<?php
header('Cache-Control: no-cache, no-store, must-revalidate');   
header('Expires: 0');
date_default_timezone_set('Europe/London');
set_time_limit(300);
// error_reporting(E_ALL);
// ini_set('display_errors', 1);

// Odette Label

include('../barcode/php-barcode.php');
require('../barcode/fpdf.php');

$mDecantRef = "";

class PDF extends FPDF
{
// Page header
	function Header()
	{
        global $mDecantRef;
// Logo
		$this->Image('../../../images/vel_logo_large.jpg',10,6,50);
// Arial bold 15
		$this->SetFont('Arial','B',15);
// Move to the right
		$this->Cell(100);
// Title
		$this->Cell(10,10,'Decant: '.$mDecantRef,0,0,'C');
// Line break
		$this->Ln(15);
	}

// Page footer
	function Footer()
	{
// Position at 1.5 cm from bottom
		$this->SetY(-15);
// Arial italic 8
		$this->SetFont('Arial','I',8);
// date / time
		$date = date('d/m/Y h:i:s a', time());
// Page number
		$this->Cell(0,10,'Page '.$this->PageNo().'   Date '.$date,0,0,'C');
	}
	
	function TextWithRotation($x, $y, $txt, $txt_angle, $font_angle=0)
    {
        $font_angle+=90+$txt_angle;
        $txt_angle*=M_PI/180;
        $font_angle*=M_PI/180;
    
        $txt_dx=cos($txt_angle);
        $txt_dy=sin($txt_angle);
        $font_dx=cos($font_angle);
        $font_dy=sin($font_angle);
    
        $s=sprintf('BT %.2F %.2F %.2F %.2F %.2F %.2F Tm (%s) Tj ET',$txt_dx,$txt_dy,$font_dx,$font_dy,$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
        if ($this->ColorFlag)
            $s='q '.$this->TextColor.' '.$s.' Q';
        $this->_out($s);
    }	

// Barcode table
	function BarcodeTablePdf($header, $data)
	{
        global $mDecantRef;
// date / time
		$date = date('d/m/Y h:i:s a', time());
// barcode settings
		$fontSize = 12;
		$marge    = 5;   // between barcode and hri in pixel
		$bx       = 100;  // barcode center
		$by       = 40;  // barcode center
		$height   = 10;   // barcode height in 1D ; module size in 2D
		$width    = 0.25;    // barcode width in 1D ; not use in 2D
		$angle    = 0;   // rotation in degrees  
		$code     = 'VANTEC'; // barcode text;)
		$type     = 'code39';
		$black    = '000000'; // color in hex
		$ty = 82;

// Data
		foreach($data as $row)
		{
// Headings
            $mDecantRef = $row['FLD01'];
            $this->AddPage();
		
            $this->SetFont('Arial','',$fontSize);
            $this->SetTextColor(0, 0, 0);
// Initial Line
            $this->ln(20);
            $y = 30;
            $l = 0;
            $this->Text(20,$y,"Reference:");
            $col = $row['FLD01'];
//            $barcode = Barcode::fpdf($this, $black, $bx, $y, $angle, $type, $col, $width, $height);
            $pos = $bx-(strlen(trim($col))*.75);
            $this->TextWithRotation($pos, $y+10, $col, $angle);
            $y = $y+15;
            $this->Line(20, $y, 210-20, $y);
            $y = $y+10;
            
            $this->Text(20,$y,"Part Number:");
            $col = $row['FLD03'];
            $barcode = Barcode::fpdf($this, $black, $bx, $y, $angle, $type,"P".$col, $width, $height);
            $pos = $bx-(strlen(trim($col))*.75);
            $this->TextWithRotation($pos, $y+10, $col, $angle);
            $y = $y+15;
            $this->Line(20, $y, 210-20, $y);
            $y = $y+10;
            
            $this->Text(20,$y,"Qty:");
            $col = $row['FLD04'];
            $barcode = Barcode::fpdf($this, $black, $bx, $y, $angle, $type,"Q".$col, $width, $height);
            $pos = $bx-(strlen($col)*.75);
            $this->TextWithRotation($pos, $y+10, $col, $angle);
            $y = $y+15;
            $this->Line(20, $y, 210-20, $y);
            $y = $y+10;
            
            $this->Text(20,$y,"Serial:");
            $col = $row['FLD05'];
            $barcode = Barcode::fpdf($this, $black, $bx, $y, $angle, $type,"S".$col, $width, $height);
            $pos = $bx-(strlen(trim($col))*.75);
            $this->TextWithRotation($pos, $y+10, $col, $angle);
            $y = $y+15;
            $this->Line(20, $y, 210-20, $y);
            $y = $y+10;
/*            
            $this->Text(10,$y,"Vendor:");
            $col = $row['FLD07'];
            $barcode = Barcode::fpdf($this, $black, 60, $y, $angle, $type,"V".$col, $width, $height);
            $this->Text(60, $y+8, $col);
            $y = $y+15;
            $this->Line(20, $y, 210-20, $y);
            $y = $y+10;
*/            
		}
	}	
}

// Load data
function LoadData($mHost, $mUser, $mPwd, $mDbName, $mDecantId, $mDecantRef)
{
// Read file lines
	$data = array();
// mysql connection
	$mConnection=mysqli_connect($mHost,$mUser,$mPwd,$mDbName) or
		exit("FAIL-Connect failed: ".mysqli_connect_errno()." : ". mysqli_connect_error());
    $mDocRef = "";

	$mDataQuery = "SELECT receipt_header.delivery_note AS document_reference";
    $mDataQuery .=" FROM decant_header";
    $mDataQuery .=" JOIN decant_body ON decant_header.id=decant_body.decant_header_id";
    $mDataQuery .=" LEFT JOIN receipt_detail ON decant_header.part_number=receipt_detail.part_number AND decant_body.serial_reference=receipt_detail.serial_reference";
    $mDataQuery .=" LEFT JOIN receipt_header ON receipt_detail.document_reference=receipt_header.document_reference";
	$mDataQuery .=" WHERE";
	if (!empty($mDecantId))
		$mDataQuery .=" decant_header.id=".$mDecantId;
	else
		$mDataQuery .=" decant_header.document_reference='".$mDecantRef."'";
    $mDataQuery .=" LIMIT 1";
    if (!$mData = mysqli_query($mConnection,$mDataQuery))
		exit("FAIL-".mysqli_error($mConnection).":".$mDataQuery);
    list($mDocRef) = mysqli_fetch_row($mData);
 
	$mDataQuery = "SELECT decant_header.document_reference AS FLD01, decant_header.part_number AS FLD03";
    $mDataQuery .=",part.part_description AS FLD11";
    $mDataQuery .=",decant_body.serial_reference AS FLD05, decant_body.tt_ran_order AS FLD12, DATE(decant_body.date_created) AS FLD17, decant_body.decant_status AS decant_status";
	$mDataQuery .=", CASE WHEN decant_body.qty > 0 THEN decant_body.qty/part.conversion_factor ELSE inventory_master.inventory_qty/part.conversion_factor END AS FLD04";
    $mDataQuery .=",substr(vendor.vendor_reference_code,1,15) AS FLD13,vendor.vendor_name AS FLD14";
    $mDataQuery .=" FROM decant_header";
    $mDataQuery .=" JOIN decant_body ON decant_header.id=decant_body.decant_header_id";
    $mDataQuery .=" LEFT JOIN part ON decant_header.part_id=part.id";
    $mDataQuery .=" LEFT JOIN vendor ON part.vendor_id=vendor.id";
	$mDataQuery .=" LEFT JOIN inventory_master ON decant_header.part_id=inventory_master.part_id AND decant_body.serial_reference=inventory_master.serial_reference";
    $mDataQuery .=" WHERE decant_body.qty>0 AND";
	if (!empty($mDecantId))
		$mDataQuery .=" decant_header.id=".$mDecantId;
	else
		$mDataQuery .=" decant_header.document_reference='".$mDecantRef."'";
	$mDataQuery .=" ORDER By decant_header.document_reference, decant_body.id DESC";

// mysql query construct
	if (!$mData = mysqli_query($mConnection,$mDataQuery))
		exit("FAIL-".mysqli_error($mConnection).":".$mDataQuery);
//	exit("FAIL-TEST-".$mHost." ".mysqli_error($mConnection).":".$mDataQuery."-".mysqli_num_rows($mData));
	$i = 0;
	$mQty = 0;
	while($mRow = mysqli_fetch_assoc($mData)) 
	{
        if ($mDocRef != "")
		{
            $mRow['FLD02'] = $mDocRef;
		}
		else
		{
			$mRow['FLDS02'] = "";
		}
		if (empty($mRow['FLD04']))
		{
			$mRow['FLD04'] = 0;
		}
		if ($mRow['decant_status'] == 1)
		{
			$mQty = $mQty+$mRow['FLD04'];
		}
		if ($mRow['decant_status'] == 0)
		{
			$mRow['FLD04'] = $mRow['FLD04'] - $mQty;
		}
		$data[] =($mRow);
		$i++;
	}
	mysqli_close($mConnection);
	return $data;
}

// odette label
function decantLabel($mLabel, $data, $mPrinter,$mPrinterType=null)
{
//	exit ("FAIL-TEST-".$mLabel."-".$mPrinter);
	$mLabelContent = "";
// Label Layout
/*
LABEL1
^PR2
^FO25,25^GB400,200,2^FS
^FO425,25^GB400,200,2^FS
^FO25,370^GB800,120,2^FS
^FO50,40^A0,40^FDEMERGENCY SUPPLY^FS
^FO450,60^A0,20^FDMaterial Requested (Date / Time)^FS
^FO450,85^A0,30^FDFLD02^FS
^FO50,80^A0,20^FDDeliver To:^FS
^FO50,105^A0,30^FDFLD14^FS
^FO50,130^A0,20^FDStorage Type / Section / Bin^FS
^FO50,150^A0,30^FDFLD11 / FLD12 / FLD13^FS
^FO50,175^A0,20^FDStorage Location^FS
^FO50,195^A0,30^FDOSWH / Warehouse LSP^FS
^FO50,230^A0,20^FDMaterial Number^FS
^FO50,260^A0,40^FDFLD05^FS
^FO450,230^A0,20^FDQuantity^FS
^FO450,260^A0,40^FDFLD03 FLD09^FS
^FO50,300^BY3^BCN,60,N,,,A^FDFLD05^FS
^FO450,350^A0,20^FDFLD10^FS
^FO50,380^A0,30^FDDestination:^FS
^FO250,380^A0,30^FDFLD04^FS
^FO50,415^A0,30^FDReceipient:^FS
^FO250,415^A0,30^FDFLD06^FS
^FO50,450^A0,30^FDReference No.:^FS
^FO250,450^A0,30^FDFLD07^FS
^FO50,500^A0,40^FDFLD01^FS
^FO50,540^BY3^BCN,60,N,,,A^FDFLD01^FS
^FO450,500^A0,40^FDFLD08^FS
^FO450,540^BY3^BCN,60,N,,,A^FDFLD08^FS
*/

//	print_r("Label:".$mLabel);
// Load Label Template
	$mPrintData = __DIR__."/".$mLabel;
//	exit("FAIL-Test-".$mPrintData);

	$mFh = fopen($mPrintData, 'r');
	$mLabel = fread($mFh, filesize($mPrintData));
	fclose($mFh);
// Add NewLine Characters
	$lines=explode(PHP_EOL,$mLabel);

// No, Labels to a row (0=single label, 1=double labels)	
//	$mLabelsAcross = 0;
    $mHeaders = array();
	$mContent1 = "";
	$mContent2 = "";
    $mFooters = array();
	$c = 0;
    $i = 0;
	
// Build label from template
	foreach($lines as $line)
	{
        if ($line == "HEADER")
        {
            $c = 0;
            continue;
        }
		if ($line == "LABEL")
        {
            $c = 1;
            continue;
        }
        if ($line == "LABEL1")
        {
            $c = 1;
            continue;
        }
        if ($line == "LABEL2")
        {
            $c = 2;
            continue;
        }
        if ($line == "FOOTER")
        {
            $c = 9;
            continue;
        }
        if ($c == 0)
            $mHeaders[] = $line;
        if ($c == 1)
            $mContent1 .= $line."\n";
        if ($c == 2)
            $mContent2 .= $line."\n";
        if ($c == 9)
            $mFooters[] = $line;
	}
// Label Data
	$mLabelContent1 = $mContent1;
	$mLabelContent2 = $mContent2;

// Populate Label with data	
	$c = 0;
	foreach($data as $row)
	{
		$i = 0;
		foreach($row as $k=>$v)
		{
// Replace Template placeholder with Value
			if ($c == 0)
				$mLabelContent1 = str_replace($k,$v,$mLabelContent1);
			else
				$mLabelContent2 = str_replace($k,$v,$mLabelContent2);
			$i++;
		}
		$c++;
		if ($c > $mLabelsAcross)
		{
//			print_r("OKMS-");
// Send Label to Printer
			$fp = fsockopen($mPrinter, 9100, $errno, $errstr, 30);
			if ($fp !== false)
			{
				if (!empty($mHeaders))
				{
					foreach ($mHeaders as $mHeader)
					{
						fwrite ($fp,$mHeader.'\n');
	//					print_r ($mHeader);
					}
				}
				else
				{
					fwrite ($fp,"\x02L\n");
					fwrite ($fp,"H08\n");
					fwrite ($fp,"D11\n");
				}
				fwrite($fp,$mLabelContent1.$mLabelContent2);
//				print_r($mLabelContent1.$mLabelContent2);
				if (!empty($mFooters))
				{
					foreach ($mFooters as $mFooter)
					{
						fwrite ($fp,$mFooter.'\n');
	//					print_r ($mFooter); 
					}
				}
				else
				{
					fwrite ($fp,"E\n"); 
				}
				fclose($fp);
				sleep(1);
//				return "OKMS-Label Printed to - ".$mPrinter." ";

// Restore Print Layout for next labels
				$mLabelContent1 = $mContent1;
				$mLabelContent2 = $mContent2;
				$c = 0;
			}
			else
			{
				$c = 0;
			}
		}
	}
// Print Remaining label if Two across
	if ($c > 0)
	{
		$fp = fsockopen($mPrinter, 9100, $errno, $errstr, 30);
		if ($fp !== false)
		{
			if (!empty($mHeaders))
			{
				foreach ($mHeaders as $mHeader)
				{
					fwrite ($fp,$mHeader.'\n');
//					print_r ($mHeader);
				}
			}
			else
			{
				fwrite ($fp,"\x02L\n");
				fwrite ($fp,"H08\n");
				fwrite ($fp,"D11\n");
			}
			fwrite($fp,$mLabelContent1);
//				print_r($mLabelContent1.$mLabelContent2);
			if (!empty($mFooters))
			{
				foreach ($mFooters as $mFooter)
				{
					fwrite ($fp,$mFooter.'\n');
//					print_r ($mFooter); 
				}
			}
			else
			{
				fwrite ($fp,"E\n"); 
			}
			fclose($fp);
//			return "OKMS-RTS Label Printed to - ".$mPrinter." ";
		}
	}
	
	return "OKMS-Decant Label Printed to - ".$mPrinter." ";
}

// Return Default mySql Connection
function defaultDbConnection()
{
// get default System Settings from xml file	
	$mSystem = "DEFAULT";
// Get System Definition XML from URL
	$mData = file_get_contents("../../vimsconfig/systemsettings.xml");
// Parse XML to XML Object Array
	$xml = simplexml_load_string($mData, 'SimpleXMLElement', LIBXML_NOCDATA);
// Split-out System Definitions from XML 'fields' Nodes
	$i = 0;

	for ($i = 0; $i <= 150; $i++) 
	{			
		$mSystemId = "";
		$mPath = "";
		$mDbHost = "";
		$mDbUser = "";
		$mDbPwd = "";
		$mDbase = "";
		$mMqServer = "";
		$mCompany = "";
		if (("".$xml->systems->system[$i]->systemid."" == "") || ("".$xml->systems->system[$i]->systemid."" == false) || ("".$xml->systems->system[$i]->systemid."" == false))
			break;
		
		$mSystemId = "".$xml->systems->system[$i]->systemid."";
		if (($mSystemId == "") || ($mSystemId == false))
			break;
		
// Store System Settings from "trandef/systemsettings.xml"		
		if (strToUpper($mSystem) == strToUpper($mSystemId))
		{
			$mPath = "".$xml->systems->system[$i]->path."";
			$mDbHost = "".$xml->systems->system[$i]->dbhost."";
			$mDbUser = "".$xml->systems->system[$i]->dbuser."";
			$mDbPwd = "".$xml->systems->system[$i]->dbpwd."";
			$mDbase = "".$xml->systems->system[$i]->dbase."";
			break;
		}
		if (($mSystemId == "") || ($mSystemId == false))
			break;
	}
	$mDbDefaults = array();
	$mDbDefaults[0] = $mDbHost;
	$mDbDefaults[1] = $mDbUser;
	$mDbDefaults[2] = $mDbPwd;
	$mDbDefaults[3] = $mDbase;
	$mDbDefaults[4] = $mPath;
	return $mDbDefaults;
}

// Print Labels
function labelPrint($mDecantId, $mDecantRef, $mPrinter, $mLabel, $mHost, $mUser, $mPwd, $mDbName, $mOutput="n")
{
//    return "FAIL-TEST-".$mDecantId;
// date / time
	$date = date('d/m/Y h:i:s a', time());
	
	if (($mPrinter == null) || ($mPrinter == "") || (!$mPrinter))
    {
// Build Report-file name
        $reportName = "decantlabelpdf";        
        list($code,$printer) = getDecantPrinter($reportName,$mHost, $mUser, $mPwd, $mDbName);	
    }
    else
	{
        list($code,$printer) = getDecantPrinter($mPrinter,$mHost, $mUser, $mPwd, $mDbName);
		$reportName = $code;
	}
	if (empty($code))
	{
		exit ("OKMS-Printer ".$printer." Not Found");
	}
//	exit("FAIL-TEST1-".$code." ".$printer);
	$data = LoadData($mHost, $mUser, $mPwd, $mDbName, $mDecantId, $mDecantRef);
//	if ($mPrinter)
//		decantLabel($mLabel, $data, $mPrinter);
	if (stripos($code,"zeb") !== false)
	{
		if (($mLabel == null) || ($mLabel == "") || (!$mLabel))
			$mLabel = "decant_zebra.prn";
//		exit("FAIL-zebra ".$code." ".$mLabel." ".$printer);
		$pdf = new PDF('P','mm','A4');
// Check if printer is connected
		if (ping($printer) == false)
		{
			exit ("OKMS-Printer ".$printer." Not Found");
		}
//		exit("FAIL-zebra ".$code." ".$mLabel." ".$printer);
		$mReturn = decantLabel($mLabel, $data, $printer);
		$mOutput = "z";
	}
	elseif (stripos($code,"lbl") !== false)
	{
		if (($mLabel == null) || ($mLabel == "") || (!$mLabel))
			$mLabel = "decant_datamax.prn";
//		exit("FAIL-Datamax-".$mLabel." ".$printer);
		$pdf = new PDF('P','mm','A4');
// Check if printer is connected
		if (ping($printer) == false)
		{
			exit ("OKMS-Printer ".$printer." Not Found");
		}	
		$mReturn = decantLabel($mLabel, $data, $printer);
		$mOutput = "z";
	}
	elseif (stripos($code,"A5") !== false)
	{
//		return("FAIL-A5".$code);
		$pdf = new PDF('P','mm','A4');
	}
	else
	{
//		exit("FAIL-A4".$code);
		$pdf = new PDF('L','mm','A4');
	}
// Column headings
	$header = "Reference,Part,Desc,vendor,Serial,Ran,Qty";
	$pdf->SetFont('Arial','',12);

	$pdf->BarcodeTablePdf($header,$data);
	$pdf->Ln(5);

	if ($mOutput == "")
		$pdf->Output();
	elseif($mOutput == "f")
	{
		$mPdf = "../../../vimsreports/decantlabel".$mCurrentUser.".pdf";
		$pdf->Output($mPdf,$mOutput);
	}
	else
	{
		if (!file_exists("../../../vimsreports_arcv/".$code)) 
		{
			if (mkdir("../../../vimsreports_arcv/".$code)) 
			{
				$dir = "../../../vimsreports_arcv/".$code;
			} 
			else 
			{
				$dir = "../../../vimsreports_arcv";
			}
		}
		else
		{
			$dir = "../../../vimsreports_arcv/".$code;
		}
		$mPdf = $dir."/decantlabel".$mCurrentUser.".pdf";
		$pdf->Output($mPdf,'f');
	}

    if ((file_exists($mPdf) && $mOutput != "z"))
    {
        $mReturn = sendPdf($mPdf, $printer);
    
		if (($mReturn == "") || ($mReturn == null))
		{
			return ("OKMS-decantlabel");
		}
		if (substr($mReturn,0,2)=="OK")
			return "OKMS-decant labels printed -".$mPrinter;
		else
			return "FAIL-".$mReturn;
	}
	if (is_string($mReturn) && substr($mReturn,0,4) != "OK  ")
	{
		exit ($mReturn);
	}
	else
	{
		return "OKMS-decant labels printed -".$mPrinter;
	}
//    return ("IFRAME-/vimsreports_arcv/decantlabel".$mCurrentUser.".pdf");
//	print_r("FAIL-TEST1");
}

function getDecantPrinter($mReference,$mHost, $mUser, $mPwd, $mDbName)
{
	$mRow = array();
	$mPrinter = "default";
	$mConnection=mysqli_connect($mHost,$mUser,$mPwd,$mDbName) or
		exit("FAIL-Connect failed: ".mysqli_connect_errno()." : ". mysqli_connect_error()."-".$mHost);
	$mDataQuery = "SELECT printer_code AS printer_code, printer_address AS printer_address FROM printer_mapping WHERE printer_code='".trim($mReference)."' LIMIT 1";
	if (!$mData = mysqli_query($mConnection,$mDataQuery))
		return "FAIL-".mysqli_error($mConnection).":".$mDataQuery;
	if (mysqli_num_rows($mData) == 0)
	{
		$mDataQuery = "SELECT printer_code AS printer_code, printer_address AS printer_address FROM printer_mapping WHERE printer_address='".trim($mReference)."' LIMIT 1";
		if (!$mData = mysqli_query($mConnection,$mDataQuery))
			return "FAIL-".mysqli_error($mConnection).":".$mDataQuery;
	}
	if (mysqli_num_rows($mData) == 0)
	{
		$mDataQuery = "SELECT printer_code AS printer_code, printer_address AS printer_address FROM printer_mapping WHERE printer_code='default' LIMIT 1";
		if (!$mData = mysqli_query($mConnection,$mDataQuery))
			return "FAIL-".mysqli_error($mConnection).":".$mDataQuery;
	}
	$mRow = mysqli_fetch_row($mData);
	mysqli_close($mConnection);
	return $mRow;
}

function sendPdf($reportName, $printer)
{
	try
	{		
		if ($printer == "default")
		{
			$pgmPath = '"c:/LibreOffice/program/soffice.exe" --pt';
			$printPath = '"'.$printer.'"';
			$filePath = '"'.$reportName.'"';
			$command = escapeshellcmd($pgmPath." ".$printPath." ".$filePath);
//			return "FAIL-TEST1-".$reportName."-".$printer;
			$output = shell_exec($command);
			echo 'OK  -'.$output." ".$pgmPath." ".$printPath." ".$filePath;
		}
		else
		{
			$pgmPath = '"c:/LibreOffice/program/soffice.exe" --pt';
			$printPath = '"'.$printer.'"';
			$filePath = '"'.$reportName.'"';
			$command = escapeshellcmd($pgmPath." ".$printPath." ".$filePath);
//			$command = '^"c:/LibreOffice/program/soffice.exe^" --pt ^"^\^\VEU-RRMC-R1.vanteceurope.local^\veu-rrmc-it-office^" ^"e:/webroot/vimsreports_arcv/decantlabel.pdf^"';
//			return "FAIL-TEST1-".$reportName."-".$printer;
//			echo shell_exec($command);

// Execute the command and capture output
			$output = array();
			$returnValue = null;
			exec($command, $output, $returnValue);
//			print_r($output);
//			echo 'FAIL-'.$output." ".$pgmPath." ".$printPath." ".$filePath;
			echo ('OK  -'.$command);
//			var_dump($output);
//			var_dump($returnValue);
		}
		return;
	}
	catch (Exception $e)
	{
		echo "FAIL-picksheetpdf-".$e;
		return;
	}
}

function ping($mAddress)
{
    if(strtolower(PHP_OS)=='winnt')
    {
        $command = "ping -n 1 -w 2000 $mAddress";
        exec($command, $output, $status);
    }
    else
    {
        $command = "ping -c 1 -w 2000 $mAddress";
        exec($command, $output, $status);
    }
    if($status === 0)
    {
        return true;
    }
    else
    {
        return false;
    }
}

// Data loading
/*
$mDecantId = 10;
if (($mHost == "") || ($mHost == null))
{
 	$mDbDefaults = defaultDbConnection();
 	$mHost = "nmukbp";
 	$mUser = "root";
 	$mPwd = "root";
 	$mDbName = "vims";
	$mPath = $mDbDefaults[4];
}

// date / time
// 	$date = date('d/m/Y h:i:s a', time());

labelPrint($mDecantId, '', '', $mHost, $mUser, $mPwd, $mDbName, $mOutput="n")
*/

?>