Thursday, 19 April 2018

Query to Find HSN Code for Item



SELECT jra.reporting_code hsn_code
  FROM jai_reporting_associations jra, jai_regimes jr
 WHERE jra.entity_id =
          (SELECT jith.template_hdr_id
             FROM jai_item_templ_hdr jith
            WHERE jith.inventory_item_id = :p_item_id
              AND organization_id = :p_organization_id)
   AND jra.entity_code = 'ITEM'
   AND jra.reporting_type_name = 'HSN Code Type for GST'
   AND jra.regime_id = jr.regime_id
   AND jr.regime_name = 'INDIA GST'
   AND TRUNC (SYSDATE) BETWEEN jra.effective_from AND NVL (jra.effective_to, TRUNC (SYSDATE));

(or)

select b.reporting_code
from jai_item_templ_hdr_v a, jai_reporting_associations_v b
where b.entity_id=a.template_hdr_id
and b.effective_from is not null
and b.effective_to is null
and b.regime_code='IND GST'
and b.reporting_type_code='GST_HSN_CODE'
and a.item_code= <<item_code>>
and a.ORGANIZATION_ID= <<organization_id>>
and TRUNC (SYSDATE) BETWEEN b.effective_from AND NVL (b.effective_to, TRUNC (SYSDATE)); 

No comments:

Post a Comment