$reqDeptId
$reqSection
$reqUnit
$issuingDept
$issueDepartmentWarehouse
II0_ID, II0_MODE, II0_DOC_TYPE, II0_DOC_NUMBER, II0_DOC_SUB_TYPE_V, II0_DOC_HEADER,
II0_DOC_DESCRIPTION, II0_ISSUE_DEPARTMENT,II0_REQ_SECTION_ID, II0_REQ_UNIT_ID, II0_REQ_DEPARTMENT,
II0_WAREHOUSE_NUMBER, II0_DOC_TOTAL_ITEMS, II0_DOC_TOTAL_ITEMS,
II0_STATUS, II0_REASON_CODE, II0_IS_LINKED, II0_LINKED_DOC_TYPE,
II0_LINKED_DOC_KEY, II0_LASTUPDATED_USER_ID,
II0_LASTUPDATED_USER_ROLE, II0_LASTUPDATED_USER_SMP, II0_LOCK_ID,
II0_IS_PROGRAM_RELATED,
II0_PROGRAM_ID, II0_PROGRAM_MODE,
II0_CREATED_USER_ID,II0_CREATED_USER_ROLE,II0_CREATED_USER_SMP,
II0_IS_LINKED AS DOC_SOURCE, REQ.COM_DEP_ENGLISH_NAME
REQ_DEP_ENG,REQ.COM_DEP_ARABIC_NAME,ISSUE.COM_DEP_ENGLISH_NAME
ISSUE_DEP_ENG,
(SELECT CON_SEC_ENGLISH_NAME FROM VCON_SECTION WHERE VII0_ISSUE_ITEM_MAIN.II0_REQ_SECTION_ID = VCON_SECTION.CON_ID) REQ_SEC_ENG,
(SELECT COO_UNIT_ENGLISH_NAME FROM VCOO_UNIT WHERE VII0_ISSUE_ITEM_MAIN.II0_REQ_UNIT_ID = VCOO_UNIT.COO_ID) REQ_UNIT_ENG,
(SELECT AT0_USER_REMARKS FROM VAT0_AUDIT_TRAIL_MAIN WHERE
VAT0_AUDIT_TRAIL_MAIN.AT0_DOCUMENT_NUMBER = VII0_ISSUE_ITEM_MAIN.II0_DOC_NUMBER
ORDER BY AT0_TIME_STAMP DESC FETCH FIRST 1 ROWS ONLY) FEEDBACK
VII0_ISSUE_ITEM_MAIN,
VCOM_DEP REQ, VCOM_DEP ISSUE
($defaultWhereClause)
AND
VII0_ISSUE_ITEM_MAIN.II0_REQ_DEPARTMENT = REQ.COM_DEP_NUMBER AND
VII0_ISSUE_ITEM_MAIN.II0_ISSUE_DEPARTMENT = ISSUE.COM_DEP_NUMBER AND
VII0_ISSUE_ITEM_MAIN.II0_DOC_TYPE = 'CUII' AND
(( VII0_ISSUE_ITEM_MAIN.II0_MODE = 'D' AND
VII0_ISSUE_ITEM_MAIN.II0_LASTUPDATED_USER_ID=$session.user.name
and VII0_ISSUE_ITEM_MAIN.II0_LASTUPDATED_USER_ROLE =
$session.user.currentRole.name ) or
(
VII0_ISSUE_ITEM_MAIN.II0_MODE = '0' AND VII0_ISSUE_ITEM_MAIN.II0_ID NOT IN (SELECT
VII0_ISSUE_ITEM_MAIN.II0_ID FROM VII0_ISSUE_ITEM_MAIN a
WHERE a.II0_ID = VII0_ISSUE_ITEM_MAIN.II0_ID AND a.II0_MODE='D'
AND
a.II0_LASTUPDATED_USER_ID = $session.user.name AND
a.II0_LASTUPDATED_USER_ROLE =
$session.user.currentRole.name)))
II0_ID, II0_MODE, II0_DOC_TYPE, II0_DOC_NUMBER, II0_DOC_SUB_TYPE_V, II0_DOC_HEADER,
II0_DOC_DESCRIPTION, II0_ISSUE_DEPARTMENT,II0_REQ_SECTION_ID, II0_REQ_UNIT_ID, II0_REQ_DEPARTMENT,
II0_WAREHOUSE_NUMBER, II0_DOC_TOTAL_ITEMS, II0_DOC_TOTAL_ITEMS,
II0_STATUS, II0_REASON_CODE, II0_IS_LINKED, II0_LINKED_DOC_TYPE,
II0_LINKED_DOC_KEY, II0_LASTUPDATED_USER_ID,
II0_LASTUPDATED_USER_ROLE, II0_LASTUPDATED_USER_SMP,
CASE II0_STATUS WHEN 'DRAFT' THEN '2' ELSE II0_LOCK_ID END as II0_LOCK_ID,
II0_IS_PROGRAM_RELATED,
II0_PROGRAM_ID, II0_PROGRAM_MODE,
II0_CREATED_USER_ID,II0_CREATED_USER_ROLE,II0_CREATED_USER_SMP,
II0_IS_LINKED AS DOC_SOURCE, REQ.COM_DEP_ENGLISH_NAME
REQ_DEP_ENG,REQ.COM_DEP_ARABIC_NAME,ISSUE.COM_DEP_ENGLISH_NAME
ISSUE_DEP_ENG,
(SELECT CON_SEC_ENGLISH_NAME FROM VCON_SECTION WHERE VII0_ISSUE_ITEM_MAIN.II0_REQ_SECTION_ID = VCON_SECTION.CON_ID) REQ_SEC_ENG,
(SELECT COO_UNIT_ENGLISH_NAME FROM VCOO_UNIT WHERE VII0_ISSUE_ITEM_MAIN.II0_REQ_UNIT_ID = VCOO_UNIT.COO_ID) REQ_UNIT_ENG,
(SELECT AT0_USER_REMARKS FROM VAT0_AUDIT_TRAIL_MAIN WHERE
VAT0_AUDIT_TRAIL_MAIN.AT0_DOCUMENT_NUMBER = VII0_ISSUE_ITEM_MAIN.II0_DOC_NUMBER
ORDER BY AT0_TIME_STAMP DESC FETCH FIRST 1 ROWS ONLY) FEEDBACK
VII0_ISSUE_ITEM_MAIN,
VCOM_DEP REQ, VCOM_DEP ISSUE
($defaultWhereClause)
AND
VII0_ISSUE_ITEM_MAIN.II0_REQ_DEPARTMENT = REQ.COM_DEP_NUMBER AND
VII0_ISSUE_ITEM_MAIN.II0_ISSUE_DEPARTMENT = ISSUE.COM_DEP_NUMBER AND
VII0_ISSUE_ITEM_MAIN.II0_DOC_TYPE = 'CUII' AND
(( VII0_ISSUE_ITEM_MAIN.II0_MODE = 'D' AND
VII0_ISSUE_ITEM_MAIN.II0_LASTUPDATED_USER_ID=$session.user.name
and VII0_ISSUE_ITEM_MAIN.II0_LASTUPDATED_USER_ROLE =
$session.user.currentRole.name ) or
(
VII0_ISSUE_ITEM_MAIN.II0_MODE = '0' AND VII0_ISSUE_ITEM_MAIN.II0_ID NOT IN (SELECT
VII0_ISSUE_ITEM_MAIN.II0_ID FROM VII0_ISSUE_ITEM_MAIN a
WHERE a.II0_ID = VII0_ISSUE_ITEM_MAIN.II0_ID AND a.II0_MODE='D'
AND
a.II0_LASTUPDATED_USER_ID = $session.user.name AND
a.II0_LASTUPDATED_USER_ROLE =
$session.user.currentRole.name)))