dealposbooks 5.49.2 → 5.49.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{chunk-F4WXASVJ.js → chunk-26LXGKDF.js} +1 -1
- package/{chunk-M5M3M3GU.js → chunk-3KEAMVYI.js} +1 -1
- package/{chunk-66YEZ4LP.js → chunk-4G57L7HS.js} +1 -1
- package/{chunk-B4CNCOTT.js → chunk-4OZIHMKI.js} +1 -1
- package/{chunk-3LOZ6OKX.js → chunk-4UVBCZJG.js} +1 -1
- package/chunk-5LGAO5J4.js +1 -0
- package/{chunk-MGGC32PD.js → chunk-A3P24MDP.js} +3 -3
- package/{chunk-TJQSE35W.js → chunk-A7OYELWP.js} +1 -1
- package/{chunk-HA7LLTOG.js → chunk-ATFRJZK3.js} +1 -1
- package/{chunk-P5ICG7YE.js → chunk-BJMEZV24.js} +1 -1
- package/{chunk-MQPKGA4I.js → chunk-C5EDHVD7.js} +1 -1
- package/{chunk-WBGCOYQJ.js → chunk-C7ZPOAWO.js} +1 -1
- package/{chunk-Q52A3GQ5.js → chunk-CTINUVLP.js} +1 -1
- package/{chunk-7P5XATXL.js → chunk-D2CH2T3I.js} +1 -1
- package/{chunk-ULBVUV32.js → chunk-DJTQ4KQ7.js} +1 -1
- package/{chunk-LXHUCAAY.js → chunk-DTAREQVV.js} +1 -1
- package/{chunk-TSPM6IPU.js → chunk-E3SH454T.js} +1 -1
- package/{chunk-F6G7POPA.js → chunk-I2IEFBTX.js} +1 -1
- package/{chunk-33JUCBXH.js → chunk-IHKBTP2Y.js} +1 -1
- package/{chunk-BZUZKZY4.js → chunk-IQ4SHFOC.js} +1 -1
- package/{chunk-C4W7XYJD.js → chunk-KGNH5JRZ.js} +1 -1
- package/{chunk-2RI2WRFG.js → chunk-KJCHFIF4.js} +1 -1
- package/{chunk-JJ2G2ITS.js → chunk-L3CQJPFS.js} +1 -1
- package/{chunk-X57GOVJJ.js → chunk-LG5TMEPP.js} +1 -1
- package/chunk-LNFCBMAA.js +1 -0
- package/{chunk-ADC7G7M6.js → chunk-LOMHQKQX.js} +1 -1
- package/{chunk-BVXHSTT4.js → chunk-LUS3QGR4.js} +1 -1
- package/{chunk-LO2GGXGQ.js → chunk-ME4V3YFW.js} +1 -1
- package/{chunk-7NY7TIU4.js → chunk-N6LQW4C4.js} +1 -1
- package/{chunk-L7WPJUZ6.js → chunk-NXJQMUGV.js} +1 -1
- package/{chunk-OARM3UHP.js → chunk-OBT3IJJQ.js} +1 -1
- package/{chunk-CIPN4BTQ.js → chunk-OFI2JX7N.js} +1 -1
- package/{chunk-YSZN7YTG.js → chunk-OFLGX5N4.js} +2 -2
- package/{chunk-HY3WGTQF.js → chunk-PW4Y2UWU.js} +1 -1
- package/{chunk-ZVEQIMYP.js → chunk-PZZCPZ6Q.js} +1 -1
- package/{chunk-2BTS7BEP.js → chunk-QFFI46W6.js} +1 -1
- package/{chunk-YUS2B7BT.js → chunk-QJ5XIVKM.js} +1 -1
- package/{chunk-RIBVS2ZL.js → chunk-RX37I2ZC.js} +1 -1
- package/{chunk-W6V2QFA7.js → chunk-S6S265JY.js} +2 -2
- package/{chunk-UM2HOJJR.js → chunk-SUWUVFH4.js} +1 -1
- package/{chunk-6KSTIWOD.js → chunk-UD23HDLE.js} +1 -1
- package/{chunk-4YH7A4M6.js → chunk-UK5OOIPU.js} +1 -1
- package/{chunk-GWKQHO7M.js → chunk-V2P3PRZY.js} +1 -1
- package/{chunk-KGZUIHAZ.js → chunk-V65ONV6D.js} +1 -1
- package/{chunk-TG6Y7ANZ.js → chunk-VMI7LQOW.js} +1 -1
- package/{chunk-EEQIJSRK.js → chunk-WRTIQGAC.js} +2 -2
- package/{chunk-JD4TR3G6.js → chunk-XJFNZBHG.js} +1 -1
- package/{chunk-RTMNVCIM.js → chunk-XWXTYJHR.js} +1 -1
- package/{chunk-S72FLLKS.js → chunk-YIEUIWT7.js} +1 -1
- package/chunk-ZZEOPBUT.js +1 -0
- package/index.html +2 -2
- package/{main-OZKRZLSC.js → main-WMHNA6IG.js} +1 -1
- package/package.json +1 -1
- package/chunk-BRKRIPYY.js +0 -1
- package/chunk-EOU5D6FS.js +0 -1
- package/chunk-KDCDSUGW.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as L}from"./chunk-
|
|
1
|
+
import{a as C,b as L}from"./chunk-4UVBCZJG.js";import"./chunk-IHKBTP2Y.js";import{a as E,b as V}from"./chunk-DJXQKSLT.js";import"./chunk-WXIG4CXY.js";import{i as H}from"./chunk-D2CH2T3I.js";import"./chunk-S27Z7D3D.js";import{a as R,b as D}from"./chunk-AD247LWQ.js";import"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{w as j,x as O,y as N,z as G}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import"./chunk-VMI3QWC6.js";import"./chunk-KGNH5JRZ.js";import"./chunk-5DRALZZF.js";import{a as I}from"./chunk-2BI7WNJP.js";import{n as $,s as F}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Dc as w,Eb as A,Ec as _,Mb as p,Oc as c,Pb as x,Pc as l,Sc as T,W as y,Wb as n,Xb as o,Y as M,Yb as m,_ as S,ac as P,fc as h,gc as s,h as v,ia as f,ib as a,qa as g,ra as d,s as u,sa as b,ta as k,yb as B}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let e=P();n(0,"div",3)(1,"p-button",4),h("onClick",function(){g(e);let r=s();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),h("onClick",function(){g(e);let r=s();return d(r.onMigrate())}),o()()}if(i&2){let e=s();a(2),p("disabled",l(3,2,e.countInBooks$)!==0)("pTooltip",l(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),c(4,"async"),b(),n(5,"svg",8),m(6,"path",9),o(),k(),m(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let e=s();x(_(12,q)),a(),x(_(13,q)),a(2),p("migrationCount",l(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",l(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var ue=(()=>{class i{constructor(){this.migrateService=f(C),this.toastr=f(I),this.refresh$=new v(void 0),this.pageTitle="Tax Account"}ngOnInit(){let e=this.refresh$.pipe(M(()=>this.migrateService.getTaxAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(u(t=>Number(t.pos))),this.countInBooks$=e.pipe(u(t=>Number(t.books)))}onMigrate(){this.migrateService.migrateTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=B({type:i,selectors:[["app-tax-account"]],features:[w([C])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(n(0,"app-main-panel",2),A(1,J,5,6,"ng-template",null,0,T)(3,K,9,14,"ng-template",null,1,T),o()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[H,F,$,V,E,D,R,G,N,L,O,j],encapsulation:2})}}return i})();export{ue as TaxAccountComponent};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as pt}from"./chunk-FQRRGJBE.js";import{a as De,b as Re}from"./chunk-UVSR4LPB.js";import{a as Se}from"./chunk-2RI2WRFG.js";import{a as Ht,b as ce}from"./chunk-33JUCBXH.js";import{b as rt}from"./chunk-B4C3ZPN6.js";import{b as Wt,c as at,d as lt}from"./chunk-HCJK6VTO.js";import{a as de,b as ue}from"./chunk-ELMSU4U7.js";import"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import{a as oe}from"./chunk-6WWXJJID.js";import"./chunk-U2VDC52W.js";import{a as Ie,b as we}from"./chunk-3VQUNDVT.js";import{a as it,b as nt,d as me,k as se}from"./chunk-DGACZ747.js";import{a as le,b as pe}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as ot}from"./chunk-CAS5GLLU.js";import{a as Ne}from"./chunk-BT7Y4ADP.js";import{b as Ee}from"./chunk-DJXQKSLT.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as qt,b as Te}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import{d as Ue}from"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import{b as ae}from"./chunk-WXIG4CXY.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{e as et,f as tt,i as re}from"./chunk-7P5XATXL.js";import"./chunk-S27Z7D3D.js";import{a as $e,b as ne}from"./chunk-AD247LWQ.js";import{b as O,c as Ye,d as Xe,e as Je,f as Qe,g as Ze}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as Ot,o as Ke,w as te,x as ie,y as jt,z as zt}from"./chunk-ME4ALIS7.js";import{b as ye}from"./chunk-DTYVTTET.js";import{b as Bt,c as Pt,e as Y,f as X,g as Gt,i as st,k as J,l as Q,o as Z,u as ve,x as ee}from"./chunk-VMI3QWC6.js";import{b as He,e as U,l as $}from"./chunk-F7PVAVLQ.js";import{a as Ce}from"./chunk-C4W7XYJD.js";import{a as At}from"./chunk-5DRALZZF.js";import{a as We}from"./chunk-2BI7WNJP.js";import{A as Nt,h as ze,k as H,p as qe,q as W,s as K,z as kt}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Ac as Lt,Bc as mt,Cc as _e,D as Be,Dc as Oe,Eb as g,Ec as M,Fc as F,Gc as Vt,Ha as E,Hc as je,Mb as s,Oc as S,Pb as Ge,Pc as y,Qc as ke,Rb as V,Sb as Fe,Sc as _,Ub as Me,Vb as Le,W as Dt,Wb as o,X as Rt,Xb as r,Y as be,Yb as T,Zb as z,_ as L,_b as q,ac as D,bd as R,c as xe,ca as Ft,cd as ge,db as j,eb as Pe,fc as w,gc as c,ia as C,ib as l,jc as Mt,qa as h,ra as x,s as Ae,sc as a,tc as b,uc as I,vc as Ve,xc as B,yb as N,yc as A,zc as G}from"./chunk-6QJHEOXN.js";import{a as f,b as v,c as he,e as Tt}from"./chunk-YQFG5XE2.js";var P=(()=>{class t{constructor(){this.httpService=C(At),this.authService=C(Se)}fetchGeneralLedgerLoader(e="single",n={}){return this.httpService.get(void 0,`api/GeneralLedgerLoader/${e==="single"?"GetFilterSingle":"GetFilter"}`,{params:n})}getGLCount(e){return this.httpService.post(void 0,"api/GeneralLedger/GetGeneralLedgerCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetGeneralLedger":"GetMultiLedger"}`,e)}exportGeneralLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}exportMultiLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetMultiLedgerExport",e,i)}getCustomerSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:n})}getSupplierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:n})}getCashierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:n})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,n={}){let i=new Nt({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),p=new kt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),u=f({params:i,headers:p},n);return this.httpService.get(void 0,"/api/BalanceSheet",u)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",f({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Ft({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ri=()=>({width:"30vw"}),ai=()=>({"1199px":"75vw","575px":"90vw"}),li=t=>({"ng-dirty ng-invalid":t}),pi=t=>["/pages/journal/journal-entry/",t],mi=t=>({"text-success":t}),si=t=>({"text-danger":t});function ci(t,m){if(t&1&&(o(0,"div",32)(1,"div",33)(2,"span",34),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",33)(8,"span",35),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function di(t,m){if(t&1&&(o(0,"div",32)(1,"div",33)(2,"span",34),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",33)(8,"span",35),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function ui(t,m){t&1&&(o(0,"div",36),a(1," Account is required. "),r())}function _i(t,m){if(t&1&&(o(0,"div",37)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function gi(t,m){if(t&1&&(o(0,"div",25)(1,"div",26),T(2,"p-radiobutton",38),o(3,"label",39),a(4),r()()()),t&2){let e=m.$implicit;l(2),s("value",e.key)("inputId",e.key),l(),s("for",e.key),l(),b(e.value)}}function fi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Customer"),r(),o(3,"p-autocomplete",40),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.customerSuggestions())}}function hi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Supplier"),r(),o(3,"p-autocomplete",41),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.supplierSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Customer"),r(),o(3,"p-autocomplete",40),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.customerSuggestions())}}function bi(t,m){if(t&1&&(o(0,"form",14)(1,"div",15)(2,"label",16),a(3,"Accounts"),r(),o(4,"p-select",17),g(5,ci,10,2,"ng-template",null,5,_)(7,di,10,2,"ng-template",null,6,_),r(),g(9,ui,2,0,"div",18),r(),o(10,"div",15)(11,"label",16),a(12,"From"),r(),o(13,"div",19),T(14,"p-datepicker",20)(15,"p-datepicker",21),r()(),o(16,"div",15)(17,"label",16),a(18,"Tag"),r(),o(19,"p-multiselect",22),g(20,_i,3,1,"ng-template",null,6,_),r()(),o(22,"div",15)(23,"label",23),a(24,"Contact Type"),r(),o(25,"div",24),Me(26,gi,5,4,"div",25,Fe),r()(),g(28,fi,4,1,"div",15)(29,hi,4,1,"div",15)(30,xi,4,1,"div",15),o(31,"div",15)(32,"label",23),a(33,"Sort order"),r(),o(34,"div",24)(35,"div",25)(36,"div",26),T(37,"p-radiobutton",27),o(38,"label",28),a(39,"Asc"),r()()(),o(40,"div",29)(41,"div",26),T(42,"p-radiobutton",30),o(43,"label",31),a(44,"Desc"),r()()()()()()),t&2){let e,n,i,p=c(2);s("formGroup",p.form),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",p.loaderMetadata().options.accounts)("ngClass",F(14,li,((e=p.form.get("accountID"))==null?null:e.invalid)&&(((e=p.form.get("accountID"))==null?null:e.touched)||((e=p.form.get("accountID"))==null?null:e.dirty)))),l(5),s("ngIf",((n=p.form.get("accountID"))==null?null:n.invalid)&&(((n=p.form.get("accountID"))==null?null:n.touched)||((n=p.form.get("accountID"))==null?null:n.dirty))),l(5),s("showIcon",!0),l(),s("showIcon",!0),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",p.loaderMetadata().options.outlets),l(7),Le(p.loaderMetadata().options.contactTypeOptions),l(2),V((i=p.form.controls.contactType.value)===1?28:i===2?29:30),l(9),s("value",!0),l(5),s("value",!1)}}function Ci(t,m){if(t&1&&g(0,bi,45,16,"form",13),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Si(t,m){if(t&1){let e=D();o(0,"p-button",44),w("onClick",function(){h(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function vi(t,m){if(t&1&&(o(0,"div",32)(1,"a",42),a(2,"Return to Accounts"),r(),g(3,Si,1,0,"p-button",43),r()),t&2){let e=c();l(3),s("ngIf",e.roleService.global().export)}}function yi(t,m){t&1&&(o(0,"tr")(1,"th",51),a(2,"Number"),r(),o(3,"th"),a(4,"Date"),r(),o(5,"th"),a(6,"Contact / Note"),r(),o(7,"th",52),a(8,"Debit"),r(),o(9,"th",52),a(10,"Credit"),r(),o(11,"th",52),a(12,"Balance"),r()())}function Ei(t,m){if(t&1&&(o(0,"div")(1,"span",60),a(2),r()()),t&2){let e=c().$implicit;l(2),I(" ",e.outletName," ")}}function Ii(t,m){if(t&1&&(o(0,"div",15),T(1,"div",61),o(2,"span",62),a(3),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function wi(t,m){if(t&1&&(o(0,"div",15),T(1,"span",61)(2,"div",61),o(3,"span",63),a(4),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.referenceText,j),l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function Ti(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.debitAmount)," ")}}function Di(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.creditAmount)," ")}}function Ri(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.balance)," ")}}function Fi(t,m){if(t&1&&(o(0,"tr")(1,"td",53)(2,"a",54),a(3),r(),g(4,Ei,3,1,"div",55),r(),o(5,"td",53)(6,"span",56),S(7,"date"),a(8),S(9,"date"),r()(),o(10,"td",53)(11,"div",15)(12,"a",57),a(13),r(),g(14,Ii,4,2,"div",15)(15,wi,5,3,"div",15),r()(),o(16,"td",58),g(17,Ti,3,3,"ng-container",55),r(),o(18,"td",58),g(19,Di,3,3,"ng-container",55),r(),o(20,"td",59),g(21,Ri,3,3,"ng-container",55),r()()),t&2){let e=m.$implicit,n=c(3);l(2),s("routerLink",F(19,pi,e.id)),l(),b(e.number),l(),s("ngIf",e.outletName==null?null:e.outletName.trim()),l(2),s("pTooltip",ke(7,13,e.date,"dd MMM y")),l(2),I(" ",ke(9,16,e.date,"dd MMM y")," "),l(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Pe),l(),b(e.contactName),l(),V(n.buildReferenceUrl(e)?14:15),l(2),s("ngClass",F(21,mi,e.debitAmount!==0)),l(),s("ngIf",e.debitAmount!==0),l(),s("ngClass",F(23,si,e.creditAmount!==0)),l(),s("ngIf",e.creditAmount!==0),l(2),s("ngIf",e.balance!==0)}}function Mi(t,m){if(t&1&&(o(0,"tr"),T(1,"td",64),o(2,"td",65),a(3,"Total"),r(),o(4,"td",66),a(5),S(6,"number"),r(),o(7,"td",67),a(8),S(9,"number"),r(),T(10,"td"),r()),t&2){let e=c(3);l(5),I(" ",y(6,2,e.debitSubTotal())," "),l(3),I(" ",y(9,4,e.creditSubTotal())," ")}}function Li(t,m){t&1&&(o(0,"tr")(1,"td",68)(2,"span"),a(3,"No records found."),r()()())}function Vi(t,m){if(t&1){let e=D();o(0,"button",69),w("click",function(){h(e);let i=c(3);return x(i.getGLCount())})("keyup.enter",function(){h(e);let i=c(3);return x(i.getGLCount())}),r()}}function ki(t,m){if(t&1&&a(0),t&2){let e=c(3);I(" ",e.count()," ")}}function Ni(t,m){if(t&1){let e=D();o(0,"p-button",70),w("onClick",function(){h(e);let i=c(3);return x(i.onNextPage())}),r()}}function Ai(t,m){if(t&1&&(o(0,"div",46)(1,"p-table",47),g(2,yi,13,0,"ng-template",null,7,_)(4,Fi,22,25,"ng-template",null,8,_)(6,Mi,11,6,"ng-template",null,4,_)(8,Li,4,0,"ng-template",null,9,_),r(),o(10,"div",48)(11,"div"),a(12),g(13,Vi,1,0,"button",49)(14,ki,1,1),a(15," entries "),r(),o(16,"div",32),g(17,Ni,1,0,"p-button",50),r()()()),t&2){let e=c(2);l(),s("value",e.items().data.data),l(11),Ve(" Showing ",e.pagination().first," to ",e.pagination().end," of "),l(),V(e.totalRecords()===-1?13:14),l(4),V(e.pagination().hasNext?17:-1)}}function Bi(t,m){if(t&1&&g(0,Ai,18,5,"div",45),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Pi(t,m){if(t&1&&(o(0,"div",71)(1,"div",72),T(2,"div",73),r(),o(3,"div",74)(4,"div",26),T(5,"i",75),o(6,"span",76),a(7),S(8,"number"),S(9,"number"),r()()()()),t&2){let e=c();l(),s("formGroup",e.form),l(6),Ve("Exporting data from ",y(8,3,e.filter().exportPageNumber)," - ",y(9,5,e.filter().exportPageSize),"")}}function Gi(t,m){if(t&1){let e=D();o(0,"p-button",77),w("onClick",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Oi(t,m){if(t&1){let e=D();o(0,"p-button",78),w("click",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",79),w("click",function(){h(e);let i=c();return x(i.onExport())}),r()}}var Ut=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=C(P),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.lastGetDataLength=E(0),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=this.items()?.data?.data?.length||0,p=i==n||this.lastGetDataLength()<e.pageSize;return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:!p}}),this.queryFilter=ye(this.route.queryParamMap.pipe(Ae(e=>{let n=e.get("from")?this.dayjsService.format(new Date(e.get("from"))):null,i=e.get("to")?this.dayjsService.format(new Date(e.get("to"))):null,p={},u=e.get("id");return Ce.IsNotEmpty(u)&&(p=v(f({},p),{accountID:u})),Ce.IsNotEmpty(n)&&Ce.IsNotEmpty(i)&&(p=v(f({},p),{from:n,to:i})),p})),{initialValue:null}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("single",this.queryFilter()),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.filter=R(()=>{let e=this.baseFilter(),n=this.localFilter();return e?f(f({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.balanceSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.balance)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),ge(()=>{let e=this.filter();e&&(Ce.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),ge(()=>{let e=this.filter(),n=this.form.value.accountID;!e||Ce.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(p=>e.pageNumber===1?i:v(f({},i),{data:v(f({},i.data),{data:[...p?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return pt(e)}ngOnInit(){this.route.queryParamMap.pipe(Be(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Pt.required]),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let p=this.findNodeByKey(i.children,n);if(p)return p}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,p])=>{switch(i){case"from":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():null;break;case"to":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(p)?n[i]=p.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(p)?p:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=p!=null?Number(p):0;break;case"sortAscending":case"export":n[i]=!!p;break;case"contactType":n[i]=p!=null?Number(p):null;break;default:n[i]=p}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>=1&&this.toastr.warning("Please select at least 1 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e),this.totalRecords()!==-1&&this.getGLCount()}buildFilterBody(){let p=this.form.getRawValue(),{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),p="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(p=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,p,u.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0,credit:this.items().data.data[this.items().data.data.length-1]?.creditAmount??0,debit:this.items().data.data[this.items().data.data.length-1]?.debitAmount??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(p=>v(f({},p),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["header",""],["body",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export General Ledger",3,"visibleChange","modal","visible","breakpoints"],["class","d-flex flex-column gap-3",4,"ngIf"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","accountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"virtualScroll","virtualScrollItemSize","options","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"d-flex","gap-2"],[1,""],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,"d-flex","justify-content-between","align-items-center","my-2"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next"],[2,"width","180px"],[1,"text-end"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],[4,"ngIf"],["tooltipPosition","top",3,"pTooltip"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[1,"text-end","text-break"],[1,"badge","bg-light","text-dark"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],[2,"white-space","normal","word-break","break-word"],["colspan","2"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",10),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.initDialogVisible,d)||(i.initDialogVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,Ci,1,1,"ng-template",null,0,_)(3,vi,4,1,"ng-template",null,1,_)(5,Bi,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",11),G("visibleChange",function(d){return h(p),A(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),x(d)}),g(8,Pi,10,7,"div",12)(9,Gi,1,2,"ng-template",null,3,_)(11,Oi,2,0,"ng-template",null,4,_),r()}n&2&&(s("pageTitle",i.pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),B("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),l(7),Ge(M(11,ri)),s("modal",!0),B("visible",i.isDialogExportVisible),s("breakpoints",M(12,ai)),l(),s("ngIf",i.form&&i.filter()))},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,qt,pe,le,Re,De,ee,J,Y,X,Q,Z,ue,de,Ee,Ue,at,rt,ne,$,U,nt,it,zt,jt,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}[_nghost-%COMP%] th:nth-child(1){width:10%}[_nghost-%COMP%] th:nth-child(2){width:15%}[_nghost-%COMP%] th:nth-child(3){width:40%}[_nghost-%COMP%] th:nth-child(4){width:15%}[_nghost-%COMP%] th:nth-child(5){width:15%}[_nghost-%COMP%] th:nth-child(6){width:15%}"],changeDetection:0})}}return t})();var ji={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},xt=Ye(Ze(ji),Xe(t=>{let m={totalCOGS:R(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalRevenue:R(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalExpense:R(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),grossProfit:R(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?m.totalRevenue()-m.totalCOGS():0),profitOrLoss:R(()=>m.totalRevenue()-m.totalCOGS()-m.totalExpense()),isDataEmpty:R(()=>Object.keys(t.data()?.data??{}).length===0)};return m}),Qe(t=>{let m=C(P),e=C(ce),n={updateFilter(i){O(t,p=>v(f({},p),{filter:f(f({},p.filter),i)}))},getLoader:Ie(xe(be(()=>m.getIncomeStatementLoader().pipe(we({next:i=>{O(t,p=>v(f({},p),{loader:i,filter:v(f({},p.filter),{from:e.from(i.filter.from).format(),to:e.from(i.filter.to).format()})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ie(xe(be(i=>m.getIncomeStatement(i).pipe(Rt(()=>O(t,p=>v(f({},p),{isLoading:!0}))),we({next:p=>{O(t,u=>v(f({},u),{data:p,isLoading:!1}))},error:p=>{console.error(p)}})))))};return n}),Je({onInit:t=>{t.getLoader()}}));var bt=()=>({}),Ct=t=>["/pages/chart-of-account/account/",t],St=()=>["/pages/report/general-ledger"],vt=(t,m,e)=>({id:t,from:m,to:e});function qi(t,m){if(t&1){let e=D();o(0,"p-button",10),w("onClick",function(){h(e);let i=c(2);return x(i.onExport())}),r()}}function Hi(t,m){if(t&1&&(o(0,"div",8),g(1,qi,1,0,"p-button",9),r()),t&2){let e=c();l(),s("ngIf",e.roleService.global().export)}}function Wi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function Ui(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Revenue :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,1,e.store.totalRevenue()))}}function $i(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No revenue records available"),r()()())}function Yi(t,m){if(t&1&&(o(0,"h6",12),a(1,"Revenue"),r(),o(2,"p-table",13),g(3,Wi,7,0,"ng-template",null,3,_)(5,Ki,10,15,"ng-template",null,4,_)(7,Ui,8,3,"ng-template",null,5,_)(9,$i,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",24),a(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total COGS :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Gross Profit :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,2,e.store.totalCOGS())),l(8),b(y(15,4,e.store.grossProfit()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No COGS records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h4",12),a(1,"COGS"),r(),o(2,"p-table",13),g(3,Xi,7,0,"ng-template",null,3,_)(5,Ji,10,15,"ng-template",null,4,_)(7,Qi,16,6,"ng-template",null,5,_)(9,Zi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Expense :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Profit / Loss :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,2,e.store.totalExpense())),l(8),b(y(15,4,e.store.profitOrLoss()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No expense records available"),r()()())}function an(t,m){if(t&1&&(o(0,"h4",12),a(1,"Expense"),r(),o(2,"p-table",13),g(3,tn,7,0,"ng-template",null,3,_)(5,nn,10,15,"ng-template",null,4,_)(7,on,16,6,"ng-template",null,5,_)(9,rn,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function ln(t,m){if(t&1&&(Lt(0)(1),o(2,"p-panel")(3,"div",11),g(4,Yi,11,1)(5,en,11,1)(6,an,11,1),r()()),t&2){let e,n,i,p,u,d=c();mt((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),l(),mt((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),l(3),V(d.Object.keys((i=d.store.data().data)!==null&&i!==void 0?i:M(5,bt)).length>0?4:-1),l(),V(d.Object.keys((p=(p=d.store.data().data)==null?null:p.cogs)!==null&&p!==void 0?p:M(6,bt)).length>0?5:-1),l(),V(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:M(7,bt)).length>0?6:-1)}}function pn(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),a(3,"Tag"),r(),T(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),a(7,"Cashier"),r(),o(8,"p-autocomplete",29),w("completeMethod",function(i){h(e);let p=c();return x(p.onCashierSearch(i))})("onSelect",function(i){h(e);let p=c();return x(p.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),a(11,"From - To"),r(),o(12,"div",31),T(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),l(4),s("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0),l(5),s("iconDisplay","input")("showIcon",!0),l(),s("iconDisplay","input")("showIcon",!0)}}var $t=(()=>{class t{constructor(){this.dayjsService=C(ce),this.store=C(xt),this.fb=C(ve),this.reportService=C(P),this.roleService=C(oe),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,ge(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(v(f({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ne("Cashier Suggestions"),L(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();console.log("initForm",this.cashierHashMap.get(e.CashierID)),this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),n=Object.entries(e).reduce((i,[p,u])=>(p==="from"||p==="to"?u instanceof Date&&(i[p]=this.dayjsService.format(u)):i[p]=u||null,i),{});this.store.updateFilter(f(f({},this.store.filter()),n)),this.dialogFilterVisible.update(i=>!i),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ne("Export Profit & Loss"),L(n=>{let i=n.type,p=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(p,{type:i}));let d=`profit-and-loss.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-income-statement"]],features:[Oe([xt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["formControlName","from","styleClass","w-100 mb-0","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",7),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOK())}),g(1,Hi,2,1,"ng-template",null,0,_)(3,ln,7,8,"ng-template",null,1,_)(5,pn,15,12,"ng-template",null,2,_),r()}n&2&&(s("isFilterable",!0)("pageTitle",i.store.data().pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[re,K,H,W,Te,pe,le,ee,J,Y,X,Q,Z,ue,de,ae,se,me,ne,$e,$,U,Re,De,ie,te],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yt=Tt(Ht());var mn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,yt.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Et=Ye(Ze(mn),Xe(t=>({totalAsset:R(()=>t.data().asset.reduce((m,e)=>m+ +e.amount,0)),totalLiability:R(()=>t.data().liability.reduce((m,e)=>m+ +e.counterAmount,0)),totalEquity:R(()=>t.data().equity.reduce((m,e)=>m+ +e.counterAmount,0))})),Qe(t=>{let m=C(P),e={updateFilter:n=>{O(t,i=>v(f({},i),{filter:n}))},fetchBalanceSheet:Ie(xe(Be(()=>{let n=t.filter();return Object.entries(n).every(([i,p])=>p!=null&&p!=="")}),be(n=>m.getBalanceSheet(n).pipe(we({next:i=>{O(t,p=>v(f({},p),{data:i}))},error:i=>{console.error(i)}}))),Dt(1))),fetchLoader:Ie(xe(be(()=>m.getBalanceSheetLoader().pipe(we({next:n=>{O(t,i=>v(f({},i),{metadata:n,filter:{date:(0,yt.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Je(t=>({onInit:()=>{t.fetchLoader()}})));var Yt=Tt(Ht());var It=t=>["/pages/chart-of-account/account/",t],wt=()=>["/pages/report/general-ledger"],sn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function cn(t,m){if(t&1){let e=D();o(0,"p-button",11),w("onClick",function(){h(e);let i=c(2);return x(i.onExport())}),r()}}function dn(t,m){if(t&1&&(o(0,"div",9),g(1,cn,1,0,"p-button",10),r()),t&2){let e=c();l(),s("ngIf",e.roleService.global().export)}}function un(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Asset"),r(),o(5,"th",17),a(6,"Total"),r()())}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,wt))("queryParams",Vt(11,sn,e.accountID,n.store.filter().date)),l(),b(y(9,6,e.amount))}}function gn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Asset"),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,1,e.store.totalAsset())," ")}}function fn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No asset records found."),r()()())}function hn(t,m){if(t&1&&(o(0,"h4",14),a(1,"Asset"),r(),o(2,"p-table",15),g(3,un,7,0,"ng-template",null,3,_)(5,_n,10,14,"ng-template",null,4,_)(7,gn,6,3,"ng-template",null,5,_)(9,fn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().asset)}}function xn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Liability"),r(),o(5,"th",17),a(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",25),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,wt))("queryParams",F(11,Xt,e.accountID)),l(),b(y(9,6,e.counterAmount))}}function Cn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2," Total Liability "),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,1,e.store.totalLiability())," ")}}function Sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No liability records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Liability"),r(),o(2,"p-table",15),g(3,xn,7,0,"ng-template",null,3,_)(5,bn,10,13,"ng-template",null,4,_)(7,Cn,6,3,"ng-template",null,5,_)(9,Sn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().liability)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Equity"),r(),o(5,"th",17),a(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,wt))("queryParams",F(11,Xt,e.accountID)),l(),b(y(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Equity"),r(),o(3,"td",22),a(4),S(5,"number"),r()(),o(6,"tr")(7,"td",21),a(8," Total Liability + Equity "),r(),o(9,"td",22),a(10),S(11,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,2,e.store.totalEquity())," "),l(6),I(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function wn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No equity records found."),r()()())}function Tn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Equity"),r(),o(2,"p-table",15),g(3,yn,7,0,"ng-template",null,3,_)(5,En,10,13,"ng-template",null,4,_),a(7," <"),g(8,In,12,6,"ng-template",null,5,_)(10,wn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().equity)}}function Dn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),g(2,hn,11,1)(3,vn,11,1)(4,Tn,12,1),r()()),t&2){let e=c();s("showHeader",!1),l(2),V(e.Object.keys(e.store.data().asset).length>0?2:-1),l(),V(e.Object.keys(e.store.data().liability).length>0?3:-1),l(),V(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Rn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function Fn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),a(3,"Tag"),r(),o(4,"p-multiselect",29),g(5,Rn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),a(9,"From"),r(),T(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),l(6),s("iconDisplay","input")("showIcon",!0)}}var Jt=(()=>{class t{constructor(){this.store=C(Et),this.ReportServiceStore=C(P),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=C(oe),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Gt({date:new st(new Date),outletID:new st([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,Yt.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ne("Export Balance Sheet"),L(n=>{let i=n.type,p=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(p,{type:i}));let d=`balance-sheet.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-balance-sheet"]],features:[Oe([Et])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","12rem"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"fw-semibold","text-end"],[1,"text-end","fw-semibold"],["colspan","3",1,""],[1,"fs-5","fw-semibold"],["target","_blank",1,"link","link-primary","d-flex","align-items-center",3,"routerLink"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","outletID","display","chip","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",8),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,dn,2,1,"ng-template",null,0,_)(3,Dn,5,4,"ng-template",null,1,_)(5,Fn,11,7,"ng-template",null,2,_),r()}n&2&&(s("pageTitle",i.store.data().pageTitle)("isFilterable",!0),B("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[re,K,H,W,se,me,ae,ie,te,ee,J,Y,X,Q,Z,ue,de,pe,le,Ee,ne,$e,$,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-comparative-balance works!"),r(),a(2,`
|
|
1
|
+
import{a as pt}from"./chunk-FQRRGJBE.js";import{a as De,b as Re}from"./chunk-UVSR4LPB.js";import{a as Se}from"./chunk-KJCHFIF4.js";import{a as Ht,b as ce}from"./chunk-IHKBTP2Y.js";import{b as rt}from"./chunk-B4C3ZPN6.js";import{b as Wt,c as at,d as lt}from"./chunk-HCJK6VTO.js";import{a as de,b as ue}from"./chunk-ELMSU4U7.js";import"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import{a as oe}from"./chunk-6WWXJJID.js";import"./chunk-U2VDC52W.js";import{a as Ie,b as we}from"./chunk-3VQUNDVT.js";import{a as it,b as nt,d as me,k as se}from"./chunk-DGACZ747.js";import{a as le,b as pe}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as ot}from"./chunk-CAS5GLLU.js";import{a as Ne}from"./chunk-BT7Y4ADP.js";import{b as Ee}from"./chunk-DJXQKSLT.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as qt,b as Te}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import{d as Ue}from"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import{b as ae}from"./chunk-WXIG4CXY.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{e as et,f as tt,i as re}from"./chunk-D2CH2T3I.js";import"./chunk-S27Z7D3D.js";import{a as $e,b as ne}from"./chunk-AD247LWQ.js";import{b as O,c as Ye,d as Xe,e as Je,f as Qe,g as Ze}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as Ot,o as Ke,w as te,x as ie,y as jt,z as zt}from"./chunk-ME4ALIS7.js";import{b as ye}from"./chunk-DTYVTTET.js";import{b as Bt,c as Pt,e as Y,f as X,g as Gt,i as st,k as J,l as Q,o as Z,u as ve,x as ee}from"./chunk-VMI3QWC6.js";import{b as He,e as U,l as $}from"./chunk-F7PVAVLQ.js";import{a as Ce}from"./chunk-KGNH5JRZ.js";import{a as At}from"./chunk-5DRALZZF.js";import{a as We}from"./chunk-2BI7WNJP.js";import{A as Nt,h as ze,k as H,p as qe,q as W,s as K,z as kt}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Ac as Mt,Bc as mt,Cc as _e,D as Be,Dc as Oe,Eb as g,Ec as L,Fc as F,Gc as Vt,Ha as E,Hc as je,Mb as s,Oc as S,Pb as Ge,Pc as y,Qc as ke,Rb as V,Sb as Fe,Sc as _,Ub as Le,Vb as Me,W as Dt,Wb as o,X as Rt,Xb as r,Y as be,Yb as T,Zb as z,_ as M,_b as q,ac as D,bd as R,c as xe,ca as Ft,cd as ge,db as j,eb as Pe,fc as w,gc as c,ia as C,ib as l,jc as Lt,qa as h,ra as x,s as Ae,sc as a,tc as b,uc as I,vc as Ve,xc as B,yb as N,yc as A,zc as G}from"./chunk-6QJHEOXN.js";import{a as f,b as v,c as he,e as Tt}from"./chunk-YQFG5XE2.js";var P=(()=>{class t{constructor(){this.httpService=C(At),this.authService=C(Se)}fetchGeneralLedgerLoader(e="single",n={}){return this.httpService.get(void 0,`api/GeneralLedgerLoader/${e==="single"?"GetFilterSingle":"GetFilter"}`,{params:n})}getGLCount(e){return this.httpService.post(void 0,"api/GeneralLedger/GetGeneralLedgerCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetGeneralLedger":"GetMultiLedger"}`,e)}exportGeneralLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}exportMultiLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetMultiLedgerExport",e,i)}getCustomerSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:n})}getSupplierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:n})}getCashierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:n})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,n={}){let i=new Nt({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),p=new kt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),u=f({params:i,headers:p},n);return this.httpService.get(void 0,"/api/BalanceSheet",u)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",f({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Ft({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ri=()=>({width:"30vw"}),ai=()=>({"1199px":"75vw","575px":"90vw"}),li=t=>({"ng-dirty ng-invalid":t}),pi=t=>["/pages/journal/journal-entry/",t],mi=t=>({"text-success":t}),si=t=>({"text-danger":t});function ci(t,m){if(t&1&&(o(0,"div",32)(1,"div",33)(2,"span",34),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",33)(8,"span",35),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function di(t,m){if(t&1&&(o(0,"div",32)(1,"div",33)(2,"span",34),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",33)(8,"span",35),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function ui(t,m){t&1&&(o(0,"div",36),a(1," Account is required. "),r())}function _i(t,m){if(t&1&&(o(0,"div",37)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function gi(t,m){if(t&1&&(o(0,"div",25)(1,"div",26),T(2,"p-radiobutton",38),o(3,"label",39),a(4),r()()()),t&2){let e=m.$implicit;l(2),s("value",e.key)("inputId",e.key),l(),s("for",e.key),l(),b(e.value)}}function fi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Customer"),r(),o(3,"p-autocomplete",40),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.customerSuggestions())}}function hi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Supplier"),r(),o(3,"p-autocomplete",41),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.supplierSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Customer"),r(),o(3,"p-autocomplete",40),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.customerSuggestions())}}function bi(t,m){if(t&1&&(o(0,"form",14)(1,"div",15)(2,"label",16),a(3,"Accounts"),r(),o(4,"p-select",17),g(5,ci,10,2,"ng-template",null,5,_)(7,di,10,2,"ng-template",null,6,_),r(),g(9,ui,2,0,"div",18),r(),o(10,"div",15)(11,"label",16),a(12,"From"),r(),o(13,"div",19),T(14,"p-datepicker",20)(15,"p-datepicker",21),r()(),o(16,"div",15)(17,"label",16),a(18,"Tag"),r(),o(19,"p-multiselect",22),g(20,_i,3,1,"ng-template",null,6,_),r()(),o(22,"div",15)(23,"label",23),a(24,"Contact Type"),r(),o(25,"div",24),Le(26,gi,5,4,"div",25,Fe),r()(),g(28,fi,4,1,"div",15)(29,hi,4,1,"div",15)(30,xi,4,1,"div",15),o(31,"div",15)(32,"label",23),a(33,"Sort order"),r(),o(34,"div",24)(35,"div",25)(36,"div",26),T(37,"p-radiobutton",27),o(38,"label",28),a(39,"Asc"),r()()(),o(40,"div",29)(41,"div",26),T(42,"p-radiobutton",30),o(43,"label",31),a(44,"Desc"),r()()()()()()),t&2){let e,n,i,p=c(2);s("formGroup",p.form),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",p.loaderMetadata().options.accounts)("ngClass",F(14,li,((e=p.form.get("accountID"))==null?null:e.invalid)&&(((e=p.form.get("accountID"))==null?null:e.touched)||((e=p.form.get("accountID"))==null?null:e.dirty)))),l(5),s("ngIf",((n=p.form.get("accountID"))==null?null:n.invalid)&&(((n=p.form.get("accountID"))==null?null:n.touched)||((n=p.form.get("accountID"))==null?null:n.dirty))),l(5),s("showIcon",!0),l(),s("showIcon",!0),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",p.loaderMetadata().options.outlets),l(7),Me(p.loaderMetadata().options.contactTypeOptions),l(2),V((i=p.form.controls.contactType.value)===1?28:i===2?29:30),l(9),s("value",!0),l(5),s("value",!1)}}function Ci(t,m){if(t&1&&g(0,bi,45,16,"form",13),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Si(t,m){if(t&1){let e=D();o(0,"p-button",44),w("onClick",function(){h(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function vi(t,m){if(t&1&&(o(0,"div",32)(1,"a",42),a(2,"Return to Accounts"),r(),g(3,Si,1,0,"p-button",43),r()),t&2){let e=c();l(3),s("ngIf",e.roleService.global().export)}}function yi(t,m){t&1&&(o(0,"tr")(1,"th",51),a(2,"Number"),r(),o(3,"th"),a(4,"Date"),r(),o(5,"th"),a(6,"Contact / Note"),r(),o(7,"th",52),a(8,"Debit"),r(),o(9,"th",52),a(10,"Credit"),r(),o(11,"th",52),a(12,"Balance"),r()())}function Ei(t,m){if(t&1&&(o(0,"div")(1,"span",60),a(2),r()()),t&2){let e=c().$implicit;l(2),I(" ",e.outletName," ")}}function Ii(t,m){if(t&1&&(o(0,"div",15),T(1,"div",61),o(2,"span",62),a(3),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function wi(t,m){if(t&1&&(o(0,"div",15),T(1,"span",61)(2,"div",61),o(3,"span",63),a(4),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.referenceText,j),l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function Ti(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.debitAmount)," ")}}function Di(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.creditAmount)," ")}}function Ri(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.balance)," ")}}function Fi(t,m){if(t&1&&(o(0,"tr")(1,"td",53)(2,"a",54),a(3),r(),g(4,Ei,3,1,"div",55),r(),o(5,"td",53)(6,"span",56),S(7,"date"),a(8),S(9,"date"),r()(),o(10,"td",53)(11,"div",15)(12,"a",57),a(13),r(),g(14,Ii,4,2,"div",15)(15,wi,5,3,"div",15),r()(),o(16,"td",58),g(17,Ti,3,3,"ng-container",55),r(),o(18,"td",58),g(19,Di,3,3,"ng-container",55),r(),o(20,"td",59),g(21,Ri,3,3,"ng-container",55),r()()),t&2){let e=m.$implicit,n=c(3);l(2),s("routerLink",F(19,pi,e.id)),l(),b(e.number),l(),s("ngIf",e.outletName==null?null:e.outletName.trim()),l(2),s("pTooltip",ke(7,13,e.date,"dd MMM y")),l(2),I(" ",ke(9,16,e.date,"dd MMM y")," "),l(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Pe),l(),b(e.contactName),l(),V(n.buildReferenceUrl(e)?14:15),l(2),s("ngClass",F(21,mi,e.debitAmount!==0)),l(),s("ngIf",e.debitAmount!==0),l(),s("ngClass",F(23,si,e.creditAmount!==0)),l(),s("ngIf",e.creditAmount!==0),l(2),s("ngIf",e.balance!==0)}}function Li(t,m){if(t&1&&(o(0,"tr"),T(1,"td",64),o(2,"td",65),a(3,"Total"),r(),o(4,"td",66),a(5),S(6,"number"),r(),o(7,"td",67),a(8),S(9,"number"),r(),T(10,"td"),r()),t&2){let e=c(3);l(5),I(" ",y(6,2,e.debitSubTotal())," "),l(3),I(" ",y(9,4,e.creditSubTotal())," ")}}function Mi(t,m){t&1&&(o(0,"tr")(1,"td",68)(2,"span"),a(3,"No records found."),r()()())}function Vi(t,m){if(t&1){let e=D();o(0,"button",69),w("click",function(){h(e);let i=c(3);return x(i.getGLCount())})("keyup.enter",function(){h(e);let i=c(3);return x(i.getGLCount())}),r()}}function ki(t,m){if(t&1&&a(0),t&2){let e=c(3);I(" ",e.count()," ")}}function Ni(t,m){if(t&1){let e=D();o(0,"p-button",70),w("onClick",function(){h(e);let i=c(3);return x(i.onNextPage())}),r()}}function Ai(t,m){if(t&1&&(o(0,"div",46)(1,"p-table",47),g(2,yi,13,0,"ng-template",null,7,_)(4,Fi,22,25,"ng-template",null,8,_)(6,Li,11,6,"ng-template",null,4,_)(8,Mi,4,0,"ng-template",null,9,_),r(),o(10,"div",48)(11,"div"),a(12),g(13,Vi,1,0,"button",49)(14,ki,1,1),a(15," entries "),r(),o(16,"div",32),g(17,Ni,1,0,"p-button",50),r()()()),t&2){let e=c(2);l(),s("value",e.items().data.data),l(11),Ve(" Showing ",e.pagination().first," to ",e.pagination().end," of "),l(),V(e.totalRecords()===-1?13:14),l(4),V(e.pagination().hasNext?17:-1)}}function Bi(t,m){if(t&1&&g(0,Ai,18,5,"div",45),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Pi(t,m){if(t&1&&(o(0,"div",71)(1,"div",72),T(2,"div",73),r(),o(3,"div",74)(4,"div",26),T(5,"i",75),o(6,"span",76),a(7),S(8,"number"),S(9,"number"),r()()()()),t&2){let e=c();l(),s("formGroup",e.form),l(6),Ve("Exporting data from ",y(8,3,e.filter().exportPageNumber)," - ",y(9,5,e.filter().exportPageSize),"")}}function Gi(t,m){if(t&1){let e=D();o(0,"p-button",77),w("onClick",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Oi(t,m){if(t&1){let e=D();o(0,"p-button",78),w("click",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",79),w("click",function(){h(e);let i=c();return x(i.onExport())}),r()}}var Ut=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(M(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=C(P),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.lastGetDataLength=E(0),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=this.items()?.data?.data?.length||0,p=i==n||this.lastGetDataLength()<e.pageSize;return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:!p}}),this.queryFilter=ye(this.route.queryParamMap.pipe(Ae(e=>{let n=e.get("from")?this.dayjsService.format(new Date(e.get("from"))):null,i=e.get("to")?this.dayjsService.format(new Date(e.get("to"))):null,p={},u=e.get("id");return Ce.IsNotEmpty(u)&&(p=v(f({},p),{accountID:u})),Ce.IsNotEmpty(n)&&Ce.IsNotEmpty(i)&&(p=v(f({},p),{from:n,to:i})),p})),{initialValue:null}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("single",this.queryFilter()),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.filter=R(()=>{let e=this.baseFilter(),n=this.localFilter();return e?f(f({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.balanceSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.balance)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),ge(()=>{let e=this.filter();e&&(Ce.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),ge(()=>{let e=this.filter(),n=this.form.value.accountID;!e||Ce.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(p=>e.pageNumber===1?i:v(f({},i),{data:v(f({},i.data),{data:[...p?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return pt(e)}ngOnInit(){this.route.queryParamMap.pipe(Be(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Pt.required]),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let p=this.findNodeByKey(i.children,n);if(p)return p}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,p])=>{switch(i){case"from":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():null;break;case"to":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(p)?n[i]=p.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(p)?p:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=p!=null?Number(p):0;break;case"sortAscending":case"export":n[i]=!!p;break;case"contactType":n[i]=p!=null?Number(p):null;break;default:n[i]=p}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(M(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(M(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(M(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>=1&&this.toastr.warning("Please select at least 1 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e),this.totalRecords()!==-1&&this.getGLCount()}buildFilterBody(){let p=this.form.getRawValue(),{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(M(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),p="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(p=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,p,u.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0,credit:this.items().data.data[this.items().data.data.length-1]?.creditAmount??0,debit:this.items().data.data[this.items().data.data.length-1]?.debitAmount??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(p=>v(f({},p),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["header",""],["body",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export General Ledger",3,"visibleChange","modal","visible","breakpoints"],["class","d-flex flex-column gap-3",4,"ngIf"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","accountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"virtualScroll","virtualScrollItemSize","options","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"d-flex","gap-2"],[1,""],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,"d-flex","justify-content-between","align-items-center","my-2"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next"],[2,"width","180px"],[1,"text-end"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],[4,"ngIf"],["tooltipPosition","top",3,"pTooltip"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[1,"text-end","text-break"],[1,"badge","bg-light","text-dark"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],[2,"white-space","normal","word-break","break-word"],["colspan","2"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",10),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.initDialogVisible,d)||(i.initDialogVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,Ci,1,1,"ng-template",null,0,_)(3,vi,4,1,"ng-template",null,1,_)(5,Bi,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",11),G("visibleChange",function(d){return h(p),A(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),x(d)}),g(8,Pi,10,7,"div",12)(9,Gi,1,2,"ng-template",null,3,_)(11,Oi,2,0,"ng-template",null,4,_),r()}n&2&&(s("pageTitle",i.pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),B("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),l(7),Ge(L(11,ri)),s("modal",!0),B("visible",i.isDialogExportVisible),s("breakpoints",L(12,ai)),l(),s("ngIf",i.form&&i.filter()))},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,qt,pe,le,Re,De,ee,J,Y,X,Q,Z,ue,de,Ee,Ue,at,rt,ne,$,U,nt,it,zt,jt,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}[_nghost-%COMP%] th:nth-child(1){width:10%}[_nghost-%COMP%] th:nth-child(2){width:15%}[_nghost-%COMP%] th:nth-child(3){width:40%}[_nghost-%COMP%] th:nth-child(4){width:15%}[_nghost-%COMP%] th:nth-child(5){width:15%}[_nghost-%COMP%] th:nth-child(6){width:15%}"],changeDetection:0})}}return t})();var ji={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},xt=Ye(Ze(ji),Xe(t=>{let m={totalCOGS:R(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalRevenue:R(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalExpense:R(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),grossProfit:R(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?m.totalRevenue()-m.totalCOGS():0),profitOrLoss:R(()=>m.totalRevenue()-m.totalCOGS()-m.totalExpense()),isDataEmpty:R(()=>Object.keys(t.data()?.data??{}).length===0)};return m}),Qe(t=>{let m=C(P),e=C(ce),n={updateFilter(i){O(t,p=>v(f({},p),{filter:f(f({},p.filter),i)}))},getLoader:Ie(xe(be(()=>m.getIncomeStatementLoader().pipe(we({next:i=>{O(t,p=>v(f({},p),{loader:i,filter:v(f({},p.filter),{from:e.format(i.filter.from),to:e.format(i.filter.to)})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ie(xe(be(i=>m.getIncomeStatement(i).pipe(Rt(()=>O(t,p=>v(f({},p),{isLoading:!0}))),we({next:p=>{O(t,u=>v(f({},u),{data:p,isLoading:!1}))},error:p=>{console.error(p)}})))))};return n}),Je({onInit:t=>{t.getLoader()}}));var bt=()=>({}),Ct=t=>["/pages/chart-of-account/account/",t],St=()=>["/pages/report/general-ledger"],vt=(t,m,e)=>({id:t,from:m,to:e});function qi(t,m){if(t&1){let e=D();o(0,"p-button",10),w("onClick",function(){h(e);let i=c(2);return x(i.onExport())}),r()}}function Hi(t,m){if(t&1&&(o(0,"div",8),g(1,qi,1,0,"p-button",9),r()),t&2){let e=c();l(),s("ngIf",e.roleService.global().export)}}function Wi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",L(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function Ui(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Revenue :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,1,e.store.totalRevenue()))}}function $i(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No revenue records available"),r()()())}function Yi(t,m){if(t&1&&(o(0,"h6",12),a(1,"Revenue"),r(),o(2,"p-table",13),g(3,Wi,7,0,"ng-template",null,3,_)(5,Ki,10,15,"ng-template",null,4,_)(7,Ui,8,3,"ng-template",null,5,_)(9,$i,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",24),a(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",L(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total COGS :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Gross Profit :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,2,e.store.totalCOGS())),l(8),b(y(15,4,e.store.grossProfit()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No COGS records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h4",12),a(1,"COGS"),r(),o(2,"p-table",13),g(3,Xi,7,0,"ng-template",null,3,_)(5,Ji,10,15,"ng-template",null,4,_)(7,Qi,16,6,"ng-template",null,5,_)(9,Zi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",L(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Expense :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Profit / Loss :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,2,e.store.totalExpense())),l(8),b(y(15,4,e.store.profitOrLoss()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No expense records available"),r()()())}function an(t,m){if(t&1&&(o(0,"h4",12),a(1,"Expense"),r(),o(2,"p-table",13),g(3,tn,7,0,"ng-template",null,3,_)(5,nn,10,15,"ng-template",null,4,_)(7,on,16,6,"ng-template",null,5,_)(9,rn,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function ln(t,m){if(t&1&&(Mt(0)(1),o(2,"p-panel")(3,"div",11),g(4,Yi,11,1)(5,en,11,1)(6,an,11,1),r()()),t&2){let e,n,i,p,u,d=c();mt((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),l(),mt((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),l(3),V(d.Object.keys((i=d.store.data().data)!==null&&i!==void 0?i:L(5,bt)).length>0?4:-1),l(),V(d.Object.keys((p=(p=d.store.data().data)==null?null:p.cogs)!==null&&p!==void 0?p:L(6,bt)).length>0?5:-1),l(),V(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:L(7,bt)).length>0?6:-1)}}function pn(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),a(3,"Tag"),r(),T(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),a(7,"Cashier"),r(),o(8,"p-autocomplete",29),w("completeMethod",function(i){h(e);let p=c();return x(p.onCashierSearch(i))})("onSelect",function(i){h(e);let p=c();return x(p.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),a(11,"From - To"),r(),o(12,"div",31),T(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),l(4),s("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0),l(5),s("iconDisplay","input")("showIcon",!0),l(),s("iconDisplay","input")("showIcon",!0)}}var $t=(()=>{class t{constructor(){this.dayjsService=C(ce),this.store=C(xt),this.fb=C(ve),this.reportService=C(P),this.roleService=C(oe),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,ge(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm()}onSearch(e){this.store.updateFilter(v(f({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ne("Cashier Suggestions"),M(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),n=Object.entries(e).reduce((i,[p,u])=>(p==="from"||p==="to"?u instanceof Date&&(i[p]=this.dayjsService.format(u)):i[p]=u||null,i),{});this.store.updateFilter(f(f({},this.store.filter()),n)),this.dialogFilterVisible.update(i=>!i),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ne("Export Profit & Loss"),M(n=>{let i=n.type,p=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(p,{type:i}));let d=`profit-and-loss.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-income-statement"]],features:[Oe([xt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["formControlName","from","styleClass","w-100 mb-0","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",7),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOK())}),g(1,Hi,2,1,"ng-template",null,0,_)(3,ln,7,8,"ng-template",null,1,_)(5,pn,15,12,"ng-template",null,2,_),r()}n&2&&(s("isFilterable",!0)("pageTitle",i.store.data().pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[re,K,H,W,Te,pe,le,ee,J,Y,X,Q,Z,ue,de,ae,se,me,ne,$e,$,U,Re,De,ie,te],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yt=Tt(Ht());var mn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,yt.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Et=Ye(Ze(mn),Xe(t=>({totalAsset:R(()=>t.data().asset.reduce((m,e)=>m+ +e.amount,0)),totalLiability:R(()=>t.data().liability.reduce((m,e)=>m+ +e.counterAmount,0)),totalEquity:R(()=>t.data().equity.reduce((m,e)=>m+ +e.counterAmount,0))})),Qe(t=>{let m=C(P),e={updateFilter:n=>{O(t,i=>v(f({},i),{filter:n}))},fetchBalanceSheet:Ie(xe(Be(()=>{let n=t.filter();return Object.entries(n).every(([i,p])=>p!=null&&p!=="")}),be(n=>m.getBalanceSheet(n).pipe(we({next:i=>{O(t,p=>v(f({},p),{data:i}))},error:i=>{console.error(i)}}))),Dt(1))),fetchLoader:Ie(xe(be(()=>m.getBalanceSheetLoader().pipe(we({next:n=>{O(t,i=>v(f({},i),{metadata:n,filter:{date:(0,yt.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Je(t=>({onInit:()=>{t.fetchLoader()}})));var Yt=Tt(Ht());var It=t=>["/pages/chart-of-account/account/",t],wt=()=>["/pages/report/general-ledger"],sn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function cn(t,m){if(t&1){let e=D();o(0,"p-button",11),w("onClick",function(){h(e);let i=c(2);return x(i.onExport())}),r()}}function dn(t,m){if(t&1&&(o(0,"div",9),g(1,cn,1,0,"p-button",10),r()),t&2){let e=c();l(),s("ngIf",e.roleService.global().export)}}function un(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Asset"),r(),o(5,"th",17),a(6,"Total"),r()())}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",L(10,wt))("queryParams",Vt(11,sn,e.accountID,n.store.filter().date)),l(),b(y(9,6,e.amount))}}function gn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Asset"),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,1,e.store.totalAsset())," ")}}function fn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No asset records found."),r()()())}function hn(t,m){if(t&1&&(o(0,"h4",14),a(1,"Asset"),r(),o(2,"p-table",15),g(3,un,7,0,"ng-template",null,3,_)(5,_n,10,14,"ng-template",null,4,_)(7,gn,6,3,"ng-template",null,5,_)(9,fn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().asset)}}function xn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Liability"),r(),o(5,"th",17),a(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",25),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",L(10,wt))("queryParams",F(11,Xt,e.accountID)),l(),b(y(9,6,e.counterAmount))}}function Cn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2," Total Liability "),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,1,e.store.totalLiability())," ")}}function Sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No liability records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Liability"),r(),o(2,"p-table",15),g(3,xn,7,0,"ng-template",null,3,_)(5,bn,10,13,"ng-template",null,4,_)(7,Cn,6,3,"ng-template",null,5,_)(9,Sn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().liability)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Equity"),r(),o(5,"th",17),a(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",L(10,wt))("queryParams",F(11,Xt,e.accountID)),l(),b(y(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Equity"),r(),o(3,"td",22),a(4),S(5,"number"),r()(),o(6,"tr")(7,"td",21),a(8," Total Liability + Equity "),r(),o(9,"td",22),a(10),S(11,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,2,e.store.totalEquity())," "),l(6),I(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function wn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No equity records found."),r()()())}function Tn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Equity"),r(),o(2,"p-table",15),g(3,yn,7,0,"ng-template",null,3,_)(5,En,10,13,"ng-template",null,4,_),a(7," <"),g(8,In,12,6,"ng-template",null,5,_)(10,wn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().equity)}}function Dn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),g(2,hn,11,1)(3,vn,11,1)(4,Tn,12,1),r()()),t&2){let e=c();s("showHeader",!1),l(2),V(e.Object.keys(e.store.data().asset).length>0?2:-1),l(),V(e.Object.keys(e.store.data().liability).length>0?3:-1),l(),V(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Rn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function Fn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),a(3,"Tag"),r(),o(4,"p-multiselect",29),g(5,Rn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),a(9,"From"),r(),T(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),l(6),s("iconDisplay","input")("showIcon",!0)}}var Jt=(()=>{class t{constructor(){this.store=C(Et),this.ReportServiceStore=C(P),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=C(oe),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Gt({date:new st(new Date),outletID:new st([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,Yt.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ne("Export Balance Sheet"),M(n=>{let i=n.type,p=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(p,{type:i}));let d=`balance-sheet.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-balance-sheet"]],features:[Oe([Et])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","12rem"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"fw-semibold","text-end"],[1,"text-end","fw-semibold"],["colspan","3",1,""],[1,"fs-5","fw-semibold"],["target","_blank",1,"link","link-primary","d-flex","align-items-center",3,"routerLink"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","outletID","display","chip","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",8),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,dn,2,1,"ng-template",null,0,_)(3,Dn,5,4,"ng-template",null,1,_)(5,Fn,11,7,"ng-template",null,2,_),r()}n&2&&(s("pageTitle",i.store.data().pageTitle)("isFilterable",!0),B("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[re,K,H,W,se,me,ae,ie,te,ee,J,Y,X,Q,Z,ue,de,pe,le,Ee,ne,$e,$,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-comparative-balance works!"),r(),a(2,`
|
|
2
2
|
,
|
|
3
3
|
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Zt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-cash-flow"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-cash-flow works!"),r(),a(2,`
|
|
4
4
|
,
|
|
5
5
|
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ei=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-trial-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-trial-balance works!"),r(),a(2,`
|
|
6
6
|
,
|
|
7
|
-
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Mn=()=>({width:"30vw"}),Ln=()=>({"1199px":"75vw","575px":"90vw"}),Vn=t=>["/pages/journal/journal-entry/",t],ti=t=>({"text-success":t}),kn=t=>({"text-danger":t}),Nn=t=>({"ng-dirty ng-invalid":t}),An=()=>({scrollHeight:"250px"});function Bn(t,m){if(t&1){let e=D();o(0,"p-button",27),w("onClick",function(){h(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function Pn(t,m){if(t&1&&(o(0,"div",24)(1,"a",25),a(2,"Return to Accounts"),r(),g(3,Bn,1,0,"p-button",26),r()),t&2){let e=c();l(3),s("ngIf",e.roleService.global().export)}}function Gn(t,m){if(t&1&&(o(0,"div",24)(1,"span",31)(2,"h2",32),a(3),r()(),o(4,"span",31)(5,"h2",32),a(6),r()()()),t&2){let e=c().$implicit;l(3),b(e.name),l(3),I(" (",e.chartOfAccountCode,") ")}}function On(t,m){t&1&&(o(0,"tr")(1,"th"),a(2,"No."),r(),o(3,"th"),a(4,"Date"),r(),o(5,"th"),a(6,"Contact / Note"),r(),o(7,"th",33),a(8,"Debit"),r(),o(9,"th",33),a(10,"Credit"),r(),o(11,"th",33),a(12,"Balance"),r()())}function jn(t,m){if(t&1&&(o(0,"div")(1,"span",42),a(2),r()()),t&2){let e=c().$implicit;l(2),I(" ",e.outletName," ")}}function zn(t,m){if(t&1&&(o(0,"div",38),T(1,"div",43),o(2,"span",44),a(3),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function qn(t,m){if(t&1&&(o(0,"div",38),T(1,"span",43)(2,"div",43),o(3,"span",44),a(4),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.referenceText,j),l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function Hn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.debitAmount)," ")}}function Wn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.creditAmount)," ")}}function Kn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.balance)," ")}}function Un(t,m){if(t&1&&(o(0,"tr")(1,"td",34),g(2,jn,3,1,"div",35),o(3,"a",36),a(4),r()(),o(5,"td",34),a(6),S(7,"date"),r(),o(8,"td",37)(9,"div",38)(10,"a",39),a(11),r(),g(12,zn,4,2,"div",38)(13,qn,5,3,"div",38),r()(),o(14,"td",40),g(15,Hn,3,3,"ng-container",35),r(),o(16,"td",40),g(17,Wn,3,3,"ng-container",35),r(),o(18,"td",41),g(19,Kn,3,3,"ng-container",35),r()()),t&2){let e=m.$implicit,n=c(4);l(2),s("ngIf",e.outletName==null?null:e.outletName.trim()),l(),s("routerLink",F(16,Vn,e.id)),l(),b(e.number),l(2),I(" ",ke(7,13,e.date,"dd MMM yyyy")," "),l(2),s("ngClass",F(18,ti,e.debitAmount!==0)),l(2),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Pe),l(),b(e.contactName),l(),V(n.buildReferenceUrl(e)?12:13),l(2),s("ngClass",F(20,ti,e.debitAmount!==0)),l(),s("ngIf",e.debitAmount!==0),l(),s("ngClass",F(22,kn,e.creditAmount!==0)),l(),s("ngIf",e.creditAmount!==0),l(2),s("ngIf",e.balance!==0)}}function $n(t,m){if(t&1&&(o(0,"tr"),T(1,"td",45),o(2,"td",46),a(3,"Total"),r(),o(4,"td",47),a(5),S(6,"number"),r(),o(7,"td",48),a(8),S(9,"number"),r(),T(10,"td"),r()),t&2){let e=c().$index,n=c(3);l(5),I(" ",y(6,2,n.items().data[e].debitTotal)," "),l(3),I(" ",y(9,4,n.items().data[e].creditTotal)," ")}}function Yn(t,m){t&1&&(o(0,"tr")(1,"td",49)(2,"span"),a(3,"No records found."),r()()())}function Xn(t,m){if(t&1&&(o(0,"p-table",30),g(1,Gn,7,2,"ng-template",null,5,_)(3,On,13,0,"ng-template",null,6,_)(5,Un,20,24,"ng-template",null,7,_)(7,$n,11,6,"ng-template",null,4,_)(9,Yn,4,0,"ng-template",null,8,_),r()),t&2){let e=m.$implicit;s("value",e.data)}}function Jn(t,m){if(t&1&&(o(0,"div",29),Me(1,Xn,11,1,"p-table",30,Fe),r()),t&2){let e=c(2);l(),Le(e.items().data)}}function Qn(t,m){if(t&1&&g(0,Jn,3,0,"div",28),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Zn(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function eo(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function to(t,m){t&1&&(o(0,"div",67),a(1," Account is required. "),r())}function io(t,m){if(t&1&&(o(0,"div",68)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function no(t,m){if(t&1&&(o(0,"div",59)(1,"div",21),T(2,"p-radiobutton",69),o(3,"label",70),a(4),r()()()),t&2){let e=m.$implicit;l(2),s("value",e.key)("inputId",e.key),l(),Mt("for",e.key),l(),b(e.value)}}function oo(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.customerSuggestions())}}function ro(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Supplier"),r(),o(3,"p-autocomplete",72),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.supplierSuggestions())}}function ao(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.customerSuggestions())}}function lo(t,m){if(t&1){let e=D();o(0,"form",50)(1,"div",38)(2,"label",51),a(3,"Accounts"),r(),o(4,"p-multiselect",52),w("onChange",function(i){h(e);let p=c();return x(p.onAccountChange(i))}),g(5,Zn,10,2,"ng-template",null,9,_)(7,eo,10,2,"ng-template",null,10,_),r(),g(9,to,2,0,"div",53),r(),o(10,"div",38)(11,"label",51),a(12,"From"),r(),o(13,"div",54),T(14,"p-datepicker",55)(15,"p-datepicker",56),r()(),o(16,"div",38)(17,"label",51),a(18,"Tag"),r(),o(19,"p-multiselect",57),g(20,io,3,1,"ng-template",null,10,_),r()(),o(22,"div",38)(23,"label",51),a(24,"Category"),r(),o(25,"p-treeselect",58),w("onFocus",function(){h(e);let i=c();return x(i.onCategoryFocus())}),r()(),o(26,"div",38)(27,"label",18),a(28,"Contact Type"),r(),o(29,"div",16),Me(30,no,5,4,"div",59,Fe),r()(),o(32,"div",38)(33,"label",18),a(34,"Sort order"),r(),o(35,"div",16)(36,"div",59)(37,"div",21),T(38,"p-radiobutton",60),o(39,"label",61),a(40,"Asc"),r()()(),o(41,"div",62)(42,"div",21),T(43,"p-radiobutton",63),o(44,"label",64),a(45,"Desc"),r()()()()(),g(46,oo,4,1,"div",38)(47,ro,4,1,"div",38)(48,ao,4,1,"div",38),r()}if(t&2){let e,n,i,p,u,d,k=c();s("formGroup",k.form),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(e=k.loaderMetadata())==null||e.options==null?null:e.options.accounts)("selectionLimit",5)("ngClass",F(21,Nn,((n=k.form.get("listAccountID"))==null?null:n.invalid)&&(((n=k.form.get("listAccountID"))==null?null:n.touched)||((n=k.form.get("listAccountID"))==null?null:n.dirty)))),l(5),s("ngIf",((i=k.form.get("listAccountID"))==null?null:i.invalid)&&(((i=k.form.get("listAccountID"))==null?null:i.touched)||((i=k.form.get("listAccountID"))==null?null:i.dirty))),l(5),s("showIcon",!0),l(),s("iconDisplay","input")("showIcon",!0),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(p=k.loaderMetadata())==null||p.options==null?null:p.options.outlets),l(6),s("metaKeySelection",!1)("virtualScroll",!0)("virtualScrollItemSize",50)("virtualScrollOptions",M(23,An))("options",k.categoriesOptions()),l(5),Le((u=k.loaderMetadata())==null||u.options==null?null:u.options.contactTypeOptions),l(8),s("value",!0),l(5),s("value",!1),l(3),V((d=k.form.controls.contactType.value)===1?46:d===2?47:48)}}function po(t,m){if(t&1){let e=D();o(0,"p-button",73),w("onClick",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function mo(t,m){if(t&1){let e=D();o(0,"p-button",74),w("click",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",75),w("click",function(){h(e);let i=c();return x(i.onExport())}),r()}}var ii=(()=>{class t{buildReferenceUrl(e){return pt(e)}getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=C(P),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.infinity=1/0,this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=Math.min(e.pageNumber*e.pageSize,isFinite(n)?n:e.pageNumber*e.pageSize);return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:isFinite(n)?e.pageNumber*e.pageSize<n:!0}}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("multiple"),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.queryFilter=ye(this.route.queryParamMap.pipe(Ae(e=>({accountID:e.get("id"),to:e.get("to")}))),{initialValue:null}),this.filter=R(()=>{let e=this.baseFilter(),n=this.queryFilter(),i=this.localFilter();return e?f(f(f({},e),n??{}),i):null}),this.creditSubTotal=R(()=>0),this.debitSubTotal=R(()=>0),this.initializeForm(),ge(()=>{let e=this.filter();if(e){this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1});let n=Array.isArray(e.listAccountID)?e.listAccountID:[],i=Array.isArray(e.listCategoryID)?e.listCategoryID:[];(n.length>0||i.length>0)&&this.reportService.fetchGeneralLedgerReport(e,"multiple").pipe().subscribe(p=>{this.items.set(p)})}})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listCategoryID:this.fb.control([]),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let p=this.findNodeByKey(i.children,n);if(p)return p}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,p])=>{switch(i){case"from":break;case"to":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(p)?n[i]=p.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(p)?p:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=p!=null?Number(p):0;break;case"sortAscending":case"export":n[i]=!!p;break;case"contactType":console.log("contactType value:",p),n[i]=p!=null?Number(p):null;break;default:n[i]=p}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}onFormValueChange(){let e=this.form.controls.listAccountID.value,n=this.form.controls.listCategoryID.value;e.length<=0&&n.length<=0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1})):e.length>0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.disable({emitEvent:!1})):n.length>0&&(this.form.controls.listAccountID.disable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1}))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>5&&this.toastr.warning("Please select at most 5 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e)}buildFilterBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportMultiLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),p="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(p=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,p,u.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:n+1})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(p=>v(f({},p),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-multiple-ledger"]],decls:28,vars:19,consts:[["actionButton",""],["content",""],["filters",""],["closeIconTemplate",""],["footer",""],["caption",""],["header",""],["body",""],["emptymessage",""],["selectedItem",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"row"],[1,"col"],["for",""],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"d-flex","align-items-center","gap-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],[1,"d-flex","gap-2"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,""],[1,"fs-5","fw-semibold"],[1,"text-end"],[1,"text-break"],[4,"ngIf"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-break",3,"ngClass"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[1,"text-end","text-break"],[1,"badge","bg-light","text-dark"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],["colspan","2"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","listAccountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"onChange","virtualScroll","virtualScrollItemSize","options","selectionLimit","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options"],["showClear","","display","chip","selectionMode","multiple","filter","","filterBy","label","formControlName","listCategoryID","appendTo","body","containerStyleClass","w-100","optionLabel","label","optionValue","key","placeholder","Select Category",3,"onFocus","metaKeySelection","virtualScroll","virtualScrollItemSize","virtualScrollOptions","options"],[1,"col-4"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",11),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.initDialogVisible,d)||(i.initDialogVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,Pn,4,1,"ng-template",null,0,_)(3,Qn,1,1,"ng-template",null,1,_)(5,lo,49,24,"ng-template",null,2,_),r(),o(7,"p-dialog",12),G("visibleChange",function(d){return h(p),A(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),x(d)}),o(8,"div",13)(9,"div",14)(10,"div",15)(11,"div",16)(12,"div",17)(13,"label",18),a(14,"Page"),r()(),o(15,"div",17),T(16,"input",19),r()()()(),o(17,"div",20)(18,"div",21),T(19,"i",22),o(20,"span",23),a(21),S(22,"number"),S(23,"number"),r()()()(),g(24,po,1,2,"ng-template",null,3,_)(26,mo,2,0,"ng-template",null,4,_),r()}if(n&2){let p;s("pageTitle",i.pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),B("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),l(7),Ge(M(17,Mn)),s("modal",!0),B("visible",i.isDialogExportVisible),s("breakpoints",M(18,Ln)),l(2),s("formGroup",i.form),l(12),Ve("Exporting data from ",y(22,13,(p=i.filter())==null?null:p.exportPageNumber)," - ",y(23,15,(p=i.filter())==null?null:p.exportPageSize),"")}},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,pe,le,Re,De,ee,J,Bt,Y,X,Q,Z,ue,de,Ee,Ue,at,Wt,rt,ne,$,U,nt,it,Ke,Ot],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}[_nghost-%COMP%] th:nth-child(1){width:10%}[_nghost-%COMP%] th:nth-child(2){width:15%}[_nghost-%COMP%] th:nth-child(3){width:40%}[_nghost-%COMP%] th:nth-child(4){width:15%}[_nghost-%COMP%] th:nth-child(5){width:15%}[_nghost-%COMP%] th:nth-child(6){width:15%}"],changeDetection:0})}}return t})();var tl=[{path:"",redirectTo:"general-ledger",pathMatch:"full"},{path:"",children:[{path:"general-ledger",component:Ut},{path:"multiple-general-ledger",component:ii},{path:"profit-loss",component:$t},{path:"balance-sheet",component:Jt},{path:"comparative-balance",component:Qt},{path:"trial-balance",component:ei},{path:"cash-flow",component:Zt}]}];export{tl as REPORTS_ROUTES};
|
|
7
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ln=()=>({width:"30vw"}),Mn=()=>({"1199px":"75vw","575px":"90vw"}),Vn=t=>["/pages/journal/journal-entry/",t],ti=t=>({"text-success":t}),kn=t=>({"text-danger":t}),Nn=t=>({"ng-dirty ng-invalid":t}),An=()=>({scrollHeight:"250px"});function Bn(t,m){if(t&1){let e=D();o(0,"p-button",27),w("onClick",function(){h(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function Pn(t,m){if(t&1&&(o(0,"div",24)(1,"a",25),a(2,"Return to Accounts"),r(),g(3,Bn,1,0,"p-button",26),r()),t&2){let e=c();l(3),s("ngIf",e.roleService.global().export)}}function Gn(t,m){if(t&1&&(o(0,"div",24)(1,"span",31)(2,"h2",32),a(3),r()(),o(4,"span",31)(5,"h2",32),a(6),r()()()),t&2){let e=c().$implicit;l(3),b(e.name),l(3),I(" (",e.chartOfAccountCode,") ")}}function On(t,m){t&1&&(o(0,"tr")(1,"th"),a(2,"No."),r(),o(3,"th"),a(4,"Date"),r(),o(5,"th"),a(6,"Contact / Note"),r(),o(7,"th",33),a(8,"Debit"),r(),o(9,"th",33),a(10,"Credit"),r(),o(11,"th",33),a(12,"Balance"),r()())}function jn(t,m){if(t&1&&(o(0,"div")(1,"span",42),a(2),r()()),t&2){let e=c().$implicit;l(2),I(" ",e.outletName," ")}}function zn(t,m){if(t&1&&(o(0,"div",38),T(1,"div",43),o(2,"span",44),a(3),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function qn(t,m){if(t&1&&(o(0,"div",38),T(1,"span",43)(2,"div",43),o(3,"span",44),a(4),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.referenceText,j),l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function Hn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.debitAmount)," ")}}function Wn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.creditAmount)," ")}}function Kn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.balance)," ")}}function Un(t,m){if(t&1&&(o(0,"tr")(1,"td",34),g(2,jn,3,1,"div",35),o(3,"a",36),a(4),r()(),o(5,"td",34),a(6),S(7,"date"),r(),o(8,"td",37)(9,"div",38)(10,"a",39),a(11),r(),g(12,zn,4,2,"div",38)(13,qn,5,3,"div",38),r()(),o(14,"td",40),g(15,Hn,3,3,"ng-container",35),r(),o(16,"td",40),g(17,Wn,3,3,"ng-container",35),r(),o(18,"td",41),g(19,Kn,3,3,"ng-container",35),r()()),t&2){let e=m.$implicit,n=c(4);l(2),s("ngIf",e.outletName==null?null:e.outletName.trim()),l(),s("routerLink",F(16,Vn,e.id)),l(),b(e.number),l(2),I(" ",ke(7,13,e.date,"dd MMM yyyy")," "),l(2),s("ngClass",F(18,ti,e.debitAmount!==0)),l(2),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Pe),l(),b(e.contactName),l(),V(n.buildReferenceUrl(e)?12:13),l(2),s("ngClass",F(20,ti,e.debitAmount!==0)),l(),s("ngIf",e.debitAmount!==0),l(),s("ngClass",F(22,kn,e.creditAmount!==0)),l(),s("ngIf",e.creditAmount!==0),l(2),s("ngIf",e.balance!==0)}}function $n(t,m){if(t&1&&(o(0,"tr"),T(1,"td",45),o(2,"td",46),a(3,"Total"),r(),o(4,"td",47),a(5),S(6,"number"),r(),o(7,"td",48),a(8),S(9,"number"),r(),T(10,"td"),r()),t&2){let e=c().$index,n=c(3);l(5),I(" ",y(6,2,n.items().data[e].debitTotal)," "),l(3),I(" ",y(9,4,n.items().data[e].creditTotal)," ")}}function Yn(t,m){t&1&&(o(0,"tr")(1,"td",49)(2,"span"),a(3,"No records found."),r()()())}function Xn(t,m){if(t&1&&(o(0,"p-table",30),g(1,Gn,7,2,"ng-template",null,5,_)(3,On,13,0,"ng-template",null,6,_)(5,Un,20,24,"ng-template",null,7,_)(7,$n,11,6,"ng-template",null,4,_)(9,Yn,4,0,"ng-template",null,8,_),r()),t&2){let e=m.$implicit;s("value",e.data)}}function Jn(t,m){if(t&1&&(o(0,"div",29),Le(1,Xn,11,1,"p-table",30,Fe),r()),t&2){let e=c(2);l(),Me(e.items().data)}}function Qn(t,m){if(t&1&&g(0,Jn,3,0,"div",28),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Zn(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function eo(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function to(t,m){t&1&&(o(0,"div",67),a(1," Account is required. "),r())}function io(t,m){if(t&1&&(o(0,"div",68)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function no(t,m){if(t&1&&(o(0,"div",59)(1,"div",21),T(2,"p-radiobutton",69),o(3,"label",70),a(4),r()()()),t&2){let e=m.$implicit;l(2),s("value",e.key)("inputId",e.key),l(),Lt("for",e.key),l(),b(e.value)}}function oo(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.customerSuggestions())}}function ro(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Supplier"),r(),o(3,"p-autocomplete",72),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.supplierSuggestions())}}function ao(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.customerSuggestions())}}function lo(t,m){if(t&1){let e=D();o(0,"form",50)(1,"div",38)(2,"label",51),a(3,"Accounts"),r(),o(4,"p-multiselect",52),w("onChange",function(i){h(e);let p=c();return x(p.onAccountChange(i))}),g(5,Zn,10,2,"ng-template",null,9,_)(7,eo,10,2,"ng-template",null,10,_),r(),g(9,to,2,0,"div",53),r(),o(10,"div",38)(11,"label",51),a(12,"From"),r(),o(13,"div",54),T(14,"p-datepicker",55)(15,"p-datepicker",56),r()(),o(16,"div",38)(17,"label",51),a(18,"Tag"),r(),o(19,"p-multiselect",57),g(20,io,3,1,"ng-template",null,10,_),r()(),o(22,"div",38)(23,"label",51),a(24,"Category"),r(),o(25,"p-treeselect",58),w("onFocus",function(){h(e);let i=c();return x(i.onCategoryFocus())}),r()(),o(26,"div",38)(27,"label",18),a(28,"Contact Type"),r(),o(29,"div",16),Le(30,no,5,4,"div",59,Fe),r()(),o(32,"div",38)(33,"label",18),a(34,"Sort order"),r(),o(35,"div",16)(36,"div",59)(37,"div",21),T(38,"p-radiobutton",60),o(39,"label",61),a(40,"Asc"),r()()(),o(41,"div",62)(42,"div",21),T(43,"p-radiobutton",63),o(44,"label",64),a(45,"Desc"),r()()()()(),g(46,oo,4,1,"div",38)(47,ro,4,1,"div",38)(48,ao,4,1,"div",38),r()}if(t&2){let e,n,i,p,u,d,k=c();s("formGroup",k.form),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(e=k.loaderMetadata())==null||e.options==null?null:e.options.accounts)("selectionLimit",5)("ngClass",F(21,Nn,((n=k.form.get("listAccountID"))==null?null:n.invalid)&&(((n=k.form.get("listAccountID"))==null?null:n.touched)||((n=k.form.get("listAccountID"))==null?null:n.dirty)))),l(5),s("ngIf",((i=k.form.get("listAccountID"))==null?null:i.invalid)&&(((i=k.form.get("listAccountID"))==null?null:i.touched)||((i=k.form.get("listAccountID"))==null?null:i.dirty))),l(5),s("showIcon",!0),l(),s("iconDisplay","input")("showIcon",!0),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(p=k.loaderMetadata())==null||p.options==null?null:p.options.outlets),l(6),s("metaKeySelection",!1)("virtualScroll",!0)("virtualScrollItemSize",50)("virtualScrollOptions",L(23,An))("options",k.categoriesOptions()),l(5),Me((u=k.loaderMetadata())==null||u.options==null?null:u.options.contactTypeOptions),l(8),s("value",!0),l(5),s("value",!1),l(3),V((d=k.form.controls.contactType.value)===1?46:d===2?47:48)}}function po(t,m){if(t&1){let e=D();o(0,"p-button",73),w("onClick",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function mo(t,m){if(t&1){let e=D();o(0,"p-button",74),w("click",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",75),w("click",function(){h(e);let i=c();return x(i.onExport())}),r()}}var ii=(()=>{class t{buildReferenceUrl(e){return pt(e)}getGLCount(){this.reportService.getGLCount(this.filter()).pipe(M(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=C(P),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.infinity=1/0,this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=Math.min(e.pageNumber*e.pageSize,isFinite(n)?n:e.pageNumber*e.pageSize);return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:isFinite(n)?e.pageNumber*e.pageSize<n:!0}}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("multiple"),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.queryFilter=ye(this.route.queryParamMap.pipe(Ae(e=>({accountID:e.get("id"),to:e.get("to")}))),{initialValue:null}),this.filter=R(()=>{let e=this.baseFilter(),n=this.queryFilter(),i=this.localFilter();return e?f(f(f({},e),n??{}),i):null}),this.creditSubTotal=R(()=>0),this.debitSubTotal=R(()=>0),this.initializeForm(),ge(()=>{let e=this.filter();if(e){this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1});let n=Array.isArray(e.listAccountID)?e.listAccountID:[],i=Array.isArray(e.listCategoryID)?e.listCategoryID:[];(n.length>0||i.length>0)&&this.reportService.fetchGeneralLedgerReport(e,"multiple").pipe().subscribe(p=>{this.items.set(p)})}})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listCategoryID:this.fb.control([]),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let p=this.findNodeByKey(i.children,n);if(p)return p}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,p])=>{switch(i){case"from":break;case"to":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(p)?n[i]=p.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(p)?p:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=p!=null?Number(p):0;break;case"sortAscending":case"export":n[i]=!!p;break;case"contactType":console.log("contactType value:",p),n[i]=p!=null?Number(p):null;break;default:n[i]=p}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}onFormValueChange(){let e=this.form.controls.listAccountID.value,n=this.form.controls.listCategoryID.value;e.length<=0&&n.length<=0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1})):e.length>0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.disable({emitEvent:!1})):n.length>0&&(this.form.controls.listAccountID.disable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1}))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(M(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(M(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(M(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>5&&this.toastr.warning("Please select at most 5 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e)}buildFilterBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportMultiLedger(e,{responseType:"blob",observe:"response"}).pipe(M(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),p="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(p=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,p,u.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:n+1})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(p=>v(f({},p),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-multiple-ledger"]],decls:28,vars:19,consts:[["actionButton",""],["content",""],["filters",""],["closeIconTemplate",""],["footer",""],["caption",""],["header",""],["body",""],["emptymessage",""],["selectedItem",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"row"],[1,"col"],["for",""],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"d-flex","align-items-center","gap-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],[1,"d-flex","gap-2"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,""],[1,"fs-5","fw-semibold"],[1,"text-end"],[1,"text-break"],[4,"ngIf"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-break",3,"ngClass"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[1,"text-end","text-break"],[1,"badge","bg-light","text-dark"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],["colspan","2"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","listAccountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"onChange","virtualScroll","virtualScrollItemSize","options","selectionLimit","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options"],["showClear","","display","chip","selectionMode","multiple","filter","","filterBy","label","formControlName","listCategoryID","appendTo","body","containerStyleClass","w-100","optionLabel","label","optionValue","key","placeholder","Select Category",3,"onFocus","metaKeySelection","virtualScroll","virtualScrollItemSize","virtualScrollOptions","options"],[1,"col-4"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",11),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.initDialogVisible,d)||(i.initDialogVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,Pn,4,1,"ng-template",null,0,_)(3,Qn,1,1,"ng-template",null,1,_)(5,lo,49,24,"ng-template",null,2,_),r(),o(7,"p-dialog",12),G("visibleChange",function(d){return h(p),A(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),x(d)}),o(8,"div",13)(9,"div",14)(10,"div",15)(11,"div",16)(12,"div",17)(13,"label",18),a(14,"Page"),r()(),o(15,"div",17),T(16,"input",19),r()()()(),o(17,"div",20)(18,"div",21),T(19,"i",22),o(20,"span",23),a(21),S(22,"number"),S(23,"number"),r()()()(),g(24,po,1,2,"ng-template",null,3,_)(26,mo,2,0,"ng-template",null,4,_),r()}if(n&2){let p;s("pageTitle",i.pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),B("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),l(7),Ge(L(17,Ln)),s("modal",!0),B("visible",i.isDialogExportVisible),s("breakpoints",L(18,Mn)),l(2),s("formGroup",i.form),l(12),Ve("Exporting data from ",y(22,13,(p=i.filter())==null?null:p.exportPageNumber)," - ",y(23,15,(p=i.filter())==null?null:p.exportPageSize),"")}},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,pe,le,Re,De,ee,J,Bt,Y,X,Q,Z,ue,de,Ee,Ue,at,Wt,rt,ne,$,U,nt,it,Ke,Ot],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}[_nghost-%COMP%] th:nth-child(1){width:10%}[_nghost-%COMP%] th:nth-child(2){width:15%}[_nghost-%COMP%] th:nth-child(3){width:40%}[_nghost-%COMP%] th:nth-child(4){width:15%}[_nghost-%COMP%] th:nth-child(5){width:15%}[_nghost-%COMP%] th:nth-child(6){width:15%}"],changeDetection:0})}}return t})();var tl=[{path:"",redirectTo:"general-ledger",pathMatch:"full"},{path:"",children:[{path:"general-ledger",component:Ut},{path:"multiple-general-ledger",component:ii},{path:"profit-loss",component:$t},{path:"balance-sheet",component:Jt},{path:"comparative-balance",component:Qt},{path:"trial-balance",component:ei},{path:"cash-flow",component:Zt}]}];export{tl as REPORTS_ROUTES};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Q}from"./chunk-Q4KG7LH6.js";import{a as W}from"./chunk-PGOSR3RI.js";import{a as O}from"./chunk-BT7Y4ADP.js";import{i as B}from"./chunk-
|
|
1
|
+
import{a as Q}from"./chunk-Q4KG7LH6.js";import{a as W}from"./chunk-PGOSR3RI.js";import{a as O}from"./chunk-BT7Y4ADP.js";import{i as B}from"./chunk-D2CH2T3I.js";import"./chunk-S27Z7D3D.js";import{a as A}from"./chunk-AD247LWQ.js";import"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as z,w as D}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{b as I,c as N,e as w,f as R,l as P,o as V,u as G,x as q}from"./chunk-VMI3QWC6.js";import{b as M,d as k}from"./chunk-F7PVAVLQ.js";import"./chunk-KGNH5JRZ.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as E,k as J}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{D as x,Eb as p,Fc as j,I as h,Mb as r,N as T,Sc as v,Wb as i,Xb as n,Y as d,Yb as g,_ as f,ac as F,fc as S,gc as s,ia as m,ib as a,k as _,qa as C,ra as b,sc as c,yb as y}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var U=t=>({"ng-invalid ng-dirty":t});function Y(t,u){if(t&1){let e=F();i(0,"div")(1,"p-button",3),S("onClick",function(){C(e);let l=s();return b(l.onSubmit())}),n()()}}function H(t,u){t&1&&(i(0,"div",14),c(1," Name is required "),n())}function K(t,u){if(t&1&&(i(0,"div"),p(1,H,2,0,"div",13),n()),t&2){let e=s(2);a(),r("ngIf",e.form.controls.name.errors.required)}}function L(t,u){if(t&1&&(i(0,"p-panel",4)(1,"div",5)(2,"div",6)(3,"div",7)(4,"div",8)(5,"label",9),c(6,"Name"),n(),g(7,"input",10),p(8,K,2,1,"div",11),n()(),i(9,"div",7)(10,"div",8)(11,"label",9),c(12,"Description"),n(),g(13,"textarea",12),n()()()()()),t&2){let e=s();a(),r("formGroup",e.form),a(6),r("ngClass",j(4,U,e.form.controls.name.invalid&&(e.form.controls.name.dirty||e.form.controls.name.touched))),a(),r("ngIf",e.form.controls.name.invalid&&(e.form.controls.name.dirty||e.form.controls.name.touched)),a(5),r("autoResize",!0)}}var ue=(()=>{class t{constructor(){this.fb=m(G),this.journalTagService=m(Q),this.route=m(M),this.router=m(k)}initForm(){console.log("Initializing form"),this.form=this.fb.group({name:this.fb.control("",[N.required]),description:this.fb.control("")})}ngOnInit(){this.initForm(),this.route.queryParamMap.pipe(x(e=>e.has("id")),d(e=>this.journalTagService.journalTagGet(e.get("id"))),O("Query params"),f(e=>{console.log("Got journal tag:",e),this.form.patchValue({name:e.name,description:e.description})})).subscribe()}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=this.form.getRawValue();this.route.queryParamMap.pipe(T(1),d(o=>{let l=o.get("id");return l?this.journalTagService.journalTagUpdate(e,l):this.journalTagService.journalTagCreate(e)}),f(()=>{console.log("Journal tag saved successfully"),this.router.navigate(["/pages/accounting-setup/journal-tag"])}),h(o=>(console.error("Failed to save journal tag:",o),_))).subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=y({type:t,selectors:[["app-journal-tag-form"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Journal Tag Form",3,"hasMainWrapperPadding"],["label","Submit",3,"onClick"],["styleClass","rounded-2"],[1,"d-flex","flex-column","gap-2",3,"formGroup"],[1,"row"],[1,"col-6"],[1,"d-flex","flex-column"],["for",""],["size","small","formControlName","name","type","text","pInputText","",3,"ngClass"],[4,"ngIf"],["rows","2","pSize","large","cols","30","pTextarea","","formControlName","description",3,"autoResize"],["class","invalid-feedback text-danger d-block",4,"ngIf"],[1,"invalid-feedback","text-danger","d-block"]],template:function(o,l){o&1&&(i(0,"app-main-panel",2),p(1,Y,2,0,"ng-template",null,0,v)(3,L,14,6,"ng-template",null,1,v),n()),o&2&&r("hasMainWrapperPadding",!0)},dependencies:[B,z,J,A,q,I,w,R,P,V,W,D,E],encapsulation:2})}}return t})();export{ue as JournalTagFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-KJCHFIF4.js";import{d as r}from"./chunk-F7PVAVLQ.js";import{ia as e}from"./chunk-6QJHEOXN.js";var f=(a,o)=>{let t=e(i),s=e(r),n=t.isAuthenticated(),u=!t.isTokenExpired(),c=t.checkAuthKeysExists();return!n||!u||!c?(s.navigate(["/"],{queryParams:{returnUrl:o.url}}),!1):!0};export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as L}from"./chunk-
|
|
1
|
+
import{a as v,b as L}from"./chunk-4UVBCZJG.js";import"./chunk-IHKBTP2Y.js";import{a as E,b as O}from"./chunk-DJXQKSLT.js";import"./chunk-WXIG4CXY.js";import{i as H}from"./chunk-D2CH2T3I.js";import"./chunk-S27Z7D3D.js";import{a as R,b as D}from"./chunk-AD247LWQ.js";import"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{w as V,x as j,y as N,z as G}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import"./chunk-VMI3QWC6.js";import"./chunk-KGNH5JRZ.js";import"./chunk-5DRALZZF.js";import{a as I}from"./chunk-2BI7WNJP.js";import{n as A,s as F}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Dc as $,Eb as B,Ec as _,Mb as p,Oc as m,Pb as d,Pc as l,Sc as x,W as y,Wb as o,Xb as n,Y as M,Yb as c,_ as b,ac as P,fc as h,gc as s,h as T,ia as f,ib as a,qa as g,ra as C,s as u,sa as S,ta as k,yb as w}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let e=P();o(0,"div",3)(1,"p-button",4),h("onClick",function(){g(e);let r=s();return C(r.onFormatCOAConfig())}),n(),o(2,"p-button",5),m(3,"async"),m(4,"async"),h("onClick",function(){g(e);let r=s();return C(r.onMigrateCoaConfig())}),n()()}if(i&2){let e=s();a(2),p("disabled",l(3,2,e.countInBooks$)!==0)("pTooltip",l(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),c(3,"app-migration-cards",7),m(4,"async"),S(),o(5,"svg",8),c(6,"path",9),n(),k(),c(7,"app-migration-cards",10),m(8,"async"),n()()()),i&2){let e=s();d(_(12,q)),a(),d(_(13,q)),a(2),p("migrationCount",l(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",l(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var ge=(()=>{class i{constructor(){this.migrateService=f(v),this.toastr=f(I),this.refresh$=new T(void 0),this.pageTitle="Chart of Account Configuration"}ngOnInit(){let e=this.refresh$.pipe(M(()=>this.migrateService.getCOAConfigurationCount()),b(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(u(t=>Number(t.pos))),this.countInBooks$=e.pipe(u(t=>Number(t.books)))}onMigrateCoaConfig(){this.migrateService.migrateCoaConfig().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormatCOAConfig(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatManualCOAConfig().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=w({type:i,selectors:[["app-coa-configuration"]],features:[$([v])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(o(0,"app-main-panel",2),B(1,J,5,6,"ng-template",null,0,x)(3,K,9,14,"ng-template",null,1,x),n()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[H,F,A,j,V,O,E,D,R,G,N,L],encapsulation:2})}}return i})();export{ge as CoaConfigurationComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ve,b as Ae}from"./chunk-E6SW7I4D.js";import{b as Te}from"./chunk-
|
|
1
|
+
import{a as Ve,b as Ae}from"./chunk-E6SW7I4D.js";import{b as Te}from"./chunk-IHKBTP2Y.js";import{a as je}from"./chunk-XKI7WLHE.js";import{a as Fe,b as Me}from"./chunk-ELMSU4U7.js";import"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import{a as N,b as H}from"./chunk-3VQUNDVT.js";import{d as De,i as ye,j as ke,k as Ie}from"./chunk-DGACZ747.js";import{a as we,b as ve}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as D}from"./chunk-BT7Y4ADP.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{i as Pe}from"./chunk-D2CH2T3I.js";import"./chunk-S27Z7D3D.js";import{a as xe,b as he}from"./chunk-AD247LWQ.js";import{b as h,c as _e,d as Ee,e as Re,f as be,g as Se,h as Ce}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{w as fe,x as ge}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{c as L,e as le,f as pe,l as ce,o as me,u as de,x as ue}from"./chunk-VMI3QWC6.js";import{e as oe,l as ae}from"./chunk-F7PVAVLQ.js";import"./chunk-KGNH5JRZ.js";import{a as se}from"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as Z,j as ee,k as te,p as ie,q as ne,s as re}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Cb as K,D as U,Dc as Q,Eb as _,Ec as W,Fc as j,L as B,Mb as f,Oc as V,P as G,Pb as z,Pc as X,Qc as Y,Sc as b,Wb as a,Xb as o,Y as I,Yb as E,_ as T,ac as F,bd as A,c as k,ca as q,fc as M,gc as x,ia as g,ib as u,qa as w,ra as v,s as P,sc as m,tc as R,uc as J,yb as $}from"./chunk-6QJHEOXN.js";import{a as s,b as c}from"./chunk-YQFG5XE2.js";var y=(()=>{class t{constructor(){this.httpService=g(se)}getPostRecurringExpenseLoader(){return this.httpService.get(void 0,"api/RecurringExpenseLoader/RecurringExpensesGenerate")}previewPostRecurringExpense(e){return this.httpService.post(void 0,"api/RecurringExpense/RecurringExpensesGeneratePreview",e)}submitPostRecurringExpense(e){return this.httpService.post(void 0,"api/RecurringExpense/RecurringExpensesGenerate",e)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=q({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ne={data:{data:[]},meta:{options:{expenses:[]},form:{date:"",number:"",listIDs:[]}},filter:{date:"",number:"",listIDs:[]}},O=_e(Se(Ne),Ce("PostRecurringExpenseStore"),Ee(t=>({hasCheckedRows:A(()=>t.data().data.some(p=>p.checked)),checkedPRE:A(()=>t.data().data.filter(p=>p.checked))})),be(t=>{let p=g(y);return{updateFilter:i=>{h(t,n=>c(s({},n),{filter:s(s({},n.filter),i)}))},emptyData(){h(t,i=>c(s({},i),{data:{data:[],totalCount:0}}))},onRowSelect(i){h(t,n=>{let r=n.data.data.map(l=>l.lastExpenseDate===i.lastExpenseDate?c(s({},l),{checked:!0}):l);return c(s({},n),{data:c(s({},n.data),{data:r})})})},onRowUnselect(i){h(t,n=>{let r=n.data.data.map(l=>l.lastExpenseDate===i.lastExpenseDate?c(s({},l),{checked:!1}):l);return c(s({},n),{data:c(s({},n.data),{data:r})})})},onHeaderCheckboxToggle(i){h(t,n=>{let r=n.data.data.map(l=>c(s({},l),{checked:i}));return c(s({},n),{data:c(s({},n.data),{data:r})})})},getPRELoader:N(k(I(()=>p.getPostRecurringExpenseLoader().pipe(H({next:i=>{h(t,n=>c(s({},n),{meta:i}))},error:i=>{console.error("Error fetching PRE Loader:",i)}}))))),getPREPreview:N(k(U(i=>i.date&&i.listIDs.length>0),P(i=>({Date:i.date,Number:i.number,ListIDs:i.listIDs})),I(i=>p.previewPostRecurringExpense(i).pipe(P(n=>c(s({},n),{data:n.data.map(r=>c(s({},r),{checked:!1}))})),H({next:n=>{h(t,r=>c(s({},r),{data:n}))},error:n=>{console.error("Error fetching PRE Preview:",n)}})))))}}),Re(t=>({onInit:()=>{t.getPRELoader(),t.getPREPreview(t.filter)}})));var He=()=>({height:"calc(100vh - 70px)"}),Oe=t=>({"ng-invalid ng-dirty":t}),Ue=t=>["/pages/recurring/recurring-expense/details/",t];function Be(t,p){if(t&1){let e=F();a(0,"p-button",7),M("onClick",function(){w(e);let n=x(2);return v(n.onSubmitPRE())}),o()}}function Ge(t,p){if(t&1&&_(0,Be,1,0,"p-button",6),t&2){let e=x();f("ngIf",e.store.hasCheckedRows())}}function qe(t,p){if(t&1&&(a(0,"div")(1,"span",19),m(2),o()()),t&2){let e=p.$implicit;u(2),R(e)}}function $e(t,p){if(t&1&&(a(0,"div"),_(1,qe,3,1,"div",18),o()),t&2){let e=x(2);u(),f("ngForOf",e.getErrors("listIDs"))}}function Ke(t,p){t&1&&(a(0,"tr")(1,"th",20),E(2,"p-tableHeaderCheckbox"),o(),a(3,"th"),m(4,"Name"),o(),a(5,"th"),m(6,"Date"),o(),a(7,"th"),m(8,"Asset Account"),o(),a(9,"th"),m(10,"Expense Account"),o(),a(11,"th",21),m(12,"Amount"),o()())}function ze(t,p){if(t&1&&(a(0,"tr")(1,"td"),E(2,"p-tableCheckbox",22),o(),a(3,"td")(4,"a",23),m(5),o()(),a(6,"td"),m(7),V(8,"date"),o(),a(9,"td"),m(10),o(),a(11,"td"),m(12),o(),a(13,"td",21),m(14),V(15,"number"),o()()),t&2){let e=p.$implicit;u(2),f("value",e),u(2),f("routerLink",j(12,Ue,e.id)),u(),J(" ",e.name," "),u(2),R(Y(8,7,e.nextExpenseDate,"d MMM y")),u(3),R(e.paymentName),u(2),R(e.expenseName),u(2),R(X(15,10,e.amount))}}function Je(t,p){t&1&&(a(0,"tr")(1,"td",24)(2,"span"),m(3,"No records found."),o()()())}function Qe(t,p){if(t&1){let e=F();a(0,"p-panel")(1,"div",8)(2,"div",9)(3,"div",10)(4,"div",11)(5,"div",12)(6,"label",13),m(7,"Date"),o(),E(8,"p-datepicker",14),o()(),a(9,"div",11)(10,"div",12)(11,"label",13),m(12,"Recurring Expense"),o(),E(13,"p-multiselect",15),_(14,$e,2,1,"div",16),o()()()()(),E(15,"p-divider"),a(16,"p-table",17),M("onRowSelect",function(n){w(e);let r=x();return v(r.onRowSelect(n))})("onRowUnselect",function(n){w(e);let r=x();return v(r.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){w(e);let r=x();return v(r.onHeaderCheckboxToggle(n))}),_(17,Ke,13,0,"ng-template",null,2,b)(19,ze,16,14,"ng-template",null,3,b)(21,Je,4,0,"ng-template",null,4,b),o()()}if(t&2){let e=x();z(W(7,He)),u(),f("formGroup",e.form),u(12),f("ngClass",j(8,Oe,e.isInvalid("listIDs")))("options",e.store.meta().options.expenses),u(),f("ngIf",e.isInvalid("listIDs")),u(2),f("value",e.store.data().data)}}var Lt=(()=>{class t extends je{constructor(){super(),this.store=g(O),this.fb=g(de),this.dayjsService=g(Te),this.PREService=g(y)}ngOnInit(){this.initForm(),this.form.valueChanges.pipe(B(300),G(),D("Form Value Changes"),P(e=>Object.entries(e).reduce((i,[n,r])=>{switch(n){case"date":typeof r=="object"&&r!==null&&!Array.isArray(r)?i[n]=this.dayjsService.from(r)?this.dayjsService.format(r):null:(typeof r=="string"||typeof r=="number"||r instanceof Date)&&!Array.isArray(r)?i[n]=r!=null?String(r):null:i[n]=null;break;default:i[n]=r===null?"":r;break}return i},{})),D("Mapped Form Value"),T(e=>{(!e.listIDs||e.listIDs.length===0)&&this.store.emptyData(),this.store.updateFilter(e)})).subscribe()}initForm(){let{date:e,listIDs:i,number:n}=this.store.filter();this.form=this.fb.group({date:this.fb.control(this.dayjsService.from(e)?this.dayjsService.from(e).toDate():this.dayjsService.now.toDate(),[L.required]),number:this.fb.control(n||""),listIDs:this.fb.control(i,[L.required])})}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(i=>{this.store.onRowUnselect(i)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onSubmitPRE(){console.log(this.store.checkedPRE());let i=this.store.checkedPRE().reduce((r,l)=>(r[l.id]||(r[l.id]={ID:l.id,ListDate:[]}),r[l.id].ListDate.push(l.lastExpenseDate),r),{}),n=Object.values(i);console.log("Submitting PRE with body:",n),this.PREService.submitPostRecurringExpense(n).pipe(D("Submit Post Recurring Expense"),T(()=>{let r=this.form.getRawValue(),l=Object.entries(r).reduce((S,[C,d])=>{switch(C){case"date":typeof d=="object"&&d!==null&&!Array.isArray(d)?S[C]=this.dayjsService.from(d)?this.dayjsService.format(d):null:(typeof d=="string"||typeof d=="number"||d instanceof Date)&&!Array.isArray(d)?S[C]=d!=null?String(d):null:S[C]=null;break;default:S[C]=d===null?"":d;break}return S},{});this.store.updateFilter(l)})).subscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=$({type:t,selectors:[["app-post-recurring-expense"]],features:[Q([O]),K],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["emptymessage",""],["pageTitle","Post Recurring Expense",3,"scrollable"],["label","Submit",3,"onClick",4,"ngIf"],["label","Submit",3,"onClick"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"row"],[1,"col"],[1,"d-flex","flex-column"],["for",""],["fluid","","formControlName","date"],["display","chip","formControlName","listIDs","optionLabel","name","optionValue","id","placeholder","Select Recurring Expenses","fluid","",3,"ngClass","options"],[4,"ngIf"],["dataKey","lastExpenseDate",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value"],[4,"ngFor","ngForOf"],[1,"text-danger"],[2,"width","1rem"],[1,"text-end"],[3,"value"],["target","_blank",1,"link","link-primary",3,"routerLink"],["colspan","6"]],template:function(i,n){i&1&&(a(0,"app-main-panel",5),_(1,Ge,1,1,"ng-template",null,0,b)(3,Qe,23,10,"ng-template",null,1,b),o()),i&2&&f("scrollable",!0)},dependencies:[Pe,re,Z,ee,te,ne,ie,he,xe,Ae,Ve,ve,we,Me,Fe,ue,le,pe,ce,me,Ie,De,ye,ke,ge,fe,ae,oe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Lt as PostRecurringExpenseComponent};
|