= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n s _ s a l e _ t a x _ i n v o i c e _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s i d ` . ` c o m p a n y _ i d `                                   A S   ` c o m p a n y _ i d ` , 
 
     ` s i d ` . ` c o m p a n y _ b r a n c h _ i d `                     A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s i d ` . ` f i s c a l _ y e a r _ i d `                           A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s i d ` . ` s a l e _ t a x _ i n v o i c e _ i d `                 A S   ` s a l e _ t a x _ i n v o i c e _ i d ` , 
 
     ` s i d ` . ` s a l e _ t a x _ i n v o i c e _ d e t a i l _ i d `   A S   ` s a l e _ t a x _ i n v o i c e _ d e t a i l _ i d ` , 
 
     ` s i d ` . ` s o r t _ o r d e r `                                   A S   ` s o r t _ o r d e r ` , 
 
     ` s i d ` . ` b a t c h _ n o `                                       A S   ` b a t c h _ n o ` , 
 
     ` s i d ` . ` w a r e h o u s e _ i d `                               A S   ` w a r e h o u s e _ i d ` , 
 
     ` s i d ` . ` p r o d u c t _ i d `                                   A S   ` p r o d u c t _ i d ` , 
 
     ` s i d ` . ` p r o d u c t _ c o d e `                               A S   ` p r o d u c t _ c o d e ` , 
 
     ` s i d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `               A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` s i d ` . ` d e s c r i p t i o n `                                 A S   ` d e s c r i p t i o n ` , 
 
     ` s i d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `             A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` s i d ` . ` e x p i r y _ d a t e `                                 A S   ` e x p i r y _ d a t e ` , 
 
     ` s i d ` . ` d o c u m r n t _ c u r e n c y _ i d `                 A S   ` d o c u m r n t _ c u r e n c y _ i d ` , 
 
     ` s i d ` . ` u n i t _ i d `                                         A S   ` u n i t _ i d ` , 
 
     ` s i d ` . ` q t y `                                                 A S   ` q t y ` , 
 
     ` s i d ` . ` r a t e `                                               A S   ` r a t e ` , 
 
     ` s i d ` . ` a m o u n t `                                           A S   ` a m o u n t ` , 
 
     ` s i d ` . ` d i s c o u n t _ p e r c e n t `                       A S   ` d i s c o u n t _ p e r c e n t ` , 
 
     ` s i d ` . ` d i s c o u n t _ a m o u n t `                         A S   ` d i s c o u n t _ a m o u n t ` , 
 
     ` s i d ` . ` g r o s s _ a m o u n t `                               A S   ` g r o s s _ a m o u n t ` , 
 
     ` s i d ` . ` o t h e r _ e x p e n c e `                             A S   ` o t h e r _ e x p e n c e ` , 
 
     ` s i d ` . ` t a x _ p e r c e n t `                                 A S   ` t a x _ p e r c e n t ` , 
 
     ` s i d ` . ` t a x _ a m o u n t `                                   A S   ` t a x _ a m o u n t ` , 
 
     ` s i d ` . ` t o t a l _ a m o u n t `                               A S   ` t o t a l _ a m o u n t ` , 
 
     ` s i d ` . ` b a s e _ c u r r e n c y _ i d `                       A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s i d ` . ` c o n v e r s i o n _ r a t e `                         A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s i d ` . ` b a s e _ t o t a l `                                   A S   ` b a s e _ t o t a l ` , 
 
     ` s i d ` . ` r e m a r k s `                                         A S   ` r e m a r k s ` , 
 
     ` s i d ` . ` c o g _ r a t e `                                       A S   ` c o g _ r a t e ` , 
 
     ` s i d ` . ` c o g _ a m o u n t `                                   A S   ` c o g _ a m o u n t ` , 
 
     ` s i d ` . ` c r e a t e d _ a t `                                   A S   ` c r e a t e d _ a t ` , 
 
     ` s i d ` . ` c r e a t e d _ b y _ i d `                             A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s i ` . ` d o c u m e n t _ t y p e _ i d `                         A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s i ` . ` d o c u m e n t _ i d e n t i t y `                       A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s i ` . ` d o c u m e n t _ d a t e `                               A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s i ` . ` i s _ p o s t `                                           A S   ` i s _ p o s t ` , 
 
     ` s i ` . ` p a r t n e r _ t y p e _ i d `                           A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` s i ` . ` p a r t n e r _ i d `                                     A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                     A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                                 A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                                   A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                                   A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                                 A S   ` w a r e h o u s e ` , 
 
     ` p r ` . ` n a m e `                                                 A S   ` p a r t n e r _ n a m e ` 
 
 F R O M   ( ( ( ( ( ( ` i n s _ s a l e _ t a x _ i n v o i c e _ d e t a i l `   ` s i d ` 
 
                 J O I N   ` i n s _ s a l e _ t a x _ i n v o i c e `   ` s i ` 
 
                     O N   ( ( ` s i ` . ` s a l e _ t a x _ i n v o i c e _ i d `   =   ` s i d ` . ` s a l e _ t a x _ i n v o i c e _ i d ` ) ) ) 
 
               L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                   O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s i d ` . ` c o m p a n y _ i d ` ) 
 
                             A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` s i d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
                 O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
               O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s i d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` u ` . ` u n i t _ i d `   =   ` s i d ` . ` u n i t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
             O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` s i d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` s i d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                       A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` s i d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` c o r e _ p a r t n e r `   ` p r ` 
 
           O N   ( ( ( ` p r ` . ` c o m p a n y _ i d `   =   ` s i ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` p r ` . ` p a r t n e r _ t y p e _ i d `   =   ` s i ` . ` p a r t n e r _ t y p e _ i d ` ) 
 
                     A N D   ( ` p r ` . ` p a r t n e r _ i d `   =   ` s i ` . ` p a r t n e r _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n s _ s a l e _ i n v o i c e _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s i d ` . ` c o m p a n y _ i d `                           A S   ` c o m p a n y _ i d ` , 
 
     ` s i d ` . ` c o m p a n y _ b r a n c h _ i d `             A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s i d ` . ` f i s c a l _ y e a r _ i d `                   A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s i d ` . ` s a l e _ i n v o i c e _ i d `                 A S   ` s a l e _ i n v o i c e _ i d ` , 
 
     ` s i d ` . ` s a l e _ i n v o i c e _ d e t a i l _ i d `   A S   ` s a l e _ i n v o i c e _ d e t a i l _ i d ` , 
 
     ` s i d ` . ` s o r t _ o r d e r `                           A S   ` s o r t _ o r d e r ` , 
 
     ` s i d ` . ` b a t c h _ n o `                               A S   ` b a t c h _ n o ` , 
 
     ` s i d ` . ` w a r e h o u s e _ i d `                       A S   ` w a r e h o u s e _ i d ` , 
 
     ` s i d ` . ` p r o d u c t _ i d `                           A S   ` p r o d u c t _ i d ` , 
 
     ` s i d ` . ` p r o d u c t _ c o d e `                       A S   ` p r o d u c t _ c o d e ` , 
 
     ` s i d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `       A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` s i d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `     A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` s i d ` . ` d e s c r i p t i o n `                         A S   ` d e s c r i p t i o n ` , 
 
     ` s i d ` . ` e x p i r y _ d a t e `                         A S   ` e x p i r y _ d a t e ` , 
 
     ` s i d ` . ` d o c u m r n t _ c u r e n c y _ i d `         A S   ` d o c u m r n t _ c u r e n c y _ i d ` , 
 
     ` s i d ` . ` u n i t _ i d `                                 A S   ` u n i t _ i d ` , 
 
     ` s i d ` . ` q t y `                                         A S   ` q t y ` , 
 
     ` s i d ` . ` r a t e `                                       A S   ` r a t e ` , 
 
     ` s i d ` . ` a m o u n t `                                   A S   ` a m o u n t ` , 
 
     ` s i d ` . ` d i s c o u n t _ p e r c e n t `               A S   ` d i s c o u n t _ p e r c e n t ` , 
 
     ` s i d ` . ` d i s c o u n t _ a m o u n t `                 A S   ` d i s c o u n t _ a m o u n t ` , 
 
     ` s i d ` . ` g r o s s _ a m o u n t `                       A S   ` g r o s s _ a m o u n t ` , 
 
     ` s i d ` . ` o t h e r _ e x p e n c e `                     A S   ` o t h e r _ e x p e n c e ` , 
 
     ` s i d ` . ` t a x _ p e r c e n t `                         A S   ` t a x _ p e r c e n t ` , 
 
     ` s i d ` . ` t a x _ a m o u n t `                           A S   ` t a x _ a m o u n t ` , 
 
     ` s i d ` . ` t o t a l _ a m o u n t `                       A S   ` t o t a l _ a m o u n t ` , 
 
     ` s i d ` . ` b a s e _ c u r r e n c y _ i d `               A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s i d ` . ` c o n v e r s i o n _ r a t e `                 A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s i d ` . ` b a s e _ t o t a l `                           A S   ` b a s e _ t o t a l ` , 
 
     ` s i d ` . ` r e m a r k s `                                 A S   ` r e m a r k s ` , 
 
     ` s i d ` . ` c o g _ r a t e `                               A S   ` c o g _ r a t e ` , 
 
     ` s i d ` . ` c o g _ a m o u n t `                           A S   ` c o g _ a m o u n t ` , 
 
     ` s i d ` . ` c r e a t e d _ a t `                           A S   ` c r e a t e d _ a t ` , 
 
     ` s i d ` . ` c r e a t e d _ b y _ i d `                     A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s i ` . ` d o c u m e n t _ t y p e _ i d `                 A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s i ` . ` d o c u m e n t _ i d e n t i t y `               A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s i ` . ` d o c u m e n t _ d a t e `                       A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s i ` . ` i s _ p o s t `                                   A S   ` i s _ p o s t ` , 
 
     ` s i ` . ` p a r t n e r _ t y p e _ i d `                   A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` s i ` . ` p a r t n e r _ i d `                             A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `             A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                         A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                           A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                           A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                         A S   ` w a r e h o u s e ` , 
 
     ` p r ` . ` n a m e `                                         A S   ` p a r t n e r _ n a m e ` 
 
 F R O M   ( ( ( ( ( ( ` i n s _ s a l e _ i n v o i c e _ d e t a i l `   ` s i d ` 
 
                 J O I N   ` i n s _ s a l e _ i n v o i c e `   ` s i ` 
 
                     O N   ( ( ` s i ` . ` s a l e _ i n v o i c e _ i d `   =   ` s i d ` . ` s a l e _ i n v o i c e _ i d ` ) ) ) 
 
               L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                   O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s i d ` . ` c o m p a n y _ i d ` ) 
 
                             A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` s i d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
                 O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
               O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s i d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` u ` . ` u n i t _ i d `   =   ` s i d ` . ` u n i t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
             O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` s i d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` s i d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                       A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` s i d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` c o r e _ p a r t n e r `   ` p r ` 
 
           O N   ( ( ( ` p r ` . ` c o m p a n y _ i d `   =   ` s i ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` p r ` . ` p a r t n e r _ t y p e _ i d `   =   ` s i ` . ` p a r t n e r _ t y p e _ i d ` ) 
 
                     A N D   ( ` p r ` . ` p a r t n e r _ i d `   =   ` s i ` . ` p a r t n e r _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n s _ s a l e _ o r d e r _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s o d ` . ` c o m p a n y _ i d `                         A S   ` c o m p a n y _ i d ` , 
 
     ` s o d ` . ` c o m p a n y _ b r a n c h _ i d `           A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s o d ` . ` f i s c a l _ y e a r _ i d `                 A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s o d ` . ` s a l e _ o r d e r _ i d `                   A S   ` s a l e _ o r d e r _ i d ` , 
 
     ` s o d ` . ` s a l e _ o r d e r _ d e t a i l _ i d `     A S   ` s a l e _ o r d e r _ d e t a i l _ i d ` , 
 
     ` s o d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `     A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` s o d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `   A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` s o d ` . ` s o r t _ o r d e r `                         A S   ` s o r t _ o r d e r ` , 
 
     ` s o d ` . ` p r o d u c t _ i d `                         A S   ` p r o d u c t _ i d ` , 
 
     ` s o d ` . ` p r o d u c t _ c o d e `                     A S   ` p r o d u c t _ c o d e ` , 
 
     ` s o d ` . ` p r o d u c t _ s e r v i c e `               A S   ` p r o d u c t _ s e r v i c e ` , 
 
     ` s o d ` . ` e x p i r y _ d a t e `                       A S   ` e x p i r y _ d a t e ` , 
 
     ` s o d ` . ` d o c u m e n t _ c u r r e n c y _ i d `     A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` s o d ` . ` u n i t _ i d `                               A S   ` u n i t _ i d ` , 
 
     ` s o d ` . ` q t y `                                       A S   ` q t y ` , 
 
     ` s o d ` . ` c o n v e r s i o n _ r a t e `               A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s o d ` . ` b a s e _ a m o u n t `                       A S   ` b a s e _ a m o u n t ` , 
 
     ` s o d ` . ` r a t e `                                     A S   ` r a t e ` , 
 
     ` s o d ` . ` a m o u n t `                                 A S   ` a m o u n t ` , 
 
     ` s o d ` . ` t a x _ p e r c e n t `                       A S   ` t a x _ p e r c e n t ` , 
 
     ` s o d ` . ` t a x _ a m o u n t `                         A S   ` t a x _ a m o u n t ` , 
 
     ` s o d ` . ` n e t _ a m o u n t `                         A S   ` n e t _ a m o u n t ` , 
 
     ` s o d ` . ` b a s e _ n e t _ a m o u n t `               A S   ` b a s e _ n e t _ a m o u n t ` , 
 
     ` s o d ` . ` b a s e _ c u r r e n c y _ i d `             A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s o d ` . ` c r e a t e d _ a t `                         A S   ` c r e a t e d _ a t ` , 
 
     ` s o d ` . ` c r e a t e d _ b y _ i d `                   A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s o d ` . ` d e s c r i p t i o n `                       A S   ` d e s c r i p t i o n ` , 
 
     ` s o ` . ` d o c u m e n t _ t y p e _ i d `               A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s o ` . ` d o c u m e n t _ i d e n t i t y `             A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s o ` . ` d o c u m e n t _ d a t e `                     A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s o ` . ` i s _ p o s t `                                 A S   ` i s _ p o s t ` , 
 
     ` s o ` . ` p a r t n e r _ t y p e _ i d `                 A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` s o ` . ` p a r t n e r _ i d `                           A S   ` p a r t n e r _ i d ` , 
 
     ` s o ` . ` s a l e s m a n _ i d `                         A S   ` s a l e s m a n _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `           A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                       A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                         A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                         A S   ` u n i t ` , 
 
     ` c s ` . ` n a m e `                                       A S   ` s a l e s m a n _ n a m e ` 
 
 F R O M   ( ( ( ( ( ` i n s _ s a l e _ o r d e r _ d e t a i l `   ` s o d ` 
 
               J O I N   ` i n s _ s a l e _ o r d e r `   ` s o ` 
 
                   O N   ( ( ` s o ` . ` s a l e _ o r d e r _ i d `   =   ` s o d ` . ` s a l e _ o r d e r _ i d ` ) ) ) 
 
             L E F T   J O I N   ` c o r e _ s a l e s m a n `   ` c s ` 
 
                 O N   ( ( ` c s ` . ` s a l e s m a n _ i d `   =   ` s o ` . ` s a l e s m a n _ i d ` ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
               O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s o d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` s o d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
             O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
           O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s o d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` u ` . ` u n i t _ i d `   =   ` s o d ` . ` u n i t _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n s _ q u o t a t i o n _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` d c d ` . ` q u o t a t i o n _ d e t a i l _ i d `   A S   ` q u o t a t i o n _ d e t a i l _ i d ` , 
 
     ` d c d ` . ` c o m p a n y _ i d `                     A S   ` c o m p a n y _ i d ` , 
 
     ` d c d ` . ` c o m p a n y _ b r a n c h _ i d `       A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` d c d ` . ` f i s c a l _ y e a r _ i d `             A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` d c d ` . ` q u o t a t i o n _ i d `                 A S   ` q u o t a t i o n _ i d ` , 
 
     ` d c d ` . ` p r o d u c t _ i d `                     A S   ` p r o d u c t _ i d ` , 
 
     ` d c d ` . ` p r o d u c t _ c o d e `                 A S   ` p r o d u c t _ c o d e ` , 
 
     ` d c d ` . ` d e s c r i p t i o n `                   A S   ` d e s c r i p t i o n ` , 
 
     ` d c d ` . ` d e l i v e r y `                         A S   ` d e l i v e r y ` , 
 
     ` d c d ` . ` u n i t _ i d `                           A S   ` u n i t _ i d ` , 
 
     ` d c d ` . ` w a r e h o u s e _ i d `                 A S   ` w a r e h o u s e _ i d ` , 
 
     ` d c d ` . ` q t y `                                   A S   ` q t y ` , 
 
     ` d c d ` . ` r a t e `                                 A S   ` r a t e ` , 
 
     ` d c d ` . ` a m o u n t `                             A S   ` a m o u n t ` , 
 
     ` d c d ` . ` t a x _ p e r c e n t `                   A S   ` t a x _ p e r c e n t ` , 
 
     ` d c d ` . ` t a x _ a m o u n t `                     A S   ` t a x _ a m o u n t ` , 
 
     ` d c d ` . ` n e t _ a m o u n t `                     A S   ` n e t _ a m o u n t ` , 
 
     ` d c d ` . ` c r e a t e d _ b y _ i d `               A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` d c d ` . ` c r e a t e d _ a t `                     A S   ` c r e a t e d _ a t ` , 
 
     ` d c d ` . ` s o r t _ o r d e r `                     A S   ` s o r t _ o r d e r ` , 
 
     ` d c ` . ` d o c u m e n t _ t y p e _ i d `           A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` d c ` . ` d o c u m e n t _ i d e n t i t y `         A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` d c ` . ` d o c u m e n t _ d a t e `                 A S   ` d o c u m e n t _ d a t e ` , 
 
     ` d c ` . ` i s _ p o s t `                             A S   ` i s _ p o s t ` , 
 
     ` d c ` . ` p a r t n e r _ t y p e _ i d `             A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` d c ` . ` p a r t n e r _ i d `                       A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `       A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                   A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                     A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                     A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                   A S   ` w a r e h o u s e ` 
 
 F R O M   ( ( ( ( ( ` i n s _ q u o t a t i o n _ d e t a i l `   ` d c d ` 
 
               J O I N   ` i n s _ q u o t a t i o n `   ` d c ` 
 
                   O N   ( ( ` d c ` . ` q u o t a t i o n _ i d `   =   ` d c d ` . ` q u o t a t i o n _ i d ` ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                 O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` d c d ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` d c d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
               O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
             O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` d c d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` u ` . ` u n i t _ i d `   =   ` d c d ` . ` u n i t _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
           O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` d c d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` d c d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                     A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` d c d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n s _ s a l e _ r e t u r n _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s r d ` . ` c o m p a n y _ i d `                         A S   ` c o m p a n y _ i d ` , 
 
     ` s r d ` . ` c o m p a n y _ b r a n c h _ i d `           A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s r d ` . ` f i s c a l _ y e a r _ i d `                 A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s r d ` . ` s a l e _ r e t u r n _ i d `                 A S   ` s a l e _ r e t u r n _ i d ` , 
 
     ` s r d ` . ` s a l e _ r e t u r n _ d e t a i l _ i d `   A S   ` s a l e _ r e t u r n _ d e t a i l _ i d ` , 
 
     ` s r d ` . ` s o r t _ o r d e r `                         A S   ` s o r t _ o r d e r ` , 
 
     ` s r d ` . ` b a t c h _ n o `                             A S   ` b a t c h _ n o ` , 
 
     ` s r d ` . ` w a r e h o u s e _ i d `                     A S   ` w a r e h o u s e _ i d ` , 
 
     ` s r d ` . ` p r o d u c t _ i d `                         A S   ` p r o d u c t _ i d ` , 
 
     ` s r d ` . ` p r o d u c t _ c o d e `                     A S   ` p r o d u c t _ c o d e ` , 
 
     ` s r d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `     A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` s r d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `   A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` s r d ` . ` e x p i r y _ d a t e `                       A S   ` e x p i r y _ d a t e ` , 
 
     ` s r d ` . ` d o c u m r n t _ c u r e n c y _ i d `       A S   ` d o c u m r n t _ c u r e n c y _ i d ` , 
 
     ` s r d ` . ` u n i t _ i d `                               A S   ` u n i t _ i d ` , 
 
     ` s r d ` . ` q t y `                                       A S   ` q t y ` , 
 
     ` s r d ` . ` r a t e `                                     A S   ` r a t e ` , 
 
     ` s r d ` . ` a m o u n t `                                 A S   ` a m o u n t ` , 
 
     ` s r d ` . ` d i s c o u n t _ p e r c e n t `             A S   ` d i s c o u n t _ p e r c e n t ` , 
 
     ` s r d ` . ` d i s c o u n t _ a m o u n t `               A S   ` d i s c o u n t _ a m o u n t ` , 
 
     ` s r d ` . ` g r o s s _ a m o u n t `                     A S   ` g r o s s _ a m o u n t ` , 
 
     ` s r d ` . ` o t h e r _ e x p e n c e `                   A S   ` o t h e r _ e x p e n c e ` , 
 
     ` s r d ` . ` t a x _ p e r c e n t `                       A S   ` t a x _ p e r c e n t ` , 
 
     ` s r d ` . ` t a x _ a m o u n t `                         A S   ` t a x _ a m o u n t ` , 
 
     ` s r d ` . ` t o t a l _ a m o u n t `                     A S   ` t o t a l _ a m o u n t ` , 
 
     ` s r d ` . ` b a s e _ c u r r e n c y _ i d `             A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s r d ` . ` c o n v e r s i o n _ r a t e `               A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s r d ` . ` b a s e _ t o t a l `                         A S   ` b a s e _ t o t a l ` , 
 
     ` s r d ` . ` r e m a r k s `                               A S   ` r e m a r k s ` , 
 
     ` s r d ` . ` c o g _ r a t e `                             A S   ` c o g _ r a t e ` , 
 
     ` s r d ` . ` c o g _ a m o u n t `                         A S   ` c o g _ a m o u n t ` , 
 
     ` s r d ` . ` c r e a t e d _ a t `                         A S   ` c r e a t e d _ a t ` , 
 
     ` s r d ` . ` c r e a t e d _ b y _ i d `                   A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s r ` . ` d o c u m e n t _ t y p e _ i d `               A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s r ` . ` d o c u m e n t _ i d e n t i t y `             A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s r ` . ` d o c u m e n t _ d a t e `                     A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s r ` . ` i s _ p o s t `                                 A S   ` i s _ p o s t ` , 
 
     ` s r ` . ` p a r t n e r _ t y p e _ i d `                 A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` s r ` . ` p a r t n e r _ i d `                           A S   ` p a r t n e r _ i d ` , 
 
     ` c p ` . ` n a m e `                                       A S   ` p a r t n e r _ n a m e ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `           A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                       A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                         A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                         A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                       A S   ` w a r e h o u s e ` 
 
 F R O M   ( ( ( ( ( ( ` i n s _ s a l e _ r e t u r n _ d e t a i l `   ` s r d ` 
 
                 J O I N   ` i n s _ s a l e _ r e t u r n `   ` s r ` 
 
                     O N   ( ( ` s r ` . ` s a l e _ r e t u r n _ i d `   =   ` s r d ` . ` s a l e _ r e t u r n _ i d ` ) ) ) 
 
               L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                   O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s r d ` . ` c o m p a n y _ i d ` ) 
 
                             A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` s r d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
                 O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
               O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s r d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` u ` . ` u n i t _ i d `   =   ` s r d ` . ` u n i t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
             O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` s r d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` s r d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                       A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` s r d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` c o r e _ p a r t n e r `   ` c p ` 
 
           O N   ( ( ( ` c p ` . ` c o m p a n y _ i d `   =   ` s r d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` c p ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` s r d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                     A N D   ( ` c p ` . ` p a r t n e r _ i d `   =   ` s r ` . ` p a r t n e r _ i d ` ) 
 
                     A N D   ( ` c p ` . ` p a r t n e r _ t y p e _ i d `   =   ` s r ` . ` p a r t n e r _ t y p e _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n p _ p u r c h a s e _ i n v o i c e _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e l e c t 
 
     ` p i d ` . ` c o m p a n y _ i d `                                   A S   ` c o m p a n y _ i d ` , 
 
     ` p i d ` . ` c o m p a n y _ b r a n c h _ i d `                     A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` p i d ` . ` f i s c a l _ y e a r _ i d `                           A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` p i d ` . ` p u r c h a s e _ i n v o i c e _ i d `                 A S   ` p u r c h a s e _ i n v o i c e _ i d ` , 
 
     ` p i d ` . ` p u r c h a s e _ i n v o i c e _ d e t a i l _ i d `   A S   ` p u r c h a s e _ i n v o i c e _ d e t a i l _ i d ` , 
 
     ` p i d ` . ` s o r t _ o r d e r `                                   A S   ` s o r t _ o r d e r ` , 
 
     ` p i d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `               A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` p i d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `             A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` p i d ` . ` p r o d u c t _ i d `                                   A S   ` p r o d u c t _ i d ` , 
 
     ` p i d ` . ` p r o d u c t _ c o d e `                               A S   ` p r o d u c t _ c o d e ` , 
 
     ` p i d ` . ` w a r e h o u s e _ i d `                               A S   ` w a r e h o u s e _ i d ` , 
 
     ` p i d ` . ` r e m a r k s `                                         A S   ` r e m a r k s ` , 
 
     ` p i d ` . ` d o c u m e n t _ c u r r e n c y _ i d `               A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` p i d ` . ` u n i t _ i d `                                         A S   ` u n i t _ i d ` , 
 
     ` p i d ` . ` q t y `                                                 A S   ` q t y ` , 
 
     ` p i d ` . ` r a t e `                                               A S   ` r a t e ` , 
 
     ` p i d ` . ` a m o u n t `                                           A S   ` a m o u n t ` , 
 
     ` p i d ` . ` d i s c o u n t _ p e r c e n t `                       A S   ` d i s c o u n t _ p e r c e n t ` , 
 
     ` p i d ` . ` d i s c o u n t _ a m o u n t `                         A S   ` d i s c o u n t _ a m o u n t ` , 
 
     ` p i d ` . ` g r o s s _ a m o u n t `                               A S   ` g r o s s _ a m o u n t ` , 
 
     ` p i d ` . ` o t h e r _ e x p e n c e `                             A S   ` o t h e r _ e x p e n c e ` , 
 
     ` p i d ` . ` t a x _ p e r c e n t `                                 A S   ` t a x _ p e r c e n t ` , 
 
     ` p i d ` . ` t a x _ a m o u n t `                                   A S   ` t a x _ a m o u n t ` , 
 
     ` p i d ` . ` t o t a l _ a m o u n t `                               A S   ` t o t a l _ a m o u n t ` , 
 
     ` p i d ` . ` b a s e _ c u r r e n c y _ i d `                       A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` p i d ` . ` c o n v e r s i o n _ r a t e `                         A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` p i d ` . ` b a s e _ t o t a l `                                   A S   ` b a s e _ t o t a l ` , 
 
     ` p i d ` . ` c r e a t e d _ a t `                                   A S   ` c r e a t e d _ a t ` , 
 
     ` p i d ` . ` c r e a t e d _ b y _ i d `                             A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` p i ` . ` d o c u m e n t _ t y p e _ i d `                         A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` p i ` . ` d o c u m e n t _ i d e n t i t y `                       A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` p i ` . ` d o c u m e n t _ d a t e `                               A S   ` d o c u m e n t _ d a t e ` , 
 
     ` p i ` . ` i s _ p o s t `                                           A S   ` i s _ p o s t ` , 
 
     ` p i ` . ` p a r t n e r _ t y p e _ i d `                           A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` p i ` . ` p a r t n e r _ i d `                                     A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                     A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                                 A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                                   A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                                   A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                                 A S   ` w a r e h o u s e ` 
 
 f r o m   ( ( ( ( ( ` i n p _ p u r c h a s e _ i n v o i c e _ d e t a i l `   ` p i d ` 
 
               j o i n   ` i n p _ p u r c h a s e _ i n v o i c e `   ` p i ` 
 
                   o n   ( ( ` p i ` . ` p u r c h a s e _ i n v o i c e _ i d `   =   ` p i d ` . ` p u r c h a s e _ i n v o i c e _ i d ` ) ) ) 
 
             l e f t   j o i n   ` i n 0 _ p r o d u c t `   ` p ` 
 
                 o n   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` p i d ` . ` c o m p a n y _ i d ` ) 
 
                           a n d   ( ` p ` . ` p r o d u c t _ i d `   =   ` p i d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
           l e f t   j o i n   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
               o n   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                         a n d   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
         l e f t   j o i n   ` i n 0 _ u n i t `   ` u ` 
 
             o n   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` p i d ` . ` c o m p a n y _ i d ` ) 
 
                       a n d   ( ` u ` . ` u n i t _ i d `   =   ` p i d ` . ` u n i t _ i d ` ) ) ) ) 
 
       l e f t   j o i n   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
           o n   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` p i d ` . ` c o m p a n y _ i d ` ) 
 
                     a n d   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` p i d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                     a n d   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` p i d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n p _ g o o d s _ r e c e i v e d _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` g r d ` . ` g o o d s _ r e c e i v e d _ d e t a i l _ i d `   A S   ` g o o d s _ r e c e i v e d _ d e t a i l _ i d ` , 
 
     ` g r d ` . ` c o m p a n y _ i d `                               A S   ` c o m p a n y _ i d ` , 
 
     ` g r d ` . ` c o m p a n y _ b r a n c h _ i d `                 A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` g r d ` . ` f i s c a l _ y e a r _ i d `                       A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` g r d ` . ` g o o d s _ r e c e i v e d _ i d `                 A S   ` g o o d s _ r e c e i v e d _ i d ` , 
 
     ` g r d ` . ` r e f _ d o c u m e n t _ i d `                     A S   ` r e f _ d o c u m e n t _ i d ` , 
 
     ` g r d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `         A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` g r d ` . ` s o r t _ o r d e r `                               A S   ` s o r t _ o r d e r ` , 
 
     ` g r d ` . ` p r o d u c t _ c o d e `                           A S   ` p r o d u c t _ c o d e ` , 
 
     ` g r d ` . ` p r o d u c t _ i d `                               A S   ` p r o d u c t _ i d ` , 
 
     ` g r d ` . ` u n i t _ i d `                                     A S   ` u n i t _ i d ` , 
 
     ` g r d ` . ` w a r e h o u s e _ i d `                           A S   ` w a r e h o u s e _ i d ` , 
 
     ` g r d ` . ` q t y `                                             A S   ` q t y ` , 
 
     ` g r d ` . ` r a t e `                                           A S   ` r a t e ` , 
 
     ` g r d ` . ` a m o u n t `                                       A S   ` a m o u n t ` , 
 
     ` g r d ` . ` c r e a t e d _ a t `                               A S   ` c r e a t e d _ a t ` , 
 
     ` g r d ` . ` c r e a t e d _ b y _ i d `                         A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` g r ` . ` d o c u m e n t _ t y p e _ i d `                     A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` g r ` . ` d o c u m e n t _ i d e n t i t y `                   A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` g r ` . ` d o c u m e n t _ d a t e `                           A S   ` d o c u m e n t _ d a t e ` , 
 
     ` g r ` . ` i s _ p o s t `                                       A S   ` i s _ p o s t ` , 
 
     ` g r ` . ` p a r t n e r _ t y p e _ i d `                       A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` g r ` . ` p a r t n e r _ i d `                                 A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                 A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                             A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                               A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                               A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                             A S   ` w a r e h o u s e ` 
 
 F R O M   ( ( ( ( ( ` i n p _ g o o d s _ r e c e i v e d _ d e t a i l `   ` g r d ` 
 
               J O I N   ` i n p _ g o o d s _ r e c e i v e d `   ` g r ` 
 
                   O N   ( ( ` g r ` . ` g o o d s _ r e c e i v e d _ i d `   =   ` g r d ` . ` g o o d s _ r e c e i v e d _ i d ` ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                 O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` g r d ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` g r d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
               O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
             O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` g r d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` u ` . ` u n i t _ i d `   =   ` g r d ` . ` u n i t _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
           O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` g r d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` g r d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                     A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` g r d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n p _ p u r c h a s e _ o r d e r _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` p o d ` . ` c o m p a n y _ i d `                               A S   ` c o m p a n y _ i d ` , 
 
     ` p o d ` . ` c o m p a n y _ b r a n c h _ i d `                 A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` p o d ` . ` f i s c a l _ y e a r _ i d `                       A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` p o d ` . ` p u r c h a s e _ o r d e r _ i d `                 A S   ` p u r c h a s e _ o r d e r _ i d ` , 
 
     ` p o d ` . ` p u r c h a s e _ o r d e r _ d e t a i l _ i d `   A S   ` p u r c h a s e _ o r d e r _ d e t a i l _ i d ` , 
 
     ` p o d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `           A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` p o d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `         A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` p o d ` . ` s o r t _ o r d e r `                               A S   ` s o r t _ o r d e r ` , 
 
     ` p o d ` . ` p r o d u c t _ i d `                               A S   ` p r o d u c t _ i d ` , 
 
     ` p o d ` . ` p r o d u c t _ c o d e `                           A S   ` p r o d u c t _ c o d e ` , 
 
     ` p o d ` . ` p r o d u c t _ s e r v i c e `                     A S   ` p r o d u c t _ s e r v i c e ` , 
 
     ` p o d ` . ` e x p i r y _ d a t e `                             A S   ` e x p i r y _ d a t e ` , 
 
     ` p o d ` . ` d o c u m e n t _ c u r r e n c y _ i d `           A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` p o d ` . ` u n i t _ i d `                                     A S   ` u n i t _ i d ` , 
 
     ` p o d ` . ` q t y `                                             A S   ` q t y ` , 
 
     ` p o d ` . ` c o n v e r s i o n _ r a t e `                     A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` p o d ` . ` b a s e _ a m o u n t `                             A S   ` b a s e _ a m o u n t ` , 
 
     ` p o d ` . ` r a t e `                                           A S   ` r a t e ` , 
 
     ` p o d ` . ` a m o u n t `                                       A S   ` a m o u n t ` , 
 
     ` p o d ` . ` b a s e _ c u r r e n c y _ i d `                   A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` p o d ` . ` c r e a t e d _ a t `                               A S   ` c r e a t e d _ a t ` , 
 
     ` p o d ` . ` c r e a t e d _ b y _ i d `                         A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` p o ` . ` d o c u m e n t _ t y p e _ i d `                     A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` p o ` . ` d o c u m e n t _ i d e n t i t y `                   A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` p o ` . ` d o c u m e n t _ d a t e `                           A S   ` d o c u m e n t _ d a t e ` , 
 
     ` p o ` . ` i s _ p o s t `                                       A S   ` i s _ p o s t ` , 
 
     ` p o ` . ` p a r t n e r _ t y p e _ i d `                       A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` p o ` . ` p a r t n e r _ i d `                                 A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                 A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                             A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                               A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                               A S   ` u n i t ` 
 
 F R O M   ( ( ( ( ` i n p _ p u r c h a s e _ o r d e r _ d e t a i l `   ` p o d ` 
 
             J O I N   ` i n p _ p u r c h a s e _ o r d e r `   ` p o ` 
 
                 O N   ( ( ` p o ` . ` p u r c h a s e _ o r d e r _ i d `   =   ` p o d ` . ` p u r c h a s e _ o r d e r _ i d ` ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
               O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` p o d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` p o d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
             O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
           O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` p o d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` u ` . ` u n i t _ i d `   =   ` p o d ` . ` u n i t _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n p _ p u r c h a s e _ r e t u r n _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` p r d ` . ` c o m p a n y _ i d `                                 A S   ` c o m p a n y _ i d ` , 
 
     ` p r d ` . ` c o m p a n y _ b r a n c h _ i d `                   A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` p r d ` . ` f i s c a l _ y e a r _ i d `                         A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` p r d ` . ` p u r c h a s e _ r e t u r n _ i d `                 A S   ` p u r c h a s e _ r e t u r n _ i d ` , 
 
     ` p r d ` . ` p u r c h a s e _ r e t u r n _ d e t a i l _ i d `   A S   ` p u r c h a s e _ r e t u r n _ d e t a i l _ i d ` , 
 
     ` p r d ` . ` s o r t _ o r d e r `                                 A S   ` s o r t _ o r d e r ` , 
 
     ` p r d ` . ` r e f _ d o c u m e n t _ t y p e _ i d `             A S   ` r e f _ d o c u m e n t _ t y p e _ i d ` , 
 
     ` p r d ` . ` r e f _ d o c u m e n t _ i d e n t i t y `           A S   ` r e f _ d o c u m e n t _ i d e n t i t y ` , 
 
     ` p r d ` . ` p r o d u c t _ i d `                                 A S   ` p r o d u c t _ i d ` , 
 
     ` p r d ` . ` p r o d u c t _ c o d e `                             A S   ` p r o d u c t _ c o d e ` , 
 
     ` p r d ` . ` w a r e h o u s e _ i d `                             A S   ` w a r e h o u s e _ i d ` , 
 
     ` p r d ` . ` d o c u m e n t _ c u r r e n c y _ i d `             A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` p r d ` . ` u n i t _ i d `                                       A S   ` u n i t _ i d ` , 
 
     ` p r d ` . ` p u r c h a s e _ q t y `                             A S   ` p u r c h a s e _ q t y ` , 
 
     ` p r d ` . ` q t y `                                               A S   ` q t y ` , 
 
     ` p r d ` . ` r a t e `                                             A S   ` r a t e ` , 
 
     ` p r d ` . ` a m o u n t `                                         A S   ` a m o u n t ` , 
 
     ` p r d ` . ` d i s c o u n t _ p e r c e n t `                     A S   ` d i s c o u n t _ p e r c e n t ` , 
 
     ` p r d ` . ` d i s c o u n t _ a m o u n t `                       A S   ` d i s c o u n t _ a m o u n t ` , 
 
     ` p r d ` . ` g r o s s _ a m o u n t `                             A S   ` g r o s s _ a m o u n t ` , 
 
     ` p r d ` . ` o t h e r _ e x p e n c e `                           A S   ` o t h e r _ e x p e n c e ` , 
 
     ` p r d ` . ` t a x _ p e r c e n t `                               A S   ` t a x _ p e r c e n t ` , 
 
     ` p r d ` . ` t a x _ a m o u n t `                                 A S   ` t a x _ a m o u n t ` , 
 
     ` p r d ` . ` t o t a l _ a m o u n t `                             A S   ` t o t a l _ a m o u n t ` , 
 
     ` p r d ` . ` b a s e _ c u r r e n c y _ i d `                     A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` p r d ` . ` c o n v e r s i o n _ r a t e `                       A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` p r d ` . ` b a s e _ t o t a l `                                 A S   ` b a s e _ t o t a l ` , 
 
     ` p r d ` . ` c r e a t e d _ a t `                                 A S   ` c r e a t e d _ a t ` , 
 
     ` p r d ` . ` c r e a t e d _ b y _ i d `                           A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` p r ` . ` d o c u m e n t _ t y p e _ i d `                       A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` p r ` . ` d o c u m e n t _ i d e n t i t y `                     A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` p r ` . ` d o c u m e n t _ d a t e `                             A S   ` d o c u m e n t _ d a t e ` , 
 
     ` p r ` . ` i s _ p o s t `                                         A S   ` i s _ p o s t ` , 
 
     ` p r ` . ` p a r t n e r _ t y p e _ i d `                         A S   ` p a r t n e r _ t y p e _ i d ` , 
 
     ` p r ` . ` p a r t n e r _ i d `                                   A S   ` p a r t n e r _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                   A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                               A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                                 A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                                 A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                               A S   ` w a r e h o u s e ` 
 
 F R O M   ( ( ( ( ( ` i n p _ p u r c h a s e _ r e t u r n _ d e t a i l `   ` p r d ` 
 
               J O I N   ` i n p _ p u r c h a s e _ r e t u r n `   ` p r ` 
 
                   O N   ( ( ` p r ` . ` p u r c h a s e _ r e t u r n _ i d `   =   ` p r d ` . ` p u r c h a s e _ r e t u r n _ i d ` ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                 O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` p r d ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` p r d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
               O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
             O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` p r d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` u ` . ` u n i t _ i d `   =   ` p r d ` . ` u n i t _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
           O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` p r d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` p r d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                     A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` p r d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n a _ s t o c k _ t r a n s f e r _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 s e l e c t 
 
     ` s t d ` . ` c o m p a n y _ i d `                               A S   ` c o m p a n y _ i d ` , 
 
     ` s t d ` . ` c o m p a n y _ b r a n c h _ i d `                 A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s t d ` . ` f i s c a l _ y e a r _ i d `                       A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s t d ` . ` s t o c k _ t r a n s f e r _ i d `                 A S   ` s t o c k _ t r a n s f e r _ i d ` , 
 
     ` s t d ` . ` s t o c k _ t r a n s f e r _ d e t a i l _ i d `   A S   ` s t o c k _ t r a n s f e r _ d e t a i l _ i d ` , 
 
     ` s t d ` . ` s o r t _ o r d e r `                               A S   ` s o r t _ o r d e r ` , 
 
     ` s t d ` . ` p r o d u c t _ i d `                               A S   ` p r o d u c t _ i d ` , 
 
     ` s t d ` . ` p r o d u c t _ c o d e `                           A S   ` p r o d u c t _ c o d e ` , 
 
     ` s t d ` . ` t o _ c o m p a n y _ b r a n c h _ i d `           A S   ` t o _ c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s t d ` . ` w a r e h o u s e _ i d `                           A S   ` w a r e h o u s e _ i d ` , 
 
     ` s t d ` . ` d o c u m e n t _ c u r r e n c y _ i d `           A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` s t d ` . ` u n i t _ i d `                                     A S   ` u n i t _ i d ` , 
 
     ` s t d ` . ` s t o c k _ q t y `                                 A S   ` s t o c k _ q t y ` , 
 
     ` s t d ` . ` q t y `                                             A S   ` q t y ` , 
 
     ` s t d ` . ` c o g _ r a t e `                                   A S   ` c o g _ r a t e ` , 
 
     ` s t d ` . ` c o g _ a m o u n t `                               A S   ` c o g _ a m o u n t ` , 
 
     ` s t d ` . ` b a s e _ c u r r e n c y _ i d `                   A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s t d ` . ` c o n v e r s i o n _ r a t e `                     A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s t d ` . ` b a s e _ c o g _ r a t e `                         A S   ` b a s e _ c o g _ r a t e ` , 
 
     ` s t d ` . ` b a s e _ c o g _ a m o u n t `                     A S   ` b a s e _ c o g _ a m o u n t ` , 
 
     ` s t d ` . ` r a t e `                                           A S   ` r a t e ` , 
 
     ` s t d ` . ` a m o u n t `                                       A S   ` a m o u n t ` , 
 
     ` s t d ` . ` c r e a t e d _ a t `                               A S   ` c r e a t e d _ a t ` , 
 
     ` s t d ` . ` c r e a t e d _ b y _ i d `                         A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s t d ` . ` d e s c r i p t i o n `                             A S   ` d e s c r i p t i o n ` , 
 
     ` s t ` . ` d o c u m e n t _ t y p e _ i d `                     A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s t ` . ` d o c u m e n t _ i d e n t i t y `                   A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s t ` . ` d o c u m e n t _ d a t e `                           A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s t ` . ` i s _ p o s t `                                       A S   ` i s _ p o s t ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                 A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                             A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                               A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                               A S   ` u n i t ` , 
 
     ` w h ` . ` n a m e `                                             A S   ` w a r e h o u s e ` 
 
 f r o m   ( ( ( ( ( ` i n a _ s t o c k _ t r a n s f e r _ d e t a i l `   ` s t d ` 
 
               j o i n   ` i n a _ s t o c k _ t r a n s f e r `   ` s t ` 
 
                   o n   ( ( ` s t ` . ` s t o c k _ t r a n s f e r _ i d `   =   ` s t d ` . ` s t o c k _ t r a n s f e r _ i d ` ) ) ) 
 
             l e f t   j o i n   ` i n 0 _ p r o d u c t `   ` p ` 
 
                 o n   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s t d ` . ` c o m p a n y _ i d ` ) 
 
                           a n d   ( ` p ` . ` p r o d u c t _ i d `   =   ` s t d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
           l e f t   j o i n   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
               o n   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                         a n d   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
         l e f t   j o i n   ` i n 0 _ u n i t `   ` u ` 
 
             o n   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s t d ` . ` c o m p a n y _ i d ` ) 
 
                       a n d   ( ` u ` . ` u n i t _ i d `   =   ` s t d ` . ` u n i t _ i d ` ) ) ) ) 
 
       l e f t   j o i n   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
           o n   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` s t d ` . ` c o m p a n y _ i d ` ) 
 
                     a n d   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` s t d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                     a n d   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` s t d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n a _ s t o c k _ a d j u s t m e n t _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s a d ` . ` s o r t _ o r d e r `                                   A S   ` s o r t _ o r d e r ` , 
 
     ` s a d ` . ` c o m p a n y _ i d `                                   A S   ` c o m p a n y _ i d ` , 
 
     ` s a d ` . ` c o m p a n y _ b r a n c h _ i d `                     A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s a d ` . ` f i s c a l _ y e a r _ i d `                           A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s a d ` . ` s t o c k _ a d j u s t m e n t _ i d `                 A S   ` s t o c k _ a d j u s t m e n t _ i d ` , 
 
     ` s a d ` . ` s t o c k _ a d j u s t m e n t _ d e t a i l _ i d `   A S   ` s t o c k _ a d j u s t m e n t _ d e t a i l _ i d ` , 
 
     ` s a d ` . ` p r o d u c t _ i d `                                   A S   ` p r o d u c t _ i d ` , 
 
     ` s a d ` . ` p r o d u c t _ c o d e `                               A S   ` p r o d u c t _ c o d e ` , 
 
     ` s a d ` . ` d o c u m e n t _ c u r r e n c y _ i d `               A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` s a d ` . ` u n i t _ i d `                                         A S   ` u n i t _ i d ` , 
 
     ` s a d ` . ` s t o c k _ q t y `                                     A S   ` s t o c k _ q t y ` , 
 
     ` s a d ` . ` q t y `                                                 A S   ` q t y ` , 
 
     ` s a d ` . ` r a t e `                                               A S   ` r a t e ` , 
 
     ` s a d ` . ` a m o u n t `                                           A S   ` a m o u n t ` , 
 
     ` s a d ` . ` b a s e _ c u r r e n c y _ i d `                       A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s a d ` . ` c o n v e r s i o n _ r a t e `                         A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s a d ` . ` b a s e _ r a t e `                                     A S   ` b a s e _ r a t e ` , 
 
     ` s a d ` . ` b a s e _ a m o u n t `                                 A S   ` b a s e _ a m o u n t ` , 
 
     ` s a d ` . ` c r e a t e d _ a t `                                   A S   ` c r e a t e d _ a t ` , 
 
     ` s a d ` . ` c r e a t e d _ b y _ i d `                             A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s a ` . ` d o c u m e n t _ t y p e _ i d `                         A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s a ` . ` d o c u m e n t _ i d e n t i t y `                       A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s a ` . ` d o c u m e n t _ d a t e `                               A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s a ` . ` i s _ p o s t `                                           A S   ` i s _ p o s t ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                     A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                                 A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                                   A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                                   A S   ` u n i t ` 
 
 F R O M   ( ( ( ( ` i n a _ s t o c k _ a d j u s t m e n t _ d e t a i l `   ` s a d ` 
 
             J O I N   ` i n a _ s t o c k _ a d j u s t m e n t `   ` s a ` 
 
                 O N   ( ( ` s a ` . ` s t o c k _ a d j u s t m e n t _ i d `   =   ` s a d ` . ` s t o c k _ a d j u s t m e n t _ i d ` ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
               O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s a d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` s a d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
             O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
           O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s a d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` u ` . ` u n i t _ i d `   =   ` s a d ` . ` u n i t _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n a _ s t o c k _ i n _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s i d ` . ` c o m p a n y _ i d `                       A S   ` c o m p a n y _ i d ` , 
 
     ` s i d ` . ` c o m p a n y _ b r a n c h _ i d `         A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s i d ` . ` f i s c a l _ y e a r _ i d `               A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s i d ` . ` s t o c k _ i n _ i d `                     A S   ` s t o c k _ i n _ i d ` , 
 
     ` s i d ` . ` s t o c k _ i n _ d e t a i l _ i d `       A S   ` s t o c k _ i n _ d e t a i l _ i d ` , 
 
     ` s i d ` . ` s o r t _ o r d e r `                       A S   ` s o r t _ o r d e r ` , 
 
     ` s i d ` . ` p r o d u c t _ i d `                       A S   ` p r o d u c t _ i d ` , 
 
     ` s i d ` . ` p r o d u c t _ c o d e `                   A S   ` p r o d u c t _ c o d e ` , 
 
     ` s i d ` . ` d o c u m e n t _ c u r r e n c y _ i d `   A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` s i d ` . ` u n i t _ i d `                             A S   ` u n i t _ i d ` , 
 
     ` s i d ` . ` s t o c k _ q t y `                         A S   ` s t o c k _ q t y ` , 
 
     ` s i d ` . ` q t y `                                     A S   ` q t y ` , 
 
     ` s i d ` . ` c o g _ r a t e `                           A S   ` c o g _ r a t e ` , 
 
     ` s i d ` . ` c o g _ a m o u n t `                       A S   ` c o g _ a m o u n t ` , 
 
     ` s i d ` . ` b a s e _ c u r r e n c y _ i d `           A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s i d ` . ` c o n v e r s i o n _ r a t e `             A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s i d ` . ` b a s e _ c o g _ r a t e `                 A S   ` b a s e _ c o g _ r a t e ` , 
 
     ` s i d ` . ` b a s e _ c o g _ a m o u n t `             A S   ` b a s e _ c o g _ a m o u n t ` , 
 
     ` s i d ` . ` c r e a t e d _ a t `                       A S   ` c r e a t e d _ a t ` , 
 
     ` s i d ` . ` c r e a t e d _ b y _ i d `                 A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` p ` . ` n a m e `                                       A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                       A S   ` u n i t ` 
 
 F R O M   ( ( ` i n a _ s t o c k _ i n _ d e t a i l `   ` s i d ` 
 
         L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
             O N   ( ( ` p ` . ` p r o d u c t _ i d `   =   ` s i d ` . ` p r o d u c t _ i d ` ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
           O N   ( ( ` u ` . ` u n i t _ i d `   =   ` s i d ` . ` u n i t _ i d ` ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n a _ s t o c k _ o u t _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s o d ` . ` c o m p a n y _ i d `                       A S   ` c o m p a n y _ i d ` , 
 
     ` s o d ` . ` c o m p a n y _ b r a n c h _ i d `         A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s o d ` . ` f i s c a l _ y e a r _ i d `               A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s o d ` . ` s t o c k _ o u t _ i d `                   A S   ` s t o c k _ o u t _ i d ` , 
 
     ` s o d ` . ` s t o c k _ o u t _ d e t a i l _ i d `     A S   ` s t o c k _ o u t _ d e t a i l _ i d ` , 
 
     ` s o d ` . ` s o r t _ o r d e r `                       A S   ` s o r t _ o r d e r ` , 
 
     ` s o d ` . ` p r o d u c t _ i d `                       A S   ` p r o d u c t _ i d ` , 
 
     ` s o d ` . ` p r o d u c t _ c o d e `                   A S   ` p r o d u c t _ c o d e ` , 
 
     ` s o d ` . ` d o c u m e n t _ c u r r e n c y _ i d `   A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` s o d ` . ` u n i t _ i d `                             A S   ` u n i t _ i d ` , 
 
     ` s o d ` . ` s t o c k _ q t y `                         A S   ` s t o c k _ q t y ` , 
 
     ` s o d ` . ` q t y `                                     A S   ` q t y ` , 
 
     ` s o d ` . ` c o g _ r a t e `                           A S   ` c o g _ r a t e ` , 
 
     ` s o d ` . ` c o g _ a m o u n t `                       A S   ` c o g _ a m o u n t ` , 
 
     ` s o d ` . ` b a s e _ c u r r e n c y _ i d `           A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s o d ` . ` c o n v e r s i o n _ r a t e `             A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s o d ` . ` b a s e _ c o g _ r a t e `                 A S   ` b a s e _ c o g _ r a t e ` , 
 
     ` s o d ` . ` b a s e _ c o g _ a m o u n t `             A S   ` b a s e _ c o g _ a m o u n t ` , 
 
     ` s o d ` . ` c r e a t e d _ a t `                       A S   ` c r e a t e d _ a t ` , 
 
     ` s o d ` . ` c r e a t e d _ b y _ i d `                 A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` p ` . ` n a m e `                                       A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                       A S   ` u n i t ` 
 
 F R O M   ( ( ` i n a _ s t o c k _ o u t _ d e t a i l `   ` s o d ` 
 
         L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
             O N   ( ( ` p ` . ` p r o d u c t _ i d `   =   ` s o d ` . ` p r o d u c t _ i d ` ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
           O N   ( ( ` u ` . ` u n i t _ i d `   =   ` s o d ` . ` u n i t _ i d ` ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ i n a _ o p e n i n g _ s t o c k _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` o s ` . ` c o m p a n y _ i d `                               A S   ` c o m p a n y _ i d ` , 
 
     ` o s ` . ` c o m p a n y _ b r a n c h _ i d `                 A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` o s ` . ` f i s c a l _ y e a r _ i d `                       A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` o s ` . ` o p e n i n g _ s t o c k _ i d `                   A S   ` o p e n i n g _ s t o c k _ i d ` , 
 
     ` o s ` . ` d o c u m e n t _ t y p e _ i d `                   A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` o s ` . ` d o c u m e n t _ p r e f i x `                     A S   ` d o c u m e n t _ p r e f i x ` , 
 
     ` o s ` . ` d o c u m e n t _ n o `                             A S   ` d o c u m e n t _ n o ` , 
 
     ` o s ` . ` d o c u m e n t _ i d e n t i t y `                 A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` o s ` . ` d o c u m e n t _ d a t e `                         A S   ` d o c u m e n t _ d a t e ` , 
 
     ` o s ` . ` w a r e h o u s e _ i d `                           A S   ` w a r e h o u s e _ i d ` , 
 
     ` w ` . ` n a m e `                                             A S   ` w a r e h o u s e ` , 
 
     ` o s ` . ` r e m a r k s `                                     A S   ` r e m a r k s ` , 
 
     ` o s d ` . ` o p e n i n g _ s t o c k _ d e t a i l _ i d `   A S   ` o p e n i n g _ s t o c k _ d e t a i l _ i d ` , 
 
     ` o s d ` . ` s o r t _ o r d e r `                             A S   ` s o r t _ o r d e r ` , 
 
     ` o s d ` . ` u n i t _ i d `                                   A S   ` u n i t _ i d ` , 
 
     ` u ` . ` n a m e `                                             A S   ` u n i t ` , 
 
     ` o s d ` . ` p r o d u c t _ i d `                             A S   ` p r o d u c t _ i d ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `               A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                           A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` p r o d u c t _ c o d e `                             A S   ` p r o d u c t _ c o d e ` , 
 
     ` p ` . ` n a m e `                                             A S   ` p r o d u c t ` , 
 
     ` p ` . ` p r o d u c t _ i m a g e `                           A S   ` p r o d u c t _ i m a g e ` , 
 
     ` o s d ` . ` d o c u m e n t _ c u r r e n c y _ i d `         A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` o s d ` . ` q t y `                                           A S   ` q t y ` , 
 
     ` o s d ` . ` r a t e `                                         A S   ` r a t e ` , 
 
     ` o s d ` . ` a m o u n t `                                     A S   ` a m o u n t ` , 
 
     ` o s d ` . ` b a s e _ c u r r e n c y _ i d `                 A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` o s d ` . ` c o n v e r s i o n _ r a t e `                   A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` o s d ` . ` b a s e _ a m o u n t `                           A S   ` b a s e _ a m o u n t ` , 
 
     ` o s d ` . ` c r e a t e d _ a t `                             A S   ` c r e a t e d _ a t ` 
 
 F R O M   ( ( ( ( ( ` i n a _ o p e n i n g _ s t o c k _ d e t a i l `   ` o s d ` 
 
               J O I N   ` i n a _ o p e n i n g _ s t o c k `   ` o s ` 
 
                   O N   ( ( ( ` o s ` . ` c o m p a n y _ i d `   =   ` o s d ` . ` c o m p a n y _ i d ` ) 
 
                             A N D   ( ` o s ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` o s d ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                             A N D   ( ` o s ` . ` f i s c a l _ y e a r _ i d `   =   ` o s d ` . ` f i s c a l _ y e a r _ i d ` ) 
 
                             A N D   ( ` o s ` . ` o p e n i n g _ s t o c k _ i d `   =   ` o s d ` . ` o p e n i n g _ s t o c k _ i d ` ) ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w ` 
 
                 O N   ( ( ( ` w ` . ` c o m p a n y _ i d `   =   ` o s ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` w ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` o s ` . ` c o m p a n y _ b r a n c h _ i d ` ) 
 
                           A N D   ( ` w ` . ` w a r e h o u s e _ i d `   =   ` o s ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
               O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` o s d ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` o s d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
             O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` o s d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` u ` . ` u n i t _ i d `   =   ` o s d ` . ` u n i t _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
           O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V I E W :   v w _ b r a n c h _ s t o c k _ t r a n s f e r _ d e t a i l 
 
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 S E L E C T 
 
     ` s t d ` . ` c o m p a n y _ i d `                                             A S   ` c o m p a n y _ i d ` , 
 
     ` s t d ` . ` c o m p a n y _ b r a n c h _ i d `                               A S   ` c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s t d ` . ` f i s c a l _ y e a r _ i d `                                     A S   ` f i s c a l _ y e a r _ i d ` , 
 
     ` s t d ` . ` b r a n c h _ s t o c k _ t r a n s f e r _ i d `                 A S   ` b r a n c h _ s t o c k _ t r a n s f e r _ i d ` , 
 
     ` s t d ` . ` b r a n c h _ s t o c k _ t r a n s f e r _ d e t a i l _ i d `   A S   ` b r a n c h _ s t o c k _ t r a n s f e r _ d e t a i l _ i d ` , 
 
     ` s t d ` . ` s o r t _ o r d e r `                                             A S   ` s o r t _ o r d e r ` , 
 
     ` s t d ` . ` p r o d u c t _ i d `                                             A S   ` p r o d u c t _ i d ` , 
 
     ` s t d ` . ` p r o d u c t _ c o d e `                                         A S   ` p r o d u c t _ c o d e ` , 
 
     ` s t d ` . ` t o _ c o m p a n y _ b r a n c h _ i d `                         A S   ` t o _ c o m p a n y _ b r a n c h _ i d ` , 
 
     ` s t d ` . ` w a r e h o u s e _ i d `                                         A S   ` w a r e h o u s e _ i d ` , 
 
     ` s t d ` . ` d o c u m e n t _ c u r r e n c y _ i d `                         A S   ` d o c u m e n t _ c u r r e n c y _ i d ` , 
 
     ` s t d ` . ` u n i t _ i d `                                                   A S   ` u n i t _ i d ` , 
 
     ` s t d ` . ` s t o c k _ q t y `                                               A S   ` s t o c k _ q t y ` , 
 
     ` s t d ` . ` q t y `                                                           A S   ` q t y ` , 
 
     ` s t d ` . ` c o g _ r a t e `                                                 A S   ` c o g _ r a t e ` , 
 
     ` s t d ` . ` c o g _ a m o u n t `                                             A S   ` c o g _ a m o u n t ` , 
 
     ` s t d ` . ` b a s e _ c u r r e n c y _ i d `                                 A S   ` b a s e _ c u r r e n c y _ i d ` , 
 
     ` s t d ` . ` c o n v e r s i o n _ r a t e `                                   A S   ` c o n v e r s i o n _ r a t e ` , 
 
     ` s t d ` . ` b a s e _ c o g _ r a t e `                                       A S   ` b a s e _ c o g _ r a t e ` , 
 
     ` s t d ` . ` b a s e _ c o g _ a m o u n t `                                   A S   ` b a s e _ c o g _ a m o u n t ` , 
 
     ` s t d ` . ` r a t e `                                                         A S   ` r a t e ` , 
 
     ` s t d ` . ` a m o u n t `                                                     A S   ` a m o u n t ` , 
 
     ` s t d ` . ` c r e a t e d _ a t `                                             A S   ` c r e a t e d _ a t ` , 
 
     ` s t d ` . ` c r e a t e d _ b y _ i d `                                       A S   ` c r e a t e d _ b y _ i d ` , 
 
     ` s t ` . ` d o c u m e n t _ t y p e _ i d `                                   A S   ` d o c u m e n t _ t y p e _ i d ` , 
 
     ` s t ` . ` d o c u m e n t _ i d e n t i t y `                                 A S   ` d o c u m e n t _ i d e n t i t y ` , 
 
     ` s t ` . ` d o c u m e n t _ d a t e `                                         A S   ` d o c u m e n t _ d a t e ` , 
 
     ` s t ` . ` i s _ p o s t `                                                     A S   ` i s _ p o s t ` , 
 
     ` p ` . ` p r o d u c t _ c a t e g o r y _ i d `                               A S   ` p r o d u c t _ c a t e g o r y _ i d ` , 
 
     ` p c ` . ` n a m e `                                                           A S   ` p r o d u c t _ c a t e g o r y ` , 
 
     ` p ` . ` n a m e `                                                             A S   ` p r o d u c t _ n a m e ` , 
 
     ` u ` . ` n a m e `                                                             A S   ` u n i t ` , 
 
     ` u ` . ` c o d e `                                                             A S   ` u n i t _ c o d e ` , 
 
     ` w h ` . ` n a m e `                                                           A S   ` w a r e h o u s e ` 
 
 F R O M   ( ( ( ( ( ` b r a n c h _ s t o c k _ t r a n s f e r _ d e t a i l `   ` s t d ` 
 
               J O I N   ` b r a n c h _ s t o c k _ t r a n s f e r `   ` s t ` 
 
                   O N   ( ( ` s t ` . ` b r a n c h _ s t o c k _ t r a n s f e r _ i d `   =   ` s t d ` . ` b r a n c h _ s t o c k _ t r a n s f e r _ i d ` ) ) ) 
 
             L E F T   J O I N   ` i n 0 _ p r o d u c t `   ` p ` 
 
                 O N   ( ( ( ` p ` . ` c o m p a n y _ i d `   =   ` s t d ` . ` c o m p a n y _ i d ` ) 
 
                           A N D   ( ` p ` . ` p r o d u c t _ i d `   =   ` s t d ` . ` p r o d u c t _ i d ` ) ) ) ) 
 
           L E F T   J O I N   ` i n 0 _ p r o d u c t _ c a t e g o r y `   ` p c ` 
 
               O N   ( ( ( ` p c ` . ` c o m p a n y _ i d `   =   ` p ` . ` c o m p a n y _ i d ` ) 
 
                         A N D   ( ` p c ` . ` p r o d u c t _ c a t e g o r y _ i d `   =   ` p ` . ` p r o d u c t _ c a t e g o r y _ i d ` ) ) ) ) 
 
         L E F T   J O I N   ` i n 0 _ u n i t `   ` u ` 
 
             O N   ( ( ( ` u ` . ` c o m p a n y _ i d `   =   ` s t d ` . ` c o m p a n y _ i d ` ) 
 
                       A N D   ( ` u ` . ` u n i t _ i d `   =   ` s t d ` . ` u n i t _ i d ` ) ) ) ) 
 
       L E F T   J O I N   ` i n 0 _ w a r e h o u s e `   ` w h ` 
 
           O N   ( ( ( ` w h ` . ` c o m p a n y _ i d `   =   ` s t d ` . ` c o m p a n y _ i d ` ) 
 
                     A N D   ( ` w h ` . ` c o m p a n y _ b r a n c h _ i d `   =   ` s t d ` . ` t o _ c o m p a n y _ b r a n c h _ i d ` ) 
 
                     A N D   ( ` w h ` . ` w a r e h o u s e _ i d `   =   ` s t d ` . ` w a r e h o u s e _ i d ` ) ) ) ) 
 
 
 
 