Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Corrective Sales Invoice

Posted on by Microsoft Employee

Hi, any have idea how I can make a Corrective Sales Invoice, for example if I have  Credit Memo posted in the Sales Credit Memo Header but i for X reason I need Canceled and create a Sales Invoice but corrective, in NAV exist the CorrectPostedSalesInvoice.CreateCreditMemoCopyDocument Function, what I need modify for create the Corrective Sales Invoice or exist another method for make this?

Thanks for the help :D

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Corrective Sales Invoice

    Thanks for answer, yeah that are the steps I need to do, but I make try that steps in automatic, whit only push a button, I am no sure is the correct form or if exist another but I use the next code (if is correct, maybe helpful to another person ):

    //first check if the credit memo are a prepayment credit memo 
    
    IF SalesCrMHeader."Prepayment Credit Memo" = FALSE THEN BEGIN
    
    // ask to the user if will like create a corrective Sales Inovice for the CrMemo
    IF CONFIRM(CorrectiveNC) THEN BEGIN
    
    //this function going into the codeunit 1303 
    
    CorrectPostedSalesInvoice.CreateSalesInvoiceCopyDocument(SalesCrMHeader,SalesHeader);
    SalesHeader.Correction:=TRUE;
    SalesHeader.MODIFY(TRUE);
    MESSAGE('Se ha creado una Factura Correctiva'+ ': ' + SalesHeader."No.");
    //post the corrective Sales Invoice
    CODEUNIT.RUN(CODEUNIT::"Sales-Post",SalesHeader);
    END ELSE BEGIN
    MESSAGE(CorrectiveNCsFE);
    END;
    //Nota de Credito Correctiva
    END ELSE BEGIN 
    MESSAGE(FacturaAnticipo);
    END;

    In the codeunit 1303 create the  next functions: 

    CreateSalesInvoiceCopyDocument(VAR SalesCrMemoHeader : Record "Sales Cr.Memo Header";VAR SalesHeader : Record "Sales Header")
    CreateCopyDocumentCredit(SalesCrMemoHeader,SalesHeader,SalesHeader."Document Type"::Invoice);
    CreateCopyDocumentCredit(VAR SalesCrMemoHeader : Record "Sales Cr.Memo Header";VAR SalesHeader : Record "Sales Header";DocumentType : Option)
    
    CLEAR(SalesHeader);
    SalesHeader."No." := '';
    SalesHeader."Document Type" := DocumentType;
    SalesHeader.INSERT(TRUE);
    
    CASE DocumentType OF
    SalesHeader."Document Type"::"Credit Memo":
    CopyDocMgt.SetPropertiesForCreditMemoCorrection;
    SalesHeader."Document Type"::Invoice:
    CopyDocMgt.SetPropertiesForInvoiceCorrection;
    ELSE
    ERROR(WrongDocumentTypeForCopyDocumentErr);
    END;
    
    //this function point to the codeunit 6620
    
    CopyDocMgt.CopySalesDocForCrMemoCancelling(SalesCrMemoHeader."No.",SalesHeader);


    in the codeunit 6620 create the function

    CopySalesDocForCrMemoCancelling(FromDocNo : Code[20];VAR ToSalesHeader : Record "Sales Header")
    CopySalesDoc(SalesDocType::"Posted Credit Memo",FromDocNo,ToSalesHeader);


    I hope this help to anyone

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Corrective Sales Invoice

    If you have the following situation:

    - you have posted Sales Invoice; then, you realized it is not correct

    - after that you have posted Credit Memo; then, you realized your Credit Memo is also incorrect and you need to reverse it :-)

    - you should then post again a Sales Invoice, copying the data from you incorrect Credit Memo, and apply that to your Credit Memo

    - then, post a correct Credit Memo by copying from initial Sales Invoice, and apply that to initial Sales Invoice

    - finally, post a correct Sales Invoice

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans