Customer orders lines

Base alias is "Customer". Child alias is "Orders". Second child alias (2th level) is Order_Line_Items.

Order line items list use silver color.

Download full example.

This example is for XFRX 19.1.0 because use data:template element and stylefor attribute.


Data preparation

m.lcTASTRADE=HOME(2)+"Tastrade\Data\"
OPEN DATA (m.lcTASTRADE+"TASTRADE")

USE Customer ORDER "CUSTOMER_I" IN 0
USE Orders ORDER "CUST_ORD" IN 0
USE Order_Line_Items ORDER "ORDER_ID" IN 0
USE Products ORDER "PRODUCT_ID" IN 0

SELECT order_Id, SUM(UNIT_PRICE*QUANTITY) AS Amount ;
  FROM Order_Line_Items;
  GROUP BY order_ID;
  INTO CURSOR order_amount 
  
SELECT ("order_amount")  
INDEX ON order_ID TAG "order_I"

SELECT ("Order_Line_Items")
SET RELATION TO PRODUCT_ID INTO ("Products")
*SET FILTER TO VAL(PRODUCT_ID)<40

SELECT ("Orders")
SET RELATION TO order_ID INTO ("order_amount")
SET RELATION TO order_ID INTO ("Order_Line_Items") ADDITIVE
*SET FILTER TO VAL(order_id)<=644

SELECT ("Customer")
SET RELATION TO Customer_id INTO ("Orders")
SET FILTER TO RECNO()<=4
*SET FILTER TO Customer_id="ANTON"


 Text format source preparation

TEXT TO m.pcOrderList TEXTMERGE NOSHOW
<options>
TF_TABLE_MARGIN="0px"
TF_TABLE_PADDING="0px"
</options>
<p style="tab-stops:left 50px left 120px left 190px right 290px;">
 <span style="font-weight:bold;font-style:italic;">Order list</span><br/>
 <span style="font-weight:bold;">Number<tab/>Date<tab/>Deliver by<tab/>Paid<tab/>Amount</span>
 <hr style="width:100%;border-width:1px;border-style:solid;border-color:'Black';"></hr><br>
 <data:template template="'Orders'">
  <span stylefor="{NOT PAID}{font-weight:bold;color:RGB(255,0,0)}"> 
   <vfpev>ALLTRIM(ORDER_ID)</vfpev><tab/>
   <vfpev>ORDER_DATE</vfpev><tab/>
   <vfpev>DELIVER_BY</vfpev><tab/>
   <vfpev>IIF(PAID, "Yes", "No")</vfpev><tab/>
   <vfpev pictureformat="9 999 999.99">order_amount.Amount</vfpev>
  </span><br>
  <table style="font-size:7pt;color:RGB(192,192,192)">
   <tr template="'Order_Line_Items'">
    <td style="width:140px;"><vfpev>ALLTRIM(products.Product_name)</vfpev></td>
    <td style="width:40px;text-align:right;"><vfpev pictureformat="$999.99">Order_Line_Items.Unit_PRICE</vfpev></td>
    <td style="width:55px;text-align:right;"><vfpev pictureformat="999 999.99">Order_Line_Items.QUANTITY</vfpev></td>
    <td style="width:100px;"><vfpev>ALLTRIM(products.quantity_in_unit)</vfpev></td>
   </tr>
  </table>
 </data:template>

</p>
ENDTEXT

Run XFRX

m.loSession=EVALUATE([xfrx("XFRX#INIT")])
*m.loSession.setLogFile(m.lcPath+"XFRX.log")

m.lnRetVal = loSession.SetParams(,,,,.T.,,"XFF")
IF m.lnRetVal=0
   m.liT1=SECONDS()
   m.loSession.ProcessReport(m.lcPath+"Customer_orders_LINES")
   ?SECONDS()-m.liT1
   m.loXFF=m.loSession.finalize()
   SET COVERAGE TO
   
   SET CLASSLIB TO xfrxlib\xfrxlib ADDITIVE 

   m.loPreview = CREATEOBJECT("frmMPPreviewer")
   m.loPreview.iEmail = 1 && show the email icon
   m.loPreview.lVFP8 =.T. && use XFRX#INIT
   *m.loPreview.setLogFile(m.lcPath+"XFRXPreview.log")
   
   m.loPreview.windowtype = 1
   m.loPreview.windowState = 0
   
   m.loPreview.PreviewXFF(m.loXFF)
   m.loPreview.show()
   
ENDIF   

Result