| Line 12... |
Line 12... |
| 12 |
import java.util.Date;
|
12 |
import java.util.Date;
|
| 13 |
import java.util.HashMap;
|
13 |
import java.util.HashMap;
|
| 14 |
import java.util.List;
|
14 |
import java.util.List;
|
| 15 |
import java.util.Map;
|
15 |
import java.util.Map;
|
| 16 |
|
16 |
|
| 17 |
import in.shop2020.datalogger.event.OrderCreation;
|
- |
|
| 18 |
import in.shop2020.logistics.LogisticsServiceException;
|
17 |
import in.shop2020.logistics.LogisticsServiceException;
|
| 19 |
import in.shop2020.logistics.Provider;
|
18 |
import in.shop2020.logistics.Provider;
|
| 20 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
19 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 21 |
import in.shop2020.model.v1.catalog.Vendor;
|
20 |
import in.shop2020.model.v1.catalog.Vendor;
|
| 22 |
import in.shop2020.model.v1.order.LineItem;
|
21 |
import in.shop2020.model.v1.order.LineItem;
|
| Line 31... |
Line 30... |
| 31 |
import in.shop2020.thrift.clients.CatalogClient;
|
30 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 32 |
import in.shop2020.thrift.clients.LogisticsClient;
|
31 |
import in.shop2020.thrift.clients.LogisticsClient;
|
| 33 |
import in.shop2020.thrift.clients.PaymentClient;
|
32 |
import in.shop2020.thrift.clients.PaymentClient;
|
| 34 |
import in.shop2020.thrift.clients.TransactionClient;
|
33 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 35 |
|
34 |
|
| 36 |
import javassist.expr.NewArray;
|
- |
|
| 37 |
|
- |
|
| 38 |
import javax.servlet.ServletContext;
|
35 |
import javax.servlet.ServletContext;
|
| 39 |
import javax.servlet.ServletOutputStream;
|
36 |
import javax.servlet.ServletOutputStream;
|
| 40 |
import javax.servlet.http.HttpServletRequest;
|
37 |
import javax.servlet.http.HttpServletRequest;
|
| 41 |
import javax.servlet.http.HttpServletResponse;
|
38 |
import javax.servlet.http.HttpServletResponse;
|
| 42 |
import javax.servlet.http.HttpSession;
|
39 |
import javax.servlet.http.HttpSession;
|
| Line 554... |
Line 551... |
| 554 |
|
551 |
|
| 555 |
int indexOrderId = 0;
|
552 |
int indexOrderId = 0;
|
| 556 |
int indexAmount = 1;
|
553 |
int indexAmount = 1;
|
| 557 |
|
554 |
|
| 558 |
TransactionClient tsc;
|
555 |
TransactionClient tsc;
|
| 559 |
PaymentClient psc;
|
- |
|
| 560 |
int countSuccessfulSaves = 0;
|
556 |
int countSuccessfulSaves = 0;
|
| 561 |
|
557 |
|
| 562 |
try {
|
558 |
try {
|
| 563 |
long settlementDate = DATE_FORMAT.parse(bluedartSettlementDate).getTime();
|
559 |
long settlementDate = DATE_FORMAT.parse(bluedartSettlementDate).getTime();
|
| 564 |
tsc = new TransactionClient();
|
560 |
tsc = new TransactionClient();
|
| 565 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
561 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 566 |
psc = new PaymentClient();
|
- |
|
| 567 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
- |
|
| 568 |
|
562 |
|
| 569 |
for (Row row : sheet) {
|
563 |
for (Row row : sheet) {
|
| 570 |
Order order = null;
|
564 |
long orderId = 0;
|
| 571 |
try {
|
565 |
try {
|
| 572 |
if(row.equals(firstRow)) continue;
|
566 |
if(row.equals(firstRow)) continue;
|
| 573 |
long orderId = (long) row.getCell(indexOrderId).getNumericCellValue();
|
567 |
orderId = (long) row.getCell(indexOrderId).getNumericCellValue();
|
| 574 |
|
568 |
|
| 575 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
569 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
| 576 |
order = transactionClient.getOrder(orderId);
|
- |
|
| 577 |
Payment payment = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
570 |
transactionClient.saveCODPaymentSettlement(orderId, settlementDate, amount);
|
| 578 |
logger.info("settlementDate: " + settlementDate + ", PaymentId: " + payment.getPaymentId() + ", Amount: " + amount);
|
571 |
logger.info("SettlementDate: " + settlementDate + ", OrderId: " + orderId + ", Amount: " + amount);
|
| 579 |
|
- |
|
| 580 |
transactionClient.savePaymentSettlements(settlementDate, 4, payment.getPaymentId(), 0.0, 0, amount);
|
- |
|
| 581 |
countSuccessfulSaves += 1;
|
572 |
countSuccessfulSaves += 1;
|
| 582 |
} catch (NullPointerException e) {
|
- |
|
| 583 |
logger.error("" + e);
|
- |
|
| 584 |
|
573 |
|
| 585 |
} catch (PaymentException e) {
|
574 |
} catch (NullPointerException e) {
|
| 586 |
logger.error("" + e);
|
575 |
logger.error("For OrderId: " + orderId + " " + e);
|
| 587 |
|
576 |
|
| 588 |
} catch (TransactionServiceException e) {
|
577 |
} catch (TransactionServiceException e) {
|
| 589 |
logger.error("" + e);
|
578 |
logger.error("For OrderId: " + orderId + " " + e);
|
| 590 |
|
- |
|
| 591 |
} catch (TApplicationException e) {
|
- |
|
| 592 |
orderIdsWithoutSuccess.add(order.getId());
|
- |
|
| 593 |
|
- |
|
| 594 |
logger.error("Application Exception while getting successfull payment for transaction Id, " + order.getTransactionId(), e);
|
- |
|
| 595 |
addActionError("Application Exception while getting payment for transaction Id, " + order.getTransactionId());
|
- |
|
| 596 |
}
|
579 |
}
|
| 597 |
}
|
580 |
}
|
| 598 |
} catch (ParseException e) {
|
581 |
} catch (ParseException e) {
|
| 599 |
logger.error("Could not parse " + bluedartSettlementDate + " " + e);
|
582 |
logger.error("Could not parse " + bluedartSettlementDate + " " + e);
|
| - |
|
583 |
addActionError(e.getMessage());
|
| - |
|
584 |
|
| 600 |
} catch (TTransportException e) {
|
585 |
} catch (TTransportException e) {
|
| 601 |
logger.error("" + e);
|
586 |
logger.error("" + e);
|
| - |
|
587 |
addActionError(e.getMessage());
|
| - |
|
588 |
|
| 602 |
} catch (TException e) {
|
589 |
} catch (TException e) {
|
| 603 |
logger.error("" + e);
|
590 |
logger.error("" + e);
|
| - |
|
591 |
addActionError(e.getMessage());
|
| 604 |
}
|
592 |
}
|
| 605 |
addActionMessage("Successfully added Bluedart settlement details for " + countSuccessfulSaves + " orders");
|
593 |
addActionMessage("Successfully added Bluedart settlement details for " + countSuccessfulSaves + " orders");
|
| 606 |
}
|
594 |
}
|
| 607 |
|
595 |
|
| 608 |
public void uploadAramexSettlements() {
|
596 |
public void uploadAramexSettlements() {
|
| Line 615... |
Line 603... |
| 615 |
|
603 |
|
| 616 |
Workbook wb = null;
|
604 |
Workbook wb = null;
|
| 617 |
try {
|
605 |
try {
|
| 618 |
wb = new HSSFWorkbook(new FileInputStream(this.aramexSettlementReport));
|
606 |
wb = new HSSFWorkbook(new FileInputStream(this.aramexSettlementReport));
|
| 619 |
} catch (FileNotFoundException e) {
|
607 |
} catch (FileNotFoundException e) {
|
| - |
|
608 |
addActionError(e.getMessage());
|
| 620 |
logger.error("Unable to open the Settlement report", e);
|
609 |
logger.error("Unable to open the Settlement report", e);
|
| 621 |
} catch (IOException e) {
|
610 |
} catch (IOException e) {
|
| - |
|
611 |
addActionError(e.getMessage());
|
| 622 |
logger.error("Unable to open the Settlement report", e);
|
612 |
logger.error("Unable to open the Settlement report", e);
|
| 623 |
} catch (NullPointerException e) {
|
613 |
} catch (NullPointerException e) {
|
| 624 |
addActionError(e.getMessage());
|
614 |
addActionError(e.getMessage());
|
| 625 |
logger.error("Unable to open the Settlement report", e);
|
615 |
logger.error("Unable to open the Settlement report", e);
|
| 626 |
return;
|
616 |
return;
|
| Line 633... |
Line 623... |
| 633 |
|
623 |
|
| 634 |
Row firstRow = sheet.getRow(0);
|
624 |
Row firstRow = sheet.getRow(0);
|
| 635 |
logger.info("Cell count:" + firstRow.getPhysicalNumberOfCells());
|
625 |
logger.info("Cell count:" + firstRow.getPhysicalNumberOfCells());
|
| 636 |
|
626 |
|
| 637 |
TransactionClient tsc;
|
627 |
TransactionClient tsc;
|
| 638 |
PaymentClient psc;
|
- |
|
| 639 |
int countSuccessfulSaves = 0;
|
628 |
int countSuccessfulSaves = 0;
|
| 640 |
try {
|
629 |
try {
|
| 641 |
long settlementDate = DATE_FORMAT.parse(aramexSettlementDate).getTime();
|
630 |
long settlementDate = DATE_FORMAT.parse(aramexSettlementDate).getTime();
|
| 642 |
|
631 |
|
| 643 |
tsc = new TransactionClient();
|
632 |
tsc = new TransactionClient();
|
| 644 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
633 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 645 |
psc = new PaymentClient();
|
- |
|
| 646 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
- |
|
| 647 |
|
634 |
|
| 648 |
for (Row row: sheet) {
|
635 |
for (Row row: sheet) {
|
| 649 |
if(row.equals(firstRow)) continue;
|
636 |
if(row.equals(firstRow)) continue;
|
| 650 |
|
637 |
|
| 651 |
long orderId = (long) row.getCell(indexOrderId).getNumericCellValue();
|
638 |
long orderId = (long) row.getCell(indexOrderId).getNumericCellValue();
|
| 652 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
639 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
| 653 |
Order order = null;
|
- |
|
| 654 |
|
640 |
|
| 655 |
try {
|
641 |
try {
|
| 656 |
order = transactionClient.getOrder(orderId);
|
- |
|
| 657 |
Payment payment = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
- |
|
| 658 |
transactionClient.savePaymentSettlements(settlementDate, 4, payment.getPaymentId(), 0.0, 0.0, amount);
|
642 |
transactionClient.saveCODPaymentSettlement(orderId, settlementDate, amount);
|
| 659 |
countSuccessfulSaves += 1;
|
643 |
countSuccessfulSaves += 1;
|
| 660 |
|
644 |
|
| 661 |
} catch (TransactionServiceException e) {
|
645 |
} catch (TransactionServiceException e) {
|
| 662 |
logger.error("Transaction Service Exception while getting order for id, " + orderId, e);
|
646 |
logger.error("Transaction Service Exception while getting order for id, " + orderId, e);
|
| 663 |
addActionError("Transaction Service Exception while getting order for id, " + orderId);
|
647 |
addActionError("Transaction Service Exception while getting order for id, " + orderId);
|
| 664 |
|
- |
|
| 665 |
} catch (PaymentException e) {
|
- |
|
| 666 |
logger.error("Payment Service Exception while getting successfull payment for transaction Id, " + order.getTransactionId(), e);
|
- |
|
| 667 |
addActionError("Payment Service Exception while getting payment for transaction Id, " + order.getTransactionId());
|
- |
|
| 668 |
|
- |
|
| 669 |
} catch (TApplicationException e) {
|
- |
|
| 670 |
orderIdsWithoutSuccess.add(orderId);
|
- |
|
| 671 |
logger.error("Application Exception while getting successfull payment for transaction Id, " + order.getTransactionId(), e);
|
- |
|
| 672 |
addActionError("Application Exception while getting payment for transaction Id, " + order.getTransactionId());
|
- |
|
| 673 |
}
|
648 |
}
|
| 674 |
}
|
649 |
}
|
| 675 |
} catch (ParseException e) {
|
650 |
} catch (ParseException e) {
|
| 676 |
addActionError("Could not parse " + aramexSettlementDate);
|
651 |
addActionError("Could not parse " + aramexSettlementDate);
|
| 677 |
logger.error("Could not parse " + aramexSettlementDate + " " + e);
|
652 |
logger.error("Could not parse " + aramexSettlementDate + " " + e);
|
| 678 |
return;
|
653 |
|
| 679 |
} catch (TTransportException e) {
|
654 |
} catch (TTransportException e) {
|
| - |
|
655 |
addActionError(e.getMessage());
|
| 680 |
logger.error("" + e);
|
656 |
logger.error("" + e);
|
| - |
|
657 |
|
| 681 |
} catch (TException e) {
|
658 |
} catch (TException e) {
|
| - |
|
659 |
addActionError(e.getMessage());
|
| 682 |
logger.error("" + e);
|
660 |
logger.error("" + e);
|
| 683 |
}
|
661 |
}
|
| 684 |
addActionMessage("Successfully added Aramex settlement details for " + countSuccessfulSaves + " orders");
|
662 |
addActionMessage("Successfully added Aramex settlement details for " + countSuccessfulSaves + " orders");
|
| 685 |
}
|
663 |
}
|
| 686 |
|
664 |
|
| 687 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
665 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
| 688 |
private ByteArrayOutputStream getReconciliationReport(long vendorId, Date startDate, Date endDate) {
|
666 |
private ByteArrayOutputStream getReconciliationReport(long vendorId, Date startDate, Date endDate) {
|
| 689 |
|
667 |
|
| 690 |
List<Order> billedOrders = null;
|
668 |
List<Order> billedOrders = null;
|
| - |
|
669 |
List<Order> settledOrders = null;
|
| - |
|
670 |
|
| 691 |
try {
|
671 |
try {
|
| 692 |
TransactionClient tsc = new TransactionClient();
|
672 |
TransactionClient tsc = new TransactionClient();
|
| 693 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
673 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 694 |
|
674 |
|
| 695 |
PaymentClient psc = new PaymentClient();
|
675 |
PaymentClient psc = new PaymentClient();
|
| Line 699... |
Line 679... |
| 699 |
logger.info("Billed Orders count: " + billedOrders.size());
|
679 |
logger.info("Billed Orders count: " + billedOrders.size());
|
| 700 |
|
680 |
|
| 701 |
List<PaymentSettlement> paymentSettlements = transactionClient.getSettlementsByDate(startDate.getTime(), endDate.getTime(), false);
|
681 |
List<PaymentSettlement> paymentSettlements = transactionClient.getSettlementsByDate(startDate.getTime(), endDate.getTime(), false);
|
| 702 |
logger.info("Settlement Count: " + paymentSettlements.size());
|
682 |
logger.info("Settlement Count: " + paymentSettlements.size());
|
| 703 |
|
683 |
|
| 704 |
List<Order> settledOrders = new ArrayList<Order>();
|
684 |
settledOrders = new ArrayList<Order>();
|
| 705 |
|
685 |
|
| 706 |
for (PaymentSettlement paymentSettlement: paymentSettlements) {
|
686 |
for (PaymentSettlement paymentSettlement: paymentSettlements) {
|
| 707 |
Payment payment = paymentClient.getPayment(paymentSettlement.getPaymentId());
|
687 |
Payment payment = paymentClient.getPayment(paymentSettlement.getPaymentId());
|
| 708 |
Transaction txn = transactionClient.getTransaction(payment.getMerchantTxnId());
|
688 |
Transaction txn = transactionClient.getTransaction(payment.getMerchantTxnId());
|
| 709 |
settledOrders.addAll(txn.getOrders());
|
689 |
settledOrders.addAll(txn.getOrders());
|
| Line 728... |
Line 708... |
| 728 |
String errMsg = "Transaction Service Exception occured";
|
708 |
String errMsg = "Transaction Service Exception occured";
|
| 729 |
logger.error(errMsg, e);
|
709 |
logger.error(errMsg, e);
|
| 730 |
addActionError(errMsg);
|
710 |
addActionError(errMsg);
|
| 731 |
}
|
711 |
}
|
| 732 |
|
712 |
|
| - |
|
713 |
List<Order> settledOrdersForVendor = new ArrayList<Order>();
|
| - |
|
714 |
|
| - |
|
715 |
for (Order order: settledOrders) {
|
| - |
|
716 |
if(order.getVendorId() == vendorId) {
|
| - |
|
717 |
settledOrdersForVendor.add(order);
|
| - |
|
718 |
}
|
| - |
|
719 |
}
|
| - |
|
720 |
logger.info("Settled Order count for Vendor: " + settledOrdersForVendor.size());
|
| - |
|
721 |
|
| 733 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
722 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
| 734 |
// return baosXLS;
|
- |
|
| 735 |
|
723 |
|
| 736 |
Workbook wb = new HSSFWorkbook();
|
724 |
Workbook wb = new HSSFWorkbook();
|
| 737 |
|
725 |
|
| 738 |
//Create the style for the title row
|
726 |
//Create the style for the title row
|
| 739 |
Font font = wb.createFont();
|
727 |
Font font = wb.createFont();
|
| 740 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
728 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
| 741 |
CellStyle boldStyle = wb.createCellStyle();
|
729 |
CellStyle boldStyle = wb.createCellStyle();
|
| 742 |
boldStyle.setFont(font);
|
730 |
boldStyle.setFont(font);
|
| 743 |
|
731 |
|
| 744 |
CellStyle rightAlignStyle = wb.createCellStyle();
|
732 |
CellStyle rightAlignStyle = wb.createCellStyle();
|
| 745 |
rightAlignStyle.setAlignment(CellStyle.ALIGN_RIGHT);
|
733 |
rightAlignStyle.setAlignment(CellStyle.ALIGN_RIGHT);
|
| 746 |
|
734 |
|
| 747 |
Sheet orderSheet = wb.createSheet("Orders");
|
735 |
Sheet orderSheet = wb.createSheet("Orders");
|
| - |
|
736 |
Sheet reshippedOrderSheet = wb.createSheet("Reshipped");
|
| 748 |
Sheet mismatchSheet = wb.createSheet("Mismatches");
|
737 |
Sheet mismatchSheet = wb.createSheet("Mismatches");
|
| 749 |
|
738 |
|
| 750 |
populateOrderSheet(billedOrders, startDate, endDate, orderSheet, boldStyle, rightAlignStyle);
|
739 |
populateOrderSheet(settledOrdersForVendor, startDate, endDate, orderSheet, boldStyle, rightAlignStyle);
|
| - |
|
740 |
populateReshippedOrderSheet(reshippedOrders, reshippedOrderSheet);
|
| 751 |
populateMismatchSheet(mismatchSheet);
|
741 |
populateMismatchSheet(mismatchSheet);
|
| 752 |
|
742 |
|
| 753 |
// Write the workbook to the output stream
|
743 |
// Write the workbook to the output stream
|
| 754 |
try {
|
744 |
try {
|
| 755 |
wb.write(baosXLS);
|
745 |
wb.write(baosXLS);
|
| Line 780... |
Line 770... |
| 780 |
contentRow.createCell(OrderMismatchColumn.EXPECTED_COLLECTION.getValue()).setCellValue(misMatches.get(orderId).get("expected"));
|
770 |
contentRow.createCell(OrderMismatchColumn.EXPECTED_COLLECTION.getValue()).setCellValue(misMatches.get(orderId).get("expected"));
|
| 781 |
contentRow.createCell(OrderMismatchColumn.ACTUAL_COLLECTION.getValue()).setCellValue(misMatches.get(orderId).get("actual"));
|
771 |
contentRow.createCell(OrderMismatchColumn.ACTUAL_COLLECTION.getValue()).setCellValue(misMatches.get(orderId).get("actual"));
|
| 782 |
}
|
772 |
}
|
| 783 |
}
|
773 |
}
|
| 784 |
|
774 |
|
| - |
|
775 |
private void populateReshippedOrderSheet(List<Order> orders, Sheet sheet) {
|
| - |
|
776 |
short serialNo = 0;
|
| - |
|
777 |
|
| - |
|
778 |
// Create the title row and put all the titles in it. Rows are 0 based.
|
| - |
|
779 |
Row titleRow = sheet.createRow(serialNo ++);
|
| - |
|
780 |
Cell titleCell = titleRow.createCell(0);
|
| - |
|
781 |
titleCell.setCellValue("Reshipped Orders");
|
| - |
|
782 |
|
| - |
|
783 |
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
|
| - |
|
784 |
|
| - |
|
785 |
sheet.createRow(serialNo ++);
|
| - |
|
786 |
|
| - |
|
787 |
Row headerRow = sheet.createRow(serialNo ++);
|
| - |
|
788 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
| - |
|
789 |
headerRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue("Order Date");
|
| - |
|
790 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
| - |
|
791 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
| - |
|
792 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Delivery Date");
|
| - |
|
793 |
headerRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue("Settlement Date");
|
| - |
|
794 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
| - |
|
795 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
| - |
|
796 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
| - |
|
797 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
| - |
|
798 |
headerRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue("Quantity");
|
| - |
|
799 |
headerRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue("Unit Transfer Price");
|
| - |
|
800 |
headerRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue("Unit Selling Price");
|
| - |
|
801 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
| - |
|
802 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
| - |
|
803 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
| - |
|
804 |
headerRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue("Gateway Transaction Id");
|
| - |
|
805 |
headerRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("Payment Type");
|
| - |
|
806 |
headerRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue("Payment Status");
|
| - |
|
807 |
headerRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue("Payment Id");
|
| - |
|
808 |
headerRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue("Coupon Code");
|
| - |
|
809 |
// headerRow.createCell(OrderReportColumn.COUPON_CATEGORY.getValue()).setCellValue("Coupon Category");
|
| - |
|
810 |
// headerRow.createCell(OrderReportColumn.DISCOUNT.getValue()).setCellValue("Discount");
|
| - |
|
811 |
headerRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue("Service Tax");
|
| - |
|
812 |
headerRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue("Other Charges");
|
| - |
|
813 |
headerRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue("Net Collection");
|
| - |
|
814 |
|
| - |
|
815 |
sheet.createRow(serialNo ++);
|
| - |
|
816 |
|
| - |
|
817 |
TransactionClient tsc;
|
| - |
|
818 |
PaymentClient psc;
|
| - |
|
819 |
LogisticsClient lsc;
|
| - |
|
820 |
|
| - |
|
821 |
try {
|
| - |
|
822 |
tsc = new TransactionClient();
|
| - |
|
823 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| - |
|
824 |
|
| - |
|
825 |
psc = new PaymentClient();
|
| - |
|
826 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
| - |
|
827 |
|
| - |
|
828 |
lsc = new LogisticsClient();
|
| - |
|
829 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
| - |
|
830 |
|
| - |
|
831 |
Map<Long, String> codProviders = new HashMap<Long, String>();
|
| - |
|
832 |
|
| - |
|
833 |
for (Provider provider: logisticsClient.getAllProviders()) {
|
| - |
|
834 |
codProviders.put(provider.getId(), provider.getName());
|
| - |
|
835 |
}
|
| - |
|
836 |
|
| - |
|
837 |
List<PaymentGateway> tPaymentGateways = paymentClient.getActivePaymentGateways();
|
| - |
|
838 |
Map<Long, String> paymentGateways = new HashMap<Long, String>();
|
| - |
|
839 |
|
| - |
|
840 |
for (PaymentGateway tPaymentGateway: tPaymentGateways) {
|
| - |
|
841 |
paymentGateways.put(tPaymentGateway.getId(), tPaymentGateway.getName());
|
| - |
|
842 |
}
|
| - |
|
843 |
|
| - |
|
844 |
int countMultipleOrderTxns = 0;
|
| - |
|
845 |
|
| - |
|
846 |
for (Order order: orders) {
|
| - |
|
847 |
logger.info("For order: " + order.getId());
|
| - |
|
848 |
|
| - |
|
849 |
LineItem lineItem = order.getLineitems().get(0);
|
| - |
|
850 |
double transferPrice = lineItem.getTransfer_price();
|
| - |
|
851 |
Payment payment = null;
|
| - |
|
852 |
|
| - |
|
853 |
try {
|
| - |
|
854 |
if(order.isCod()) {
|
| - |
|
855 |
payment = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
| - |
|
856 |
} else {
|
| - |
|
857 |
payment = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
| - |
|
858 |
}
|
| - |
|
859 |
logger.info("getSuccessfulPaymentForTxnId, " + order.getTransactionId() + ": " + payment);
|
| - |
|
860 |
|
| - |
|
861 |
} catch (TApplicationException e) {
|
| - |
|
862 |
orderIdsWithoutSuccess.add(order.getId());
|
| - |
|
863 |
String errMsg = "Exception while getting successfull payment for transaction Id, " + order.getTransactionId();
|
| - |
|
864 |
logger.error(errMsg, e);
|
| - |
|
865 |
addActionError(errMsg);
|
| - |
|
866 |
}
|
| - |
|
867 |
|
| - |
|
868 |
Transaction txn = transactionClient.getTransaction(order.getTransactionId());
|
| - |
|
869 |
PaymentSettlement paymentSettlement = null;
|
| - |
|
870 |
String paymentType = null;
|
| - |
|
871 |
|
| - |
|
872 |
if(payment != null) {
|
| - |
|
873 |
paymentSettlement = transactionClient.getSettlementForPaymentId(payment.getPaymentId());
|
| - |
|
874 |
paymentType = paymentGateways.get(payment.getGatewayId());
|
| - |
|
875 |
}
|
| - |
|
876 |
|
| - |
|
877 |
double totalSellingPrice = lineItem.getTotal_price();
|
| - |
|
878 |
double serviceTax = 0.0;
|
| - |
|
879 |
double otherCollectionCharges = 0.0;
|
| - |
|
880 |
double netCollection = 0.0;
|
| - |
|
881 |
|
| - |
|
882 |
if(paymentSettlement != null) {
|
| - |
|
883 |
serviceTax = paymentSettlement.getServiceTax();
|
| - |
|
884 |
otherCollectionCharges = paymentSettlement.getOtherCharges();
|
| - |
|
885 |
netCollection = paymentSettlement.getNetCollection();
|
| - |
|
886 |
}
|
| - |
|
887 |
|
| - |
|
888 |
if (netCollection < 0.0) {
|
| - |
|
889 |
paymentType = paymentType + "-REFUND";
|
| - |
|
890 |
}
|
| - |
|
891 |
|
| - |
|
892 |
Row contentRow = sheet.createRow(serialNo++);
|
| - |
|
893 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
| - |
|
894 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
| - |
|
895 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
| - |
|
896 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
| - |
|
897 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
| - |
|
898 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
| - |
|
899 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
| - |
|
900 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
| - |
|
901 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
| - |
|
902 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
| - |
|
903 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(transferPrice);
|
| - |
|
904 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
| - |
|
905 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(transferPrice * lineItem.getQuantity());
|
| - |
|
906 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
|
| - |
|
907 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatusDescription());
|
| - |
|
908 |
|
| - |
|
909 |
double refund = 0.0;
|
| - |
|
910 |
|
| - |
|
911 |
if(order.isCod()) {
|
| - |
|
912 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("COD - " + codProviders.get(order.getLogistics_provider_id()));
|
| - |
|
913 |
} else {
|
| - |
|
914 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentType);
|
| - |
|
915 |
}
|
| - |
|
916 |
|
| - |
|
917 |
if (payment != null) {
|
| - |
|
918 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
| - |
|
919 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
| - |
|
920 |
contentRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue(payment.getStatus().name());
|
| - |
|
921 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
| - |
|
922 |
}
|
| - |
|
923 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
| - |
|
924 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(serviceTax);
|
| - |
|
925 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(otherCollectionCharges);
|
| - |
|
926 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(netCollection);
|
| - |
|
927 |
}
|
| - |
|
928 |
|
| - |
|
929 |
logger.info("Order Ids where no successful payment was found: " + orderIdsWithoutSuccess.size());
|
| - |
|
930 |
logger.info(orderIdsWithoutSuccess.toString());
|
| - |
|
931 |
|
| - |
|
932 |
sheet.createRow(serialNo++);
|
| - |
|
933 |
|
| - |
|
934 |
} catch (TTransportException e) {
|
| - |
|
935 |
logger.error("TTransportException " + e);
|
| - |
|
936 |
} catch (PaymentException e) {
|
| - |
|
937 |
logger.error("PaymentException " + e);
|
| - |
|
938 |
} catch (TException e) {
|
| - |
|
939 |
logger.error("TException " + e);
|
| - |
|
940 |
} catch (TransactionServiceException e) {
|
| - |
|
941 |
logger.error("Transaction Service Exception " + e);
|
| - |
|
942 |
} catch (LogisticsServiceException e) {
|
| - |
|
943 |
addActionError("Error loading list of COD providers");
|
| - |
|
944 |
logger.error("Logistics Service Exception " + e);
|
| - |
|
945 |
}
|
| - |
|
946 |
}
|
| - |
|
947 |
|
| 785 |
private void populateOrderSheet(List<Order> orders, Date startDate, Date endDate, Sheet sheet, CellStyle style, CellStyle rightAlignStyle) {
|
948 |
private void populateOrderSheet(List<Order> orders, Date startDate, Date endDate, Sheet sheet, CellStyle style, CellStyle rightAlignStyle) {
|
| 786 |
short serialNo = 0;
|
949 |
short serialNo = 0;
|
| 787 |
|
950 |
|
| 788 |
// Create the title row and put all the titles in it. Rows are 0 based.
|
951 |
// Create the title row and put all the titles in it. Rows are 0 based.
|
| 789 |
Row titleRow = sheet.createRow(serialNo ++);
|
952 |
Row titleRow = sheet.createRow(serialNo ++);
|
| Line 822... |
Line 985... |
| 822 |
headerRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue("Service Tax");
|
985 |
headerRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue("Service Tax");
|
| 823 |
headerRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue("Other Charges");
|
986 |
headerRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue("Other Charges");
|
| 824 |
headerRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue("Net Collection");
|
987 |
headerRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue("Net Collection");
|
| 825 |
headerRow.createCell(OrderReportColumn.REFUND.getValue()).setCellValue("Refund");
|
988 |
headerRow.createCell(OrderReportColumn.REFUND.getValue()).setCellValue("Refund");
|
| 826 |
headerRow.createCell(OrderReportColumn.FINAL_AMOUNT.getValue()).setCellValue("Final Amount");
|
989 |
headerRow.createCell(OrderReportColumn.FINAL_AMOUNT.getValue()).setCellValue("Final Amount");
|
| 827 |
headerRow.createCell(OrderReportColumn.IS_RESHIPED_ORDER.getValue()).setCellValue("Is Reshipped Order");
|
- |
|
| 828 |
|
990 |
|
| 829 |
sheet.createRow(serialNo ++);
|
991 |
sheet.createRow(serialNo ++);
|
| 830 |
|
992 |
|
| 831 |
TransactionClient tsc;
|
993 |
TransactionClient tsc;
|
| 832 |
PaymentClient psc;
|
994 |
PaymentClient psc;
|
| Line 853... |
Line 1015... |
| 853 |
|
1015 |
|
| 854 |
for (PaymentGateway tPaymentGateway: tPaymentGateways) {
|
1016 |
for (PaymentGateway tPaymentGateway: tPaymentGateways) {
|
| 855 |
paymentGateways.put(tPaymentGateway.getId(), tPaymentGateway.getName());
|
1017 |
paymentGateways.put(tPaymentGateway.getId(), tPaymentGateway.getName());
|
| 856 |
}
|
1018 |
}
|
| 857 |
|
1019 |
|
| 858 |
List<PaymentSettlement> settlements = transactionClient.getSettlementsByDate(startDate.getTime(), endDate.getTime(), true);
|
- |
|
| 859 |
logger.info("Refunds: " + settlements.size());
|
- |
|
| 860 |
logger.info(settlements.toString());
|
- |
|
| 861 |
|
- |
|
| 862 |
Map<Long, PaymentSettlement> refunds = new HashMap<Long, PaymentSettlement>();
|
- |
|
| 863 |
|
- |
|
| 864 |
for (PaymentSettlement settlement: settlements) {
|
- |
|
| 865 |
refunds.put(settlement.getPaymentId(), settlement);
|
- |
|
| 866 |
}
|
- |
|
| 867 |
|
- |
|
| 868 |
List <Long> orderIds = new ArrayList<Long>();
|
1020 |
List <Long> orderIds = new ArrayList<Long>();
|
| 869 |
Map<Long, List<Order>> orderMap = new HashMap<Long, List<Order>>();
|
1021 |
Map<Long, List<Order>> orderMap = new HashMap<Long, List<Order>>();
|
| 870 |
|
1022 |
|
| 871 |
int countMultipleOrderTxns = 0;
|
1023 |
int countMultipleOrderTxns = 0;
|
| 872 |
|
1024 |
|
| 873 |
for(Order order : orders) {
|
1025 |
for(Order order : orders) {
|
| - |
|
1026 |
if(order.getBilling_timestamp() == 0) {
|
| - |
|
1027 |
continue;
|
| - |
|
1028 |
}
|
| 874 |
orderIds.add(order.getId());
|
1029 |
orderIds.add(order.getId());
|
| 875 |
|
1030 |
|
| 876 |
if (orderMap.containsKey(order.getTransactionId())) {
|
1031 |
if (orderMap.containsKey(order.getTransactionId())) {
|
| 877 |
orderMap.get(order.getTransactionId()).add(order);
|
1032 |
orderMap.get(order.getTransactionId()).add(order);
|
| 878 |
countMultipleOrderTxns += 1;
|
1033 |
countMultipleOrderTxns += 1;
|
| Line 890... |
Line 1045... |
| 890 |
for(long txnId: orderMap.keySet()) {
|
1045 |
for(long txnId: orderMap.keySet()) {
|
| 891 |
List<Order> orderList = orderMap.get(txnId);
|
1046 |
List<Order> orderList = orderMap.get(txnId);
|
| 892 |
|
1047 |
|
| 893 |
for (Order order: orderList) {
|
1048 |
for (Order order: orderList) {
|
| 894 |
logger.info("For order: " + order.getId());
|
1049 |
logger.info("For order: " + order.getId());
|
| 895 |
|
1050 |
|
| 896 |
boolean isReshippedOrder = reshippedOrderIds.contains(order.getId());
|
1051 |
// Orders where payment was captured but never billed
|
| - |
|
1052 |
if(order.getBilling_timestamp() == 0) {
|
| - |
|
1053 |
continue;
|
| 897 |
|
1054 |
}
|
| - |
|
1055 |
|
| 898 |
if (isReshippedOrder) {
|
1056 |
if (reshippedOrderIds.contains(order.getId())) {
|
| 899 |
reshippedOrders.add(order);
|
1057 |
reshippedOrders.add(order);
|
| 900 |
// orderList.remove(order);
|
- |
|
| 901 |
// orderMap.get(txnId).remove(order);
|
- |
|
| 902 |
continue;
|
1058 |
continue;
|
| 903 |
}
|
1059 |
}
|
| 904 |
|
1060 |
|
| 905 |
LineItem lineItem = order.getLineitems().get(0);
|
1061 |
LineItem lineItem = order.getLineitems().get(0);
|
| 906 |
double transferPrice = lineItem.getTransfer_price();
|
1062 |
double transferPrice = lineItem.getTransfer_price();
|
| Line 982... |
Line 1138... |
| 982 |
if (payment != null) {
|
1138 |
if (payment != null) {
|
| 983 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
1139 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
| 984 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
1140 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
| 985 |
contentRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue(payment.getStatus().name());
|
1141 |
contentRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue(payment.getStatus().name());
|
| 986 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
1142 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
| 987 |
|
- |
|
| 988 |
if(refunds.containsKey(payment.getPaymentId())) {
|
- |
|
| 989 |
refund = refunds.get(payment.getPaymentId()).getNetCollection();
|
- |
|
| 990 |
refunds.remove(payment.getPaymentId());
|
- |
|
| 991 |
}
|
- |
|
| 992 |
contentRow.createCell(OrderReportColumn.REFUND.getValue()).setCellValue(refund);
|
- |
|
| 993 |
}
|
1143 |
}
|
| 994 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
1144 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
| 995 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(serviceTax);
|
1145 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(serviceTax);
|
| 996 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(otherCollectionCharges);
|
1146 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(otherCollectionCharges);
|
| 997 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(netCollection);
|
1147 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(netCollection);
|
| 998 |
contentRow.createCell(OrderReportColumn.FINAL_AMOUNT.getValue()).setCellValue(netCollection - refund);
|
1148 |
contentRow.createCell(OrderReportColumn.FINAL_AMOUNT.getValue()).setCellValue(netCollection - refund);
|
| 999 |
|
- |
|
| 1000 |
contentRow.createCell(OrderReportColumn.IS_RESHIPED_ORDER.getValue()).setCellValue(isReshippedOrder ? 1 : 0);
|
- |
|
| 1001 |
}
|
1149 |
}
|
| 1002 |
}
|
1150 |
}
|
| 1003 |
|
1151 |
|
| 1004 |
logger.info("Reshipped Orders ", reshippedOrders);
|
1152 |
logger.info("Reshipped Orders ", reshippedOrders);
|
| 1005 |
|
1153 |
|
| 1006 |
logger.info("Order Ids where no successful payment was found: " + orderIdsWithoutSuccess.size());
|
1154 |
logger.info("Order Ids where no successful payment was found: " + orderIdsWithoutSuccess.size());
|
| 1007 |
logger.info(orderIdsWithoutSuccess.toString());
|
1155 |
logger.info(orderIdsWithoutSuccess.toString());
|
| 1008 |
logger.info("Pending Refunds: " + refunds);
|
- |
|
| 1009 |
logger.info("Reshipped Order Ids" + reshippedOrderIds);
|
1156 |
logger.info("Reshipped Order Ids: " + reshippedOrderIds);
|
| 1010 |
logger.info("countMultipleOrderTxns: " + countMultipleOrderTxns);
|
1157 |
logger.info("countMultipleOrderTxns: " + countMultipleOrderTxns);
|
| 1011 |
|
1158 |
|
| 1012 |
sheet.createRow(serialNo++);
|
1159 |
sheet.createRow(serialNo++);
|
| - |
|
1160 |
|
| - |
|
1161 |
List<PaymentSettlement> refundSettlements = transactionClient.getSettlementsByDate(startDate.getTime(), endDate.getTime(), true);
|
| - |
|
1162 |
logger.info("Refunds: " + refundSettlements.size());
|
| - |
|
1163 |
logger.info(refundSettlements.toString());
|
| 1013 |
|
1164 |
|
| - |
|
1165 |
Map<Long, PaymentSettlement> refunds = new HashMap<Long, PaymentSettlement>();
|
| - |
|
1166 |
|
| - |
|
1167 |
for (PaymentSettlement settlement: refundSettlements) {
|
| - |
|
1168 |
refunds.put(settlement.getPaymentId(), settlement);
|
| - |
|
1169 |
}
|
| - |
|
1170 |
|
| 1014 |
// Refunds belonging to orders billed before the start date of supplied billing date range
|
1171 |
// Refunds belonging to orders billed before the start date of supplied billing date range
|
| 1015 |
for (long paymentId: refunds.keySet()) {
|
1172 |
for (long paymentId: refunds.keySet()) {
|
| 1016 |
Payment payment = paymentClient.getPayment(paymentId);
|
1173 |
Payment payment = paymentClient.getPayment(paymentId);
|
| 1017 |
Transaction txn = transactionClient.getTransaction(payment.getMerchantTxnId());
|
1174 |
Transaction txn = transactionClient.getTransaction(payment.getMerchantTxnId());
|
| 1018 |
PaymentSettlement paymentSettlement = refunds.get(paymentId);
|
1175 |
PaymentSettlement paymentSettlement = refunds.get(paymentId);
|
| Line 1040... |
Line 1197... |
| 1040 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(transferPrice);
|
1197 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(transferPrice);
|
| 1041 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
1198 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
| 1042 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(transferPrice * lineItem.getQuantity());
|
1199 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(transferPrice * lineItem.getQuantity());
|
| 1043 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
|
1200 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
|
| 1044 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatusDescription());
|
1201 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatusDescription());
|
| 1045 |
|
1202 |
|
| 1046 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
1203 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
| 1047 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
1204 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
| 1048 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentType);
|
1205 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentType);
|
| 1049 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
1206 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
| 1050 |
contentRow.createCell(OrderReportColumn.REFUND.getValue()).setCellValue(paymentSettlement.getNetCollection());
|
- |
|
| 1051 |
|
1207 |
|
| 1052 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
1208 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
| 1053 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(0.0);
|
1209 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(0.0);
|
| 1054 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(0.0);
|
1210 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(0.0);
|
| 1055 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(paymentSettlement.getNetCollection());
|
1211 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(paymentSettlement.getNetCollection());
|