1 package org.kuali.ole.ingest;
2
3 import org.apache.commons.lang3.StringUtils;
4 import org.apache.log4j.Logger;
5 import org.kuali.ole.OLEConstants;
6 import org.kuali.ole.pojo.OleInvoiceRecord;
7 import org.kuali.ole.pojo.edi.*;
8 import org.kuali.ole.select.OleSelectConstant;
9 import org.kuali.ole.sys.context.SpringContext;
10 import org.kuali.ole.vnd.businessobject.OleCurrencyType;
11 import org.kuali.ole.vnd.businessobject.VendorAlias;
12 import org.kuali.rice.krad.service.BusinessObjectService;
13 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
14 import org.kuali.rice.krad.service.LookupService;
15
16 import java.text.NumberFormat;
17 import java.text.ParsePosition;
18 import java.util.HashMap;
19 import java.util.List;
20 import java.util.Map;
21
22
23
24
25
26
27
28
29 public class OleInvoiceRecordBuilder {
30 private static final Logger LOG = Logger.getLogger(OleInvoiceRecordBuilder.class);
31 private static OleInvoiceRecordBuilder oleInvoiceRecordBuilder;
32 protected BusinessObjectService businessObjectService;
33
34
35
36
37
38 private OleInvoiceRecordBuilder(){
39
40 }
41
42
43
44
45
46
47 public static OleInvoiceRecordBuilder getInstance() {
48 if (null == oleInvoiceRecordBuilder) {
49 oleInvoiceRecordBuilder = new OleInvoiceRecordBuilder();
50 }
51 return oleInvoiceRecordBuilder;
52 }
53
54 protected BusinessObjectService getBusinessObjectService() {
55 if (businessObjectService == null) {
56 businessObjectService = SpringContext.getBean(BusinessObjectService.class);
57 }
58 return businessObjectService;
59 }
60
61 private LookupService getLookupService() {
62 return KRADServiceLocatorWeb.getLookupService();
63 }
64
65
66 public OleInvoiceRecord build(LineItemOrder lineItemOrder, INVOrder invOrder) throws Exception {
67
68 OleInvoiceRecord oleInvoiceRecord = new OleInvoiceRecord();
69
70 oleInvoiceRecord.setListPrice(getListPrice(lineItemOrder));
71 oleInvoiceRecord.setUnitPrice(populateUnitPrice(lineItemOrder));
72 oleInvoiceRecord.setQuantity(getQuantity(lineItemOrder));
73 oleInvoiceRecord.setVendorItemIdentifier(getVendorItemIdentifier(lineItemOrder)!=null?getVendorItemIdentifier(lineItemOrder):getVendorIdentifierByPIA(lineItemOrder));
74 oleInvoiceRecord.setBfnNumber(getBFNNumber(lineItemOrder));
75 oleInvoiceRecord.setVendorNumber(getVendorNumber(invOrder,oleInvoiceRecord));
76 if(StringUtils.isBlank(oleInvoiceRecord.getVendorNumber())){
77 oleInvoiceRecord.setVendorAlias(getVendorAlias(invOrder));
78 oleInvoiceRecord.setVendorNumber(getVendorNumberFromVendorAlias(oleInvoiceRecord,invOrder));
79 }
80 oleInvoiceRecord.setItemChartCode(OLEConstants.OleInvoiceImport.ITM_CHART_CODE);
81 oleInvoiceRecord.setInvoiceNumber(getInvoiceNumber(invOrder));
82 oleInvoiceRecord.setInvoiceDate(getInvoiceDate(invOrder));
83 oleInvoiceRecord.setVendorInvoiceAmount(getVendorInvoiceAmount(invOrder));
84
85
86 oleInvoiceRecord.setISBN(getISBN(lineItemOrder) == null? getLineItemISBN(lineItemOrder):getISBN(lineItemOrder));
87 oleInvoiceRecord.setISSN(getISSN(lineItemOrder));
88
89 oleInvoiceRecord.setBillToCustomerID(populateBillToCustomerId(invOrder));
90 oleInvoiceRecord.setItemDescription(getItemDescription(lineItemOrder));
91 oleInvoiceRecord.setNumberOfCopiesOrdered(oleInvoiceRecord.getQuantity());
92
93 oleInvoiceRecord.setSubscriptionPeriodFrom(getSubscriptionDateFrom(lineItemOrder));
94 oleInvoiceRecord.setSubscriptionPeriodTo(getSubscriptionDateTo(lineItemOrder));
95 oleInvoiceRecord.setSummaryAmount(getSummaryCharge(invOrder));
96 oleInvoiceRecord.setAdditionalChargeCode(getAdditionChargeCode(invOrder));
97 oleInvoiceRecord.setAdditionalCharge(getAdditionCharge(invOrder));
98 oleInvoiceRecord.setLineItemAdditionalChargeCode(populateLineItemChargeCode(lineItemOrder));
99 oleInvoiceRecord.setLineItemAdditionalCharge(populateLineItemAdditionalCharge(lineItemOrder));
100 oleInvoiceRecord.setPurchaseOrderNumber(getPurchaseOrderNumber(lineItemOrder));
101 setCurrencyDetails(invOrder,oleInvoiceRecord);
102 return oleInvoiceRecord;
103 }
104
105 private String getVendorNumberFromVendorAlias(OleInvoiceRecord oleInvoiceRecord,INVOrder invOrder) throws Exception{
106 if(StringUtils.isNotBlank(oleInvoiceRecord.getVendorAlias())){
107 Map vendorAliasMap = new HashMap();
108 vendorAliasMap.put(org.kuali.ole.sys.OLEConstants.VENDOR_ALIAS_NAME, oleInvoiceRecord.getVendorAlias());
109 List<VendorAlias> vendorAliasList = (List<VendorAlias>) getLookupService().findCollectionBySearchHelper(VendorAlias.class, vendorAliasMap, true);
110 if (vendorAliasList != null && vendorAliasList.size() > 0) {
111 return vendorAliasList.get(0).getVendorHeaderGeneratedIdentifier() + "-" + vendorAliasList.get(0).getVendorDetailAssignedIdentifier();
112
113 }else{
114 if(oleInvoiceRecord.getVendorItemIdentifier() == null)
115 throw new Exception("The vendor alias in Edifact file doesn't match in database for invoice number:: "+getInvoiceNumber(invOrder)+" and invoice date:: "+getInvoiceDate(invOrder));
116 }
117 }
118 return null;
119 }
120
121 private void setCurrencyDetails(INVOrder invOrder,OleInvoiceRecord oleInvoiceRecord){
122 if(invOrder.getMessage() != null && invOrder.getMessage().getCurrencyDetails() != null && invOrder.getMessage().getCurrencyDetails().getCurrencyDetailsSupplierInformation() != null){
123 if(!StringUtils.isBlank(invOrder.getMessage().getCurrencyDetails().getCurrencyDetailsSupplierInformation().getCurrencyType())){
124 Map<String,String> currencyTypeMap = new HashMap<>();
125 currencyTypeMap.put(OLEConstants.CURR_ALPHA_CD, invOrder.getMessage().getCurrencyDetails().getCurrencyDetailsSupplierInformation().getCurrencyType());
126 List<OleCurrencyType> currencyTypeList = (List) getBusinessObjectService().findMatching(OleCurrencyType.class, currencyTypeMap);
127 if(currencyTypeList != null && currencyTypeList.size() >0){
128 oleInvoiceRecord.setCurrencyTypeId(currencyTypeList.get(0).getCurrencyTypeId().toString());
129 oleInvoiceRecord.setCurrencyType(currencyTypeList.get(0).getCurrencyType());
130 if (!oleInvoiceRecord.getCurrencyType().equalsIgnoreCase(OleSelectConstant.CURRENCY_TYPE_NAME)) {
131 oleInvoiceRecord.setForeignListPrice(oleInvoiceRecord.getListPrice());
132 }
133 }
134 }
135 }
136 }
137
138 private String populateBillToCustomerId(INVOrder invOrder){
139 if(invOrder.getMessage() != null && invOrder.getMessage().getPartyQualifier() != null && invOrder.getMessage().getPartyQualifier().size() > 0){
140 for(int i=0;i<invOrder.getMessage().getPartyQualifier().size();i++){
141 if(invOrder.getMessage().getPartyQualifier().get(i).getPartyCode()!=null && invOrder.getMessage().getPartyQualifier().get(i).getPartyCode().equalsIgnoreCase("BY")){
142 return invOrder.getMessage().getPartyQualifier().get(i).getPartyInformation().getCodeIdentification();
143 } else if(invOrder.getMessage() != null && invOrder.getMessage().getBuyerAdditionalPartyIdentifier() != null && invOrder.getMessage().getBuyerAdditionalPartyIdentifier().getBuyerIdentifier() != null &&
144 invOrder.getMessage().getBuyerAdditionalPartyIdentifier().getBuyerIdentifier().getBuyerReferenceQualifier().equalsIgnoreCase("API")){
145 return invOrder.getMessage().getBuyerAdditionalPartyIdentifier().getBuyerIdentifier().getBuyerReferenceNumber();
146 }
147 }
148 }
149 return null;
150 }
151
152 private Integer getPurchaseOrderNumber(LineItemOrder lineItemOrder)throws Exception{
153 if(lineItemOrder.getSupplierReferenceInformation() != null && lineItemOrder.getSupplierReferenceInformation().size() > 0){
154 for(int i=0;i<lineItemOrder.getSupplierReferenceInformation().size();i++){
155 if(lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference() != null &&
156 lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().size() >0){
157 for(int j=0;j<lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().size();j++){
158 if(lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getSuppliersOrderLine() != null &&
159 lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getSuppliersOrderLine().equals("ON")){
160 try{
161 if (lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getVendorReferenceNumber() != null &&
162 isNumeric(lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getVendorReferenceNumber())) {
163 return Integer.parseInt(lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getVendorReferenceNumber());
164 }
165 else {
166 return 0;
167 }
168
169
170 }catch(Exception e){
171 LOG.error("Purchase Order Number should be a number but invoice file has :"+lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getVendorReferenceNumber());
172 throw new Exception("Purchase Order Number should be a number but invoice file has :"+lineItemOrder.getSupplierReferenceInformation().get(i).getSupplierLineItemReference().get(j).getVendorReferenceNumber(),e);
173 }
174 }
175 }
176
177 }
178 }
179
180 }
181
182
183
184
185
186 return null;
187 }
188
189 private String populateUnitPrice(LineItemOrder lineItemOrder){
190 if(lineItemOrder.getMonetaryDetail() != null){
191 if(lineItemOrder.getMonetaryDetail().get(0).getMonetaryLineItemInformation() != null){
192 return lineItemOrder.getMonetaryDetail().get(0).getMonetaryLineItemInformation().get(0).getAmount();
193 }
194 }
195 return null;
196 }
197
198 private String populateLineItemChargeCode(LineItemOrder lineItemOrder){
199 if(lineItemOrder.getLineItemAllowanceOrCharge() != null){
200 if(lineItemOrder.getLineItemAllowanceOrCharge().get(0).getLineItemSpecialServiceIdentification()!= null){
201 return lineItemOrder.getLineItemAllowanceOrCharge().get(0).getLineItemSpecialServiceIdentification().get(0).getSpecialServiceCode();
202 }
203 }
204 return null;
205 }
206
207 private String populateLineItemAdditionalCharge(LineItemOrder lineItemOrder){
208 if(lineItemOrder.getAllowanceMonetaryDetail()!= null){
209 if(lineItemOrder.getAllowanceMonetaryDetail().get(0).getAllowanceMonetaryLineItemInformation() != null){
210 return lineItemOrder.getAllowanceMonetaryDetail().get(0).getAllowanceMonetaryLineItemInformation().get(0).getAmount();
211 }
212 }
213 return null;
214 }
215
216
217 private String getAdditionCharge(INVOrder invOrder) {
218 if(invOrder.getMessage().getMonetary() != null){
219 if(invOrder.getMessage().getMonetary().getMonetaryInformation() != null){
220 return invOrder.getMessage().getMonetary().getMonetaryInformation().getAmount();
221 }
222 }
223 return null;
224 }
225
226
227 private String getAdditionChargeCode(INVOrder invOrder) {
228 if(invOrder.getMessage().getAllowanceOrCharge() != null){
229 if(invOrder.getMessage().getAllowanceOrCharge().getSpecialServiceIdentification() != null){
230 return invOrder.getMessage().getAllowanceOrCharge().getSpecialServiceIdentification().getSpecialServiceCode();
231 }
232 }
233 return null;
234 }
235
236
237
238
239
240
241
242
243 private String getListPrice(LineItemOrder lineItemOrder) {
244 List<PriceInformation> priceInformation = lineItemOrder.getPriceInformation();
245 if (priceInformation !=null && priceInformation.size() > 0) {
246 List<ItemPrice> itemPrice = priceInformation.get(0).getItemPrice();
247
248 if (itemPrice != null && itemPrice.size() > 0) {
249 String priceCode = itemPrice.get(0).getGrossPrice();
250 if(priceCode != null && (priceCode.equalsIgnoreCase("AAB") || priceCode.equalsIgnoreCase("CAL"))){
251 return itemPrice.get(0).getPrice();
252 }
253 }
254 }
255 return null;
256 }
257
258
259
260
261
262
263
264
265 private String getQuantity(LineItemOrder lineItemOrder) {
266 List<QuantityInformation> quantityInformation = lineItemOrder.getQuantityInformation();
267 if (quantityInformation != null && quantityInformation.size() > 0) {
268 List<Qunatity> qunatity = quantityInformation.get(0).getQunatity();
269 if (qunatity.size() > 0) {
270 return qunatity.get(0).getQuantity();
271 }
272 }
273 return null;
274 }
275
276 private String getVendorIdentifierByPIA(LineItemOrder lineItemOrder) {
277 List<ProductFunction> productFunction = lineItemOrder.getProductFunction();
278 if(productFunction != null && productFunction.size()>0){
279 for(int i=0;i<productFunction.size();i++){
280 if(productFunction.get(i).getProductArticleNumber() != null && productFunction.get(i).getProductArticleNumber().size()>0){
281 if(productFunction.get(i).getProductArticleNumber().get(0).getProductItemNumberType().equalsIgnoreCase("SA")){
282 return productFunction.get(i).getProductArticleNumber().get(0).getProductIsbn();
283 }
284 }
285 }
286 }
287 return null;
288 }
289
290 public String getVendorItemIdentifier(LineItemOrder lineItemOrder) {
291 List<SupplierReferenceInformation> supplierReferenceInformationList = lineItemOrder.getSupplierReferenceInformation();
292 if (supplierReferenceInformationList != null && supplierReferenceInformationList.size() > 0) {
293 for(int i=0;i<supplierReferenceInformationList.size();i++){
294 SupplierReferenceInformation supplierReferenceInformation = supplierReferenceInformationList.get(i);
295 List<SupplierLineItemReference> supplierLineItemReferenceList = supplierReferenceInformation.getSupplierLineItemReference();
296 if (supplierLineItemReferenceList != null && supplierLineItemReferenceList.size() > 0) {
297 SupplierLineItemReference supplierLineItemReferenceRef = supplierLineItemReferenceList.get(0);
298 String supplierOrderLine = supplierLineItemReferenceRef.getSuppliersOrderLine();
299 String vendorItemReference = supplierLineItemReferenceRef.getVendorReferenceNumber();
300 if (supplierOrderLine.equals("SNA")) {
301 return vendorItemReference;
302 }
303 }
304 }
305 }
306 return null;
307 }
308
309 public String getBFNNumber(LineItemOrder lineItemOrder) {
310 List<SupplierReferenceInformation> supplierReferenceInformationList = lineItemOrder.getSupplierReferenceInformation();
311 if (supplierReferenceInformationList != null && supplierReferenceInformationList.size() > 0) {
312 for(int i=0;i<supplierReferenceInformationList.size();i++){
313 SupplierReferenceInformation supplierReferenceInformation = supplierReferenceInformationList.get(i);
314 List<SupplierLineItemReference> supplierLineItemReferenceList = supplierReferenceInformation.getSupplierLineItemReference();
315 if (supplierLineItemReferenceList != null && supplierLineItemReferenceList.size() > 0) {
316 SupplierLineItemReference supplierLineItemReferenceRef = supplierLineItemReferenceList.get(0);
317 String supplierOrderLine = supplierLineItemReferenceRef.getSuppliersOrderLine();
318 String vendorItemReference = supplierLineItemReferenceRef.getVendorReferenceNumber();
319 if (supplierOrderLine.equals("BFN")) {
320 return vendorItemReference;
321 }
322 }
323 }
324 }
325 return null;
326 }
327
328 private String getVendorAlias(INVOrder invOrder) throws Exception{
329 if(invOrder.getMessage().getSupplierAdditionalPartyIdentifier() != null && invOrder.getMessage().getSupplierAdditionalPartyIdentifier().getSupplierIdentifier() != null && StringUtils.isNotEmpty(invOrder.getMessage().getSupplierAdditionalPartyIdentifier().getSupplierIdentifier().getReferenceQualifier()) && invOrder.getMessage().getSupplierAdditionalPartyIdentifier().getSupplierIdentifier().getReferenceQualifier().equalsIgnoreCase("API")){
330 return invOrder.getMessage().getSupplierAdditionalPartyIdentifier().getSupplierIdentifier().getReferenceNumber();
331 }
332 return null;
333 }
334
335
336
337
338
339
340 private String getVendorNumber(INVOrder invOrder,OleInvoiceRecord oleInvoiceRecord) throws Exception{
341 try{
342 for(int i=0;i<invOrder.getMessage().getPartyQualifier().size();i++){
343 if(invOrder.getMessage().getPartyQualifier().get(i).getPartyCode()!=null && (invOrder.getMessage().getPartyQualifier().get(i).getPartyCode().equalsIgnoreCase("SR") || invOrder.getMessage().getPartyQualifier().get(i).getPartyCode().equalsIgnoreCase("SU"))){
344 if(StringUtils.isNotEmpty(invOrder.getMessage().getPartyQualifier().get(i).getPartyInformation().getCodeIdentification())){
345 return invOrder.getMessage().getPartyQualifier().get(i).getPartyInformation().getCodeIdentification();
346 }
347 }
348 }
349 }catch (Exception e){
350 if(oleInvoiceRecord.getVendorItemIdentifier() == null)
351 throw new Exception("Edifact file has no vendor number for invoice number:: "+getInvoiceNumber(invOrder)+" and invoice date:: "+getInvoiceDate(invOrder),e);
352 }
353 return null;
354 }
355
356
357
358
359
360
361
362 private String getInvoiceNumber(INVOrder invOrder)throws Exception{
363 try{
364 return invOrder.getMessage().getMessageBeginning().getMessageBeginningInterchangeControlReference();
365 }catch (Exception e){
366 throw new Exception("Edifact file has no invoice number.",e);
367 }
368 }
369
370
371
372
373
374
375 private String getInvoiceDate(INVOrder invOrder) throws Exception{
376 try{
377 return invOrder.getMessage().getMessageCreationInformation().getMessageCreationInfoDetails().getMessageCreationInfoDate();
378 }catch (Exception e){
379 throw new Exception("Edifact file has no invoice date.",e);
380 }
381 }
382
383
384 private String getForeignInvoiceAmount(INVOrder invOrder){
385
386 return null;
387 }
388
389 private String getVendorInvoiceAmount(INVOrder invOrder){
390 if(invOrder.getSummary() != null && invOrder.getSummary().getMonetarySummary() != null && invOrder.getSummary().getMonetarySummary().size() > 0){
391 for(int i=0;i<invOrder.getSummary().getMonetarySummary().size();i++){
392 MonetarySummary monetarySummary = (MonetarySummary)invOrder.getSummary().getMonetarySummary().get(i);
393 if(monetarySummary.getMonetarySummaryInformation()!=null && monetarySummary.getMonetarySummaryInformation().size()>0){
394 for(int j=0;j<monetarySummary.getMonetarySummaryInformation().size();j++){
395 if(monetarySummary.getMonetarySummaryInformation().get(0).getAmountType().equalsIgnoreCase("86")){
396 return monetarySummary.getMonetarySummaryInformation().get(0).getAmount();
397 }
398 }
399 }
400 }
401 }
402 return null;
403 }
404
405 private String getLineItemISBN(LineItemOrder lineItemOrder){
406 if(lineItemOrder.getLineItem() != null && lineItemOrder.getLineItem().get(0)!= null){
407 if(lineItemOrder.getLineItem().get(0).getLineItemArticleNumber() != null && lineItemOrder.getLineItem().get(0).getLineItemArticleNumber().get(0)!=null){
408 return lineItemOrder.getLineItem().get(0).getLineItemArticleNumber().get(0).getLineItemIsbn();
409 }
410 }
411 return null;
412 }
413
414 private String getISBN(LineItemOrder lineItemOrder){
415 if(lineItemOrder.getProductFunction()!= null && lineItemOrder.getProductFunction().size() > 0){
416 if(lineItemOrder.getProductFunction().get(0).getProductArticleNumber() != null && lineItemOrder.getProductFunction().get(0).getProductArticleNumber().size() > 0){
417 if(lineItemOrder.getProductFunction().get(0).getProductArticleNumber().get(0).getProductItemNumberType() != null){
418 return lineItemOrder.getProductFunction().get(0).getProductArticleNumber().get(0).getProductIsbn();
419 }
420 if(lineItemOrder.getProductFunction().get(0).getProductArticleNumber().get(0).getProductItemNumberType() == null &&
421 lineItemOrder.getProductFunction().get(0).getProductArticleNumber().get(0).getProductIsbn() != null){
422 return lineItemOrder.getProductFunction().get(0).getProductArticleNumber().get(0).getProductIsbn();
423 }
424 }
425 }
426 return null;
427 }
428
429 private String getISSN(LineItemOrder lineItemOrder){
430 if (lineItemOrder.getProductFunction()!= null && lineItemOrder.getProductFunction().size() > 0){
431 if(lineItemOrder.getProductFunction().get(0).getSupplierArticleNumber() != null && lineItemOrder.getProductFunction().get(0).getSupplierArticleNumber().size() > 0){
432 return lineItemOrder.getProductFunction().get(0).getSupplierArticleNumber().get(0).getIsbn();
433 }
434 }
435 return null;
436 }
437
438
439 private String getItemDescription(LineItemOrder lineItemOrder){
440 if(lineItemOrder.getItemDescriptionList() != null && lineItemOrder.getItemDescriptionList().size() > 0){
441 return lineItemOrder.getItemDescriptionList().get(0).getData();
442 }
443 return null;
444 }
445
446 private String getSubscriptionDateFrom(LineItemOrder lineItemOrder){
447 if(lineItemOrder.getDateTimeDetail() != null && lineItemOrder.getDateTimeDetail().size() > 0){
448 if(lineItemOrder.getDateTimeDetail().get(0).getDateTimeInformationList() != null && lineItemOrder.getDateTimeDetail().get(0).getDateTimeInformationList().size() > 0){
449 return lineItemOrder.getDateTimeDetail().get(0).getDateTimeInformationList().get(0).getPeriod();
450 }
451 }
452 return null;
453 }
454
455 private String getSubscriptionDateTo(LineItemOrder lineItemOrder){
456 if(lineItemOrder.getDateTimeDetail()!= null && lineItemOrder.getDateTimeDetail().size() > 1){
457 if(lineItemOrder.getDateTimeDetail().get(1).getDateTimeInformationList() != null && lineItemOrder.getDateTimeDetail().get(1).getDateTimeInformationList().size() > 0){
458 return lineItemOrder.getDateTimeDetail().get(1).getDateTimeInformationList().get(0).getPeriod();
459 }
460 }
461 return null;
462 }
463
464 private String getSummaryCharge(INVOrder invOrder){
465 if(invOrder.getSummary()!= null && invOrder.getSummary().getMonetarySummary() != null &&
466 invOrder.getSummary().getMonetarySummary().size()> 0){
467 if(invOrder.getSummary().getMonetarySummary().get(invOrder.getSummary().getMonetarySummary().size()-1).getMonetarySummaryInformation() != null && invOrder.getSummary().getMonetarySummary().get(invOrder.getSummary().getMonetarySummary().size()-1).getMonetarySummaryInformation().size() > 0){
468 invOrder.getSummary().getMonetarySummary().get(invOrder.getSummary().getMonetarySummary().size()-1).getMonetarySummaryInformation().get(0).getAmount();
469 }
470 }
471 return null;
472 }
473
474 private static boolean isNumeric(String str) {
475 NumberFormat formatter = NumberFormat.getInstance();
476 ParsePosition pos = new ParsePosition(0);
477 formatter.parse(str, pos);
478 return str.length() == pos.getIndex();
479 }
480
481 }