| Line 1053... |
Line 1053... |
| 1053 |
customInsurancePolicy.setNetAmount(insurancePolicy.getSaleAmount());
|
1053 |
customInsurancePolicy.setNetAmount(insurancePolicy.getSaleAmount());
|
| 1054 |
customInsurancePolicies.add(customInsurancePolicy);
|
1054 |
customInsurancePolicies.add(customInsurancePolicy);
|
| 1055 |
}
|
1055 |
}
|
| 1056 |
pdfModel.setInsurancePolicies(customInsurancePolicies);
|
1056 |
pdfModel.setInsurancePolicies(customInsurancePolicies);
|
| 1057 |
|
1057 |
|
| 1058 |
pdfModel.setCustomer(getCustomCustomer(fofoOrder));
|
- |
|
| 1059 |
pdfModel.setInvoiceNumber(fofoOrder.getInvoiceNumber());
|
- |
|
| 1060 |
pdfModel.setTotalAmount(fofoOrder.getTotalAmount());
|
- |
|
| 1061 |
|
- |
|
| 1062 |
Retailer retailer = retailerRepository.selectById(fofoOrder.getFofoId());
|
1058 |
Retailer retailer = retailerRepository.selectById(fofoOrder.getFofoId());
|
| 1063 |
PrivateDealUser privateDealUser = null;
|
1059 |
PrivateDealUser privateDealUser = null;
|
| 1064 |
try {
|
1060 |
try {
|
| 1065 |
privateDealUser = privateDealUserRepository.selectById(retailer.getId());
|
1061 |
privateDealUser = privateDealUserRepository.selectById(retailer.getId());
|
| 1066 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
1062 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| Line 1084... |
Line 1080... |
| 1084 |
}
|
1080 |
}
|
| 1085 |
Address retailerAddress = addressRepository.selectById(retailerRegisteredAddressRepository.selectAddressIdByRetailerId(retailer.getId()));
|
1081 |
Address retailerAddress = addressRepository.selectById(retailerRegisteredAddressRepository.selectAddressIdByRetailerId(retailer.getId()));
|
| 1086 |
customRetailer.setAddress(this.createCustomAddress(retailerAddress));
|
1082 |
customRetailer.setAddress(this.createCustomAddress(retailerAddress));
|
| 1087 |
pdfModel.setRetailer(customRetailer);
|
1083 |
pdfModel.setRetailer(customRetailer);
|
| 1088 |
|
1084 |
|
| - |
|
1085 |
pdfModel.setCustomer(getCustomCustomer(fofoOrder, customRetailer.getAddress()));
|
| - |
|
1086 |
pdfModel.setInvoiceNumber(fofoOrder.getInvoiceNumber());
|
| - |
|
1087 |
pdfModel.setTotalAmount(fofoOrder.getTotalAmount());
|
| - |
|
1088 |
|
| - |
|
1089 |
|
| 1089 |
Set<CustomOrderItem> customerFofoOrderItems = new HashSet<>();
|
1090 |
Set<CustomOrderItem> customerFofoOrderItems = new HashSet<>();
|
| 1090 |
for (FofoOrderItem fofoOrderItem : fofoOrderItems) {
|
1091 |
for (FofoOrderItem fofoOrderItem : fofoOrderItems) {
|
| 1091 |
float discount = fofoOrderItem.getDiscount();
|
1092 |
float discount = fofoOrderItem.getDiscount();
|
| 1092 |
CustomOrderItem customFofoOrderItem = new CustomOrderItem();
|
1093 |
CustomOrderItem customFofoOrderItem = new CustomOrderItem();
|
| 1093 |
float totalTaxRate = fofoOrderItem.getIgstRate() + fofoOrderItem.getSgstRate() + fofoOrderItem.getCgstRate();
|
1094 |
float totalTaxRate = fofoOrderItem.getIgstRate() + fofoOrderItem.getSgstRate() + fofoOrderItem.getCgstRate();
|
| Line 1155... |
Line 1156... |
| 1155 |
pdfModel.setTncs(tncs);
|
1156 |
pdfModel.setTncs(tncs);
|
| 1156 |
return pdfModel;
|
1157 |
return pdfModel;
|
| 1157 |
|
1158 |
|
| 1158 |
}
|
1159 |
}
|
| 1159 |
|
1160 |
|
| 1160 |
private CustomCustomer getCustomCustomer(FofoOrder fofoOrder) throws ProfitMandiBusinessException {
|
1161 |
private CustomCustomer getCustomCustomer(FofoOrder fofoOrder, CustomAddress retailerAddress) throws ProfitMandiBusinessException {
|
| 1161 |
Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
|
1162 |
Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
|
| 1162 |
CustomCustomer customCustomer = new CustomCustomer();
|
1163 |
CustomCustomer customCustomer = new CustomCustomer();
|
| 1163 |
customCustomer.setFirstName(customer.getFirstName());
|
1164 |
customCustomer.setFirstName(customer.getFirstName());
|
| 1164 |
customCustomer.setLastName(customer.getLastName());
|
1165 |
customCustomer.setLastName(customer.getLastName());
|
| 1165 |
customCustomer.setEmailId(customer.getEmailId());
|
1166 |
customCustomer.setEmailId(customer.getEmailId());
|
| Line 1167... |
Line 1168... |
| 1167 |
customCustomer.setGstNumber(fofoOrder.getCustomerGstNumber());
|
1168 |
customCustomer.setGstNumber(fofoOrder.getCustomerGstNumber());
|
| 1168 |
if (fofoOrder.getCustomerAddressId() != 0) {
|
1169 |
if (fofoOrder.getCustomerAddressId() != 0) {
|
| 1169 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
1170 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
| 1170 |
customCustomer.setAddress(this.createCustomAddress(customerAddress));
|
1171 |
customCustomer.setAddress(this.createCustomAddress(customerAddress));
|
| 1171 |
} else {
|
1172 |
} else {
|
| - |
|
1173 |
|
| 1172 |
customCustomer.setAddress(this.createCustomAddressWithoutId(customCustomer));
|
1174 |
customCustomer.setAddress(this.createCustomAddressWithoutId(customCustomer, retailerAddress));
|
| 1173 |
}
|
1175 |
}
|
| 1174 |
return customCustomer;
|
1176 |
return customCustomer;
|
| 1175 |
|
1177 |
|
| 1176 |
}
|
1178 |
}
|
| 1177 |
|
1179 |
|
| Line 1680... |
Line 1682... |
| 1680 |
customAddress.setCountry(customerAddress.getCountry());
|
1682 |
customAddress.setCountry(customerAddress.getCountry());
|
| 1681 |
customAddress.setPhoneNumber(customerAddress.getPhoneNumber());
|
1683 |
customAddress.setPhoneNumber(customerAddress.getPhoneNumber());
|
| 1682 |
return customAddress;
|
1684 |
return customAddress;
|
| 1683 |
}
|
1685 |
}
|
| 1684 |
|
1686 |
|
| 1685 |
private CustomAddress createCustomAddressWithoutId(CustomCustomer customerAddress) {
|
1687 |
private CustomAddress createCustomAddressWithoutId(CustomCustomer customerAddress, CustomAddress retailerAddress) {
|
| 1686 |
CustomAddress customAddress = new CustomAddress();
|
1688 |
CustomAddress customAddress = new CustomAddress();
|
| 1687 |
customAddress.setName(customerAddress.getFirstName());
|
1689 |
customAddress.setName(customerAddress.getFirstName());
|
| 1688 |
customAddress.setLastName(customerAddress.getLastName());
|
1690 |
customAddress.setLastName(customerAddress.getLastName());
|
| 1689 |
customAddress.setLine1("");
|
1691 |
customAddress.setLine1("");
|
| 1690 |
customAddress.setLine2("");
|
1692 |
customAddress.setLine2("");
|
| 1691 |
customAddress.setLandmark("");
|
1693 |
customAddress.setLandmark("");
|
| 1692 |
customAddress.setCity("");
|
1694 |
customAddress.setCity(retailerAddress.getCity());
|
| 1693 |
customAddress.setPinCode("");
|
1695 |
customAddress.setPinCode(retailerAddress.getPinCode());
|
| 1694 |
customAddress.setState("");
|
1696 |
customAddress.setState(retailerAddress.getState());
|
| 1695 |
customAddress.setCountry("");
|
1697 |
customAddress.setCountry("");
|
| 1696 |
customAddress.setPhoneNumber(customerAddress.getMobileNumber());
|
1698 |
customAddress.setPhoneNumber(customerAddress.getMobileNumber());
|
| 1697 |
return customAddress;
|
1699 |
return customAddress;
|
| 1698 |
}
|
1700 |
}
|
| 1699 |
|
1701 |
|