-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathconsumption.xhtml
More file actions
959 lines (890 loc) · 64.4 KB
/
Copy pathconsumption.xhtml
File metadata and controls
959 lines (890 loc) · 64.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:body>
<ui:composition template="/reports/index.xhtml">
<ui:define name="subcontent">
<h:form>
<p:panel header="Consumption">
<h:panelGrid columns="8" class="w-100">
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText value="" styleClass="fa ml-5"/>
<p:outputLabel value="From Date" for="fromDate" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:calendar
class="w-100"
inputStyleClass="w-100"
id="fromDate"
value="#{pharmacyController.fromDate}"
pattern="#{sessionController.applicationPreference.longDateTimeFormat}"/>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText value="" styleClass="fa ml-5"/>
<p:outputLabel value="To Date" for="toDate" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:calendar
class="w-100"
inputStyleClass="w-100"
id="toDate"
value="#{pharmacyController.toDate}"
pattern="#{sessionController.applicationPreference.longDateTimeFormat}"/>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-building ml-5"/>
<p:outputLabel value="Item Department Type" for="departmentTypeFilter" class="mx-3"/>
</h:panelGroup>
<h:panelGroup layout="block" styleClass="form-group">
<p:selectCheckboxMenu
id="departmentTypeFilter"
value="#{pharmacyController.selectedDepartmentTypes}"
label="Select Department Types"
class="w-100"
filter="true"
filterMatchMode="contains"
showHeader="true"
scrollHeight="200"
title="Select one or more department types to filter results. Leave empty to include all.">
<f:selectItems
value="#{pharmacyController.availableDepartmentTypes}"
var="depType"
itemLabel="#{depType.label}"
itemValue="#{depType}"/>
</p:selectCheckboxMenu>
<p:tooltip for="departmentTypeFilter" value="Select one or more department types to filter results. Leave empty to include all." position="top"/>
</h:panelGroup>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-university ml-5"/>
<p:outputLabel value="Institution" for="phmIns" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmIns"
class="w-100"
value="#{pharmacyController.institution}"
filter="true">
<f:selectItem itemLabel="All Institutions"/>
<f:selectItems value="#{institutionController.companies}" var="ins" itemLabel="#{ins.name}"
itemValue="#{ins}"/>
<p:ajax process="phmIns" update="phmDept"/>
</p:selectOneMenu>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-map-marker-alt ml-5"/>
<p:outputLabel value="Site" for="phmSite" class="mx-3"/>
</h:panelGroup>
<p:selectOneMenu
id="phmSite"
class="w-100"
value="#{pharmacyController.site}"
filter="true">
<f:selectItem itemLabel="All Sites"/>
<f:selectItems value="#{institutionController.sites}" var="site" itemLabel="#{site.name}"
itemValue="#{site}"/>
<p:ajax process="phmSite" update="phmDept"/>
</p:selectOneMenu>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-building ml-5"/>
<p:outputLabel value="Department" for="phmDept" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmDept"
class="w-100"
value="#{pharmacyController.dept}"
filter="true">
<f:selectItem itemLabel="All Departments"/>
<f:selectItems
value="#{departmentController.getDepartmentsOfInstitutionAndSite(pharmacyController.institution, pharmacyController.site)}"
var="dept"
itemLabel="#{dept.name}"
itemValue="#{dept}"/>
</p:selectOneMenu>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-tags ml-5"/>
<p:outputLabel value="Category" for="phmCategory" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmCategory"
value="#{pharmacyController.category}"
filter="true"
class="w-100 ">
<f:selectItem itemLabel="All Categories"/>
<f:selectItems value="#{pharmaceuticalItemCategoryController.items}"
var="category"
itemLabel="#{category.name}"
itemValue="#{category}"/>
</p:selectOneMenu>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-capsules ml-5"/>
<p:outputLabel value="Dosage Form" for="phmDf" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu
id="phmDf"
value="#{pharmacyController.dosageForm}"
class="w-100"
filter="true"
filterMatchMode="contains">
<f:selectItem itemLabel="All Dosage Forms"/>
<f:selectItems value="#{dosageFormController.items}" var="df" itemLabel="#{df.name}" itemValue="#{df}"/>
</p:selectOneMenu>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-box ml-5"/>
<p:outputLabel value="Item" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:autoComplete value="#{pharmacyController.item}"
inputStyleClass="w-100"
class="w-100"
completeMethod="#{itemController.completeAmpItemAll}"
var="item" itemValue="#{item}" itemLabel="#{item.name}"
forceSelection="true">
<p:column headerText="Item">
<h:outputLabel value="#{item.name}"/>
</p:column>
<p:column headerText="Code">
<h:outputLabel value="#{item.code}"/>
</p:column>
</p:autoComplete>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-list-alt ml-5"/>
<p:outputLabel value="Report Type" class="mx-3" for="grnReportType">
</p:outputLabel>
</h:panelGroup>
<p:selectOneMenu class="w-100" id="grnReportType" value="#{pharmacyController.reportType}">
<f:selectItem itemLabel="Summary" itemValue="summeryReport"/>
<f:selectItem itemLabel="By Bill" itemValue="byBill"/>
<f:selectItem itemLabel="By Bill Item" itemValue="byBillItem"/>
<f:selectItem itemLabel="By Category"
itemValue="categoryWise"/>
</p:selectOneMenu>
<p:spacer width="20"/>
<h:panelGroup layout="block" styleClass="form-group">
<h:outputText styleClass="fa fa-barcode ml-5"/>
<p:outputLabel value="Consumption Department" for="phmCde" class="mx-3">
</p:outputLabel>
</h:panelGroup>
<p:autoComplete value="#{pharmacyController.toDepartment}"
inputStyleClass="w-100"
id="phmCde"
class="w-100"
completeMethod="#{departmentController.completeDept}"
var="i" itemValue="#{i}" itemLabel="#{i.name}"
forceSelection="true">
<p:column headerText="Department">
<h:outputLabel value="#{i.name}"/>
</p:column>
</p:autoComplete>
</h:panelGrid>
<div class="d-flex align-items-center mt-3">
<p:commandButton class="ui-button-warning mx-1"
icon="fas fa-cogs"
ajax="false"
value="Process"
action="#{pharmacyController.createConsumptionReportTable()}">
</p:commandButton>
<p:commandButton class="ui-button- mx-1" icon="fas fa-print" ajax="false" value="Print All"
rendered="#{pharmacyController.reportType eq 'summeryReport' or pharmacyController.reportType eq null or empty pharmacyController.reportType}"
onclick="hidePaginatorBeforePrint()">
<p:printer target="tbl1" oncomplete="restorePaginatorAfterPrint()"/>
</p:commandButton>
<p:commandButton class="ui-button- mx-1" icon="fas fa-print" ajax="false" value="Print All"
rendered="#{pharmacyController.reportType eq 'byBill'}"
onclick="hidePaginatorBeforePrint()">
<p:printer target="tblListBills" oncomplete="restorePaginatorAfterPrint()"/>
</p:commandButton>
<p:commandButton class="ui-button- mx-1" icon="fas fa-print" ajax="false" value="Print All"
rendered="#{pharmacyController.reportType eq 'byBillItem'}"
onclick="hidePaginatorBeforePrint()">
<p:printer target="tblListBillItems" oncomplete="restorePaginatorAfterPrint()"/>
</p:commandButton>
<p:commandButton class="ui-button- mx-1" icon="fas fa-print" ajax="false" value="Print All"
rendered="#{pharmacyController.reportType eq 'categoryWise'}"
onclick="hidePaginatorBeforePrint()">
<p:printer target="tblCategory" oncomplete="restorePaginatorAfterPrint()"/>
</p:commandButton>
<h:outputScript>
function hidePaginatorBeforePrint() {
let paginators = document.querySelectorAll('.ui-paginator');
paginators.forEach(el => el.style.display = 'none');
}
function restorePaginatorAfterPrint() {
let paginators = document.querySelectorAll('.ui-paginator');
paginators.forEach(el => el.style.display = '');
}
window.onafterprint = function () {
restorePaginatorAfterPrint();
};
</h:outputScript>
<p:commandButton class="ui-button-success mx-1" icon="fas fa-file-excel" ajax="false"
value="Download"
rendered="#{pharmacyController.reportType eq 'summeryReport' or pharmacyController.reportType eq null or empty pharmacyController.reportType}"
action="#{pharmacyController.exportConsumptionReportSummaryToExcel()}">
</p:commandButton>
<p:commandButton class="ui-button-success mx-1" icon="fas fa-file-excel" ajax="false"
value="Download" rendered="#{pharmacyController.reportType eq 'byBill'}">
<p:dataExporter type="xlsx" target="tblListBills"
fileName="#{pharmacyController.generateFileNameForReport('Consumption')}"
postProcessor="#{pharmacyController.postProcessConsumptionByBillExcel}"/>
</p:commandButton>
<p:commandButton class="ui-button-success mx-1" icon="fas fa-file-excel" ajax="false"
value="Download" rendered="#{pharmacyController.reportType eq 'byBillItem'}">
<p:dataExporter type="xlsx" target="tblListBillItems"
fileName="#{pharmacyController.generateFileNameForReport('Consumption')}"/>
</p:commandButton>
<p:commandButton class="ui-button-success mx-1" icon="fas fa-file-excel" ajax="false"
value="Download" rendered="#{pharmacyController.reportType eq 'categoryWise'}"
action="#{pharmacyController.exportConsumptionReportCategoryWiseToExcel()}"/>
<p:commandButton class="ui-button-danger mx-1" icon="fas fa-file-pdf" ajax="false" value="PDF"
rendered="#{pharmacyController.reportType eq 'summeryReport' or pharmacyController.reportType eq null or empty pharmacyController.reportType}"
action="#{pharmacyController.exportConsumptionReportSummaryToPdf()}">
</p:commandButton>
<p:commandButton class="ui-button-danger mx-1" icon="fas fa-file-pdf" ajax="false" value="PDF"
rendered="#{pharmacyController.reportType eq 'byBill'}"
action="#{pharmacyController.exportConsumptionReportByBillToPdf()}">
</p:commandButton>
<p:commandButton class="ui-button-danger mx-1" icon="fas fa-file-pdf" ajax="false" value="PDF"
rendered="#{pharmacyController.reportType eq 'byBillItem'}">
<p:dataExporter type="pdf" target="tblListBillItems"
fileName="#{pharmacyController.generateFileNameForReport('Consumption')}"/>
</p:commandButton>
<p:commandButton class="ui-button-danger mx-1" icon="fas fa-file-pdf" ajax="false" value="PDF"
rendered="#{pharmacyController.reportType eq 'categoryWise'}"
action="#{pharmacyController.exportConsumptionReportCategoryWiseToPdf()}">
</p:commandButton>
</div>
<h:panelGroup rendered="#{pharmacyController.reportType eq 'summeryReport' and (pharmacyController.totalPurchase != 0 or pharmacyController.totalCostValue != 0 or pharmacyController.totalRetailValue != 0 or pharmacyController.totalSaleValue != 0)}" id="tbl1">
<h5 class="mt-3">Department Summary</h5>
<h:panelGroup layout="block" styleClass="mb-3 p-2" style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; font-size: 0.9em;">
<h:panelGroup layout="block">
<strong>From: </strong>
<h:outputText value="#{pharmacyController.fromDate}">
<f:convertDateTime pattern="#{sessionController.applicationPreference.longDateTimeFormat}"/>
</h:outputText>
<strong class="ml-3">To: </strong>
<h:outputText value="#{pharmacyController.toDate}">
<f:convertDateTime pattern="#{sessionController.applicationPreference.longDateTimeFormat}"/>
</h:outputText>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.institution ne null}">
<strong>Institution: </strong>
<h:outputText value="#{pharmacyController.institution.name}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.site ne null}">
<strong>Site: </strong>
<h:outputText value="#{pharmacyController.site.name}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.dept ne null}">
<strong>Department: </strong>
<h:outputText value="#{pharmacyController.dept.name}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.category ne null}">
<strong>Category: </strong>
<h:outputText value="#{pharmacyController.category.name}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.dosageForm ne null}">
<strong>Dosage Form: </strong>
<h:outputText value="#{pharmacyController.dosageForm.name}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.item ne null}">
<strong>Item: </strong>
<h:outputText value="#{pharmacyController.item.name}"/>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{pharmacyController.toDepartment ne null}">
<strong>Consumption Department: </strong>
<h:outputText value="#{pharmacyController.toDepartment.name}"/>
</h:panelGroup>
</h:panelGroup>
<ui:repeat value="#{pharmacyController.departmentTotals.entrySet()}" var="map"
varStatus="status">
<p:dataTable id="tblSummary" value="#{map.value.entrySet()}" var="entry"
rowIndexVar="n" rowKey="#{entry.key}" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="Showing {startRecord} to {endRecord} of {totalRecords}">
<f:facet name="header">
<h:outputLabel value="Department" rendered="#{status.first}"/>
</f:facet>
<p:column headerText="#{map.key}"
filterBy="#{entry.key}"
filterMatchMode="contains">
<h:outputLabel value="#{entry.key}"/>
</p:column>
<p:column headerText="Purchase Value" style="text-align: right">
<h:outputLabel value="#{entry.value[0]}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</p:column>
<p:column headerText="Cost Value" style="text-align: right">
<h:outputLabel value="#{entry.value[1]}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</p:column>
<p:column headerText="Retail Value" style="text-align: right">
<h:outputLabel value="#{entry.value[2]}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</p:column>
<p:column headerText="Net Total" style="text-align: right">
<h:outputLabel value="#{entry.value[3]}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</p:column>
<p:columnGroup type="footer">
<p:row rendered="#{status.last}">
<p:column colspan="1">
<f:facet name="footer">
<h:outputLabel value="Total" style="font-weight: bold;"/>
</f:facet>
</p:column>
<p:column style="text-align: right; font-weight: bold;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalPurchase}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
<p:column style="text-align: right; font-weight: bold;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalCostValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
<p:column style="text-align: right; font-weight: bold;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalRetailValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
<p:column style="text-align: right; font-weight: bold;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalSaleValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
</p:row>
</p:columnGroup>
</p:dataTable>
</ui:repeat>
</h:panelGroup>
<!-- No data message for Summary report -->
<h:panelGroup rendered="#{pharmacyController.reportType eq 'summeryReport' and pharmacyController.totalPurchase == 0 and pharmacyController.totalCostValue == 0 and pharmacyController.totalRetailValue == 0 and pharmacyController.totalSaleValue == 0}">
<div class="ui-messages ui-widget ui-corner-all ui-messages-info ui-messages-noicon" style="margin-top: 20px;">
<div class="ui-messages-info-summary">No data found for the selected criteria.</div>
</div>
</h:panelGroup>
<h:panelGroup rendered="#{pharmacyController.reportType eq 'byBill'}">
<h5 class="mt-3">Department unit issue by Bill No</h5>
<p:dataTable
id="tblListBills"
value="#{pharmacyController.pharmacyRows}"
var="b"
rowIndexVar="n"
paginator="true"
rows="10"
paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="Showing {startRecord} to {endRecord} of {totalRecords}"
rowsPerPageTemplate="5,10,15,25,50,100,500,1000">
<p:column
headerText="Bill No"
width="10em"
filterMatchMode="contains"
sortBy="#{b.bill.deptId}"
filterBy="#{b.bill.deptId}">
<h:outputText value="#{b.bill.deptId}"/>
</p:column>
<p:column
headerText="Consumption Department"
width="10em"
filterMatchMode="contains"
sortBy="#{b.bill.toDepartment.name}"
filterBy="#{b.bill.toDepartment.name}">
<h:outputText value="#{b.bill.toDepartment.name}"/>
</p:column>
<p:column
headerText="Request No"
width="6em"
filterMatchMode="contains"
sortBy="#{b.bill.invoiceNumber}"
filterBy="#{b.bill.invoiceNumber}">
<h:outputText value="#{b.bill.invoiceNumber}"/>
</p:column>
<p:column headerText="Status/Links" width="10em">
<!-- Show status if this bill is cancelled or returned -->
<h:panelGroup rendered="#{b.bill.cancelled}">
<h:outputText value="CANCELLED" style="color: red; font-weight: bold; display: block;" />
</h:panelGroup>
<h:panelGroup rendered="#{b.bill.fullReturned}">
<h:outputText value="RETURNED" style="color: orange; font-weight: bold; display: block;" />
</h:panelGroup>
<!-- If this bill has been cancelled, show link to cancellation bill -->
<h:panelGroup rendered="#{b.bill.cancelledBill != null}" styleClass="d-block mt-1">
<h:outputText value="Cancel: #{b.bill.cancelledBill.deptId}" style="color: red;"/>
<p:commandButton
title="View Cancellation Bill"
ajax="false"
styleClass="mx-1 ui-button-sm"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(b.bill.cancelledBill.id)}" />
</h:panelGroup>
<!-- If this bill has been returned, show link to return bill -->
<h:panelGroup rendered="#{b.bill.refundedBill != null}" styleClass="d-block mt-1">
<h:outputText value="Return: #{b.bill.refundedBill.deptId}" style="color: orange;"/>
<p:commandButton
title="View Return Bill"
ajax="false"
styleClass="mx-1 ui-button-sm"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(b.bill.refundedBill.id)}" />
</h:panelGroup>
<!-- If this is a cancellation/return bill, show link to original bill -->
<h:panelGroup rendered="#{b.bill.billedBill != null}" styleClass="d-block mt-1">
<h:outputText value="Original: #{b.bill.billedBill.deptId}" style="color: blue;"/>
<p:commandButton
title="View Original Bill"
ajax="false"
styleClass="mx-1 ui-button-sm ui-button-info"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(b.bill.billedBill.id)}" />
</h:panelGroup>
</p:column>
<p:column
exportable="false"
headerText="Action" width="5em">
<p:commandButton
id="btnViewBill"
title="View Bill"
ajax="false"
styleClass="mx-1 ui-button-sm"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(b.bill.id)}" />
</p:column>
<p:column
headerText="Purchase Value"
width="4em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{b.consumptionPurchaseValue}">
<h:outputText value="#{b.consumptionPurchaseValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalPurchase}">
<f:convertNumber pattern="#,##0.00"/></h:outputLabel>
</f:facet>
</p:column>
<p:column
headerText="Cost Value"
width="4em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{b.consumptionCostValue}">
<h:outputText value="#{b.consumptionCostValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalCostValue}">
<f:convertNumber pattern="#,##0.00"/></h:outputLabel>
</f:facet>
</p:column>
<p:column
headerText="Retail Value"
width="4em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{b.consumptionRetailValue}">
<h:outputText value="#{b.consumptionRetailValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalRetailValue}">
<f:convertNumber pattern="#,##0.00"/></h:outputLabel>
</f:facet>
</p:column>
<p:column
headerText="Created Date and Time"
width="6em"
filterMatchMode="contains"
sortBy="#{b.bill.createdAt}"
filterBy="#{pharmacyController.formatDate(b.bill.createdAt)}">
<h:outputText value="#{b.bill.createdAt}">
<f:convertDateTime
pattern="#{sessionController.applicationPreference.longDateTimeFormat}"/>
</h:outputText>
</p:column>
<p:column headerText="Document Created By" width="10em">
<h:outputText value="#{b.bill.creater.webUserPerson.name}"/>
</p:column>
<p:column headerText="Remarks" width="10em">
<h:outputText value="#{b.bill.comments}"/>
</p:column>
</p:dataTable>
</h:panelGroup>
<h:panelGroup rendered="#{pharmacyController.reportType eq 'byBillItem'}">
<h5 class="mt-3"> Department unit issue by Bill Item</h5>
<p:dataTable
id="tblListBillItems"
value="#{pharmacyController.pharmacyRows}"
var="i"
rowIndexVar="n"
rowKey="#{i.id}"
paginator="true"
rows="10"
paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="Showing {startRecord} to {endRecord} of {totalRecords}"
rowsPerPageTemplate="5,10,15,25,50,100,500,1000">
<p:column headerText="No" width="2em">
<p:outputLabel value="#{n+1}"/>
</p:column>
<p:column
headerText="Bill No"
width="6em"
filterMatchMode="contains"
sortBy="#{i.billItem.bill.deptId}"
filterBy="#{i.billItem.bill.deptId}">
<p:outputLabel value="#{i.billItem.bill.deptId}"/>
</p:column>
<p:column
headerText="Request No"
width="6em"
filterMatchMode="contains"
sortBy="#{i.billItem.bill.invoiceNumber}"
filterBy="#{i.billItem.bill.invoiceNumber}">
<p:outputLabel value="#{i.billItem.bill.invoiceNumber}"/>
</p:column>
<p:column
headerText="Consumption Department"
width="10em"
filterMatchMode="contains"
sortBy="#{i.billItem.bill.toDepartment.name}"
filterBy="#{i.billItem.bill.toDepartment.name}">
<p:outputLabel value="#{i.billItem.bill.toDepartment.name}"/>
</p:column>
<p:column
headerText="Item"
width="6em"
filterMatchMode="contains"
sortBy="#{i.billItem.item.name}"
filterBy="#{i.billItem.item.name}">
<p:outputLabel value="#{i.billItem.item.name}"/>
</p:column>
<p:column
headerText="Item Category"
width="6em"
filterMatchMode="contains"
sortBy="#{i.billItem.item.category.name}"
filterBy="#{i.billItem.item.category.name}">
<p:outputLabel value="#{i.billItem.item.category.name}"/>
</p:column>
<p:column
headerText="Dosage Form"
width="6em"
filterMatchMode="contains"
sortBy="#{i.billItem.item.dosageForm.name}"
filterBy="#{i.billItem.item.dosageForm.name}">
<p:outputLabel value="#{i.billItem.item.dosageForm.name}"/>
</p:column>
<p:column
headerText="Quantity"
width="4em"
style="text-align: right; padding-right: 20px;"
filterMatchMode="contains"
sortBy="#{i.consumptionQty}"
filterBy="#{i.consumptionQty}">
<p:outputLabel value="#{i.consumptionQty}"/>
</p:column>
<p:column headerText="Status/Links" width="10em" exportable="false">
<!-- Show status if this bill is cancelled or returned -->
<h:panelGroup rendered="#{i.billItem.bill.cancelled}">
<h:outputText value="CANCELLED" style="color: red; font-weight: bold; display: block;" />
</h:panelGroup>
<h:panelGroup rendered="#{i.billItem.bill.fullReturned}">
<h:outputText value="RETURNED" style="color: orange; font-weight: bold; display: block;" />
</h:panelGroup>
<!-- If this bill has been cancelled, show link to cancellation bill -->
<h:panelGroup rendered="#{i.billItem.bill.cancelledBill != null}" styleClass="d-block mt-1">
<h:outputText value="Cancel: #{i.billItem.bill.cancelledBill.deptId}" style="color: red;"/>
<p:commandButton
title="View Cancellation Bill"
ajax="false"
styleClass="mx-1 ui-button-sm"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(i.billItem.bill.cancelledBill.id)}" />
</h:panelGroup>
<!-- If this bill has been returned, show link to return bill -->
<h:panelGroup rendered="#{i.billItem.bill.refundedBill != null}" styleClass="d-block mt-1">
<h:outputText value="Return: #{i.billItem.bill.refundedBill.deptId}" style="color: orange;"/>
<p:commandButton
title="View Return Bill"
ajax="false"
styleClass="mx-1 ui-button-sm"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(i.billItem.bill.refundedBill.id)}" />
</h:panelGroup>
<!-- If this is a cancellation/return bill, show link to original bill -->
<h:panelGroup rendered="#{i.billItem.bill.billedBill != null}" styleClass="d-block mt-1">
<h:outputText value="Original: #{i.billItem.bill.billedBill.deptId}" style="color: blue;"/>
<p:commandButton
title="View Original Bill"
ajax="false"
styleClass="mx-1 ui-button-sm ui-button-info"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillId(i.billItem.bill.billedBill.id)}" />
</h:panelGroup>
</p:column>
<p:column headerText="Action" width="5em" exportable="false">
<p:commandButton
id="btnViewBill"
title="View Bill"
ajax="false"
styleClass="mx-1 ui-button-sm"
icon="pi pi-eye"
action="#{billSearch.navigateToViewBillByAtomicBillTypeByBillItemId(i.billItem.id)}" />
</p:column>
<p:column
headerText="Purchase Rate"
width="6em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{i.billItem.billItemFinanceDetails.purchaseRate}">
<p:outputLabel value="#{i.billItem.billItemFinanceDetails.purchaseRate}">
<f:convertNumber pattern="#,##0.00"/>
</p:outputLabel>
</p:column>
<p:column
headerText="Purchase Value"
width="6em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{i.consumptionPurchaseValue}">
<p:outputLabel value="#{i.consumptionPurchaseValue}">
<f:convertNumber pattern="#,##0.00"/>
</p:outputLabel>
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalPurchase}">
<f:convertNumber pattern="#,##0.00"/></h:outputLabel>
</f:facet>
</p:column>
<p:column
headerText="Retail Rate"
width="6em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{i.billItem.billItemFinanceDetails.retailSaleRate}">
<p:outputLabel value="#{i.billItem.billItemFinanceDetails.retailSaleRate}">
<f:convertNumber pattern="#,##0.00"/>
</p:outputLabel>
</p:column>
<p:column
headerText="Retail Value"
width="6em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{i.consumptionRetailValue}">
<p:outputLabel value="#{i.consumptionRetailValue}">
<f:convertNumber pattern="#,##0.00"/>
</p:outputLabel>
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalRetailValue}">
<f:convertNumber pattern="#,##0.00"/></h:outputLabel>
</f:facet>
</p:column>
<p:column
headerText="Cost Rate"
width="6em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{i.billItem.billItemFinanceDetails.costRate}">
<p:outputLabel value="#{i.billItem.billItemFinanceDetails.costRate}">
<f:convertNumber pattern="#,##0.00"/>
</p:outputLabel>
</p:column>
<p:column
headerText="Cost Value"
width="6em"
style="text-align: right;"
filterMatchMode="contains"
sortBy="#{i.consumptionCostValue}">
<p:outputLabel value="#{i.consumptionCostValue}">
<f:convertNumber pattern="#,##0.00"/>
</p:outputLabel>
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalCostValue}">
<f:convertNumber pattern="#,##0.00"/></h:outputLabel>
</f:facet>
</p:column>
<p:column
headerText="Created At"
width="8em"
filterMatchMode="contains"
sortBy="#{i.billItem.bill.createdAt}"
filterBy="#{pharmacyController.formatDate(i.billItem.bill.createdAt)}">
<p:outputLabel value="#{i.billItem.bill.createdAt}">
<f:convertDateTime
pattern="#{sessionController.applicationPreference.longDateTimeFormat}"/>
</p:outputLabel>
</p:column>
<p:column headerText="User" width="8em">
<p:outputLabel value="#{i.billItem.bill.creater.webUserPerson.name}">
</p:outputLabel>
</p:column>
<p:column headerText="Remarks" width="10em">
<p:outputLabel value="#{i.billItem.bill.comments}"/>
</p:column>
</p:dataTable>
</h:panelGroup>
<h:panelGroup
rendered="#{pharmacyController.reportType eq 'categoryWise'}"
id="tblCategory">
<h5 class="mt-3">Category Wise Issue Details by Department</h5>
<ui:repeat value="#{pharmacyController.departmentCategoryMap.entrySet()}" var="map"
varStatus="status">
<p:dataTable id="itblCategory"
value="#{map.value.entrySet()}"
var="entry"
rowIndexVar="n"
rowKey="#{entry.key}"
rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="Showing {startRecord} to {endRecord} of {totalRecords}">
<p:columnGroup type="header">
<p:row style="background: #e5e9ec" rendered="#{status.first}">
<p:column headerText="Department Unit"
style="font-weight: bold; background: #e5e9ec" colspan="7"/>
</p:row>
<p:row style="background: #70a4ca">
<p:column headerText="#{map.key}" style="font-weight: bold; background: #70a4ca"
colspan="3"/>
<p:column
headerText="#{pharmacyController.getDepartmentPurchaseTotalForConsumptionReport(map.key)}"
style="font-weight: bold; background: #70a4ca; text-align: right;"/>
<p:column
headerText="#{pharmacyController.getDepartmentCostTotalForConsumptionReport(map.key)}"
style="font-weight: bold; background: #70a4ca; text-align: right;"/>
<p:column
headerText="#{pharmacyController.getDepartmentRetailTotalForConsumptionReport(map.key)}"
style="font-weight: bold; background: #70a4ca; text-align: right;"/>
<p:column
headerText="#{pharmacyController.getDepartmentNetTotalForConsumptionReport(map.key)}"
style="font-weight: bold; background: #70a4ca; text-align: right;"/>
</p:row>
<p:row>
<p:column headerText="Category" style="font-weight: bold;"/>
<p:column headerText="Issues" style="font-weight: bold;"/>
<p:column headerText="" style="font-weight: bold;" colspan="4"/>
</p:row>
<p:row>
<p:column headerText="" style="font-weight: bold;"/>
<p:column headerText="Qty" style="font-weight: bold;"/>
<p:column headerText="Purchase Value" style="font-weight: bold;"/>
<p:column headerText="Cost Value" style="font-weight: bold;"/>
<p:column headerText="Retail Value" style="font-weight: bold;"/>
<p:column headerText="Net Total" style="font-weight: bold;"/>
</p:row>
</p:columnGroup>
<p:subTable value="#{entry.value}" var="item">
<p:columnGroup type="header">
<p:row>
<p:column headerText="#{entry.key}" style="font-weight: bold;" colspan="2"/>
<p:column
headerText="#{pharmacyController.getCategoryPurchaseTotalForConsumptionReport(map.key, entry.key)}"
style="font-weight: bold; text-align: right;"/>
<p:column
headerText="#{pharmacyController.getCategoryCostTotalForConsumptionReport(map.key, entry.key)}"
style="font-weight: bold; text-align: right;"/>
<p:column
headerText="#{pharmacyController.getCategoryRetailTotalForConsumptionReport(map.key, entry.key)}"
style="font-weight: bold; text-align: right;"/>
<p:column
headerText="#{pharmacyController.getCategoryNetTotalForConsumptionReport(map.key, entry.key)}"
style="font-weight: bold; text-align: right;"/>
</p:row>
</p:columnGroup>
<p:column headerText="Item Name">
<h:outputText value="#{item.item.name}"/>
</p:column>
<p:column headerText="Quantity">
<h:outputText value="#{item.qty}"/>
</p:column>
<p:column headerText="Purchase Value" style="text-align: right;">
<h:outputText value="#{item.totalPurchaseValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
</p:column>
<p:column headerText="Cost Value" style="text-align: right;">
<h:outputText value="#{item.totalCostValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
</p:column>
<p:column headerText="Retail Value" style="text-align: right;">
<h:outputText value="#{item.totalRetailValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
</p:column>
<p:column headerText="Net Total" style="text-align: right;">
<h:outputText value="#{item.netTotal}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputText>
</p:column>
</p:subTable>
<p:columnGroup type="footer" rendered="#{status.last}">
<p:row>
<p:column colspan="2">
<f:facet name="footer">
<h:outputLabel value="Total" style="font-weight: bold;"/>
</f:facet>
</p:column>
<p:column style="font-weight: bold; text-align: right;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalPurchase}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
<p:column style="font-weight: bold; text-align: right;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalCostValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
<p:column style="font-weight: bold; text-align: right;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalRetailValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
<p:column style="font-weight: bold; text-align: right;">
<f:facet name="footer">
<h:outputLabel value="#{pharmacyController.totalSaleValue}">
<f:convertNumber pattern="#,##0.00"/>
</h:outputLabel>
</f:facet>
</p:column>
</p:row>
</p:columnGroup>
</p:dataTable>
</ui:repeat>
</h:panelGroup>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>