I have tried this code on the FinishCodeunit() trigger
WITH GenJnlLine DO BEGIN
IF GLEntryTmp.FIND(’-’) THEN BEGIN
REPEAT
GLEntry := GLEntryTmp;
//MOD01 Start
SingleCU.InsertGL(GLEntry);
//MOD01 End
IF GLSetup.“Additional Reporting Currency” = ‘’ THEN BEGIN
GLEntry.“Additional-Currency Amount” := 0;
GLEntry.“Add.-Currency Debit Amount” := 0;
GLEntry.“Add.-Currency Credit Amount” := 0;
END;
GLEntry.INSERT;
IF NOT InsertFAAllocDim(GLEntry.“Entry No.”) THEN
but how can fix this problem… One of the amounts in the G/L Entry table is taking the foreign exchange conversion and its negative while the other is not being translated by the foreign exchange conversion.Any idea why?
First I would start from what is the purpose of your modification? The purpose of this function is to test the validity of the GL posting. (Is it in balance?). I would not be placing modifications here that create additional entries.
When i issue LCY the amounts in the G/L Entry table are equal but opposite signs. This is correct. But when i an issuing a foreign currency customer. It complains of the above title. The consistency problem. When i commented the the consistency function. the error stopped, but the amount in the G/L Entry are no more equal with opposite signs. The negative sign is translated by the currency conversion but the positive one is not converted.
Can someone help me fix this.
The previous code is
WITH GenJnlLine DO BEGIN
IF GLEntryTmp.FIND(’-’) THEN BEGIN
REPEAT
GLEntry := GLEntryTmp;
IF GLSetup.“Additional Reporting Currency” = ‘’ THEN
GLEntry.“Additional-Currency Amount” := 0;
GLEntry.INSERT;
IF NOT InsertFAAllocDim(GLEntry.“Entry No.”) THEN
DimMgt.MoveJnlLineDimToLedgEntryDim(
TempJnlLineDim,DATABASE::“G/L Entry”,GLEntry.“Entry No.”);
UNTIL GLEntryTmp.NEXT = 0;
GLReg.“To VAT Entry No.” := NextVATEntryNo - 1;
IF GLReg.“To Entry No.” = 0 THEN BEGIN
GLReg.“To Entry No.” := GLEntry.“Entry No.”;
GLReg.INSERT;
END ELSE BEGIN
GLReg.“To Entry No.” := GLEntry.“Entry No.”;
GLReg.MODIFY;
END;
END;
GLEntry.CONSISTENT(
(BalanceCheckAmount = 0) AND (BalanceCheckAmount2 = 0) AND
(BalanceCheckAddCurrAmount = 0) AND (BalanceCheckAddCurrAmount2 = 0));
END;
Now modified to
WITH GenJnlLine DO BEGIN
IF GLEntryTmp.FIND(’-’) THEN BEGIN
REPEAT
GLEntry := GLEntryTmp;
//MOD01 Start
SingleCU.InsertGL(GLEntry);
//MOD01 End
IF GLSetup.“Additional Reporting Currency” = ‘’ THEN BEGIN
GLEntry.“Additional-Currency Amount” := 0;
GLEntry.“Add.-Currency Debit Amount” := 0;
GLEntry.“Add.-Currency Credit Amount” := 0;
END;
GLEntry.INSERT;
IF NOT InsertFAAllocDim(GLEntry.“Entry No.”) THEN
DimMgt.MoveJnlLineDimToLedgEntryDim(
TempJnlLineDim,DATABASE::“G/L Entry”,GLEntry.“Entry No.”);
UNTIL GLEntryTmp.NEXT = 0;
END;
END;
GLEntry.CONSISTENT(
(BalanceCheckAmount = 0) AND (BalanceCheckAmount2 = 0) AND
(BalanceCheckAddCurrAmount = 0) AND (BalanceCheckAddCurrAmount2 = 0));
GLReg.“To Entry No.” := GLEntry.“Entry No.”;
GLReg.INSERT;
GLEntry.INSERT(TRUE);
I remember seeing that in a post somewhere. I think he writes the entries to a temp table that can be view by a form. A very useful approach if dealing with a large entry (as in number of lines). I usually just set debug and write the accounts and amounts down. The account that is incorrect usually points you in the right direction.
Seriously try Ahmed’s way. I have tried tons of different methods, and his is by far the best. I think its in tips and tricks either here or on mibuso.
I tried Ahmed’s way but it gives me the issued figure in a form. This works when the inconsistemcy function is commented. Who can show me how he/she solved his/her problem on this issue.