主题:代码问题(急!高分求助)
*!* 建立curFinance临时表,用于存放进货和销售数据
CREATE CURSOR curFinance (nMonth N(2),SumIn N(18,2),SumOut N(18,2),;
BePay N(18,2),UnPay N(18,2),BeReceive N(18,2),UnReceive N(18,2))
SELECT MONTH(rq) AS nMonth,yzje,wzje ; &&统计进货数据
FROM tblInMaster INTO CURSOR curInMaster ;
WHERE YEAR(rq)=Thisform.spnSelectYear.Value
CALCULATE SUM (curinmaster.yzje) TO nyzje
CALCULATE SUM (curinmaster.wzje) TO nwzje
*!* 为curFinance表填充数据。问题是11月12月数据相同!
FOR i=1 TO 12
SELECT curFinance
APPEND BLANK
REPLACE nMonth WITH i
SELECT curInMaster
LOCATE FOR nMonth=i
IF FOUND()
SELECT curFinance
REPLACE SumIn WITH nyzje+nwzje,;
BePay WITH nyzje,UnPay WITH nwzje
ENDIF
ENDFOR
CREATE CURSOR curFinance (nMonth N(2),SumIn N(18,2),SumOut N(18,2),;
BePay N(18,2),UnPay N(18,2),BeReceive N(18,2),UnReceive N(18,2))
SELECT MONTH(rq) AS nMonth,yzje,wzje ; &&统计进货数据
FROM tblInMaster INTO CURSOR curInMaster ;
WHERE YEAR(rq)=Thisform.spnSelectYear.Value
CALCULATE SUM (curinmaster.yzje) TO nyzje
CALCULATE SUM (curinmaster.wzje) TO nwzje
*!* 为curFinance表填充数据。问题是11月12月数据相同!
FOR i=1 TO 12
SELECT curFinance
APPEND BLANK
REPLACE nMonth WITH i
SELECT curInMaster
LOCATE FOR nMonth=i
IF FOUND()
SELECT curFinance
REPLACE SumIn WITH nyzje+nwzje,;
BePay WITH nyzje,UnPay WITH nwzje
ENDIF
ENDFOR