Skip to content

KVSKBAMinimumProfitManagement#

Summary: Codeunit "KVSKBAMinimumProfitManagement" (ID 5048812).

Remarks: This codeunit should manage all functions to calculate and compare minimum profits in sales line documents

Procedures#

CalcProfitValuesOfSalesLines(Record Sales Header, Record Sales Line, Decimal, Decimal, Decimal, Decimal, Decimal) :#

Summary: CalcProfitValuesOfSalesLines.

procedure CalcProfitValuesOfSalesLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var LineAmountLCY: Decimal; var LineAmountLCYExclVAT: Decimal; var UnitCostAmountLCY: Decimal; var ProfitAmountLCY: Decimal; var ProfitPerCent: Decimal): 

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • LineAmountLCY: VAR Decimal.
  • LineAmountLCYExclVAT: VAR Decimal.
  • UnitCostAmountLCY: VAR Decimal.
  • ProfitAmountLCY: VAR Decimal.
  • ProfitPerCent: VAR Decimal.

Remarks: this function calculates the profit based on the cost and price of the sales line

IsMinimumProfitEndPagePopupCase(Record Sales Header) : Boolean#

Summary: IsMinimumProfitEndPagePopupCase

procedure IsMinimumProfitEndPagePopupCase(var SalesHeader: Record "Sales Header"): Boolean

Parameters:

  • SalesHeader:

Returns: Result value of type Boolean.

Events#

OnBeforeCalcProfitValuesOfSalesLines(Record Sales Header, Record Sales Line, Decimal, Decimal, Decimal, Decimal, Decimal, Boolean) :#

Summary: OnBeforeCalcProfitValuesOfSalesLines.

[IntegrationEvent(false, false)]
local procedure OnBeforeCalcProfitValuesOfSalesLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var LineAmountLCY: Decimal; var LineAmountLCYExclVAT: Decimal; var UnitCostAmountLCY: Decimal; var ProfitAmountLCY: Decimal; var ProfitPerCent: Decimal; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeCalcProfitValuesOfSalesLines', '', false, false)]
local procedure DoSomethingOnBeforeCalcProfitValuesOfSalesLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var LineAmountLCY: Decimal; var LineAmountLCYExclVAT: Decimal; var UnitCostAmountLCY: Decimal; var ProfitAmountLCY: Decimal; var ProfitPerCent: Decimal; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • LineAmountLCY: VAR Decimal.
  • LineAmountLCYExclVAT: VAR Decimal.
  • UnitCostAmountLCY: VAR Decimal.
  • ProfitAmountLCY: VAR Decimal.
  • ProfitPerCent: VAR Decimal.
  • Handled: VAR Boolean.

OnAfterCalculatedSalesAmountCalcProfitValuesOfSalesLine(Record Sales Header, Record Sales Line, Decimal, Decimal) :#

Summary: OnAfterCalculatedSalesAmountCalcProfitValuesOfSalesLine.

[IntegrationEvent(false, false)]
local procedure OnAfterCalculatedSalesAmountCalcProfitValuesOfSalesLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var LineAmountLCY: Decimal; var LineAmountLCYExclVAT: Decimal): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnAfterCalculatedSalesAmountCalcProfitValuesOfSalesLine', '', false, false)]
local procedure DoSomethingOnAfterCalculatedSalesAmountCalcProfitValuesOfSalesLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var LineAmountLCY: Decimal; var LineAmountLCYExclVAT: Decimal)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • LineAmountLCY: VAR Decimal.
  • LineAmountLCYExclVAT: VAR Decimal.

OnAfterCalculatedCostCalcProfitValuesOfSalesLine(Record Sales Header, Record Sales Line, Decimal) :#

Summary: OnAfterCalculatedCostsCalcProfitValuesOfSalesLine.

[IntegrationEvent(false, false)]
local procedure OnAfterCalculatedCostCalcProfitValuesOfSalesLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var UnitCostAmountLCY: Decimal): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnAfterCalculatedCostCalcProfitValuesOfSalesLine', '', false, false)]
local procedure DoSomethingOnAfterCalculatedCostCalcProfitValuesOfSalesLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var UnitCostAmountLCY: Decimal)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • UnitCostAmountLCY: VAR Decimal.

OnAfterCalculatedProfitCalcProfitValuesOfSalesLine(Record Sales Header, Record Sales Line, Decimal, Decimal) :#

Summary: OnAfterCalculatedProfitCalcProfitValuesOfSalesLine.

[IntegrationEvent(false, false)]
local procedure OnAfterCalculatedProfitCalcProfitValuesOfSalesLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var ProfitAmountLCY: Decimal; var ProfitPerCent: Decimal): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnAfterCalculatedProfitCalcProfitValuesOfSalesLine', '', false, false)]
local procedure DoSomethingOnAfterCalculatedProfitCalcProfitValuesOfSalesLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var ProfitAmountLCY: Decimal; var ProfitPerCent: Decimal)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • ProfitAmountLCY: VAR Decimal.
  • ProfitPerCent: VAR Decimal.

OnBeforeCalcMinProfitSourceOfSalesDoc(Record Sales Header, Text[80], Boolean) :#

Summary: OnBeforeCalcMinProfitSourceOfSalesDoc.

[IntegrationEvent(false, false)]
local procedure OnBeforeCalcMinProfitSourceOfSalesDoc(SalesHeader: Record "Sales Header"; var MinimumProfitSourceDocumentText: Text[80]; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeCalcMinProfitSourceOfSalesDoc', '', false, false)]
local procedure DoSomethingOnBeforeCalcMinProfitSourceOfSalesDoc(SalesHeader: Record "Sales Header"; var MinimumProfitSourceDocumentText: Text[80]; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • MinimumProfitSourceDocumentText: VAR Text[80].
  • Handled: VAR Boolean.

OnBeforeShowPageDrillDownMinimumProfit(Record Sales Header, Decimal, Enum KVSKBAMinimumProfitSource, Boolean) :#

Summary: OnBeforeShowPageDrillDownMinimumProfit.

[IntegrationEvent(false, false)]
local procedure OnBeforeShowPageDrillDownMinimumProfit(SalesHeader: Record "Sales Header"; MinimumProfitPercentage: Decimal; MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeShowPageDrillDownMinimumProfit', '', false, false)]
local procedure DoSomethingOnBeforeShowPageDrillDownMinimumProfit(SalesHeader: Record "Sales Header"; MinimumProfitPercentage: Decimal; MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • MinimumProfitPercentage: Decimal.
  • MinimumProfitSource: enum KVSKBAMinimumProfitSource.
  • Handled: VAR Boolean.

OnBeforeHandleDocumentProfitBelowMinimumProfit(Record Sales Header, Decimal, Decimal, Enum KVSKBAMinimumProfitSource, Boolean) :#

Summary: OnBeforeHandleDocumentProfitBelowMinimumProfit.

[IntegrationEvent(false, false)]
local procedure OnBeforeHandleDocumentProfitBelowMinimumProfit(SalesHeader: Record "Sales Header"; DocumentProfitPercentage: Decimal; MinimumProfitPercentage: Decimal; MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeHandleDocumentProfitBelowMinimumProfit', '', false, false)]
local procedure DoSomethingOnBeforeHandleDocumentProfitBelowMinimumProfit(SalesHeader: Record "Sales Header"; DocumentProfitPercentage: Decimal; MinimumProfitPercentage: Decimal; MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • DocumentProfitPercentage: Decimal.
  • MinimumProfitPercentage: Decimal.
  • MinimumProfitSource: enum KVSKBAMinimumProfitSource.
  • Handled: VAR Boolean.

Remarks: Allows the complete handling of a document, if the total document is below the minimum profit.

OnBeforeHandleDocumentLineProfitBelowMinimumProfit(Record Sales Header, Record Sales Line, Decimal, Decimal, Enum KVSKBAMinimumProfitSource, Boolean) :#

Summary: OnBeforeHandleDocumentLineProfitBelowMinimumProfit.

[IntegrationEvent(false, false)]
local procedure OnBeforeHandleDocumentLineProfitBelowMinimumProfit(SalesHeader: Record "Sales Header"; var TempSalesLine: Record "Sales Line" temporary; DocumentProfitPercentage: Decimal; MinimumProfitPercentage: Decimal; MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeHandleDocumentLineProfitBelowMinimumProfit', '', false, false)]
local procedure DoSomethingOnBeforeHandleDocumentLineProfitBelowMinimumProfit(SalesHeader: Record "Sales Header"; var TempSalesLine: Record "Sales Line" temporary; DocumentProfitPercentage: Decimal; MinimumProfitPercentage: Decimal; MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • TempSalesLine: Temporary VAR Record "Sales Line".
  • DocumentProfitPercentage: Decimal.
  • MinimumProfitPercentage: Decimal.
  • MinimumProfitSource: enum KVSKBAMinimumProfitSource.
  • Handled: VAR Boolean.

Remarks: Allows the complete handling of all sales lines, which are below the minimum profit. The sales lines are a temporary buffer.

OnBeforeGetMinimumProfitBaseForSalesLine(Record Sales Line, Decimal, Text[100], Boolean) :#

Summary: OnBeforeGetMinimumProfitBaseForSalesLine.

[IntegrationEvent(false, false)]
local procedure OnBeforeGetMinimumProfitBaseForSalesLine(SalesLine: Record "Sales Line"; var MinimumProfitPercentage: Decimal; var DeviationSourceText: Text[100]; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeGetMinimumProfitBaseForSalesLine', '', false, false)]
local procedure DoSomethingOnBeforeGetMinimumProfitBaseForSalesLine(SalesLine: Record "Sales Line"; var MinimumProfitPercentage: Decimal; var DeviationSourceText: Text[100]; var Handled: Boolean)
begin
end;

Parameters:

  • SalesLine: Record "Sales Line".
  • MinimumProfitPercentage: VAR Decimal.
  • DeviationSourceText: VAR Text[100].
  • Handled: VAR Boolean.

OnBeforeGetMinimumProfitBaseForSalesDocument(Record Sales Header, Decimal, Enum KVSKBAMinimumProfitSource, Boolean) :#

Summary: OnBeforeGetMinimumProfitBaseForSalesDocument.

[IntegrationEvent(false, false)]
local procedure OnBeforeGetMinimumProfitBaseForSalesDocument(SalesHeader: Record "Sales Header"; var MinimumProfitPercentage: Decimal; var MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeGetMinimumProfitBaseForSalesDocument', '', false, false)]
local procedure DoSomethingOnBeforeGetMinimumProfitBaseForSalesDocument(SalesHeader: Record "Sales Header"; var MinimumProfitPercentage: Decimal; var MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • MinimumProfitPercentage: VAR Decimal.
  • MinimumProfitSource: VAR enum KVSKBAMinimumProfitSource.
  • Handled: VAR Boolean.

OnAfterGetMinimumProfitBaseForSalesDocument(Record Sales Header, Decimal, Enum KVSKBAMinimumProfitSource) :#

Summary: OnAfterGetMinimumProfitBaseForSalesDocument.

[IntegrationEvent(false, false)]
local procedure OnAfterGetMinimumProfitBaseForSalesDocument(SalesHeader: Record "Sales Header"; var MinimumProfitPercentage: Decimal; var MinimumProfitSource: Enum "KVSKBAMinimumProfitSource"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnAfterGetMinimumProfitBaseForSalesDocument', '', false, false)]
local procedure DoSomethingOnAfterGetMinimumProfitBaseForSalesDocument(SalesHeader: Record "Sales Header"; var MinimumProfitPercentage: Decimal; var MinimumProfitSource: Enum "KVSKBAMinimumProfitSource")
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • MinimumProfitPercentage: VAR Decimal.
  • MinimumProfitSource: VAR enum KVSKBAMinimumProfitSource.

OnBeforeClearMinimumProfitReleasedByInSalesLine(Record Sales Line, Integer, Boolean) :#

Summary: OnBeforeClearMinimumProfitReleasedByInSalesLine.

[IntegrationEvent(false, false)]
local procedure OnBeforeClearMinimumProfitReleasedByInSalesLine(var SalesLine: Record "Sales Line"; CalledByFieldNo: Integer; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeClearMinimumProfitReleasedByInSalesLine', '', false, false)]
local procedure DoSomethingOnBeforeClearMinimumProfitReleasedByInSalesLine(var SalesLine: Record "Sales Line"; CalledByFieldNo: Integer; var Handled: Boolean)
begin
end;

Parameters:

  • SalesLine: VAR Record "Sales Line".
  • CalledByFieldNo: Integer.
  • Handled: VAR Boolean.

OnBeforeCheckSalesLineMinProfitManual(Record Sales Header, Record Sales Line, Boolean) :#

Summary: OnBeforeCheckSalesLineMinProfitManual.

[IntegrationEvent(false, false)]
local procedure OnBeforeCheckSalesLineMinProfitManual(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeCheckSalesLineMinProfitManual', '', false, false)]
local procedure DoSomethingOnBeforeCheckSalesLineMinProfitManual(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • Handled: VAR Boolean.

OnBeforeConfirmMinimumProfitCheckCheckSalesLineMinProfitManual(Record Sales Header, Record Sales Line, Decimal, Decimal, Boolean) :#

Summary: OnBeforeConfirmMinimumProfitCheckCheckSalesLineMinProfitManual.

[IntegrationEvent(false, false)]
local procedure OnBeforeConfirmMinimumProfitCheckCheckSalesLineMinProfitManual(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; CurrentSalesLineProfit: Decimal; MinimumProfit: Decimal; var Handled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnBeforeConfirmMinimumProfitCheckCheckSalesLineMinProfitManual', '', false, false)]
local procedure DoSomethingOnBeforeConfirmMinimumProfitCheckCheckSalesLineMinProfitManual(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; CurrentSalesLineProfit: Decimal; MinimumProfit: Decimal; var Handled: Boolean)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • SalesLine: Record "Sales Line".
  • CurrentSalesLineProfit: Decimal.
  • MinimumProfit: Decimal.
  • Handled: VAR Boolean.

OnAfterCalcProfitValuesOfSalesDoc(Record Sales Header, Option, Decimal, Decimal, Decimal) :#

Summary: OnAfterCalcProfitValuesOfSalesDoc.

[IntegrationEvent(false, false)]
local procedure OnAfterCalcProfitValuesOfSalesDoc(SalesHeader: Record "Sales Header"; QtyType: Option; var SalesLCY: Decimal; var ProfitLCY: Decimal; var ProfitPct: Decimal): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAMinimumProfitManagement", 'OnAfterCalcProfitValuesOfSalesDoc', '', false, false)]
local procedure DoSomethingOnAfterCalcProfitValuesOfSalesDoc(SalesHeader: Record "Sales Header"; QtyType: Option; var SalesLCY: Decimal; var ProfitLCY: Decimal; var ProfitPct: Decimal)
begin
end;

Parameters:

  • SalesHeader: Record "Sales Header".
  • QtyType: Option General,Invoicing,Shipping.
  • SalesLCY: VAR Decimal.
  • ProfitLCY: VAR Decimal.
  • ProfitPct: VAR Decimal.