Hi,
“Check. Prepmt. When posting” is not checked on Sales & Receivable setup.
I have created a new order, posted a prepayment Invoice. We haven’t received the amount for prepayment invoice, but still, wanted to ship the order. Is that possible? I am getting the below error when trying to ship.
“There are Unpaid prepayment Amounts on Order…….”
0
Comments
Thanks for the reply. Could you please describe how it can be possible?
SalesInvHeader.SETCURRENTKEY("Prepayment Order No.","Prepayment Invoice");
SalesInvHeader.SETRANGE("Prepayment Order No.",SalesHeader."No.");
SalesInvHeader.SETRANGE("Prepayment Invoice",TRUE);
IF SalesInvHeader.FINDSET THEN BEGIN
REPEAT
CustLedgerEntry.SETCURRENTKEY("Document No.");
CustLedgerEntry.SETRANGE("Document Type",CustLedgerEntry."Document Type"::Invoice);
CustLedgerEntry.SETRANGE("Document No.",SalesInvHeader."No.");
CustLedgerEntry.SETRANGE(Open,TRUE);
IF CustLedgerEntry.FIND('-') THEN
ERROR(STRSUBSTNO(Text001,SalesHeader."Document Type",SalesHeader."No."));
UNTIL (SalesInvHeader.NEXT = 0);
END;
I could not find above code in that codeunit ?
You should check again. The code exist in NAV 2009 SP1 version that is where I have checked
Instead of commenting you should uncheck the field "Check Prepmt. when Posting" in sales setup. The purpose of the the functionality is that you can block the posting of Order if payment against prepayment invoice is not received.
http://ssdynamics.co.in
Thanks! Yes, I verified the field “Check Prepmt. When Posting” in Sales & Receivables Setup and it is unchecked.
And, we are using Nav 5.0Sp1 Native. Here is what I am trying to achieve.
1. Created a order
2. Posted a prepayment Invoice
3. Changed the status of the order to open from Pending Prepayment, because prepayment has been delayed and user don’t want to stop the shipment.
4. Now trying to ship the order. Below is the code from the Post Button,
IF ApprovalMgt.PrePostApprovalCheck(Rec,PurchaseHeader) THEN BEGIN
IF ApprovalMgt.TestSalesPrepayment(Rec) THEN
ERROR(STRSUBSTNO(Text001,"Document Type","No."))
ELSE BEGIN
IF ApprovalMgt.TestSalesPayment(Rec) THEN
ERROR(STRSUBSTNO(Text002,"Document Type","No."))
ELSE
CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)",Rec);
END;
END;
TestSalesPrepayment is a function in codeunit 439, and below is the code in that function.
SalesLines.SETRANGE("Document Type",SalesHeader."Document Type");
SalesLines.SETRANGE("Document No.",SalesHeader."No.");
SalesLines.SETFILTER("Prepmt. Line Amount",'<>%1',0);
IF SalesLines.FIND('-') THEN BEGIN
REPEAT
IF SalesLines."Prepmt. Amt. Inv." <> SalesLines."Prepmt. Line Amount" THEN
EXIT(TRUE);
UNTIL SalesLines.NEXT = 0;
END;
SalesInvHeader.SETCURRENTKEY("Prepayment Order No.","Prepayment Invoice");
SalesInvHeader.SETRANGE("Prepayment Order No.",SalesHeader."No.");
SalesInvHeader.SETRANGE("Prepayment Invoice",TRUE);
IF SalesInvHeader.FINDSET THEN BEGIN
REPEAT
CustLedgerEntry.SETCURRENTKEY("Document No.");
CustLedgerEntry.SETRANGE("Document Type",CustLedgerEntry."Document Type"::Invoice);
CustLedgerEntry.SETRANGE("Document No.",SalesInvHeader."No.");
CustLedgerEntry.SETRANGE(Open,TRUE);
IF CustLedgerEntry.FIND('-') THEN
ERROR(STRSUBSTNO(Text001,SalesHeader."Document Type",SalesHeader."No."));
UNTIL (SalesInvHeader.NEXT = 0);
END;
What could be wrong?
So in some cases your client ready to dispatch material without payment also. so In that case do some customization.
Add field called Allow ship to sales Order .
If it is Yes then allow the dispath without payment also.if it is no system will not allow to dispatch the material without payment.