REPORTFORM;IVC1_E.frf
TITLE;STOCK COST REPORT
SQL;SELECT INVCARD.ID, INVMST.XDESC, INVMST.UNIT, SUM(INVCARD.COSTREPBAL) AS XCOST, 
SQL;INVMST.NBAL
SQL;FROM INVCARD
SQL;LEFT JOIN INVMST ON INVCARD.ID = INVMST.ID
SQL;GROUP BY INVCARD.ID, INVMST.XDESC, INVMST.UNIT
SQL;ORDER BY INVCARD.ID
CONDITION;FROM STOCK ID~INVMST.ID~Chr~2~SELECT ID FROM INVMST ~INV
CONDITION;AT THE END OF DATE~INVCARD.DATEDOC~Date~1~<=~
EXCELSQL;SELECT INVCARD.ID AS "รหัสสินค้า", INVMST.XDESC AS "รายละเอียดสินค้า", INVMST.UNIT AS "หน่วยนับหลัก", 
EXCELSQL;INVMST.NBAL AS "ยอดคงเหลือ", ((SUM(INVCARD.COSTREPBAL))/INVMST.NBAL) AS "ต้นทุน/หน่วย",
EXCELSQL;((SUM(INVCARD.COSTREPBAL))/INVMST.NBAL)*INVMST.NBAL AS "มูลค่าปลายงวด"
EXCELSQL;FROM INVCARD
EXCELSQL;LEFT JOIN INVMST ON INVCARD.ID = INVMST.ID
EXCELSQL;GROUP BY INVCARD.ID, INVMST.XDESC, INVMST.UNIT
EXCELSQL;ORDER BY INVCARD.ID
