Skip to content

Commit

Permalink
Merge pull request #9925 from hmislk/Issue##9923_Pharmacy_retail_bill…
Browse files Browse the repository at this point in the history
…_print

Issue##9923 pharmacy retail bill print
  • Loading branch information
buddhika75 authored Dec 30, 2024
2 parents 8d51f3e + 2ebe440 commit 0dd9e71
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 103 deletions.
11 changes: 7 additions & 4 deletions src/main/java/com/divudi/bean/emr/DataUploadController.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@ public String importToExcelWithStock() {
Date doe;
StringBuilder warningMessages = new StringBuilder();

int rowCount = 0;

try (InputStream in = file.getInputStream(); Workbook workbook = new XSSFWorkbook(in)) {
rowCount++;
System.out.println("rowCount at Start of a row= " + rowCount);
Sheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIterator = sheet.iterator();

Expand All @@ -434,7 +438,7 @@ public String importToExcelWithStock() {
int rowIndex = 0;
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
System.out.println("row = " + row);
// System.out.println("row = " + row);
if (rowIndex++ < startRow) {
continue; // Skip header or initial rows as per the startRow value
}
Expand Down Expand Up @@ -573,7 +577,7 @@ public String importToExcelWithStock() {
getPharmacyPurchaseController().getCurrentBillItem().getPharmaceuticalBillItem().setStringValue(batch);
}
getPharmacyPurchaseController().addItem();

System.out.println("rowCount at End of a row= " + rowCount);
}
if (warningMessages.length() > 0) {
getPharmacyPurchaseController().setWarningMessage(warningMessages.toString());
Expand Down Expand Up @@ -2263,7 +2267,6 @@ public List<Patient> readMembersFromExcel(InputStream inputStream) throws IOExce
while (rowIterator.hasNext()) {
Row row = rowIterator.next();


String name = row.getCell(1).getStringCellValue();
String titleString = row.getCell(2).getStringCellValue();
String sexString = row.getCell(3).getStringCellValue();
Expand Down Expand Up @@ -2306,7 +2309,7 @@ public List<Patient> readMembersFromExcel(InputStream inputStream) throws IOExce
family.getFamilyMembers().add(fm);
family.setChiefHouseHolder(pt);
familyFacade.edit(family);

patients.add(pt);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ public void addItemWithLastRate() {
}

public void addItem() {
System.out.println("add item = ");
if (getBill().getId() == null) {
getBillFacade().create(getBill());
}
Expand Down Expand Up @@ -674,6 +675,8 @@ public void addItem() {
getCurrentBillItem().getPharmaceuticalBillItem().setFreeQty(getCurrentBillItem().getPharmaceuticalBillItem().getFreeQtyPacks() * getCurrentBillItem().getItem().getDblValue());
getCurrentBillItem().getPharmaceuticalBillItem().setPurchaseRate(getCurrentBillItem().getPharmaceuticalBillItem().getPurchaseRatePack() / getCurrentBillItem().getItem().getDblValue());
}

System.out.println("getBillItems().size() = " + getBillItems().size());

getCurrentBillItem().setSearialNo(getBillItems().size());
getBillItems().add(currentBillItem);
Expand Down
53 changes: 0 additions & 53 deletions src/main/webapp/admin/users/tmp.xhtml

This file was deleted.

6 changes: 5 additions & 1 deletion src/main/webapp/pharmacy/pharmacy_purchase.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,14 @@
<h:outputText class="mx-4" value="Ordered Items" />
</f:facet>

<p:column headerText="No" width="2em">
<h:outputLabel value="#{i+1}">
</h:outputLabel>
</p:column>

<p:column headerText="Item Name" styleClass="#{ph.item.category.profitMargin > ((ph.pharmaceuticalBillItem.retailRate - ph.pharmaceuticalBillItem.purchaseRate) / ph.pharmaceuticalBillItem.purchaseRate)*100 ? 'ui-messages-fatal' : ''}">
<h:outputLabel id="item" value="#{ph.item.name} - #{ph.item.code}" style="width:100%">
</h:outputLabel>

</p:column>

<p:column headerText="Qty" style="width:8em; padding: 0px;" styleClass="#{ph.item.category.profitMargin > ((ph.pharmaceuticalBillItem.retailRate - ph.pharmaceuticalBillItem.purchaseRate) / ph.pharmaceuticalBillItem.purchaseRate)*100 ? 'ui-messages-fatal' : ''}">
Expand Down
131 changes: 86 additions & 45 deletions src/main/webapp/resources/css/sale_bill_five_five_custom_3.css
Original file line number Diff line number Diff line change
@@ -1,87 +1,128 @@
/* Styles specific to the receipt composite component */
/* General Container */
.receipt-container {
font-family: monospace;
font-size: 10px;
font-family: "Courier New", "Liberation Mono", monospace;
font-size: 12px;
line-height: 1.4;
width: 12cm;
height: auto;
height: 14cm;
margin: auto;
padding: 10px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
border: 1px solid #000;
}

.receipt-header {
/* Header */
.hospital-name {
text-align: center;
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
font-size: 16px; /* Larger font for hospital name */
text-transform: uppercase;
}

hr {
border: none;
border-top: 1px dashed black;
margin: 5px 0;
.hospital-details {
text-align: center;
font-size: 12px; /* Smaller font for address, phone, and email */
}

.bill-details, .payment-summary, .footer {
/* Line Separator */
.separator {
border-top: 1px solid #000;
margin: 10px 0;
}

/* Patient and Bill Info Table */
.info-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10px;
}

.key-value {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
.info-table td {
font-size: 12px;
padding: 5px;
}

.key-value span:first-child {
.info-table .label {
font-weight: bold;
text-align: left;
}

.key-value span:last-child {
text-align: right;
.info-table .value {
text-align: left;
}

.info-table .spacer {
width: 10px; /* Adds space between the two columns */
}

/* Table styles */
table {
/* Item Table */
.receipt-table {
width: 100%;
border-collapse: collapse;
font-size: 12px;
margin-bottom: 10px;
}

.receipt-table th,
.receipt-table td {
text-align: left;
padding: 5px;
border-bottom: 1px solid #000;
}

.receipt-table th {
font-weight: bold;
text-transform: uppercase;
}

/* Total Section Table */
.total-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
font-size: 12px;
}

table th, table td {
.total-table td {
padding: 5px;
text-align: left;
}

table th:nth-child(3),
table th:nth-child(4),
table th:nth-child(5),
table td:nth-child(3),
table td:nth-child(4),
table td:nth-child(5) {
text-align: right;
.total-table .label {
font-weight: bold;
text-align: left;
}

.payment-summary {
display: flex;
flex-direction: column;
.total-table .value {
text-align: right;
font-weight: bold;
}

.footer {
margin-top: auto;
/* Footer */
.receipt-footer {
text-align: center;
font-size: 12px;
margin-top: 20px;
font-style: italic;
}

/* Print-specific styles */
/* Print Styles */
@media print {
.receipt-container {
margin: 0;
padding: 0;
width: 100%;
height: auto;
border: none;
width: 12cm;
height: 14cm;
}

.hospital-name {
font-size: 14px;
}

.receipt-table th,
.receipt-table td {
border-bottom: 1px solid #000;
}

hr {
border-top: 1px dashed black;
.separator {
margin: 5px 0;
}
}
Loading

0 comments on commit 0dd9e71

Please sign in to comment.