OBJECT Report 50026 Leave Computation { OBJECT-PROPERTIES { Date=21/02/08; Time=18:30:54; Modified=Yes; Version List=; } PROPERTIES { } DATAITEMS { { PROPERTIES { DataItemTable=Table5200; OnAfterGetRecord=BEGIN Cats.GET(Catagory); EmpName :="First Name" + Space + "Middle Name" + Space + "Last Name"; // Testing Below //Cats.GET(Employee.Catagory); //"Employee Absence".SETRANGE("Employee No.",Employee."No."); //Cats.SETRANGE(Catagories, Employee.Catagory); RemLeave := Cats."Leave entitle"; AnnLeave := 0; //IF "Employee Absence".FIND('-') //THEN BEGIN //AnnLeave := "Employee Absence".Quantity; //IF "Employee Absence".NEXT <> 0 //THEN REPEAT //AnnLeave := AnnLeave + "Employee Absence".Quantity; //UNTIL "Employee Absence".NEXT = 0; //RemLeave := Cats."Leave entitle" - "Employee Absence".Quantity; //END //ELSE BEGIN //RemLeave := Cats."Leave entitle"; //AnnLeave := 0; //END; {IF empAbse.FIND('-') THEN BEGIN AnnLeave := empAbse.Quantity; IF empAbse.NEXT <> 0 THEN REPEAT AnnLeave := AnnLeave + empAbse.Quantity; UNTIL empAbse.NEXT = 0; RemLeave := Cats."Leave entitle" - AnnLeave; END ELSE BEGIN RemLeave := Cats."Leave entitle"; AnnLeave := 0; END;} // Updating RemLeave and AnnLeave on Employee Table. {Employee.RemLeave := RemLeave; Employee.AnnLeave := AnnLeave; Employee.MODIFY();} END; } SECTIONS { { PROPERTIES { SectionType=Header; SectionWidth=17250; SectionHeight=2115; } CONTROLS { { 1000000011;Label ;1500 ;1269 ;9150 ;423 ;FontSize=12; FontBold=Yes; CaptionML=ENU=STAFF LEAVE COMPUTATION REPORT } { 1000000016;TextBox;12150;0 ;3750 ;423 ;HorzAlign=Right; SourceExpr=FORMAT(TODAY,0,4) } { 1000000018;TextBox;13050;846 ;2850 ;423 ;HorzAlign=Right; SourceExpr=USERID } { 1000000015;TextBox;0 ;0 ;1800 ;423 ;SourceExpr=COMPANYNAME } { 1000000017;TextBox;14400;423 ;1500 ;423 ;SourceExpr=CurrReport.PAGENO } { 1000000019;Label ;12900;423 ;1500 ;423 ;HorzAlign=Right; CaptionML=ENU=Page } } } { PROPERTIES { SectionType=Body; SectionWidth=17250; SectionHeight=1269; } CONTROLS { { 1000000014;Label ;0 ;0 ;2250 ;423 ;FontSize=9; FontBold=Yes; CaptionML=ENU=Employee No.: } { 1000000000;TextBox;2250 ;0 ;1350 ;423 ;FontSize=8; SourceExpr=Employee."No." } { 1000000005;Label ;3900 ;0 ;1200 ;423 ;FontSize=9; FontBold=Yes; CaptionML=ENU=Name: } { 1000000002;TextBox;5250 ;0 ;6900 ;423 ;FontSize=8; SourceExpr=EmpName } { 1000000006;Label ;0 ;423 ;1650 ;423 ;FontSize=9; FontBold=Yes; CaptionML=ENU=Category: } { 1000000001;TextBox;1800 ;423 ;900 ;423 ;HorzAlign=Left; FontSize=8; SourceExpr=Employee.Catagory } { 1000000003;Label ;2850 ;423 ;2550 ;423 ;FontSize=8; FontBold=Yes; CaptionML=ENU=Leave Entitle To } { 1000000007;TextBox;5550 ;423 ;1500 ;423 ;HorzAlign=Left; FontSize=8; SourceExpr=RemLeave } } } } } { PROPERTIES { DataItemIndent=1; DataItemTable=Table5207; OnAfterGetRecord=BEGIN //Cats.GET(Employee.Catagory); empAbse.SETRANGE("Employee No.",Employee."No."); empAbse.SETRANGE(Deductible,TRUE); Cats.SETRANGE(Catagories, Employee.Catagory); IF empAbse.FIND('-') THEN BEGIN AnnLeave := empAbse.Quantity; IF empAbse.NEXT <> 0 THEN REPEAT AnnLeave := AnnLeave + empAbse.Quantity; UNTIL empAbse.NEXT = 0; RemLeave := Cats."Leave entitle" - AnnLeave; END ELSE BEGIN RemLeave := Cats."Leave entitle"; AnnLeave := 0; END; // Updating RemLeave and AnnLeave on Employee Table. empAbse.Quantity := RLeave; //Employee.AnnLeave := ALeave; Employee.MODIFY(); END; DataItemLink=Employee No.=FIELD(No.); } SECTIONS { { PROPERTIES { SectionType=Header; SectionWidth=17250; SectionHeight=423; } CONTROLS { { 1000000020;Label ;0 ;0 ;1350 ;423 ;HorzAlign=Left; FontBold=Yes; CaptionML=ENU=From Date: } { 1000000022;Label ;1350 ;0 ;1050 ;423 ;HorzAlign=Left; FontBold=Yes; CaptionML=ENU=To Date: } { 1000000024;Label ;2850 ;0 ;2100 ;423 ;HorzAlign=Left; FontBold=Yes; CaptionML=ENU=Cause of Absence: } { 1000000026;Label ;6150 ;0 ;5850 ;423 ;HorzAlign=Left; FontBold=Yes; CaptionML=ENU=Description: } { 1000000028;Label ;13350;0 ;1800 ;423 ;HorzAlign=Left; FontBold=Yes; CaptionML=ENU=No. of days: } { 1000000031;Label ;15150;0 ;1500 ;423 ;HorzAlign=Left; FontBold=Yes; CaptionML=ENU=Deductible } } } { PROPERTIES { SectionType=Body; SectionWidth=17250; SectionHeight=846; } CONTROLS { { 1000000004;TextBox;0 ;0 ;1200 ;423 ;HorzAlign=Left; SourceExpr="From Date" } { 1000000021;TextBox;1200 ;0 ;1200 ;423 ;HorzAlign=Left; SourceExpr="To Date" } { 1000000023;TextBox;2850 ;0 ;2700 ;423 ;HorzAlign=Left; SourceExpr="Cause of Absence Code" } { 1000000025;TextBox;6150 ;0 ;6450 ;423 ;HorzAlign=Left; SourceExpr=Description } { 1000000027;TextBox;13350;0 ;1800 ;423 ;HorzAlign=Left; SourceExpr=Quantity } { 1000000029;TextBox;15150;0 ;1500 ;423 ;HorzAlign=Left; SourceExpr=Deductible } } } { PROPERTIES { SectionType=Footer; SectionWidth=17250; SectionHeight=1269; } CONTROLS { { 1000000009;Label ;0 ;0 ;3150 ;423 ;FontSize=9; FontBold=Yes; CaptionML=ENU=Annual Leave Taken: } { 1000000010;TextBox;3150 ;0 ;1050 ;423 ;HorzAlign=Left; FontSize=8; SourceExpr=AnnLeave } { 1000000012;Label ;4200 ;0 ;3900 ;423 ;HorzAlign=Left; FontSize=9; FontBold=Yes; CaptionML=ENU=Annual Leave Remaining: } { 1000000013;TextBox;8100 ;0 ;1050 ;423 ;HorzAlign=Left; FontSize=8; SourceExpr=RemLeave } { 1000000008;TextBox;0 ;423 ;17250;423 ;HorzAlign=Left; FontSize=9; FontBold=Yes; SourceExpr=Line2 } } } } } } REQUESTFORM { PROPERTIES { Width=9020; Height=3410; } CONTROLS { } } CODE { VAR Space@1000000001 : TextConst 'ENU=" "'; Cats@1000000000 : Record 50025; RemLeave@1000000002 : Integer; EmpName@1000000003 : Text[180]; AnnLeave@1000000004 : Integer; Line1@1000000005 : TextConst 'ENU=......................................................................................................................................................'; Line2@1000000006 : TextConst 'ENU=------------------------------------------------------------------------------------------------------------------------------------------------------'; DedOption@1000000007 : Boolean; empAbse@1000000008 : Record 5207; RLeave@1000000009 : Integer; ALeave@1000000010 : Integer; BEGIN END. } }Thanks.