hi mohana
thank you for reply
i did that i can see my order in purchase order list but quantity incoiced in not coming after i posted also
this my code
"Document Type"::"Credit Memo":
BEGIN
PurchLine.SETFILTER("Return Shipment No.",'<>%1','');
IF PurchLine.FINDSET THEN
REPEAT
IF PurchLine.Type <> PurchLine.Type::" " THEN BEGIN
ReturnShptLine.GET(PurchLine."Return Shipment No.",PurchLine."Return Shipment Line No.");
TempPurchLine.GET(
TempPurchLine."Document Type"::"Return Order",
ReturnShptLine."Return Order No.",ReturnShptLine."Return Order Line No.");
IF PurchLine.Type = PurchLine.Type::"Charge (Item)" THEN
UpdatePurchOrderChargeAssgnt(PurchLine,TempPurchLine);
TempPurchLine."Quantity Invoiced" :=
TempPurchLine."Quantity Invoiced" + PurchLine."Qty. to Invoice";
TempPurchLine."Qty. Invoiced (Base)" :=
TempPurchLine."Qty. Invoiced (Base)" + PurchLine."Qty. to Invoice (Base)";
IF ABS(TempPurchLine."Quantity Invoiced") > ABS(TempPurchLine."Return Qty. Shipped") THEN
ERROR(
Text041,
TempPurchLine."Document No.");
TempPurchLine.InitQtyToInvoice;
TempPurchLine.InitOutstanding;
TempPurchLine.MODIFY;
END;
UNTIL PurchLine.NEXT = 0;
InsertTrackingSpecification;
PurchLine.SETRANGE("Return Shipment No.");
END;
ELSE
IF PurchLine.FINDSET THEN
REPEAT
IF PurchLine."Prepayment %" <> 0 THEN
DecrementPrepmtAmtInvLCY(
PurchLine,PurchLine."Prepmt. Amount Inv. (LCY)",PurchLine."Prepmt. VAT Amount Inv. (LCY)");
UNTIL PurchLine.NEXT = 0;
END;
PurchLine.SETFILTER("Blanket Order Line No.",'<>0');
IF PurchLine.FINDSET THEN
REPEAT
UpdateBlanketOrderLine(PurchLine,Receive,Ship,Invoice);
UNTIL PurchLine.NEXT = 0;
PurchLine.SETRANGE("Blanket Order Line No.");
IF WhseReceive THEN BEGIN
WhsePostRcpt.PostUpdateWhseDocuments(WhseRcptHeader);
//TempWhseRcptHeader.DELETE;
END;
IF WhseShip THEN BEGIN
WhsePostShpt.PostUpdateWhseDocuments(WhseShptHeader);
// TempWhseShptHeader.DELETE;
END;
IF ("Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"]) AND Subcontracting THEN BEGIN
MODIFY;
InsertTrackingSpecification;
SubConOrderLine.SETRANGE("Document Type","Document Type");
SubConOrderLine.SETRANGE("Document No.","No.");
SubConOrderLine.FIND('-');
REPEAT
IF SubConOrderLine.Quantity <> 0 THEN BEGIN
IF Receive THEN BEGIN
SubConOrderLine."Quantity Received" := SubConOrderLine."Quantity Received" + SubConOrderLine."Qty. to Receive";
SubConOrderLine."Qty. Received (Base)" := SubConOrderLine."Qty. Received (Base)" +
SubConOrderLine."Qty. to Receive (Base)";
END;
IF Ship THEN BEGIN
SubConOrderLine."Return Qty. Shipped" := SubConOrderLine."Return Qty. Shipped" +
SubConOrderLine."Return Qty. to Ship";
SubConOrderLine."Return Qty. Shipped (Base)" :=
SubConOrderLine."Return Qty. Shipped (Base)" + SubConOrderLine."Return Qty. to Ship (Base)";
END;
IF Invoice THEN BEGIN
IF "Document Type" = "Document Type"::Order THEN BEGIN
IF ABS(SubConOrderLine."Quantity Invoiced" + SubConOrderLine."Qty. to Invoice") >
ABS(SubConOrderLine."Quantity Received")
THEN BEGIN
SubConOrderLine.VALIDATE("Qty. to Invoice",
SubConOrderLine."Quantity Received" - SubConOrderLine."Quantity Invoiced");
SubConOrderLine."Qty. to Invoice (Base)" :=
SubConOrderLine."Qty. Received (Base)" - SubConOrderLine."Qty. Invoiced (Base)";
END;
END ELSE
IF ABS(SubConOrderLine."Quantity Invoiced" + SubConOrderLine."Qty. to Invoice") >
ABS(SubConOrderLine."Return Qty. Shipped")
THEN BEGIN
SubConOrderLine.VALIDATE("Qty. to Invoice",
SubConOrderLine."Return Qty. Shipped" - SubConOrderLine."Quantity Invoiced");
SubConOrderLine."Qty. to Invoice (Base)" :=
SubConOrderLine."Return Qty. Shipped (Base)" - SubConOrderLine."Qty. Invoiced (Base)";
END;
SubConOrderLine."Quantity Invoiced" := SubConOrderLine."Quantity Invoiced" + SubConOrderLine."Qty. to Invoice";
SubConOrderLine."Qty. Invoiced (Base)" := SubConOrderLine."Qty. Invoiced (Base)" +
SubConOrderLine."Qty. to Invoice (Base)";
END;
SubConOrderLine.InitOutstanding;
IF WhseHandlingRequired THEN BEGIN
IF "Document Type" = "Document Type"::"Return Order" THEN BEGIN
SubConOrderLine."Return Qty. to Ship" := 0;
SubConOrderLine."Return Qty. to Ship (Base)" := 0;
END ELSE BEGIN
SubConOrderLine."Qty. to Receive" := 0;
SubConOrderLine."Qty. to Receive (Base)" := 0;
END;
SubConOrderLine.InitQtyToInvoice;
END ELSE BEGIN
IF "Document Type" = "Document Type"::"Return Order" THEN
SubConOrderLine.InitQtyToShip
ELSE
SubConOrderLine.InitQtyToReceive;
END;
SubConOrderLine.MODIFY;
END;
UNTIL SubConOrderLine.NEXT = 0;
END;
IF NOT Subcontracting THEN BEGIN
ApprovalsMgmt.DeleteApprovalEntries(RECORDID);
ArchiveManagement.AutoArchivePurchDocument(PurchHeader);
IF HASLINKS THEN
//DELETELINKS;
// DELETE;
ReservePurchLine.DeleteInvoiceSpecFromHeader(PurchHeader);
IF PurchLine.FINDFIRST THEN
REPEAT
IF PurchLine."Deferral Code" <> '' THEN
DeferralUtilities.RemoveOrSetDeferralSchedule(
'',DeferralUtilities.GetPurchDeferralDocType,'','',
PurchLine."Document Type",
PurchLine."Document No.",
PurchLine."Line No.",0,0D,
PurchLine.Description,
'',
TRUE);
IF PurchLine.HASLINKS THEN
PurchLine.DELETELINKS;
UNTIL PurchLine.NEXT = 0;
//PurchLine.DELETEALL;
DeleteItemChargeAssgnt;
PurchCommentLine.SETRANGE("Document Type","Document Type");
PurchCommentLine.SETRANGE("No.","No.");
IF NOT PurchCommentLine.ISEMPTY THEN
// PurchCommentLine.DELETEALL;
StrOrderDetails.SETCURRENTKEY("Document Type","Document No.",Type);
StrOrderDetails.SETRANGE("Document Type","Document Type");
StrOrderDetails.SETRANGE("Document No.","No.");
StrOrderDetails.SETRANGE(Type,StrOrderDetails.Type::Purchase);
StrOrderDetails.SETRANGE("Structure Code",Structure);
IF StrOrderDetails.FIND('-') THEN
//StrOrderDetails.DELETEALL;
StrOrdLineDetails.SETCURRENTKEY("Document Type","Document No.",Type);
StrOrdLineDetails.SETRANGE("Document Type","Document Type");
StrOrdLineDetails.SETRANGE("Document No.","No.");
StrOrdLineDetails.SETRANGE(Type,StrOrdLineDetails.Type::Purchase);
StrOrdLineDetails.SETRANGE("Structure Code",Structure);
IF StrOrdLineDetails.FIND('-') THEN
// StrOrdLineDetails.DELETEALL;
DefermentBuffer.RESET;
DefermentBuffer.SETRANGE("Document Type","Document Type");
DefermentBuffer.SETRANGE("Document No.","No.");
// DefermentBuffer.DELETEALL;
DetailTaxEntryBuffer.RESET;
DetailTaxEntryBuffer.SETRANGE("Document Type","Document Type");
DetailTaxEntryBuffer.SETRANGE("Document No.","No.");
DetailTaxEntryBuffer.SETRANGE("Transaction Type",DetailTaxEntryBuffer."Transaction Type"::Purchase);
// DetailTaxEntryBuffer.DELETEALL;
GSTManagement.DeleteGSTBuffer(
DetailedGSTEntryBuffer."Transaction Type"::Purchase,"Document Type","No.",0);
DeleteWhseRqst(PurchHeader);
END;
END;
InsertValueEntryRelation;
DeleteReservationEntryRelateJobNo(PurchLine."Document Type","No.",PurchLine."Line No.",PurchLine."Job No.");
IF NOT InvtPickPutaway THEN
COMMIT;
ClearPostBuffers;
IF GUIALLOWED THEN
Window.CLOSE;
END;
Rec := PurchHeader;
IF NOT InvtPickPutaway THEN BEGIN
COMMIT;
UpdateAnalysisView.UpdateAll(0,TRUE);
UpdateItemAnalysisView.UpdateAll(0,TRUE);
END;
OnAfterPostPurchaseDoc(Rec,GenJnlPostLine,PurchRcptHeader."No.",ReturnShptHeader."No.",PurchInvHeader."No.",
PurchCrMemoHeader."No.");
please give any solution
Thank you