Item A Customer5 : 400 customer 2: 250 customer 3: 200 itemB customer2 : 500 customer 4: 340
Item - OnAfterGetRecord () Number1:=0; ItemLedgerEntry.RESET; ItemLedgerEntry.SETCURRENTKEY("Source Type","Source No."); ItemLedgerEntry.SETRANGE("Entry Type",ItemLedgerEntry."Entry Type"::Sale); ItemLedgerEntry.SETRANGE("Item No.",Item."No."); IF ItemLedgerEntry.FIND('-') THEN REPEAT ItemLedgerEntry.SETRANGE("Source No.",ItemLedgerEntry."Source No."); Number:= Number +1; ItemLedgerEntry.FIND('+'); ItemLedgerEntry.SETRANGE("Source No."); UNTIL ItemLedgerEntry.NEXT=0; Number2:=0; ItemLedgerEntry.RESET; ItemLedgerEntry.SETCURRENTKEY("Source Type","Source No."); ItemLedgerEntry.SETRANGE("Entry Type",ItemLedgerEntry."Entry Type"::Sale); ItemLedgerEntry.SETRANGE("Item No.",Item."No."); IF ItemLedgerEntry.FIND('-') THEN REPEAT number2:= number2 -ItemLedgerEntry.Quantity; // you know that sales in item ledger entry are negative numbers // ItemLedgerEntry.SETRANGE("Source No."); UNTIL ItemLedgerEntry.NEXT=0; ItemAmount.INIT; ItemAmount."Item No.":= Item."No."; ItemAmount.Amount:= Number; ItemAmount."Amount 2":=q1; ItemAmount.INSERT;
Integer - OnPreDateItem() ItemAmount.RESET; ItemAmount.SETCURRENTKEY(Amount); ItemAmount.ASCENDING(FALSE); Integer - OnAfterGetRecord() IF Number = 1 THEN ItemAmount.FIND('-') ELSE ItemAmount.NEXT; Item.GET(ItemAmount."Item No.");
Comments
just want quantity not amounts and other.