}
$sth->finish;
- if ($form->{id}) {
- $query = qq|SELECT weightunit
- FROM defaults|;
+ if (!$form->{id}) {
+ $query = qq|SELECT current_date FROM defaults|;
$sth = $dbh->prepare($query);
$sth->execute || $form->dberror($query);
- ($form->{weightunit}) = $sth->fetchrow_array;
- $sth->finish;
-
- } else {
- $query = qq|SELECT weightunit, current_date
- FROM defaults|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{weightunit}, $form->{priceupdate}) = $sth->fetchrow_array;
+ ($form->{priceupdate}) = $sth->fetchrow_array;
$sth->finish;
}
} else {
$transdate = $form->{deliverydate};
}
+ } elsif ($form->{type} eq "credit_note") {
+ $transdate = $form->{invdate};
} else {
$transdate = $form->{transdate};
}
if (!$ref) {
$dbh->disconnect();
- return $lxdebug->leave_sub();
+ return $main::lxdebug->leave_sub();
}
$ref->{"inventory_accno_id"} = undef unless ($ref->{"is_part"});
$ref = $sth->fetchrow_hashref();
$sth->finish();
$dbh->disconnect();
-
+
unless ($ref) {
$main::lxdebug->leave_sub();
return;
# " || taxaccounts_$index " . $form->{"taxaccounts_$index"} .
# " || taxaccounts " . $form->{"taxaccounts"});
- $sth->finish();
-
$main::lxdebug->leave_sub();
}
1;