iam generating a payslip Report.i want to group the Report with Employee Name and Department .
iam using Mysql Data Base and RecordSet Object.How can i group the Report using RecordSet.
CODE:
Code: Select all
//------------------------------------------------------------------------------
FUNCTION GenEmpPaySlipBill(oRecSet,oDlg)
//------------------------------------------------------------------------------
LOCAL oReport,oFont1, oFont2, oFont3, oPen1, oPen2
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-10 BOLD
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-12 BOLD
DEFINE PEN oPen1 WIDTH 1 COLOR 12632256
DEFINE PEN oPen2 WIDTH 1 COLOR CLR_HMAGENTA
REPORT oReport ;
TITLE " " ;
CENTERED;
FONT oFont1,oFont2,oFont3 ;
PEN oPen1, ;
oPen2 ;
HEADER Space(40)+"XXXXXXXXX", ;
Space(100),;
"NAME :" + AllTrim(oRecSet:Fields( 'EmpName' ):Value) + Space(Len(oRecSet:Fields( 'EmpName' ):Value)+20) +"DESIGNATION :" + oRecSet:Fields( 'Department' ):Value ,;
Space(100),;
"MONTH\YEAR :" + AllTrim(Str(oApp:nFnYear))+ "-" + AllTrim(Str( oRecSet:Fields( 'MonthOfTransaction' ):Value)),;
Space(100),;
"BASIC SALARY :" + AllTrim(str(oRecSet:Fields('BasicSalary' ):Value)) + Space(Len(oRecSet:Fields( 'EmpName' ):Value)+20) + "MOBILE ALLOWENCE :" ,;
Space(100),;
"LEAVE DAYS :" + AllTrim(str(oRecSet:Fields('NoOfLeaves' ):Value)) + Space(Len(oRecSet:Fields( 'EmpName' ):Value)+25) + "MOBILE BILL :" + AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value)),;
Space(100),;
"LEAVE DDN :" + AllTrim(str(oRecSet:Fields('LossOffPayAmt' ):Value)) + Space(Len(oRecSet:Fields( 'EmpName' ):Value)+25) + "ADDL MOBILE BILL :" + AllTrim(Str(oRecSet:Fields( 'MobileRecovery' ):Value));
Left;
GROUP ON oRecSet:Fields( 'EmpName' ):Value ;//Here Iam getting Error
FOOTER "Page Number: "+str(oReport:nPage,3);
CENTER ;
PREVIEW
COLUMN TITLE 'PARTICULARS' DATA "" CENTER SIZE 30 GRID
COLUMN TITLE 'EARNINGS' DATA oRecSet:Fields('BasicSalary' ):Value,;
oRecSet:Fields( 'Incentives' ):Value,;
oRecSet:Fields( 'TAAmt' ):Value ,;
"-",;
"-",;
"-",;
"-",;
"-" TOTAL SIZE 15 CENTER GRID
COLUMN TITLE 'DEDUCTIONS' DATA "-" ,;
"-",;
"-",;
oRecSet:Fields( 'TaxAmount' ):Value,;
oRecSet:Fields( 'PFAmount' ):Value,;
oRecSet:Fields( 'PfArrers' ):Value,;
oRecSet:Fields( 'SalaryAdvance' ):Value,;
oRecSet:Fields( 'MobileRecovery' ):Value TOTAL SIZE 15 CENTER GRID
// COLUMN TITLE 'TOAL SALARY' DATA oRecSet:Fields( 'TotalSalary' ):Value SIZE 10 CENTER GRID
oReport:SetTxtColor(nRGB(0,0,0),1)
oReport:lSeparator := .T.
oReport:CELLVIEW()
oReport:nTotalLine := RPT_SINGLELINE
oReport:oTITLE:afont[1] :={||3}
END REPORT
oReport:bSkip := { || oRecSet:MoveNext() }
oRecSet:MoveFirst()
ACTIVATE REPORT oReport WHILE ( ! oRecSet:Eof() ) ;
ON init(oReport:Say(0,"SALARY",,,oReport:nRow),;
oReport:Say(0,"INCENTIVE",,,oReport:nRow+100),;
oReport:Say(10,"TRAVELLING ALLOWENCE",,,oReport:nRow+200),oReport:Say(10,"INCOME TAX",,,oReport:nRow+300),;
oReport:Say(10,"PROVIDENT FUND",,,oReport:nRow+400),oReport:Say(10,"PROVIDENT FUND ARRERS",,,oReport:nRow+500),;
oReport:Say(10,"SALARY ADVANCE",,,oReport:nRow+600),oReport:Say(10,"MOBILE RECOVERY",,,oReport:nRow+700))
oRecSet:MoveFirst()
//ON STARTPAGE (StartPage(oReport), oReport:Say(10,"ghhhj",,,1060))
oDlg:END()
oFont1:END()
oFont2:END()
oFont3:END()
RETURN Nil