jquery jquery-ui jquery.cookie jquery.checkall jquery.download
jquery/jquery.form jquery/fixes client_js
jquery/jquery.tooltipster.min
- common part_selection switchmenuframe
+ common part_selection
), "jquery/ui/i18n/jquery.ui.datepicker-$::myconfig{countrycode}");
$self->{favicon} ||= "favicon.ico";
}
sub round_amount {
- my ($self, $amount, $places) = @_;
+ my ($self, $amount, $places, $adjust) = @_;
return 0 if !defined $amount;
+ $places //= 0;
+
+ if ($adjust) {
+ my $precision = $::instance_conf->get_precision || 0.01;
+ return $self->round_amount( $self->round_amount($amount / $precision, 0) * $precision, $places);
+ }
+
# We use Perl's knowledge of string representation for
# rounding. First, convert the floating point number to a string
# with a high number of places. Then split the string on the decimal
my $shipto;
my @values;
- foreach my $item (qw(name department_1 department_2 street zipcode city country
+ foreach my $item (qw(name department_1 department_2 street zipcode city country gln
contact cp_gender phone fax email)) {
if ($self->{"shipto$item"}) {
$shipto = 1 if ($self->{$item} ne $self->{"shipto$item"});
shiptozipcode = ?,
shiptocity = ?,
shiptocountry = ?,
+ shiptogln = ?,
shiptocontact = ?,
shiptocp_gender = ?,
shiptophone = ?,
shiptozipcode = ? AND
shiptocity = ? AND
shiptocountry = ? AND
+ shiptogln = ? AND
shiptocontact = ? AND
shiptocp_gender = ? AND
shiptophone = ? AND
if(!$insert_check){
$query =
qq|INSERT INTO shipto (trans_id, shiptoname, shiptodepartment_1, shiptodepartment_2,
- shiptostreet, shiptozipcode, shiptocity, shiptocountry,
+ shiptostreet, shiptozipcode, shiptocity, shiptocountry, shiptogln,
shiptocontact, shiptocp_gender, shiptophone, shiptofax, shiptoemail, module)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
do_query($self, $dbh, $query, $id, @values, $module);
}
}
$main::lxdebug->leave_sub();
}
+sub new_lastmtime {
+ my ($self, $table, $option) = @_;
+
+ return unless $self->{id};
+ croak ("wrong call, no valid table defined") unless $table =~ /^(oe|ar|ap|delivery_orders|parts)$/;
+
+ my $query = "SELECT mtime, itime FROM " . $table . " WHERE id = ?";
+ my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id});
+ $ref->{mtime} ||= $ref->{itime};
+ $self->{lastmtime} = $ref->{mtime};
+ $main::lxdebug->message(LXDebug->DEBUG2(),"new lastmtime=".$self->{lastmtime});
+}
+
sub mtime_ischanged {
my ($self, $table, $option) = @_;
d.closedto, d.revtrans,
(SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency,
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
+ (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
+ (SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno,
+ (SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno
FROM defaults d|;
$ref = selectfirst_hashref_query($self, $dbh, $query);
map { $self->{$_} = $ref->{$_} } keys %$ref;
current_date AS transdate, d.closedto, d.revtrans,
(SELECT cu.name FROM currencies cu WHERE cu.id=d.currency_id) AS defaultcurrency,
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno,
- (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno
+ (SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno,
+ (SELECT c.accno FROM chart c WHERE d.rndgain_accno_id = c.id) AS rndgain_accno,
+ (SELECT c.accno FROM chart c WHERE d.rndloss_accno_id = c.id) AS rndloss_accno
FROM defaults d|;
$ref = selectfirst_hashref_query($self, $dbh, $query);
map { $self->{$_} = $ref->{$_} } keys %$ref;
my ($self,$amount,$taxrate,$taxincluded,$roundplaces) = @_;
- $roundplaces = 2 unless defined $roundplaces;
+ $roundplaces //= 2;
+ $taxincluded //= 0;
my $tax;
- if ($taxincluded *= 1) {
+ if ($taxincluded) {
# calculate tax (unrounded), subtract from amount, round amount and round tax
$tax = $amount - ($amount / ($taxrate + 1)); # equivalent to: taxrate * amount / (taxrate + 1)
$amount = $self->round_amount($amount - $tax, $roundplaces);