HI
I have to create report showing quantity of items from item ledger entry(entry type = purchase) weekwise, monthwise, yearwise.
In request form i cretaed three option buttons like week, month, year.. and date filter.
using date functions, i write code like..
On predataitem
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Entry Type","Item Ledger Entry"."Entry Type"::Purchase);
weektemp := DATE2DWY(datefilter,2);
monthtemp := DATE2DMY(datefilter,2);
yeartemp := DATE2DMY(datefilter,3);
On afterget record
weektemp1 := DATE2DWY("Item Ledger Entry"."Posting Date",2);
monthtemp1 := DATE2DMY("Item Ledger Entry"."Posting Date",2);
yeartemp1 := DATE2DMY("Item Ledger Entry"."Posting Date",3);
and created three (body) sections
IF ((monthtemp1 = monthtemp) AND (test = 2))
THEN
CurrReport.SHOWOUTPUT(TRUE)
ELSE
CurrReport.SHOWOUTPUT(FALSE);
this is working! but items are repeating as like ledger entry,
i dont want like that, and for repeating items, one item and total quantity should be shown in report.
i tried grouping, by putting item and quantity in groupfooter, and same code as in body section.. still its not working.. pls give me suggestion that items should not repeat in my report and quantity should be the total of such repeating items
Thanks
Gopal
0
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
{
OBJECT-PROPERTIES
{
Date=05/21/09;
Time=[ 5:29:33 PM];
Modified=Yes;
Version List=;
}
PROPERTIES
{
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table32;
DataItemTableView=SORTING(Item No.);
OnPreDataItem=BEGIN
compinfo.GET;
"Item Ledger Entry".SETRANGE("Item Ledger Entry"."Entry Type","Item Ledger Entry"."Entry Type"::Purchase);
weektemp := DATE2DWY(datefilter,2);
monthtemp := DATE2DMY(datefilter,2);
yeartemp := DATE2DMY(datefilter,3);
END;
OnAfterGetRecord=BEGIN
{IF (check1 = TRUE) OR (check2 = TRUE) OR (check3 = TRUE)THEN
"Item Ledger Entry".Quantity := 0; }
weektemp1 := DATE2DWY("Item Ledger Entry"."Posting Date",2);
monthtemp1 := DATE2DMY("Item Ledger Entry"."Posting Date",2);
yeartemp1 := DATE2DMY("Item Ledger Entry"."Posting Date",3);
itemrec.SETRANGE(itemrec."No.","Item No.");
IF itemrec.FINDFIRST THEN
desc := itemrec.Description;
END;
TotalFields=Quantity;
GroupTotalFields=Item No.;
}
SECTIONS
{
{ PROPERTIES
{
SectionType=Header;
SectionWidth=11700;
SectionHeight=1269;
}
CONTROLS
{
{ 1000000000;TextBox;8250 ;0 ;3150 ;423 ;HorzAlign=Right;
FontSize=8;
FontBold=Yes;
SourceExpr=FORMAT(TODAY,0,4) }
{ 1000000005;TextBox;9150 ;846 ;2250 ;423 ;HorzAlign=Right;
FontSize=8;
FontBold=Yes;
SourceExpr=USERID }
{ 1000000006;Label ;10200;423 ;750 ;423 ;FontSize=8;
FontBold=Yes }
{ 1000000007;TextBox;0 ;0 ;7650 ;846 ;FontSize=11;
FontBold=Yes;
MultiLine=Yes;
SourceExpr=compinfo.Name }
}
}
{ PROPERTIES
{
SectionType=Header;
SectionWidth=11700;
SectionHeight=846;
}
CONTROLS
{
{ 1000000001;Label ;1350 ;0 ;2100 ;423 ;VertAlign=Bottom;
FontSize=9;
FontBold=Yes;
MultiLine=Yes;
CaptionML=ENU=Item No }
{ 1000000003;Label ;9150 ;0 ;1800 ;423 ;HorzAlign=Right;
VertAlign=Bottom;
FontSize=9;
FontBold=Yes;
MultiLine=Yes;
CaptionML=ENU=Quantity }
{ 1000000002;Shape ;0 ;700 ;11700;50 ;ShapeStyle=HorzLine }
{ 1000000017;Label ;4350 ;0 ;4050 ;423 ;VertAlign=Bottom;
FontSize=9;
FontBold=Yes;
MultiLine=Yes;
CaptionML=ENU=Description }
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=11700;
SectionHeight=0;
OnPreSection=BEGIN
IF ((monthtemp1 = monthtemp) AND (test = 2))
THEN
check2 := TRUE;
END;
}
CONTROLS
{
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=11700;
SectionHeight=0;
OnPreSection=BEGIN
IF ((yeartemp1 = yeartemp) AND (test = 3))
THEN
check3 := TRUE;
END;
}
CONTROLS
{
}
}
{ PROPERTIES
{
SectionType=Body;
SectionWidth=11700;
SectionHeight=0;
OnPreSection=BEGIN
IF ((weektemp1 = weektemp) AND (test = 1))
THEN
check1 := TRUE;
END;
}
CONTROLS
{
}
}
{ PROPERTIES
{
SectionType=GroupFooter;
SectionWidth=11700;
SectionHeight=423;
OnPreSection=BEGIN
IF check1 = TRUE THEN
CurrReport.SHOWOUTPUT(TRUE)
ELSE
CurrReport.SHOWOUTPUT(FALSE);
END;
}
CONTROLS
{
{ 1000000004;TextBox;1200 ;0 ;2100 ;423 ;FontSize=9;
SourceExpr="Item No." }
{ 1000000008;TextBox;4200 ;0 ;4200 ;423 ;FontSize=9;
SourceExpr=desc }
{ 1000000011;TextBox;9150 ;0 ;1800 ;423 ;FontSize=9;
SourceExpr=Quantity }
}
}
{ PROPERTIES
{
SectionType=GroupFooter;
SectionWidth=11700;
SectionHeight=423;
OnPreSection=BEGIN
IF check2 = TRUE
THEN
CurrReport.SHOWOUTPUT(TRUE) ELSE
CurrReport.SHOWOUTPUT(FALSE);
END;
}
CONTROLS
{
{ 1000000013;TextBox;9150 ;0 ;1800 ;423 ;FontSize=9;
SourceExpr=Quantity }
{ 1000000014;TextBox;1200 ;0 ;2100 ;423 ;FontSize=9;
SourceExpr="Item No." }
{ 1000000009;TextBox;4200 ;0 ;4200 ;423 ;FontSize=9;
SourceExpr=desc }
}
}
{ PROPERTIES
{
SectionType=GroupFooter;
SectionWidth=11700;
SectionHeight=423;
OnPreSection=BEGIN
IF check3 = TRUE
THEN
CurrReport.SHOWOUTPUT(TRUE) ELSE
CurrReport.SHOWOUTPUT(FALSE);
END;
}
CONTROLS
{
{ 1000000015;TextBox;9150 ;0 ;1800 ;423 ;FontSize=9;
SourceExpr=Quantity }
{ 1000000016;TextBox;1200 ;0 ;2100 ;423 ;FontSize=9;
SourceExpr="Item No." }
{ 1000000010;TextBox;4200 ;0 ;4200 ;423 ;FontSize=9;
SourceExpr=desc }
}
}
}
}
}
REQUESTFORM
{
PROPERTIES
{
Width=6710;
Height=3410;
}
CONTROLS
{
{ 1000000006;TextBox;3410 ;2090 ;1700 ;440 ;InPage=-1;
SourceExpr=[datefilter ] }
{ 1000000007;Label ;0 ;2090 ;3300 ;440 ;ParentControl=1000000006;
InPage=-1 }
{ 1000000000;OptionButton;110;220;3740;440 ;InPage=-1;
SourceExpr=test;
OptionValue=week }
{ 1000000001;OptionButton;110;770;3740;440 ;InPage=-1;
SourceExpr=test;
OptionValue=month }
{ 1000000002;OptionButton;110;1430;3740;440 ;InPage=-1;
SourceExpr=test;
OptionValue=year }
}
}
CODE
{
VAR
test@1000000000 : ',week,month,year';
datefilter@1000000003 : Date;
yeartemp@1000000004 : Integer;
weektemp@1000000005 : Integer;
monthtemp@1000000006 : Integer;
yeartemp1@1000000007 : Integer;
weektemp1@1000000008 : Integer;
monthtemp1@1000000009 : Integer;
compinfo@1000000001 : Record 79;
desc@1000000002 : Text[250];
itemrec@1000000010 : Record 27;
check1@1000000011 : Boolean;
check2@1000000012 : Boolean;
check3@1000000013 : Boolean;
BEGIN
END.
}
}
place in between them
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
check1 is just boolean, here im showing only for weekwise..
test is option variable.. week, month, year
report is running fine in my system?
where u are getting problem?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
pls check.. did u modify any in my report? and send the report u r using to gopalakrishnan.nagendran@yahoo.com