how to modify code unit 12 to post BED Amount in particular GL No.

Hi All,

I am trying to post value of “BED Amount” field of purchase line table in particular GL No. of GL Entry table in same manner as currently “ADC VAT Amount” value posting from purchase line table to particular GL No. of GL Entry table. So i modified below function of code unit 12 as per below code but at the time of purchase inv posting system displaying inconsistent error

PostExcise(GenJnlLine : Record “Gen. Journal Line”)

WITH GenJnlLine DO BEGIN

IF “Excise Amount” <> 0 THEN BEGIN

IF “Gen. Posting Type” = “Gen. Posting Type”::Purchase THEN BEGIN

ExcisePostingSetup.SETRANGE(“Excise Bus. Posting Group”,“Excise Bus. Posting Group”);

ExcisePostingSetup.SETRANGE(“Excise Prod. Posting Group”,“Excise Prod. Posting Group”);

ExcisePostingSetup.SETRANGE(“From Date”,0D,GenJnlLine.“Posting Date”);

IF ExcisePostingSetup.FIND(’+’) THEN

IF ((“Account Type” = “Account Type”::“Fixed Asset”) OR

((“Account Type” = “Account Type”::“G/L Account”) AND (“Capital Item”)))

THEN BEGIN

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. Receivable Account”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. Receivable Account”,

ROUND(((“Excise Amount” - “ADC VAT Amount”)/2) + “ADC VAT Amount”),

ROUND(((“Source Curr. Excise Amount” - “Source Curr. ADC VAT Amount”)/2) + “Source Curr. ADC VAT Amount”),

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. Receivable Account”); //to separate bed amount

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. Receivable Account”,

ROUND(((“Excise Amount” - “BED Amount”)/2) + “BED Amount”),

ROUND(((“Source Curr. Excise Amount” - “Source Curr. BED Amount”)/2) + “Source Curr. BED Amount”),

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup.“Cenvat Cr. Receivable Account”,FALSE);

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. (Deferred) Account”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. (Deferred) Account”,

(“Excise Amount” - ROUND(((“Excise Amount”-“ADC VAT Amount”)/ 2) + “ADC VAT Amount”)),

(“Source Curr. Excise Amount” - ROUND(((“Source Curr. Excise Amount” - “Source Curr. ADC VAT Amount”)/2) +

“Source Curr. ADC VAT Amount”)), TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup.“Cenvat Cr. Receivable Account”,FALSE); // to separate bed amount

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. (Deferred) Account”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. (Deferred) Account”,

(“Excise Amount” - ROUND(((“Excise Amount”-“BED Amount”)/ 2) + “BED Amount”)),

(“Source Curr. Excise Amount” - ROUND(((“Source Curr. Excise Amount” - “Source Curr. BED Amount”)/2) +

“Source Curr. BED Amount”)), TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup.“Cenvat Cr. (Deferred) Account”,TRUE);

END ELSE BEGIN

IF NOT Trading THEN BEGIN

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. Receivable Account”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. Receivable Account”,“Excise Amount”,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExcise(GenJnlLine,ExcisePostingSetup.“Cenvat Cr. Receivable Account”);

END ELSE BEGIN

IF “Sales Return Order” THEN BEGIN

ExcisePostingSetup.TESTFIELD(“Cenvat Transfered(Trading)”);

InitGLEntry(ExcisePostingSetup.“Cenvat Transfered(Trading)”,“Excise Amount”,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END ELSE BEGIN

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. Receivable(Trading)”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. Receivable(Trading)”,“Excise Amount” ,

“Source Curr. Excise Amount”,TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

IF “ADC VAT Amount” <> 0 THEN BEGIN

InitGLEntry(ExcisePostingSetup.“ADC VAT Account”,“ADC VAT Amount”

+“ADC VAT AmountClained”

,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END;

IF “BED Amount” <> 0 THEN BEGIN // to separate bed amount

InitGLEntry(ExcisePostingSetup.“BED Account”,“BED Amount”

,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END;

END;

InsertExcise(GenJnlLine,ExcisePostingSetup.“Cenvat Cr. Receivable(Trading)”);

END;

END;

END;

IF “Gen. Posting Type” = “Gen. Posting Type”::Sale THEN BEGIN

ExcisePostingSetup.SETRANGE(“Excise Bus. Posting Group”,“Excise Bus. Posting Group”);

ExcisePostingSetup.SETRANGE(“Excise Prod. Posting Group”,“Excise Prod. Posting Group”);

ExcisePostingSetup.SETRANGE(“From Date”,0D,GenJnlLine.“Posting Date”);

IF ExcisePostingSetup.FIND(’+’) THEN BEGIN

IF “Document Type” = “Document Type” ::“Credit Memo” THEN BEGIN

IF (“Account Type” = “Account Type”::“Fixed Asset”) OR ((“Account Type” = “Account Type”::“G/L Account”) AND

(“Capital Item”))

THEN BEGIN

ExcisePostingSetup.TESTFIELD(“Excise Payable Account”);

InitGLEntry(ExcisePostingSetup.“Excise Payable Account”,

ROUND(((“Excise Amount” - “ADC VAT Amount”)/2) + “ADC VAT Amount”),

ROUND(((“Source Curr. Excise Amount” - “Source Curr. ADC VAT Amount”)/2) + “Source Curr. ADC VAT Amount”),

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

ExcisePostingSetup.TESTFIELD(“Excise Payable Account”); // to separate bed amount

InitGLEntry(ExcisePostingSetup.“Excise Payable Account”,

ROUND(((“Excise Amount” - “BED Amount”)/2) + “BED Amount”),

ROUND(((“Source Curr. Excise Amount” - “Source Curr. BED Amount”)/2) + “Source Curr. BED Amount”),

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup.“Excise Payable Account”,FALSE);

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. (Deferred) Account”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. (Deferred) Account”,

(“Excise Amount” - ROUND(((“Excise Amount”-“ADC VAT Amount”)/ 2) + “ADC VAT Amount”)),

(“Source Curr. Excise Amount” - ROUND(((“Source Curr. Excise Amount” - “Source Curr. ADC VAT Amount”)/2) +

“Source Curr. ADC VAT Amount”)), TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup.“Excise Payable Account”,FALSE); //separate bed

ExcisePostingSetup.TESTFIELD(“Cenvat Cr. (Deferred) Account”);

InitGLEntry(ExcisePostingSetup.“Cenvat Cr. (Deferred) Account”,

(“Excise Amount” - ROUND(((“Excise Amount”-“BED Amount”)/ 2) + “BED Amount”)),

(“Source Curr. Excise Amount” - ROUND(((“Source Curr. Excise Amount” - “Source Curr. BED Amount”)/2) +

“Source Curr. BED Amount”)), TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExciseforCapitalItems(GenJnlLine,ExcisePostingSetup.“Cenvat Cr. (Deferred) Account”,TRUE);

END ELSE BEGIN

IF NOT Trading THEN BEGIN

ExcisePostingSetup.TESTFIELD(“Excise Payable Account”);

InitGLEntry(ExcisePostingSetup.“Excise Payable Account”,“Excise Amount”,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExcise(GenJnlLine,ExcisePostingSetup.“Excise Payable Account”);

END ELSE BEGIN

ExcisePostingSetup.TESTFIELD(“Cenvat Transfered(Trading)”);

InitGLEntry(ExcisePostingSetup.“Cenvat Transfered(Trading)”,“Excise Amount”,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExcise(GenJnlLine,ExcisePostingSetup.“Cenvat Transfered(Trading)”);

END;

END;

END ELSE BEGIN

IF NOT Trading THEN BEGIN

ExcisePostingSetup.TESTFIELD(“Excise Payable Account”);

InitGLEntry(ExcisePostingSetup.“Excise Payable Account”,“Excise Amount”,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InsertExcise(GenJnlLine,ExcisePostingSetup.“Excise Payable Account”);

END ELSE BEGIN

ExcisePostingSetup.TESTFIELD(“Cenvat Transfered(Trading)”);

InitGLEntry(ExcisePostingSetup.“Cenvat Transfered(Trading)”,“Excise Amount”,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InitGLEntry(ExcisePostingSetup.“ADC VAT Account”,-(ABS(ROUND(“ADC VAT Amount”)))

+ABS(ROUND(“ADC VAT AmountClained”)),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InitGLEntry(ExcisePostingSetup.“BED Account”,-(ABS(ROUND(“BED Amount”))) // to separate bed amount

,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

IF GenJnlLine.“SED PASS” THEN BEGIN

InitGLEntry(ExcisePostingSetup.“Custom Duty Account”,+(ABS((ROUND(“ADC VAT Amount”)))

+ABS(ROUND(“ADC VAT AmountClained”))),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END

ELSE

BEGIN

IF GenJnlLine.“ADC VAT AmountClained” <> 0 THEN BEGIN

InitGLEntry(ExcisePostingSetup.“ADC Claim A/c”,+(ABS(ROUND(“ADC VAT AmountClained”))),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

{InitGLEntry(ExcisePostingSetup.“ADC Lapse A/c”,-((ROUND(“ADC VAT Amount”))),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE); }

END;

InitGLEntry(ExcisePostingSetup.“ADC Refund Due”,+((ABS(ROUND(“ADC VAT Amount”)))),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END;

InsertExcise(GenJnlLine,ExcisePostingSetup.“Cenvat Transfered(Trading)”);

END;

END;

END;

END;

END

ELSE

BEGIN

ExPostingGrp.SETRANGE(“Excise Bus. Posting Group”,“Excise Bus. Posting Group”);

ExPostingGrp.SETRANGE(“Excise Prod. Posting Group”,“Excise Prod. Posting Group”);

ExPostingGrp.SETRANGE(“From Date”,0D,GenJnlLine.“Posting Date”);

IF ExPostingGrp.FIND(’-’) THEN

ExPostingGrp.TESTFIELD(“ADC VAT Account”);

ExPostingGrp.TESTFIELD(“BED Account”);

ExPostingGrp.TESTFIELD(“ADC Refund Due”);

ExPostingGrp.TESTFIELD(“ADC Claim A/c”);

ExPostingGrp.TESTFIELD(“Custom Duty Account”);

IF GenJnlLine.“ADC VAT AmountClained” <> 0 THEN

InitGLEntry(ExPostingGrp.“ADC VAT Account”,

-ABS(ABS(ROUND(“ADC VAT Amount”))+ABS(ROUND(“ADC VAT AmountClained”)))

,“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”)

ELSE

InitGLEntry(ExPostingGrp.“ADC VAT Account”,-ABS(ABS(ROUND(“ADC VAT Amount”)

)),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

InitGLEntry(ExPostingGrp.“BED Account”,-ABS(ABS(ROUND(“BED Amount”)

)),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

IF GenJnlLine.“SED PASS” THEN BEGIN

InitGLEntry(ExPostingGrp.“Custom Duty Account”,ABS(ROUND(“ADC VAT Amount”)),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END

ELSE

{InitGLEntry(ExPostingGrp.“ADC Refund Due”,+ROUND(“ADC VAT Amount”) +

ROUND(“ADC VAT AmountClained”),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);}

BEGIN

IF GenJnlLine.“ADC VAT AmountClained” <> 0 THEN BEGIN

InitGLEntry(ExPostingGrp.“ADC Claim A/c”,+(ROUND(“ADC VAT AmountClained”)),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE);

END;

InitGLEntry(ExPostingGrp.“ADC Refund Due”,

+ABS((ROUND(“ADC VAT Amount”)) ),“Source Curr. Excise Amount”,

TRUE,“System-Created Entry”);

InsertGLEntry(TRUE); END;

END;

END;

Pls help me . . .Thanxxx