Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Roglar01/ALAppExtensions in…
Browse files Browse the repository at this point in the history
…to tiet
  • Loading branch information
magnushar committed Dec 2, 2024
2 parents 71a7b2d + c55f8f4 commit f9a1f30
Show file tree
Hide file tree
Showing 3 changed files with 475 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ codeunit 30166 "Shpfy Process Order"
/// </summary>
/// <param name="SalesHeader">Parameter of type Record "Sales Header".</param>
/// <param name="ShopifyOrderHeader">Parameter of type Record "Shopify Order Header".</param>
local procedure CreateHeaderFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
internal procedure CreateHeaderFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
var
ShopifyTaxArea: Record "Shpfy Tax Area";
DocLinkToBCDoc: Record "Shpfy Doc. Link To Doc.";
Expand Down Expand Up @@ -184,7 +184,7 @@ codeunit 30166 "Shpfy Process Order"
/// </summary>
/// <param name="SalesHeader">Parameter of type Record "Sales Header".</param>
/// <param name="ShopifyOrderHeader">Parameter of type Record "Shopify Order Header".</param>
local procedure CreateLinesFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
internal procedure CreateLinesFromShopifyOrder(var SalesHeader: Record "Sales Header"; ShopifyOrderHeader: Record "Shpfy Order Header")
var
Item: Record Item;
SalesLine: Record "Sales Line";
Expand Down Expand Up @@ -432,6 +432,11 @@ codeunit 30166 "Shpfy Process Order"
SalesHeader.Delete(true);
end;

internal procedure SetShopifyShop(Shop: Record "Shpfy Shop")
begin
ShopifyShop := Shop;
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnInsertShipmentHeaderOnAfterTransferfieldsToSalesShptHeader', '', false, false)]
local procedure TransferShopifyOrderNoToShipmentHeader(SalesHeader: Record "Sales Header"; var SalesShptHeader: Record "Sales Shipment Header")
begin
Expand Down
20 changes: 15 additions & 5 deletions Apps/W1/Shopify/test/Base/ShpfyInitializeTest.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ codeunit 139561 "Shpfy Initialize Test"

internal procedure CreateShop(): Record "Shpfy Shop"
var
GLAccount: Record "G/L Account";
RefundGLAccount: Record "G/L Account";
Shop: Record "Shpfy Shop";
VATPostingSetup: Record "VAT Posting Setup";
Expand All @@ -43,8 +42,6 @@ codeunit 139561 "Shpfy Initialize Test"
exit(Shop);

Code := Any.AlphabeticText(MaxStrLen(Code));
GLAccount.SetRange("Direct Posting", true);
GLAccount.FindLast();

LibraryERM.CreateVATPostingSetupWithAccounts(VATPostingSetup,
VATPostingSetup."VAT Calculation Type"::"Normal VAT", LibraryRandom.RandDecInDecimalRange(10, 25, 0));
Expand All @@ -65,7 +62,7 @@ codeunit 139561 "Shpfy Initialize Test"
CreateVATPostingSetup(PostingGroupCode, PostingGroupCode);
CreateVATPostingSetup(PostingGroupCode, '');
CreateVATPostingSetup(PostingGroupCode, RefundGLAccount."VAT Prod. Posting Group");
Shop."Shipping Charges Account" := GLAccount."No.";
Shop."Shipping Charges Account" := CreateShippingChargesGLAcc(VATPostingSetup, GenPostingType, PostingGroupCode);
Shop."Customer Posting Group" := PostingGroupCode;
Shop."Gen. Bus. Posting Group" := PostingGroupCode;
Shop."VAT Bus. Posting Group" := PostingGroupCode;
Expand Down Expand Up @@ -353,7 +350,7 @@ codeunit 139561 "Shpfy Initialize Test"
LibraryAssert.IsTrue(Values[1] = ShopifyAccessToken, 'invalid access token');
end;

local procedure CreateVATPostingSetup(BusinessPostingGroup: Code[20]; ProductPostingGroup: Code[20])
internal procedure CreateVATPostingSetup(BusinessPostingGroup: Code[20]; ProductPostingGroup: Code[20])
var
GeneralPostingSetup: Record "General Posting Setup";
VatPostingSetup: Record "VAT Posting Setup";
Expand All @@ -376,4 +373,17 @@ codeunit 139561 "Shpfy Initialize Test"
end;
end;

local procedure CreateShippingChargesGLAcc(var VATPostingSetup: Record "VAT Posting Setup"; GenPostingType: Enum "General Posting Type"; PostingGroupCode: Code[20]): Code[20]
var
ShippingChargesGLAccount: Record "G/L Account";
begin
ShippingChargesGLAccount.Get(LibraryERM.CreateGLAccountWithVATPostingSetup(VATPostingSetup, GenPostingType::Sale));
ShippingChargesGLAccount."Direct Posting" := true;
ShippingChargesGLAccount.Modify(false);

CreateVATPostingSetup(PostingGroupCode, ShippingChargesGLAccount."VAT Prod. Posting Group");

exit(ShippingChargesGLAccount."No.");
end;

}
Loading

0 comments on commit f9a1f30

Please sign in to comment.