fixed comments

pull/14/head
Usama Khan 2025-03-04 22:02:24 -08:00
parent 78c1d7682f
commit 79d47a66b0
5 changed files with 10 additions and 85 deletions

View File

@ -177,7 +177,7 @@ public class JobCardController {
} }
@GetMapping( value = "/pdf/{id}", produces = MediaType.APPLICATION_PDF_VALUE ) @GetMapping( value = "/pdf/{id}", produces = MediaType.APPLICATION_PDF_VALUE )
public ResponseEntity<InputStreamResource> showGinReceivingPDF(@PathVariable long id, Model model ) throws Exception { public ResponseEntity<InputStreamResource> generateJobCardPdf(@PathVariable long id, Model model ) throws Exception {
return jobCardService.getJobCardReceivingPdf(id,model); return jobCardService.getJobCardReceivingPdf(id,model);
} }

View File

@ -311,30 +311,28 @@ public class JobCardService {
public Map<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){ public Map<Long, Long> totalFinishItem(List<Long> itemIds, long jobCardId ){
return finishedItemDAO.findTotalFinishedItems( itemIds, jobCardId ); return finishedItemDAO.findTotalFinishedItems( itemIds, jobCardId );
} }
/** /**
* Print Job card * * Print Job card *
* **/ * **/
public ResponseEntity<InputStreamResource> getJobCardReceivingPdf(long id, Model model ) throws Exception { public ResponseEntity<InputStreamResource> getJobCardReceivingPdf(long id, Model model ) throws Exception {
List<JobCardItem> jobCardItems = findJobCardItemByJobCardId(id);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd,yyyy h:m a");
List<JobCardItem> jobCardItems = this.findJobCardItemByJobCardId(id);
List<Long> jobCardItemIds = jobCardItems.stream() List<Long> jobCardItemIds = jobCardItems.stream()
.map(JobCardItem::getItemId) .map(JobCardItem::getItemId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<Long> itemIds = jobCardItems.stream() List<Long> itemIds = jobCardItems.stream()
.map(JobCardItem::getId) .map(JobCardItem::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
model.addAttribute( "baseUrl", URLUtils.getCurrentBaseUrl() ); model.addAttribute( "baseUrl", URLUtils.getCurrentBaseUrl() );
model.addAttribute( "card", this.findByID(id)); model.addAttribute( "card", findByID(id));
model.addAttribute("jobCardItems", jobCardItems); model.addAttribute("jobCardItems", jobCardItems);
model.addAttribute("cutPiece",this.findCutPieceByJobCardItemIds(itemIds)); model.addAttribute("cutPiece", findCutPieceByJobCardItemIds(itemIds));
model.addAttribute("totalFinishItem",this.totalFinishItem(jobCardItemIds, id)); model.addAttribute("totalFinishItem", totalFinishItem(jobCardItemIds, id));
model.addAttribute("totalStitchingItem",this.totalStitchingItem(jobCardItemIds, id)); model.addAttribute("totalStitchingItem", totalStitchingItem(jobCardItemIds, id));
// html str // html str
String htmlStr = htmlBuilder.buildHTML( "job-card-view-pdf", model ); String htmlStr = htmlBuilder.buildHTML( "job-card-view-pdf", model );
// return pdf // return pdf
return pdfGenerator.generatePdf( htmlStr, "Job-Card", "inline" ); return pdfGenerator.generatePdf( htmlStr, "Job-Card", "inline" );
} }

View File

@ -107,10 +107,4 @@ public class PDFResponseEntityInputStreamResource {
public ResponseEntity<InputStreamResource> generateInvoicePdf( String htmlStr, String filename, String method, long height, long width ) throws IOException { public ResponseEntity<InputStreamResource> generateInvoicePdf( String htmlStr, String filename, String method, long height, long width ) throws IOException {
return this.createPDFResponseEntityInvoiceInputStreamResource( htmlStr, filename, method, height, width ); return this.createPDFResponseEntityInvoiceInputStreamResource( htmlStr, filename, method, height, width );
} }
} }

View File

@ -1,63 +0,0 @@
package com.utopiaindustries.util;
public class TemporaryDocument {
private long id;
private long typeId;
private String parentDocumentType;
private long parentDocumentId;
private String photoBlob;
public TemporaryDocument() {
}
public long getId() {
return id;
}
public void setId( long id ) {
this.id = id;
}
public long getTypeId() {
return typeId;
}
public void setTypeId( long typeId ) {
this.typeId = typeId;
}
public String getParentDocumentType() {
return parentDocumentType;
}
public void setParentDocumentType( String parentDocumentType ) {
this.parentDocumentType = parentDocumentType;
}
public long getParentDocumentId() {
return parentDocumentId;
}
public void setParentDocumentId( long parentDocumentId ) {
this.parentDocumentId = parentDocumentId;
}
public String getPhotoBlob() {
return photoBlob;
}
public void setPhotoBlob( String photoBlob ) {
this.photoBlob = photoBlob;
}
@Override
public String toString() {
return "TemporaryDocument{" +
"id=" + id +
", typeId=" + typeId +
", parentDocumentType='" + parentDocumentType + '\'' +
", parentDocumentId=" + parentDocumentId +
", photoBlob='" + photoBlob + '\'' +
'}';
}
}

View File

@ -87,7 +87,6 @@
</table> </table>
<table class="bordered" style="width: 100%; margin-top: 20px; border-collapse: collapse; "> <table class="bordered" style="width: 100%; margin-top: 20px; border-collapse: collapse; ">
<h5 class="no-margin-top no-margin-bottom" style="margin-top: 20px;">ITEMS</h5> <h5 class="no-margin-top no-margin-bottom" style="margin-top: 20px;">ITEMS</h5>
<thead > <thead >
<tr class="tr-header"> <tr class="tr-header">
@ -102,7 +101,6 @@
<td th:text="'Cut Piece Items'"></td> <td th:text="'Cut Piece Items'"></td>
</tr> </tr>
</thead> </thead>
<!-- Table Body --> <!-- Table Body -->
<tbody> <tbody>
<tr th:each="cardItem : ${jobCardItems}"> <tr th:each="cardItem : ${jobCardItems}">
@ -125,11 +123,9 @@
</tbody> </tbody>
</table> </table>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</body> </body>
</html> </html>