          SUBROUTINE (OID,GEN,NO.PT,STATUS,PSTYLE.OVRD,MBX.BODY)
** Version# 17.0001[1] - 06/29/2015 - 04:53pm - TSMITH - eclipse
** Copied from BP SOE.MBX.ORDER Version# 17 - 08/31/2011 - 05:23pm - BILLW - main

*** Subroutine - SOE.MBX.ORDER
*-------------------------------------------------------------------------*
*** Formats all text email Sales Orders
*-------------------------------------------------------------------------*
*** OID         - order ID                                           [IN]
*** GEN         - generation ID                                      [IN]
*** NO.PT       - not used
*** STATUS      - status to send document as                         [IN]
*** PSTYLE.OVRD - print style ovrd sent by user from OE.PRINT.OPTS   [IN]
*** MBX.BODY    - email body                                         [OUT]
*-------------------------------------------------------------------------*

          * Return if Email Orders as Tiff Attachments is active
          EMAIL.CHECK.TIFF 'INV',OID,GEN,,EMAIL.TIFF

          * Backorder ACK  neve send rthe order, only a text message
          IF EMAIL.TIFF AND STATUS # 'Z' THEN
             MBX.BODY = ''
             RETURN
          END

          EMOID    = OID
          EMGEN    = GEN
          EMSTATUS = STATUS

          * set the print style ID here before we call Bid/Ack/Inv programs
          *** No Override print style
          IF PSTYLE.OVRD = '' THEN
             PSTYLE.GET.ID OID,GEN,PSTYLE.ID,STATUS
             *** If order level print style is BLIND do not send BLIND
             *** Invoices, Bids or Acknowledgements.  If for some reason
             *** the user wants to send a BLIND version of these forms they
             *** can access the Order Reprinting screen and set the print
             *** to BLIND.  This will set BLIND as the Overide print style
             *** and it will be used.
             IF OID[1,1] = "S" AND PSTYLE.ID = "BLIND" THEN
                BEGIN CASE
                *** Invoice
                CASE STATUS = "I"
                   PSTYLE.ID = "NET"
                *** Bid
                CASE STATUS = "B"
                   PSTYLE.ID = "BID"
                *** Acknowledgement
                CASE STATUS # "T" AND STATUS # "O" AND STATUS # "F"
                   PSTYLE.ID = "BID"
                END CASE
             END
          END ELSE
             PSTYLE.ID = PSTYLE.OVRD
          END

          BEGIN CASE
          CASE STATUS = 'I'
             SOE.MBX.INVOICE EMOID,EMGEN,PSTYLE.ID,MBX.BODY
          CASE STATUS = 'B'
             SOE.MBX.BID EMOID,EMGEN,PSTYLE.ID,MBX.BODY
          CASE STATUS = "M"
             MBX.BODY = ""
             RETURN
          CASE OTHERWISE
             SOE.MBX.ACK EMOID,EMGEN,STATUS,PSTYLE.ID,MBX.BODY
          END CASE

          RETURN
!TSMITH~06/29/15~16:53
