From 2a72f94a4b2dffd98db5c7a0c14f72b27720a956 Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Thu, 20 Nov 2025 12:38:14 -0500 Subject: [PATCH 1/8] Add SL 1099 Migration functionality and related data structures --- Apps/US/HybridSL_US/app/ExtensionLogo.png | Bin 0 -> 20541 bytes .../SLD365BasicExtHSLUS.PermissionSetExt.al | 15 + ...SLD365BasicISVExtHSLUS.PermissionSetExt.al | 15 + .../SLD365TeamMemberHSLUS.PermissionSetExt.al | 15 + ...LIntelligentCloudHSLUS.PermissionSetExt.al | 15 + .../SLMigrationUSEdit.PermissionSet.al | 18 + .../SLMigrationUSObjects.PermissionSet.al | 23 + .../SLMigrationUSRead.PermissionSet.al | 18 + Apps/US/HybridSL_US/app/app.json | 51 ++ .../Codeunits/SLCloudMigrationUS.Codeunit.al | 59 ++ .../src/Codeunits/SLIRSFormData.Codeunit.al | 184 +++++ .../SLPopulateVendor1099Data.Codeunit.al | 769 ++++++++++++++++++ .../SLVendor1099MappingHelpers.Codeunit.al | 101 +++ .../SLCompanyAddSettListExt.PageExt.al | 28 + .../SLMigrationConfigurationExt.PageExt.al | 61 ++ .../app/src/Pages/SL1099MigrationLog.Page.al | 88 ++ .../SLCompanyAddSettingsExt.TableExt.al | 79 ++ .../app/src/Tables/SL1099BoxMapping.Table.al | 50 ++ .../src/Tables/SL1099MigrationLog.Table.al | 97 +++ .../src/Tables/SLSupportedTaxYear.Table.al | 29 + .../Support/SLHelperFunctions.Codeunit.al | 5 +- .../Migration/Vendors/SLAPBalances.Table.al | 1 - .../src/Migration/Vendors/SLAPSetup.Table.al | 1 - .../src/Migration/Vendors/SLVendor.Table.al | 1 - .../SLCompanyAdditionalSettings.Table.al | 3 +- 25 files changed, 1718 insertions(+), 8 deletions(-) create mode 100644 Apps/US/HybridSL_US/app/ExtensionLogo.png create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLD365BasicExtHSLUS.PermissionSetExt.al create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLD365BasicISVExtHSLUS.PermissionSetExt.al create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLD365TeamMemberHSLUS.PermissionSetExt.al create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLIntelligentCloudHSLUS.PermissionSetExt.al create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLMigrationUSEdit.PermissionSet.al create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLMigrationUSObjects.PermissionSet.al create mode 100644 Apps/US/HybridSL_US/app/Permissions/SLMigrationUSRead.PermissionSet.al create mode 100644 Apps/US/HybridSL_US/app/app.json create mode 100644 Apps/US/HybridSL_US/app/src/Codeunits/SLCloudMigrationUS.Codeunit.al create mode 100644 Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al create mode 100644 Apps/US/HybridSL_US/app/src/Codeunits/SLPopulateVendor1099Data.Codeunit.al create mode 100644 Apps/US/HybridSL_US/app/src/Codeunits/SLVendor1099MappingHelpers.Codeunit.al create mode 100644 Apps/US/HybridSL_US/app/src/PageExt/SLCompanyAddSettListExt.PageExt.al create mode 100644 Apps/US/HybridSL_US/app/src/PageExt/SLMigrationConfigurationExt.PageExt.al create mode 100644 Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al create mode 100644 Apps/US/HybridSL_US/app/src/TableExt/SLCompanyAddSettingsExt.TableExt.al create mode 100644 Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al create mode 100644 Apps/US/HybridSL_US/app/src/Tables/SL1099MigrationLog.Table.al create mode 100644 Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al diff --git a/Apps/US/HybridSL_US/app/ExtensionLogo.png b/Apps/US/HybridSL_US/app/ExtensionLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..5dc7f8c2873712ec6121a86911bdc389bad622f0 GIT binary patch literal 20541 zcmeI3c|25Y^uUJ{k*%_C(?pRNW1q>AeI&a#dyJWpvCS}J&r%Vkl%)L*}Y#Az&Ov8DcJ{FQre=z&hcO{+?JP|%XDnq{dMF8iU%}@yVYZsD>GDK~2K(K|r5m*E7 zi3Q6^%1fYOGKydYxFk#tt|%>g5G*YPlZQ&dp)gqqDHuWuj*xxsy=767Iyk-<G5qOn@uz^&~4-QAOLjz1^oFP=6v|9I_KU)(>KZEC)m zeGP?gGo%FED?-B)iz4AY&G2|vm2XjI^d~~FhQ?-8DS$=Iaqbwr4^d1BN^bIVzJGed zYNAM3l}$?tDH#bVX)~BC0tQD&%ZhIXrqnM^zV#&Yp^wMl9Q}UdLrxYU`xhU-^d$EI ztRD=Dg!)%re(n2<9}F7di1&0ukyLPQs1sNy!Tp31^k?HQJ%26BK@x|gL`f*f$YLcF<>6AmnUoYp z(E%fmc98oDQD6U8^S`;)#G}17SIc+T7{IlIqAc)-mX<(a926xS;Ie25lp-1>At&#E zb#TNwN=Ylg|8)I}`QKa{dg6dghjRU;&*s(tSBLnGo4*Z(#1Vn`^!p`lf$063%S^Ez ze{KC!;fnj3lL#nJB6f4dDMS8TazB#Tj~umW^L6DSQ0UEUrh?vF5Lk>7^e?SHFYAZp zcQf4IC-C1<{^tJ|^M4-0#|i6BX+eE+^|jYOJ0ap7Nj@k~tl9}6CjQM@|K|0tX5{Xb zpqts>759HI5k!>t|7;rm-8%Z8O~YSu(*NHy{ET9>6UzMr7NY|FGl2hW_;)k+Z9f0H zvi?j6e_x48o7)irSj9j@p}wvjm=g4FZ9hl;*56`tHM)9z?XMs$1sqV==I3|QU)AKM zmXu9@Rg;_kwEV*zM^cggJ{no`FIJm-=C_1y3Y2$P6?r*186fYHHV?uuvnSWcLKl0fB=E=`n z`rq_Q=8HNA84$`M6&GbbWLhdNG9Z*iDlW==$h1^kWI!m3R9uw#kZGy7$be85skkWf zA=6TEkpZDBQgKn{L#CzTA_GEMq~fB?hfGVwMFxbjNX12&51E#Viwp>5k&25lA2KZ! z7a0)BA{7^9K4e-dE;1mLMJg`Je8{v^Tx38fi&R{c`H*R;xX6G|7OA)>^C8nxaghO` zEK+e%=0m2X;vxe=S)}5k%!f=%#YF~$vPi{6nGczkii->gWs!=DG9NN66&D#0$|4mP zWj~n57Xg7n&VWFlH-PUc5Xegk1bS-^0wEGWATE52-6L%fh@($eQ_akG zVCIIcE1$V{Bc8uYBui3DLhDpd2q>IYwt<~CjHw57|M{C+4^)h_g~pC-eQo>T^r_jj z4|;s{G>qjTRWz=$YC;EZ1`)1s67F76sN>9J*gg9eUF5NFeEKj50yLfibU-7Z0~!Gx& z<{;M*hCOh*Y>pQC)hqSW-iu3+P=DH^=4C_u!_zZ!UR$}X%LF8+YW%m}K2?Hjk3WCf zf<0qMAPaJYxg!5{(%^M(u2x^g(r~N|&9-_*TDID=&_+CG*ijD+r4XeH?CMRuZa!NR zw!FM68X*Baj!|4Gzj@;FCxUCZMt>Lhn5I}&Ow97fnxI||dw<#sw}yulxP=)64Ykx< z&0MO|%=)9fwWhR$`Wo-8M>pxJFdQzX4VJ$%B-2z$dvw^ov;JQ3XnP~ywKQ;P($Vm~ zHqH7O-`rcS82VGsGkc4~vu2KD7w#=df(%zk{jtna8egF^wMbvjVSjoQW+(e%yO@Da zi0Gu=;6f{0CGWz94b5ZKo%34s7tp?oa?gNaRCnI1K2@w3p{4fZpvsf^q>0J`4&#=C z`>d1sHwePAa?XG7OE5VYvz1N6$FV1bqu2JbZy*~q?`cLE;@hBN%;|r46oVr?Yl>B> zZfbUN2{1&Z^oi4@&l_2?>ga7=V%cQ8^tp5qyv3oY)aI^N%YH8D(!DgWs+gSQ}yDyffMNE@zl9~KY3cMFPmU>lY6B}+y* z;@YFJ#nqkiq4IZ>W#u^eFQvA3_O8a1CkStNyCdAw%$^{?rQGUvBzva`hdWowEG8fc z91Z*_$7_oYUwGL0Y&%nfu5(3L(VUI6Eym#pTUZ61?nPz(fWG*m&%LIYh9PtCl{dt=x#6!7C~T90JFEK7Pq)&rLvBXsOv$c?nhF%tOu%RXZ^Hpm^ED)8eW< zSnccxjp05$z`b}coS#pzAeK+e9C-^2wrDvjrrxB=4_|2)AvDrgP4(5ReTlW>N?!dk zU-Y=ABlt6Z4Idhmv&08_tt)1eVhdIqd9YN&lzD%(Ci$KJ>|jCPhw+xEkGb<7YuC^D zEG{i_KbPbc&=d*NklCduNH1VgLqu7Z-MYKZqb}Nr=e?$-apt*ts$Us1$qe5#H#7H$ z$w>VSb~6FCQ+j>LBjq8ljnOZ@kx{XH&l-pqrovipT>Z#@D>1{+@>U z{t)i-2it8LiUJCAvYt5XJiKZJSGg!&#eaOMe>y&dBfHRRu;X}e>qPP1&`{Q$+DMxn zG-=nNdBeEd&BmFIoto|I$6tFd4=#DJax&Ar9++j-Jxv=am)Ok3Og{<>HOezOp0bwN zqxK@vt}ZndinwWc+Jrr0QP*a9KfR%BaYFf&A`2&R)iKI&dRd>8uag_m-7%c3#n69! z@m^J*8L4GZ)p8w@w9zZHLDSs0B(UL+8nONGMQGo8@mgRL)U^#dvb}-R#q7#L#-$BR z>7KqnYPagdvm*khthtt?F{AuW{kc=>^e5sUF^livtn-ZWIa=UBu^|bzy4QRzqX+df1$hk?j(PAtyq+N*KhJ-_ZF-4170*P+FNnlFrdKGu#ypCqWoHUGa zR-P<9@WcrxM@ZwH=4h3c(YE#ZmEfpFPOkZi=CMSJrurAC*{~QcUx?^@yQR>J%iJ4d}4)S zKo7D%Xw}P~sB;E$ZoSu^dr3T#lCgKu5vApPtx zWKLm;A<9_q;XF6Xv>eh>)~fR{_RTToJGlqAT3<;s>>N%Sgv5*%8Wq z7>n#>96v8=Jk-`r*PxRmygrNBLQDv4c7mM=7CybwCZggN#P(UXS@{s-A-G*jetOi6 zyJ%65(tPt_&c$|#K=#{o(Q!|6Vs3ML=Pg@~X00Z5#~Y4io2_=#Zam`JxMALUnzM_@ zA6t`G^YEs;jl-Nxe{|+V`%|^J#Y*f-ZbGK~nE!fg-p2BL$Jp>{$2zCTgXfjA(Ah!f zn!$xYYtPiD?>cpddl%1OlX~9qVCHELDC0+YF!y{U8Pm?GHS~3jcv<5@>*EcbQ#L-> zl?7FQ9N$&(=vqvTgwK1Q8Xgw@PdDs#YtIdqJ-a*&50Yubo6HVE?6S)DbXy1ZFf^!0 zIx*7?u9O1R1DC+fSyABh{Ar|oKW@ow#Nm3Q`r}*}#6vt;O?(+Uj=_ibT`a5cvgCQR z4pbL7vuU`BzDe3FeQU`{%TEyX9S(U$x4HIpZ;jSeI-576TK&GcX}QFMSKDpKdsT_e z^oFgz-!@CHK&N4Qw!Yw3x1|Jy3g!PDk$T`innDP>cS`%>yUN@_xRIWEe>sqPWPrypZd4jWSqEMlQ-j8WJ;Tp zD4xA8mJf;@RTylnP5^0s$Oy=lqwAe0Ru}`S7CGeb)onsL?vRWit@B`&mrcc?mA#!l zFH`!H?H+SxX5e%7KPb1@hJTpVF7mSa@fPqPT8_0bCTc%os^S*TE?X|vvf)m^!b6E; z(; zie?FJceKx0J0}1(bySag86StqVS)&^+Ou!g`xub%0iT=GiDKJ1i@kO~V-Y^j$v!E5 zMPR%89;6|gM@{!lT!)&~`L}sW*tdArZWFTrX|dB0wXkx>$a5xB^-P~>;1J6S?2^36y2$RSjG2Q6fw_(|DG4e!ry+Oj~n>sgm~ z(#ljgYNpP)OwR?CuElbM8qG{_IMH;ygmm+*==pqp+&_1$5AsE)Hq0(}s4`_Rshv4Z z2;A!-&VN5VMKVHAGJ?&y$*aVIw77J3pU!+h{?IyMt(}(cX5we8X3>*tk`ZG8Id5)s z9KDF*WLNKh_OzRIc#Dyf-Wiy7v4lfU441;w88sytInFA-jI}fd;&$W(rwD##)ay|R zQReg|!c5X!$JjE-5vCiIpernMPFN*Svvscrf=)AAN5hE@l5y(eYVU_BLDyx|T{Dh!X@S^F6m_dLGK>${8(Zb#=Y_l=f^oP;!iT^)Ze=d0mel zYhO0AI9Yfm935bxy+YJS=r6x8W&VKGS8M2c_qC`v`E(cBDhj!8P#+3h3^{#dU_28f(PZmcDu*HH`QfK4c45}^#g=C6F0CnRAVGJpz zrxo`;e@6`jc%&)n8)kfrPB-ucrk>>3Wn|1YpO_OYoTkr^J~hL);RN(%+J4oR#&PCd z39!G`I3*-S1y8Q=JaN#-7iz9K%`z7ut7l3Ab=BW{=zGw6p=D1!OGT&b^%J+XuXJP- z)y5}9iEC(IuAE@A`(uNkSu}dQSg=kLgc#%4qw901ry+0)BJN4*)vZE~0(v^hX8!vb z%0xe|?A=!O@S?K-J}LzRJC&fp+E^)jJ(y*IomJ=+ZzUdhJO*mM7!kXrfTsx(0Y9Y>E!$ryng~~Zc=AMdx+jVWP4PKsvqf1_o5<0 zEc4r^=H*EG0@0C$y0!Xfpp4JxVHfmWK)VE;<9C>2l)9H>9(DiKhp8Kv57arC$=vfGQsMk4U~l~^^2!{^u=dgYZ~!d(SbaiU)XQycXdI;11~=Q zJXzpi8cSWE_42yzN#4Po*kR6r>Drm?QjODt&Soya14VoM(yZTuBzz5VOSbF7ybgJv zh46fXHzxYD;AGh|BezFikoX6)uh!&QrCx|sGF#Q;-{!l`lA|nSvjoN5YHODcLF&y0 zT34lo4w4MI>$P07Z`GECW1Yl zxS2b`ltusIR5|Zfuyg8`FQp%Wpxf!u^2M7_-+p8gC|4A-3gNRS3hcUyukrI`vkX>=l z+r<5^xFkG)R9c*UP?oc(2;D#m7f+t^K7>D(fD)6x0#(K|$b-+Max8d4nYZkr4qU&*aRmW6l?tAX6%-9-K^X z?~Xo>JYDWRt%8#XL_5|k@8)fXSiQ7$=GpD9xH$7k&rxhHq|Rcxe6(b6srj{;ljl<# z9T8B(vCE#B`E59%O6LX<7f@GA%!0_s8M>)rh4@3;*d)@PICusGo#U?Se45~A$U?`~ zmdG1>Z~t>PmbRk_h-X{a+9o6WPH-Vj9L_&-?g{a&uJDZ09^~eEIQtn}ZF!pGLgT@n z;4Pe8{85Tk*G(XAB3TIW5+!=u!Ms-eS9bFp)u?+2B$wVpQ^2nIEK%GiU7(sjPIXjnFYP z4U?p5$4>2%mzllDSAXo*4CVa#+GwiBJEF#f!#HM{6gBLc@_>h5wV=P>5cHa9e8hrZ zaD186n#_T#RgK93p1y;Z-pTQ=#A>jLABuUeMmxN$BKgLFhxz6UpJayxJ;W?fzBrz_ zOw*v@amEhA8QVhiXhy1%a=mF;8~qhIQ_u0Iv?~vsJcxOJxfggAwAD|2RuFt~$3CTz z%Zf_$-sW-6pS#~h72|y%g5hcJ=nQr>6POnz97iYd9S7FTSX;*gGjw<3i35%AjvuO+ ztXmXoyu<2lFQO=THfZ%2X7~KMVd7??tZZY{_yBZRDK4}^b6@nyt_|gYHHl}lIz)Sf zV6s8#5 0 then + if Open1099Year then + SLIRSFormData.CreateIRSFormsReportingPeriodIfNeeded(ReportingYear); + end; + if SLCompanyAdditionalSettings.GetMigrateNext1099YearEnabled() then begin + ReportingYear := SLVendor1099MappingHelpers.GetNext1099YearFromSLAPSetup(); + Open1099Year := SLVendor1099MappingHelpers.GetNext1099YearOpenStatus(); + if ReportingYear <> 0 then + if Open1099Year then + SLIRSFormData.CreateIRSFormsReportingPeriodIfNeeded(ReportingYear); + end; + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al b/Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al new file mode 100644 index 0000000000..2b9a908238 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al @@ -0,0 +1,184 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +using Microsoft.Finance.VAT.Reporting; + +codeunit 47200 "SL IRS Form Data" +{ + Permissions = tabledata "IRS Reporting Period" = RIM, + tabledata "IRS 1099 Form" = RIM, + tabledata "IRS 1099 Form Box" = RIM, + tabledata "IRS 1099 Form Statement Line" = RIM, + tabledata "IRS 1099 Form Instruction" = RIM; + + var + IRSFormStatementLineFilterExpressionTxt: Label 'Form Box No.: %1', Comment = '%1 = Form Box No.', Locked = true; + + internal procedure CreateIRSFormsReportingPeriodIfNeeded(ReportingYear: Integer) + var + IRSReportingPeriod: Record "IRS Reporting Period"; + PeriodNo: Code[20]; + begin + PeriodNo := Format(ReportingYear); + if not IRSReportingPeriod.Get(PeriodNo) then begin + IRSReportingPeriod.Validate("No.", PeriodNo); + IRSReportingPeriod.Validate("Starting Date", DMY2Date(1, 1, ReportingYear)); + IRSReportingPeriod.Validate("Ending Date", DMY2Date(31, 12, ReportingYear)); + IRSReportingPeriod.Validate("Description", PeriodNo); + IRSReportingPeriod.Insert(true); + + PopulateFormsAndBoxes(PeriodNo); + end; + end; + + local procedure PopulateFormsAndBoxes(PeriodNo: Code[20]) + begin + AddForm(PeriodNo, 'MISC', 'Miscellaneous Income'); + AddFormBox(PeriodNo, 'MISC', 'MISC-01', 'Rents', 600); + AddFormBox(PeriodNo, 'MISC', 'MISC-02', 'Royalties', 10); + AddFormBox(PeriodNo, 'MISC', 'MISC-03', 'Other Income', 600); + AddFormBox(PeriodNo, 'MISC', 'MISC-04', 'Federal Income Tax Withheld', 0); + AddFormBox(PeriodNo, 'MISC', 'MISC-05', 'Fishing Boat Proceeds', 600); + AddFormBox(PeriodNo, 'MISC', 'MISC-06', 'Medical and Health Care Payments', 600); + AddFormBox(PeriodNo, 'MISC', 'MISC-07', 'Payer made direct sales totaling $5,000 or more of consumer products to recipient for resale', 5000); + AddFormBox(PeriodNo, 'MISC', 'MISC-08', 'Substitute Payments in Lieu of Dividends or Interest', 10); + AddFormBox(PeriodNo, 'MISC', 'MISC-09', 'Crop Insurance Proceeds', 1); + AddFormBox(PeriodNo, 'MISC', 'MISC-10', 'Gross Proceeds Paid to an Attorney', 0); + AddFormBox(PeriodNo, 'MISC', 'MISC-11', 'Fish purchased for resale', 600); + AddFormBox(PeriodNo, 'MISC', 'MISC-12', 'Section 409A deferrals', 600); + AddFormBox(PeriodNo, 'MISC', 'MISC-14', 'Excess golden parachute payments', 0); + AddFormBox(PeriodNo, 'MISC', 'MISC-15', 'Nonqualified deferred compensation', 0); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-01', 10000, 'Rents'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-02', 20000, 'Royalties'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-03', 30000, 'Other Income'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-04', 40000, 'Federal Income Tax Withheld'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-05', 50000, 'Fishing Boat Proceeds'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-06', 60000, 'Medical and Health Care Payments'); + AddFormStatementLine(PeriodNo, 'MISC', Enum::"IRS 1099 Print Value Type"::"Yes/No", 'MISC-07', 70000, 'Payer made direct sales totaling $5,000 or more of consumer products to recipient for resale'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-08', 80000, 'Substitute Payments in Lieu of Dividends or Interest'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-09', 90000, 'Crop Insurance Proceeds'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-10', 100000, 'Gross Proceeds Paid to an Attorney'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-11', 110000, 'Fish purchased for resale'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-12', 120000, 'Section 409A deferrals'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-14', 130000, 'Excess golden parachute payments'); + AddFormStatementLine(PeriodNo, 'MISC', 'MISC-15', 140000, 'Nonqualified deferred compensation'); + + AddForm(PeriodNo, 'NEC', 'Nonemployee Compensation'); + AddFormBox(PeriodNo, 'NEC', 'NEC-01', 'Nonemployee Compensation', 600); + AddFormStatementLine(PeriodNo, 'NEC', 'NEC-01', 10000, 'Nonemployee Compensation'); + + AddFormInstructionLines(PeriodNo); + end; + + procedure AddFormInstructionLines(PeriodNo: Code[20]) + begin + AddNecFormInstructionLines(PeriodNo); + AddMiscFormInstructionLines(PeriodNo); + end; + + local procedure AddNecFormInstructionLines(PeriodNo: Code[20]) + var + IRS1099Form: Record "IRS 1099 Form"; + begin + if not IRS1099Form.Get(PeriodNo, 'NEC') then + exit; + AddFormInstructionLine(PeriodNo, 'NEC', 1, '', 'You received this form instead of Form W-2 because the payer did not consider you an employee and did not withhold income tax or social security and Medicare tax. If you believe you are an employee and cannot get the payer to correct this form, report the amount shown in box 1 on the line for “Wages, salaries, tips, etc.” of Form 1040, 1040-SR, or 1040-NR. You must also complete Form 8919 and attach it to your return. For more information, see Pub. 1779, Independent Contractor or Employee. If you are not an employee but the amount in box 1 is not self-employment (SE) income (for example, it is income from a sporadic activity or a hobby), report the amount shown in box 1 on the “Other income” line (on Schedule 1 (Form 1040)).'); + AddFormInstructionLine(PeriodNo, 'NEC', 2, 'Recipient’s taxpayer identification number (TIN).', 'For your protection, this form may show only the last four digits of your TIN (social security number (SSN), individual taxpayer identification number (ITIN), adoption taxpayer identification number (ATIN), or employer identification number (EIN)). However, the issuer has reported your complete TIN to the IRS.'); + AddFormInstructionLine(PeriodNo, 'NEC', 3, 'Account number.', 'May show an account or other unique number the payer assigned to distinguish your account.'); + AddFormInstructionLine(PeriodNo, 'NEC', 4, 'Box 1.', 'Shows nonemployee compensation. If the amount in this box is SE income, report it on Schedule C or F (Form 1040) if a sole proprietor, or on Form 1065 and Schedule K-1 (Form 1065) if a partnership, and the recipient/partner completes Schedule SE (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'NEC', 5, 'Note:', 'If you are receiving payments on which no income, social security, and Medicare taxes are withheld, you should make estimated tax payments. See Form 1040-ES (or Form 1040-ES (NR)). Individuals must report these amounts as explained in these box 1 instructions. Corporations, fiduciaries, and partnerships must report these amounts on the appropriate line of their tax returns.'); + AddFormInstructionLine(PeriodNo, 'NEC', 6, 'Box 2.', 'If checked, consumer products totaling $5,000 or more were sold to you for resale, on a buy-sell, a deposit-commission, or other basis. Generally, report any income from your sale of these products on Schedule C (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'NEC', 7, 'Box 3.', 'Reserved for future use.'); + AddFormInstructionLine(PeriodNo, 'NEC', 8, 'Box 4.', 'Shows backup withholding. A payer must backup withhold on certain payments if you did not give your TIN to the payer. See Form W-9, Request for Taxpayer Identification Number and Certification, for information on backup withholding. Include this amount on your income tax return as tax withheld.'); + AddFormInstructionLine(PeriodNo, 'NEC', 9, 'Boxes 5-7.', 'State income tax withheld reporting boxes.'); + AddFormInstructionLine(PeriodNo, 'NEC', 10, 'Future developments.', 'For the latest information about developments related to Form 1099-NEC and its instructions, such as legislation enacted after they were published, go to www.irs.gov/Form1099NEC.'); + AddFormInstructionLine(PeriodNo, 'NEC', 11, 'Free File Program.', 'Go to www.irs.gov/FreeFile to see if you qualify for no-cost online federal tax preparation, e-filing, and direct deposit or payment options.'); + end; + + local procedure AddMiscFormInstructionLines(PeriodNo: Code[20]) + var + IRS1099Form: Record "IRS 1099 Form"; + begin + if not IRS1099Form.Get(PeriodNo, 'MISC') then + exit; + AddFormInstructionLine(PeriodNo, 'MISC', 1, 'Recipient’s taxpayer identification number (TIN).', 'For your protection, this form may show only the last four digits of your TIN (social security number (SSN), individual taxpayer identification number (ITIN), adoption taxpayer identification number (ATIN), or employer identification number (EIN)). However, the issuer has reported your complete TIN to the IRS.'); + AddFormInstructionLine(PeriodNo, 'MISC', 2, 'Account number.', 'May show an account or other unique number the payer assigned to distinguish your account.'); + AddFormInstructionLine(PeriodNo, 'MISC', 3, 'Amounts shown may be subject to self-employment (SE) tax.', 'Individuals should see the Instructions for Schedule SE (Form 1040). Corporations, fiduciaries, or partnerships must report the amounts on the appropriate line of their tax returns.'); + AddFormInstructionLine(PeriodNo, 'MISC', 4, 'Form 1099-MISC incorrect?', 'If this form is incorrect or has been issued in error, contact the payer. If you cannot get this form corrected, attach an explanation to your tax return and report your information correctly.'); + AddFormInstructionLine(PeriodNo, 'MISC', 5, 'Box 1.', 'Report rents from real estate on Schedule E (Form 1040). However, report rents on Schedule C (Form 1040) if you provided significant services to the tenant, sold real estate as a business, or rented personal property as a business. See Pub. 527.'); + AddFormInstructionLine(PeriodNo, 'MISC', 6, 'Box 2.', 'Report royalties from oil, gas, or mineral properties; copyrights; and patents on Schedule E (Form 1040). However, report payments for a working interest as explained in the Schedule E (Form 1040) instructions. For royalties on timber, coal, and iron ore, see Pub. 544.'); + AddFormInstructionLine(PeriodNo, 'MISC', 7, 'Box 3.', 'Generally, report this amount on the “Other income” line of Schedule 1 (Form 1040) and identify the payment. The amount shown may be payments received as the beneficiary of a deceased employee, prizes, awards, taxable damages, Indian gaming profits, or other taxable income. See Pub. 525. If it is trade or business income, report this amount on Schedule C or F (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'MISC', 8, 'Box 4.', 'Shows backup withholding or withholding on Indian gaming profits. Generally, a payer must backup withhold if you did not furnish your TIN. See Form W-9 and Pub. 505 for more information. Report this amount on your income tax return as tax withheld.'); + AddFormInstructionLine(PeriodNo, 'MISC', 9, 'Box 5.', 'Shows the amount paid to you as a fishing boat crew member by the operator, who considers you to be self-employed. Self-employed individuals must report this amount on Schedule C (Form 1040). See Pub. 334.'); + AddFormInstructionLine(PeriodNo, 'MISC', 10, 'Box 6.', 'For individuals, report on Schedule C (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'MISC', 11, 'Box 7.', 'If checked, consumer products totaling $5,000 or more were sold to you for resale, on a buy-sell, a deposit-commission, or other basis. Generally, report any income from your sale of these products on Schedule C (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'MISC', 12, 'Box 8.', 'Shows substitute payments in lieu of dividends or tax-exempt interest received by your broker on your behalf as a result of a loan of your securities. Report on the “Other income” line of Schedule 1 (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'MISC', 13, 'Box 9.', 'Report this amount on Schedule F (Form 1040).'); + AddFormInstructionLine(PeriodNo, 'MISC', 14, 'Box 10.', 'Shows gross proceeds paid to an attorney in connection with legal services. Report only the taxable part as income on your return.'); + AddFormInstructionLine(PeriodNo, 'MISC', 15, 'Box 11.', 'Shows the amount of cash you received for the sale of fish if you are in the trade or business of catching fish.'); + AddFormInstructionLine(PeriodNo, 'MISC', 16, 'Box 12.', 'May show current year deferrals as a nonemployee under a nonqualified deferred compensation (NQDC) plan that is subject to the requirements of section 409A plus any earnings on current and prior year deferrals.'); + AddFormInstructionLine(PeriodNo, 'MISC', 17, 'Box 13.', 'If the FATCA filing requirement box is checked, the payer is reporting on this Form 1099 to satisfy its account reporting requirement under chapter 4 of the Internal Revenue Code. You may also have a filing requirement. See the Instructions for Form 8938.'); + AddFormInstructionLine(PeriodNo, 'MISC', 18, 'Box 14.', 'Shows your total compensation of excess golden parachute payments subject to a 20% excise tax. See your tax return instructions for where to report.'); + AddFormInstructionLine(PeriodNo, 'MISC', 19, 'Box 15.', 'Shows income as a nonemployee under an NQDC plan that does not meet the requirements of section 409A. Any amount included in box 12 that is currently taxable is also included in this box. Report this amount as income on your tax return. This income is also subject to a substantial additional tax to be reported on Form 1040, 1040-SR, or 1040-NR. See the instructions for your tax return.'); + AddFormInstructionLine(PeriodNo, 'MISC', 20, 'Boxes 16-18.', 'Show state or local income tax withheld from the payments.'); + AddFormInstructionLine(PeriodNo, 'MISC', 21, 'Future developments.', 'For the latest information about developments related to Form 1099-MISC and its instructions, such as legislation enacted after they were published, go to www.irs.gov/Form1099MISC.'); + AddFormInstructionLine(PeriodNo, 'MISC', 22, 'Free File Program.', 'Go to www.irs.gov/FreeFile to see if you qualify for no-cost online federal tax preparation, e-filing, and direct deposit or payment options.'); + end; + + local procedure AddForm(PeriodNo: Code[20]; FormNo: Code[20]; Description: Text) + var + IRS1099Form: Record "IRS 1099 Form"; + begin + IRS1099Form.Validate("Period No.", PeriodNo); + IRS1099Form.Validate("No.", FormNo); + IRS1099Form.Validate("Description", Description); + IRS1099Form.Insert(true); + end; + + local procedure AddFormBox(PeriodNo: Code[20]; FormNo: Code[20]; FormBoxNo: Code[20]; Description: Text; MinimumReportableAmount: Decimal) + var + IRS1099FormBox: Record "IRS 1099 Form Box"; + begin + IRS1099FormBox.Validate("Period No.", PeriodNo); + IRS1099FormBox.Validate("Form No.", FormNo); + IRS1099FormBox.Validate("No.", FormBoxNo); + IRS1099FormBox.Validate("Description", Description); + IRS1099FormBox.Validate("Minimum Reportable Amount", MinimumReportableAmount); + IRS1099FormBox.Insert(true); + end; + + local procedure AddFormStatementLine(PeriodNo: Code[20]; FormNo: Code[20]; FormBoxNo: Code[20]; StatementLineNo: Integer; Description: Text) + begin + AddFormStatementLine(PeriodNo, FormNo, Enum::"IRS 1099 Print Value Type"::Amount, FormBoxNo, StatementLineNo, Description); + end; + + local procedure AddFormStatementLine(PeriodNo: Code[20]; FormNo: Code[20]; Type: Enum "IRS 1099 Print Value Type"; FormBoxNo: Code[20]; StatementLineNo: Integer; Description: Text) + var + IRS1099FormStatementLine: Record "IRS 1099 Form Statement Line"; + begin + IRS1099FormStatementLine.Validate("Period No.", PeriodNo); + IRS1099FormStatementLine.Validate("Form No.", FormNo); + IRS1099FormStatementLine.Validate("Line No.", StatementLineNo); + IRS1099FormStatementLine.Validate("Print Value Type", Type); + IRS1099FormStatementLine.Validate("Row No.", FormBoxNo); + IRS1099FormStatementLine.Validate("Description", Description); + IRS1099FormStatementLine.Validate("Filter Expression", StrSubstNo(IRSFormStatementLineFilterExpressionTxt, FormBoxNo)); + IRS1099FormStatementLine.Insert(true); + end; + + local procedure AddFormInstructionLine(PeriodNo: Code[20]; FormNo: Code[20]; LineNo: Integer; Header: Text; Description: Text) + var + IRS1099FormInstruction: Record "IRS 1099 Form Instruction"; + begin + IRS1099FormInstruction.Validate("Period No.", PeriodNo); + IRS1099FormInstruction.Validate("Form No.", FormNo); + IRS1099FormInstruction.Validate("Line No.", LineNo); + IRS1099FormInstruction.Validate(Header, Header); + IRS1099FormInstruction.Validate(Description, Description); + IRS1099FormInstruction.Insert(true); + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Codeunits/SLPopulateVendor1099Data.Codeunit.al b/Apps/US/HybridSL_US/app/src/Codeunits/SLPopulateVendor1099Data.Codeunit.al new file mode 100644 index 0000000000..26e4616a88 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Codeunits/SLPopulateVendor1099Data.Codeunit.al @@ -0,0 +1,769 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +using Microsoft.Finance.GeneralLedger.Journal; +using Microsoft.Finance.GeneralLedger.Posting; +using Microsoft.Finance.ReceivablesPayables; +using Microsoft.Purchases.Payables; +using Microsoft.Finance.GeneralLedger.Account; +using Microsoft.Finance.VAT.Reporting; +using Microsoft.Foundation.NoSeries; +using Microsoft.Purchases.Vendor; +using System.Integration; + +codeunit 47201 "SL Populate Vendor 1099 Data" +{ + EventSubscriberInstance = Manual; + Permissions = tabledata "IRS 1099 Form Box" = R, + tabledata "IRS 1099 Vendor Form Box Setup" = RIM; + + var + DefaultPayablesAccountCode: Code[20]; + PostingDate: Date; + NextYearPostingDate: Date; + SLCurr1099Yr: Integer; + SLNext1099Yr: Integer; + Current1099YearOpen: Boolean; + Next1099YearOpen: Boolean; + GenJournalBatchDescriptionTxt: Label 'SL Vendor 1099 Tax Journal for ', Locked = true; + MessageCodeAbortedTxt: Label 'ABORTED', Locked = true; + MessageCodeCompletedTxt: Label 'COMPLETED', Locked = true; + MessageCodeSkippedTxt: Label 'SKIPPED', Locked = true; + MessageCodeStartTxt: Label 'START', Locked = true; + MessageCodeProcessingTxt: Label 'PROCESSING', Locked = true; + NoSeriesDescriptionTxt: Label 'SL Vendor 1099', Locked = true; + SourceCodeTxt: Label 'GENJNL', Locked = true; + VendorTaxBatchNameTxt: Label 'SL1099', Locked = true; + VendorTaxNoSeriesTxt: Label 'VENDTAX', Locked = true; + + [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post", 'OnBeforeCode', '', false, false)] + local procedure OnBeforeCode(var GenJournalLine: Record "Gen. Journal Line"; var HideDialog: Boolean) + begin + HideDialog := true; + end; + + [EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post", 'OnBeforeShowPostResultMessage', '', false, false)] + local procedure OnBeforeShowPostResultMessage(var GenJnlLine: Record "Gen. Journal Line"; TempJnlBatchName: Code[10]; var IsHandled: Boolean) + begin + IsHandled := true; + end; + + trigger OnRun() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + SLVendor1099MappingHelpers: Codeunit "SL Vendor 1099 Mapping Helpers"; + begin + if not SLCompanyAdditionalSettings.GetMigrateCurrent1099YearEnabled() and not SLCompanyAdditionalSettings.GetMigrateNext1099YearEnabled() then begin + LogMessage(MessageCodeAbortedTxt, 'SL Vendor 1099 Data Migration is not enabled on the SL Company Migration Configuration page.'); + exit; + end; + if not SLCompanyAdditionalSettings.GetMigrateCurrent1099YearEnabled() then + LogMessage(MessageCodeSkippedTxt, 'SL Vendor Current 1099 Year Data Migration is not enabled on the SL Company Migration Configuration page.'); + if not SLCompanyAdditionalSettings.GetMigrateNext1099YearEnabled() then + LogMessage(MessageCodeSkippedTxt, 'SL Vendor Next 1099 Year Data Migration is not enabled on the SL Company Migration Configuration page.'); + + SLCurr1099Yr := SLVendor1099MappingHelpers.GetCurrent1099YearFromSLAPSetup(); + if SLCurr1099Yr <> 0 then begin + Current1099YearOpen := SLVendor1099MappingHelpers.GetCurrent1099YearOpenStatus(); + end; + SLNext1099Yr := SLVendor1099MappingHelpers.GetNext1099YearFromSLAPSetup(); + if SLNext1099Yr <> 0 then begin + Next1099YearOpen := SLVendor1099MappingHelpers.GetNext1099YearOpenStatus(); + end; + if not Current1099YearOpen and not Next1099YearOpen then begin + LogMessage(MessageCodeAbortedTxt, 'Neither the SL Current 1099 Year nor the Next 1099 Year is open for data entry.'); + exit; + end; + if not Current1099YearOpen then + LogMessage(MessageCodeSkippedTxt, 'SL Current 1099 Year ' + Format(SLCurr1099Yr) + ' is not open for data entry.'); + + if not Next1099YearOpen then + LogMessage(MessageCodeSkippedTxt, 'SL Next 1099 Year ' + Format(SLNext1099Yr) + ' is not open for data entry.'); + + UpdateAllVendorTaxInfo(); + end; + + local procedure UpdateAllVendorTaxInfo() + begin + Initialize(); + LogMessage(MessageCodeCompletedTxt, 'Completed Initialization for Vendor Tax Info Update'); + if (SLCurr1099Yr <> 0) and (Current1099YearOpen) then begin + LogMessage(MessageCodeStartTxt, 'Starting SL Vendor 1099 Data Migration for Current 1099 Tax Year ' + Format(SLCurr1099Yr)); + UpdateVendorTaxInfo(SLCurr1099Yr, PostingDate); + LogMessage(MessageCodeCompletedTxt, 'Completed SL Vendor 1099 Data Migration for Current 1099 Tax Year ' + Format(SLCurr1099Yr)); + end; + + if (SLNext1099Yr <> 0) and (Next1099YearOpen) then begin + LogMessage(MessageCodeStartTxt, 'Starting SL Vendor 1099 Data Migration for Next 1099 Tax Year ' + Format(SLNext1099Yr)); + UpdateVendorTaxInfo(SLNext1099Yr, NextYearPostingDate); + LogMessage(MessageCodeCompletedTxt, 'Completed SL Vendor 1099 Data Migration for Next 1099 Tax Year ' + Format(SLNext1099Yr)); + end; + + LogMessage(MessageCodeCompletedTxt, 'Completed Vendor Tax Info Update'); + + CleanUp(); + end; + + local procedure Initialize() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + DataMigrationFacadeHelper: Codeunit "Data Migration Facade Helper"; + SLHelperFunctions: Codeunit "SL Helper Functions"; + CurrentYear: Integer; + Day31: Integer; + Month12: Integer; + NextYear: Integer; + VendorTaxBatchCode: Code[10]; + Day31Txt: Label '31', Locked = true; + Month12Txt: Label '12', Locked = true; + begin + SLCompanyAdditionalSettings.GetSingleInstance(); + CurrentYear := SLCurr1099Yr; + NextYear := SLNext1099Yr; + + CreateMappingsIfNeeded(); + + Evaluate(Day31, Day31Txt); + Evaluate(Month12, Month12Txt); + PostingDate := DMY2Date(Day31, Month12, CurrentYear); + NextYearPostingDate := DMY2Date(Day31, Month12, NextYear); + + CreateNoSeriesIfNeeded(); + DefaultPayablesAccountCode := SLHelperFunctions.GetPostingAccountNumber('PayablesAccount'); + + if (CurrentYear <> 0) and (Current1099YearOpen) then begin + VendorTaxBatchCode := VendorTaxBatchNameTxt + Format(CurrentYear); + CreateGeneralJournalBatchIfNeeded(VendorTaxBatchCode, '', '', CurrentYear); + end; + if (NextYear <> 0) and (Next1099YearOpen) then begin + VendorTaxBatchCode := VendorTaxBatchNameTxt + Format(NextYear); + CreateGeneralJournalBatchIfNeeded(VendorTaxBatchCode, '', '', NextYear); + end; + + DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(SourceCodeTxt); + end; + + local procedure CreateMappingsIfNeeded() + begin + Create1099Mappings(SLCurr1099Yr, Current1099YearOpen); + Create1099Mappings(SLNext1099Yr, Next1099YearOpen); + end; + + local procedure Create1099Mappings(TaxYear: Integer; Open1099Year: Boolean) + var + SLSupportedTaxYear: Record "SL Supported Tax Year"; + SLVendor1099MappingHelpers: Codeunit "SL Vendor 1099 Mapping Helpers"; + begin + if TaxYear = 0 then + exit; + if not Open1099Year then + exit; + if SLSupportedTaxYear.Get(TaxYear) then + exit; + SLVendor1099MappingHelpers.InsertSupportedTaxYear(TaxYear); + + // MISC + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '1', '1M', 'MISC', 'MISC-01'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '2', '2M', 'MISC', 'MISC-02'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '3', '3M', 'MISC', 'MISC-03'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '4', '4M', 'MISC', 'MISC-04'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '5', '5M', 'MISC', 'MISC-05'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '6', '6M', 'MISC', 'MISC-06'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '8', '8M', 'MISC', 'MISC-08'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '10', '9M', 'MISC', 'MISC-09'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '14', '10M', 'MISC', 'MISC-10'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '15', '12M', 'MISC', 'MISC-12'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '13', '14M', 'MISC', 'MISC-14'); + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '25', '15M', 'MISC', 'MISC-15'); + + // NEC + SLVendor1099MappingHelpers.InsertMapping(TaxYear, '7', '1N', 'NEC', 'NEC-01'); + + LogMessage(MessageCodeCompletedTxt, 'Completed Box Mappings for Tax Year ' + Format(TaxYear)); + end; + + local procedure CreateNoSeriesIfNeeded() + var + NoSeries: Record "No. Series"; + NoSeriesLine: Record "No. Series Line"; + begin + if not NoSeries.Get(VendorTaxNoSeriesTxt) then begin + NoSeries."Code" := VendorTaxNoSeriesTxt; + NoSeries.Description := NoSeriesDescriptionTxt; + NoSeries."Default Nos." := true; + NoSeries."Manual Nos." := true; + NoSeries.Insert(); + + NoSeriesLine."Series Code" := VendorTaxNoSeriesTxt; + NoSeriesLine."Starting No." := 'VT000000'; + NoSeriesLine."Ending No." := 'VT999999'; + NoSeriesLine."Increment-by No." := 1; + NoSeriesLine.Open := true; + NoSeriesLine.Insert(); + end; + end; + + local procedure UpdateVendorTaxInfo(TaxYear: Integer; YearEndPostingDate: Date) + var + SLVendor: Record "SL Vendor"; + begin + SLVendor.SetRange(Vend1099, 1); + if SLVendor.FindSet() then + repeat + LogVendorMessage(CopyStr(SLVendor.VendId, 1, MaxStrLen(SLVendor.VendId)), MessageCodeProcessingTxt, 'Processing Tax Info for Vendor No.: ' + SLVendor.VendId.Trim() + ', ' + 'Tax Year: ' + Format(TaxYear)); + ProcessVendorTaxInfo(SLVendor, TaxYear, YearEndPostingDate); + until SLVendor.Next() = 0; + end; + + local procedure ProcessVendorTaxInfo(var SLVendor: Record "SL Vendor"; TaxYear: Integer; YearEndPostingDate: Date) + var + Vendor: Record Vendor; + SLVendor1099MappingHelpers: Codeunit "SL Vendor 1099 Mapping Helpers"; + IRS1099Code: Code[10]; + begin + if not Vendor.Get(SLVendor.VendId) then begin + LogVendorMessage(SLVendor.VendId, MessageCodeAbortedTxt, 'Vendor No.: ' + SLVendor.VendId.Trim() + ' not found in Business Central.'); + exit; + end; + + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, SLVendor.DfltBox); + if IRS1099Code <> '' then + if not VendorAlreadyHasIRS1099CodeAssigned(Vendor, TaxYear) then begin + AssignIRS1099CodeToVendor(Vendor, IRS1099Code, TaxYear); + if SLVendor.TIN.TrimEnd() <> '' then + Vendor.Validate("Federal ID No.", SLVendor.TIN.TrimEnd()); + if SLVendor.S4Future09 = 1 then + Vendor.Validate("FATCA Requirement", true); + if SLVendor.TIN.TrimEnd() <> '' then + Vendor.Validate("Tax Identification Type", Vendor."Tax Identification Type"::"Legal Entity"); + if not Vendor.Modify() then begin + LogLastError(Vendor."No."); + exit; + end; + end else + LogVendorSkipped(Vendor."No.", 'Vendor already has an IRS 1099 Code assigned.'); + + AddVendor1099Values(Vendor, TaxYear, YearEndPostingDate); + end; + + local procedure VendorAlreadyHasIRS1099CodeAssigned(var Vendor: Record Vendor; TaxYear: Integer): Boolean + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + IRS1099VendorFormBoxSetup: Record "IRS 1099 Vendor Form Box Setup"; + begin + SLCompanyAdditionalSettings.GetSingleInstance(); + if IRS1099VendorFormBoxSetup.Get(TaxYear, Vendor."No.") then + exit(true); + end; + + local procedure AssignIRS1099CodeToVendor(var Vendor: Record Vendor; IRS1099Code: Code[10]; TaxYear: Integer): Boolean + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + IRS1099VendorFormBoxSetup: Record "IRS 1099 Vendor Form Box Setup"; + IRS1099FormBox: Record "IRS 1099 Form Box"; + begin + IRS1099FormBox.SetRange("No.", IRS1099Code); + if not IRS1099FormBox.FindFirst() then + exit(false); + + SLCompanyAdditionalSettings.GetSingleInstance(); + IRS1099VendorFormBoxSetup.Validate("Period No.", Format(TaxYear)); + IRS1099VendorFormBoxSetup.Validate("Vendor No.", Vendor."No."); + IRS1099VendorFormBoxSetup.Validate("Form No.", IRS1099FormBox."Form No."); + IRS1099VendorFormBoxSetup.Validate("Form Box No.", IRS1099Code); + IRS1099VendorFormBoxSetup.Insert(true); + LogVendorDefaultBoxMessage(Vendor."No.", IRS1099Code, MessageCodeCompletedTxt, 'Assigned IRS 1099 Code ' + IRS1099Code + ' to Vendor No.: ' + Vendor."No."); + exit(true); + end; + + local procedure AddVendor1099Values(var Vendor: Record Vendor; TaxYear: Integer; YearEndPostingDate: Date) + var + InvoiceGenJournalLine: Record "Gen. Journal Line"; + PaymentGenJournalLine: Record "Gen. Journal Line"; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + NoSeries: Codeunit "No. Series"; + InvoiceDocumentNo: Code[20]; + InvoiceExternalDocumentNo: Code[35]; + IRS1099Code: Code[10]; + PaymentDocumentNo: Code[20]; + PaymentExternalDocumentNo: Code[35]; + VendorPayablesAccountCode: Code[20]; + VendorYear1099AmountDictionary: Dictionary of [Code[10], Decimal]; + TaxAmount: Decimal; + InvoiceCreated: Boolean; + PaymentCreated: Boolean; + begin + BuildVendor1099Entries(Vendor."No.", VendorYear1099AmountDictionary, TaxYear); + LogVendorMessage(Vendor."No.", MessageCodeCompletedTxt, 'Built 1099 Entries for Vendor No.: ' + Vendor."No." + ' for Tax Year: ' + Format(TaxYear)); + if VendorYear1099AmountDictionary.Count() = 0 then begin + LogVendorSkipped(Vendor."No.", 'No 1099 amounts found for Vendor: ' + Vendor."No." + ' for Tax Year: ' + Format(TaxYear)); + exit; + end; + + VendorPayablesAccountCode := GetPostingAccountNo(Vendor); + if VendorPayablesAccountCode = '' then begin + LogErrorMessage(Vendor."No.", 'No Payables Account found.'); + exit; + end; + + SLCompanyAdditionalSettings.GetSingleInstance(); + foreach IRS1099Code in VendorYear1099AmountDictionary.Keys() do begin + TaxAmount := VendorYear1099AmountDictionary.Get(IRS1099Code); + + if TaxAmount > 0 then begin + // Invoice + InvoiceExternalDocumentNo := CopyStr(IRS1099Code + '-INV-' + Format(TaxYear), 1, MaxStrLen(InvoiceExternalDocumentNo)); + InvoiceDocumentNo := NoSeries.GetNextNo(VendorTaxNoSeriesTxt); + InvoiceCreated := CreateGeneralJournalLine(InvoiceGenJournalLine, + Vendor."No.", + "Gen. Journal Document Type"::Invoice, + InvoiceDocumentNo, + IRS1099Code, + Vendor."No.", + -TaxAmount, + VendorPayablesAccountCode, + IRS1099Code, + InvoiceExternalDocumentNo, + YearEndPostingDate, + TaxYear); + + if InvoiceCreated then + LogVendorDefaultBoxMessage(Vendor."No.", IRS1099Code, MessageCodeCompletedTxt, 'Created Invoice Journal Line for Amount: ' + Format(-TaxAmount)); + + // Payment + PaymentExternalDocumentNo := CopyStr(IRS1099Code + '-PMT-' + Format(TaxYear), 1, MaxStrLen(PaymentExternalDocumentNo)); + PaymentDocumentNo := NoSeries.GetNextNo(VendorTaxNoSeriesTxt); + PaymentCreated := CreateGeneralJournalLine(PaymentGenJournalLine, + Vendor."No.", + "Gen. Journal Document Type"::Payment, + PaymentDocumentNo, + IRS1099Code, + Vendor."No.", + TaxAmount, + VendorPayablesAccountCode, + IRS1099Code, + PaymentExternalDocumentNo, + YearEndPostingDate, + TaxYear); + + if PaymentCreated then + LogVendorDefaultBoxMessage(Vendor."No.", IRS1099Code, MessageCodeCompletedTxt, 'Created Payment Journal Line for Amount: ' + Format(TaxAmount)); + + if InvoiceCreated and PaymentCreated then begin + InvoiceGenJournalLine.SendToPosting(Codeunit::"Gen. Jnl.-Post"); + PaymentGenJournalLine.SendToPosting(Codeunit::"Gen. Jnl.-Post"); + ApplyEntries(Vendor."No.", InvoiceDocumentNo, PaymentDocumentNo, InvoiceExternalDocumentNo, YearEndPostingDate); + end; + end; + end; + end; + + local procedure GetPostingAccountNo(var Vendor: Record Vendor): Code[20] + var + VendorPostingGroup: Record "Vendor Posting Group"; + GLAccount: Record "G/L Account"; + begin + if Vendor."Vendor Posting Group" = '' then + exit(DefaultPayablesAccountCode); + + if VendorPostingGroup.Get(Vendor."Vendor Posting Group") then + if VendorPostingGroup."Payables Account" <> '' then + if GLAccount.Get(VendorPostingGroup."Payables Account") then + exit(GLAccount."No."); + + exit(''); + end; + + local procedure BuildVendor1099Entries(VendorNo: Code[20]; var VendorYear1099AmountDictionary: Dictionary of [Code[10], Decimal]; TaxYear: Integer) + var + SLAPBalances: Record "SL AP_Balances"; + SLVendor1099MappingHelpers: Codeunit "SL Vendor 1099 Mapping Helpers"; + IRS1099Code: Code[10]; + TaxAmount: Decimal; + begin + if SLAPBalances.Get(VendorNo, CompanyName) then begin + if SLAPBalances.CYBox00 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '1') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox00) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox00); + if SLAPBalances.CYBox01 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '2') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox01) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox01); + if SLAPBalances.CYBox02 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '3') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox02) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox02); + if SLAPBalances.CYBox03 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '4') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox03) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox03); + if SLAPBalances.CYBox04 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '5') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox04) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox04); + if SLAPBalances.CYBox05 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '6') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox05) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox05); + if SLAPBalances.CYBox06 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '7') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox06) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox06); + if SLAPBalances.CYBox07 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '8') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox07) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox07); + if SLAPBalances.CYBox09 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '10') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox09) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox09); + if SLAPBalances.CYBox14 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '14') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox14) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox14); + if SLAPBalances.CYBox11 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '15') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox11) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox11); + if SLAPBalances.CYBox13 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '13') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox13) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox13); + if SLAPBalances.CYBox12 > 0 then + IRS1099Code := SLVendor1099MappingHelpers.GetIRS1099BoxCode(TaxYear, '25') + else + IRS1099Code := ''; + if IRS1099Code <> '' then + if VendorYear1099AmountDictionary.Get(IRS1099Code, TaxAmount) then + VendorYear1099AmountDictionary.Set(IRS1099Code, TaxAmount + SLAPBalances.CYBox12) + else + VendorYear1099AmountDictionary.Add(IRS1099Code, SLAPBalances.CYBox12); + end; + end; + + local procedure CreateGeneralJournalLine(var GenJournalLine: Record "Gen. Journal Line"; VendorNo: Code[20]; DocumentType: enum "Gen. Journal Document Type"; DocumentNo: Code[20]; + Description: Text[50]; AccountNo: Code[20]; Amount: Decimal; BalancingAccount: Code[20]; IRS1099Code: Code[10]; ExternalDocumentNo: Code[35]; YearEndPostingDate: Date; TaxYear: Integer): boolean + var + GenJournalBatch: Record "Gen. Journal Batch"; + GenJournalLineCurrent: Record "Gen. Journal Line"; + GenJournalTemplate: Record "Gen. Journal Template"; + IRS1099FormBox: Record "IRS 1099 Form Box"; + LineNum: Integer; + VendorTaxBatchCode: Code[10]; + begin + VendorTaxBatchCode := VendorTaxBatchNameTxt + Format(TaxYear); + GenJournalBatch.Get(CreateGenJournalTemplateIfNeeded(VendorTaxBatchCode, TaxYear), VendorTaxBatchCode); + + GenJournalLineCurrent.SetRange("Journal Template Name", GenJournalBatch."Journal Template Name"); + GenJournalLineCurrent.SetRange("Journal Batch Name", GenJournalBatch.Name); + if GenJournalLineCurrent.FindLast() then + LineNum := GenJournalLineCurrent."Line No." + 10000 + else + LineNum := 10000; + + GenJournalTemplate.Get(GenJournalBatch."Journal Template Name"); + + Clear(GenJournalLine); + GenJournalLine.SetHideValidation(true); + GenJournalLine.Validate("Source Code", GenJournalTemplate."Source Code"); + GenJournalLine.Validate("Journal Template Name", GenJournalBatch."Journal Template Name"); + GenJournalLine.Validate("Journal Batch Name", GenJournalBatch.Name); + GenJournalLine.Validate("Line No.", LineNum); + GenJournalLine.Validate("Account Type", "Gen. Journal Account Type"::Vendor); + GenJournalLine.Validate("Document No.", DocumentNo); + GenJournalLine.Validate("Account No.", AccountNo); + GenJournalLine.Validate(Description, Description); + GenJournalLine.Validate("Document Date", YearEndPostingDate); + GenJournalLine.Validate("Posting Date", YearEndPostingDate); + GenJournalLine.Validate("Due Date", YearEndPostingDate); + GenJournalLine.Validate(Amount, Amount); + GenJournalLine.Validate("Amount (LCY)", Amount); + GenJournalLine.Validate("Currency Code", ''); + GenJournalLine.Validate("Bal. Account Type", GenJournalLine."Bal. Account Type"::"G/L Account"); + GenJournalLine.Validate("Bal. Account No.", BalancingAccount); + GenJournalLine.Validate("Bal. Gen. Posting Type", GenJournalLine."Bal. Gen. Posting Type"::" "); + GenJournalLine.Validate("Bal. Gen. Bus. Posting Group", ''); + GenJournalLine.Validate("Bal. Gen. Prod. Posting Group", ''); + GenJournalLine.Validate("Bal. VAT Prod. Posting Group", ''); + GenJournalLine.Validate("Bal. VAT Bus. Posting Group", ''); + GenJournalLine.Validate("Document Type", DocumentType); + GenJournalLine.Validate("Source Code", SourceCodeTxt); + GenJournalLine.Validate("External Document No.", ExternalDocumentNo); + GenJournalLine.Validate("IRS 1099 Reporting Period", Format(TaxYear)); + + IRS1099FormBox.SetRange("No.", IRS1099Code); + if IRS1099FormBox.FindFirst() then + GenJournalLine.Validate("IRS 1099 Form No.", IRS1099FormBox."Form No."); + + GenJournalLine.Validate("IRS 1099 Form Box No.", IRS1099Code); + GenJournalLine.Validate("IRS 1099 Reporting Amount", Amount); + + if GenJournalLine.Insert(true) then + exit(true) + else + LogLastError(VendorNo); + + exit(false); + end; + + local procedure CreateGenJournalTemplateIfNeeded(GenJournalBatchCode: Code[10]; TaxYear: Integer): Code[10] + var + GenJournalTemplate: Record "Gen. Journal Template"; + begin + GenJournalTemplate.SetRange(Type, GenJournalTemplate.Type::General); + GenJournalTemplate.SetRange(Recurring, false); + if not GenJournalTemplate.FindFirst() then begin + Clear(GenJournalTemplate); + GenJournalTemplate.Validate(Name, GenJournalBatchCode); + GenJournalTemplate.Validate(Type, GenJournalTemplate.Type::General); + GenJournalTemplate.Validate(Recurring, false); + GenJournalTemplate.Validate(Description, GenJournalBatchDescriptionTxt + Format(TaxYear)); + GenJournalTemplate.Insert(true); + end; + exit(GenJournalTemplate.Name); + end; + + local procedure ApplyEntries(VendorNo: Code[20]; InvoiceDocumentNo: Code[20]; PaymentDocumentNo: Code[20]; ExternalDocumentNo: Code[35]; YearEndPostingDate: Date) + var + PaymentVendorLedgerEntry: Record "Vendor Ledger Entry"; + InvoiceVendorLedgerEntry: Record "Vendor Ledger Entry"; + ApplyUnapplyParameters: Record "Apply Unapply Parameters"; + VendEntrySetApplID: Codeunit "Vend. Entry-SetAppl.ID"; + VendEntryApplyPostedEntries: Codeunit "VendEntry-Apply Posted Entries"; + begin + PaymentVendorLedgerEntry.SetRange("Vendor No.", VendorNo); + PaymentVendorLedgerEntry.SetRange("Document Type", "Gen. Journal Document Type"::Payment); + PaymentVendorLedgerEntry.SetRange("Document No.", PaymentDocumentNo); + PaymentVendorLedgerEntry.SetRange("Posting Date", YearEndPostingDate); + if PaymentVendorLedgerEntry.FindFirst() then begin + InvoiceVendorLedgerEntry.SetRange("Vendor No.", VendorNo); + InvoiceVendorLedgerEntry.SetRange("Document Type", "Gen. Journal Document Type"::Invoice); + InvoiceVendorLedgerEntry.SetRange("Document No.", InvoiceDocumentNo); + InvoiceVendorLedgerEntry.SetRange("Posting Date", YearEndPostingDate); + + if InvoiceVendorLedgerEntry.FindFirst() then begin + PaymentVendorLedgerEntry.CalcFields(Amount); + InvoiceVendorLedgerEntry.CalcFields(Amount); + + InvoiceVendorLedgerEntry.Validate("Applying Entry", true); + InvoiceVendorLedgerEntry.Validate("Applies-to ID", PaymentVendorLedgerEntry."Document No."); + InvoiceVendorLedgerEntry.CalcFields("Remaining Amount"); + InvoiceVendorLedgerEntry.Validate("Amount to Apply", InvoiceVendorLedgerEntry.Amount); + Codeunit.Run(Codeunit::"Vend. Entry-Edit", InvoiceVendorLedgerEntry); + + VendEntrySetApplID.SetApplId(PaymentVendorLedgerEntry, InvoiceVendorLedgerEntry, PaymentVendorLedgerEntry."Document No."); + + ApplyUnapplyParameters."Account Type" := "Gen. Journal Account Type"::Vendor; + ApplyUnapplyParameters."Account No." := VendorNo; + ApplyUnapplyParameters."Document Type" := InvoiceVendorLedgerEntry."Document Type"; + ApplyUnapplyParameters."Document No." := InvoiceVendorLedgerEntry."Document No."; + ApplyUnapplyParameters."Posting Date" := YearEndPostingDate; + ApplyUnapplyParameters."External Document No." := ExternalDocumentNo; + VendEntryApplyPostedEntries.Apply(InvoiceVendorLedgerEntry, ApplyUnapplyParameters); + end; + end; + end; + + local procedure CreateGeneralJournalBatchIfNeeded(GeneralJournalBatchCode: Code[10]; NoSeriesCode: Code[20]; PostingNoSeriesCode: Code[20]; TaxYear: Integer) + var + GenJournalBatch: Record "Gen. Journal Batch"; + TemplateName: Code[10]; + begin + TemplateName := CreateGenJournalTemplateIfNeeded(GeneralJournalBatchCode, TaxYear); + GenJournalBatch.SetRange("Journal Template Name", TemplateName); + GenJournalBatch.SetRange(Name, GeneralJournalBatchCode); + GenJournalBatch.SetRange("No. Series", NoSeriesCode); + GenJournalBatch.SetRange("Posting No. Series", PostingNoSeriesCode); + if not GenJournalBatch.FindFirst() then begin + GenJournalBatch.Init(); + GenJournalBatch.Validate("Journal Template Name", TemplateName); + GenJournalBatch.SetupNewBatch(); + GenJournalBatch.Validate(Name, GeneralJournalBatchCode); + GenJournalBatch.Validate(Description, GenJournalBatchDescriptionTxt + Format(TaxYear)); + GenJournalBatch."No. Series" := NoSeriesCode; + GenJournalBatch."Posting No. Series" := PostingNoSeriesCode; + GenJournalBatch.Insert(true); + end; + end; + + local procedure CleanUp() + var + GenJournalTemplate: Record "Gen. Journal Template"; + GenJournalBatch: Record "Gen. Journal Batch"; + GenJournalLine: Record "Gen. Journal Line"; + CurrentYearJournalBatchName: Code[20]; + NextYearJournalBatchName: Code[20]; + begin + // Current Year + CurrentYearJournalBatchName := VendorTaxBatchNameTxt + Format(SLCurr1099Yr); + GenJournalLine.SetRange("Journal Batch Name", CurrentYearJournalBatchName); + GenJournalLine.SetFilter("Account No.", '<>%1', ''); + if (not GenJournalLine.IsEmpty()) then + exit; + + Clear(GenJournalLine); + GenJournalLine.SetRange("Journal Batch Name", CurrentYearJournalBatchName); + GenJournalLine.SetRange("Account No.", ''); + if not GenJournalLine.IsEmpty() then + GenJournalLine.DeleteAll(); + GenJournalBatch.SetRange(Name, CurrentYearJournalBatchName); + if GenJournalBatch.FindFirst() then begin + GenJournalLine.SetRange("Journal Batch Name", CurrentYearJournalBatchName); + if (not GenJournalLine.IsEmpty()) then + exit; + GenJournalBatch.Delete(true); + if (GenJournalTemplate.Get(CurrentYearJournalBatchName)) then + GenJournalTemplate.Delete(true); + end; + + // Next Year + NextYearJournalBatchName := VendorTaxBatchNameTxt + Format(SLNext1099Yr); + GenJournalLine.SetRange("Journal Batch Name", NextYearJournalBatchName); + GenJournalLine.SetFilter("Account No.", '<>%1', ''); + if (not GenJournalLine.IsEmpty()) then + exit; + + Clear(GenJournalLine); + GenJournalLine.SetRange("Journal Batch Name", NextYearJournalBatchName); + GenJournalLine.SetRange("Account No.", ''); + if not GenJournalLine.IsEmpty() then + GenJournalLine.DeleteAll(); + GenJournalBatch.SetRange(Name, NextYearJournalBatchName); + if GenJournalBatch.FindFirst() then begin + GenJournalLine.SetRange("Journal Batch Name", NextYearJournalBatchName); + if (not GenJournalLine.IsEmpty()) then + exit; + GenJournalBatch.Delete(true); + if (GenJournalTemplate.Get(NextYearJournalBatchName)) then + GenJournalTemplate.Delete(true); + end; + end; + + local procedure LogLastError(VendorNo: Code[20]) + var + SL1099MigrationLog: Record "SL 1099 Migration Log"; + begin + SL1099MigrationLog."Vendor No." := VendorNo; + SL1099MigrationLog.IsError := true; + SL1099MigrationLog."Error Code" := CopyStr(GetLastErrorCode(), 1, MaxStrLen(SL1099MigrationLog."Error Code")); + SL1099MigrationLog.SetErrorMessage(GetLastErrorCallStack()); + SL1099MigrationLog.Insert(); + ClearLastError(); + end; + + local procedure LogErrorMessage(VendorNo: Code[20]; ErrorMsg: Text) + var + SL1099MigrationLog: Record "SL 1099 Migration Log"; + begin + SL1099MigrationLog."Vendor No." := VendorNo; + SL1099MigrationLog.IsError := true; + SL1099MigrationLog.SetErrorMessage(ErrorMsg); + SL1099MigrationLog.Insert(); + ClearLastError(); + end; + + local procedure LogVendorSkipped(VendorNo: Code[20]; MessageText: Text[250]) + var + SL1099MigrationLog: Record "SL 1099 Migration Log"; + begin + SL1099MigrationLog."Vendor No." := VendorNo; + SL1099MigrationLog.WasSkipped := true; + SL1099MigrationLog."Message Text" := MessageText; + SL1099MigrationLog.Insert(); + end; + + local procedure LogMessage(MessageCode: Text[100]; MessageText: Text[250]) + var + SL1099MigrationLog: Record "SL 1099 Migration Log"; + begin + SL1099MigrationLog."Message Code" := MessageCode; + SL1099MigrationLog."Message Text" := MessageText; + SL1099MigrationLog.Insert(); + end; + + local procedure LogVendorMessage(VendorNo: Code[20]; MessageCode: Text[100]; MessageText: Text[250]) + var + SL1099MigrationLog: Record "SL 1099 Migration Log"; + begin + SL1099MigrationLog."Vendor No." := VendorNo; + SL1099MigrationLog."Message Code" := MessageCode; + SL1099MigrationLog."Message Text" := MessageText; + SL1099MigrationLog.Insert(); + end; + + local procedure LogVendorDefaultBoxMessage(VendorNo: Code[20]; IRS1099Code: Code[10]; MessageCode: Text[100]; MessageText: Text[250]) + var + SL1099MigrationLog: Record "SL 1099 Migration Log"; + begin + SL1099MigrationLog."Vendor No." := VendorNo; + SL1099MigrationLog."BC IRS 1099 Code" := IRS1099Code; + SL1099MigrationLog."Message Code" := MessageCode; + SL1099MigrationLog."Message Text" := MessageText; + SL1099MigrationLog.Insert(); + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Codeunits/SLVendor1099MappingHelpers.Codeunit.al b/Apps/US/HybridSL_US/app/src/Codeunits/SLVendor1099MappingHelpers.Codeunit.al new file mode 100644 index 0000000000..6586284e94 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Codeunits/SLVendor1099MappingHelpers.Codeunit.al @@ -0,0 +1,101 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +codeunit 47202 "SL Vendor 1099 Mapping Helpers" +{ + var + APStringTxt: Label 'AP', Locked = true; + StatusOpenTxt: Label 'O', Locked = true; + + procedure InsertSupportedTaxYear(TaxYear: Integer) + var + SLSupportedTaxYear: Record "SL Supported Tax Year"; + begin + SLSupportedTaxYear."Tax Year" := TaxYear; + SLSupportedTaxYear.Insert(); + end; + + procedure InsertMapping(TaxYear: Integer; SL1099DataValue: Text[2]; SL1099BoxNo: Text[3]; FormType: Text[4]; BCIRS1099Code: Code[10]) + var + SL1099BoxMapping: Record "SL 1099 Box Mapping"; + begin + SL1099BoxMapping."Tax Year" := TaxYear; + SL1099BoxMapping."SL 1099 Box No." := SL1099BoxNo; + SL1099BoxMapping."SL Data Value" := SL1099DataValue; + SL1099BoxMapping."Form Type" := FormType; + SL1099BoxMapping."BC IRS 1099 Code" := BCIRS1099Code; + SL1099BoxMapping.Insert(); + end; + + procedure GetIRS1099BoxCode(TaxYear: Integer; SL1099DataValue: Text[2]): Code[10] + var + SL1099BoxMapping: Record "SL 1099 Box Mapping"; + begin + if SL1099BoxMapping.Get(TaxYear, SL1099DataValue) then + exit(SL1099BoxMapping."BC IRS 1099 Code"); + + exit(''); + end; + + internal procedure GetCurrent1099YearFromSLAPSetup(): Integer + var + SLAPSetup: Record "SL APSetup"; + ReportingYear: Integer; + begin + if not SLAPSetup.Get(APStringTxt) then + exit(0); + + if Evaluate(ReportingYear, SLAPSetup.Curr1099Yr) then + exit(ReportingYear) + else + exit(0); + end; + + internal procedure GetCurrent1099YearOpenStatus(): Boolean + var + SLAPSetup: Record "SL APSetup"; + CurrentYearStatus: Text[1]; + begin + if not SLAPSetup.Get(APStringTxt) then + exit(false); + + CurrentYearStatus := SLAPSetup.CY1099Stat; + if CurrentYearStatus = StatusOpenTxt then + exit(true) + else + exit(false); + end; + + internal procedure GetNext1099YearFromSLAPSetup(): Integer + var + SLAPSetup: Record "SL APSetup"; + ReportingYear: Integer; + begin + if not SLAPSetup.Get(APStringTxt) then + exit(0); + + if Evaluate(ReportingYear, SLAPSetup.Next1099Yr) then + exit(ReportingYear) + else + exit(0); + end; + + internal procedure GetNext1099YearOpenStatus(): Boolean + var + SLAPSetup: Record "SL APSetup"; + NextYearStatus: Text[1]; + begin + if not SLAPSetup.Get(APStringTxt) then + exit(false); + + NextYearStatus := SLAPSetup.NY1099Stat; + if NextYearStatus = StatusOpenTxt then + exit(true) + else + exit(false); + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/PageExt/SLCompanyAddSettListExt.PageExt.al b/Apps/US/HybridSL_US/app/src/PageExt/SLCompanyAddSettListExt.PageExt.al new file mode 100644 index 0000000000..489b410394 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/PageExt/SLCompanyAddSettListExt.PageExt.al @@ -0,0 +1,28 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +pageextension 47201 "SL Company Add. Sett. List Ext" extends "SL Company Add. Settings List" +{ + layout + { + addlast(General) + { + field("Migrate Current 1099 Year"; Rec."Migrate Current 1099 Year") + { + ApplicationArea = All; + Caption = 'Migrate Current 1099 Year'; + ToolTip = 'Specifies whether to migrate current 1099 year data.'; + } + field("Migrate Next 1099 Year"; Rec."Migrate Next 1099 Year") + { + ApplicationArea = All; + Caption = 'Migrate Next 1099 Year'; + ToolTip = 'Specifies whether to migrate next 1099 year data.'; + } + } + } +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/PageExt/SLMigrationConfigurationExt.PageExt.al b/Apps/US/HybridSL_US/app/src/PageExt/SLMigrationConfigurationExt.PageExt.al new file mode 100644 index 0000000000..520f13e574 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/PageExt/SLMigrationConfigurationExt.PageExt.al @@ -0,0 +1,61 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +pageextension 47200 "SL Migration Configuration Ext" extends "SL Migration Configuration" +{ + layout + { + addafter(Classes) + { + group(Vendor1099) + { + Caption = 'Vendor 1099'; + InstructionalText = 'Choose whether to migrate vendor 1099 information from Dynamics SL to Business Central. This option is only available if the Payables module is selected for migration.'; + + field("Migrate Current 1099 Year"; Rec."Migrate Current 1099 Year") + { + ApplicationArea = All; + Caption = 'Migrate Current 1099 Year'; + ToolTip = 'Specifies whether to migrate current 1099 year information.'; + + trigger OnValidate() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + begin + SLCompanyAdditionalSettings.SetFilter(Name, '<>%1', ''); + if SLCompanyAdditionalSettings.FindSet() then + repeat + SLCompanyAdditionalSettings.Validate("Migrate Current 1099 Year", Rec."Migrate Current 1099 Year"); + SLCompanyAdditionalSettings.Modify(); + until SLCompanyAdditionalSettings.Next() = 0; + end; + } + field("Migrate Next 1099 Year"; Rec."Migrate Next 1099 Year") + { + ApplicationArea = All; + Caption = 'Migrate Next 1099 Year'; + ToolTip = 'Specifies whether to migrate next 1099 year information.'; + + trigger OnValidate() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + begin + SLCompanyAdditionalSettings.SetFilter(Name, '<>%1', ''); + if SLCompanyAdditionalSettings.FindSet() then + repeat + SLCompanyAdditionalSettings.Validate("Migrate Next 1099 Year", Rec."Migrate Next 1099 Year"); + SLCompanyAdditionalSettings.Modify(); + until SLCompanyAdditionalSettings.Next() = 0; + end; + } + } + } + } +} + + + diff --git a/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al b/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al new file mode 100644 index 0000000000..920baf7a1a --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al @@ -0,0 +1,88 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +page 47200 "SL 1099 Migration Log" +{ + ApplicationArea = All; + Caption = 'SL 1099 Migration Log'; + PageType = List; + SourceTable = "SL 1099 Migration Log"; + UsageCategory = Administration; + DeleteAllowed = false; + InsertAllowed = false; + ModifyAllowed = false; + + layout + { + area(Content) + { + repeater(General) + { + field("Vendor No."; Rec."Vendor No.") + { + Caption = 'Vendor No.'; + ToolTip = 'Specifies the value of the Vendor No. field.'; + } + field("SL Data Value"; Rec."SL Data Value") + { + Caption = 'SL Data Value'; + ToolTip = 'Specifies the value of the DfltBox field in the SL Vendor table.'; + } + field("SL 1099 Box No."; Rec."SL 1099 Box No.") + { + Caption = 'SL Default 1099 Box No.'; + ToolTip = 'Specifies the SL Default 1099 Box No. based on the SL Data Value field.'; + } + field("Form Type"; Rec."Form Type") + { + Caption = 'Form Type'; + ToolTip = 'Specifies the value of the Form Type field. Value can be MISC or NEC.'; + } + field("BC IRS 1099 Code"; Rec."BC IRS 1099 Code") + { + Caption = 'IRS 1099 Code'; + ToolTip = 'Specifies the value of the IRS 1099 Code in Business Central based on the SL 1099 Box No. field.'; + } + field(WasSkipped; Rec.WasSkipped) + { + Caption = 'Was Skipped'; + ToolTip = 'Specifies whether the record was skipped.'; + } + field(IsError; Rec.IsError) + { + Caption = 'Is Error'; + ToolTip = 'Specifies whether the record has an error.'; + } + field("Error Code"; Rec."Error Code") + { + Caption = 'Error Code'; + ToolTip = 'Specifies the value of the Error Code field.'; + } + field("Error Message"; Rec.GetErrorMessage()) + { + Caption = 'Error Message'; + ToolTip = 'Specifies the value of the Error Message field.'; + } + field("Message Code"; Rec."Message Code") + { + Caption = 'Message Code'; + ToolTip = 'Specifies the value of the Message Code field.'; + } + field("Message Text"; Rec."Message Text") + { + Caption = 'Message Text'; + ToolTip = 'Specifies the value of the Message Text field.'; + } + } + } + } + + procedure FilterOnErrors() + begin + Rec.SetRange(IsError, true); + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/TableExt/SLCompanyAddSettingsExt.TableExt.al b/Apps/US/HybridSL_US/app/src/TableExt/SLCompanyAddSettingsExt.TableExt.al new file mode 100644 index 0000000000..e9e690444e --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/TableExt/SLCompanyAddSettingsExt.TableExt.al @@ -0,0 +1,79 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + + +tableextension 47200 "SL Company Add. Settings Ext." extends "SL Company Additional Settings" +{ + fields + { + field(57200; "Migrate Current 1099 Year"; Boolean) + { + Caption = 'Migrate Current 1099 Year'; + InitValue = true; + DataClassification = SystemMetadata; + + trigger OnValidate() + begin + if Rec."Migrate Current 1099 Year" then begin + Rec.Validate("Migrate Payables Module", true); + + if not Rec."Migrate GL Module" then + Rec.Validate("Migrate GL Module", true); + end; + end; + } + field(57201; "Migrate Next 1099 Year"; Boolean) + { + Caption = 'Migrate Next 1099 Year'; + InitValue = true; + DataClassification = SystemMetadata; + + trigger OnValidate() + begin + if Rec."Migrate Next 1099 Year" then begin + Rec.Validate("Migrate Payables Module", true); + + if not Rec."Migrate GL Module" then + Rec.Validate("Migrate GL Module", true); + end; + end; + } + + modify("Migrate Payables Module") + { + trigger OnAfterValidate() + begin + if not Rec."Migrate Payables Module" then begin + Rec."Migrate Current 1099 Year" := false; + Rec."Migrate Next 1099 Year" := false; + end; + end; + } + modify("Migrate GL Module") + { + trigger OnAfterValidate() + begin + if not Rec."Migrate GL Module" then begin + Rec."Migrate Current 1099 Year" := false; + Rec."Migrate Next 1099 Year" := false; + end; + end; + } + } + + procedure GetMigrateCurrent1099YearEnabled(): Boolean + begin + GetSingleInstance(); + exit(Rec."Migrate Current 1099 Year"); + end; + + procedure GetMigrateNext1099YearEnabled(): Boolean + begin + GetSingleInstance(); + exit(Rec."Migrate Next 1099 Year"); + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al b/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al new file mode 100644 index 0000000000..d30a4d9097 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al @@ -0,0 +1,50 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +table 47201 "SL 1099 Box Mapping" +{ + Access = Internal; + DataPerCompany = false; + Caption = 'SL 1099 Box Mapping'; + DataClassification = SystemMetadata; + + Fields + { + field(1; "Tax Year"; Integer) + { + Caption = 'Tax Year'; + NotBlank = true; + TableRelation = "SL Supported Tax Year"."Tax Year"; + } + field(2; "SL Data Value"; Text[2]) + { + Caption = 'SL Data Value'; + } + field(3; "SL 1099 Box No."; Text[3]) + { + Caption = 'SL 1099 Box No.'; + NotBlank = true; + } + field(4; "Form Type"; Text[4]) + { + Caption = 'Form Type'; + NotBlank = true; + } + field(5; "BC IRS 1099 Code"; Code[10]) + { + Caption = 'BC IRS 1099 Code'; + NotBlank = true; + } + } + Keys + { + key(Key1; "Tax Year", "SL Data Value") + { + Clustered = true; + } + } +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Tables/SL1099MigrationLog.Table.al b/Apps/US/HybridSL_US/app/src/Tables/SL1099MigrationLog.Table.al new file mode 100644 index 0000000000..ec7947327f --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Tables/SL1099MigrationLog.Table.al @@ -0,0 +1,97 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +table 47203 "SL 1099 Migration Log" +{ + Caption = 'SL 1099 Migration Log'; + DataClassification = SystemMetadata; + + fields + { + field(1; "Primary Key"; Integer) + { + Caption = 'Primary Key'; + AutoIncrement = true; + } + field(2; "Vendor No."; Code[20]) + { + Caption = 'Vendor No.'; + DataClassification = CustomerContent; + } + field(3; "SL Data Value"; Text[2]) + { + Caption = 'SL Data Value'; + } + field(4; "SL 1099 Box No."; Text[3]) + { + Caption = 'SL 1099 Box No.'; + } + field(5; "Form Type"; Text[4]) + { + Caption = 'Form Type'; + } + field(6; "BC IRS 1099 Code"; Code[10]) + { + Caption = 'BC IRS 1099 Code'; + } + field(7; IsError; Boolean) + { + Caption = 'Error'; + } + field(8; WasSkipped; Boolean) + { + Caption = 'Skipped'; + } + field(9; "Error Code"; Text[100]) + { + Caption = 'Error Code'; + } + field(10; "Error Message"; Blob) + { + Caption = 'Error Message'; + } + field(11; "Message Code"; Text[100]) + { + Caption = 'Message Code'; + } + field(12; "Message Text"; Text[250]) + { + Caption = 'Message Text'; + } + } + + keys + { + key(PK; "Primary Key") + { + Clustered = true; + } + } + + procedure SetErrorMessage(ErrorMessageText: Text) + var + ErrorMessageOutStream: OutStream; + begin + Rec."Error Message".CreateOutStream(ErrorMessageOutStream); + ErrorMessageOutStream.WriteText(ErrorMessageText); + end; + + procedure GetErrorMessage(): Text + var + ErrorMessageBuilder: TextBuilder; + ErrorMessageInStream: InStream; + ErrorMessageLine: Text; + begin + CalcFields(Rec."Error Message"); + Rec."Error Message".CreateInStream(ErrorMessageInStream); + while not ErrorMessageInStream.EOS do begin + ErrorMessageInStream.ReadText(ErrorMessageLine); + ErrorMessageBuilder.AppendLine(ErrorMessageLine); + end; + exit(ErrorMessageBuilder.ToText().Trim()) + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al b/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al new file mode 100644 index 0000000000..c5ea3fc7c0 --- /dev/null +++ b/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al @@ -0,0 +1,29 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +table 47200 "SL Supported Tax Year" +{ + DataPerCompany = false; + Caption = 'Supported Tax Year'; + DataClassification = SystemMetadata; + + fields + { + field(1; "Tax Year"; Integer) + { + Caption = 'Tax Year'; + NotBlank = true; + } + } + keys + { + key(PK; "Tax Year") + { + Clustered = true; + } + } +} \ No newline at end of file diff --git a/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al index 158d61f0e2..80b3af7a1e 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al @@ -28,7 +28,6 @@ using Microsoft.Inventory.Posting; codeunit 47023 "SL Helper Functions" { - Access = Internal; Permissions = tabledata "Dimension Set Entry" = rimd, tabledata "G/L Account" = rimd, tabledata "G/L Entry" = rimd, @@ -65,7 +64,7 @@ codeunit 47023 "SL Helper Functions" GeneralTemplateNameTxt: Label 'GENERAL', Locked = true; MigrationLogAreaBatchPostingTxt: Label 'Batch Posting', Locked = true; - internal procedure GetPostingAccountNumber(AccountToGet: Text): Code[20] + procedure GetPostingAccountNumber(AccountToGet: Text): Code[20] var SLAccountStagingSetup: Record "SL Account Staging Setup"; begin @@ -114,7 +113,7 @@ codeunit 47023 "SL Helper Functions" end; end; - internal procedure GetMigrationTypeTxt(): Text[250] + procedure GetMigrationTypeTxt(): Text[250] begin exit(CopyStr(MigrationTypeTxt, 1, MaxStrLen(MigrationTypeTxt))); end; diff --git a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al index c3cff299f8..96ca564305 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al @@ -7,7 +7,6 @@ namespace Microsoft.DataMigration.SL; table 47046 "SL AP_Balances" { - Access = Internal; Caption = 'SL AP_Balances'; DataClassification = CustomerContent; diff --git a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPSetup.Table.al b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPSetup.Table.al index 4a95cf5113..53aa195c56 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPSetup.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPSetup.Table.al @@ -7,7 +7,6 @@ namespace Microsoft.DataMigration.SL; table 47047 "SL APSetup" { - Access = Internal; Caption = 'SL APSetup'; DataClassification = CustomerContent; diff --git a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendor.Table.al b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendor.Table.al index 1cd5906a3c..d79ef27293 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendor.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendor.Table.al @@ -7,7 +7,6 @@ namespace Microsoft.DataMigration.SL; table 47049 "SL Vendor" { - Access = Internal; Caption = 'SL Vendor'; DataClassification = CustomerContent; diff --git a/Apps/W1/HybridSL/app/src/tables/SLCompanyAdditionalSettings.Table.al b/Apps/W1/HybridSL/app/src/tables/SLCompanyAdditionalSettings.Table.al index fb96149f7c..feea1c22a9 100644 --- a/Apps/W1/HybridSL/app/src/tables/SLCompanyAdditionalSettings.Table.al +++ b/Apps/W1/HybridSL/app/src/tables/SLCompanyAdditionalSettings.Table.al @@ -9,7 +9,6 @@ using Microsoft.DataMigration; table 47061 "SL Company Additional Settings" { - Access = Internal; DataClassification = SystemMetadata; DataPerCompany = false; Description = 'Additional Company settings for a SL migration'; @@ -487,7 +486,7 @@ table 47061 "SL Company Additional Settings" } } - internal procedure GetSingleInstance() + procedure GetSingleInstance() var CurrentCompanyName: Text[50]; begin From 69d183a4c11641505f9210515a0370bd3511cb95 Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Sun, 30 Nov 2025 17:26:15 -0500 Subject: [PATCH 2/8] Increase CpnyID field length to 30 characters and change PrepSettingsForFieldUpdate to a public procedure --- .../W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al | 2 +- Apps/W1/HybridSL/app/src/pages/SLMigrationConfiguration.Page.al | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al index 96ca564305..55cbd97e27 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLAPBalances.Table.al @@ -12,7 +12,7 @@ table 47046 "SL AP_Balances" fields { - field(1; CpnyID; Text[10]) + field(1; CpnyID; Text[30]) { Caption = 'CpnyID'; } diff --git a/Apps/W1/HybridSL/app/src/pages/SLMigrationConfiguration.Page.al b/Apps/W1/HybridSL/app/src/pages/SLMigrationConfiguration.Page.al index e9f287c8b5..73421d7651 100644 --- a/Apps/W1/HybridSL/app/src/pages/SLMigrationConfiguration.Page.al +++ b/Apps/W1/HybridSL/app/src/pages/SLMigrationConfiguration.Page.al @@ -756,7 +756,7 @@ page 47018 "SL Migration Configuration" CurrPage.Update(); end; - internal procedure PrepSettingsForFieldUpdate(): Boolean + procedure PrepSettingsForFieldUpdate(): Boolean begin SLCompanyAdditionalSettings.SetFilter(Name, '<>%1', ''); SLCompanyAdditionalSettings.SetRange("Migration Completed", false); From 9bd04cf8f58c572702b6d1e00c5e27517599cbc2 Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Sun, 30 Nov 2025 17:54:46 -0500 Subject: [PATCH 3/8] Refactor SL 1099 Migration components: rename pages, update permissions, and remove obsolete codeunit --- .../SLMigrationUSObjects.PermissionSet.al | 3 +- .../Codeunits/SLCloudMigrationUS.Codeunit.al | 8 +- .../src/Codeunits/SLIRSFormData.Codeunit.al | 184 ------------------ .../app/src/Pages/SL1099MigrationLog.Page.al | 4 +- .../app/src/Tables/SL1099BoxMapping.Table.al | 2 - .../src/Tables/SLSupportedTaxYear.Table.al | 1 - 6 files changed, 8 insertions(+), 194 deletions(-) delete mode 100644 Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al diff --git a/Apps/US/HybridSL_US/app/Permissions/SLMigrationUSObjects.PermissionSet.al b/Apps/US/HybridSL_US/app/Permissions/SLMigrationUSObjects.PermissionSet.al index 921e538e44..05bdc1df03 100644 --- a/Apps/US/HybridSL_US/app/Permissions/SLMigrationUSObjects.PermissionSet.al +++ b/Apps/US/HybridSL_US/app/Permissions/SLMigrationUSObjects.PermissionSet.al @@ -18,6 +18,5 @@ permissionset 47202 "SL Migration US - Objects" codeunit "SL Cloud Migration US" = X, codeunit "SL Populate Vendor 1099 Data" = X, codeunit "SL Vendor 1099 Mapping Helpers" = X, - codeunit "SL IRS Form Data" = X, - page "SL 1099 Migration Log" = X; + page "SL 1099 Migration Log List" = X; } \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Codeunits/SLCloudMigrationUS.Codeunit.al b/Apps/US/HybridSL_US/app/src/Codeunits/SLCloudMigrationUS.Codeunit.al index d0c861c8b7..6476b2b9f3 100644 --- a/Apps/US/HybridSL_US/app/src/Codeunits/SLCloudMigrationUS.Codeunit.al +++ b/Apps/US/HybridSL_US/app/src/Codeunits/SLCloudMigrationUS.Codeunit.al @@ -4,7 +4,9 @@ // ------------------------------------------------------------------------------------------------ namespace Microsoft.DataMigration.SL; + using System.Integration; +using Microsoft.Finance.VAT.Reporting; codeunit 47203 "SL Cloud Migration US" { @@ -35,7 +37,7 @@ codeunit 47203 "SL Cloud Migration US" local procedure SetupIRSFormsFeatureIfNeeded() var SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; - SLIRSFormData: Codeunit "SL IRS Form Data"; + IRSFormsData: Codeunit "IRS Forms Data"; SLVendor1099MappingHelpers: Codeunit "SL Vendor 1099 Mapping Helpers"; ReportingYear: Integer; Open1099Year: Boolean; @@ -46,14 +48,14 @@ codeunit 47203 "SL Cloud Migration US" Open1099Year := SLVendor1099MappingHelpers.GetCurrent1099YearOpenStatus(); if ReportingYear <> 0 then if Open1099Year then - SLIRSFormData.CreateIRSFormsReportingPeriodIfNeeded(ReportingYear); + IRSFormsData.AddReportingPeriodsWithForms(ReportingYear); end; if SLCompanyAdditionalSettings.GetMigrateNext1099YearEnabled() then begin ReportingYear := SLVendor1099MappingHelpers.GetNext1099YearFromSLAPSetup(); Open1099Year := SLVendor1099MappingHelpers.GetNext1099YearOpenStatus(); if ReportingYear <> 0 then if Open1099Year then - SLIRSFormData.CreateIRSFormsReportingPeriodIfNeeded(ReportingYear); + IRSFormsData.AddReportingPeriodsWithForms(ReportingYear); end; end; } \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al b/Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al deleted file mode 100644 index 2b9a908238..0000000000 --- a/Apps/US/HybridSL_US/app/src/Codeunits/SLIRSFormData.Codeunit.al +++ /dev/null @@ -1,184 +0,0 @@ -// ------------------------------------------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// ------------------------------------------------------------------------------------------------ - -namespace Microsoft.DataMigration.SL; - -using Microsoft.Finance.VAT.Reporting; - -codeunit 47200 "SL IRS Form Data" -{ - Permissions = tabledata "IRS Reporting Period" = RIM, - tabledata "IRS 1099 Form" = RIM, - tabledata "IRS 1099 Form Box" = RIM, - tabledata "IRS 1099 Form Statement Line" = RIM, - tabledata "IRS 1099 Form Instruction" = RIM; - - var - IRSFormStatementLineFilterExpressionTxt: Label 'Form Box No.: %1', Comment = '%1 = Form Box No.', Locked = true; - - internal procedure CreateIRSFormsReportingPeriodIfNeeded(ReportingYear: Integer) - var - IRSReportingPeriod: Record "IRS Reporting Period"; - PeriodNo: Code[20]; - begin - PeriodNo := Format(ReportingYear); - if not IRSReportingPeriod.Get(PeriodNo) then begin - IRSReportingPeriod.Validate("No.", PeriodNo); - IRSReportingPeriod.Validate("Starting Date", DMY2Date(1, 1, ReportingYear)); - IRSReportingPeriod.Validate("Ending Date", DMY2Date(31, 12, ReportingYear)); - IRSReportingPeriod.Validate("Description", PeriodNo); - IRSReportingPeriod.Insert(true); - - PopulateFormsAndBoxes(PeriodNo); - end; - end; - - local procedure PopulateFormsAndBoxes(PeriodNo: Code[20]) - begin - AddForm(PeriodNo, 'MISC', 'Miscellaneous Income'); - AddFormBox(PeriodNo, 'MISC', 'MISC-01', 'Rents', 600); - AddFormBox(PeriodNo, 'MISC', 'MISC-02', 'Royalties', 10); - AddFormBox(PeriodNo, 'MISC', 'MISC-03', 'Other Income', 600); - AddFormBox(PeriodNo, 'MISC', 'MISC-04', 'Federal Income Tax Withheld', 0); - AddFormBox(PeriodNo, 'MISC', 'MISC-05', 'Fishing Boat Proceeds', 600); - AddFormBox(PeriodNo, 'MISC', 'MISC-06', 'Medical and Health Care Payments', 600); - AddFormBox(PeriodNo, 'MISC', 'MISC-07', 'Payer made direct sales totaling $5,000 or more of consumer products to recipient for resale', 5000); - AddFormBox(PeriodNo, 'MISC', 'MISC-08', 'Substitute Payments in Lieu of Dividends or Interest', 10); - AddFormBox(PeriodNo, 'MISC', 'MISC-09', 'Crop Insurance Proceeds', 1); - AddFormBox(PeriodNo, 'MISC', 'MISC-10', 'Gross Proceeds Paid to an Attorney', 0); - AddFormBox(PeriodNo, 'MISC', 'MISC-11', 'Fish purchased for resale', 600); - AddFormBox(PeriodNo, 'MISC', 'MISC-12', 'Section 409A deferrals', 600); - AddFormBox(PeriodNo, 'MISC', 'MISC-14', 'Excess golden parachute payments', 0); - AddFormBox(PeriodNo, 'MISC', 'MISC-15', 'Nonqualified deferred compensation', 0); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-01', 10000, 'Rents'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-02', 20000, 'Royalties'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-03', 30000, 'Other Income'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-04', 40000, 'Federal Income Tax Withheld'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-05', 50000, 'Fishing Boat Proceeds'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-06', 60000, 'Medical and Health Care Payments'); - AddFormStatementLine(PeriodNo, 'MISC', Enum::"IRS 1099 Print Value Type"::"Yes/No", 'MISC-07', 70000, 'Payer made direct sales totaling $5,000 or more of consumer products to recipient for resale'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-08', 80000, 'Substitute Payments in Lieu of Dividends or Interest'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-09', 90000, 'Crop Insurance Proceeds'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-10', 100000, 'Gross Proceeds Paid to an Attorney'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-11', 110000, 'Fish purchased for resale'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-12', 120000, 'Section 409A deferrals'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-14', 130000, 'Excess golden parachute payments'); - AddFormStatementLine(PeriodNo, 'MISC', 'MISC-15', 140000, 'Nonqualified deferred compensation'); - - AddForm(PeriodNo, 'NEC', 'Nonemployee Compensation'); - AddFormBox(PeriodNo, 'NEC', 'NEC-01', 'Nonemployee Compensation', 600); - AddFormStatementLine(PeriodNo, 'NEC', 'NEC-01', 10000, 'Nonemployee Compensation'); - - AddFormInstructionLines(PeriodNo); - end; - - procedure AddFormInstructionLines(PeriodNo: Code[20]) - begin - AddNecFormInstructionLines(PeriodNo); - AddMiscFormInstructionLines(PeriodNo); - end; - - local procedure AddNecFormInstructionLines(PeriodNo: Code[20]) - var - IRS1099Form: Record "IRS 1099 Form"; - begin - if not IRS1099Form.Get(PeriodNo, 'NEC') then - exit; - AddFormInstructionLine(PeriodNo, 'NEC', 1, '', 'You received this form instead of Form W-2 because the payer did not consider you an employee and did not withhold income tax or social security and Medicare tax. If you believe you are an employee and cannot get the payer to correct this form, report the amount shown in box 1 on the line for “Wages, salaries, tips, etc.” of Form 1040, 1040-SR, or 1040-NR. You must also complete Form 8919 and attach it to your return. For more information, see Pub. 1779, Independent Contractor or Employee. If you are not an employee but the amount in box 1 is not self-employment (SE) income (for example, it is income from a sporadic activity or a hobby), report the amount shown in box 1 on the “Other income” line (on Schedule 1 (Form 1040)).'); - AddFormInstructionLine(PeriodNo, 'NEC', 2, 'Recipient’s taxpayer identification number (TIN).', 'For your protection, this form may show only the last four digits of your TIN (social security number (SSN), individual taxpayer identification number (ITIN), adoption taxpayer identification number (ATIN), or employer identification number (EIN)). However, the issuer has reported your complete TIN to the IRS.'); - AddFormInstructionLine(PeriodNo, 'NEC', 3, 'Account number.', 'May show an account or other unique number the payer assigned to distinguish your account.'); - AddFormInstructionLine(PeriodNo, 'NEC', 4, 'Box 1.', 'Shows nonemployee compensation. If the amount in this box is SE income, report it on Schedule C or F (Form 1040) if a sole proprietor, or on Form 1065 and Schedule K-1 (Form 1065) if a partnership, and the recipient/partner completes Schedule SE (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'NEC', 5, 'Note:', 'If you are receiving payments on which no income, social security, and Medicare taxes are withheld, you should make estimated tax payments. See Form 1040-ES (or Form 1040-ES (NR)). Individuals must report these amounts as explained in these box 1 instructions. Corporations, fiduciaries, and partnerships must report these amounts on the appropriate line of their tax returns.'); - AddFormInstructionLine(PeriodNo, 'NEC', 6, 'Box 2.', 'If checked, consumer products totaling $5,000 or more were sold to you for resale, on a buy-sell, a deposit-commission, or other basis. Generally, report any income from your sale of these products on Schedule C (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'NEC', 7, 'Box 3.', 'Reserved for future use.'); - AddFormInstructionLine(PeriodNo, 'NEC', 8, 'Box 4.', 'Shows backup withholding. A payer must backup withhold on certain payments if you did not give your TIN to the payer. See Form W-9, Request for Taxpayer Identification Number and Certification, for information on backup withholding. Include this amount on your income tax return as tax withheld.'); - AddFormInstructionLine(PeriodNo, 'NEC', 9, 'Boxes 5-7.', 'State income tax withheld reporting boxes.'); - AddFormInstructionLine(PeriodNo, 'NEC', 10, 'Future developments.', 'For the latest information about developments related to Form 1099-NEC and its instructions, such as legislation enacted after they were published, go to www.irs.gov/Form1099NEC.'); - AddFormInstructionLine(PeriodNo, 'NEC', 11, 'Free File Program.', 'Go to www.irs.gov/FreeFile to see if you qualify for no-cost online federal tax preparation, e-filing, and direct deposit or payment options.'); - end; - - local procedure AddMiscFormInstructionLines(PeriodNo: Code[20]) - var - IRS1099Form: Record "IRS 1099 Form"; - begin - if not IRS1099Form.Get(PeriodNo, 'MISC') then - exit; - AddFormInstructionLine(PeriodNo, 'MISC', 1, 'Recipient’s taxpayer identification number (TIN).', 'For your protection, this form may show only the last four digits of your TIN (social security number (SSN), individual taxpayer identification number (ITIN), adoption taxpayer identification number (ATIN), or employer identification number (EIN)). However, the issuer has reported your complete TIN to the IRS.'); - AddFormInstructionLine(PeriodNo, 'MISC', 2, 'Account number.', 'May show an account or other unique number the payer assigned to distinguish your account.'); - AddFormInstructionLine(PeriodNo, 'MISC', 3, 'Amounts shown may be subject to self-employment (SE) tax.', 'Individuals should see the Instructions for Schedule SE (Form 1040). Corporations, fiduciaries, or partnerships must report the amounts on the appropriate line of their tax returns.'); - AddFormInstructionLine(PeriodNo, 'MISC', 4, 'Form 1099-MISC incorrect?', 'If this form is incorrect or has been issued in error, contact the payer. If you cannot get this form corrected, attach an explanation to your tax return and report your information correctly.'); - AddFormInstructionLine(PeriodNo, 'MISC', 5, 'Box 1.', 'Report rents from real estate on Schedule E (Form 1040). However, report rents on Schedule C (Form 1040) if you provided significant services to the tenant, sold real estate as a business, or rented personal property as a business. See Pub. 527.'); - AddFormInstructionLine(PeriodNo, 'MISC', 6, 'Box 2.', 'Report royalties from oil, gas, or mineral properties; copyrights; and patents on Schedule E (Form 1040). However, report payments for a working interest as explained in the Schedule E (Form 1040) instructions. For royalties on timber, coal, and iron ore, see Pub. 544.'); - AddFormInstructionLine(PeriodNo, 'MISC', 7, 'Box 3.', 'Generally, report this amount on the “Other income” line of Schedule 1 (Form 1040) and identify the payment. The amount shown may be payments received as the beneficiary of a deceased employee, prizes, awards, taxable damages, Indian gaming profits, or other taxable income. See Pub. 525. If it is trade or business income, report this amount on Schedule C or F (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'MISC', 8, 'Box 4.', 'Shows backup withholding or withholding on Indian gaming profits. Generally, a payer must backup withhold if you did not furnish your TIN. See Form W-9 and Pub. 505 for more information. Report this amount on your income tax return as tax withheld.'); - AddFormInstructionLine(PeriodNo, 'MISC', 9, 'Box 5.', 'Shows the amount paid to you as a fishing boat crew member by the operator, who considers you to be self-employed. Self-employed individuals must report this amount on Schedule C (Form 1040). See Pub. 334.'); - AddFormInstructionLine(PeriodNo, 'MISC', 10, 'Box 6.', 'For individuals, report on Schedule C (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'MISC', 11, 'Box 7.', 'If checked, consumer products totaling $5,000 or more were sold to you for resale, on a buy-sell, a deposit-commission, or other basis. Generally, report any income from your sale of these products on Schedule C (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'MISC', 12, 'Box 8.', 'Shows substitute payments in lieu of dividends or tax-exempt interest received by your broker on your behalf as a result of a loan of your securities. Report on the “Other income” line of Schedule 1 (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'MISC', 13, 'Box 9.', 'Report this amount on Schedule F (Form 1040).'); - AddFormInstructionLine(PeriodNo, 'MISC', 14, 'Box 10.', 'Shows gross proceeds paid to an attorney in connection with legal services. Report only the taxable part as income on your return.'); - AddFormInstructionLine(PeriodNo, 'MISC', 15, 'Box 11.', 'Shows the amount of cash you received for the sale of fish if you are in the trade or business of catching fish.'); - AddFormInstructionLine(PeriodNo, 'MISC', 16, 'Box 12.', 'May show current year deferrals as a nonemployee under a nonqualified deferred compensation (NQDC) plan that is subject to the requirements of section 409A plus any earnings on current and prior year deferrals.'); - AddFormInstructionLine(PeriodNo, 'MISC', 17, 'Box 13.', 'If the FATCA filing requirement box is checked, the payer is reporting on this Form 1099 to satisfy its account reporting requirement under chapter 4 of the Internal Revenue Code. You may also have a filing requirement. See the Instructions for Form 8938.'); - AddFormInstructionLine(PeriodNo, 'MISC', 18, 'Box 14.', 'Shows your total compensation of excess golden parachute payments subject to a 20% excise tax. See your tax return instructions for where to report.'); - AddFormInstructionLine(PeriodNo, 'MISC', 19, 'Box 15.', 'Shows income as a nonemployee under an NQDC plan that does not meet the requirements of section 409A. Any amount included in box 12 that is currently taxable is also included in this box. Report this amount as income on your tax return. This income is also subject to a substantial additional tax to be reported on Form 1040, 1040-SR, or 1040-NR. See the instructions for your tax return.'); - AddFormInstructionLine(PeriodNo, 'MISC', 20, 'Boxes 16-18.', 'Show state or local income tax withheld from the payments.'); - AddFormInstructionLine(PeriodNo, 'MISC', 21, 'Future developments.', 'For the latest information about developments related to Form 1099-MISC and its instructions, such as legislation enacted after they were published, go to www.irs.gov/Form1099MISC.'); - AddFormInstructionLine(PeriodNo, 'MISC', 22, 'Free File Program.', 'Go to www.irs.gov/FreeFile to see if you qualify for no-cost online federal tax preparation, e-filing, and direct deposit or payment options.'); - end; - - local procedure AddForm(PeriodNo: Code[20]; FormNo: Code[20]; Description: Text) - var - IRS1099Form: Record "IRS 1099 Form"; - begin - IRS1099Form.Validate("Period No.", PeriodNo); - IRS1099Form.Validate("No.", FormNo); - IRS1099Form.Validate("Description", Description); - IRS1099Form.Insert(true); - end; - - local procedure AddFormBox(PeriodNo: Code[20]; FormNo: Code[20]; FormBoxNo: Code[20]; Description: Text; MinimumReportableAmount: Decimal) - var - IRS1099FormBox: Record "IRS 1099 Form Box"; - begin - IRS1099FormBox.Validate("Period No.", PeriodNo); - IRS1099FormBox.Validate("Form No.", FormNo); - IRS1099FormBox.Validate("No.", FormBoxNo); - IRS1099FormBox.Validate("Description", Description); - IRS1099FormBox.Validate("Minimum Reportable Amount", MinimumReportableAmount); - IRS1099FormBox.Insert(true); - end; - - local procedure AddFormStatementLine(PeriodNo: Code[20]; FormNo: Code[20]; FormBoxNo: Code[20]; StatementLineNo: Integer; Description: Text) - begin - AddFormStatementLine(PeriodNo, FormNo, Enum::"IRS 1099 Print Value Type"::Amount, FormBoxNo, StatementLineNo, Description); - end; - - local procedure AddFormStatementLine(PeriodNo: Code[20]; FormNo: Code[20]; Type: Enum "IRS 1099 Print Value Type"; FormBoxNo: Code[20]; StatementLineNo: Integer; Description: Text) - var - IRS1099FormStatementLine: Record "IRS 1099 Form Statement Line"; - begin - IRS1099FormStatementLine.Validate("Period No.", PeriodNo); - IRS1099FormStatementLine.Validate("Form No.", FormNo); - IRS1099FormStatementLine.Validate("Line No.", StatementLineNo); - IRS1099FormStatementLine.Validate("Print Value Type", Type); - IRS1099FormStatementLine.Validate("Row No.", FormBoxNo); - IRS1099FormStatementLine.Validate("Description", Description); - IRS1099FormStatementLine.Validate("Filter Expression", StrSubstNo(IRSFormStatementLineFilterExpressionTxt, FormBoxNo)); - IRS1099FormStatementLine.Insert(true); - end; - - local procedure AddFormInstructionLine(PeriodNo: Code[20]; FormNo: Code[20]; LineNo: Integer; Header: Text; Description: Text) - var - IRS1099FormInstruction: Record "IRS 1099 Form Instruction"; - begin - IRS1099FormInstruction.Validate("Period No.", PeriodNo); - IRS1099FormInstruction.Validate("Form No.", FormNo); - IRS1099FormInstruction.Validate("Line No.", LineNo); - IRS1099FormInstruction.Validate(Header, Header); - IRS1099FormInstruction.Validate(Description, Description); - IRS1099FormInstruction.Insert(true); - end; -} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al b/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al index 920baf7a1a..dabc75f3f0 100644 --- a/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al +++ b/Apps/US/HybridSL_US/app/src/Pages/SL1099MigrationLog.Page.al @@ -5,10 +5,10 @@ namespace Microsoft.DataMigration.SL; -page 47200 "SL 1099 Migration Log" +page 47200 "SL 1099 Migration Log List" { ApplicationArea = All; - Caption = 'SL 1099 Migration Log'; + Caption = 'SL 1099 Migration Log List'; PageType = List; SourceTable = "SL 1099 Migration Log"; UsageCategory = Administration; diff --git a/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al b/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al index d30a4d9097..756bf4b975 100644 --- a/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al +++ b/Apps/US/HybridSL_US/app/src/Tables/SL1099BoxMapping.Table.al @@ -7,8 +7,6 @@ namespace Microsoft.DataMigration.SL; table 47201 "SL 1099 Box Mapping" { - Access = Internal; - DataPerCompany = false; Caption = 'SL 1099 Box Mapping'; DataClassification = SystemMetadata; diff --git a/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al b/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al index c5ea3fc7c0..2c665cb95e 100644 --- a/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al +++ b/Apps/US/HybridSL_US/app/src/Tables/SLSupportedTaxYear.Table.al @@ -7,7 +7,6 @@ namespace Microsoft.DataMigration.SL; table 47200 "SL Supported Tax Year" { - DataPerCompany = false; Caption = 'Supported Tax Year'; DataClassification = SystemMetadata; From b3ff7816ef1c6f0303d95a61c4c4a32a735f24a2 Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Sun, 30 Nov 2025 19:39:32 -0500 Subject: [PATCH 4/8] Add Vendor 1099 tests for the Dynamics SL Migration - US extension --- .../datasets/input/SLBCGLAccount.csv | 383 ++++++++++++++++++ .../datasets/input/SLBCVendorNo1099.csv | 11 + .../datasets/input/SLBCVendorPostingGroup.csv | 5 + .../input/SLCompanyAdditionalSettings.csv | 3 + .../input/SLCompanyMigrationSettings.csv | 2 + .../datasets/input/SLTables/SLAPSetup.csv | 2 + .../datasets/input/SLTables/SLAP_Balances.csv | 11 + .../input/SLTables/SLVendorWith1099.csv | 11 + .../datasets/results/SL1099BoxMapping.csv | 27 ++ .../datasets/results/SLBCVendorWith1099.csv | 11 + .../datasets/results/SLSupportedTaxYear.csv | 3 + Apps/US/HybridSL_US/test/ExtensionLogo.png | Bin 0 -> 5185 bytes Apps/US/HybridSL_US/test/app.json | 58 +++ .../test/src/SL1099BoxMappingData.XmlPort.al | 84 ++++ .../test/src/SLAPBalancesData.XmlPort.al | 129 ++++++ .../test/src/SLAPSetupData.XmlPort.al | 81 ++++ .../test/src/SLBCGLAccountData.XmlPort.al | 90 ++++ .../test/src/SLBCVendorNo1099Data.XmlPost.al | 139 +++++++ .../src/SLBCVendorWith1099Data.XmlPort.al | 159 ++++++++ .../SLCompanyAdditionalSettings.XmlPort.al | 218 ++++++++++ .../src/SLCompanyMigrationSettings.Xmlport.al | 81 ++++ .../SLMigrationVendor1099Tests.Codeunit.al | 178 ++++++++ .../src/SLSupportedTaxYearData.XmlPort.al | 68 ++++ .../src/SLTestHelperFunctions.Codeunit.al | 162 ++++++++ .../test/src/SLVendorData.XmlPort.al | 161 ++++++++ .../src/SLVendorPostingGroupData.XmlPort.al | 111 +++++ 26 files changed, 2188 insertions(+) create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCGLAccount.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorNo1099.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorPostingGroup.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyAdditionalSettings.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyMigrationSettings.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAPSetup.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAP_Balances.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLVendorWith1099.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/results/SL1099BoxMapping.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/results/SLBCVendorWith1099.csv create mode 100644 Apps/US/HybridSL_US/test/.resources/datasets/results/SLSupportedTaxYear.csv create mode 100644 Apps/US/HybridSL_US/test/ExtensionLogo.png create mode 100644 Apps/US/HybridSL_US/test/app.json create mode 100644 Apps/US/HybridSL_US/test/src/SL1099BoxMappingData.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLAPBalancesData.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLAPSetupData.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLBCGLAccountData.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLBCVendorNo1099Data.XmlPost.al create mode 100644 Apps/US/HybridSL_US/test/src/SLBCVendorWith1099Data.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLCompanyAdditionalSettings.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLCompanyMigrationSettings.Xmlport.al create mode 100644 Apps/US/HybridSL_US/test/src/SLMigrationVendor1099Tests.Codeunit.al create mode 100644 Apps/US/HybridSL_US/test/src/SLSupportedTaxYearData.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLTestHelperFunctions.Codeunit.al create mode 100644 Apps/US/HybridSL_US/test/src/SLVendorData.XmlPort.al create mode 100644 Apps/US/HybridSL_US/test/src/SLVendorPostingGroupData.XmlPort.al diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCGLAccount.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCGLAccount.csv new file mode 100644 index 0000000000..d7f0ca98f3 --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCGLAccount.csv @@ -0,0 +1,383 @@ +No.,Name,Search Name,Account Type,Account Category,Income/Balance,Debit/Credit,Direct Posting +000000,GL SUSPENSE ,GL SUSPENSE,Posting,Assets,Balance Sheet,Both,true +1000,Cash - NPP ,CASH - NPP,Posting,Assets,Balance Sheet,Both,true +1001,Cash 1001 ,CASH 1001,Posting,Assets,Balance Sheet,Both,true +1030,Cash-US Dollars-US ,CASH-US DOLLARS-US,Posting,Assets,Balance Sheet,Both,true +1031,Cash US Dollars ,CASH US DOLLARS,Posting,Assets,Balance Sheet,Both,true +1037,Cash US Dollars-Main ,CASH US DOLLARS-MAIN,Posting,Assets,Balance Sheet,Both,true +1038,Cash US Dollars-Investments ,CASH US DOLLARS-INVESTMENTS,Posting,Assets,Balance Sheet,Both,true +1039,Cash US Dollars-Petty Cash ,CASH US DOLLARS-PETTY CASH,Posting,Assets,Balance Sheet,Both,true +1040,Cash US Dollars-Corporate ,CASH US DOLLARS-CORPORATE,Posting,Assets,Balance Sheet,Both,true +1041,Cash Us Dollars-General ,CASH US DOLLARS-GENERAL,Posting,Assets,Balance Sheet,Both,true +1070,Cash-Other ,CASH-OTHER,Posting,Assets,Balance Sheet,Both,true +1110,A/R Trade-USD ,A/R TRADE-USD,Posting,Assets,Balance Sheet,Both,true +1115,AR Holding Account ,AR HOLDING ACCOUNT,Posting,Assets,Balance Sheet,Both,true +1140,Advances in Travel & Expense ,ADVANCES IN TRAVEL & EXPENSE,Posting,Assets,Balance Sheet,Both,true +1150,Due From Company 0010 ,DUE FROM COMPANY 0010,Posting,Assets,Balance Sheet,Both,true +1151,Due From Company 0020 ,DUE FROM COMPANY 0020,Posting,Assets,Balance Sheet,Both,true +1152,Due From Company 0030 ,DUE FROM COMPANY 0030,Posting,Assets,Balance Sheet,Both,true +1153,Due From Company 0040 ,DUE FROM COMPANY 0040,Posting,Assets,Balance Sheet,Both,true +1154,Due From Company 0050 ,DUE FROM COMPANY 0050,Posting,Assets,Balance Sheet,Both,true +1155,Due From Company 0060 ,DUE FROM COMPANY 0060,Posting,Assets,Balance Sheet,Both,true +1156,Due From Company 0070 ,DUE FROM COMPANY 0070,Posting,Assets,Balance Sheet,Both,true +1157,Due From Company 0080 ,DUE FROM COMPANY 0080,Posting,Assets,Balance Sheet,Both,true +1160,A/R Inter-Company-USD ,A/R INTER-COMPANY-USD,Posting,Assets,Balance Sheet,Both,true +1170,Notes Receivable-USD ,NOTES RECEIVABLE-USD,Posting,Assets,Balance Sheet,Both,true +1171,Notes Receivable-IntCo-0010 ,NOTES RECEIVABLE-INTCO-0010,Posting,Assets,Balance Sheet,Both,true +1173,Notes Receivable-IntCo-0020 ,NOTES RECEIVABLE-INTCO-0020,Posting,Assets,Balance Sheet,Both,true +1190,A/R Holding-USD ,A/R HOLDING-USD,Posting,Assets,Balance Sheet,Both,true +1191,Miscellaneous Receivables ,MISCELLANEOUS RECEIVABLES,Posting,Assets,Balance Sheet,Both,true +1192,Unbilled Receivables - Expense,UNBILLED RECEIVABLES - EXPENSE,Posting,Assets,Balance Sheet,Both,true +1210,Inventory-Merchandise ,INVENTORY-MERCHANDISE,Posting,Assets,Balance Sheet,Both,true +1220,Inventory-Raw Materials ,INVENTORY-RAW MATERIALS,Posting,Assets,Balance Sheet,Both,true +1225,Inventory-WIP ,INVENTORY-WIP,Posting,Assets,Balance Sheet,Both,true +1226,Project Materials ,PROJECT MATERIALS,Posting,Assets,Balance Sheet,Both,true +1230,Inventory-Components ,INVENTORY-COMPONENTS,Posting,Assets,Balance Sheet,Both,true +12301,WIP: Materials ,WIP: MATERIALS,Posting,Assets,Balance Sheet,Both,true +12302,WIP: Labor ,WIP: LABOR,Posting,Assets,Balance Sheet,Both,true +12303,WIP: Subcontract ,WIP: SUBCONTRACT,Posting,Assets,Balance Sheet,Both,true +12304,WIP: Other Direct Costs ,WIP: OTHER DIRECT COSTS,Posting,Assets,Balance Sheet,Both,true +12305,WIP: Overhead ,WIP: OVERHEAD,Posting,Assets,Balance Sheet,Both,true +12309,WIP: Rollup Variance ,WIP: ROLLUP VARIANCE,Posting,Assets,Balance Sheet,Both,true +1231,Inventory-Components-1 ,INVENTORY-COMPONENTS-1,Posting,Assets,Balance Sheet,Both,true +12311,Project WIP: Materials ,PROJECT WIP: MATERIALS,Posting,Assets,Balance Sheet,Both,true +12312,Project WIP: Labor ,PROJECT WIP: LABOR,Posting,Assets,Balance Sheet,Both,true +12313,Project WIP: Subcontract ,PROJECT WIP: SUBCONTRACT,Posting,Assets,Balance Sheet,Both,true +12314,Project WIP: Other Direct Cost,PROJECT WIP: OTHER DIRECT COST,Posting,Assets,Balance Sheet,Both,true +12315,Project WIP: Overhead ,PROJECT WIP: OVERHEAD,Posting,Assets,Balance Sheet,Both,true +12319,Project WIP: Rollup Variance ,PROJECT WIP: ROLLUP VARIANCE,Posting,Assets,Balance Sheet,Both,true +1232,Inventory-Components-2 ,INVENTORY-COMPONENTS-2,Posting,Assets,Balance Sheet,Both,true +1233,Inventory-Components-3 ,INVENTORY-COMPONENTS-3,Posting,Assets,Balance Sheet,Both,true +1234,Inventory-Components-4 ,INVENTORY-COMPONENTS-4,Posting,Assets,Balance Sheet,Both,true +1235,Inventory-Components-5 ,INVENTORY-COMPONENTS-5,Posting,Assets,Balance Sheet,Both,true +1236,Inventory-Components-6 ,INVENTORY-COMPONENTS-6,Posting,Assets,Balance Sheet,Both,true +1237,Inventory-Components-7 ,INVENTORY-COMPONENTS-7,Posting,Assets,Balance Sheet,Both,true +1240,Inventory-Fin. Goods ,INVENTORY-FIN. GOODS,Posting,Assets,Balance Sheet,Both,true +1241,Inventory-Fin. Goods-1 ,INVENTORY-FIN. GOODS-1,Posting,Assets,Balance Sheet,Both,true +1242,Inventory-Fin. Goods-2 ,INVENTORY-FIN. GOODS-2,Posting,Assets,Balance Sheet,Both,true +1243,Inventory-Fin. Goods-3 ,INVENTORY-FIN. GOODS-3,Posting,Assets,Balance Sheet,Both,true +1244,Inventory-Fin. Goods-4 ,INVENTORY-FIN. GOODS-4,Posting,Assets,Balance Sheet,Both,true +1245,Inventory-Fin. Goods-5 ,INVENTORY-FIN. GOODS-5,Posting,Assets,Balance Sheet,Both,true +1246,Inventory-Fin. Goods-6 ,INVENTORY-FIN. GOODS-6,Posting,Assets,Balance Sheet,Both,true +1247,Inventory-Fin. Goods-7 ,INVENTORY-FIN. GOODS-7,Posting,Assets,Balance Sheet,Both,true +1250,Supplies ,SUPPLIES,Posting,Assets,Balance Sheet,Both,true +1251,Prepaid Supplies ,PREPAID SUPPLIES,Posting,Assets,Balance Sheet,Both,true +1310,Prepaid Insurance ,PREPAID INSURANCE,Posting,Assets,Balance Sheet,Both,true +1320,Prepaid Interest ,PREPAID INTEREST,Posting,Assets,Balance Sheet,Both,true +1330,Deposits Refundable ,DEPOSITS REFUNDABLE,Posting,Assets,Balance Sheet,Both,true +1340,Bid Deposits ,BID DEPOSITS,Posting,Assets,Balance Sheet,Both,true +1565,SWE Test ,SWE TEST,Posting,Assets,Balance Sheet,Both,true +1601,Currency Gain - Unrealized ,CURRENCY GAIN - UNREALIZED,Posting,Assets,Balance Sheet,Both,true +1602,Currency Gain - Realized ,CURRENCY GAIN - REALIZED,Posting,Assets,Balance Sheet,Both,true +1610,Land ,LAND,Posting,Assets,Balance Sheet,Both,true +1620,Buildings ,BUILDINGS,Posting,Assets,Balance Sheet,Both,true +1621,Accumulated Depreciation ,ACCUMULATED DEPRECIATION,Posting,Assets,Balance Sheet,Both,true +1630,Furniture & Fixtures ,FURNITURE & FIXTURES,Posting,Assets,Balance Sheet,Both,true +1631,Less: Accumulated Deprec. ,LESS: ACCUMULATED DEPREC.,Posting,Assets,Balance Sheet,Both,true +1640,Machines & Equipment ,MACHINES & EQUIPMENT,Posting,Assets,Balance Sheet,Both,true +1641,Less: Accumulated Deprec. ,LESS: ACCUMULATED DEPREC.,Posting,Assets,Balance Sheet,Both,true +1650,Automobiles ,AUTOMOBILES,Posting,Assets,Balance Sheet,Both,true +1651,Less: Accumulated Deprec. ,LESS: ACCUMULATED DEPREC.,Posting,Assets,Balance Sheet,Both,true +1660,Trucks ,TRUCKS,Posting,Assets,Balance Sheet,Both,true +1661,Less: Accumulated Deprec. ,LESS: ACCUMULATED DEPREC.,Posting,Assets,Balance Sheet,Both,true +1670,Office Equipment ,OFFICE EQUIPMENT,Posting,Assets,Balance Sheet,Both,true +1671,Less: Accumulated Deprec. ,LESS: ACCUMULATED DEPREC.,Posting,Assets,Balance Sheet,Both,true +1680,Leaseholds ,LEASEHOLDS,Posting,Assets,Balance Sheet,Both,true +1681,Less: Accumulated Deprec. ,LESS: ACCUMULATED DEPREC.,Posting,Assets,Balance Sheet,Both,true +1810,Prepaid Insurance ,PREPAID INSURANCE,Posting,Assets,Balance Sheet,Both,true +1820,Prepaid Interest ,PREPAID INTEREST,Posting,Assets,Balance Sheet,Both,true +1830,Prepaid Rent ,PREPAID RENT,Posting,Assets,Balance Sheet,Both,true +1840,Organizational Expense ,ORGANIZATIONAL EXPENSE,Posting,Assets,Balance Sheet,Both,true +1850,Deferred Charges ,DEFERRED CHARGES,Posting,Assets,Balance Sheet,Both,true +1860,Deposits ,DEPOSITS,Posting,Assets,Balance Sheet,Both,true +1901,Due to/from NPP ,DUE TO/FROM NPP,Posting,Assets,Balance Sheet,Both,true +1910,Investments Treasuries ,INVESTMENTS TREASURIES,Posting,Assets,Balance Sheet,Both,true +1911,Investments Money Market ,INVESTMENTS MONEY MARKET,Posting,Assets,Balance Sheet,Both,true +1912,Investments Banks ,INVESTMENTS BANKS,Posting,Assets,Balance Sheet,Both,true +1913,Investments Stocks ,INVESTMENTS STOCKS,Posting,Assets,Balance Sheet,Both,true +1914,Investments Stocks Foreign ,INVESTMENTS STOCKS FOREIGN,Posting,Assets,Balance Sheet,Both,true +1915,Investments Miscellanous ,INVESTMENTS MISCELLANOUS,Posting,Assets,Balance Sheet,Both,true +1916,Accrued Investment Income ,ACCRUED INVESTMENT INCOME,Posting,Assets,Balance Sheet,Both,true +1917,Accrued Misc. Receivables ,ACCRUED MISC. RECEIVABLES,Posting,Assets,Balance Sheet,Both,true +1918,Accrued Income Misc. ,ACCRUED INCOME MISC.,Posting,Assets,Balance Sheet,Both,true +1920,Goodwill ,GOODWILL,Posting,Assets,Balance Sheet,Both,true +1990,Due to/from 401K ,DUE TO/FROM 401K,Posting,Assets,Balance Sheet,Both,true +1999,Out of Balance Correction ,OUT OF BALANCE CORRECTION,Posting,Assets,Balance Sheet,Both,true +2000,AP - NPP ,AP - NPP,Posting,Liabilities,Balance Sheet,Both,true +2001,Due to Company 0010 ,DUE TO COMPANY 0010,Posting,Liabilities,Balance Sheet,Both,true +2002,Due to Company 0020 ,DUE TO COMPANY 0020,Posting,Liabilities,Balance Sheet,Both,true +2003,Due to Company 0030 ,DUE TO COMPANY 0030,Posting,Liabilities,Balance Sheet,Both,true +2004,Due to Company 0040 ,DUE TO COMPANY 0040,Posting,Liabilities,Balance Sheet,Both,true +2005,Due to Company 0050 ,DUE TO COMPANY 0050,Posting,Liabilities,Balance Sheet,Both,true +2006,Due to Company 0060 ,DUE TO COMPANY 0060,Posting,Liabilities,Balance Sheet,Both,true +2007,Due to Company 0070 ,DUE TO COMPANY 0070,Posting,Liabilities,Balance Sheet,Both,true +2008,Due to Company 0080 ,DUE TO COMPANY 0080,Posting,Liabilities,Balance Sheet,Both,true +2010,Inter-Company A/P-USD ,INTER-COMPANY A/P-USD,Posting,Liabilities,Balance Sheet,Both,true +2020,Mortgage Payable-Current ,MORTGAGE PAYABLE-CURRENT,Posting,Liabilities,Balance Sheet,Both,true +2025,Bonds Payable ,BONDS PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2030,Notes Payable-Demand ,NOTES PAYABLE-DEMAND,Posting,Liabilities,Balance Sheet,Both,true +2031,Notes Payable-Line of Credit ,NOTES PAYABLE-LINE OF CREDIT,Posting,Liabilities,Balance Sheet,Both,true +2032,Notes Payable- Suppliers ,NOTES PAYABLE- SUPPLIERS,Posting,Liabilities,Balance Sheet,Both,true +2033,Notes Payable-Other Banks ,NOTES PAYABLE-OTHER BANKS,Posting,Liabilities,Balance Sheet,Both,true +2040,Notes Payable-Current ,NOTES PAYABLE-CURRENT,Posting,Liabilities,Balance Sheet,Both,true +2050,A/P Trade-USD ,A/P TRADE-USD,Posting,Liabilities,Balance Sheet,Both,true +2060,A/P-Other-USD ,A/P-OTHER-USD,Posting,Liabilities,Balance Sheet,Both,true +2065,A/P-Misc-USD ,A/P-MISC-USD,Posting,Liabilities,Balance Sheet,Both,true +2070,A/P-Customer Refunds ,A/P-CUSTOMER REFUNDS,Posting,Liabilities,Balance Sheet,Both,true +2071,A/R Customer Refunds ,A/R CUSTOMER REFUNDS,Posting,Liabilities,Balance Sheet,Both,true +2072,A/R Prepayment ,A/R PREPAYMENT,Posting,Liabilities,Balance Sheet,Both,true +2075,Customer Deposits ,CUSTOMER DEPOSITS,Posting,Liabilities,Balance Sheet,Both,true +2080,Contracts Payable-Current ,CONTRACTS PAYABLE-CURRENT,Posting,Liabilities,Balance Sheet,Both,true +2090,Construction Advances ,CONSTRUCTION ADVANCES,Posting,Liabilities,Balance Sheet,Both,true +2100,Benefits Payable ,BENEFITS PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2110,Federal Tax Withheld ,FEDERAL TAX WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2120,FICA Withheld ,FICA WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2121,Employee Medicare FICA ,EMPLOYEE MEDICARE FICA,Posting,Liabilities,Balance Sheet,Both,true +2130,FICA-Employer ,FICA-EMPLOYER,Posting,Liabilities,Balance Sheet,Both,true +2131,Employer Medicare FICA ,EMPLOYER MEDICARE FICA,Posting,Liabilities,Balance Sheet,Both,true +2140,State Income Tax Withheld ,STATE INCOME TAX WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2150,Local Income Tax Withheld ,LOCAL INCOME TAX WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2160,Federal Unemploy. Withheld ,FEDERAL UNEMPLOY. WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2170,State Unemploy. Withheld ,STATE UNEMPLOY. WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2180,Workers' Compensation ,WORKERS' COMPENSATION,Posting,Liabilities,Balance Sheet,Both,true +2190,Misc. 1 Withheld ,MISC. 1 WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2200,Misc. 2 Withheld ,MISC. 2 WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2210,Misc. 3 Withheld ,MISC. 3 WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2220,Misc. 4 Withheld ,MISC. 4 WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2230,Misc. 5 Withheld ,MISC. 5 WITHHELD,Posting,Liabilities,Balance Sheet,Both,true +2240,Sales Tax Payable ,SALES TAX PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2241,Sales Tax Payable - City ,SALES TAX PAYABLE - CITY,Posting,Liabilities,Balance Sheet,Both,true +2242,Sales Tax Payable - County ,SALES TAX PAYABLE - COUNTY,Posting,Liabilities,Balance Sheet,Both,true +2243,Sales Tax Payable - State ,SALES TAX PAYABLE - STATE,Posting,Liabilities,Balance Sheet,Both,true +2245,Sales Tax Payable - AvaTax ,SALES TAX PAYABLE - AVATAX,Posting,Liabilities,Balance Sheet,Both,true +2300,Accrued A/P Trade-USD ,ACCRUED A/P TRADE-USD,Posting,Liabilities,Balance Sheet,Both,true +2301,Accrued A/P Trade-CAD ,ACCRUED A/P TRADE-CAD,Posting,Liabilities,Balance Sheet,Both,true +2302,Accrued A/P Trade-FRF ,ACCRUED A/P TRADE-FRF,Posting,Liabilities,Balance Sheet,Both,true +2303,Accrued A/P Trade-DEM ,ACCRUED A/P TRADE-DEM,Posting,Liabilities,Balance Sheet,Both,true +2304,Accrued A/P Trade-GBP ,ACCRUED A/P TRADE-GBP,Posting,Liabilities,Balance Sheet,Both,true +2305,Accrued A/P Trade-LRA ,ACCRUED A/P TRADE-LRA,Posting,Liabilities,Balance Sheet,Both,true +2310,Accrued Interest ,ACCRUED INTEREST,Posting,Liabilities,Balance Sheet,Both,true +2320,Accrued Rent ,ACCRUED RENT,Posting,Liabilities,Balance Sheet,Both,true +2330,Accrued Wages ,ACCRUED WAGES,Posting,Liabilities,Balance Sheet,Both,true +23301,Applied Labor ,APPLIED LABOR,Posting,Liabilities,Balance Sheet,Both,true +2340,Accrued Insurance ,ACCRUED INSURANCE,Posting,Liabilities,Balance Sheet,Both,true +2350,Accrued Real Estate Taxes ,ACCRUED REAL ESTATE TAXES,Posting,Liabilities,Balance Sheet,Both,true +2360,Federal Taxes Payable ,FEDERAL TAXES PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2370,State Taxes Payable ,STATE TAXES PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2410,Dividends Paid ,DIVIDENDS PAID,Posting,Liabilities,Balance Sheet,Both,true +2510,Mortgage Payable ,MORTGAGE PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2520,Long Term Notes Payable ,LONG TERM NOTES PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2530,Contracts Payable-LT ,CONTRACTS PAYABLE-LT,Posting,Liabilities,Balance Sheet,Both,true +2540,Land Contracts Payable ,LAND CONTRACTS PAYABLE,Posting,Liabilities,Balance Sheet,Both,true +2550,Shareholder Loans ,SHAREHOLDER LOANS,Posting,Liabilities,Balance Sheet,Both,true +2560,Officer Loans ,OFFICER LOANS,Posting,Liabilities,Balance Sheet,Both,true +2610,Deferred Income ,DEFERRED INCOME,Posting,Liabilities,Balance Sheet,Both,true +2710,Issued Common Stock ,ISSUED COMMON STOCK,Posting,Liabilities,Balance Sheet,Both,true +2720,Paid in Capital ,PAID IN CAPITAL,Posting,Liabilities,Balance Sheet,Both,true +2730,Treasury Stock ,TREASURY STOCK,Posting,Liabilities,Balance Sheet,Both,true +2740,Retained Earnings ,RETAINED EARNINGS,Posting,Liabilities,Balance Sheet,Both,true +2750,YTD Net Income ,YTD NET INCOME,Posting,Liabilities,Balance Sheet,Both,true +2760,Variance ,VARIANCE,Posting,Liabilities,Balance Sheet,Both,true +2800,SWE Test ,SWE TEST,Posting,Liabilities,Balance Sheet,Both,true +2810,SWE Test ,SWE TEST,Posting,Liabilities,Balance Sheet,Both,true +2900,Pension Accrued ,PENSION ACCRUED,Posting,Liabilities,Balance Sheet,Both,true +2901,401k Accrued ,401K ACCRUED,Posting,Liabilities,Balance Sheet,Both,true +3020,Inter-Company Sales ,INTER-COMPANY SALES,Posting,Income,Income Statement,Both,true +3030,Sales/Income ,SALES/INCOME,Posting,Income,Income Statement,Both,true +3031,Sales/Income Type 1 ,SALES/INCOME TYPE 1,Posting,Income,Income Statement,Both,true +3032,Sales/Income Type 2 ,SALES/INCOME TYPE 2,Posting,Income,Income Statement,Both,true +3033,Sales/Income Type 3 ,SALES/INCOME TYPE 3,Posting,Income,Income Statement,Both,true +3034,Sales/Income Type 4 ,SALES/INCOME TYPE 4,Posting,Income,Income Statement,Both,true +3035,Sales/Income Type 5 ,SALES/INCOME TYPE 5,Posting,Income,Income Statement,Both,true +3036,Sales/Income Type 6 ,SALES/INCOME TYPE 6,Posting,Income,Income Statement,Both,true +3037,Sales/Income Type 7 ,SALES/INCOME TYPE 7,Posting,Income,Income Statement,Both,true +3042,Writeup/Writedown Labor ,WRITEUP/WRITEDOWN LABOR,Posting,Income,Income Statement,Both,true +3044,Writeup/Writedown Expenses ,WRITEUP/WRITEDOWN EXPENSES,Posting,Income,Income Statement,Both,true +3050,Discounts Allowed-Trade ,DISCOUNTS ALLOWED-TRADE,Posting,Income,Income Statement,Both,true +3070,Freight Income ,FREIGHT INCOME,Posting,Income,Income Statement,Both,true +3080,Miscellaneous Income ,MISCELLANEOUS INCOME,Posting,Income,Income Statement,Both,true +3090,Customer Finance Charges ,CUSTOMER FINANCE CHARGES,Posting,Income,Income Statement,Both,true +3100,Miscellaneous Income ,MISCELLANEOUS INCOME,Posting,Income,Income Statement,Both,true +3220,Proceeds from Securities ,PROCEEDS FROM SECURITIES,Posting,Income,Income Statement,Both,true +4010,Beginning Inventory ,BEGINNING INVENTORY,Posting,Expense,Income Statement,Both,true +4020,Inter-Company Purchases ,INTER-COMPANY PURCHASES,Posting,Expense,Income Statement,Both,true +4030,Merchandise Purchases ,MERCHANDISE PURCHASES,Posting,Expense,Income Statement,Both,true +4040,Discounts Taken ,DISCOUNTS TAKEN,Posting,Expense,Income Statement,Both,true +4050,Productive Labor ,PRODUCTIVE LABOR,Posting,Expense,Income Statement,Both,true +4051,Premium Labor ,PREMIUM LABOR,Posting,Expense,Income Statement,Both,true +4052,Labor - Direct ,LABOR - DIRECT,Posting,Expense,Income Statement,Both,true +4053,"Labor - Direct, Fixed ","LABOR - DIRECT, FIXED",Posting,Expense,Income Statement,Both,true +4054,Labor - Indirect ,LABOR - INDIRECT,Posting,Expense,Income Statement,Both,true +4055,"Labor - Indirect, Fixed ","LABOR - INDIRECT, FIXED",Posting,Expense,Income Statement,Both,true +4059,Fringe ,FRINGE,Posting,Expense,Income Statement,Both,true +4060,Vacation-Holiday Pay ,VACATION-HOLIDAY PAY,Posting,Expense,Income Statement,Both,true +4065,Sick Leave ,SICK LEAVE,Posting,Expense,Income Statement,Both,true +4070,Payroll Taxes ,PAYROLL TAXES,Posting,Expense,Income Statement,Both,true +4080,Payroll Benefits ,PAYROLL BENEFITS,Posting,Expense,Income Statement,Both,true +4090,Sub-Contracts ,SUB-CONTRACTS,Posting,Expense,Income Statement,Both,true +4091,Federal Tax Expense ,FEDERAL TAX EXPENSE,Posting,Expense,Income Statement,Both,true +4092,State Taxes Payable ,STATE TAXES PAYABLE,Posting,Expense,Income Statement,Both,true +4100,Freight-In ,FREIGHT-IN,Posting,Expense,Income Statement,Both,true +4110,Supplies ,SUPPLIES,Posting,Expense,Income Statement,Both,true +4120,Deprec.-Production Equip. ,DEPREC.-PRODUCTION EQUIP.,Posting,Expense,Income Statement,Both,true +4130,Utilities-Production ,UTILITIES-PRODUCTION,Posting,Expense,Income Statement,Both,true +4140,Inventory Increase/Decrease ,INVENTORY INCREASE/DECREASE,Posting,Expense,Income Statement,Both,true +4141,Inventory Issue (Non-Project) ,INVENTORY ISSUE (NON-PROJECT),Posting,Expense,Income Statement,Both,true +4142,Inventory Issue (Project) ,INVENTORY ISSUE (PROJECT),Posting,Expense,Income Statement,Both,true +4150,Cost of Goods Sold ,COST OF GOODS SOLD,Posting,Expense,Income Statement,Both,true +41501,Late Charges ,LATE CHARGES,Posting,Expense,Income Statement,Both,true +4151,Cost of Goods Sold-Type 1 ,COST OF GOODS SOLD-TYPE 1,Posting,Expense,Income Statement,Both,true +4152,Cost of Goods Sold-Type 2 ,COST OF GOODS SOLD-TYPE 2,Posting,Expense,Income Statement,Both,true +4153,Cost of Goods Sold-Type 3 ,COST OF GOODS SOLD-TYPE 3,Posting,Expense,Income Statement,Both,true +4154,Cost of Goods Sold-Type 4 ,COST OF GOODS SOLD-TYPE 4,Posting,Expense,Income Statement,Both,true +4155,Cost of Goods Sold-Type 5 ,COST OF GOODS SOLD-TYPE 5,Posting,Expense,Income Statement,Both,true +4156,Cost of Goods Sold-Type 6 ,COST OF GOODS SOLD-TYPE 6,Posting,Expense,Income Statement,Both,true +4157,Cost of Goods Sold-Type 7 ,COST OF GOODS SOLD-TYPE 7,Posting,Expense,Income Statement,Both,true +4200,Ending Inventory ,ENDING INVENTORY,Posting,Expense,Income Statement,Both,true +4210,Inventory Revaluation ,INVENTORY REVALUATION,Posting,Expense,Income Statement,Both,true +4220,Clearing-Other Direct Costs ,CLEARING-OTHER DIRECT COSTS,Posting,Expense,Income Statement,Both,true +4230,Clearing-Material O/H ,CLEARING-MATERIAL O/H,Posting,Expense,Income Statement,Both,true +4240,Clearing-Machine O/H ,CLEARING-MACHINE O/H,Posting,Expense,Income Statement,Both,true +4290,Clearing-Landed Costs ,CLEARING-LANDED COSTS,Posting,Expense,Income Statement,Both,true +4300,Variance-Direct Material ,VARIANCE-DIRECT MATERIAL,Posting,Expense,Income Statement,Both,true +43001,Variance-Rollup Variance ,VARIANCE-ROLLUP VARIANCE,Posting,Expense,Income Statement,Both,true +4310,Variance-Direct Labor ,VARIANCE-DIRECT LABOR,Posting,Expense,Income Statement,Both,true +4320,Variance-Other Direct Cost ,VARIANCE-OTHER DIRECT COST,Posting,Expense,Income Statement,Both,true +4330,Variance-Material O/H ,VARIANCE-MATERIAL O/H,Posting,Expense,Income Statement,Both,true +4340,Variance-Labor O/H ,VARIANCE-LABOR O/H,Posting,Expense,Income Statement,Both,true +4350,Variance-Machine O/H ,VARIANCE-MACHINE O/H,Posting,Expense,Income Statement,Both,true +4360,Scrap Var-Direct Material ,SCRAP VAR-DIRECT MATERIAL,Posting,Expense,Income Statement,Both,true +4370,Scrap Var-Direct Labor ,SCRAP VAR-DIRECT LABOR,Posting,Expense,Income Statement,Both,true +4380,Scrap Var-Other Direct Cost ,SCRAP VAR-OTHER DIRECT COST,Posting,Expense,Income Statement,Both,true +4390,Scrap Var-Material O/H ,SCRAP VAR-MATERIAL O/H,Posting,Expense,Income Statement,Both,true +4400,Scrap Var-Labor O/H ,SCRAP VAR-LABOR O/H,Posting,Expense,Income Statement,Both,true +4410,Scrap Var-Machine O/H ,SCRAP VAR-MACHINE O/H,Posting,Expense,Income Statement,Both,true +4500,Std Chg Var-Dir Material ,STD CHG VAR-DIR MATERIAL,Posting,Expense,Income Statement,Both,true +4510,Std Chg Var-Dir Labor ,STD CHG VAR-DIR LABOR,Posting,Expense,Income Statement,Both,true +4520,Std Chg Var-Other Direct ,STD CHG VAR-OTHER DIRECT,Posting,Expense,Income Statement,Both,true +4530,Std Chg Var-Material O/H ,STD CHG VAR-MATERIAL O/H,Posting,Expense,Income Statement,Both,true +4540,Std Chg Var-Labor O/H ,STD CHG VAR-LABOR O/H,Posting,Expense,Income Statement,Both,true +4550,Std Chg Var-Machine O/H ,STD CHG VAR-MACHINE O/H,Posting,Expense,Income Statement,Both,true +4610,Effic Var-Direct Labor ,EFFIC VAR-DIRECT LABOR,Posting,Expense,Income Statement,Both,true +4710,Rate Var-Direct Labor ,RATE VAR-DIRECT LABOR,Posting,Expense,Income Statement,Both,true +4790,Variance-Landed Costs ,VARIANCE-LANDED COSTS,Posting,Expense,Income Statement,Both,true +5010,Officers Salaries ,OFFICERS SALARIES,Posting,Expense,Income Statement,Both,true +5020,Office Salaries ,OFFICE SALARIES,Posting,Expense,Income Statement,Both,true +5030,Sales Salaries ,SALES SALARIES,Posting,Expense,Income Statement,Both,true +5040,Shop Wages ,SHOP WAGES,Posting,Expense,Income Statement,Both,true +5050,Delivery Wages ,DELIVERY WAGES,Posting,Expense,Income Statement,Both,true +5060,Maintenance Wages ,MAINTENANCE WAGES,Posting,Expense,Income Statement,Both,true +5070,Warehouse Wages ,WAREHOUSE WAGES,Posting,Expense,Income Statement,Both,true +5080,Vacation ,VACATION,Posting,Expense,Income Statement,Both,true +5090,Payroll Taxes ,PAYROLL TAXES,Posting,Expense,Income Statement,Both,true +5100,Payroll Benefits ,PAYROLL BENEFITS,Posting,Expense,Income Statement,Both,true +5110,Clearing-Direct Labor ,CLEARING-DIRECT LABOR,Posting,Expense,Income Statement,Both,true +5120,Clearing-Labor O/H ,CLEARING-LABOR O/H,Posting,Expense,Income Statement,Both,true +5130,Clearing - Labor G&A ,CLEARING - LABOR G&A,Posting,Expense,Income Statement,Both,true +5400,SWE Test ,SWE TEST,Posting,Expense,Income Statement,Both,true +5450,SWE Test ,SWE TEST,Posting,Expense,Income Statement,Both,true +6010,Advertising ,ADVERTISING,Posting,Expense,Income Statement,Both,true +6020,Answering Service ,ANSWERING SERVICE,Posting,Expense,Income Statement,Both,true +6030,Accounting and Legal Fees ,ACCOUNTING AND LEGAL FEES,Posting,Expense,Income Statement,Both,true +6040,Vehicle Expense ,VEHICLE EXPENSE,Posting,Expense,Income Statement,Both,true +6050,Bad Check ,BAD CHECK,Posting,Expense,Income Statement,Both,true +6060,Bad Debts ,BAD DEBTS,Posting,Expense,Income Statement,Both,true +6061,Small Balance WO ,SMALL BALANCE WO,Posting,Expense,Income Statement,Both,true +6070,Bank Service Charges ,BANK SERVICE CHARGES,Posting,Expense,Income Statement,Both,true +6071,Bank Fee ,BANK FEE,Posting,Expense,Income Statement,Both,true +6080,Janitorial/Cleaning Service ,JANITORIAL/CLEANING SERVICE,Posting,Expense,Income Statement,Both,true +6100,Lab Tests ,LAB TESTS,Posting,Expense,Income Statement,Both,true +6500,Commissions ,COMMISSIONS,Posting,Expense,Income Statement,Both,true +6510,Contributions ,CONTRIBUTIONS,Posting,Expense,Income Statement,Both,true +6520,Collection ,COLLECTION,Posting,Expense,Income Statement,Both,true +6530,Delivery ,DELIVERY,Posting,Expense,Income Statement,Both,true +6540,Directors Fees ,DIRECTORS FEES,Posting,Expense,Income Statement,Both,true +6550,Dues and Subscriptions ,DUES AND SUBSCRIPTIONS,Posting,Expense,Income Statement,Both,true +6560,Depreciation ,DEPRECIATION,Posting,Expense,Income Statement,Both,true +6570,Amort/Leasehold Improve. ,AMORT/LEASEHOLD IMPROVE.,Posting,Expense,Income Statement,Both,true +6580,Amort/Organ. Expense ,AMORT/ORGAN. EXPENSE,Posting,Expense,Income Statement,Both,true +6590,Entertainment ,ENTERTAINMENT,Posting,Expense,Income Statement,Both,true +7000,Travel Expense ,TRAVEL EXPENSE,Posting,Expense,Income Statement,Both,true +7001,Per Diem ,PER DIEM,Posting,Expense,Income Statement,Both,true +7005,Travel Expense - Meals ,TRAVEL EXPENSE - MEALS,Posting,Expense,Income Statement,Both,true +7006,Meals ,MEALS,Posting,Expense,Income Statement,Both,true +7007,Management Meals ,MANAGEMENT MEALS,Posting,Expense,Income Statement,Both,true +7010,Travel Expense - Lodging ,TRAVEL EXPENSE - LODGING,Posting,Expense,Income Statement,Both,true +7011,Logding ,LOGDING,Posting,Expense,Income Statement,Both,true +7020,Travel Expense - Transportatin,TRAVEL EXPENSE - TRANSPORTATIN,Posting,Expense,Income Statement,Both,true +7021,Air/Train ,AIR/TRAIN,Posting,Expense,Income Statement,Both,true +7022,Taxi/Mass Transit ,TAXI/MASS TRANSIT,Posting,Expense,Income Statement,Both,true +7030,Travel Expense - Entertainment,TRAVEL EXPENSE - ENTERTAINMENT,Posting,Expense,Income Statement,Both,true +7040,Office Expenses - Misc. ,OFFICE EXPENSES - MISC.,Posting,Expense,Income Statement,Both,true +7050,Telephone Expense ,TELEPHONE EXPENSE,Posting,Expense,Income Statement,Both,true +7055,Equipment Rental ,EQUIPMENT RENTAL,Posting,Expense,Income Statement,Both,true +7056,AV Equipment ,AV EQUIPMENT,Posting,Expense,Income Statement,Both,true +7060,Electric Expense ,ELECTRIC EXPENSE,Posting,Expense,Income Statement,Both,true +7070,Gas ,GAS,Posting,Expense,Income Statement,Both,true +7080,Water ,WATER,Posting,Expense,Income Statement,Both,true +7090,Insurance-General ,INSURANCE-GENERAL,Posting,Expense,Income Statement,Both,true +7100,Insurance-Group Medical ,INSURANCE-GROUP MEDICAL,Posting,Expense,Income Statement,Both,true +7101,Currency Loss - Unrealized ,CURRENCY LOSS - UNREALIZED,Posting,Expense,Income Statement,Both,true +7102,Currency Loss - Realized ,CURRENCY LOSS - REALIZED,Posting,Expense,Income Statement,Both,true +7110,Insurance-Officer's Life ,INSURANCE-OFFICER'S LIFE,Posting,Expense,Income Statement,Both,true +7120,Long Term Interest ,LONG TERM INTEREST,Posting,Expense,Income Statement,Both,true +7130,Laundry ,LAUNDRY,Posting,Expense,Income Statement,Both,true +7140,Uniform ,UNIFORM,Posting,Expense,Income Statement,Both,true +7150,Licenses ,LICENSES,Posting,Expense,Income Statement,Both,true +7160,Repair/Maint-Building ,REPAIR/MAINT-BUILDING,Posting,Expense,Income Statement,Both,true +7170,Repair/Maint-Equipment ,REPAIR/MAINT-EQUIPMENT,Posting,Expense,Income Statement,Both,true +7171,Repair/Maint Expense ,REPAIR/MAINT EXPENSE,Posting,Expense,Income Statement,Both,true +7172,Management Rent ,MANAGEMENT RENT,Posting,Expense,Income Statement,Both,true +7180,Office Supplies ,OFFICE SUPPLIES,Posting,Expense,Income Statement,Both,true +7181,Copy Services ,COPY SERVICES,Posting,Expense,Income Statement,Both,true +7182,Design Services ,DESIGN SERVICES,Posting,Expense,Income Statement,Both,true +7183,Printing Services ,PRINTING SERVICES,Posting,Expense,Income Statement,Both,true +7184,Copy Services - ODC ,COPY SERVICES - ODC,Posting,Expense,Income Statement,Both,true +7190,Outside Services ,OUTSIDE SERVICES,Posting,Expense,Income Statement,Both,true +7200,Rubbish Removal ,RUBBISH REMOVAL,Posting,Expense,Income Statement,Both,true +7210,Sales Promotion ,SALES PROMOTION,Posting,Expense,Income Statement,Both,true +7220,Salesman's Vehicle Expense ,SALESMAN'S VEHICLE EXPENSE,Posting,Expense,Income Statement,Both,true +7221,Corporate Vehicle Expense ,CORPORATE VEHICLE EXPENSE,Posting,Expense,Income Statement,Both,true +7222,Travel Expenses ,TRAVEL EXPENSES,Posting,Expense,Income Statement,Both,true +7230,Shop Supplies ,SHOP SUPPLIES,Posting,Expense,Income Statement,Both,true +7240,Taxes/Personal Property ,TAXES/PERSONAL PROPERTY,Posting,Expense,Income Statement,Both,true +7250,Taxes/Real Estate ,TAXES/REAL ESTATE,Posting,Expense,Income Statement,Both,true +7260,Taxes Franchise ,TAXES FRANCHISE,Posting,Expense,Income Statement,Both,true +7270,Freight ,FREIGHT,Posting,Expense,Income Statement,Both,true +7271,Freight Expense ,FREIGHT EXPENSE,Posting,Expense,Income Statement,Both,true +7272,Express Freight ,EXPRESS FREIGHT,Posting,Expense,Income Statement,Both,true +7273,Honor ,HONOR,Posting,Expense,Income Statement,Both,true +7280,Postage ,POSTAGE,Posting,Expense,Income Statement,Both,true +7281,Postage Expense ,POSTAGE EXPENSE,Posting,Expense,Income Statement,Both,true +7290,Personnel ,PERSONNEL,Posting,Expense,Income Statement,Both,true +7300,Miscellaneous ,MISCELLANEOUS,Posting,Expense,Income Statement,Both,true +7410,Sales Tax Paid ,SALES TAX PAID,Posting,Expense,Income Statement,Both,true +7411,Sales Tax Paid - City ,SALES TAX PAID - CITY,Posting,Expense,Income Statement,Both,true +7412,Sales Tax Paid - County ,SALES TAX PAID - COUNTY,Posting,Expense,Income Statement,Both,true +7413,Sales Tax Paid - State ,SALES TAX PAID - STATE,Posting,Expense,Income Statement,Both,true +7415,Sales Tax Paid - IL ,SALES TAX PAID - IL,Posting,Expense,Income Statement,Both,true +7416,Sales Tax Paid - IL - City ,SALES TAX PAID - IL - CITY,Posting,Expense,Income Statement,Both,true +7417,Sales Tax Paid - IL - County ,SALES TAX PAID - IL - COUNTY,Posting,Expense,Income Statement,Both,true +7418,Sales Tax Paid - IL - State ,SALES TAX PAID - IL - STATE,Posting,Expense,Income Statement,Both,true +7419,Sales Tax Paid Expense - GST ,SALES TAX PAID EXPENSE - GST,Posting,Expense,Income Statement,Both,true +7420,Sales Tax Paid Expense - VAT ,SALES TAX PAID EXPENSE - VAT,Posting,Expense,Income Statement,Both,true +7500,PPV ,PPV,Posting,Expense,Income Statement,Both,true +8000,Pooled Rent Expense ,POOLED RENT EXPENSE,Posting,Expense,Income Statement,Both,true +8001,Test Allocation 8001 ,TEST ALLOCATION 8001,Posting,Expense,Income Statement,Both,true +8002,Test Allocation 8002 ,TEST ALLOCATION 8002,Posting,Expense,Income Statement,Both,true +8003,Test Allocation 8003 ,TEST ALLOCATION 8003,Posting,Expense,Income Statement,Both,true +8010,Commissions ,COMMISSIONS,Posting,Income,Income Statement,Both,true +8020,Interest Earned ,INTEREST EARNED,Posting,Income,Income Statement,Both,true +8030,Discounts Taken ,DISCOUNTS TAKEN,Posting,Income,Income Statement,Both,true +8040,Rents ,RENTS,Posting,Income,Income Statement,Both,true +8050,Gain on Sale of Assets ,GAIN ON SALE OF ASSETS,Posting,Income,Income Statement,Both,true +8060,Dividends Received ,DIVIDENDS RECEIVED,Posting,Income,Income Statement,Both,true +8070,Miscellaneous ,MISCELLANEOUS,Posting,Income,Income Statement,Both,true +8300,SWE Test ,SWE TEST,Posting,Income,Income Statement,Both,true +8999,Allocated Rent Offset ,ALLOCATED RENT OFFSET,Posting,Income,Income Statement,Both,true +9010,Discounts-Allowed ,DISCOUNTS-ALLOWED,Posting,Expense,Income Statement,Both,true +9020,Interest-General ,INTEREST-GENERAL,Posting,Expense,Income Statement,Both,true +9030,Loss on Sale of Assets ,LOSS ON SALE OF ASSETS,Posting,Expense,Income Statement,Both,true +9040,Miscellaneous ,MISCELLANEOUS,Posting,Expense,Income Statement,Both,true +9050,Non-Deductible Penalties ,NON-DEDUCTIBLE PENALTIES,Posting,Expense,Income Statement,Both,true +9090,Provision for Income Tax1 ,PROVISION FOR INCOME TAX1,Posting,Expense,Income Statement,Both,true diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorNo1099.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorNo1099.csv new file mode 100644 index 0000000000..f6d3ffccc9 --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorNo1099.csv @@ -0,0 +1,11 @@ +No.,Name,Search Name,Name 2,Address,Address 2,City,Contact,Phone No.,Vendor Posting Group,Payment Terms Code,Country/Region Code,Blocked,Fax No.,Gen. Bus. Posting Group,ZIP Code,State,Email,Tax Area Code,Tax Liable +VEN1099-1,Test 1099 Vendor 1,TEST 1099 VENDOR 1,Test 1099 Vendor 1,1234 Elmwood Drive,,Centerville,,5551234567,CONTRACT,,US,,,SL,43001,OH ,Payables@Test1099Vendor1.com,,false +VEN1099-2,Test 1099 Vendor 2,TEST 1099 VENDOR 2,Test 1099 Vendor 2,1234 Maplewood Lane,,Centerville,,6145550198,CONTRACT,,US,,,SL,43001,OH ,JamesDoe@Test1099Vendor2.com,,false +VT0100,International,INTERNATIONAL,International,400 West Madison St.,Suite 400,Chicago,,5555550190,TRADE,,US,,5555550191,SL,222222,IL ,someone@example.com,COOK-G,true +VT0110,America,AMERICA,America,100 N. State St.,Suite 1200,Madison,,5555550196,TRADE,,US,,5555550197,SL,45454,WI ,,,false +VT0120,Circle,CIRCLE,Circle,258 N. Johnson Ave.,,Sioux City,,5555550105,TRADE,,US,,5555550106,SL,09000,IA ,,,false +VT0121,Square,SQUARE,Square,10 S. Ricker Ave.,,Sioux City,,5555550107,TRADE,,US,,5555550108,SL,08777,IA ,,,false +VT0122,Alphabet,ALPHABET,Alphabet,125 N. Main Ave.,,Sioux City,,5555550109,TRADE,,US,,5555550110,SL,10100,IA ,,,false +VT0123,Consolidated Messenger,CONSOLIDATED MESSENGER,Consolidated Messenger,139 N. Akron Ave.,,Sioux City,,5555550111,TRADE,,US,,5555550112,SL,22111,IA ,,,false +VT0124,Fourth Coffee,FOURTH COFFEE,Fourth Coffee,420 S. State St.,,Sioux City,,5555550112,TRADE,,US,,5555550113,SL,01000,IA ,,,false +VT0125,Trey Research,TREY RESEARCH,Trey Research,520 N. Laurence Ave.,,Sioux City,,5555550113,TRADE,,US,,5555550114,SL,01000,IA ,,,false \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorPostingGroup.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorPostingGroup.csv new file mode 100644 index 0000000000..8a06183c8b --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLBCVendorPostingGroup.csv @@ -0,0 +1,5 @@ +Code,Payables Account,Service Charge Acc.,Payment Disc. Debit Acc.,Invoice Rounding Account,Debit Curr. Appln. Rndg. Acc.,Credit Curr. Appln. Rndg. Acc.,Debit Rounding Account,Credit Rounding Account,Payment Disc. Credit Acc.,Payment Tolerance Debit Acc.,Payment Tolerance Credit Acc.,Description +CONTRACT,2080,,,,,,,,,,,1099 Vendors +EMP,2050,,,,,,,,,,,Employee +SL,2050,,,,,,,,,,,Migrated from SL +TRADE,2050,,,,,,,,,,,Trade Vendor \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyAdditionalSettings.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyAdditionalSettings.csv new file mode 100644 index 0000000000..3bbcb80de0 --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyAdditionalSettings.csv @@ -0,0 +1,3 @@ +Company,Inactive Customers,Inactive Vendors,Vendor Classes,Customer Classes,Product Classes,Oldest GL Year,AP Module,AR Module,Inventory Module,Dimension 1,Dimension 2,Open POs,GL Master Only,AP Master Only,Rec. Master Only,Inventory Master Only,Inactive Items,Delete Status Items,Oldest Snapshot year,Snapshot GLTran,Snapshot ARTran,Snapshot APTran,Snapshot INTran,Snapshot POTran,Skip Posting G/L Account Batches,Skip Posting Customer Batches,Skip Posting Vendor Batches,GL Module,Skip Posting Item Batches,Project Controller Module,Projects Only,Tasks Only,Resources Only,Include Plan Status Projects,Include Hold Status Resources,Migrate Current 1099 Year,Migrate Next 1099 Year +,false,false,true,true,true,0,true,true,true,,,false,false,false,false,false,false,false,0,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true +"CRONUS USA, Inc.",false,false,true,true,true,2016,true,true,true,Reporting Unit,Reg/Branch,false,false,false,false,false,false,false,2016,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyMigrationSettings.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyMigrationSettings.csv new file mode 100644 index 0000000000..2e7e388101 --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLCompanyMigrationSettings.csv @@ -0,0 +1,2 @@ +Name,Global Dimension 1,Global Dimension 2,Migrate Inactive Customers,Migrate Inactive Vendors,ProcessesAreRunning +"CRONUS USA, Inc.",Reporting Unit,Reg/Branch,false,false,false diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAPSetup.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAPSetup.csv new file mode 100644 index 0000000000..70ce03932e --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAPSetup.csv @@ -0,0 +1,2 @@ +SetupId,APAcct,Curr1099Yr,CY1099Stat,Next1099Yr,NY1099Stat +AP,2050,2018,O,2019,O \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAP_Balances.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAP_Balances.csv new file mode 100644 index 0000000000..286fbf34e2 --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLAP_Balances.csv @@ -0,0 +1,11 @@ +VendID,CpnyID,CYBox00,CYBox01,CYBox02,CYBox03,CYBox04,CYBox05,CYBox06,CYBox07,CYBox08,CYBox09,CYBox10,CYBox11,CYBox12,CYBox13,CYBox14,CYBox15 +VEN1099-1 ,"CRONUS USA, Inc.",0,0,0,0,0,0,0,1850,0,0,0,0,0,0,0,0,0 +VEN1099-2 ,"CRONUS USA, Inc.",0,0,0,0,0,0,2500,0,0,0,0,0,2500,0,0,0 +VT0100 ,"CRONUS USA, Inc.",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +VT0110 ,"CRONUS USA, Inc.",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +VT0120 ,"CRONUS USA, Inc.",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +VT0121 ,"CRONUS USA, Inc.",0,0,0,0,0,0,615,0,0,0,0,0,0,0,0,0 +VT0122 ,"CRONUS USA, Inc.",0,0,0,0,610,0,0,0,0,0,0,0,0,0,0,0 +VT0123 ,"CRONUS USA, Inc.",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +VT0124 ,"CRONUS USA, Inc.",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +VT0125 ,"CRONUS USA, Inc.",0,2500,0,0,0,0,0,0,0,0,0,0,0,0,0,0 diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLVendorWith1099.csv b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLVendorWith1099.csv new file mode 100644 index 0000000000..34bf2b26ea --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/input/SLTables/SLVendorWith1099.csv @@ -0,0 +1,11 @@ +VendId,Addr1,Addr2,APAcct,APSub,Attn,City,ClassID,Country,Curr1099Yr,DfltBox,EMailAddr,Fax,Name,Next1099Yr,Phone,RemitName,S4Future09,State,Status,TaxId00,TaxRegNbr,Terms,TIN,Vend1099,Zip +VEN1099-1 ,1234 Elmwood Drive ,,2080 ,SC260AA99999 ,,Centerville ,CONTRACT ,US ,2018,7 ,Payables@Test1099Vendor1.com ,,Test 1099 Vendor 1 ,2019,5551234567 ,Test 1099 Vendor 1 ,0,OH ,A,,,05,2587963 ,1,43001 +VEN1099-2 ,1234 Maplewood Lane ,,2080 ,SC260AA99999 ,,Centerville ,CONTRACT ,US ,2018,25,JamesDoe@Test1099Vendor2.com ,,Test 1099 Vendor 2 ,2019,6145550198 ,Test 1099 Vendor 2 ,1,OH ,A,,,05,996688 ,1,43001 +VT0100 ,400 West Madison St. ,Suite 400 ,2050 ,01100AA00001 ,,Chicago ,TRADE ,US ,2018,,someone@example.com ,5555550191 ,International ,2019,5555550190 ,International ,0,IL ,A,COOK-G ,25-5254254 ,01,,0,222222 +VT0110 ,100 N. State St. ,Suite 1200 ,2050 ,01100AA00001 ,,Madison ,TRADE ,US ,2018,7 ,,5555550197 ,America ,2019,5555550196 ,America ,0,WI ,A,MADISON ,25-3636254 ,05,1122334455 ,1,45454 +VT0120 ,258 N. Johnson Ave. ,,2050 ,01100AA00001 ,,Sioux City ,TRADE ,US ,2018,14,,5555550106 ,Circle ,2019,5555550105 ,Circle ,0,IA ,A,,,05,369987 ,1,09000 +VT0121 ,10 S. Ricker Ave. ,,2050 ,01100AA00001 ,,Sioux City ,TRADE ,US ,2018,7 ,,5555550108 ,Square ,2019,5555550107 ,Square ,0,IA ,A,,,05,123321 ,1,08777 +VT0122 ,125 N. Main Ave. ,,2050 ,01100AA00001 ,,Sioux City ,TRADE ,US ,2018,5 ,,5555550110 ,Alphabet ,2019,5555550109 ,Alphabet ,0,IA ,A,,,05,147852 ,1,10100 +VT0123 ,139 N. Akron Ave. ,,2050 ,01100AA00001 ,,Sioux City ,TRADE ,US ,2018,1 ,,5555550112 ,Consolidated Messenger ,2019,5555550111 ,Consolidated Messenger ,0,IA ,A,,,05,369258 ,1,22111 +VT0124 ,420 S. State St. ,,2050 ,01100AA00001 ,,Sioux City ,TRADE ,US ,2018,1 ,,5555550113 ,Fourth Coffee ,2019,5555550112 ,Fourth Coffee ,0,IA ,A,,,05,951159 ,1,01000 +VT0125 ,520 N. Laurence Ave. ,,2050 ,01100AA00001 ,,Sioux City ,TRADE ,US ,2018,2 ,,5555550114 ,Trey Research ,2019,5555550113 ,Trey Research ,0,IA ,A,,,05,986532 ,1,01000 \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/results/SL1099BoxMapping.csv b/Apps/US/HybridSL_US/test/.resources/datasets/results/SL1099BoxMapping.csv new file mode 100644 index 0000000000..b942b88f2a --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/results/SL1099BoxMapping.csv @@ -0,0 +1,27 @@ +Tax Year,SL Data Value,SL 1099 Box No.,Form Type,BC IRS 1099 Code +2018,1,1M,MISC,MISC-01 +2018,10,9M,MISC,MISC-09 +2018,13,14M,MISC,MISC-14 +2018,14,10M,MISC,MISC-10 +2018,15,12M,MISC,MISC-12 +2018,2,2M,MISC,MISC-02 +2018,25,15M,MISC,MISC-15 +2018,3,3M,MISC,MISC-03 +2018,4,4M,MISC,MISC-04 +2018,5,5M,MISC,MISC-05 +2018,6,6M,MISC,MISC-06 +2018,7,1N,NEC,NEC-01 +2018,8,8M,MISC,MISC-08 +2019,1,1M,MISC,MISC-01 +2019,10,9M,MISC,MISC-09 +2019,13,14M,MISC,MISC-14 +2019,14,10M,MISC,MISC-10 +2019,15,12M,MISC,MISC-12 +2019,2,2M,MISC,MISC-02 +2019,25,15M,MISC,MISC-15 +2019,3,3M,MISC,MISC-03 +2019,4,4M,MISC,MISC-04 +2019,5,5M,MISC,MISC-05 +2019,6,6M,MISC,MISC-06 +2019,7,1N,NEC,NEC-01 +2019,8,8M,MISC,MISC-08 diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/results/SLBCVendorWith1099.csv b/Apps/US/HybridSL_US/test/.resources/datasets/results/SLBCVendorWith1099.csv new file mode 100644 index 0000000000..c1fac2badb --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/results/SLBCVendorWith1099.csv @@ -0,0 +1,11 @@ +No.,Name,Search Name,Name 2,Address,Address 2,City,Contact,Phone No.,Vendor Posting Group,Payment Terms Code,Country/Region Code,Blocked,Fax No.,Gen. Bus. Posting Group,ZIP Code,State,Email,Tax Area Code,Tax Liable,Federal ID No.,FATCA Requirement,Tax Identification Type +VEN1099-1,Test 1099 Vendor 1,TEST 1099 VENDOR 1,Test 1099 Vendor 1,1234 Elmwood Drive,,Centerville,,5551234567,CONTRACT,,US,,,SL,43001,OH ,Payables@Test1099Vendor1.com,,false,2587963,false,Legal Entity +VEN1099-2,Test 1099 Vendor 2,TEST 1099 VENDOR 2,Test 1099 Vendor 2,1234 Maplewood Lane,,Centerville,,6145550198,CONTRACT,,US,,,SL,43001,OH ,JamesDoe@Test1099Vendor2.com,,false,996688,true,Legal Entity +VT0100,International,INTERNATIONAL,International,400 West Madison St.,Suite 400,Chicago,,5555550190,TRADE,,US,,5555550191,SL,222222,IL ,someone@example.com,COOK-G,true,,false,Legal Entity +VT0110,America,AMERICA,America,100 N. State St.,Suite 1200,Madison,,5555550196,TRADE,,US,,5555550197,SL,45454,WI ,,,false,1122334455,false,Legal Entity +VT0120,Circle,CIRCLE,Circle,258 N. Johnson Ave.,,Sioux City,,5555550105,TRADE,,US,,5555550106,SL,09000,IA ,,,false,369987,false,Legal Entity +VT0121,Square,SQUARE,Square,10 S. Ricker Ave.,,Sioux City,,5555550107,TRADE,,US,,5555550108,SL,08777,IA ,,,false,123321,false,Legal Entity +VT0122,Alphabet,ALPHABET,Alphabet,125 N. Main Ave.,,Sioux City,,5555550109,TRADE,,US,,5555550110,SL,10100,IA ,,,false,147852,false,Legal Entity +VT0123,Consolidated Messenger,CONSOLIDATED MESSENGER,Consolidated Messenger,139 N. Akron Ave.,,Sioux City,,5555550111,TRADE,,US,,5555550112,SL,22111,IA ,,,false,369258,false,Legal Entity +VT0124,Fourth Coffee,FOURTH COFFEE,Fourth Coffee,420 S. State St.,,Sioux City,,5555550112,TRADE,,US,,5555550113,SL,01000,IA ,,,false,951159,false,Legal Entity +VT0125,Trey Research,TREY RESEARCH,Trey Research,520 N. Laurence Ave.,,Sioux City,,5555550113,TRADE,,US,,5555550114,SL,01000,IA ,,,false,986532,false,Legal Entity diff --git a/Apps/US/HybridSL_US/test/.resources/datasets/results/SLSupportedTaxYear.csv b/Apps/US/HybridSL_US/test/.resources/datasets/results/SLSupportedTaxYear.csv new file mode 100644 index 0000000000..94f16adfc0 --- /dev/null +++ b/Apps/US/HybridSL_US/test/.resources/datasets/results/SLSupportedTaxYear.csv @@ -0,0 +1,3 @@ +Tax Year +2018 +2019 diff --git a/Apps/US/HybridSL_US/test/ExtensionLogo.png b/Apps/US/HybridSL_US/test/ExtensionLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..0ce0327e679bea8dd722ec79fa8f667458748cfa GIT binary patch literal 5185 zcma)=X*kr;+sA)1)-jPKyDSOWw?g(55!oWk7<-f@Ci~h5$sS@<_BGqg2w7v2C5?y} z%NWKUV~~W9o?O@e|LS>OJTLC^z0P&c{k>nDbFOpUpG0%ho6JmnOaK5d8yViP{HNQe z!ASpa)V5yB{3j59L%RR~fU=(kXp|Iv3;-NIjc#1C3Z16rcRduvXZLln(PL?7+_6Yi zQD&a@;!sh)iUJ?y5woI#H+ny`KkNehatc_~et%s#6@L}} z-L-j_hTmrEI@Y8)hRcQ)%9b^4(LqC1>Ot$IX1_UIix-7$E*$3PKoysgfIH{(k&^$F z3%GOoY|cslkrGCQ)7hz5(B_t00-O9-{+s&$aX8I6b-2Bz^%|$c>vjkj?A$BrP>xGw~;XW1L-HP%e>TdmW-}&(qX`Yu%G0-sYzz>z@7e>FV0_(=hcFfVfAAW zWRHD2`HmK_2#unSJ5fPUZg!uCu0h6dd{1E?r9J84%@yv9KZnQ3P6rERhP&1unwL6?}<@97k>_k=&uPD1=8=+0+ztv24&dk*n0J+G_|-W1U7 z$=zDG3VLFK^rk*@Tk{XI`EBP4dlI32H!TgRSx@Nm5d%9|JE-=$s4qIG3o2)Q28Bsd z2V$NBD8AL`k{SmJ?m$NPTb(%0FNwI2*KT5inSIAn*QET871T*sHvj|!=EB))jBCu{ z#G7=pL&?a&UOTx-3%hIu|&ydeH=k9EduevgfZ4;)@Vu z+e57%Xfpa2;{|A1D#wFH`G&EDj7r?z9U{05VbK_y5Y{1N+kRd}>(xYAWD%amXBCuF zmSWp_KhI^45(dKcqqQ-nG%{D)oW^f@BknvhNFbZF`{D zAu>=7EjdG_tn4Wt$_B;^n9z;Il17Hj|2XF~U!{Zj2!p>PF`fs3hWHNsPi3Gduz znwXql`kG+z8Tl}8nqU_xRiU?Z3O*lqEQt=^Z9lXdgby<4gC1CPmv?Lp=$b({zB1NG zKX}n;W)+NU`JUug+jM6q?1!?$o9*=hdkqoX!=CqDZ_;lSB65-vbu^}FAA`0TxP(H- z1CGf7sdcZpG@omazAt`RprN*S>~}w`&%%z~R;MQ2L%W%H#HE?V*uI`&oETJ1;QQja zf2O``D8HPUzOlzsB+b3*$K9DVo`NA%C{>TU<$AX4*`;Wk#Rj5;!{Lxmx%5@RlhX9w zML*4G;7=as@yxsz-(z`fPhh1PY(6{G@1?5{ad4H#wh-L4aZqure}Mx^u1g5>B< zBdf8d819$t9NS*{EF(VHtN~v-!~;IaV0EfvZO=D8tF0AKD2o-8ER^!ke|#6^$F=MR z>JfbuKAKJVBPos>x1UoCUS0MHK%CK7aslgzXwP}Djb_sUJcgF6AoPdBouxRu@Fv?r zvcsB5hJ0~?4S=uDn(7(PgV90|iPUW8$9mp+NPK*Ap|@4rP+ZF`Y0Zo#SFl5-_@r#x zaF~IN2)d~5?xbx0uSf;|9vdHLS(U|}6X93bt25C81_|otp&A;Z z)L7`3NtBn~9if@~mGJum#(x|alL#Thw=M#+?~8poHk78{eB6WcxUGyD(6|jw_EMjs zVdUool$Uuu}XwPXLq zMwE2l=2s*uOC7X*UGG~|g+pp=zLX9nk1l7*^ZlN&u|-sb=R+4^%%O6f8>NpZ`Y@F1 z(C6*e5f6)}NGNw=J3KECD1Er_fm zeaB^o(Qt!Um<;^agK+dp!t|5NS?xt<4m3VhfItzF!;ve(UyX)7nLxIAp&M@HkqkKI za^@|}fuHg6iU);ysAbyP_0~&aFsfFEznU_p`$&4CR8ib`HW7}rvy`5A^mnMNs57MY zXKK;jANKy5S}N_)QAK)8oB7189HUtQ(Ikz?F9Dm>7F!X=Rk@XrNqNM#NnV4|im8>S8sNxDkuIBA;Sx_yDb;}FUBi(#zOS`w zo1{T@+{^9W3gw85 z`w(`$IkSZpYn)|!{a3WU`0%>fWZkb5CY)JcE_d0gew{t-Lu4bLvG$4&6PXUAO`{-z zl^fN8YPa9Czv`M6s4{`qW6b1H%2E4EP_&5_H4@hn5XS`ak++T>53G!TR*DOR&5FP^ zqS%^;ry||5EA#7UgktxEfRo-Bn4{ql3*&b2cWoz(?X<7u*WX*pHn3%WPksnH@LF90 z*CRHB)XIs^o`8;)mtL@GtI`gacx+axk(CG73VKahyh0seeqE%zEpDjVFR^pwmx}LlkRei%8RnkyTinKKG(F!H z)qya6W^AF7aYY#SA}81n|7t$ZIixfFX=u+%1@yMH@>>)=wxzp!W>n#zK?_F&CyI|J5}^N;yQO*G^E3bW%la)djWFA+3bLU_=1la zUi$?&Rjc!B>rW7wB+gZG)JpA7{m&geeP(P32$@r$D){jL&E>v}K?%IAQ)E`l-1BQ6 zW=A-;pBkb{bVD(MYDZpQVQl0mma{pnf;+w+ojtMAoEXIkLg;ZI3~=K8TqazWJFGDnPS ze3XUhYA&l)AQ-Jz*}!G%{AFl!Et?n0?{>j$kRB(mWOz(V#`NXh9=Yaf6^v-w*(`}YHna=_Zs0TcN)7M4XSc_JG{SMRqJ zPVCq}D2@*Jv2W`=H@+lUo1$n22ridK08lrRv5KUuzT8A)*#xzcGwc@Mq=b;t&)L|W zDN^CHpwG2^0M5qE66a!nXOg**id-Go1SypG@Rh_&$}WDzAYK_N6?6!8^GV=SoELo%&P% zHDB?*2-jb4DVse}W;JoQW_IOwmZ$ACcH?R6$$Pd7oJjMTRdYFN^xj3&PLwIM%t#tq z22p}`Eac5g)1yR2gMMwaY5kldfFC-PU$LTbs`y&DYKkO69?=SC?v89oO?Mzr&5__e zzV_PYrO&YMZYV&xCy3!4CgY)Ks`oDI?%R=MKTacvf4fTogmr4xllpeg^mrl$jQQ-I z(`0*MFcZ#8-V92i5|zbqq?j-ftVuTI4SYJf7dzBjjiH^i&ca{b+3#O3{nY=2g|>x= z-eaP>=Q<`QLuGL)r5lx!;7>SfnVik7)JzC(jd}sx(f6mQVS{>^-AlGiTZd*h)!n4T z#w8O&ei%iaJIvkCLsrRk6NkgjnV}_G0=whoKG_tA=3lDPDisfrpHlZ8yxx>=Ua~N| z?0wdxk`C<{vLG(YhgJ$p2yFNu&mLm&g?UFYctF&#|2_OsF@s@^Nt?OdA_sK&3jG%C zkz~cNgour#x7h$bmS046 zreN**od=Kla%tP|B~LSCv3%qQ4(y_KkNeuZ0*fh`CVW~|=}+kWZuY~PZ`8a4MG`zh z+gWKSFX#Gd3kKul19D=jxn^%9nBQLmg*h-(v;ltPfVT!Hkl^|HzMzom&fxqg;#-4I zi2t3lKP{rhE?%w=@4D!ft+`d?y$zNn4Hil9MkiE2Y9#Wdx=&QzKWoXJ9TM3?C8>ij z6M&P&W>9hxzRUq3FYiEucE_HK>YtX!WO$HTo+ljB4zJ6G0e*S0`>n>??+Eb*v9EcV zHr?U_m9Oh9-J(&|sJe!!YJQa8%mJvv?-Ir%9!Pe8MroPh-)gMaG6IXM-gWbf+)f=N zlP=uONNt}Mm#Mn`8`xxBv&<{_;#8vFp2VmyemAs#QeKy#Ec>#!&v~#(t8Y-{_FBs~6s}|1&t-qWel(a0D)ndl5lS%gAYz zRR6QhTTpPu5II-m9gyZk;X-8)Wsa!bzxRf0kV&eUZ9mg=xUBV>F;CHVA2KB$3uPR0>~iLjOZQL=)R?R zKjtz-baSU7wt8&3d(+e5yHFY^OPXH0nLsaQUttuZ@iIi314yhP*q!9)!uwAO2B-T1 zvmV6YzgpToQ%tj|N*Oz{tSt#7OCqamYt1*Wg`5bEPE9d@?nx`iF9lhvGA^XLa|K_V zAoo1B!wdI(<9QHcypb=G)J*2Gjbk9*Z@E%x5JAwL!gZNJyZlv)`C-z!fr+ z`6q87oH?3pF9gVMD|{Ks9G3&wFd?3N)GCLrwS-YDk8-Xc=4kHy2p2n^EJtc%3k-XvdnCmx7Odg7Me&fq=bp>v=zmR;pB8@P-^@2WTN9n zBpbG=9V(#HK{fs3s}FeG-ED`NnnSSi3ZCfor(91@Y1g>a-KC;a!1aHSt<&{?i0pr} rvHy~-|FE&s)c=peDGmFL{>yOhInG_L^x6JDCI}emo8Ca{IY0RyAD72q literal 0 HcmV?d00001 diff --git a/Apps/US/HybridSL_US/test/app.json b/Apps/US/HybridSL_US/test/app.json new file mode 100644 index 0000000000..b64c58b0f9 --- /dev/null +++ b/Apps/US/HybridSL_US/test/app.json @@ -0,0 +1,58 @@ +{ + "id": "5f85a491-a6f4-4303-88ed-95a577849f91", + "name": "Dynamics SL Migration - US Tests", + "publisher": "Microsoft", + "version": "28.0.0.0", + "brief": "Tests for migrating Microsoft Dynamics SL Vendor 1099 Data to Dynamics 365 Business Central", + "description": "Tests for the Dynamics SL Migration - US extension.", + "resourceFolders": [".resources"], + "privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009", + "EULA": "https://go.microsoft.com/fwlink/?linkid=2009120", + "help": "https://go.microsoft.com/fwlink/?linkid=2009037", + "url": "https://go.microsoft.com/fwlink/?LinkId=724011", + "contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2285106", + "logo": "ExtensionLogo.png", + "dependencies": [ + { + "id": "237981b4-9e3c-437c-9b92-988aae978e8f", + "publisher": "Microsoft", + "name": "Dynamics SL Migration", + "version": "28.0.0.0" + }, + { + "id": "2c75580e-ca19-49be-899b-d0b59fc3f2f3", + "publisher": "Microsoft", + "name": "Dynamics SL Migration - US", + "version": "28.0.0.0" + }, + { + "id": "b696b4c9-637c-49d1-a806-763ff8f0a20e", + "name": "IRS Forms", + "publisher": "Microsoft", + "version": "28.0.0.0" + }, + { + "id": "dd0be2ea-f733-4d65-bb34-a28f4624fb14", + "publisher": "Microsoft", + "name": "Library Assert", + "version": "28.0.0.0" + } + ], + "screenshots": [], + "platform": "28.0.0.0", + "application": "28.0.0.0", + "idRanges": [ + { + "from": 147650, + "to": 147699 + } + ], + "resourceExposurePolicy": { + "allowDebugging": true, + "allowDownloadingSource": true, + "includeSourceInSymbolFile": true + }, + "features": [ + "NoImplicitWith" + ] +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/src/SL1099BoxMappingData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SL1099BoxMappingData.XmlPort.al new file mode 100644 index 0000000000..1e278184b2 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SL1099BoxMappingData.XmlPort.al @@ -0,0 +1,84 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147656 "SL 1099 Box Mapping Data" +{ + Caption = 'SL 1099 Box Mapping data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("SL 1099 Box Mapping"; "SL 1099 Box Mapping") + { + AutoSave = false; + XmlName = 'SL1099BoxMapping'; + UseTemporary = true; + + textelement(TaxYear) + { + } + textelement(SLDataValue) + { + } + textelement(SL1099BoxNo) + { + } + textelement(FormType) + { + } + textelement(BCIRS1099Code) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + Evaluate(TempSL1099BoxMapping."Tax Year", TaxYear); + Evaluate(TempSL1099BoxMapping."SL Data Value", SLDataValue); + TempSL1099BoxMapping."SL 1099 Box No." := SL1099BoxNo; + TempSL1099BoxMapping."Form Type" := FormType; + TempSL1099BoxMapping."BC IRS 1099 Code" := BCIRS1099Code; + TempSL1099BoxMapping.Insert(true); + end; + } + } + } + + trigger OnPreXmlPort() + begin + CaptionRow := true; + end; + + procedure GetExpectedSL1099BoxMapping(var NewTempSL1099BoxMapping: Record "SL 1099 Box Mapping" temporary) + begin + if TempSL1099BoxMapping.FindSet() then + repeat + NewTempSL1099BoxMapping := TempSL1099BoxMapping; + NewTempSL1099BoxMapping.Insert(); + until TempSL1099BoxMapping.Next() = 0; + end; + + var + CaptionRow: Boolean; + TempSL1099BoxMapping: Record "SL 1099 Box Mapping" temporary; +} diff --git a/Apps/US/HybridSL_US/test/src/SLAPBalancesData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLAPBalancesData.XmlPort.al new file mode 100644 index 0000000000..1cc5ec81e6 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLAPBalancesData.XmlPort.al @@ -0,0 +1,129 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147658 "SL AP Balances Data" +{ + Caption = 'SL AP Balances data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("SL AP Balances"; "SL AP_Balances") + { + AutoSave = false; + XmlName = 'SLAPBalances'; + + textelement(VendID) + { + } + textelement(CpnyID) + { + } + textelement(CYBox00) + { + } + textelement(CYBox01) + { + } + textelement(CYBox02) + { + } + textelement(CYBox03) + { + } + textelement(CYBox04) + { + } + textelement(CYBox05) + { + } + textelement(CYBox06) + { + } + textelement(CYBox07) + { + } + textelement(CYBox08) + { + } + textelement(CYBox09) + { + } + textelement(CYBox10) + { + } + textelement(CYBox11) + { + } + textelement(CYBox12) + { + } + textelement(CYBox13) + { + } + textelement(CYBox14) + { + } + textelement(CYBox15) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + SLAPBalances: Record "SL AP_Balances"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + SLAPBalances.VendID := VendID; + SLAPBalances.CpnyID := CpnyID; + Evaluate(SLAPBalances.CYBox00, CYBox00); + Evaluate(SLAPBalances.CYBox01, CYBox01); + Evaluate(SLAPBalances.CYBox02, CYBox02); + Evaluate(SLAPBalances.CYBox03, CYBox03); + Evaluate(SLAPBalances.CYBox04, CYBox04); + Evaluate(SLAPBalances.CYBox05, CYBox05); + Evaluate(SLAPBalances.CYBox06, CYBox06); + Evaluate(SLAPBalances.CYBox07, CYBox07); + Evaluate(SLAPBalances.CYBox08, CYBox08); + Evaluate(SLAPBalances.CYBox09, CYBox09); + Evaluate(SLAPBalances.CYBox10, CYBox10); + Evaluate(SLAPBalances.CYBox11, CYBox11); + Evaluate(SLAPBalances.CYBox12, CYBox12); + Evaluate(SLAPBalances.CYBox13, CYBox13); + Evaluate(SLAPBalances.CYBox14, CYBox14); + Evaluate(SLAPBalances.CYBox15, CYBox15); + SLAPBalances.Insert(); + end; + } + } + } + + trigger OnPreXmlPort() + begin + SLAPBalances.DeleteAll(true); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + SLAPBalances: Record "SL AP_Balances"; +} diff --git a/Apps/US/HybridSL_US/test/src/SLAPSetupData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLAPSetupData.XmlPort.al new file mode 100644 index 0000000000..5dd65d5880 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLAPSetupData.XmlPort.al @@ -0,0 +1,81 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147650 "SL APSetup Data" +{ + Caption = 'SL APSetup data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("SL APSetup"; "SL APSetup") + { + AutoSave = false; + XmlName = 'SLAPSetup'; + + textelement(SetupID) + { + } + textelement(APAcct) + { + } + textelement(Curr1099Yr) + { + } + textelement(CY1099Stat) + { + } + textelement(Next1099Yr) + { + } + textelement(NY1099Stat) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + SLAPSetup: Record "SL APSetup"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + SLAPSetup.SetupId := SetupID; + SLAPSetup.APAcct := APAcct; + SLAPSetup.Curr1099Yr := Curr1099Yr; + SLAPSetup.CY1099Stat := CY1099Stat; + SLAPSetup.Next1099Yr := Next1099Yr; + SLAPSetup.NY1099Stat := NY1099Stat; + SLAPSetup.Insert(true); + end; + } + } + } + + trigger OnPreXmlPort() + begin + SLAPSetup.DeleteAll(); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + SLAPSetup: Record "SL APSetup"; +} diff --git a/Apps/US/HybridSL_US/test/src/SLBCGLAccountData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLBCGLAccountData.XmlPort.al new file mode 100644 index 0000000000..06f47db526 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLBCGLAccountData.XmlPort.al @@ -0,0 +1,90 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; +using Microsoft.Finance.GeneralLedger.Account; + +xmlport 147660 "SL BC GL Account Data" +{ + Caption = 'SL BC GL Account data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("G/L Account"; "G/L Account") + { + AutoSave = false; + XmlName = 'BCGLAccount'; + + textelement(No) + { + } + textelement(Name) + { + } + textelement(SearchName) + { + } + textelement(AccountType) + { + } + textelement(AccountCategory) + { + } + textelement(IncomeBalance) + { + } + textelement(DebitCredit) + { + } + textelement(DirectPosting) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + GLAccount: Record "G/L Account"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + GLAccount."No." := No; + GLAccount.Name := Name; + GLAccount."Search Name" := SearchName; + Evaluate(GLAccount."Account Type", AccountType); + Evaluate(GLAccount."Account Category", AccountCategory); + Evaluate(GLAccount."Income/Balance", IncomeBalance); + Evaluate(GLAccount."Debit/Credit", DebitCredit); + Evaluate(GLAccount."Direct Posting", DirectPosting); + GLAccount.Insert(); + end; + } + } + } + + trigger OnPreXmlPort() + begin + GLAccount.DeleteAll(); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + GLAccount: Record "G/L Account"; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/src/SLBCVendorNo1099Data.XmlPost.al b/Apps/US/HybridSL_US/test/src/SLBCVendorNo1099Data.XmlPost.al new file mode 100644 index 0000000000..814414cadf --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLBCVendorNo1099Data.XmlPost.al @@ -0,0 +1,139 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +using Microsoft.Purchases.Vendor; + +xmlport 147654 "SL BC Vendor No 1099 Data" +{ + Caption = 'Vendor data without 1099 information for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("Vendor"; Vendor) + { + AutoSave = false; + XmlName = 'Vendor'; + + textelement("No.") + { + } + textelement("Name") + { + } + textelement("SearchName") + { + } + textelement("Name2") + { + } + textelement("Address") + { + } + textelement("Address2") + { + } + textelement("City") + { + } + textelement("Contact") + { + } + textelement("PhoneNo.") + { + } + textelement("VendorPostingGroup") + { + } + textelement("PaymentTermsCode") + { + } + textelement("CountryRegionCode") + { + } + textelement("Blocked") + { + } + textelement("FaxNo.") + { + } + textelement("GenBusPostingGroup") + { + } + textelement("ZipCode") + { + } + textelement("State") + { + } + textelement("EMail") + { + } + textelement("TaxAreaCode") + { + } + textelement("TaxLiable") + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + BCVendor: Record Vendor; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + BCVendor."No." := "No."; + BCVendor.Name := "Name"; + BCVendor."Search Name" := "SearchName"; + BCVendor."Name 2" := "Name2"; + BCVendor.Address := "Address"; + BCVendor."Address 2" := "Address2"; + BCVendor.City := "City"; + BCVendor."Contact" := "Contact"; + BCVendor."Phone No." := "PhoneNo."; + BCVendor."Vendor Posting Group" := "VendorPostingGroup"; + BCVendor."Payment Terms Code" := "PaymentTermsCode"; + BCVendor."Country/Region Code" := "CountryRegionCode"; + Evaluate(BCVendor."Blocked", "Blocked"); + BCVendor."Fax No." := "FaxNo."; + BCVendor."Gen. Bus. Posting Group" := "GenBusPostingGroup"; + BCVendor."Post Code" := "ZipCode"; + BCVendor.County := "State"; + BCVendor."E-Mail" := "EMail"; + BCVendor."Tax Area Code" := "TaxAreaCode"; + Evaluate(BCVendor."Tax Liable", "TaxLiable", 9); + BCVendor.Insert(true); + end; + } + } + } + + trigger OnPreXmlPort() + begin + BCVendor.DeleteAll(); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + BCVendor: Record Vendor; +} diff --git a/Apps/US/HybridSL_US/test/src/SLBCVendorWith1099Data.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLBCVendorWith1099Data.XmlPort.al new file mode 100644 index 0000000000..a58f1d58c1 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLBCVendorWith1099Data.XmlPort.al @@ -0,0 +1,159 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +using Microsoft.Purchases.Vendor; + +xmlport 147657 "SL BC Vendor With 1099 Data" +{ + Caption = 'BC Vendor With 1099 data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement(Vendor; Vendor) + { + AutoSave = false; + XmlName = 'BCVendor'; + UseTemporary = true; + + textelement("No.") + { + } + textelement("Name") + { + } + textelement("SearchName") + { + } + textelement("Name2") + { + } + textelement("Address") + { + } + textelement("Address2") + { + } + textelement("City") + { + } + textelement("Contact") + { + } + textelement("PhoneNo.") + { + } + textelement("VendorPostingGroup") + { + } + textelement("PaymentTermsCode") + { + } + textelement("CountryRegionCode") + { + } + textelement("Blocked") + { + } + textelement("FaxNo.") + { + } + textelement("GenBusPostingGroup") + { + } + textelement("ZIPCode") + { + } + textelement("State") + { + } + textelement("Email") + { + } + textelement("TaxAreaCode") + { + } + textelement("TaxLiable") + { + } + textelement("FederalIDNo") + { + } + textelement("FATCARequirement") + { + } + textelement("TaxIdentificationType") + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + TempVendor."No." := "No."; + TempVendor.Name := "Name"; + TempVendor."Search Name" := "SearchName"; + TempVendor."Name 2" := "Name2"; + TempVendor.Address := "Address"; + TempVendor."Address 2" := "Address2"; + TempVendor.City := "City"; + TempVendor."Contact" := "Contact"; + TempVendor."Phone No." := "PhoneNo."; + TempVendor."Vendor Posting Group" := "VendorPostingGroup"; + TempVendor."Payment Terms Code" := "PaymentTermsCode"; + TempVendor."Country/Region Code" := "CountryRegionCode"; + Evaluate(TempVendor."Blocked", "Blocked"); + TempVendor."Fax No." := "FaxNo."; + TempVendor."Gen. Bus. Posting Group" := "GenBusPostingGroup"; + TempVendor."Post Code" := "ZipCode"; + TempVendor.County := "State"; + TempVendor."E-Mail" := "EMail"; + TempVendor."Tax Area Code" := "TaxAreaCode"; + Evaluate(TempVendor."Tax Liable", "TaxLiable", 9); + TempVendor."Federal ID No." := "FederalIDNo"; + Evaluate(TempVendor."FATCA Requirement", "FATCARequirement", 9); + Evaluate(TempVendor."Tax Identification Type", "TaxIdentificationType"); + TempVendor.Insert(false); + end; + } + } + } + + trigger OnPreXmlPort() + begin + CaptionRow := true; + end; + + procedure GetExpectedVendors(var NewTempVendor: Record Vendor temporary) + begin + if TempVendor.FindSet() then begin + repeat + NewTempVendor.Copy(TempVendor); + NewTempVendor.Insert(); + until TempVendor.Next() = 0; + end; + end; + + var + CaptionRow: Boolean; + TempVendor: Record Vendor temporary; +} diff --git a/Apps/US/HybridSL_US/test/src/SLCompanyAdditionalSettings.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLCompanyAdditionalSettings.XmlPort.al new file mode 100644 index 0000000000..5c23fe0b09 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLCompanyAdditionalSettings.XmlPort.al @@ -0,0 +1,218 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147651 "SL Company Additional Settings" +{ + Caption = 'SL Company Additional Settings'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(Root) + { + tableelement("SL Company Additional Settings"; "SL Company Additional Settings") + { + AutoSave = false; + XmlName = 'SLCompanyAdditionalSettings'; + + textelement(Name) + { + } + textelement(MigrateInactiveCustomers) + { + } + textelement(MigrateInactiveVendors) + { + } + textelement(MigrateVendorClasses) + { + } + textelement(MigrateCustomerClasses) + { + } + textelement(MigrateItemClasses) + { + } + textelement(OldestGLYeartoMigrate) + { + } + textelement(MigratePayablesModule) + { + } + textelement(MigrateReceivablesModule) + { + } + textelement(MigrateInventoryModule) + { + } + textelement(GlobalDimension1) + { + } + textelement(GlobalDimension2) + { + } + textelement(MigrateOpenPOs) + { + } + textelement(MigrateOnlyGLMaster) + { + } + textelement(MigrateOnlyPayablesMaster) + { + } + textelement(MigrateOnlyRecMaster) + { + } + textelement(MigrateOnlyInventoryMaster) + { + } + textelement(MigrateInactiveItems) + { + } + textelement(MigrateDiscontinuedItems) + { + } + textelement(OldestHistYeartoMigrate) + { + } + textelement(MigrateHistGLTrx) + { + } + textelement(MigrateHistARTrx) + { + } + textelement(MigrateHistAPTrx) + { + } + textelement(MigrateHistInvTrx) + { + } + textelement(MigrateHistPurchTrx) + { + } + textelement(MigrationCompleted) + { + } + textelement(SkipPostingAccountBatches) + { + } + textelement(SkipPostingCustomerBatches) + { + } + textelement(SkipPostingVendorBatches) + { + } + textelement(MigrateGLModule) + { + } + textelement(SkipPostingItemBatches) + { + } + textelement(HasHybridCompany) + { + } + textelement(IncludeProjectModule) + { + } + textelement(ProjectMasterOnly) + { + } + textelement(TaskMasterOnly) + { + } + textelement(ResourceMasterOnly) + { + } + textelement(IncludePlanStatusProjects) + { + MinOccurs = Once; + } + textelement(IncludeHoldStatusResources) + { + } + textelement(MigrateCurrent1099Year) + { + } + textelement(MigrateNext1099Year) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + SLCompanyAdditionalSettings.Name := Name; + Evaluate(SLCompanyAdditionalSettings."Migrate Inactive Customers", MigrateInactiveCustomers, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Inactive Vendors", MigrateInactiveVendors, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Vendor Classes", MigrateVendorClasses, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Customer Classes", MigrateCustomerClasses, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Item Classes", MigrateItemClasses, 9); + Evaluate(SLCompanyAdditionalSettings."Oldest GL Year to Migrate", OldestGLYeartoMigrate, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Payables Module", MigratePayablesModule, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Receivables Module", MigrateReceivablesModule, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Inventory Module", MigrateInventoryModule, 9); + SLCompanyAdditionalSettings."Global Dimension 1" := GlobalDimension1; + SLCompanyAdditionalSettings."Global Dimension 2" := GlobalDimension2; + Evaluate(SLCompanyAdditionalSettings."Migrate Open POs", MigrateOpenPOs, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Only GL Master", MigrateOnlyGLMaster, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Only Payables Master", MigrateOnlyPayablesMaster, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Only Rec. Master", MigrateOnlyRecMaster, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Only Inventory Master", MigrateOnlyInventoryMaster, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Inactive Items", MigrateInactiveItems, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Discontinued Items", MigrateDiscontinuedItems, 9); + Evaluate(SLCompanyAdditionalSettings."Oldest Hist. Year to Migrate", OldestHistYeartoMigrate, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Hist. GL Trx.", MigrateHistGLTrx, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Hist. AR Trx.", MigrateHistARTrx, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Hist. AP Trx.", MigrateHistAPTrx, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Hist. Inv. Trx.", MigrateHistInvTrx, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Hist. Purch. Trx.", MigrateHistPurchTrx, 9); + Evaluate(SLCompanyAdditionalSettings."Migration Completed", MigrationCompleted, 9); + Evaluate(SLCompanyAdditionalSettings."Skip Posting Account Batches", SkipPostingAccountBatches, 9); + Evaluate(SLCompanyAdditionalSettings."Skip Posting Customer Batches", SkipPostingCustomerBatches, 9); + Evaluate(SLCompanyAdditionalSettings."Skip Posting Vendor Batches", SkipPostingVendorBatches, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate GL Module", MigrateGLModule, 9); + Evaluate(SLCompanyAdditionalSettings."Skip Posting Item Batches", SkipPostingItemBatches, 9); + Evaluate(SLCompanyAdditionalSettings."Has Hybrid Company", HasHybridCompany, 9); + Evaluate(SLCompanyAdditionalSettings."Include Project Module", IncludeProjectModule, 9); + Evaluate(SLCompanyAdditionalSettings."Project Master Only", ProjectMasterOnly, 9); + Evaluate(SLCompanyAdditionalSettings."Task Master Only", TaskMasterOnly, 9); + Evaluate(SLCompanyAdditionalSettings."Resource Master Only", ResourceMasterOnly, 9); + Evaluate(SLCompanyAdditionalSettings."Include Plan Status Projects", IncludePlanStatusProjects); + Evaluate(SLCompanyAdditionalSettings."Include Hold Status Resources", IncludeHoldStatusResources, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Current 1099 Year", MigrateCurrent1099Year, 9); + Evaluate(SLCompanyAdditionalSettings."Migrate Next 1099 Year", MigrateNext1099Year, 9); + SLCompanyAdditionalSettings.Insert(true); + end; + } + } + } + + trigger OnPreXmlPort() + begin + SLCompanyAdditionalSettings.DeleteAll(); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; +} diff --git a/Apps/US/HybridSL_US/test/src/SLCompanyMigrationSettings.Xmlport.al b/Apps/US/HybridSL_US/test/src/SLCompanyMigrationSettings.Xmlport.al new file mode 100644 index 0000000000..c1c23d1ca9 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLCompanyMigrationSettings.Xmlport.al @@ -0,0 +1,81 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147652 "SL Company Migration Settings" +{ + Caption = 'Company Migration Settings data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("SL Company Migration Settings"; "SL Company Migration Settings") + { + AutoSave = false; + XmlName = 'SLCompanyMigrationSettings'; + + textelement("Name") + { + } + textelement("GlobalDimension1") + { + } + textelement("GlobalDimension2") + { + } + textelement("MigrateInactiveCustomers") + { + } + textelement("MigrateInactiveVendors") + { + } + textelement("ProcessesAreRunning") + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + SLCompanyMigrationSettings: Record "SL Company Migration Settings"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + SLCompanyMigrationSettings.Name := Name; + SLCompanyMigrationSettings."Global Dimension 1" := GlobalDimension1; + SLCompanyMigrationSettings."Global Dimension 2" := GlobalDimension2; + Evaluate(SLCompanyMigrationSettings."Migrate Inactive Customers", MigrateInactiveCustomers); + Evaluate(SLCompanyMigrationSettings."Migrate Inactive Vendors", MigrateInactiveVendors); + Evaluate(SLCompanyMigrationSettings.ProcessesAreRunning, ProcessesAreRunning); + SLCompanyMigrationSettings.Insert(false); + end; + } + } + } + + trigger OnPreXmlPort() + begin + SLCompanyMigrationSettings.DeleteAll(); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + SLCompanyMigrationSettings: Record "SL Company Migration Settings"; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/src/SLMigrationVendor1099Tests.Codeunit.al b/Apps/US/HybridSL_US/test/src/SLMigrationVendor1099Tests.Codeunit.al new file mode 100644 index 0000000000..8720e1b0b9 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLMigrationVendor1099Tests.Codeunit.al @@ -0,0 +1,178 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ + +namespace Microsoft.DataMigration.SL; + +using Microsoft.Purchases.Payables; +using System.TestLibraries.Utilities; +using Microsoft.Foundation.Company; +using Microsoft.Purchases.Vendor; + +codeunit 147650 "SL Migration Vendor 1099 Tests" +{ + EventSubscriberInstance = Manual; + Subtype = Test; + TestPermissions = Disabled; + Permissions = tabledata "Detailed Vendor Ledg. Entry" = rimd, + tabledata "Vendor Ledger Entry" = rimd; + + var + Assert: Codeunit "Library Assert"; + SLTestHelperFunctions: Codeunit "SL Test Helper Functions"; + IsInitialized: Boolean; + + [Test] + procedure TestVendor1099Migration() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + TempVendor: Record Vendor temporary; + SLCloudMigrationUS: Codeunit "SL Cloud Migration US"; + ExpectedVendorData: XmlPort "SL BC Vendor With 1099 Data"; + VendorInstream: InStream; + begin + // [Given] SL Data + Initialize(); + SLTestHelperFunctions.ClearBCVendorTableData(); + SLTestHelperFunctions.DeleteAllSettings(); + SLTestHelperFunctions.CreateConfigurationSettings(); + + // Enable Current 1099 Year and Next 1099 Year migration in SL Company Additional Settings + SLCompanyAdditionalSettings.GetSingleInstance(); + SLCompanyAdditionalSettings.Validate("Migrate Current 1099 Year", true); + SLCompanyAdditionalSettings.Validate("Migrate Next 1099 Year", true); + SLCompanyAdditionalSettings.Modify(); + + // Import test data + SLTestHelperFunctions.ImportGLAccountData(); + SLTestHelperFunctions.ImportVendorPostingGroupData(); + SLTestHelperFunctions.ImportSLVendorData(); + SLTestHelperFunctions.ImportBCVendorDataNo1099(); + SLTestHelperFunctions.ImportSLAPBalancesData(); + + // [When] SL migration has completed and the Vendor 1099 migration has started + SLCloudMigrationUS.RunPostMigration(); + + // [Then] Validate BC Vendor 1099 data has been populated correctly + SLTestHelperFunctions.GetInputStreamFromResource('datasets/results/SLBCVendorWith1099.csv', VendorInstream); + ExpectedVendorData.SetSource(VendorInstream); + ExpectedVendorData.Import(); + ExpectedVendorData.GetExpectedVendors(TempVendor); + ValidateVendor1099Data(TempVendor); + end; + + [Test] + procedure TestMappingCreated() + var + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + SLSupportedTaxYear: Record "SL Supported Tax Year"; + TempSL1099BoxMapping: Record "SL 1099 Box Mapping" temporary; + TempSLSupportedTaxYear: Record "SL Supported Tax Year" temporary; + SLCloudMigrationUS: Codeunit "SL Cloud Migration US"; + ExpectedSL1099BoxMappingData: XmlPort "SL 1099 Box Mapping Data"; + ExpectedSLSupportedTaxYearData: XmlPort "SL Supported Tax Year Data"; + SL1099BoxMappingInstream: InStream; + SLSupportedTaxYearInstream: InStream; + begin + // [Scenario] Current 1099 Year and Next 1099 Year migration enabled in SL Company Additional Settings + + // [Given] SL Data + Initialize(); + SLTestHelperFunctions.ClearBCVendorTableData(); + SLTestHelperFunctions.DeleteAllSettings(); + SLTestHelperFunctions.CreateConfigurationSettings(); + + // Enable Current 1099 Year and Next 1099 Year migration in SL Company Additional Settings + SLCompanyAdditionalSettings.GetSingleInstance(); + SLCompanyAdditionalSettings.Validate("Migrate Current 1099 Year", true); + SLCompanyAdditionalSettings.Validate("Migrate Next 1099 Year", true); + SLCompanyAdditionalSettings.Modify(); + + // Import test data + SLTestHelperFunctions.ImportSLVendorData(); + SLTestHelperFunctions.ImportBCVendorDataNo1099(); + + // [When] SL migration has completed and the Vendor 1099 migration has started + SLCloudMigrationUS.RunPostMigration(); + + // [Then] Validate supported tax years + SLTestHelperFunctions.GetInputStreamFromResource('datasets/results/SLSupportedTaxYear.csv', SLSupportedTaxYearInstream); + ExpectedSLSupportedTaxYearData.SetSource(SLSupportedTaxYearInstream); + ExpectedSLSupportedTaxYearData.Import(); + ExpectedSLSupportedTaxYearData.GetExpectedSLSupportedTaxYear(TempSLSupportedTaxYear); + ValidateSLSupportedTaxYearData(TempSLSupportedTaxYear); + + // [Then] Mappings will be present for the supported tax years + SLTestHelperFunctions.GetInputStreamFromResource('datasets/results/SL1099BoxMapping.csv', SL1099BoxMappingInstream); + ExpectedSL1099BoxMappingData.SetSource(SL1099BoxMappingInstream); + ExpectedSL1099BoxMappingData.Import(); + ExpectedSL1099BoxMappingData.GetExpectedSL1099BoxMapping(TempSL1099BoxMapping); + ValidateSL1099BoxMappingData(TempSL1099BoxMapping); + end; + + local procedure ValidateSLSupportedTaxYearData(var TempSLSupportedTaxYear: Record "SL Supported Tax Year" temporary) + var + SLSupportedTaxYear: Record "SL Supported Tax Year"; + begin + TempSLSupportedTaxYear.Reset(); + TempSLSupportedTaxYear.FindSet(); + repeat + Assert.IsTrue(SLSupportedTaxYear.Get(TempSLSupportedTaxYear."Tax Year"), 'SL Supported Tax Year record not found for Tax Year ' + Format(TempSLSupportedTaxYear."Tax Year")); + until TempSLSupportedTaxYear.Next() = 0; + end; + + local procedure ValidateSL1099BoxMappingData(var TempSL1099BoxMapping: Record "SL 1099 Box Mapping" temporary) + var + SL1099BoxMapping: Record "SL 1099 Box Mapping"; + begin + TempSL1099BoxMapping.Reset(); + TempSL1099BoxMapping.FindSet(); + repeat + Assert.IsTrue(SL1099BoxMapping.Get(TempSL1099BoxMapping."Tax Year", TempSL1099BoxMapping."SL Data Value"), 'SL 1099 Box Mapping record not found for Tax Year ' + Format(TempSL1099BoxMapping."Tax Year") + ' and SL Data Value ' + TempSL1099BoxMapping."SL Data Value"); + Assert.AreEqual(TempSL1099BoxMapping."SL 1099 Box No.", SL1099BoxMapping."SL 1099 Box No.", 'SL 1099 Box No. does not match for Tax Year ' + Format(TempSL1099BoxMapping."Tax Year") + ' and SL Data Value ' + TempSL1099BoxMapping."SL Data Value"); + Assert.AreEqual(TempSL1099BoxMapping."Form Type", SL1099BoxMapping."Form Type", 'Form Type does not match for Tax Year ' + Format(TempSL1099BoxMapping."Tax Year") + ' and SL Data Value ' + TempSL1099BoxMapping."SL Data Value"); + Assert.AreEqual(TempSL1099BoxMapping."BC IRS 1099 Code", SL1099BoxMapping."BC IRS 1099 Code", 'BC IRS 1099 Code does not match for Tax Year ' + Format(TempSL1099BoxMapping."Tax Year") + ' and SL Data Value ' + TempSL1099BoxMapping."SL Data Value"); + until TempSL1099BoxMapping.Next() = 0; + end; + + local procedure ValidateVendor1099Data(var TempVendor: Record Vendor temporary) + var + Vendor: Record Vendor; + begin + TempVendor.Reset(); + TempVendor.FindSet(); + repeat + Assert.IsTrue(Vendor.Get(TempVendor."No."), 'Vendor record not found for No. ' + TempVendor."No."); + Assert.AreEqual(TempVendor."Federal ID No.", Vendor."Federal ID No.", 'Federal ID No. does not match for Vendor No. ' + TempVendor."No."); + Assert.AreEqual(TempVendor."FATCA Requirement", Vendor."FATCA Requirement", 'FATCA Requirement does not match for Vendor No. ' + TempVendor."No."); + Assert.AreEqual(TempVendor."Tax Identification Type", Vendor."Tax Identification Type", 'Tax Identification Type does not match for Vendor No. ' + TempVendor."No."); + until TempVendor.Next() = 0; + end; + + local procedure Initialize() + var + SLAPBalances: Record "SL AP_Balances"; + SLAPSetup: Record "SL APSetup"; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + SLCompanyMigrationSettings: Record "SL Company Migration Settings"; + SLVendor: Record "SL Vendor"; + + begin + // Clear existing data + if not SLAPSetup.IsEmpty() then + SLAPSetup.DeleteAll(); + if not SLVendor.IsEmpty() then + SLVendor.DeleteAll(); + if not SLAPBalances.IsEmpty() then + SLAPBalances.DeleteAll(); + + if IsInitialized then + exit; + + SLTestHelperFunctions.ImportSLAPSetupData(); + Commit(); + IsInitialized := true; + end; +} + diff --git a/Apps/US/HybridSL_US/test/src/SLSupportedTaxYearData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLSupportedTaxYearData.XmlPort.al new file mode 100644 index 0000000000..e4878a97ca --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLSupportedTaxYearData.XmlPort.al @@ -0,0 +1,68 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147655 "SL Supported Tax Year Data" +{ + Caption = 'SL Supported Tax Year data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("SL Supported Tax Year"; "SL Supported Tax Year") + { + AutoSave = false; + XmlName = 'SLSupportedTaxYear'; + UseTemporary = true; + + textelement("TaxYear") + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + Evaluate(TempSLSupportedTaxYear."Tax Year", TaxYear); + TempSLSupportedTaxYear.Insert(true); + end; + } + } + } + + trigger OnPreXmlPort() + begin + CaptionRow := true; + end; + + procedure GetExpectedSLSupportedTaxYear(var NewTempSLSupportedTaxYear: Record "SL Supported Tax Year" temporary) + begin + if TempSLSupportedTaxYear.FindSet() then + repeat + NewTempSLSupportedTaxYear := TempSLSupportedTaxYear; + NewTempSLSupportedTaxYear.Insert(); + until TempSLSupportedTaxYear.Next() = 0; + end; + + var + CaptionRow: Boolean; + TempSLSupportedTaxYear: Record "SL Supported Tax Year" temporary; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/src/SLTestHelperFunctions.Codeunit.al b/Apps/US/HybridSL_US/test/src/SLTestHelperFunctions.Codeunit.al new file mode 100644 index 0000000000..65b9c44992 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLTestHelperFunctions.Codeunit.al @@ -0,0 +1,162 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +using Microsoft.Purchases.Vendor; + +codeunit 147651 "SL Test Helper Functions" +{ + procedure GetInputStreamFromResource(ResourcePath: Text; var ResInstream: InStream) + begin + NavApp.GetResource(ResourcePath, ResInstream); + end; + + procedure ImportGLAccountData() + var + GLAccountInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLBCGLAccount.csv', GLAccountInstream); + PopulateGLAccountTable(GLAccountInstream); + end; + + procedure ImportSLAPBalancesData() + var + SLAPBalancesInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLTables/SLAP_Balances.csv', SLAPBalancesInstream); + PopulateSLAPBalancesTable(SLAPBalancesInstream); + end; + + procedure ImportSLAPSetupData() + var + SLAPSetupInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLTables/SLAPSetup.csv', SLAPSetupInstream); + PopulateSLAPSetupTable(SLAPSetupInstream); + end; + + procedure ImportSLCompanyAdditionalSettingsData() + var + SLCompanyAdditionalSettingsInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLCompanyAdditionalSettings.csv', SLCompanyAdditionalSettingsInstream); + PopulateSLCompanyAdditionalSettingsTable(SLCompanyAdditionalSettingsInstream); + end; + + procedure ImportSLCompanyMigrationSettingsData() + var + SLCompanyMigrationSettingsInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLCompanyMigrationSettings.csv', SLCompanyMigrationSettingsInstream); + PopulateSLCompanyMigrationSettingsTable(SLCompanyMigrationSettingsInstream); + end; + + procedure ImportVendorPostingGroupData() + var + VendorPostingGroupInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLBCVendorPostingGroup.csv', VendorPostingGroupInstream); + PopulateVendorPostingGroupTable(VendorPostingGroupInstream); + end; + + procedure ImportSLVendorData() + var + SLVendorInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLTables/SLVendorWith1099.csv', SLVendorInstream); + PopulateSLVendorTable(SLVendorInstream); + end; + + procedure ImportBCVendorDataNo1099() + var + BCVendorInstream: InStream; + begin + GetInputStreamFromResource('datasets/input/SLBCVendorNo1099.csv', BCVendorInstream); + PopulateBCVendorTableNo1099(BCVendorInstream); + end; + + procedure PopulateGLAccountTable(var Instream: InStream) + begin + // Populate GL Account table + Xmlport.Import(Xmlport::"SL BC GL Account Data", Instream); + end; + + procedure PopulateSLAPBalancesTable(var Instream: InStream) + begin + // Populate SL AP_Balances table + Xmlport.Import(Xmlport::"SL AP Balances Data", Instream); + end; + + procedure PopulateSLAPSetupTable(var Instream: InStream) + begin + // Populate SL APSetup table + Xmlport.Import(Xmlport::"SL APSetup Data", Instream); + end; + + procedure PopulateSLCompanyAdditionalSettingsTable(var Instream: InStream) + begin + // Populate SL Company Additional Settings table + Xmlport.Import(Xmlport::"SL Company Additional Settings", Instream); + end; + + procedure PopulateSLCompanyMigrationSettingsTable(var Instream: InStream) + begin + // Populate SL Company Migration Settings table + Xmlport.Import(Xmlport::"SL Company Migration Settings", Instream); + end; + + procedure PopulateSLVendorTable(var Instream: InStream) + begin + // Populate SL Vendor table + Xmlport.Import(Xmlport::"SL Vendor Data", Instream); + end; + + procedure PopulateBCVendorTableNo1099(var Instream: InStream) + begin + // Populate BC Vendor table + Xmlport.Import(Xmlport::"SL BC Vendor No 1099 Data", Instream); + end; + + procedure PopulateVendorPostingGroupTable(var Instream: InStream) + begin + // Populate Vendor Posting Group table + Xmlport.Import(Xmlport::"SL Vendor Posting Group Data", Instream); + end; + + procedure ClearBCVendorTableData() + var + Vendor: Record Vendor; + begin + Vendor.DeleteAll(); + end; + + procedure CreateConfigurationSettings() + var + SLCompanyMigrationSettings: Record "SL Company Migration Settings"; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + CompanyNameText: Text[30]; + begin + CompanyNameText := CompanyName(); + + if not SLCompanyMigrationSettings.Get(CompanyNameText) then begin + SLCompanyMigrationSettings.Name := CompanyNameText; + SLCompanyMigrationSettings.Insert(); + end; + + if not SLCompanyAdditionalSettings.Get(CompanyNameText) then begin + SLCompanyAdditionalSettings.Name := CompanyNameText; + SLCompanyAdditionalSettings.Insert(); + end; + end; + + procedure DeleteAllSettings() + var + SLCompanyMigrationSettings: Record "SL Company Migration Settings"; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + begin + SLCompanyMigrationSettings.DeleteAll(); + SLCompanyAdditionalSettings.DeleteAll(); + end; +} \ No newline at end of file diff --git a/Apps/US/HybridSL_US/test/src/SLVendorData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLVendorData.XmlPort.al new file mode 100644 index 0000000000..0679d50271 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLVendorData.XmlPort.al @@ -0,0 +1,161 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +xmlport 147653 "SL Vendor Data" +{ + Caption = 'SL Vendor data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("SL Vendor"; "SL Vendor") + { + AutoSave = false; + XmlName = 'SLVendor'; + + textelement(VendId) + { + } + textelement(Addr1) + { + } + textelement(Addr2) + { + } + textelement(APAcct) + { + } + textelement(APSub) + { + } + textelement(Attn) + { + } + textelement(City) + { + } + textelement(ClassID) + { + } + textelement(Country) + { + } + textelement(Curr1099Yr) + { + } + textelement(DfltBox) + { + } + textelement(EMailAddr) + { + } + textelement(Fax) + { + } + textelement(Name) + { + } + textelement(Next1099Yr) + { + } + textelement(Phone) + { + } + textelement(RemitName) + { + } + textelement(S4Future09) + { + } + textelement(State) + { + } + textelement(Status) + { + } + textelement(TaxId00) + { + } + textelement(TaxRegNbr) + { + } + textelement(Terms) + { + } + textelement(TIN) + { + } + textelement(Vend1099) + { + } + textelement(Zip) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + SLVendor: Record "SL Vendor"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + SLVendor.VendId := VendId; + SLVendor.Addr1 := Addr1; + SLVendor.Addr2 := Addr2; + SLVendor.APAcct := APAcct; + SLVendor.APSub := APSub; + SLVendor.Attn := Attn; + SLVendor.City := City; + SLVendor.ClassID := ClassID; + SLVendor.Country := Country; + SLVendor.Curr1099Yr := Curr1099Yr; + SLVendor.DfltBox := DfltBox; + SLVendor.EMailAddr := EMailAddr; + SLVendor.Fax := Fax; + SLVendor.Name := Name; + SLVendor.Next1099Yr := Next1099Yr; + SLVendor.Phone := Phone; + SLVendor.RemitName := RemitName; + Evaluate(SLVendor.S4Future09, S4Future09, 9); + SLVendor.State := State; + SLVendor.Status := Status; + SLVendor.TaxId00 := TaxId00; + SLVendor.TaxRegNbr := TaxRegNbr; + SLVendor.Terms := Terms; + SLVendor.TIN := TIN; + Evaluate(SLVendor.Vend1099, Vend1099, 9); + SLVendor.Zip := Zip; + SLVendor.Insert(); + end; + } + } + } + + trigger OnPreXmlPort() + begin + SLVendor.DeleteAll(true); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + SLVendor: Record "SL Vendor"; +} diff --git a/Apps/US/HybridSL_US/test/src/SLVendorPostingGroupData.XmlPort.al b/Apps/US/HybridSL_US/test/src/SLVendorPostingGroupData.XmlPort.al new file mode 100644 index 0000000000..b522216cf8 --- /dev/null +++ b/Apps/US/HybridSL_US/test/src/SLVendorPostingGroupData.XmlPort.al @@ -0,0 +1,111 @@ +// ------------------------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// ------------------------------------------------------------------------------------------------ +namespace Microsoft.DataMigration.SL; + +using Microsoft.Purchases.Vendor; + +xmlport 147659 "SL Vendor Posting Group Data" +{ + Caption = 'Vendor Posting Group data for import/export'; + Direction = Both; + FieldSeparator = ','; + RecordSeparator = ''; + Format = VariableText; + + schema + { + textelement(root) + { + tableelement("Vendor Posting Group"; "Vendor Posting Group") + { + AutoSave = false; + XmlName = 'BCVendorPostingGroup'; + + textelement(Code) + { + } + textelement(PayablesAccount) + { + } + textelement(ServiceChargeAcc) + { + } + textelement(PaymentDiscDebitAcc) + { + } + textelement(InvoiceRoundingAccount) + { + } + textelement(DebitCurrApplnRndgAcc) + { + } + textelement(CreditCurrApplnRndgAcc) + { + } + textelement(DebitRoundingAccount) + { + } + textelement(CreditRoundingAccount) + { + } + textelement(PaymentDiscCreditAcc) + { + } + textelement(PaymentToleranceDebitAcc) + { + } + textelement(PaymentToleranceCreditAcc) + { + } + textelement(Description) + { + } + + trigger OnPreXmlItem() + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + end; + + trigger OnBeforeInsertRecord() + var + VendorPostingGroup: Record "Vendor Posting Group"; + begin + if CaptionRow then begin + CaptionRow := false; + currXMLport.Skip(); + end; + + VendorPostingGroup.Code := Code; + VendorPostingGroup."Payables Account" := PayablesAccount; + VendorPostingGroup."Service Charge Acc." := ServiceChargeAcc; + VendorPostingGroup."Payment Disc. Debit Acc." := PaymentDiscDebitAcc; + VendorPostingGroup."Invoice Rounding Account" := InvoiceRoundingAccount; + VendorPostingGroup."Debit Curr. Appln. Rndg. Acc." := DebitCurrApplnRndgAcc; + VendorPostingGroup."Credit Curr. Appln. Rndg. Acc." := CreditCurrApplnRndgAcc; + VendorPostingGroup."Debit Rounding Account" := DebitRoundingAccount; + VendorPostingGroup."Credit Rounding Account" := CreditRoundingAccount; + VendorPostingGroup."Payment Disc. Credit Acc." := PaymentDiscCreditAcc; + VendorPostingGroup."Payment Tolerance Debit Acc." := PaymentToleranceDebitAcc; + VendorPostingGroup."Payment Tolerance Credit Acc." := PaymentToleranceCreditAcc; + VendorPostingGroup.Description := Description; + VendorPostingGroup.Insert(); + end; + } + } + } + + trigger OnPreXmlPort() + begin + VendorPostingGroup.DeleteAll(); + CaptionRow := true; + end; + + var + CaptionRow: Boolean; + VendorPostingGroup: Record "Vendor Posting Group"; +} From 1c0ff540a36a17ee719b8d35b5f19aa35621b507 Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Mon, 1 Dec 2025 11:36:38 -0500 Subject: [PATCH 5/8] GL Account Beginning Balance update and improve dimension handling. --- .../Accounts/SLAccountMigrator.Codeunit.al | 348 ++++++++++++++++-- .../SLTables/SLPopulateAccounts.Codeunit.al | 8 +- .../SLPopulateFiscalPeriods.Codeunit.al | 3 - .../Support/SLHelperFunctions.Codeunit.al | 37 +- .../codeunits/SLCloudMigration.Codeunit.al | 1 + .../src/codeunits/SLDimensions.Codeunit.al | 32 +- 6 files changed, 367 insertions(+), 62 deletions(-) diff --git a/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAccountMigrator.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAccountMigrator.Codeunit.al index 3e4c148341..57b652a6a0 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAccountMigrator.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAccountMigrator.Codeunit.al @@ -6,6 +6,7 @@ namespace Microsoft.DataMigration.SL; using System.Integration; +using Microsoft.Finance.GeneralLedger.Account; using Microsoft.Finance.GeneralLedger.Journal; using Microsoft.Finance.Dimension; @@ -14,6 +15,7 @@ codeunit 47000 "SL Account Migrator" Access = Internal; var + BeginningBalanceDescriptionTxt: Label 'Beginning Balance for ', Locked = true; PostingGroupCodeTxt: Label 'SL', Locked = true; PostingGroupDescriptionTxt: Label 'Migrated from SL', Locked = true; GLModuleIDLbl: Label 'GL', Locked = true; @@ -111,8 +113,157 @@ codeunit 47000 "SL Account Migrator" Sender.ModifyGLAccount(true); end; + [EventSubscriber(ObjectType::Codeunit, Codeunit::"GL Acc. Data Migration Facade", OnCreateOpeningBalanceTrx, '', true, true)] + local procedure OnCreateOpeningBalanceTrx(var Sender: Codeunit "GL Acc. Data Migration Facade"; RecordIdToMigrate: RecordId) + begin + CreateOpeningBalanceTrx(Sender, RecordIdToMigrate); + end; + + internal procedure CreateOpeningBalanceTrx(var Sender: Codeunit "GL Acc. Data Migration Facade"; RecordIdToMigrate: RecordId) + var + SLAccountStaging: Record "SL Account Staging"; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + begin + if RecordIdToMigrate.TableNo <> Database::"SL Account Staging" then + exit; + if not SLCompanyAdditionalSettings.GetGLModuleEnabled() then + exit; + if SLCompanyAdditionalSettings.GetMigrateOnlyGLMaster() then + exit; + + SLAccountStaging.Get(RecordIdToMigrate); + if SLAccountStaging.IncomeBalance then + exit; + + CreateGLAccountBeginningBalance(SLAccountStaging); + end; + + internal procedure CreateGLAccountBeginningBalance(SLAcccountStaging: Record "SL Account Staging"); + var + GenJournalLine: Record "Gen. Journal Line"; + GLAccount: Record "G/L Account"; + SLAcctHist: Record "SL AcctHist"; + SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; + SLFiscalPeriods: Record "SL Fiscal Periods"; + SLGLSetup: Record "SL GLSetup"; + DataMigrationFacadeHelper: Codeunit "Data Migration Facade Helper"; + SLPopulateAccountHistory: Codeunit "SL Populate Account History"; + PostingGroupCode: Code[10]; + SubSegment_1: Code[20]; + SubSegment_2: Code[20]; + SubSegment_3: Code[20]; + SubSegment_4: Code[20]; + SubSegment_5: Code[20]; + SubSegment_6: Code[20]; + SubSegment_7: Code[20]; + SubSegment_8: Code[20]; + BeginningBalanceDate: Date; + BeginningBalance: Decimal; + InitialYear: Integer; + PreviousYear: Integer; + NbrOfSegments: Integer; + DimSetID: Integer; + BeginningBalancePeriodTxt: Label '-00', Locked = true; + begin + if not GLAccount.Get(SLAcccountStaging.AcctNum) then + exit; + if not SLGLSetup.Get(GLModuleIDLbl) then + exit; + + SLCompanyAdditionalSettings.GetSingleInstance(); + InitialYear := SLCompanyAdditionalSettings.GetInitialYear(); + if InitialYear = 0 then + exit; + PreviousYear := InitialYear - 1; + if SLFiscalPeriods.Get(SLGLSetup.NbrPer, PreviousYear) then + BeginningBalanceDate := SLFiscalPeriods.PerEndDT + else + exit; + + NbrOfSegments := SLPopulateAccountHistory.GetNumberOfSegments(); + + PostingGroupCode := PostingGroupCodeTxt + Format(InitialYear) + BeginningBalancePeriodTxt; + SLAcctHist.SetRange(CpnyID, CompanyName()); + SLAcctHist.SetRange(Acct, SLAcccountStaging.AcctNum); + SLAcctHist.SetRange(LedgerID, SLGLSetup.LedgerID); + SLAcctHist.SetRange(FiscYr, Format(InitialYear)); + + if SLAcctHist.FindSet() then + repeat + if SLAcccountStaging.AccountCategory = 2 then + BeginningBalance := SLAcctHist.BegBal * -1 + else + BeginningBalance := SLAcctHist.BegBal; + if BeginningBalance <> 0 then begin + CreateBeginningBalanceGenJournalBatchIfNeeded(PostingGroupCode, InitialYear); + DataMigrationFacadeHelper.CreateGeneralJournalLine( + GenJournalLine, + PostingGroupCode, + PostingGroupCode, + BeginningBalanceDescriptionTxt + Format(InitialYear), + GenJournalLine."Account Type"::"G/L Account", + SLAcccountStaging.AcctNum, + BeginningBalanceDate, + 0D, + BeginningBalance, + BeginningBalance, + '', + ''); + + SubSegment_1 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 1, NbrOfSegments); + SubSegment_2 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 2, NbrOfSegments); + SubSegment_3 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 3, NbrOfSegments); + SubSegment_4 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 4, NbrOfSegments); + SubSegment_5 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 5, NbrOfSegments); + SubSegment_6 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 6, NbrOfSegments); + SubSegment_7 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 7, NbrOfSegments); + SubSegment_8 := GetSegmentValueFromSubaccount(SLAcctHist.Sub, 8, NbrOfSegments); + + DimSetID := CreateDimSetFromSubSegments(SubSegment_1, SubSegment_2, SubSegment_3, SubSegment_4, SubSegment_5, SubSegment_6, SubSegment_7, SubSegment_8); + GenJournalLine.Validate("Dimension Set ID", DimSetID); + GenJournalLine.Modify(true); + end; + until SLAcctHist.Next() = 0; + end; + + internal procedure CreateBeginningBalanceGenJournalBatchIfNeeded(GeneralJournalBatchCode: Code[10]; InitialYear: Integer) + var + GenJournalBatch: Record "Gen. Journal Batch"; + TemplateName: Code[10]; + begin + TemplateName := CreateBeginningBalanceGenJournalTemplateIfNeeded(GeneralJournalBatchCode, InitialYear); + GenJournalBatch.SetRange("Journal Template Name", TemplateName); + GenJournalBatch.SetRange(Name, GeneralJournalBatchCode); + if not GenJournalBatch.FindFirst() then begin + GenJournalBatch.Init(); + GenJournalBatch.Validate("Journal Template Name", TemplateName); + GenJournalBatch.SetupNewBatch(); + GenJournalBatch.Validate(Name, GeneralJournalBatchCode); + GenJournalBatch.Validate(Description, BeginningBalanceDescriptionTxt + Format(InitialYear)); + GenJournalBatch.Insert(true); + end; + end; + + internal procedure CreateBeginningBalanceGenJournalTemplateIfNeeded(GenJournalBatchCode: Code[10]; InitialYear: Integer): Code[10] + var + GenJournalTemplate: Record "Gen. Journal Template"; + begin + GenJournalTemplate.SetRange(Type, GenJournalTemplate.Type::General); + GenJournalTemplate.SetRange(Recurring, false); + if not GenJournalTemplate.FindFirst() then begin + Clear(GenJournalTemplate); + GenJournalTemplate.Validate(Name, GenJournalBatchCode); + GenJournalTemplate.Validate(Type, GenJournalTemplate.Type::General); + GenJournalTemplate.Validate(Recurring, false); + GenJournalTemplate.Validate(Description, BeginningBalanceDescriptionTxt + Format(InitialYear)); + GenJournalTemplate.Insert(true); + end; + exit(GenJournalTemplate.Name); + end; + internal procedure GenerateGLTransactionBatches(SLAccountStaging: Record "SL Account Staging"); var + GenJournalBatch: Record "Gen. Journal Batch"; GenJournalLine: Record "Gen. Journal Line"; SLAccountTransactions: Record "SL AccountTransactions"; SLFiscalPeriods: Record "SL Fiscal Periods"; @@ -140,14 +291,14 @@ codeunit 47000 "SL Account Migrator" if SLAccountStaging.AccountCategory = 4 then // Income SLAccountTransactions.Balance := (-1 * SLAccountTransactions.Balance); - CreateGeneralJournalBatchIfNeeded(CopyStr(PostingGroupCode, 1, 10)); + CreateGeneralJournalBatchIfNeeded(CopyStr(PostingGroupCode, 1, MaxStrLen(GenJournalBatch.Name))); BatchDocumentNo := PostingGroupCodeTxt + GLModuleIDLbl + SLAccountTransactions.Year + PostingGroupPeriod; BatchDescription := DescriptionTrxTxt + SLAccountTransactions.Year + '-' + PostingGroupPeriod; if SLFiscalPeriods.Get(SLAccountTransactions.PERIODID, SLAccountTransactions.Year) then DataMigrationFacadeHelper.CreateGeneralJournalLine( GenJournalLine, - CopyStr(PostingGroupCode, 1, 10), + CopyStr(PostingGroupCode, 1, MaxStrLen(GenJournalLine."Journal Batch Name")), CopyStr(BatchDocumentNo, 1, MaxStrLen(BatchDocumentNo)), CopyStr(BatchDescription, 1, MaxStrLen(BatchDescription)), GenJournalLine."Account Type"::"G/L Account", @@ -168,8 +319,9 @@ codeunit 47000 "SL Account Migrator" var GenJournalBatch: Record "Gen. Journal Batch"; TemplateName: Code[10]; + GeneralLbl: Label 'GENERAL', Locked = true; begin - TemplateName := CreateGeneralJournalTemplateIfNeeded('GENERAL'); + TemplateName := CreateGeneralJournalTemplateIfNeeded(GeneralLbl); GenJournalBatch.SetRange("Journal Template Name", TemplateName); GenJournalBatch.SetRange(Name, GeneralJournalBatchCode); if not GenJournalBatch.FindFirst() then begin @@ -201,47 +353,175 @@ codeunit 47000 "SL Account Migrator" var TempDimensionSetEntry: Record "Dimension Set Entry" temporary; DimensionValue: Record "Dimension Value"; - SLSegments: Record "SL Segments"; SLHelperFunctions: Codeunit "SL Helper Functions"; DimensionManagement: Codeunit DimensionManagement; NewDimSetID: Integer; begin - SLSegments.SetCurrentKey(SLSegments.SegmentNumber); - SLSegments.Ascending(true); - if SLSegments.FindSet() then - repeat - DimensionValue.Get(SLHelperFunctions.CheckDimensionName(SLSegments.Id), GetSegmentValue(MigrationSlAccountTrans, SLSegments.SegmentNumber)); - TempDimensionSetEntry.Init(); - TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); - TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); - TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); - TempDimensionSetEntry.Insert(true); - until SLSegments.Next() = 0; + if MigrationSlAccountTrans.SubSegment_1.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(1), MigrationSlAccountTrans.SubSegment_1); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_2.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(2), MigrationSlAccountTrans.SubSegment_2); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_3.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(3), MigrationSlAccountTrans.SubSegment_3); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_4.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(4), MigrationSlAccountTrans.SubSegment_4); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_5.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(5), MigrationSlAccountTrans.SubSegment_5); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_6.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(6), MigrationSlAccountTrans.SubSegment_6); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_7.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(7), MigrationSlAccountTrans.SubSegment_7); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; + if MigrationSlAccountTrans.SubSegment_8.TrimEnd() <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(8), MigrationSlAccountTrans.SubSegment_8); + InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + end; NewDimSetID := DimensionManagement.GetDimensionSetID(TempDimensionSetEntry); TempDimensionSetEntry.DeleteAll(); exit(NewDimSetID); end; - internal procedure GetSegmentValue(MigrationSlAccountTrans: Record "SL AccountTransactions"; SegmentNumber: Integer): Code[20] - begin - case SegmentNumber of - 1: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_1, 1, 20)); - 2: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_2, 1, 20)); - 3: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_3, 1, 20)); - 4: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_4, 1, 20)); - 5: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_5, 1, 20)); - 6: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_6, 1, 20)); - 7: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_7, 1, 20)); - 8: - exit(CopyStr(MigrationSlAccountTrans.SubSegment_8, 1, 20)); + internal procedure CreateDimSetFromSubSegments(SubSegment_1: Code[20]; SubSegment_2: Code[20]; SubSegment_3: Code[20]; SubSegment_4: Code[20]; SubSegment_5: Code[20]; SubSegment_6: Code[20]; SubSegment_7: Code[20]; SubSegment_8: Code[20]): Integer + var + TempDimensionSetEntry: Record "Dimension Set Entry" temporary; + DimensionValue: Record "Dimension Value"; + SLHelperFunctions: Codeunit "SL Helper Functions"; + DimensionManagement: Codeunit DimensionManagement; + NewDimSetID: Integer; + begin + if SubSegment_1 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(1), SubSegment_1); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + if SubSegment_2 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(2), SubSegment_2); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + if SubSegment_3 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(3), SubSegment_3); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + if SubSegment_4 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(4), SubSegment_4); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + if SubSegment_5 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(5), SubSegment_5); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + if SubSegment_6 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(6), SubSegment_6); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); end; + if SubSegment_7 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(7), SubSegment_7); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + if SubSegment_8 <> '' then begin + DimensionValue.Get(SLHelperFunctions.GetSLSegmentsIdBySegmentNumber(8), SubSegment_8); + // InsertTempDimensionSetEntry(TempDimensionSetEntry, DimensionValue); + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + + NewDimSetID := DimensionManagement.GetDimensionSetID(TempDimensionSetEntry); + TempDimensionSetEntry.DeleteAll(); + exit(NewDimSetID); + end; + + procedure GetSegmentValueFromSubaccount(Sub: Text[24]; SegmentNumber: Integer; NumberOfSegments: Integer): Code[20] + var + SLPopulateAccountHistory: Codeunit "SL Populate Account History"; + SubAcctSegmentText: Text[20]; + begin + SubAcctSegmentText := CopyStr(SLPopulateAccountHistory.GetSubAcctSegmentText(Sub, SegmentNumber, NumberOfSegments), 1, MaxStrLen(SubAcctSegmentText)); + if SubAcctSegmentText.TrimEnd() <> '' then + exit(SubAcctSegmentText) + else + exit(''); + end; + + procedure InsertTempDimensionSetEntry(var TempDimensionSetEntry: Record "Dimension Set Entry" temporary; DimensionValue: Record "Dimension Value") + begin + TempDimensionSetEntry.Init(); + TempDimensionSetEntry.Validate("Dimension Code", DimensionValue."Dimension Code"); + TempDimensionSetEntry.Validate("Dimension Value Code", DimensionValue.Code); + TempDimensionSetEntry.Validate("Dimension Value ID", DimensionValue."Dimension Value ID"); + TempDimensionSetEntry.Insert(true); + end; + + internal procedure AreAllSegmentNumbersEmpty(SubSegment_1: Code[20]; SubSegment_2: Code[20]; SubSegment_3: Code[20]; SubSegment_4: Code[20]; SubSegment_5: Code[20]; SubSegment_6: Code[20]; SubSegment_7: Code[20]; SubSegment_8: Code[20]): Boolean + begin + exit( + CodeIsEmpty(SubSegment_1) and + CodeIsEmpty(SubSegment_2) and + CodeIsEmpty(SubSegment_3) and + CodeIsEmpty(SubSegment_4) and + CodeIsEmpty(SubSegment_5) and + CodeIsEmpty(SubSegment_6) and + CodeIsEmpty(SubSegment_7) and + CodeIsEmpty(SubSegment_8) + ); + end; + + internal procedure CodeIsEmpty(TheCode: Code[20]): Boolean + var + CodeText: Text[20]; + begin + CodeText := TheCode; + CodeText := CopyStr(CodeText.Trim(), 1, MaxStrLen(CodeText)); + exit(CodeText = ''); end; } \ No newline at end of file diff --git a/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccounts.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccounts.Codeunit.al index 7324159627..bcf85176bc 100644 --- a/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccounts.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccounts.Codeunit.al @@ -55,13 +55,13 @@ codeunit 47019 "SL Populate Accounts" begin case (SLAccountType.Trim().Substring(2, 1)) of 'A': - exit(true); + exit(false); 'L': - exit(true); - 'I': exit(false); + 'I': + exit(true); 'E': - exit(false); + exit(true); end; end; } \ No newline at end of file diff --git a/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateFiscalPeriods.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateFiscalPeriods.Codeunit.al index 409d920f99..f2d373f52b 100644 --- a/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateFiscalPeriods.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateFiscalPeriods.Codeunit.al @@ -22,7 +22,6 @@ codeunit 47003 "SL Populate Fiscal Periods" FPDateBeg: Date; FPDateEnd: Date; CurFiscalYear: Integer; - PrevFiscalYear: Integer; FirstFiscalYear: Integer; Index: Integer; IndexYear: Integer; @@ -47,8 +46,6 @@ codeunit 47003 "SL Populate Fiscal Periods" SLGLSetup.Reset(); if SLGLSetup.FindFirst() then begin Evaluate(CurFiscalYear, CopyStr(SLGLSetup.PerNbr, 1, YearLength)); - Evaluate(PrevFiscalYear, CopyStr(SLGLSetup.PerNbr, 1, YearLength)); - PrevFiscalYear := PrevFiscalYear - 1; NumberOfPeriods := SLGLSetup.NbrPer; BeginFiscalYear := SLGLSetup.BegFiscalYr; FiscalPerEnd00 := SLGLSetup.FiscalPerEnd00; diff --git a/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al index 80b3af7a1e..611742dbb9 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/Support/SLHelperFunctions.Codeunit.al @@ -231,9 +231,9 @@ codeunit 47023 "SL Helper Functions" IncomeBalanceType: Option "Income Statement","Balance Sheet"; begin if SLAccountStaging.IncomeBalance then - exit(IncomeBalanceType::"Balance Sheet"); + exit(IncomeBalanceType::"Income Statement"); - exit(IncomeBalanceType::"Income Statement"); + exit(IncomeBalanceType::"Balance Sheet"); end; internal procedure ResetAdjustforPaymentInGLSetup(var Flag: Boolean); @@ -574,7 +574,7 @@ codeunit 47023 "SL Helper Functions" if (GlobalDim1 <> '') or (GlobalDim2 <> '') then GeneralLedgerSetup.Modify(); - SetShorcutDimenions(); + SetShortcutDimenions(); end; internal procedure CheckPluralization(var GlobalDim: Code[20]) @@ -587,21 +587,25 @@ codeunit 47023 "SL Helper Functions" end; end; - internal procedure SetShorcutDimenions() + internal procedure SetShortcutDimenions() var GeneralLedgerSetup: Record "General Ledger Setup"; SLSegments: Record "SL Segments"; + GlobalDimension1Code: Text[20]; + GlobalDimension2Code: Text[20]; Modified: Boolean; i: Integer; begin i := 1; Modified := false; GeneralLedgerSetup.Get(); + GlobalDimension1Code := GeneralLedgerSetup."Global Dimension 1 Code"; + GlobalDimension2Code := GeneralLedgerSetup."Global Dimension 2 Code"; SLSegments.SetCurrentKey(SLSegments.SegmentNumber); SLSegments.Ascending(true); if SLSegments.FindSet() then repeat - if (SLSegments.Id <> GeneralLedgerSetup."Global Dimension 1 Code") and (SLSegments.Id <> GeneralLedgerSetup."Global Dimension 2 Code") then begin + if (SLSegments.Id <> GlobalDimension1Code) and (SLSegments.Id <> GlobalDimension2Code) then begin case i of 1: GeneralLedgerSetup."Shortcut Dimension 3 Code" := SLSegments.Id; @@ -662,6 +666,15 @@ codeunit 47023 "SL Helper Functions" end; end; + internal procedure GetSLSegmentsIdBySegmentNumber(SegmentNumber: Integer): Text[20] + var + SLSegments: Record "SL Segments"; + begin + SLSegments.SetFilter(SLSegments.SegmentNumber, '%1', SegmentNumber); + if SLSegments.FindFirst() then + exit(SLSegments.Id); + end; + internal procedure SetProcessesRunning(IsRunning: Boolean) var SLCmpnyMigratnSettings: Record "SL Company Migration Settings"; @@ -1083,6 +1096,20 @@ codeunit 47023 "SL Helper Functions" SLConfiguration.Modify(); end; + internal procedure RunPreMigrationCleanup() + var + Dimension: Record "Dimension"; + GeneralPostingSetup: Record "General Posting Setup"; + GenProductPostingGroup: Record "Gen. Product Posting Group"; + begin + if not Dimension.IsEmpty() then + Dimension.DeleteAll(true); + if not GeneralPostingSetup.IsEmpty() then + GeneralPostingSetup.DeleteAll(true); + if not GenProductPostingGroup.IsEmpty() then + GenProductPostingGroup.DeleteAll(true); + end; + internal procedure CreatePreMigrationData(): Boolean var SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; diff --git a/Apps/W1/HybridSL/app/src/codeunits/SLCloudMigration.Codeunit.al b/Apps/W1/HybridSL/app/src/codeunits/SLCloudMigration.Codeunit.al index e58b257648..36db9fc1ca 100644 --- a/Apps/W1/HybridSL/app/src/codeunits/SLCloudMigration.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/codeunits/SLCloudMigration.Codeunit.al @@ -122,6 +122,7 @@ codeunit 47001 "SL Cloud Migration" SelectLatestVersion(); SLHelperFunctions.SetProcessesRunning(true); + SLHelperFunctions.RunPreMigrationCleanup(); SLPopulateFiscalPeriods.CreateSLFiscalPeriodsFromGLSetup(); SLFiscalPeriods.MoveStagingData(); diff --git a/Apps/W1/HybridSL/app/src/codeunits/SLDimensions.Codeunit.al b/Apps/W1/HybridSL/app/src/codeunits/SLDimensions.Codeunit.al index 8d14bba17d..a03e6915d5 100644 --- a/Apps/W1/HybridSL/app/src/codeunits/SLDimensions.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/codeunits/SLDimensions.Codeunit.al @@ -74,9 +74,9 @@ codeunit 47020 "SL Dimensions" 0: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr00) then - SLSegments.Id := SLFlexDef.Descr00.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr00.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr00; + SLSegments.Id := CopyStr(SLFlexDef.Descr00.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr00; SLSegments.CodeCaption := SLFlexDef.Descr00.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr00.Trim() + ' Filter'; @@ -87,9 +87,9 @@ codeunit 47020 "SL Dimensions" 1: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr01) then - SLSegments.Id := SLFlexDef.Descr01.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr01.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr01; + SLSegments.Id := CopyStr(SLFlexDef.Descr01.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr01; SLSegments.CodeCaption := SLFlexDef.Descr01.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr01.Trim() + ' Filter'; @@ -100,9 +100,9 @@ codeunit 47020 "SL Dimensions" 2: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr02) then - SLSegments.Id := SLFlexDef.Descr02.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr02.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr02; + SLSegments.Id := CopyStr(SLFlexDef.Descr02.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr02; SLSegments.CodeCaption := SLFlexDef.Descr02.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr02.Trim() + ' Filter'; @@ -113,9 +113,9 @@ codeunit 47020 "SL Dimensions" 3: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr03) then - SLSegments.Id := SLFlexDef.Descr03.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr03.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr03; + SLSegments.Id := CopyStr(SLFlexDef.Descr03.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr03; SLSegments.CodeCaption := SLFlexDef.Descr03.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr03.Trim() + ' Filter'; @@ -126,9 +126,9 @@ codeunit 47020 "SL Dimensions" 4: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr04) then - SLSegments.Id := SLFlexDef.Descr04.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr04.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr04; + SLSegments.Id := CopyStr(SLFlexDef.Descr04.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr04; SLSegments.CodeCaption := SLFlexDef.Descr04.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr04.Trim() + ' Filter'; @@ -139,9 +139,9 @@ codeunit 47020 "SL Dimensions" 5: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr05) then - SLSegments.Id := SLFlexDef.Descr05.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr05.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr05; + SLSegments.Id := CopyStr(SLFlexDef.Descr05.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr05; SLSegments.CodeCaption := SLFlexDef.Descr05.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr05.Trim() + ' Filter'; @@ -152,9 +152,9 @@ codeunit 47020 "SL Dimensions" 6: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr06) then - SLSegments.Id := SLFlexDef.Descr06.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr06.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr06; + SLSegments.Id := CopyStr(SLFlexDef.Descr06.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr06; SLSegments.CodeCaption := SLFlexDef.Descr06.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr06.Trim() + ' Filter'; @@ -165,9 +165,9 @@ codeunit 47020 "SL Dimensions" 7: begin if FlexDefDescInSLSubaccountSegDesc(SLFlexDef.Descr07) then - SLSegments.Id := SLFlexDef.Descr07.Trim() + 's' + SLSegments.Id := SLFlexDef.Descr07.Trim().ToUpper() + 'S' else - SLSegments.Id := SLFlexDef.Descr07; + SLSegments.Id := CopyStr(SLFlexDef.Descr07.Trim().ToUpper(), 1, MaxStrLen(SLSegments.Id)); SLSegments.Name := SLFlexDef.Descr07; SLSegments.CodeCaption := SLFlexDef.Descr07.Trim() + ' Code'; SLSegments.FilterCaption := SLFlexDef.Descr07.Trim() + ' Filter'; From 8be45fb9fa84ade3d03cd5c0b26d1d6178e7be52 Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Mon, 1 Dec 2025 13:59:02 -0500 Subject: [PATCH 6/8] Only migrate open AP and AR balances for released and posted batches. --- .../Customers/SLCustomerMigrator.Codeunit.al | 239 ++++++++++-------- .../Vendors/SLVendorMigrator.Codeunit.al | 188 +++++++------- 2 files changed, 230 insertions(+), 197 deletions(-) diff --git a/Apps/W1/HybridSL/app/src/Migration/Customers/SLCustomerMigrator.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/Customers/SLCustomerMigrator.Codeunit.al index ad4cd4e70e..7228ae0a91 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Customers/SLCustomerMigrator.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/Customers/SLCustomerMigrator.Codeunit.al @@ -19,7 +19,9 @@ codeunit 47018 "SL Customer Migrator" PostingGroupCodeTxt: Label 'SL', Locked = true; SLPrefixTxt: Label 'SL', Locked = true; SourceCodeTxt: Label 'GENJNL', Locked = true; + StatusCompletedTxt: Label 'C', Locked = true; StatusInactiveTxt: Label 'I', Locked = true; + StatusPostedTxt: Label 'P', Locked = true; [EventSubscriber(ObjectType::Codeunit, Codeunit::"Customer Data Migration Facade", OnMigrateCustomer, '', true, true)] local procedure OnMigrateCustomer(var Sender: Codeunit "Customer Data Migration Facade"; RecordIdToMigrate: RecordId) @@ -209,6 +211,7 @@ codeunit 47018 "SL Customer Migrator" GenJournalLine: Record "Gen. Journal Line"; SLARDoc: Record "SL ARDoc Buffer"; SLARSetup: Record "SL ARSetup"; + SLBatch: Record "SL Batch"; SLCustomer: Record "SL Customer"; SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; DataMigrationFacadeHelper: Codeunit "Data Migration Facade Helper"; @@ -251,13 +254,16 @@ codeunit 47018 "SL Customer Migrator" SLARDoc.SetRange(CustId, SLCustomer.CustId); SLARDoc.SetFilter(DocType, '%1|%2|%3|%4|%5', ARDocTypeInvoiceTxt, ARDocTypeCashSaleTxt, ARDocTypeDebitMemoTxt, ARDocTypeSmallCreditTxt, ARDocTypeNSFCheckChargeTxt); //Invoices SLARDoc.SetFilter(DocBal, '<>%1', 0); + SLARDoc.SetFilter(Rlsed, '1'); if SLARDoc.FindSet() then repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); - GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; - BalancingAccount := SLARSetup.ArAcct; + SLBatch.Get(ARSetupIDTxt, SLARDoc.BatNbr); + if (SLBatch.Status = StatusPostedTxt) or (SLBatch.Status = StatusCompletedTxt) then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); + GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; + BalancingAccount := SLARSetup.ArAcct; - Sender.CreateGeneralJournalLine( + Sender.CreateGeneralJournalLine( CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), GLDocNbr, SLARDoc.DocDesc, @@ -267,23 +273,24 @@ codeunit 47018 "SL Customer Migrator" SLARDoc.DocBal, '', BalancingAccount - ); - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Invoice); - DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - if (SLARDoc.SlsperId.TrimEnd() <> '') then begin - Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); - Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); - end; - if SLARDoc.OrdNbr.TrimEnd() <> '' then - Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); - - // Temporary code to set the Due Date on Invoices until the Payment Terms migration is implemented. - GenJournalLine.SetRange("Journal Batch Name", CustomerBatchNameTxt); - GenJournalLine.SetRange("Document No.", GLDocNbr); - if GenJournalLine.FindLast() then begin - GenJournalLine."Due Date" := SLARDoc.DueDate; - GenJournalLine.Modify(); + ); + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Invoice); + DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + if (SLARDoc.SlsperId.TrimEnd() <> '') then begin + Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); + Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); + end; + if SLARDoc.OrdNbr.TrimEnd() <> '' then + Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); + + // Termporary code to set the Due Date on Invoices until the Payment Terms migration is implemented. + GenJournalLine.SetRange("Journal Batch Name", CustomerBatchNameTxt); + GenJournalLine.SetRange("Document No.", GLDocNbr); + if GenJournalLine.FindLast() then begin + GenJournalLine."Due Date" := SLARDoc.DueDate; + GenJournalLine.Modify(); + end; end; until SLARDoc.Next() = 0; @@ -292,31 +299,35 @@ codeunit 47018 "SL Customer Migrator" SLARDoc.SetRange(CustId, SLCustomer.CustId); SLARDoc.SetFilter(DocType, '%1|%2', ARDocTypePaymentTxt, ARDocTypePaymentPrepaymentTxt); //Payments SLARDoc.SetFilter(DocBal, '<>%1', 0); + SLARDoc.SetFilter(Rlsed, '1'); if SLARDoc.FindSet() then repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); - GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; - BalancingAccount := SLARSetup.ArAcct; + SLBatch.Get(ARSetupIDTxt, SLARDoc.BatNbr); + if SLBatch.Status = StatusPostedTxt then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); + GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; + BalancingAccount := SLARSetup.ArAcct; - Sender.CreateGeneralJournalLine( - CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), - GLDocNbr, - SLARDoc.DocDesc, - SLARDoc.DocDate, - SLARDoc.DocDate, - (SLARDoc.DocBal * -1), - (SLARDoc.DocBal * -1), - '', - BalancingAccount - ); - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Payment); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - if (SLARDoc.SlsperId.TrimEnd() <> '') then begin - Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); - Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); + Sender.CreateGeneralJournalLine( + CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), + GLDocNbr, + SLARDoc.DocDesc, + SLARDoc.DocDate, + SLARDoc.DocDate, + (SLARDoc.DocBal * -1), + (SLARDoc.DocBal * -1), + '', + BalancingAccount + ); + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Payment); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + if (SLARDoc.SlsperId.TrimEnd() <> '') then begin + Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); + Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); + end; + if SLARDoc.OrdNbr.TrimEnd() <> '' then + Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); end; - if SLARDoc.OrdNbr.TrimEnd() <> '' then - Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); until SLARDoc.Next() = 0; SLARDoc.Reset(); @@ -324,47 +335,95 @@ codeunit 47018 "SL Customer Migrator" SLARDoc.SetRange(CustId, SLCustomer.CustId); SLARDoc.SetFilter(DocType, '%1|%2|%3', ARDocTypeCreditMemoTxt, ARDocTypeSmallBalanceTxt, ARDocTypeNSFReversalTxt); //Credit Memos SLARDoc.SetFilter(DocBal, '<>%1', 0); + SLARDoc.SetFilter(Rlsed, '1'); if SLARDoc.FindSet() then repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); - GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; - BalancingAccount := SLARSetup.ArAcct; + SLBatch.Get(ARSetupIDTxt, SLARDoc.BatNbr); + if (SLBatch.Status = StatusPostedTxt) or (SLBatch.Status = StatusCompletedTxt) then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); + GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; + BalancingAccount := SLARSetup.ArAcct; + + if SLARDoc.DocType = ARDocTypeCreditMemoTxt then + Sender.CreateGeneralJournalLine( + CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), + GLDocNbr, + SLARDoc.DocDesc, + SLARDoc.DocDate, + SLARDoc.DueDate, + (SLARDoc.DocBal * -1), + (SLARDoc.DocBal * -1), + '', + BalancingAccount + ) + else + Sender.CreateGeneralJournalLine( + CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), + GLDocNbr, + SLARDoc.DocDesc, + SLARDoc.DocDate, + SLARDoc.DocDate, + (SLARDoc.DocBal * -1), + (SLARDoc.DocBal * -1), + '', + BalancingAccount + ); + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::"Credit Memo"); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + if (SLARDoc.SlsperId.TrimEnd() <> '') then begin + Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); + Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); + end; + if SLARDoc.OrdNbr.TrimEnd() <> '' then + Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); + + // Temporary code to set the Due Date on Charge Memos until the Payment Terms migration is implemented. + if SLARDoc.DocType = ARDocTypeCreditMemoTxt then begin + GenJournalLine.SetRange("Journal Batch Name", CustomerBatchNameTxt); + GenJournalLine.SetRange("Document No.", GLDocNbr); + if GenJournalLine.FindLast() then begin + GenJournalLine."Due Date" := SLARDoc.DueDate; + GenJournalLine.Modify(); + end; + end; + end; + until SLARDoc.Next() = 0; + + SLARDoc.Reset(); + SLARDoc.SetRange(CpnyID, CompanyName); + SLARDoc.SetRange(CustId, SLCustomer.CustId); + SLARDoc.SetRange(DocType, ARDocTypeFinanceChargeTxt); // Finance Charge + SLARDoc.SetFilter(DocBal, '<>%1', 0); + SLARDoc.SetFilter(Rlsed, '1'); + if SLARDoc.FindSet() then + repeat + SLBatch.Get(ARSetupIDTxt, SLARDoc.BatNbr); + if SLBatch.Status = StatusPostedTxt then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); + GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; + BalancingAccount := SLARSetup.ArAcct; - if SLARDoc.DocType = ARDocTypeCreditMemoTxt then Sender.CreateGeneralJournalLine( CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), GLDocNbr, SLARDoc.DocDesc, SLARDoc.DocDate, SLARDoc.DueDate, - (SLARDoc.DocBal * -1), - (SLARDoc.DocBal * -1), - '', - BalancingAccount - ) - else - Sender.CreateGeneralJournalLine( - CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), - GLDocNbr, - SLARDoc.DocDesc, - SLARDoc.DocDate, - SLARDoc.DocDate, - (SLARDoc.DocBal * -1), - (SLARDoc.DocBal * -1), + SLARDoc.DocBal, + SLARDoc.DocBal, '', BalancingAccount ); - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::"Credit Memo"); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - if (SLARDoc.SlsperId.TrimEnd() <> '') then begin - Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); - Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); - end; - if SLARDoc.OrdNbr.TrimEnd() <> '' then - Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::"Finance Charge Memo"); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + if (SLARDoc.SlsperId.TrimEnd() <> '') then begin + Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); + Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); + end; + if SLARDoc.OrdNbr.TrimEnd() <> '' then + Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); - // Temporary code to set the Due Date on Credit Memos until the Payment Terms migration is implemented. - if SLARDoc.DocType = ARDocTypeCreditMemoTxt then begin + // Temporary code to set the Due Date on Finance Charge Memos until the Payment Terms migration is implemented. GenJournalLine.SetRange("Journal Batch Name", CustomerBatchNameTxt); GenJournalLine.SetRange("Document No.", GLDocNbr); if GenJournalLine.FindLast() then begin @@ -373,45 +432,5 @@ codeunit 47018 "SL Customer Migrator" end; end; until SLARDoc.Next() = 0; - - SLARDoc.Reset(); - SLARDoc.SetRange(CpnyID, CompanyName); - SLARDoc.SetRange(CustId, SLCustomer.CustId); - SLARDoc.SetRange(DocType, ARDocTypeFinanceChargeTxt); // Finance Charge - SLARDoc.SetFilter(DocBal, '<>%1', 0); - if SLARDoc.FindSet() then - repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLARDoc.RecordId)); - GLDocNbr := SLPrefixTxt + SLARDoc.RefNbr; - BalancingAccount := SLARSetup.ArAcct; - - Sender.CreateGeneralJournalLine( - CopyStr(CustomerBatchNameTxt, 1, MaxStrLen(CustomerBatchNameTxt)), - GLDocNbr, - SLARDoc.DocDesc, - SLARDoc.DocDate, - SLARDoc.DueDate, - SLARDoc.DocBal, - SLARDoc.DocBal, - '', - BalancingAccount - ); - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::"Finance Charge Memo"); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - if (SLARDoc.SlsperId.TrimEnd() <> '') then begin - Sender.CreateSalespersonPurchaserIfNeeded(SLARDoc.SlsperId, '', '', ''); - Sender.SetGeneralJournalLineSalesPersonCode(SLARDoc.SlsperId); - end; - if SLARDoc.OrdNbr.TrimEnd() <> '' then - Sender.SetGeneralJournalLineExternalDocumentNo(SLARDoc.OrdNbr); - - // Temporary code to set the Due Date on Finance Charge Memos until the Payment Terms migration is implemented. - GenJournalLine.SetRange("Journal Batch Name", CustomerBatchNameTxt); - GenJournalLine.SetRange("Document No.", GLDocNbr); - if GenJournalLine.FindLast() then begin - GenJournalLine."Due Date" := SLARDoc.DueDate; - GenJournalLine.Modify(); - end; - until SLARDoc.Next() = 0; end; } \ No newline at end of file diff --git a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendorMigrator.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendorMigrator.Codeunit.al index 42451a1672..cf93bcf83a 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendorMigrator.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/Vendors/SLVendorMigrator.Codeunit.al @@ -21,6 +21,7 @@ codeunit 47021 "SL Vendor Migrator" SLPrefixTxt: Label 'SL', Locked = true; SourceCodeTxt: Label 'GENJNL', Locked = true; StatusInactiveTxt: Label 'I', Locked = true; + StatusPostedTxt: Label 'P', Locked = true; VendorBatchNameTxt: Label 'SLVEND', Locked = true; [EventSubscriber(ObjectType::Codeunit, Codeunit::"Vendor Data Migration Facade", OnMigrateVendor, '', true, true)] @@ -156,6 +157,7 @@ codeunit 47021 "SL Vendor Migrator" var SLAPDoc: Record "SL APDoc Buffer"; SLAPSetup: Record "SL APSetup"; + SLBatch: Record "SL Batch"; SLVendor: Record "SL Vendor"; SLCompanyAdditionalSettings: Record "SL Company Additional Settings"; GenJournalLine: Record "Gen. Journal Line"; @@ -192,32 +194,36 @@ codeunit 47021 "SL Vendor Migrator" SLAPDoc.SetRange(VendId, SLVendor.VendId); SLAPDoc.SetRange(DocType, APDocTypePrePaymentTxt); // Payment SLAPDoc.SetFilter(DocBal, '<>%1', 0); + SLAPDoc.SetFilter(Rlsed, '1'); if SLAPDoc.FindSet() then repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLAPDoc.RecordID)); - GLDocNbr := SLPrefixTxt + SLAPDoc.RefNbr; - BalancingAccount := SLAPSetup.APAcct; - if SLAPDoc.PONbr.TrimEnd() <> '' then - if SLAPDoc.PONbr.TrimEnd() <> '*' then - LineDescription := JournalLinePOPrefixTxt + SLAPDoc.PONbr.TrimEnd() + '-' + SLAPDoc.DocDesc.TrimEnd() - else - LineDescription := CopyStr(SLAPDoc.DocDesc.TrimEnd(), 1, MaxStrLen(SLAPDoc.DocDesc)); - - Sender.CreateGeneralJournalLine( - CopyStr(VendorBatchNameTxt, 1, MaxStrLen(VendorBatchNameTxt)), - GLDocNbr, - LineDescription, - SLAPDoc.DocDate, - SLAPDoc.DocDate, - SLAPDoc.DocBal, - SLAPDoc.DocBal, - '', - BalancingAccount - ); - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Payment); - DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineExternalDocumentNo(SLAPDoc.RefNbr.TrimEnd() + '-' + SLAPDoc.InvcNbr.TrimEnd()); + SLBatch.Get(APSetupIDTxt, SLAPDoc.BatNbr); + if SLBatch.Status = StatusPostedTxt then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLAPDoc.RecordID)); + GLDocNbr := SLPrefixTxt + SLAPDoc.RefNbr; + BalancingAccount := SLAPSetup.APAcct; + if SLAPDoc.PONbr.TrimEnd() <> '' then + if SLAPDoc.PONbr.TrimEnd() <> '*' then + LineDescription := JournalLinePOPrefixTxt + SLAPDoc.PONbr.TrimEnd() + '-' + SLAPDoc.DocDesc.TrimEnd() + else + LineDescription := CopyStr(SLAPDoc.DocDesc.TrimEnd(), 1, MaxStrLen(SLAPDoc.DocDesc)); + + Sender.CreateGeneralJournalLine( + CopyStr(VendorBatchNameTxt, 1, MaxStrLen(VendorBatchNameTxt)), + GLDocNbr, + LineDescription, + SLAPDoc.DocDate, + SLAPDoc.DocDate, + SLAPDoc.DocBal, + SLAPDoc.DocBal, + '', + BalancingAccount + ); + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Payment); + DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineExternalDocumentNo(SLAPDoc.RefNbr.TrimEnd() + '-' + SLAPDoc.InvcNbr.TrimEnd()); + end; until SLAPDoc.Next() = 0; SLAPDoc.Reset(); @@ -225,39 +231,43 @@ codeunit 47021 "SL Vendor Migrator" SLAPDoc.SetRange(VendId, SLVendor.VendId); SLAPDoc.SetFilter(DocType, '%1|%2', APDocTypeVoucherTxt, APDocTypeAdjustmentCreditTxt); // Invoice SLAPDoc.SetFilter(DocBal, '<>%1', 0); + SLAPDoc.SetFilter(Rlsed, '1'); if SLAPDoc.FindSet() then repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLAPDoc.RecordID)); - GLDocNbr := SLPrefixTxt + SLAPDoc.RefNbr; - BalancingAccount := SLAPSetup.APAcct; - if SLAPDoc.PONbr.TrimEnd() <> '' then - if SLAPDoc.PONbr.TrimEnd() <> '*' then - LineDescription := JournalLinePOPrefixTxt + SLAPDoc.PONbr.TrimEnd() + '-' + SLAPDoc.DocDesc.TrimEnd() - else - LineDescription := CopyStr(SLAPDoc.DocDesc.TrimEnd(), 1, MaxStrLen(SLAPDoc.DocDesc)); - - Sender.CreateGeneralJournalLine( - CopyStr(VendorBatchNameTxt, 1, MaxStrLen(VendorBatchNameTxt)), - GLDocNbr, - LineDescription, - SLAPDoc.DocDate, - SLAPDoc.DueDate, - SLAPDoc.DocBal * -1, - SLAPDoc.DocBal * -1, - '', - BalancingAccount - ); - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Invoice); - DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineExternalDocumentNo(SLAPDoc.RefNbr.TrimEnd() + '-' + SLAPDoc.InvcNbr.TrimEnd()); - - // Temporary code to set the Due Date on Invoices until the Payment Terms migration is implemented. - GenJournalLine.SetRange("Journal Batch Name", VendorBatchNameTxt); - GenJournalLine.SetRange("Document No.", GLDocNbr); - if GenJournalLine.FindLast() then begin - GenJournalLine."Due Date" := SLAPDoc.DueDate; - GenJournalLine.Modify(); + SLBatch.Get(APSetupIDTxt, SLAPDoc.BatNbr); + if SLBatch.Status = StatusPostedTxt then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLAPDoc.RecordID)); + GLDocNbr := SLPrefixTxt + SLAPDoc.RefNbr; + BalancingAccount := SLAPSetup.APAcct; + if SLAPDoc.PONbr.TrimEnd() <> '' then + if SLAPDoc.PONbr.TrimEnd() <> '*' then + LineDescription := JournalLinePOPrefixTxt + SLAPDoc.PONbr.TrimEnd() + '-' + SLAPDoc.DocDesc.TrimEnd() + else + LineDescription := CopyStr(SLAPDoc.DocDesc.TrimEnd(), 1, MaxStrLen(SLAPDoc.DocDesc)); + + Sender.CreateGeneralJournalLine( + CopyStr(VendorBatchNameTxt, 1, MaxStrLen(VendorBatchNameTxt)), + GLDocNbr, + LineDescription, + SLAPDoc.DocDate, + SLAPDoc.DueDate, + SLAPDoc.DocBal * -1, + SLAPDoc.DocBal * -1, + '', + BalancingAccount + ); + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::Invoice); + DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineExternalDocumentNo(SLAPDoc.RefNbr.TrimEnd() + '-' + SLAPDoc.InvcNbr.TrimEnd()); + + // Termporary code to set the Due Date on Invoices until the Payment Terms migration is implemented. + GenJournalLine.SetRange("Journal Batch Name", VendorBatchNameTxt); + GenJournalLine.SetRange("Document No.", GLDocNbr); + if GenJournalLine.FindLast() then begin + GenJournalLine."Due Date" := SLAPDoc.DueDate; + GenJournalLine.Modify(); + end; end; until SLAPDoc.Next() = 0; @@ -266,40 +276,44 @@ codeunit 47021 "SL Vendor Migrator" SLAPDoc.SetRange(VendId, SLVendor.VendId); SLAPDoc.SetFilter(DocType, APDocTypeAdjustmentDebitTxt); // Credit Memo SLAPDoc.SetFilter(DocBal, '<>%1', 0); + SLAPDoc.SetFilter(Rlsed, '1'); if SLAPDoc.FindSet() then repeat - DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLAPDoc.RecordID)); - GLDocNbr := SLPrefixTxt + SLAPDoc.RefNbr; - BalancingAccount := SLAPSetup.APAcct; - if SLAPDoc.PONbr.TrimEnd() <> '' then - if SLAPDoc.PONbr.TrimEnd() <> '*' then - LineDescription := JournalLinePOPrefixTxt + SLAPDoc.PONbr.TrimEnd() + '-' + SLAPDoc.DocDesc.TrimEnd() - else - LineDescription := CopyStr(SLAPDoc.DocDesc.TrimEnd(), 1, MaxStrLen(SLAPDoc.DocDesc)); - - Sender.CreateGeneralJournalLine( - CopyStr(VendorBatchNameTxt, 1, MaxStrLen(VendorBatchNameTxt)), - GLDocNbr, - LineDescription, - SLAPDoc.DocDate, - SLAPDoc.DueDate, - SLAPDoc.DocBal, - SLAPDoc.DocBal, - '', - BalancingAccount - ); - - Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::"Credit Memo"); - DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); - Sender.SetGeneralJournalLineExternalDocumentNo(SLAPDoc.RefNbr.TrimEnd() + '-' + SLAPDoc.InvcNbr.TrimEnd()); - - // Temporary code to set the Due Date on Credit Memos until the Payment Terms migration is implemented. - GenJournalLine.SetRange("Journal Batch Name", VendorBatchNameTxt); - GenJournalLine.SetRange("Document No.", GLDocNbr); - if GenJournalLine.FindLast() then begin - GenJournalLine."Due Date" := SLAPDoc.DueDate; - GenJournalLine.Modify(); + SLBatch.Get(APSetupIDTxt, SLAPDoc.BatNbr); + if SLBatch.Status = StatusPostedTxt then begin + DataMigrationErrorLogging.SetLastRecordUnderProcessing(Format(SLAPDoc.RecordID)); + GLDocNbr := SLPrefixTxt + SLAPDoc.RefNbr; + BalancingAccount := SLAPSetup.APAcct; + if SLAPDoc.PONbr.TrimEnd() <> '' then + if SLAPDoc.PONbr.TrimEnd() <> '*' then + LineDescription := JournalLinePOPrefixTxt + SLAPDoc.PONbr.TrimEnd() + '-' + SLAPDoc.DocDesc.TrimEnd() + else + LineDescription := CopyStr(SLAPDoc.DocDesc.TrimEnd(), 1, MaxStrLen(SLAPDoc.DocDesc)); + + Sender.CreateGeneralJournalLine( + CopyStr(VendorBatchNameTxt, 1, MaxStrLen(VendorBatchNameTxt)), + GLDocNbr, + LineDescription, + SLAPDoc.DocDate, + SLAPDoc.DueDate, + SLAPDoc.DocBal, + SLAPDoc.DocBal, + '', + BalancingAccount + ); + + Sender.SetGeneralJournalLineDocumentType(DocTypeToSet::"Credit Memo"); + DataMigrationFacadeHelper.CreateSourceCodeIfNeeded(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineSourceCode(CopyStr(SourceCodeTxt, 1, MaxStrLen(SourceCodeTxt))); + Sender.SetGeneralJournalLineExternalDocumentNo(SLAPDoc.RefNbr.TrimEnd() + '-' + SLAPDoc.InvcNbr.TrimEnd()); + + // Temporary code to set the Due Date on Credit Memos until the Payment Terms migration is implemented. + GenJournalLine.SetRange("Journal Batch Name", VendorBatchNameTxt); + GenJournalLine.SetRange("Document No.", GLDocNbr); + if GenJournalLine.FindLast() then begin + GenJournalLine."Due Date" := SLAPDoc.DueDate; + GenJournalLine.Modify(); + end; end; until SLAPDoc.Next() = 0; end; From 94e45453664f7803eb5824761e7fb5ad65dc184f Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Thu, 11 Dec 2025 11:16:58 -0500 Subject: [PATCH 7/8] Increase CpnyID field length to 30 to support automated testing. Update for assigning dimensions on Beginning Balance journal entries. --- .../src/Migration/Accounts/SLAcctHist.Table.al | 2 +- .../SLPopulateAccountHistory.Codeunit.al | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAcctHist.Table.al b/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAcctHist.Table.al index 675b8ec7be..d8e81b8843 100644 --- a/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAcctHist.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/Accounts/SLAcctHist.Table.al @@ -37,7 +37,7 @@ table 47007 "SL AcctHist" { Caption = 'BegBal'; } - field(7; CpnyID; Text[10]) + field(7; CpnyID; Text[30]) { Caption = 'CpnyID'; } diff --git a/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccountHistory.Codeunit.al b/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccountHistory.Codeunit.al index 86b52e583a..469b774096 100644 --- a/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccountHistory.Codeunit.al +++ b/Apps/W1/HybridSL/app/src/Migration/SLTables/SLPopulateAccountHistory.Codeunit.al @@ -141,7 +141,17 @@ codeunit 47002 "SL Populate Account History" NbrSegments: Integer; begin NbrSegments := 0; - SLFlexDef.SetRange(FieldClassName, 'SUBACCOUNT'); + SLFlexDef.SetRange(FieldClassName, SubaccountTxt); + if SLFlexDef.FindFirst() then + NbrSegments := SLFlexDef.NumberSegments; + exit(NbrSegments); + end; + + internal procedure PopulateSegmentLengths() + var + SLFlexDef: Record "SL FlexDef"; + begin + SLFlexDef.SetRange(FieldClassName, SubaccountTxt); if SLFlexDef.FindFirst() then begin SegLen1 := SLFlexDef.SegLength00; SegLen2 := SLFlexDef.SegLength01; @@ -151,15 +161,14 @@ codeunit 47002 "SL Populate Account History" SegLen6 := SLFlexDef.SegLength05; SegLen7 := SLFlexDef.SegLength06; SegLen8 := SLFlexDef.SegLength07; - NbrSegments := SLFlexDef.NumberSegments; end; - exit(NbrSegments); end; internal procedure GetSubAcctSegmentText(Subaccount: Text[24]; SegmentNo: Integer; NbrOfSegments: Integer): Text[24] var SubaccountSegmentText: Text; begin + PopulateSegmentLengths(); case SegmentNo of 1: begin @@ -227,4 +236,5 @@ codeunit 47002 "SL Populate Account History" SegLen6: Integer; SegLen7: Integer; SegLen8: Integer; + SubaccountTxt: Label 'SUBACCOUNT', Locked = true; } \ No newline at end of file From 5544cf6396fd8a471342fa761ce061415bb47f5a Mon Sep 17 00:00:00 2001 From: Brian Lauer Date: Mon, 5 Jan 2026 15:10:16 -0500 Subject: [PATCH 8/8] Increase CpnyID field length to 30 in SL APDoc Buffer, SL ARDoc Buffer, and SL Batch tables to support tests. --- .../HybridSL/app/src/Migration/History/SLAPDocBuffer.Table.al | 2 +- .../HybridSL/app/src/Migration/History/SLARDocBuffer.Table.al | 2 +- Apps/W1/HybridSL/app/src/Migration/History/SLBatch.Table.al | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Apps/W1/HybridSL/app/src/Migration/History/SLAPDocBuffer.Table.al b/Apps/W1/HybridSL/app/src/Migration/History/SLAPDocBuffer.Table.al index 6fd1a3ae33..01f04ce00b 100644 --- a/Apps/W1/HybridSL/app/src/Migration/History/SLAPDocBuffer.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/History/SLAPDocBuffer.Table.al @@ -65,7 +65,7 @@ table 47073 "SL APDoc Buffer" { Caption = 'CodeType'; } - field(14; CpnyID; Text[10]) + field(14; CpnyID; Text[30]) { Caption = 'CpnyID'; } diff --git a/Apps/W1/HybridSL/app/src/Migration/History/SLARDocBuffer.Table.al b/Apps/W1/HybridSL/app/src/Migration/History/SLARDocBuffer.Table.al index 2a6ec09824..a5fd812873 100644 --- a/Apps/W1/HybridSL/app/src/Migration/History/SLARDocBuffer.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/History/SLARDocBuffer.Table.al @@ -73,7 +73,7 @@ table 47074 "SL ARDoc Buffer" { Caption = 'ContractID'; } - field(16; CpnyID; Text[10]) + field(16; CpnyID; Text[30]) { Caption = 'CpnyID'; } diff --git a/Apps/W1/HybridSL/app/src/Migration/History/SLBatch.Table.al b/Apps/W1/HybridSL/app/src/Migration/History/SLBatch.Table.al index e99460b433..49862ff407 100644 --- a/Apps/W1/HybridSL/app/src/Migration/History/SLBatch.Table.al +++ b/Apps/W1/HybridSL/app/src/Migration/History/SLBatch.Table.al @@ -57,7 +57,7 @@ table 47027 "SL Batch" { Caption = 'Cleared'; } - field(12; CpnyID; Text[10]) + field(12; CpnyID; Text[30]) { Caption = 'CpnyID'; }