web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Corrective Sales Invoice

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Alexander Ermakov Profile Picture
    28,096 on at

    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

  • Community Member Profile Picture
    on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans