how to List the top ten customers form the given start date with greater cost/price of orders...

Discussão em 'StackOverflow' iniciado por fdantas, Dezembro 15, 2016.

  1. fdantas

    fdantas Administrator Moderador

    a single customer could have multiple orders and corresponding cost. now the cost/price has to be added and according to the max price the customer's should be displayed. i have just written the skeleton of the prog , please help me.

    define temp-table ttorder
    field ocust-num like order.cust-num
    field oorder-num like order.order-num.
    define variable i as int.
    define variable a as int.

    define temp-table ttorderln
    field oprice like order-line.price.

    for each order where order-date > 01/08/93 /*by cust-num*/ .

    create ttorder .
    assign
    ttorder.ocust-num =cust-num
    ttorder.oorder-num = order-num.

    for each order-line where order-line.order-num = ttorder.oorder-num break by ocust-num.

    i = order-line.price.
    a = i + a.
    /* display cust-num order-num a. */
    if last-of (ttorder.ocust-num) then
    do:


    create ttorderln.
    ttorderln.oprice=a.

    end.

    display ttorderln.

    end.


    end.

    Continue reading...

Compartilhe esta Página