Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. unikMap.put((string.valueOF(ar.get('prdName'))+string.valueOf(ar.get('clr'))+string.valueOf(ar.get('cnd'))+string.valueOf(ar.get('gen'))),string.valueOf(ar.get('str')));
  2. }
  3.  
  4. //Get all the Quote line items to get start and end numbers
  5. QLI= [select Id,Product2Id,Product2.Name,Quote.QuoteNumber,Quote.Contact.Name,Quote.Discount_Amount__c,Quote.Bulk_Discount_Total__c,Quote.Grand_Total_Exclude__c,Quote.MWST_Calculation__c,
  6. Quote.MwSt_Procent__c,Quote.Subtotal_Exclude__c,Quote.Total_Price_Exclude__c,//Discount_Amount__c,
  7. Quote.Subtotal,Quote.GrandTotal,Quote.Contact.LastName,Quote.Contact.Account.billingCity,Quote.Contact.Account.billingstreet,Quote.Contact.Account.billingpostalCode,Quote.Contact.Account.Name,
  8. Quote.Contact.Account.Phone,Quote.Contact.MobilePhone,Quote.Contact.Email,Product2.Colour__c,Product2.Product_Image__r.skuid__Url__c,Product2.Related_Image__r.skuid__Url__c,Sales_Price_Exclude__c,
  9. LineNumber,Product2.Article_Image__c,Product2.Condition__c,PriceBookEntry.Name,Product2.Generation__c,UnitPrice,Discount_Amount__c,Bulk_Discount__c,Pos__c from QuoteLineItem
  10. where QuoteId =:QuoteID order by Pos__c];
  11.  
  12. string strST,strND,imgURL;
  13. QuoteLineItem objQLI = new QuoteLineItem();
  14. boolean firstime= false;
  15. exclPrice = 0.00;
  16. InclPrice = 0.00;
  17. bulkDiscount = 0.00;
  18. for(string str:unikMap.keyset()){
  19. imgURL = '';
  20. QLWrap QLWrap1 = new QLWrap();
  21. boolean uniString = false;
  22. Decimal disAmount = 0;
  23. system.debug('**********'+str);
  24.  
  25. for(QuoteLineItem objQL:QLI){
  26. if((string.valueOF(objQL.Product2.Name)+string.valueOf(objQL.Product2.Colour__c)+string.valueOf(objQL.Product2.Condition__c)+string.valueOf(objQL.Product2.Generation__c)).equals(str)){
  27. if(uniString ==false ){
  28. strST = string.valueOf(objQL.Pos__c);
  29.  
  30. if(objQL.Product2.Related_Image__r.skuid__Url__c != null)
  31. imgURL = string.valueOf(objQL.Product2.Related_Image__r.skuid__Url__c);
  32. system.debug('**********'+objQL.Pos__c);
  33. uniString = true;
  34. objQLI = objQL;
  35. }
  36. if(objQL.Discount_Amount__c != null)
  37. disAmount += objQL.Discount_Amount__c;
  38. strND = string.valueOf(objQL.Pos__c);
  39. system.debug('SE no::>:::::'+strST+'--'+strND);
  40. if(objQL.Sales_Price_Exclude__c!=null)
  41. exclPrice = exclPrice+objQL.Sales_Price_Exclude__c;
  42. InclPrice = InclPrice+objQL.UnitPrice;
  43. bulkDiscount = bulkDiscount+objQL.Discount_Amount__c;
  44.  
  45. }
  46. }
  47. QLWrap1.FT = (strST+'-'+strND);
  48. QLWrap1.objWrQL = objQLI;
  49. QLWrap1.QTY = integer.valueOf(unikMap.get(str));
  50. QLWrap1.DiscAmount = disAmount;
  51. QLWrap1.imageURL = imgURL.removeStart('<img src="').removeEnd('" alt="[Click Here]" height="100" width="200" border="0"/>');
  52. system.debug('####'+imgURL.removeStart('<img src="').removeEnd('" alt="[Click Here]" height="100" width="200" border="0"/>'));
  53. system.debug('****'+imgURL);
  54. lstWrap.add(QLWrap1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement