Sha256: b129cd206e30a05c5959f249e5a640f44eb55b44528b8f4237ea6da45d205c8b

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

module Skr
    module Concerns

        module INV

            module Lines

                def other_charge
                    select{|l| l.sku.is_other_charge? }
                end

                def regular
                    reject{|l| l.sku.is_other_charge? }
                end

                def product
                    reject{|l| l.time_entry }
                end

                def time_entry
                    select{|l| l.time_entry }
                end

                def from_pick_ticket!
                    proxy_association.owner.pick_ticket.lines.each do | line |
                        build({ pt_line: line, qty: line.qty_to_ship })
                    end
                end

                def from_sales_order!
                    proxy_association.owner.sales_order.lines.each do | line |
                        build({ so_line: line, qty: line.qty_allocated })
                    end
                end

                def ea_qty
                    if proxy_association.loaded?
                        inject(0){ | sum, il | sum+(il.qty*il.uom_size) }
                    else
                        sum('qty*uom_size')
                    end
                end

            end

        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stockor-0.3.0 lib/skr/concerns/inv_extensions.rb
stockor-0.2 lib/skr/concerns/inv_extensions.rb