#correct rows
$form->{price_rows} = $i - 1;
- unless ($form->{item} eq 'service') {
-
- # get makes
- if ($form->{makemodel}) {
- #hli
- $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | .
- qq|WHERE m.parts_id = ? order by m.sortorder asc|;
- my @values = ($form->{id});
- $sth = $dbh->prepare($query);
- $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")");
-
- my $i = 1;
-
- while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"},
- $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array)
- {
- $i++;
- }
- $sth->finish;
- $form->{makemodel_rows} = $i - 1;
-
+ # get makes
+ if ($form->{makemodel}) {
+ #hli
+ $query = qq|SELECT m.make, m.model,m.lastcost,m.lastcost,m.lastupdate,m.sortorder FROM makemodel m | .
+ qq|WHERE m.parts_id = ? order by m.sortorder asc|;
+ my @values = ($form->{id});
+ $sth = $dbh->prepare($query);
+ $sth->execute(@values) || $form->dberror("$query (" . join(', ', @values) . ")");
+
+ my $i = 1;
+
+ while (($form->{"make_$i"}, $form->{"model_$i"}, $form->{"old_lastcost_$i"},
+ $form->{"lastcost_$i"}, $form->{"lastupdate_$i"}, $form->{"sortorder_$i"}) = $sth->fetchrow_array)
+ {
+ $i++;
}
+ $sth->finish;
+ $form->{makemodel_rows} = $i - 1;
+
}
# get translations
}
$sth->finish;
- if ($form->{item} ne 'service') {
- # delete makemodel records
- do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id}));
- }
+ # delete makemodel records
+ do_query($form, $dbh, qq|DELETE FROM makemodel WHERE parts_id = ?|, conv_i($form->{id}));
if ($form->{item} eq 'assembly') {
# delete assembly records
my @apoe_filters = qw(transdate);
my @like_filters = (@simple_filters, @invoice_oi_filters);
my @all_columns = (@simple_filters, @makemodel_filters, @apoe_filters, @project_filters, qw(serialnumber));
- my @simple_l_switches = (@all_columns, qw(listprice sellprice lastcost priceupdate weight unit bin rop image));
+ my @simple_l_switches = (@all_columns, qw(notes listprice sellprice lastcost priceupdate weight unit bin rop image));
my @oe_flags = qw(bought sold onorder ordered rfq quoted);
my @qsooqr_flags = qw(invnumber ordnumber quonumber trans_id name module qty);
my @deliverydate_flags = qw(deliverydate);
if ($form->{searchitems} eq 'assembly' && $form->{bom}) {
$query =
qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand,
- p.unit, p.bin,
+ p.unit, p.bin, p.notes,
p.sellprice, p.listprice, p.lastcost,
p.rop, p.weight, p.priceupdate,
p.image, p.drawing, p.microfiche,
$form->{parts} = \@assemblies;
}
+ if ($form->{l_pricegroups} ) {
+ my $query = <<SQL;
+ SELECT parts_id, price, pricegroup_id
+ FROM prices
+ WHERE parts_id = ?
+SQL
+
+ my $sth = prepare_query($form, $dbh, $query);
+
+ foreach my $part (@{ $form->{parts} }) {
+ do_statement($form, $sth, $query, conv_i($part->{id}));
+
+ while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
+ $part->{"pricegroup_$ref->{pricegroup_id}"} = $ref->{price};
+ }
+ $sth->finish;
+ }
+ };
+
+
$main::lxdebug->leave_sub();
return wantarray ? @{ $form->{parts} } : $form->{parts};