[ask]display item line per line in quote date

benedictine191

New Member
hi mfgprogress talker, i was build a nett sales report..but i cannot display the result line per line..
PS: the result of nett sales i got it from "qty * price = ext price" and sum of ext price = "nett sales"..
the table that i used was "ih_hist" and "idh_hist"....

here is my code :
Code:
/*LAPORAN NET SALES*/

{mfdtitle.i}
    DEFINE VARIABLE nbr LIKE ih_nbr.
    DEFINE VARIABLE nbr1 LIKE ih_nbr.
    DEFINE VARIABLE shto LIKE ih_ship.
    DEFINE VARIABLE shto1 LIKE ih_ship.
    DEFINE VARIABLE ord LIKE ih_inv_date.
    DEFINE VARIABLE ord1 LIKE ih_inv_date.
    define variable ln as integer.

define variable qtyi like idh_qty_inv.
define variable harga like idh_price.
  
define variable totk as decimal.
define variable tran as decimal.
define variable tot as decimal.
define variable totl as decimal.
define variable totns as decimal.
define variable sumtot as decimal .
define variable sumtot1 as decimal .
define variable jml as decimal.
DEFINE VARIABLE aa AS CHAR.
DEFINE VARIABLE nmstor AS CHAR.
define variable cc as char.
define variable ptdesc like pt_desc1.
define variable bb like ad_name.

define variable i as integer.
define variable a as char.
define variable b as date.
        
FORM SKIP
    shto    COLON 20 
    shto1   COLON 49    LABEL "TO"
    ord     COLON 20 
    ord1    COLON 49    LABEL "TO" SKIP(1)
    totl  colon 20    label "TOTAL LISTRIK"
    totk    colon 20    label "TOTAL KONSINYASI"
    SKIP(1)
WITH FRAME a WIDTH 80 SIDE-LABEL.



repeat:
UPDATE   
    shto shto1
    ord ord1
    totl totk


WITH FRAME a.

    {mfquoter.i  nbr   }
    {mfquoter.i  nbr1   }
    {mfquoter.i  shto   }
    {mfquoter.i  shto1  }
    {mfquoter.i  ord   }
    {mfquoter.i  ord1 }

{mfselbpr.i "printer" 132}
/*Header*/

FOR EACH ih_hist WHERE ih_domain = GLOBAL_domain and ih_ship >= shto and ih_ship <= shto1  NO-LOCK break by ih_ship by ih_inv_date : 
find ad_mstr where ad_domain = global_domain and ad_addr = ih_ship no-lock.
assign 
bb = ad_name.
a = ih_nbr.
b = ih_inv_date.

end.


        PUT "LAPORAN NETT SALES" AT 5 SKIP
            "===================" at 5 skip(2).
        PUT "STORE :" at 5 SPACE(2) bb FORMAT "x(50)" SKIP. 
        PUT SKIP(2).
	 PUT "Nomor SO." space(3) "Tanggal Invoice" space(6) "Nett Sales" skip.
	 PUT "---------" space(3) "---------------" space(6) "----------" skip(1).	

FOR EACH ih_hist WHERE ih_domain = GLOBAL_domain and ih_ship >= shto and ih_ship <= shto1 and ih_inv_date >=ord and ih_inv_date <= ord1  NO-LOCK break by ih_ship by ih_inv_date :
	for each idh_hist where idh_domain = GLOBAL_domain and idh_nbr = ih_nbr no-lock break by ih_inv_date by ih_ship by ih_nbr :

		sumtot = idh_qty_inv * idh_price.
		sumtot1 = sumtot1 + sumtot.					 
   	end.
 end.

	totns = totns + sumtot1.
	put ih_nbr space(6) ih_inv_date space(6) sumtot1 format "(>>>,>>>,>>9.99)".
	tot = totk + totl.

	 PUT SKIP (2).
	 PUT "TOTAL NET SALES" to 30  totns to 60 FORMAT "->>>,>>>,>>9.99" skip.
        put   "--------------------" to 60 skip.
        put "TOTAL KONSINYASI 15%" to 30  totk to 60        FORMAT "(>>>,>>>,>>9.99)" SKIP.
        put   "--------------------" to 60 SKIP.
        put "TOTAL LISTRIK/HARI Rp.10.000,-    " to 30 totl to    60     FORMAT "(>>>,>>>,>>9.99)" SKIP.
        put   "--------------------" to 60 skip.
        put "TOTAL YANG HARUS DIBAYAR" to 30 tot to 60 FORMAT "(>>>,>>>,>>9.99)" SKIP.

{mfreset.i}
end.

but the result not same as my hope
attachment.php


i hope the result is like this..the date was display line per line by range date
attachment.php


could anyone help me to correct my code...tq very much :)
 

Attachments

  • prscr laporan net sales.JPG
    prscr laporan net sales.JPG
    37.1 KB · Views: 26
  • result.JPG
    result.JPG
    44.8 KB · Views: 27
Are you displaying the net sales value based on the Sales Orders, if yes then follow the below points,

1. There is no proper initialization for sumtot1. Initialize the sumtot1 = 0 before the for each idh_hist.
2. display the put statement after for each idh_hist.

Hope this resolves issues
 
Top