Hi All, I have question about output on Voucher so I will change it for all voucher in system. I will show output like this.
quote:
LineNo. AccNo. Description/Descriptin 2 1000 11000 AAAAAAA /aaaaaaaaaaa 2000 21000 BBBBBBB/bbbbbbbbbbb 3000 11000 AAAAAAA/ccccccccccccc
Problem is description 2 not corrent by AccNo. in each line. Description 2 on line 3000 at AccNo. show on Voucher is AAAAAAA/aaaaaaa is not show correct output is AAAAAAA/ ccccccccccc I will show you two codes that I use for different voucher. but both show incorrect on Description 2. Code No.1 CLEAR(Desc2); PurchInvLine.RESET; PurchInvLine.SETRANGE("Document No.","Document No."); PurchInvLine.SETRANGE(Type,PurchInvLine.Type::"G/L Account"); PurchInvLine.SETRANGE("No.","G/L Account No."); IF PurchInvLine.FIND('-') THEN BEGIN GLEntry.RESET; GLEntry.SETRANGE("Document No.",PurchInvLine."Document No."); GLEntry.SETRANGE("G/L Account No.",PurchInvLine."No."); IF GLEntry.FIND('-') THEN BEGIN REPEAT Desc2 := PurchInvLine."Description 2"; UNTIL GLEntry.NEXT = 0; END; CLEAR(AccDesc); IF GLAcc.GET(AccNo) THEN BEGIN IF Desc2 <> '' THEN AccDesc := Desc + '/' + Desc2; END; IF GLAcc.GET(AccNo) THEN BEGIN IF Desc2 = '' THEN AccDesc := Desc; END; END;
Code No.2 CLEAR(AccNo); CLEAR(Desc); CLEAR(Desc2); CLEAR(AccName); IF Type = Type::"G/L Account" THEN AccNo := "No." ELSE IF Type = Type::Item THEN BEGIN IF GenPostingSetup.GET("Gen. Bus. Posting Group","Gen. Prod. Posting Group") THEN AccNo := GenPostingSetup."Purch. Account"; END ELSE IF Type = Type::"Fixed Asset" THEN BEGIN FA.GET("No."); IF FAPostingSetup.GET(FA."FA Posting Group") THEN AccNo := FAPostingSetup."Acquisition Cost Account"; END; PurchLine.RESET; PurchLine.SETRANGE("Document No.","Document No."); PurchLine.SETRANGE(Type,Type::"G/L Account"); PurchLine.SETRANGE("No.","No."); IF PurchLine.FIND('-') THEN BEGIN Desc := PurchLine.Description; Desc2 := PurchLine."Description 2"; END; IF GLAcc.GET(AccNo) THEN BEGIN IF Desc2 <> '' THEN AccName := Desc + '/' + Desc2; END; IF GLAcc.GET(AccNo) THEN BEGIN IF Desc2 = '' THEN AccName := Desc; END;
What do you think. What the best code??? for beginner like me. but Actually problem is not codes. Real Problem is output that show on “Description 2” that I mention above. Can anybody help me please? How I should to do? thank for advance klum