when data item has no value, it is not working?

when i select data according to responsibility center, it cannot show value. because when G/L entry table has value, it’s data item works. otherwise, it is not working.

it’s filter with responsibility center.

but i have value on general journal line table. i want to show posted and unposted value from g/L entry and general journal line table.

if one table has value and another has no value, it must show one table value.

help me to solve this issue?

OBJECT Report 50002 Daily Report
{
OBJECT-PROPERTIES
{
Date=16.11.11;
Time=18:11:57;
Modified=Yes;
Version List=Monir;
}
PROPERTIES
{
}
DATAITEMS
{
{ PROPERTIES
{
DataItemTable=Table17;
DataItemTableView=SORTING(Entry No.);
OnPreDataItem=BEGIN
totalcash_posted:=0;
totalcredit_posted:=0;
totalother_posted:=0;
IF ((StartDate <> 0D ) AND( EndDate <>0D)) THEN BEGIN
“G/L Entry”.SETRANGE(“Posting Date”,StartDate,EndDate);

END;

IF (ResponsibilityCenter<>’’) THEN BEGIN
“G/L Entry”.SETFILTER(“G/L Entry”.“Resposibility Center”,ResponsibilityCenter);
END;
END;

OnAfterGetRecord=BEGIN

//////////////Start of G/L Entry Amount Calculation

WITH “G/L Entry” DO BEGIN

IF “G/L Entry”.FIND(’-’) THEN BEGIN
REPEAT

IF (“G/L Entry”.Amount>0) THEN BEGIN
CASE “G/L Entry”.“Payment Method Code” OF
‘CASH’:
BEGIN

totalcash_posted:= totalcash_posted+“G/L Entry”.Amount;

END;

‘CREDCARD’:
BEGIN

totalcredit_posted:= totalcredit_posted+“G/L Entry”.Amount;

END;

END;
END;

UNTIL “G/L Entry”.NEXT<=0;

END;

END;

//////////////End of G/L Entry Amount Calculation
//START OF SALES INVOICE LINE.

IF ((StartDate <> 0D ) AND( EndDate <>0D)) THEN BEGIN
SalesInvLine.SETRANGE(“Posting Date”,StartDate,EndDate);

END;

IF (ResponsibilityCenter<>’’) THEN BEGIN

SalesInvLine.SETFILTER(SalesInvLine.“Responsibility Center”,ResponsibilityCenter);

END;

WITH SalesInvLine DO BEGIN

IF SalesInvLine.FIND(’-’) THEN BEGIN
REPEAT

totalcostamountSIn:=totalcostamountSIn+(SalesInvLine.“Unit Cost”*SalesInvLine.Quantity);

totalLinediscountSIn:=totalLinediscountSIn+SalesInvLine.“Line Discount %”;
totalInvdiscountSIn:=totalInvdiscountSIn+SalesInvLine.“Inv. Discount Amount”;

BeforeTotalamountInclVatSIn:= BeforeTotalamountInclVatSIn+SalesInvLine.“Amount Including VAT”;

UNTIL SalesInvLine.NEXT<=0;
END;
END;

IF ((StartDate <> 0D ) AND( EndDate <>0D)) THEN BEGIN
SLine.SETRANGE(SLine.“Shipment Date”,StartDate,EndDate);

END;

IF (ResponsibilityCenter<>’’) THEN BEGIN
SLine.SETFILTER(SLine.“Responsibility Center”,ResponsibilityCenter);
END;

WITH SLine DO BEGIN

IF SLine.FIND(’-’) THEN BEGIN
REPEAT

IF (SLine.“Document Type”= “Document Type”::Order) THEN BEGIN

totalcostamountSL:=totalcostamountSL+(SLine.Quantity*SLine.“Unit Cost”);

totalLinediscountSL:=totalLinediscountSL+SLine.“Line Discount %”;
totalInvdiscountSL:=totalInvdiscountSL+SLine.“Inv. Discount Amount”;

BeforeTotalamountInclVatSl:= BeforeTotalamountInclVatSl+SLine.“Amount Including VAT”;
END;
UNTIL SLine.NEXT<=0;
END;
END;

///////////////////////////////// Start of General Journal Line
IF ((StartDate <> 0D ) AND( EndDate <>0D)) THEN BEGIN
GLine.SETRANGE(“Posting Date”,StartDate,EndDate);

END;

IF (ResponsibilityCenter<>’’) THEN BEGIN
GLine.SETFILTER(GLine.“Resposibility Center”,ResponsibilityCenter);
END;

WITH GLine DO BEGIN

IF GLine.FIND(’-’) THEN BEGIN

REPEAT

IF( GLine.Amount>0) THEN BEGIN

CASE GLine.“Payment Method Code” OF
‘CASH’:
BEGIN

totalcash_unposted:= totalcash_unposted+GLine.Amount;

END;

‘CREDCARD’:
BEGIN

totalcredit_unposted:= totalcredit_unposted+GLine.Amount;

END;
END;

END;

UNTIL GLine.NEXT<=0;

END;

END;

///////////////////////////////// End of General Journal Line

IF ((StartDate <> 0D ) AND( EndDate <>0D)) THEN BEGIN
SaleH.SETRANGE(“Posting Date”,StartDate,EndDate);

END;

IF (ResponsibilityCenter<>’’) THEN BEGIN
SaleH.SETFILTER( SaleH.“Responsibility Center”,ResponsibilityCenter);
END;

/////////////Start of Sales Header
WITH SaleH DO BEGIN

REPEAT

IF(SaleH.“Transportation Fee”>0) THEN BEGIN

totaltransporation_unpostedH:= totaltransporation_unpostedH+SaleH.“Transportation Fee”;

END;

IF (SaleH.“Construction Fee”>0) THEN BEGIN
totalinstallation_unpostedH:= totalinstallation_unpostedH+SaleH.“Construction Fee”;
END;

UNTIL SaleH.NEXT<=0;

// END OF WITH
END;

//////////////Sales InVoice Header
IF ((StartDate <> 0D ) AND( EndDate <>0D)) THEN BEGIN
SaleInH.SETRANGE(“Posting Date”,StartDate,EndDate);

END;

IF (ResponsibilityCenter<>’’) THEN BEGIN
SaleInH.SETFILTER( SaleInH.“Responsibility Center”,ResponsibilityCenter);
END;

WITH SaleInH DO BEGIN
REPEAT

IF(SaleInH.“Transportation Fee”>0) THEN BEGIN

totaltransportation_postedH:= totaltransportation_postedH+SaleInH.“Transportation Fee”;

END;

IF