Changeset 1343

Show
Ignore:
Timestamp:
02/27/07 14:16:26 (2 years ago)
Author:
james
Message:

accept null for coupon

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • peasantonline/app/views/admin/_show_line_items.rhtml

    r1341 r1343  
    3535<% end %> 
    3636<%= 
    37 @valid_coupon = Coupon.find(@order.coupon_id) 
    38 @subtotal = total_price 
    39 @discount = 0 
    40  
    41 if @valid_coupon 
    42 #Valid for this date? 
    43         if @valid_coupon.offer_percent 
    44                 @discount =  (@subtotal * @valid_coupon.offer_amount)/100 
    45         else 
    46                 if @valid_coupon.offer_amount < @subtotal 
    47                         @discount = @valid_coupon.offer_amount 
    48                 else 
    49                         @discount = @subtotal 
    50                 end 
    51         end 
    52         "<tr> 
    53                 <td colspan='4'> 
    54                         <b>Coupon Discount:</b> 
    55                 </td> 
    56                 <td>     
    57                         <b>$#{@discount}</b> 
    58                 </td> 
    59         </tr>" 
     37if @order.coupon_id 
     38        @valid_coupon = Coupon.find(@order.coupon_id) 
     39        @subtotal = total_price 
     40        @discount = 0 
     41         
     42        if @valid_coupon 
     43        #Valid for this date? 
     44                if @valid_coupon.offer_percent 
     45                        @discount =  (@subtotal * @valid_coupon.offer_amount)/100 
     46                else 
     47                        if @valid_coupon.offer_amount < @subtotal 
     48                                @discount = @valid_coupon.offer_amount 
     49                        else 
     50                                @discount = @subtotal 
     51                        end 
     52                end 
     53                "<tr> 
     54                        <td colspan='4'> 
     55                                <b>Coupon Discount:</b> 
     56                        </td> 
     57                        <td>     
     58                                <b>$#{@discount}</b> 
     59                        </td> 
     60                </tr>" 
     61        end 
    6062end 
    6163%>