REPORTFORM;SA18.frf
TITLE;ÇÔà¤ÃÒÐËì¢ÒÂ ÂÍ´¢ÒÂ¾¹Ñ¡§Ò¹ ÅÙ¡¤éÒ·Ñé§»Õ
SQL;SELECT
SQL;INVCARD.SALEID,
SQL;SALEMST.SNAME,
SQL;INVCARD.ACCID,
SQL;ARMST.XCOMP,
SQL;SUM(INVCARD.SALEPURAMT) AS SALEPURAMT,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=1,INVCARD.SALEPURAMT,0)) AS MTH1,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=2,INVCARD.SALEPURAMT,0)) AS MTH2,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=3,INVCARD.SALEPURAMT,0)) AS MTH3,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=4,INVCARD.SALEPURAMT,0)) AS MTH4,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=5,INVCARD.SALEPURAMT,0)) AS MTH5,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=6,INVCARD.SALEPURAMT,0)) AS MTH6,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=7,INVCARD.SALEPURAMT,0)) AS MTH7,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=8,INVCARD.SALEPURAMT,0)) AS MTH8,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=9,INVCARD.SALEPURAMT,0)) AS MTH9,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=10,INVCARD.SALEPURAMT,0)) AS MTH10,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=11,INVCARD.SALEPURAMT,0)) AS MTH11,
SQL;SUM(IF(MONTH(INVCARD.DATEDOC)=12,INVCARD.SALEPURAMT,0)) AS MTH12
SQL;FROM INVCARD 
SQL;LEFT JOIN SALEMST ON INVCARD.SALEID = SALEMST.SID
SQL;LEFT JOIN ARMST ON INVCARD.ACCID = ARMST.ACCID
SQL;LEFT JOIN ARCARD ON INVCARD.DOCNO = ARCARD.DOCNO 
SQL;WHERE (LEFT(INVCARD.DOCNO,2) = "IV" OR LEFT(INVCARD.DOCNO,2) = "RI")
SQL;GROUP BY 1,2,3,4
SQL;ORDER BY INVCARD.SALEID,INVCARD.ACCID
CONDITION;µÑé§áµèÇÑ¹·Õè~INVCARD.DATEDOC~Date~2~SELECT DATEDOC FROM INVCARD~
CONDITION;µÑé§áµèÃËÑÊ¾¹Ñ¡§Ò¹~INVCARD.SALEID~Chr~2~SELECT SALEID FROM INVCARD~SALE
EXCELSQL;SELECT
EXCELSQL;INVCARD.SALEID AS "ÃËÑÊ¾¹Ñ¡§Ò¹",
EXCELSQL;SALEMST.SNAME AS "ª×èÍ Ê¡ØÅ¾¹Ñ¡§Ò¹",
EXCELSQL;INVCARD.ACCID AS "ÃËÑÊÅÙ¡¤éÒ",
EXCELSQL;ARMST.XCOMP AS "ÃÒÂÅÐàÍÕÂ´ÅÙ¡¤éÒ",
EXCELSQL;SUM(INVCARD.SALEPURAMT) AS SALEPURAMT,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=1,INVCARD.SALEPURAMT,0)) AS MTH1,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=2,INVCARD.SALEPURAMT,0)) AS MTH2,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=3,INVCARD.SALEPURAMT,0)) AS MTH3,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=4,INVCARD.SALEPURAMT,0)) AS MTH4,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=5,INVCARD.SALEPURAMT,0)) AS MTH5,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=6,INVCARD.SALEPURAMT,0)) AS MTH6,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=7,INVCARD.SALEPURAMT,0)) AS MTH7,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=8,INVCARD.SALEPURAMT,0)) AS MTH8,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=9,INVCARD.SALEPURAMT,0)) AS MTH9,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=10,INVCARD.SALEPURAMT,0)) AS MTH10,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=11,INVCARD.SALEPURAMT,0)) AS MTH11,
EXCELSQL;SUM(IF(MONTH(INVCARD.DATEDOC)=12,INVCARD.SALEPURAMT,0)) AS MTH12
EXCELSQL;FROM INVCARD 
EXCELSQL;LEFT JOIN SALEMST ON INVCARD.SALEID = SALEMST.SID
EXCELSQL;LEFT JOIN ARMST ON INVCARD.ACCID = ARMST.ACCID
EXCELSQL;LEFT JOIN ARCARD ON INVCARD.DOCNO = ARCARD.DOCNO 
EXCELSQL;WHERE (LEFT(INVCARD.DOCNO,2) = "IV" OR LEFT(INVCARD.DOCNO,2) = "RI")
EXCELSQL;GROUP BY 1,2,3,4
EXCELSQL;ORDER BY INVCARD.SALEID,INVCARD.ACCID
