Subversion Repositories SmartDukaan

Rev

Rev 34956 | Rev 34958 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34956 Rev 34957
Line 153... Line 153...
153
                throw new ProfitMandiBusinessException("Item Quantity", "", "Should be greater than 0");
153
                throw new ProfitMandiBusinessException("Item Quantity", "", "Should be greater than 0");
154
            }
154
            }
155
 
155
 
156
            List<CartItem> cartItems = new ArrayList<>();
156
            List<CartItem> cartItems = new ArrayList<>();
157
            double totalPayableAmount = 0;
157
            double totalPayableAmount = 0;
-
 
158
            BigDecimal totalPayableAmountBD = new BigDecimal(0);
158
            for (BulkOrderModel fofoBulkOrderModel : fofoBulkOrderModels) {
159
            for (BulkOrderModel fofoBulkOrderModel : fofoBulkOrderModels) {
159
                CartItem cartItem = new CartItem();
160
                CartItem cartItem = new CartItem();
160
                cartItem.setQuantity(fofoBulkOrderModel.getQuantity());
161
                cartItem.setQuantity(fofoBulkOrderModel.getQuantity());
161
                cartItem.setItemId(fofoBulkOrderModel.getItemId());
162
                cartItem.setItemId(fofoBulkOrderModel.getItemId());
162
                TagListing tagListing = tagListingRepository.selectByItemId(fofoBulkOrderModel.getItemId());
163
                TagListing tagListing = tagListingRepository.selectByItemId(fofoBulkOrderModel.getItemId());
Line 188... Line 189...
188
                    } else {
189
                    } else {
189
                        throw new ProfitMandiBusinessException("Given price is greater than selling price for item Id - ", itemId, " it should be less or equal of DP");
190
                        throw new ProfitMandiBusinessException("Given price is greater than selling price for item Id - ", itemId, " it should be less or equal of DP");
190
                    }
191
                    }
191
 
192
 
192
                }
193
                }
193
                totalPayableAmount += (long) cartItem.getSellingPrice() * cartItem.getQuantity();
194
                totalPayableAmountBD.add(new BigDecimal(String.valueOf(cartItem.getSellingPrice())).multiply(new BigDecimal(cartItem.getQuantity())));
194
                cartItems.add(cartItem);
195
                cartItems.add(cartItem);
195
            }
196
            }
-
 
197
            totalPayableAmount = totalPayableAmountBD.doubleValue();
196
            Bid bid = null;
198
            Bid bid = null;
197
            if (type.equals(ProfitMandiConstants.PO_TYPE.AUTO)) {
199
            if (type.equals(ProfitMandiConstants.PO_TYPE.AUTO)) {
198
                bid = bidRepository.selectById(fofoBulkOrderModels.get(0).getRowIndex());
200
                bid = bidRepository.selectById(fofoBulkOrderModels.get(0).getRowIndex());
199
                approvalRequired = false;
201
                approvalRequired = false;
200
                totalPayableAmount = totalPayableAmount - ProfitMandiConstants.BID_CHARGES;
202
                totalPayableAmount = totalPayableAmountBD.doubleValue() - ProfitMandiConstants.BID_CHARGES;
201
            }
203
            }
202
            LOGGER.info("totalAmount of item " + totalPayableAmount);
204
            LOGGER.info("totalAmount of item " + totalPayableAmount);
203
            double walletAmount = walletService.getWalletAmount(fofoId);
205
            double walletAmount = walletService.getWalletAmount(fofoId);
204
 
206
 
205
            BigDecimal creditAvailability = sdCreditService.getAvailableAmount(fofoId);
207
            BigDecimal creditAvailability = sdCreditService.getAvailableAmount(fofoId);