COMPILE FUNCTION Comm_Dialog_WO_Scan(Method, Parm1)
#pragma precomp SRP_PreCompiler

/*
	Commuter module for Dialog_WO_Scan window.
	
	08/12/2004 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status, ErrMsg, Extract_SI_Keys, Logging_Services
DECLARE SUBROUTINE obj_Appwindow, Start_Window, Msg, Btree.Extract, Error_Services
DECLARE FUNCTION   Get_Property, Get_Status, Dialog_Box, Send_Message, Set_FSError, Environment_Services
DECLARE FUNCTION   obj_Vendor_Code, Msg, Error_Services, Logging_Services

$INSERT LOGICAL
$INSERT MSG_EQUATES
$INSERT APPCOLORS

EQU CRLF$	TO \0D0A\

EQU COL$LQP_LOT		TO 1				;* Equates for Lot_Qty... edit table controls used to scan in label data
EQU COL$LQP_QTY		TO 2
EQU COL$LQP_PART	TO 3				;* This is either Cust Part No OR Substrate Part Number depending on which control is visible
EQU COL$LQP_VENDOR	TO 4				;* Vendor code on the Substrate screen 7/14/2011 JCH for SAP

EQU CA$ITEM_NO				TO 1		;* Equates for Checking Array passed to Scan routine
EQU CA$LOT_NO				TO 2
EQU CA$LOT_QTY				TO 3
EQU CA$CUST_PART_NO			TO 4
EQU CA$SUB_PART_NO			TO 5
EQU CA$SCANNED_LOT_QTY		TO 6
EQU CA$VERIFY_PART_NO		TO 7
EQU CA$SUB_SUPP_BY			TO 8

LogPath     = Environment_Services('GetApplicationRootPath') : '\LogFiles\Receiving'
LogDate     = Oconv(Date(), 'D4/')
LogTime     = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Receiving Log.csv'
Headers     = 'Logging DTM' : @FM : 'User' : @FM : 'Scan Data'
objLog      = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$)
LoggingDTM  = LogDate : ' ' : LogTime   ; // Logging DTM


ErrTitle	= 'Error in Comm_Dialog_WO_Scan'
ErrorMsg	= ''
Result		= ''

BEGIN CASE
	CASE Method = 'Create'			; GOSUB Create
	CASE Method = 'OK'				; GOSUB OK
	CASE Method = 'Cancel'			; GOSUB Cancel
	CASE Method = 'FieldClick'		; GOSUB FieldClick
	CASE Method = 'LQP'				; GOSUB LQP
	CASE 1
		ErrMsg(ErrTitle:@SVM:'Unknown method ':QUOTE(Method):' passed to routine.')
END CASE

RETURN Result

* * * * * * *
Create:
* * * * * * *

VendorDef	= Parm1[1,@FM]

CheckArray	= FIELD(Parm1,@FM,2,999)

Set_Property(@WINDOW,'@VENDOR_DEF',VendorDef)

OpenQty	= CheckArray<CA$LOT_QTY>
Set_Property(@WINDOW:'.OPEN_QTY','TEXT',OCONV(OpenQty,'MD0,'))		;* 12/6/2011 JCH

Set_Property(@WINDOW,'@CHECK_ARRAY',CheckArray)
obj_AppWindow('Create')

TimeStamp = OCONV(Date(),'D4/'):' ':OCONV(Time(),'MTS')
Set_Property(@WINDOW:'.RX_DTM','DEFPROP',TimeStamp)
Set_Property(@WINDOW,'FOCUS',@WINDOW:'.RX_DTM')
Set_Property(@WINDOW:'.RX_DTM','SELECTION',1:@FM:65534)

GOSUB Refresh


* * * * * * *
FieldClick:
* * * * * * *

CtrlEntID = @WINDOW:'.FIELD_RADIO'

ControlSelection = Get_Property(CtrlEntID,'VALUE')

Ctrls  = @WINDOW:'.LOT_QTY':@RM				; Props  = 'VISIBLE':@RM
Ctrls := @WINDOW:'.LOT_QTY_PART':@RM		; Props := 'VISIBLE':@RM
Ctrls := @WINDOW:'.LOT_QTY_SUB_PART':@RM 	; Props := 'VISIBLE':@RM
Ctrls := @WINDOW:'.WINDOW_LABEL_FIX'		; Props := 'TEXT'


BEGIN CASE
	CASE ControlSelection = 'LQ'		; Vals = '1':@RM:'0':@RM:'0':@RM:'Customer Wafers'
	CASE ControlSelection = 'LQP'		; Vals = '0':@RM:'1':@RM:'0':@RM:'Customer Wafers'
	CASE ControlSelection = 'LQSP'		; Vals = '0':@RM:'0':@RM:'1':@RM:'Substrates'
END CASE

Set_Property(Ctrls,Props,Vals)

RETURN

* * * * * * *
Close:
* * * * * * *

* * * * * * *
Cancel:
* * * * * * *

End_Dialog(@WINDOW,'Cancel')

RETURN


* * * * * * *
Refresh:
* * * * * * *

ListArray	= Get_Property(CtrlEntId,'ARRAY')
CheckArray = Get_Property(@WINDOW,'@CHECK_ARRAY')
TotalScannedQty = SUM(ListArray<COL$LQP_QTY>)
OpenQty	= CheckArray<CA$LOT_QTY>

Set_Property(@WINDOW:'.SCANNED_QTY','TEXT',OCONV(TotalScannedQty,'MD0,'))

IF TotalScannedQty < OpenQty THEN
	Set_Property(@WINDOW:'.SCANNED_QTY','BACKCOLOR',GREEN$)
END ELSE
	Set_Property(@WINDOW:'.SCANNED_QTY','BACKCOLOR',RED$)	
END

RETURN

* * * * * * *
LQP:
* * * * * * *

CtrlEntID	= Get_Property(@WINDOW,'FOCUS')
StripANSI	= Get_Property(@WINDOW:'.STRIP_ANSI','CHECK')
SkipSubANSI	= Get_Property(@WINDOW:'.SKIP_SUBSTRATE_ANSI','CHECK')

CheckArray = Get_Property(@WINDOW,'@CHECK_ARRAY')

BEGIN CASE
	CASE CtrlEntID = @WINDOW:'.LOT_QTY'				; ColCnt = 2
	CASE CtrlEntID = @WINDOW:'.LOT_QTY_PART'		; ColCnt = 3
	CASE CtrlEntID = @WINDOW:'.LOT_QTY_SUB_PART'	; ColCnt = 4
END CASE

PrevSelPos	= Get_Property(CtrlEntId,"PREVSELPOS")
PrevCol 	= PrevSelPos<1>
PrevRow 	= PrevSelPos<2>
CurrPos		= Get_Property(CtrlEntId,'SELPOS')
CurrCol		= CurrPos<1>
CurrRow		= CurrPos<2>
ListData	= Get_Property(CtrlEntId,'LIST')

IF ListData<CurrRow,CurrCol> = '' THEN
	ColPointer = CurrCol
	LinePointer = CurrRow
	
	* Find the first non-empty cell
	LOOP
		Test = ListData<LinePointer,(ColPointer) >
	UNTIL Test NE '' OR (LinePointer = 0 AND ColPointer = 1)
		ColPointer -= 1
		IF ColPointer = 0 THEN
			ColPointer = ColCnt
			LinePointer -= 1
		END
	REPEAT
	* Move one past the non empty cell
	BEGIN CASE
		CASE LinePointer = 0 
			* Empty Table
			LinePointer = 1
			CoilPointer = 1
		CASE ColPointer = ColCnt
			LinePointer += 1
			ColPointer = 1
		CASE 1
			ColPointer += 1
	END CASE
	Set_Property(CtrlEntId,"SELPOS",ColPointer:@FM:LinePointer)
END

// Global scan validation check. Only alpha-numeric, dashes, spaces, and periods permitted.
ValidationScan  = Trim(ListData<PrevRow,PrevCol>)
Convert @Lower_Case to @Upper_Case in ValidationScan
Convert 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ./' to '' in ValidationScan
//DPC 2/18/20 - changed validation to allow foward slash per supplier lot naming (Global Wafer)
//FYI - conversion would only work when separated from above line
Convert '/' to '' in ValidationScan
If ValidationScan NE '' then
    Error_Services('Set', 'Scanned code ' : Quote(Trim(ListData<PrevRow,PrevCol>)) : ' contains an invalid character. Please re-scan.')
end

If Error_Services('NoError') then
    IF ListData<PrevRow,PrevCol> NE '' THEN
        BEGIN CASE
            CASE PrevCol = COL$LQP_LOT

                IF StripANSI THEN
                    RawLot = TRIM(ListData<PrevRow,PrevCol>)
                    IF RawLot[1,2] = '1T' OR RawLot[1,2] = '2T' THEN
                        LotNo = RawLot[3,99]
                    END ELSE
                        Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Scanned Code ':QUOTE(RawLot):' is not an ANSI Lot No.')
                        Set_Property(CtrlEntId,"SELPOS",PrevSelPos)
                        Set_Property(CtrlEntID,'INVALUE','',PrevSelPos)
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                        RETURN
                    END
                END ELSE
                    LotNo = TRIM(ListData<PrevRow,PrevCol>)
                END
                
                IF CtrlEntID NE @WINDOW:'.LOT_QTY_SUB_PART' THEN
                
                    * Don't check Customer Lot Numbers if scanning substrates
                    
                    LOCATE LotNo IN CheckArray<CA$LOT_NO> USING @VM SETTING Pos ELSE
                        * Accept or Rescan message
                        Resp             = Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Lot No ':QUOTE(LotNo):' not found in':@TM:'Order Item Lot Numbers!')
                        LotNo            = ''											;* Clear entered field for a rescan
                        Set_Property(CtrlEntId,"SELPOS",PrevSelPos)			;* Cursor to Lot No for a rescan
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                    END
                END
                
                Set_Property(CtrlEntID,'INVALUE',LotNo,PrevSelPos)
            
            CASE PrevCol = COL$LQP_QTY									
                
                IF StripANSI THEN
                    RawLotQty = ListData<PrevRow,PrevCol>
                    IF RawLotQty[1,1] = 'Q' THEN
                        LotQty = RawLotQty[2,99]
                    END ELSE
                        Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Scanned Code ':QUOTE(RawLotQty):' is not an ANSI Quantity')
                        Set_Property(CtrlEntId,"SELPOS",PrevSelPos)
                        Set_Property(CtrlEntID,'INVALUE','',PrevSelPos)
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                        RETURN
                    END
                END ELSE
                    LotQty = ListData<PrevRow,PrevCol>
                END
                
                IF NOT(NUM(LotQty)) THEN
                    * Accept or Rescan message
                    Resp  = Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Lot Qty ':QUOTE(LotQty):' is not a number!')
                    LotNo = ''											;* Clear entered field for a rescan
                    Set_Property(CtrlEntId,"SELPOS",PrevSelPos)			;* Cursor to Lot No for a rescan
                    Set_Property(CtrlEntID, 'FOCUS', True$)
                END
                
                Set_Property(CtrlEntID,'INVALUE',LotQty,PrevSelPos)
            
            
            CASE PrevCol = COL$LQP_PART
                // Check scanned part number for 5 segments. If there are 5 segments then use segments 3 and 4
                // to make the actual part number.
                ScannedPartNo   = Trim(ListData<PrevRow, PrevCol>)
                If DCount(ScannedPartNo, '-') EQ 5 then
                    RawPartNo   = ''
                    If ScannedPartNo[1, 1] _EQC 'P' then RawPartNo := 'P'
                    If ScannedPartNo[1, 1] _EQC 'S' then RawPartNo := 'S'
                    RawPartNo  := Field(ScannedPartNo, '-', 3, 2)
                    ListData<PrevRow, PrevCol>  = RawPartNo
                end
                RawPartNo = TRIM(ListData<PrevRow,PrevCol>)
                IF StripANSI AND NOT(SkipSubAnsi) THEN				;***************************************
                    RawPartNo = TRIM(ListData<PrevRow,PrevCol>)
                    IF RawPartNo[1,1] _EQC 'P' OR RawPartNo[1,1] _EQC 'S' THEN
                        PartNo = RawPartNo[2,99]
                    END ELSE
                        Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Scanned Code ':QUOTE(RawPartNo):' is not an ANSI Part No')
                        Set_Property(CtrlEntId,"SELPOS",PrevSelPos)
                        Set_Property(CtrlEntID,'INVALUE','',PrevSelPos)
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                        RETURN
                    END
                END ELSE
                    PartNo = ListData<PrevRow,PrevCol>
                END
                
                IF CtrlEntID = @WINDOW:'.LOT_QTY_PART' THEN
                    * Check Customer Part Numbers
                    LOCATE PartNo IN CheckArray<CA$VERIFY_PART_NO> USING @VM SETTING Pos THEN
                        PartNo = CheckArray<CA$CUST_PART_NO,Pos>
                    END ELSE
                        * Accept or Rescan message
                        Resp   = Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Part No ':QUOTE(PartNo):' not found in':@TM:'Order Customer Part Numbers!')
                        PartNo = ''											;* Clear entered field for a rescan
                        Set_Property(CtrlEntId,"SELPOS",PrevSelPos)			;* Cursor to Lot No for a rescan
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                    END
                    
                END ELSE
                    * Check Substrate Part Numbers
                    LOCATE PartNo IN CheckArray<CA$SUB_PART_NO> USING @VM SETTING Pos ELSE
                        * Accept or Rescan message
                        Resp             = Msg(@Window, '', 'OK', '', 'Scan Error':@FM:'Part No ':QUOTE(PartNo):' not found in':@TM:'Order Substrate Part Numbers!')
                        PartNo           = ''											;* Clear entered field for a rescan
                        Set_Property(CtrlEntId,"SELPOS",PrevSelPos)			;* Cursor to Lot No for a rescan
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                    END
                END	;* End of check for Customer supplied or Inventory substrate part number
                
                Set_Property(CtrlEntID,'INVALUE',PartNo,PrevSelPos)
                
            CASE PrevCol = COL$LQP_VENDOR 
                
                SubSuppBy = CheckArray<CA$SUB_SUPP_BY>
                VendCode  = ''
                IF StripANSI AND NOT(SkipSubAnsi) THEN	
                    RawVendCode = TRIM(ListData<PrevRow,PrevCol>)
                    IF RawVendCode[1,2] = '1V' THEN
                        VendCode = RawVendCode[3,99]
                    END ELSE
                        TypeOver         = ''
                        TypeOver<MTYPE$> = 'B&Rescan'
                        TypeOver<MTEXT$> = 'Scanned Code ':QUOTE(RawVendCode):' is not an ANSI Vendor Code'
                        Resp             = Msg(@WINDOW, '','OK', '', 'Scan Error':@FM:'Scanned Code ':QUOTE(RawVendCode):' is not an ANSI Vendor Code')
                        Set_Property(CtrlEntID,"SELPOS",PrevSelPos)
                        Set_Property(CtrlEntID,'INVALUE','',PrevSelPos)
                        Set_Property(CtrlEntID, 'FOCUS', True$)
                        RETURN
                    END
                END ELSE
                    VendCode = ListData<PrevRow,PrevCol>
                END
                
                IF RowExists('SEMI_VEND_CODE', VendCode) OR SubSuppBy = 'C' ELSE
                    * Accept or Rescan message
                    If VendCode EQ '' then VendCode = RawVendCode
                    Resp             = Msg(@WINDOW, '','OK', '', 'Scan Error':@FM:'Vendor Code ':QUOTE(VendCode):' not found in':@TM:'Vendor Codes on file!')
                    VendCode         = ''										;* Clear entered field for a rescan
                    Set_Property(CtrlEntId,"SELPOS",PrevSelPos)			;* Cursor to Lot No for a rescan
                    Set_Property(CtrlEntID,'INVALUE','',PrevSelPos)
                    Set_Property(CtrlEntID, 'FOCUS', True$)
                    RETURN
                END
                
                Set_Property(CtrlEntID,'INVALUE',VendCode,PrevSelPos)
                
				ExpectedCode = Get_Property(@WINDOW,'@VENDOR_DEF')
				
				IF VendCode NE ExpectedCode AND ExpectedCode NE '' THEN
					void = Msg(@WINDOW,'','EXPECTED_VENDOR_CODE','',ExpectedCode:@FM:VendCode)
					Set_Property(CtrlEntID, 'FOCUS', True$)
				END

                ListArray	= Get_Property(CtrlEntId,'ARRAY')
                CheckArray = Get_Property(@WINDOW,'@CHECK_ARRAY')

                TotalScannedQty = SUM(ListArray<COL$LQP_QTY>)
                OpenQty	= CheckArray<CA$LOT_QTY>
                
                IF TotalScannedQty >= OpenQty THEN
                                    
                    Resp = 	Msg(@WINDOW,'','WO_REC_COMPLETE')
                    
                    GOTO OK		
                END
                
        END CASE
    END 
end

If Error_Services('HasError') then
    TypeOver            = ''
    TypeOver<MTYPE$>    = 'B&Rescan'
    Message             = Error_Services('GetMessage')
    TypeOver<MTEXT$>    = Message
    Msg(@Window, TypeOver, 'LABEL_DATA_ERROR')
    Set_Property(CtrlEntId, 'SELPOS', PrevSelPos)
    Set_Property(CtrlEntID, 'INVALUE', '', PrevSelPos)
    Error_Services('Clear')
end else
    GOSUB Refresh
end

RETURN


* * * * * * *
OK:
* * * * * * *

CtrlEntID = @WINDOW:'.FIELD_RADIO'
CheckArray = Get_Property(@WINDOW,'@CHECK_ARRAY')

ControlSelection = Get_Property(CtrlEntID,'VALUE')

Ctrls  = @WINDOW:'.LOT_QTY':@RM				; Props  = 'VISIBLE':@RM
Ctrls := @WINDOW:'.LOT_QTY_PART':@RM		; Props := 'VISIBLE':@RM
Ctrls := @WINDOW:'.LOT_QTY_SUB_PART' 		; Props := 'VISIBLE'

BEGIN CASE
	CASE ControlSelection = 'LQ'		; Ctrl = @WINDOW:'.LOT_QTY'
	CASE ControlSelection = 'LQP'		; Ctrl = @WINDOW:'.LOT_QTY_PART'
	CASE ControlSelection = 'LQSP'		; Ctrl = @WINDOW:'.LOT_QTY_SUB_PART'
END CASE

ListData = Get_Property(Ctrl,'LIST')

TimeStamp = Get_Property(@WINDOW:'.RX_DTM','TEXT')
TimeStamp = ICONV(TimeStamp,'DT')
IF TimeStamp = '' THEN
	ErrMsg('Invalid Received DateTime data entered.  "mm/dd/yy hh:mm:ss" is the basic format.')
	RETURN
END

CheckArray<CA$SCANNED_LOT_QTY> = ''	;* Clear scanned lot quantities column

LineCnt = 1
LOOP
	TestVal = ListData<LineCnt,1>
UNTIL TestVal = ''
	LotNo	= TRIM(ListData<LineCnt,1>)
	Qty		= TRIM(ListData<LineCnt,2>)
	
	IF ControlSelection = 'LQ' THEN
		LOCATE LotNo IN CheckArray<CA$LOT_NO> USING @VM SETTING Pos THEN
			OrderItemNo = CheckArray<CA$ITEM_NO,Pos>
			CustPartNo	= CheckArray<CA$CUST_PART_NO,Pos>
			SubPartNo	= CheckArray<CA$SUB_PART_NO,Pos>
			CheckArray<CA$SCANNED_LOT_QTY,Pos> = CheckArray<CA$SCANNED_LOT_QTY,Pos> + Qty
		END ELSE
			* Accept or Rescan message
			TypeOver			= ''
			TypeOver<MTYPE$>	= 'B&Rescan'
			TypeOver<MTEXT$>	= 'Lot No ':QUOTE(LotNo):' not found in':@TM:'Order Item Lot Numbers!'
			Resp				= Msg(@WINDOW,TypeOver,'LABEL_DATA_ERROR')
			LotNo				= ''									;* Clear entered field for a rescan
			Set_Property(CtrlEntId,"SELPOS",CA$LOT_NO:@FM:LineCnt)		;* Cursor to Lot No for a rescan
			RETURN
		END

	END
	
	IF ControlSelection = 'LQP' THEN
		CustPartNo	= TRIM(ListData<LineCnt,3>)
		LOCATE LotNo IN CheckArray<CA$LOT_NO> USING @VM SETTING Pos THEN
			OrderItemNo = CheckArray<CA$ITEM_NO,Pos>
			SubPartNo	= CheckArray<CA$SUB_PART_NO,Pos>
			CheckArray<CA$SCANNED_LOT_QTY,Pos> = CheckArray<CA$SCANNED_LOT_QTY,Pos> + Qty
		END ELSE
			* Accept or Rescan message
			TypeOver = ''
			TypeOver<MTYPE$> = 'B&Rescan'
			TypeOver<MTEXT$> = 'Lot No ':QUOTE(LotNo):' not found in':@TM:'Order Item Lot Numbers!'
			Resp = Msg(@WINDOW,TypeOver,'LABEL_DATA_ERROR')
			
			LotNo = ''														;* Clear entered field for a rescan
			Set_Property(CtrlEntId,"SELPOS",CA$LOT_NO:@FM:LineCnt)			;* Cursor to Lot No for a rescan
			RETURN
		END
	END
	
	IF ControlSelection = 'LQSP' THEN
		
		SubPartNo	= TRIM(ListData<LineCnt,3>)
		Vendor		= TRIM(ListData<LineCnt,4>)		;* Added 7/14/2011 JCH for SAP
		OrderItemNo = CheckArray<CA$ITEM_NO,1>		;* Changed 2/8/2010 from ' = 1 ' JCH
		CustPartNo = CheckArray<CA$CUST_PART_NO,1>
		
	END ELSE
		Vendor = ''
	END

	Result<1,LineCnt> = LineCnt
	Result<2,LineCnt> = LotNo							;* Lot No
	Result<3,LineCnt> = Qty
	Result<4,LineCnt> = CustPartNo	;* PartNo
	Result<5,LineCnt> = SubPartNo	;* Substrate Part No
	Result<6,LineCnt> = Vendor		;* Substrate Vendor Code
	Result<7,LineCnt> = OCONV(TimeStamp,'DT')
	Result<8,LineCnt> = @USER4
	Result<9,LineCnt> = OrderItemNo
	
	LineCnt += 1
REPEAT

IF ControlSelection NE 'LQSP' THEN

	* Orders with Epi supplied substrates don't have any lot quantities to check against.
	
	ProblemQtyLots = ''
	FOR I = 1 TO COUNT(CheckArray<CA$LOT_NO>,@VM) + (CheckArray<CA$LOT_NO> NE '')
		IF (CheckArray<CA$SCANNED_LOT_QTY,I> NE '') AND (CheckArray<CA$LOT_QTY,I> NE CheckArray<CA$SCANNED_LOT_QTY,I>) THEN
			* Lot quantity mismatch
			ProblemQtyLots<-1> = CheckArray<CA$LOT_NO,I>
		END
	NEXT I

	IF ProblemQtyLots NE '' THEN
		LineCnt = 1
		LOOP
			TestVal = ListData<LineCnt,1>
		UNTIL TestVal = ''
			LotNo	= TRIM(ListData<LineCnt,1>)
			LOCATE LotNo IN ProblemQtyLots USING @FM SETTING Pos THEN
				stat = Send_Message(Ctrl,'COLOR_BY_POS',0,LineCnt,RED$)		;* Flag all the lines with lot numbers having qty problems
			END
			LineCnt += 1
		REPEAT
		
		ErrMsg('Lot Quantity(s) Scanned do not match Order Item Lot Quantity(s)!||Review and rescan highlighted items.')
		RETURN
	END
END ELSE
	* 
END

NumRows = DCount(Result, @FM)
NullFound = False$
For LineIndex = 1 to NumRows
    Row = Result<LineIndex>
    NumVals = DCount(Row, @VM)
    For ValIndex = 1 to NumVals
        Val = Row<0, ValIndex>
        If Val EQ '' then NullFound = True$
    Next ValIndex
Until NullFound
Next LineIndex
If NullFound EQ True$ then
    ErrMsg('Missing value found in scanned data! Verify your labels and restart your scan operation.')
    Result = 'Cancel'
end

ScanResult    = Result
Swap @VM with ' | ' in ScanResult

LogData    = ''
LogData<1> = LoggingDTM
LogData<2> = @User4
LogData<3> = ScanResult
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)

End_Dialog(@WINDOW,Result)

RETURN


