First Party GSTIN Number:
SELECT 'GSTIN : '||b.registration_number
--INTO :cp_org_gst
FROM ja.jai_party_regs a, ja.jai_party_reg_lines b
WHERE org_id = :p_org_id
AND a.party_id= :P_INV_ORG_ID
AND a.party_reg_id = b.party_reg_id
AND a.reg_class_code = b.reg_class_code
AND a.reg_class_code = 'FIRST_PARTY'
AND a.party_class_name = 'Transaction Tax'
AND a.PARTY_TYPE_CODE='IO'
AND b.registration_type_name = 'GSTIN'
AND a.party_site_id IS NOT NULL
AND SYSDATE BETWEEN b.effective_from
AND NVL (b.effective_to, SYSDATE);
SELECT 'GSTIN : '||b.registration_number
--INTO :cp_org_gst
FROM ja.jai_party_regs a, ja.jai_party_reg_lines b
WHERE org_id = :p_org_id
AND a.party_id= :P_INV_ORG_ID
AND a.party_reg_id = b.party_reg_id
AND a.reg_class_code = b.reg_class_code
AND a.reg_class_code = 'FIRST_PARTY'
AND a.party_class_name = 'Transaction Tax'
AND a.PARTY_TYPE_CODE='IO'
AND b.registration_type_name = 'GSTIN'
AND a.party_site_id IS NOT NULL
AND SYSDATE BETWEEN b.effective_from
AND NVL (b.effective_to, SYSDATE);
Third Party Supplier GSTIN Number:
SELECT b.registration_number
FROM ja.jai_party_regs a, ja.jai_party_reg_lines b
WHERE a.org_id = :p_org_id
AND a.party_id = :p_vendor_id
AND a.party_site_id = :p_vendor_site_id
AND a.party_reg_id = b.party_reg_id
AND a.PARTY_TYPE_CODE = 'THIRD_PARTY_SITE'
AND NVL(a.SUPPLIER_FLAG,'N') = 'Y' AND NVL(SITE_FLAG,'N') = 'Y'
AND b.REGISTRATION_TYPE_CODE = 'GSTIN' --Depen on Setup
AND SYSDATE BETWEEN b.effective_from AND NVL (b.effective_to, SYSDATE)