Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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')));
- }
- //Get all the Quote line items to get start and end numbers
- 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,
- Quote.MwSt_Procent__c,Quote.Subtotal_Exclude__c,Quote.Total_Price_Exclude__c,//Discount_Amount__c,
- Quote.Subtotal,Quote.GrandTotal,Quote.Contact.LastName,Quote.Contact.Account.billingCity,Quote.Contact.Account.billingstreet,Quote.Contact.Account.billingpostalCode,Quote.Contact.Account.Name,
- 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,
- LineNumber,Product2.Article_Image__c,Product2.Condition__c,PriceBookEntry.Name,Product2.Generation__c,UnitPrice,Discount_Amount__c,Bulk_Discount__c,Pos__c from QuoteLineItem
- where QuoteId =:QuoteID order by Pos__c];
- string strST,strND,imgURL;
- QuoteLineItem objQLI = new QuoteLineItem();
- boolean firstime= false;
- exclPrice = 0.00;
- InclPrice = 0.00;
- bulkDiscount = 0.00;
- for(string str:unikMap.keyset()){
- imgURL = '';
- QLWrap QLWrap1 = new QLWrap();
- boolean uniString = false;
- Decimal disAmount = 0;
- system.debug('**********'+str);
- for(QuoteLineItem objQL:QLI){
- 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)){
- if(uniString ==false ){
- strST = string.valueOf(objQL.Pos__c);
- if(objQL.Product2.Related_Image__r.skuid__Url__c != null)
- imgURL = string.valueOf(objQL.Product2.Related_Image__r.skuid__Url__c);
- system.debug('**********'+objQL.Pos__c);
- uniString = true;
- objQLI = objQL;
- }
- if(objQL.Discount_Amount__c != null)
- disAmount += objQL.Discount_Amount__c;
- strND = string.valueOf(objQL.Pos__c);
- system.debug('SE no::>:::::'+strST+'--'+strND);
- if(objQL.Sales_Price_Exclude__c!=null)
- exclPrice = exclPrice+objQL.Sales_Price_Exclude__c;
- InclPrice = InclPrice+objQL.UnitPrice;
- bulkDiscount = bulkDiscount+objQL.Discount_Amount__c;
- }
- }
- QLWrap1.FT = (strST+'-'+strND);
- QLWrap1.objWrQL = objQLI;
- QLWrap1.QTY = integer.valueOf(unikMap.get(str));
- QLWrap1.DiscAmount = disAmount;
- QLWrap1.imageURL = imgURL.removeStart('<img src="').removeEnd('" alt="[Click Here]" height="100" width="200" border="0"/>');
- system.debug('####'+imgURL.removeStart('<img src="').removeEnd('" alt="[Click Here]" height="100" width="200" border="0"/>'));
- system.debug('****'+imgURL);
- lstWrap.add(QLWrap1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement