page 56001 "Sales Line Custom Factbox"
{
Caption = 'Sales Calculation';
PageType = CardPart;
SourceTable = "Sales Line";
layout
{
area(content)
{
group(SalesTotalCalculation)
{
Caption = 'Sales Total Calculation';
field("Total Amount Incl. VAT"; TotalSalesLine."Amount Including VAT")
{
ApplicationArea = Basic, Suite;
Caption = 'Total Amount Incl. VAT';
AutoFormatExpression = Currency.Code;
AutoFormatType = 1;
CaptionClass = DocumentTotals.GetTotalInclVATCaption(Currency.Code);
}
}
}
}
// trigger OnAfterGetCurrRecord()
// begin
// Rec.ClearSalesHeader();
// end;
trigger OnAfterGetRecord()
begin
Rec.CalcFields("Reserved Quantity", "Attached Doc Count");
SalesInfoPaneMgt.ResetItemNo();
GetTotalSalesHeader;
CalculateTotals();
end;
trigger OnOpenPage()
begin
SetOpenPage();
end;
var
Currency: Record Currency;
DocumentTotals: Codeunit "Document Totals";
SuppressTotals: Boolean;
TotalSalesHeader: Record "Sales Header";
protected var
SalesInfoPaneMgt: Codeunit "Sales Info-Pane Management";
ItemAvailFormsMgt: Codeunit "Item Availability Forms Mgt";
TotalSalesLine: Record "Sales Line";
VATAmount: Decimal;
InvoiceDiscountAmount: Decimal;
InvoiceDiscountPct: Decimal;
local procedure SetOpenPage()
begin
SuppressTotals := CurrentClientType() = ClientType::ODataV4;
end;
local procedure ShowNo(): Code[20]
begin
if Rec.Type <> Rec.Type::Item then
exit('');
exit(Rec."No.");
end;
local procedure GetTotalSalesHeader()
begin
DocumentTotals.GetTotalSalesHeaderAndCurrency(Rec, TotalSalesHeader, Currency);
end;
local procedure CalculateSalesLineCost() ReturnValue: Integer
begin
if Rec."Line Discount %" <> 0 then
ReturnValue := "Unit Cost" * Quantity * ("Line Discount %" / 100)
else
ReturnValue := "Unit Cost" * Quantity
end;
// procedure ClearTotalSalesHeader();
// begin
// Clear(TotalSalesHeader);
// end;
procedure CalculateTotals()
begin
OnBeforeCalculateTotals(TotalSalesLine, SuppressTotals);
if SuppressTotals then
exit;
DocumentTotals.SalesCheckIfDocumentChanged(Rec, xRec);
DocumentTotals.CalculateSalesSubPageTotals(TotalSalesHeader, TotalSalesLine, VATAmount, InvoiceDiscountAmount, InvoiceDiscountPct);
DocumentTotals.RefreshSalesLine(Rec);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeCalculateTotals(var TotalSalesLine: Record "Sales Line"; SuppressTotals: Boolean)
begin
end;
}
pageextension 56002 PageExtension56002 extends "Sales Quote"
{
layout
{
addbefore(Control1906127307)
{
part(CustomControl5653357897; "Sales Line Custom Factbox")
{
ApplicationArea = Suite;
Provider = SalesLines;
SubPageLink = "Document Type" = FIELD("Document Type"), "Document No." = FIELD("Document No."), "Line No." = FIELD("Line No.");
}
}
}
}