i have done a bill format report.but the "Header alignment "is not in right way.because of space adjustment.
Code: Select all | Expand
HEADER " ",;//problem "Header alignment "is not in right way.
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
"Name : "+ AllTrim(oRecSet:Fields( 'EmpName' ):Value) + Space(40+(12-Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value)))) +"Designation : " + oRecSet:Fields( 'Department' ):Value , ;
Space(100),;
"Mobile Bill : " + AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value)) +Space(Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value))-Len(AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value))))+ Space(52+(4-Len(AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value))))) + "Mobile Allowence : " + AllTrim(Str(oRecSet:Fields( 'MobAllownce' ):Value)) ,;
Space(100),;
"Leave Days : " + AllTrim(str(oRecSet:Fields('NoOfLeaves' ):Value))+Space(Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value))-Len(AllTrim(str(oRecSet:Fields('NoOfLeaves' ):Value)))) + Space(52)+ "Leave DDN : " + AllTrim(str(oRecSet:Fields('LossOffPayAmt' ):Value)),;
Space(100),;
"Date : " +AllTrim(DToC( oRecSet:Fields( 'PayDate' ):Value))+Space(Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value))-(Len(AllTrim(DToC( oRecSet:Fields( 'PayDate' ):Value))))) + Space(43)+ "Account No : " + AllTrim(oRecSet:Fields('AccountNo' ):Value);
PREVIEW
Full Code view.
Code: Select all | Expand
//------------------------------------------------------------------------------
FUNCTION GenEmpPaySlipBill(oRecSet,oDlg)
//------------------------------------------------------------------------------
LOCAL cIniFile :="Ini\FontForRpt.INI"
LOCAL oReport,oFont1, oFont2, oFont3, oPen1, oPen2,nTotal,oPrn
DEFINE FONT oFont1 NAME "ARIAL" SIZE 0,Val(AllTrim(GETPVPROFSTRING( "FONT(PaySlipBill)","FontSize" , "", cIniFile))) BOLD
DEFINE FONT oFont2 NAME "ARIAL" SIZE 0,-17 BOLD
DEFINE FONT oFont3 NAME "ARIAL" SIZE 0,-12 BOLD
DEFINE PEN oPen1 WIDTH Val(AllTrim(GETPVPROFSTRING( "PEN1","WIDTH" , "", cIniFile))) COLOR 12632256
//DEFINE PEN oPen2 WIDTH 1 COLOR CLR_HMAGENTA
oPrn:=TPrinter():New()
REPORT oReport ;
TITLE " " ;
CENTERED;
FONT oFont1,oFont2 ;
PEN oPen1 ;
HEADER " ",;//problem "Header alignment "is not in right way.
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
Space(100),;
"Name : "+ AllTrim(oRecSet:Fields( 'EmpName' ):Value) + Space(40+(12-Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value)))) +"Designation : " + oRecSet:Fields( 'Department' ):Value , ;
Space(100),;
"Mobile Bill : " + AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value)) +Space(Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value))-Len(AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value))))+ Space(52+(4-Len(AllTrim(Str(oRecSet:Fields( 'MobileBill' ):Value))))) + "Mobile Allowence : " + AllTrim(Str(oRecSet:Fields( 'MobAllownce' ):Value)) ,;
Space(100),;
"Leave Days : " + AllTrim(str(oRecSet:Fields('NoOfLeaves' ):Value))+Space(Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value))-Len(AllTrim(str(oRecSet:Fields('NoOfLeaves' ):Value)))) + Space(52)+ "Leave DDN : " + AllTrim(str(oRecSet:Fields('LossOffPayAmt' ):Value)),;
Space(100),;
"Date : " +AllTrim(DToC( oRecSet:Fields( 'PayDate' ):Value))+Space(Len(AllTrim(oRecSet:Fields( 'EmpName' ):Value))-(Len(AllTrim(DToC( oRecSet:Fields( 'PayDate' ):Value))))) + Space(43)+ "Account No : " + AllTrim(oRecSet:Fields('AccountNo' ):Value);
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 ,;
oRecSet:Fields('DAAmt' ):Value ,;
oRecSet:Fields('HRAAmt' ):Value ,;
oRecSet:Fields('OtherAdditions' ):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,;
oRecSet:Fields( 'LossOffPayAmt' ):Value,;
oRecSet:Fields( 'InsuranceAmt' ):Value,;
oRecSet:Fields( 'OtherDeduction' ):Value TOTAL SIZE 15 CENTER GRID
oReport:SetTxtColor(nRGB(0,0,0),1)
oReport:lSeparator := .T.
oReport:CELLVIEW()
nTotal:=(oRecSet:Fields('BasicSalary' ):Value+oRecSet:Fields('Incentives' ):Value+oRecSet:Fields('TAAmt' ):Value+;
oRecSet:Fields('DAAmt' ):Value+oRecSet:Fields('HRAAmt' ):Value+;
oRecSet:Fields('OtherAdditions' ):Value)-;
( oRecSet:Fields( 'TaxAmount' ):Value+oRecSet:Fields( 'PFAmount' ):Value+;
oRecSet:Fields( 'PfArrers' ):Value+ oRecSet:Fields( 'SalaryAdvance' ):Value+;
oRecSet:Fields( 'MobileRecovery' ):Value+oRecSet:Fields('LossOffPayAmt' ):Value+;
oRecSet:Fields( 'InsuranceAmt' ):Value+oRecSet:Fields( 'OtherDeduction' ):Value)
oReport:SayBitmap(0.1, oReport:PhyWidth() - 2.2, "Icons\rptlogo.bmp", 2, 0.6)
nHorz := oPrn:nHorzRes()
nVert := oPrn:nVertRes()
// oReport:aFont[1]:ninpWidth=10
// oReport:aFont[1]:ninpHeight=20
oReport:nTopMargin:=18
END REPORT
oReport:bSkip := { || oRecSet:MoveNext() }
oReport:bPostGroup:={|| oReport:newLine() }
oRecSet:MoveFirst()
oReport:bPostPage :={|| Print( oReport,nTotal ) }
ACTIVATE REPORT oReport WHILE ( ! oRecSet:Eof());
ON init(oReport:Say(0,"Basic Salary",,,oReport:nRow),;
oReport:Say(0,"Incentives",,,oReport:nRow+ oReport:afont[1]:nInpHeight),;
oReport:Say(10,"Travelling Allowence",,,oReport:nRow+(oReport:afont[1]:nInpHeight*2)),oReport:Say(10,"DA",,,oReport:nRow+(oReport:afont[1]:nInpHeight*3)),;
oReport:Say(10,"HRA",,,oReport:nRow+(oReport:afont[1]:nInpHeight*4)) ,oReport:Say(10,"Other Additions",,,oReport:nRow+(oReport:afont[1]:nInpHeight*5)) ,;
oReport:Say(10,"Income Tax",,,oReport:nRow+(oReport:afont[1]:nInpHeight*6)),;
oReport:Say(10,"Provident Fund",,,oReport:nRow+(oReport:afont[1]:nInpHeight*7)),oReport:Say(10,"Provident Fund Arrers",,,oReport:nRow+(oReport:afont[1]:nInpHeight*8)),;
oReport:Say(10,"Salary Advance",,,oReport:nRow+(oReport:afont[1]:nInpHeight*9)),oReport:Say(10,"Mobile Recovery",,,oReport:nRow+(oReport:afont[1]:nInpHeight*10)),;
oReport:Say(10,"Loss of Pay Amount",,,oReport:nRow+(oReport:afont[1]:nInpHeight*11)),oReport:Say(10,"Insurance Amount",,,oReport:nRow+(oReport:afont[1]:nInpHeight*12)),;
oReport:Say(10,"Other Deduction",,,oReport:nRow+(oReport:afont[1]:nInpHeight*13)),oReport:SayBitmap(1.7,1, "Icons\RegLogo1.bmp",1.2,0.5),;
oReport:Say(15," xxxxxxxxxxx(India) Pvt Ltd",2,,oReport:nTitleUpLine + (oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight)),;
oReport:newline(),oReport:Say(25," xxxxxx",2,,oReport:nTitleUpLine + (oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight+oReport:afont[2]:nInpHeight)) )
oRecSet:MoveFirst()
oDlg:END()
oFont1:END()
oFont2:END()
oFont3:END()
RETURN Nil