# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
#======================================================================
#
# Inventory received module
# reverse inventory items
my $query =
- qq|SELECT i.parts_id, p.inventory_accno_id, p.expense_accno_id, i.qty, i.allocated, i.sellprice
+ qq|SELECT i.parts_id, p.part_type, i.qty, i.allocated, i.sellprice
FROM invoice i, parts p
WHERE (i.parts_id = p.id)
AND (i.trans_id = ?)|;
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
$netamount += $form->round_amount($ref->{sellprice} * $ref->{qty} * -1, 2);
- next unless $ref->{inventory_accno_id};
+ next unless $ref->{part_type} eq 'part';
# if $ref->{allocated} > 0 than we sold that many items
next if ($ref->{allocated} <= 0);
i.id AS invoice_id,
i.description, i.longdescription, i.qty, i.fxsellprice AS sellprice, i.parts_id AS id, i.unit, i.deliverydate, i.project_id, i.serialnumber,
i.price_factor_id, i.price_factor, i.marge_price_factor, i.discount, i.active_price_source, i.active_discount_source,
- p.partnumber, p.inventory_accno_id AS part_inventory_accno_id, pr.projectnumber, pg.partsgroup
+ p.partnumber, p.part_type, pr.projectnumber, pg.partsgroup
FROM invoice i
JOIN parts p ON (i.parts_id = p.id)
);
map { $ref->{"ic_cvar_$_->{name}"} = $_->{value} } @{ $cvars };
- map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid)) if !$ref->{"part_inventory_accno_id"};
- delete($ref->{"part_inventory_accno_id"});
+ map({ delete($ref->{$_}); } qw(inventory_accno inventory_new_chart inventory_valid)) if !$ref->{"part_type"} eq 'part';
foreach my $type (qw(inventory income expense)) {
while ($ref->{"${type}_new_chart"} && ($ref->{"${type}_valid"} >=0)) {
p.id, p.partnumber, p.description, p.lastcost AS sellprice, p.listprice,
p.unit, p.part_type, p.onhand, p.formel,
p.notes AS partnotes, p.notes AS longdescription, p.not_discountable,
- p.inventory_accno_id, p.price_factor_id,
+ p.price_factor_id,
p.ean,
pfac.factor AS price_factor,