dealposbooks 5.49.0 → 5.49.2
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-KSPR5HTA.js → chunk-2BTS7BEP.js} +1 -1
- package/{chunk-6RB67IF5.js → chunk-2RI2WRFG.js} +1 -1
- package/{chunk-XLEICBBP.js → chunk-33JUCBXH.js} +1 -1
- package/{chunk-ZIZHSXQM.js → chunk-3LOZ6OKX.js} +1 -1
- package/{chunk-XVAFZB6H.js → chunk-4YH7A4M6.js} +1 -1
- package/{chunk-K4IULEBH.js → chunk-66YEZ4LP.js} +1 -1
- package/{chunk-UHOHG6YG.js → chunk-6KSTIWOD.js} +1 -1
- package/{chunk-TFW2HBFA.js → chunk-7NY7TIU4.js} +1 -1
- package/{chunk-ADODNO5M.js → chunk-7P5XATXL.js} +1 -1
- package/{chunk-L6PLE5U4.js → chunk-ADC7G7M6.js} +1 -1
- package/{chunk-O7PTQ6FD.js → chunk-B4CNCOTT.js} +1 -1
- package/{chunk-7HVUWEG2.js → chunk-BVXHSTT4.js} +1 -1
- package/{chunk-5YGRLXFR.js → chunk-BZUZKZY4.js} +1 -1
- package/{chunk-Q3HB53OC.js → chunk-C4W7XYJD.js} +1 -1
- package/{chunk-CLWQ53HX.js → chunk-CIPN4BTQ.js} +1 -1
- package/{chunk-WTU5HM6J.js → chunk-EEQIJSRK.js} +2 -2
- package/chunk-EOU5D6FS.js +1 -0
- package/{chunk-IW7TNRJO.js → chunk-F4WXASVJ.js} +1 -1
- package/{chunk-AOQH3HTB.js → chunk-F6G7POPA.js} +1 -1
- package/{chunk-O54WM4PU.js → chunk-GWKQHO7M.js} +1 -1
- package/{chunk-VCUOMA7I.js → chunk-HA7LLTOG.js} +1 -1
- package/{chunk-4KDA7ZRZ.js → chunk-HY3WGTQF.js} +1 -1
- package/{chunk-A5Q65V4N.js → chunk-JD4TR3G6.js} +1 -1
- package/{chunk-HECYO7RI.js → chunk-JJ2G2ITS.js} +1 -1
- package/{chunk-OQRWMLXY.js → chunk-KDCDSUGW.js} +1 -1
- package/{chunk-U57VXKUE.js → chunk-KGZUIHAZ.js} +1 -1
- package/{chunk-ER5Y4FMF.js → chunk-L7WPJUZ6.js} +1 -1
- package/{chunk-OPSSYJMR.js → chunk-LO2GGXGQ.js} +1 -1
- package/{chunk-JLFNJ2HH.js → chunk-LXHUCAAY.js} +1 -1
- package/{chunk-QJGYGXL3.js → chunk-M5M3M3GU.js} +1 -1
- package/{chunk-2A5KXVYV.js → chunk-MGGC32PD.js} +2 -2
- package/{chunk-ERG2YCYC.js → chunk-MQPKGA4I.js} +1 -1
- package/{chunk-WUMR7VK2.js → chunk-OARM3UHP.js} +1 -1
- package/{chunk-LOLOGGWA.js → chunk-P5ICG7YE.js} +1 -1
- package/{chunk-MV52MU2A.js → chunk-Q52A3GQ5.js} +1 -1
- package/{chunk-IMQMRA4Y.js → chunk-RIBVS2ZL.js} +1 -1
- package/{chunk-4ZU2FOSO.js → chunk-RTMNVCIM.js} +1 -1
- package/{chunk-TON77VSP.js → chunk-S72FLLKS.js} +1 -1
- package/{chunk-ULAE6ZMS.js → chunk-TG6Y7ANZ.js} +1 -1
- package/{chunk-J3R2TUSM.js → chunk-TJQSE35W.js} +1 -1
- package/{chunk-SWU3XDYQ.js → chunk-TSPM6IPU.js} +1 -1
- package/{chunk-2RHKXE62.js → chunk-ULBVUV32.js} +1 -1
- package/{chunk-OZXIWJFE.js → chunk-UM2HOJJR.js} +1 -1
- package/{chunk-STBJVKOH.js → chunk-W6V2QFA7.js} +1 -1
- package/{chunk-5M5KVWZB.js → chunk-WBGCOYQJ.js} +1 -1
- package/{chunk-WDT3X7BX.js → chunk-X57GOVJJ.js} +1 -1
- package/{chunk-O3XDMCQO.js → chunk-YSZN7YTG.js} +2 -2
- package/{chunk-ZXJEHHMR.js → chunk-YUS2B7BT.js} +1 -1
- package/{chunk-2RKPDCYU.js → chunk-ZVEQIMYP.js} +1 -1
- package/index.html +2 -2
- package/{main-P47IKABJ.js → main-OZKRZLSC.js} +1 -1
- package/package.json +1 -1
- package/chunk-AJA5W4PQ.js +0 -1
|
@@ -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-7P5XATXL.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-C4W7XYJD.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,4 +1,4 @@
|
|
|
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-6RB67IF5.js";import{a as Ht,b as ce}from"./chunk-XLEICBBP.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-ADODNO5M.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-Q3HB53OC.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-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,`
|
|
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
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-2RI2WRFG.js";import"./chunk-U2VDC52W.js";import{d as n}from"./chunk-F7PVAVLQ.js";import"./chunk-C4W7XYJD.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{ia as e}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var a=(t,m)=>{let o=e(r),i=e(n),p=o.isAuthenticated(),s=!o.isTokenExpired(),u=o.checkAuthKeysExists();return p&&s&&u?(i.navigateByUrl("/pages/dashboard"),!1):!0};var C=[{path:"",canActivate:[a],loadComponent:()=>import("./chunk-OARM3UHP.js").then(t=>t.LoginComponent)},{path:"404",loadComponent:()=>import("./chunk-OJTHBHGK.js").then(t=>t.NotfoundComponent)},{path:"signup",loadComponent:()=>import("./chunk-2LNMV22E.js").then(t=>t.SignupComponent)},{path:"504",loadComponent:()=>import("./chunk-6DTQWLB3.js").then(t=>t.TimeoutComponent)}];export{C as AuthenticationRoutes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./chunk-Q4KG7LH6.js";import{d as q,i as K,j as G,k as Q}from"./chunk-DGACZ747.js";import"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as W}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 O}from"./chunk-
|
|
1
|
+
import{a as X}from"./chunk-Q4KG7LH6.js";import{d as q,i as K,j as G,k as Q}from"./chunk-DGACZ747.js";import"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as W}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 O}from"./chunk-7P5XATXL.js";import"./chunk-S27Z7D3D.js";import"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{w as B}from"./chunk-ME4ALIS7.js";import{a as N,b as U}from"./chunk-DTYVTTET.js";import"./chunk-VMI3QWC6.js";import{e as L}from"./chunk-F7PVAVLQ.js";import"./chunk-C4W7XYJD.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{k as I}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Eb as h,Fc as A,Ha as b,L as R,Mb as d,Rb as v,Sc as _,Wb as i,Xb as o,Y as J,Yb as w,_ as k,ac as T,bd as S,cd as H,fc as x,gc as r,ia as D,ib as f,qa as m,ra as c,s as j,sc as u,tc as V,wc as F,xc as M,yb as E,yc as z,zc as P}from"./chunk-6QJHEOXN.js";import{a as s,b as g}from"./chunk-YQFG5XE2.js";var Y=["class","component"],Z=t=>({id:t});function $(t,p){if(t&1){let e=T();i(0,"p-button",13),x("onClick",function(){m(e);let n=r(2);return c(n.onJournalTagDelete())}),o()}}function ee(t,p){if(t&1){let e=T();i(0,"div",8)(1,"p-button",9),x("onClick",function(){m(e);let n=r();return c(n.onMigrate())}),o(),h(2,$,1,0,"p-button",10),i(3,"a",11),w(4,"i",12),u(5," Add"),o()()}if(t&2){let e=r();f(2),d("ngIf",e.journalTagsChecked().length>0)}}function te(t,p){t&1&&(i(0,"div",14)(1,"h3",15),u(2," Are you to sure to copy All Outlet from POS to Journal Tag? "),o()())}function ne(t,p){t&1&&(i(0,"tr")(1,"th",18),w(2,"p-tableHeaderCheckbox"),o(),i(3,"th"),u(4,"Tag"),o(),i(5,"th"),u(6,"Description"),o()())}function ae(t,p){if(t&1&&(i(0,"tr")(1,"td"),w(2,"p-tableCheckbox",19),o(),i(3,"td")(4,"a",20),u(5),o()(),i(6,"td"),u(7),o()()),t&2){let e=p.$implicit;f(2),d("value",e),f(2),d("queryParams",A(4,Z,e.id)),f(),V(e.name),f(2),V(e.description)}}function ie(t,p){if(t&1&&u(0),t&2){let e=r(3);F(" Showing ",e.first()," to ",e.end()," of ",e.journalTags().count," entries ")}}function oe(t,p){t&1&&(i(0,"tr")(1,"td",21)(2,"span"),u(3," No journal entries found. "),o()()())}function le(t,p){if(t&1){let e=T();i(0,"p-table",17),x("onPage",function(n){m(e);let l=r(2);return c(l.onPageChange(n))})("onRowSelect",function(n){m(e);let l=r(2);return c(l.onRowSelect(n))})("onRowUnselect",function(n){m(e);let l=r(2);return c(l.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){m(e);let l=r(2);return c(l.onHeaderCheckboxToggle(n))}),h(1,ne,7,0,"ng-template",null,3,_)(3,ae,8,6,"ng-template",null,4,_)(5,ie,1,3,"ng-template",null,5,_)(7,oe,4,0,"ng-template",null,6,_),o()}if(t&2){let e=r(2);d("value",e.journalTags().data)("paginator",!0)("totalRecords",e.journalTags().count)("lazy",!0)("rows",e.params().pageSize)("scrollable",!0)}}function re(t,p){if(t&1&&h(0,le,9,6,"p-table",16),t&2){let e=r();v(e.journalTags()?0:-1)}}var we=(()=>{class t{constructor(){this.journalTagService=D(X),this.isDialogFilterVisible=b(!1),this.params=b({pageNumber:1,pageSize:100}),this.first=S(()=>(this.params().pageNumber-1)*this.params().pageSize+1),this.end=S(()=>Math.min(this.params().pageNumber*this.params().pageSize,this.journalTags().count||100)),this.journalTagsSource=U(N(this.params).pipe(R(300),J(e=>this.journalTagService.journalTagList(e).pipe(j(a=>g(s({},a),{data:a.data.map(n=>g(s({},n),{checked:!1}))}))))),{initialValue:null}),this.journalTags=b(null),this.journalTagsChecked=S(()=>this.journalTags()?this.journalTags().data.filter(e=>e.checked):[]),H(()=>{let e=this.journalTagsSource();e&&this.journalTags.set(e)})}ngOnInit(){this.journalTagService.journalTagList({pageNumber:1,pageSize:100}).pipe(W("response")).subscribe()}onPageChange(e){this.params.update(a=>g(s({},a),{pageNumber:e.first/e.rows+1,pageSize:e.rows}))}onRowSelect(e){if(Array.isArray(e.data)){let a=e.data.map(n=>n.id);this.updateCheckedRows(a,!0)}else e.data&&this.updateCheckedRows([e.data.id],!0)}onRowUnselect(e){if(Array.isArray(e.data)){let a=e.data.map(n=>n.id);this.updateCheckedRows(a,!1)}else e.data&&this.updateCheckedRows([e.data.id],!1)}updateCheckedRows(e,a){this.journalTags.update(n=>{if(!n)return n;let l=n.data.map(C=>e.includes(C.id)?g(s({},C),{checked:a}):C);return g(s({},n),{data:l})})}onHeaderCheckboxToggle(e){this.journalTags.update(a=>g(s({},a),{data:a.data.map(n=>g(s({},n),{checked:e.checked}))}))}onJournalTagDelete(){this.journalTagService.journalTagDelete(this.journalTagsChecked()[0].id).pipe(k(()=>this.params.update(e=>s({},e)))).subscribe()}onMigrate(){this.isDialogFilterVisible.update(e=>!e)}onFilterConfirmed(){this.journalTagService.journalTagMigrate().pipe(k(()=>{this.isDialogFilterVisible.update(e=>!e),this.params.update(e=>s({},e))})).subscribe()}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-journal-tag",8,"component"]],attrs:Y,decls:7,vars:3,consts:[["actionButton",""],["filters",""],["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Journal Tag List","dialogTitle","Migrate Users",3,"isDialogFilterVisibleChange","filterConfirmed","overflowScroll","isDialogFilterVisible","showCancelButton"],[1,"d-flex","gap-2"],["label","Migrate","variant","outlined",3,"onClick"],["label","Delete","severity","danger","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["routerLink","form",1,"p-button"],[1,"fa-solid","fa-plus"],["label","Delete","severity","danger","icon","fa-solid fa-trash",3,"onClick"],[1,"h-full","d-flex","align-items-center"],[1,"fs-3"],["dataKey","id","selectionMode","single","styleClass","d-flex flex-column justify-content-between h-100",3,"value","paginator","totalRecords","lazy","rows","scrollable"],["dataKey","id","selectionMode","single","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","totalRecords","lazy","rows","scrollable"],[2,"width","1rem"],[3,"value"],["routerLink","form",1,"link","link-primary",3,"queryParams"],["colspan","5"]],template:function(a,n){if(a&1){let l=T();i(0,"app-main-panel",7),P("isDialogFilterVisibleChange",function(y){return m(l),z(n.isDialogFilterVisible,y)||(n.isDialogFilterVisible=y),c(y)}),x("filterConfirmed",function(){return m(l),c(n.onFilterConfirmed())}),h(1,ee,6,1,"ng-template",null,0,_)(3,te,3,0,"ng-template",null,1,_)(5,re,1,1,"ng-template",null,2,_),o()}a&2&&(d("overflowScroll",!0),M("isDialogFilterVisible",n.isDialogFilterVisible),d("showCancelButton",!1))},dependencies:[O,Q,q,K,G,B,I,L],styles:[".container-wrapper .p-datatable .p-datatable-thead>tr>th{position:sticky;top:0;z-index:1050;background:#f6f6f6!important}"],changeDetection:0})}}return t})();export{we as JournalTagComponent};
|