Revision be776964
Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
1060 | 1060 |
my %accnos; |
1061 | 1061 |
map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno ar_paid_accno); |
1062 | 1062 |
|
1063 |
$form->{curr} =~ s/ //g; |
|
1064 |
my @currencies = grep { $_ ne '' } split m/:/, $form->{curr}; |
|
1065 |
my $currency = join ':', @currencies; |
|
1066 |
|
|
1067 | 1063 |
# these defaults are database wide |
1068 | 1064 |
|
1069 | 1065 |
my $query = |
... | ... | |
1087 | 1083 |
assemblynumber = ?, |
1088 | 1084 |
sdonumber = ?, |
1089 | 1085 |
pdonumber = ?, |
1090 |
curr = ?, |
|
1091 | 1086 |
businessnumber = ?, |
1092 | 1087 |
weightunit = ?, |
1093 | 1088 |
language_id = ?|; |
... | ... | |
1100 | 1095 |
$form->{articlenumber}, $form->{servicenumber}, |
1101 | 1096 |
$form->{assemblynumber}, |
1102 | 1097 |
$form->{sdonumber}, $form->{pdonumber}, |
1103 |
$currency, |
|
1104 | 1098 |
$form->{businessnumber}, $form->{weightunit}, |
1105 | 1099 |
conv_i($form->{language_id})); |
1106 | 1100 |
do_query($form, $dbh, $query, @values); |
1107 | 1101 |
|
1102 |
$main::lxdebug->message(0, "es gibt rowcount: " . $form->{rowcount}); |
|
1103 |
|
|
1104 |
for my $i (1..$form->{rowcount}) { |
|
1105 |
if ($form->{"curr_$i"} ne $form->{"old_curr_$i"}) { |
|
1106 |
$query = qq|UPDATE currencies SET curr = '| . $form->{"curr_$i"} . qq|' WHERE curr = '| . $form->{"old_curr_$i"} . qq|'|; |
|
1107 |
do_query($form, $dbh, $query); |
|
1108 |
} |
|
1109 |
} |
|
1110 |
|
|
1111 |
if (length($form->{new_curr}) > 0) { |
|
1112 |
$query = qq|INSERT INTO currencies (curr) VALUES ('| . $form->{new_curr} . qq|')|; |
|
1113 |
do_query($form, $dbh, $query); |
|
1114 |
} |
|
1115 |
|
|
1108 | 1116 |
$dbh->commit(); |
1109 | 1117 |
|
1110 | 1118 |
$main::lxdebug->leave_sub(); |
... | ... | |
1118 | 1126 |
|
1119 | 1127 |
my $dbh = $form->get_standard_dbh($myconfig); |
1120 | 1128 |
|
1121 |
my ($currency, $businessnumber) = selectrow_query($form, $dbh, qq|SELECT curr, businessnumber FROM defaults|);
|
|
1129 |
my ($businessnumber) = selectrow_query($form, $dbh, qq|SELECT businessnumber FROM defaults|);
|
|
1122 | 1130 |
|
1123 | 1131 |
# update name |
1124 | 1132 |
my $query = qq|UPDATE employee SET name = ? WHERE login = ?|; |
... | ... | |
1126 | 1134 |
|
1127 | 1135 |
my $rc = $dbh->commit(); |
1128 | 1136 |
|
1129 |
# save first currency in myconfig |
|
1130 |
$currency =~ s/:.*//; |
|
1131 |
$form->{currency} = $currency; |
|
1132 |
|
|
1133 | 1137 |
$form->{businessnumber} = $businessnumber; |
1134 | 1138 |
|
1135 | 1139 |
$myconfig = User->new(login => $form->{login}); |
SL/AP.pm | ||
---|---|---|
55 | 55 |
my $exchangerate = 0; |
56 | 56 |
|
57 | 57 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
58 |
delete $form->{currency} unless $form->{defaultcurrency}; |
|
59 | 58 |
|
60 | 59 |
($null, $form->{department_id}) = split(/--/, $form->{department}); |
61 | 60 |
|
... | ... | |
185 | 184 |
$query = qq|UPDATE ap SET |
186 | 185 |
invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?, |
187 | 186 |
amount = ?, duedate = ?, paid = ?, netamount = ?, |
188 |
curr = ?, notes = ?, department_id = ?, storno = ?, storno_id = ?,
|
|
187 |
curr = (SELECT id FROM currencies WHERE curr = ?), notes = ?, department_id = ?, storno = ?, storno_id = ?,
|
|
189 | 188 |
globalproject_id = ?, direct_debit = ? |
190 | 189 |
WHERE id = ?|; |
191 | 190 |
@values = ($form->{invnumber}, conv_date($form->{transdate}), |
... | ... | |
665 | 664 |
|
666 | 665 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
667 | 666 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
668 |
delete $form->{currency} unless $form->{defaultcurrency}; |
|
669 | 667 |
|
670 | 668 |
# Get the AP accno. |
671 | 669 |
$query = |
SL/AR.pm | ||
---|---|---|
56 | 56 |
|
57 | 57 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); |
58 | 58 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
59 |
delete $form->{currency} unless $form->{defaultcurrency}; |
|
60 | 59 |
|
61 | 60 |
# set exchangerate |
62 | 61 |
$form->{exchangerate} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 : |
... | ... | |
135 | 134 |
} else { |
136 | 135 |
$query = qq|SELECT nextval('glid')|; |
137 | 136 |
($form->{id}) = selectrow_query($form, $dbh, $query); |
138 |
$query = qq|INSERT INTO ar (id, invnumber, employee_id) VALUES (?, 'dummy', ?)|;
|
|
139 |
do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}); |
|
137 |
$query = qq|INSERT INTO ar (id, invnumber, employee_id, curr) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE curr=?))|;
|
|
138 |
do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency});
|
|
140 | 139 |
$form->{invnumber} = $form->update_defaults($myconfig, "invnumber", $dbh) unless $form->{invnumber}; |
141 | 140 |
} |
142 | 141 |
} |
... | ... | |
156 | 155 |
qq|UPDATE ar set |
157 | 156 |
invnumber = ?, ordnumber = ?, transdate = ?, customer_id = ?, |
158 | 157 |
taxincluded = ?, amount = ?, duedate = ?, paid = ?, |
159 |
netamount = ?, curr = ?, notes = ?, department_id = ?,
|
|
158 |
netamount = ?, notes = ?, department_id = ?, |
|
160 | 159 |
employee_id = ?, storno = ?, storno_id = ?, globalproject_id = ?, |
161 | 160 |
direct_debit = ? |
162 | 161 |
WHERE id = ?|; |
163 | 162 |
my @values = ($form->{invnumber}, $form->{ordnumber}, conv_date($form->{transdate}), conv_i($form->{customer_id}), $form->{taxincluded} ? 't' : 'f', $form->{amount}, |
164 |
conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}),
|
|
163 |
conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{notes}, conv_i($form->{department_id}), |
|
165 | 164 |
conv_i($form->{employee_id}), $form->{storno} ? 't' : 'f', $form->{storno_id}, |
166 | 165 |
conv_i($form->{globalproject_id}), $form->{direct_debit} ? 't' : 'f', conv_i($form->{id})); |
167 | 166 |
do_query($form, $dbh, $query, @values); |
... | ... | |
426 | 425 |
|
427 | 426 |
$form->{exchangerate} = $form->format_amount($myconfig, $form->{exchangerate}); |
428 | 427 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
429 |
delete $form->{currency} unless $form->{defaultcurrency}; |
|
430 | 428 |
|
431 | 429 |
# Get the AR accno (which is normally done by Form::create_links()). |
432 | 430 |
$query = |
SL/CP.pm | ||
---|---|---|
93 | 93 |
} |
94 | 94 |
$sth->finish; |
95 | 95 |
|
96 |
# get currencies and closedto |
|
97 |
$query = qq|SELECT curr, closedto FROM defaults|; |
|
98 |
($form->{currencies}, $form->{closedto}) = |
|
99 |
selectrow_query($form, $dbh, $query); |
|
96 |
# get closedto |
|
97 |
$query = qq|SELECT closedto FROM defaults|; |
|
98 |
($form->{closedto}) = selectrow_query($form, $dbh, $query); |
|
100 | 99 |
|
101 | 100 |
$dbh->disconnect; |
102 | 101 |
|
... | ... | |
150 | 149 |
my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; |
151 | 150 |
|
152 | 151 |
my $query = |
153 |
qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr | .
|
|
152 |
qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, cu.curr | .
|
|
154 | 153 |
qq|FROM $arap a | . |
155 |
qq|WHERE (a.${vc}_id = ?) AND (COALESCE(a.curr, '') = ?) AND NOT (a.amount = a.paid)| . |
|
154 |
qq|LEFT JOIN currencies cu ON (cu.id=a.curr)| . |
|
155 |
qq|WHERE (a.${vc}_id = ?) AND cu.curr = ? AND NOT (a.amount = a.paid)| . |
|
156 | 156 |
qq|ORDER BY a.id|; |
157 | 157 |
my $sth = prepare_execute_query($form, $dbh, $query, |
158 | 158 |
conv_i($form->{"${vc}_id"}), |
... | ... | |
174 | 174 |
SELECT COUNT(*) |
175 | 175 |
FROM $arap |
176 | 176 |
WHERE (${vc}_id = ?) |
177 |
AND (COALESCE(curr, '') <> ?)
|
|
177 |
AND ((SELECT cu.curr FROM currencies cu WHERE cu.id=${arap}.curr) <> ?)
|
|
178 | 178 |
AND (amount <> paid) |
179 | 179 |
SQL |
180 | 180 |
($form->{openinvoices_other_currencies}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), "$form->{currency}"); |
... | ... | |
250 | 250 |
qq|SELECT $buysell | . |
251 | 251 |
qq|FROM exchangerate e | . |
252 | 252 |
qq|JOIN ${arap} a ON (a.transdate = e.transdate) | . |
253 |
qq|WHERE (e.curr = ?) AND (a.id = ?)|;
|
|
253 |
qq|WHERE (e.curr = (SELECT id FROM currencies WHERE curr = ?)) AND (a.id = ?)|;
|
|
254 | 254 |
my ($exchangerate) = |
255 | 255 |
selectrow_query($form, $dbh, $query, |
256 | 256 |
$form->{currency}, $form->{"id_$i"}); |
SL/CT.pm | ||
---|---|---|
68 | 68 |
my $ref = $sth->fetchrow_hashref("NAME_lc"); |
69 | 69 |
|
70 | 70 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
71 |
$sth->finish; |
|
71 | 72 |
|
72 |
# remove any trailing whitespace |
|
73 |
$form->{curr} =~ s/\s*$//; |
|
73 |
#get name of currency instead of id: |
|
74 |
$query = qq|SELECT curr FROM currencies WHERE id=?|; |
|
75 |
($form->{curr}) = selectrow_query($form, $dbh, $query, conv_i($form->{curr})); |
|
74 | 76 |
|
75 |
$sth->finish; |
|
76 | 77 |
if ( $form->{salesman_id} ) { |
77 | 78 |
my $query = |
78 | 79 |
qq|SELECT ct.name AS salesman | . |
... | ... | |
319 | 320 |
qq|user_password = ?, | . |
320 | 321 |
qq|c_vendor_id = ?, | . |
321 | 322 |
qq|klass = ?, | . |
322 |
qq|curr = ?, | .
|
|
323 |
qq|curr = (SELECT id FROM currencies WHERE curr = ?), | .
|
|
323 | 324 |
qq|taxincluded_checked = ? | . |
324 | 325 |
qq|WHERE id = ?|; |
325 | 326 |
my @values = ( |
... | ... | |
362 | 363 |
$form->{user_password}, |
363 | 364 |
$form->{c_vendor_id}, |
364 | 365 |
conv_i($form->{klass}), |
365 |
substr($form->{currency}, 0, 3),
|
|
366 |
$form->{currency},
|
|
366 | 367 |
$form->{taxincluded_checked} ne '' ? $form->{taxincluded_checked} : undef, |
367 | 368 |
$form->{id} |
368 | 369 |
); |
... | ... | |
471 | 472 |
qq| username = ?, | . |
472 | 473 |
qq| user_password = ?, | . |
473 | 474 |
qq| v_customer_id = ?, | . |
474 |
qq| curr = ? | .
|
|
475 |
qq| curr = (SELECT id FROM currencies WHERE curr = ?) | .
|
|
475 | 476 |
qq|WHERE id = ?|; |
476 | 477 |
my @values = ( |
477 | 478 |
$form->{vendornumber}, |
... | ... | |
511 | 512 |
$form->{username}, |
512 | 513 |
$form->{user_password}, |
513 | 514 |
$form->{v_customer_id}, |
514 |
substr($form->{currency}, 0, 3),
|
|
515 |
$form->{currency},
|
|
515 | 516 |
$form->{id} |
516 | 517 |
); |
517 | 518 |
do_query($form, $dbh, $query, @values); |
SL/DN.pm | ||
---|---|---|
228 | 228 |
-- duedate: |
229 | 229 |
(SELECT duedate FROM dunning WHERE dunning_id = ? LIMIT 1), |
230 | 230 |
'f', -- invoice |
231 |
?, -- curr
|
|
231 |
(SELECT id FROM currencies WHERE curr = ?), -- curr
|
|
232 | 232 |
?, -- notes |
233 | 233 |
-- employee_id: |
234 | 234 |
(SELECT id FROM employee WHERE login = ?) |
... | ... | |
761 | 761 |
ar.transdate, ar.duedate, ar.customer_id, |
762 | 762 |
ar.invnumber, ar.ordnumber, ar.cp_id, |
763 | 763 |
ar.amount, ar.netamount, ar.paid, |
764 |
ar.curr,
|
|
764 |
(SELECT cu.curr FROM currencies cu WHERE cu.id=ar.curr) AS curr,
|
|
765 | 765 |
ar.amount - ar.paid AS open_amount, |
766 | 766 |
ar.amount - ar.paid + da.fee + da.interest AS linetotal |
767 | 767 |
|
SL/DO.pm | ||
---|---|---|
348 | 348 |
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, closed = ?, |
349 | 349 |
delivered = ?, department_id = ?, language_id = ?, shipto_id = ?, |
350 | 350 |
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, |
351 |
is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, curr = ?
|
|
351 |
is_sales = ?, taxzone_id = ?, taxincluded = ?, terms = ?, curr = (SELECT id FROM currencies WHERE curr = ?)
|
|
352 | 352 |
WHERE id = ?|; |
353 | 353 |
|
354 | 354 |
@values = ($form->{donumber}, $form->{ordnumber}, |
... | ... | |
616 | 616 |
d.description AS department, dord.language_id, |
617 | 617 |
dord.shipto_id, |
618 | 618 |
dord.globalproject_id, dord.delivered, dord.transaction_description, |
619 |
dord.taxzone_id, dord.taxincluded, dord.terms, dord.curr AS currency
|
|
619 |
dord.taxzone_id, dord.taxincluded, dord.terms, (SELECT cu.curr FROM currencies cu WHERE cu.id=dord.curr) AS currency
|
|
620 | 620 |
FROM delivery_orders dord |
621 | 621 |
JOIN ${vc} cv ON (dord.${vc}_id = cv.id) |
622 | 622 |
LEFT JOIN employee e ON (dord.employee_id = e.id) |
... | ... | |
638 | 638 |
} |
639 | 639 |
$sth->finish(); |
640 | 640 |
|
641 |
# remove any trailing whitespace |
|
642 |
$form->{currency} =~ s/\s*$//; |
|
643 |
|
|
644 | 641 |
$form->{donumber_array} =~ s/\s*$//g; |
645 | 642 |
|
646 | 643 |
$form->{saved_donumber} = $form->{donumber}; |
SL/Form.pm | ||
---|---|---|
1490 | 1490 |
$main::lxdebug->leave_sub(); |
1491 | 1491 |
return; |
1492 | 1492 |
} |
1493 |
$query = qq|SELECT curr FROM defaults|; |
|
1494 |
|
|
1495 |
my ($currency) = selectrow_query($self, $dbh, $query); |
|
1496 |
my ($defaultcurrency) = split m/:/, $currency; |
|
1493 |
$query = qq|SELECT curr FROM currencies WHERE id=(SELECT curr FROM defaults)|; |
|
1497 | 1494 |
|
1495 |
my ($defaultcurrency) = selectrow_query($self, $dbh, $query); |
|
1498 | 1496 |
|
1499 | 1497 |
if ($curr eq $defaultcurrency) { |
1500 | 1498 |
$main::lxdebug->leave_sub(); |
... | ... | |
1502 | 1500 |
} |
1503 | 1501 |
|
1504 | 1502 |
$query = qq|SELECT e.curr FROM exchangerate e |
1505 |
WHERE e.curr = ? AND e.transdate = ?
|
|
1503 |
WHERE e.curr = (SELECT cu.id FROM currencies cu WHERE cu.curr=?) AND e.transdate = ?
|
|
1506 | 1504 |
FOR UPDATE|; |
1507 | 1505 |
my $sth = prepare_execute_query($self, $dbh, $query, $curr, $transdate); |
1508 | 1506 |
|
... | ... | |
1528 | 1526 |
if ($sth->fetchrow_array) { |
1529 | 1527 |
$query = qq|UPDATE exchangerate |
1530 | 1528 |
SET $set |
1531 |
WHERE curr = ?
|
|
1529 |
WHERE curr = (SELECT id FROM currencies WHERE curr = ?)
|
|
1532 | 1530 |
AND transdate = ?|; |
1533 | 1531 |
|
1534 | 1532 |
} else { |
1535 | 1533 |
$query = qq|INSERT INTO exchangerate (curr, buy, sell, transdate) |
1536 |
VALUES (?, $buy, $sell, ?)|;
|
|
1534 |
VALUES ((SELECT id FROM currencies WHERE curr = ?), $buy, $sell, ?)|;
|
|
1537 | 1535 |
} |
1538 | 1536 |
$sth->finish; |
1539 | 1537 |
do_query($self, $dbh, $query, $curr, $transdate); |
... | ... | |
1573 | 1571 |
return 1; |
1574 | 1572 |
} |
1575 | 1573 |
|
1576 |
$query = qq|SELECT curr FROM defaults|;
|
|
1574 |
$query = qq|SELECT curr FROM currencies WHERE id = (SELECT curr FROM defaults)|;
|
|
1577 | 1575 |
|
1578 |
my ($currency) = selectrow_query($self, $dbh, $query); |
|
1579 |
my ($defaultcurrency) = split m/:/, $currency; |
|
1576 |
my ($defaultcurrency) = selectrow_query($self, $dbh, $query); |
|
1580 | 1577 |
|
1581 |
if ($currency eq $defaultcurrency) {
|
|
1578 |
if ($curr eq $defaultcurrency) { |
|
1582 | 1579 |
$main::lxdebug->leave_sub(); |
1583 | 1580 |
return 1; |
1584 | 1581 |
} |
1585 | 1582 |
|
1586 | 1583 |
$query = qq|SELECT e.$fld FROM exchangerate e |
1587 |
WHERE e.curr = ? AND e.transdate = ?|;
|
|
1584 |
WHERE e.curr = (SELECT id FROM currencies WHERE curr = ?) AND e.transdate = ?|;
|
|
1588 | 1585 |
my ($exchangerate) = selectrow_query($self, $dbh, $query, $curr, $transdate); |
1589 | 1586 |
|
1590 | 1587 |
|
... | ... | |
1617 | 1614 |
|
1618 | 1615 |
my $dbh = $self->get_standard_dbh($myconfig); |
1619 | 1616 |
my $query = qq|SELECT e.$fld FROM exchangerate e |
1620 |
WHERE e.curr = ? AND e.transdate = ?|;
|
|
1617 |
WHERE e.curr = (SELECT id FROM currencies WHERE curr = ?) AND e.transdate = ?|;
|
|
1621 | 1618 |
|
1622 | 1619 |
my ($exchangerate) = selectrow_query($self, $dbh, $query, $currency, $transdate); |
1623 | 1620 |
|
... | ... | |
1632 | 1629 |
my $self = shift; |
1633 | 1630 |
my $myconfig = shift || \%::myconfig; |
1634 | 1631 |
my $dbh = $self->get_standard_dbh($myconfig); |
1632 |
my @currencies =(); |
|
1635 | 1633 |
|
1636 |
my $query = qq|SELECT curr FROM defaults|;
|
|
1634 |
my $query = qq|SELECT curr FROM currencies|;
|
|
1637 | 1635 |
|
1638 |
my ($curr) = selectrow_query($self, $dbh, $query); |
|
1639 |
my @currencies = grep { $_ } map { s/\s//g; $_ } split m/:/, $curr; |
|
1636 |
my $sth = prepare_execute_query($self, $dbh, $query); |
|
1637 |
|
|
1638 |
while (my $ref = $sth->fetchrow_hashref()) { |
|
1639 |
push(@currencies, $ref->{curr}); |
|
1640 |
} |
|
1641 |
$sth->finish; |
|
1640 | 1642 |
|
1641 | 1643 |
$main::lxdebug->leave_sub(); |
1642 | 1644 |
|
... | ... | |
1647 | 1649 |
$main::lxdebug->enter_sub(); |
1648 | 1650 |
|
1649 | 1651 |
my ($self, $myconfig) = @_; |
1650 |
my @currencies = $self->get_all_currencies($myconfig); |
|
1652 |
my $dbh = $self->get_standard_dbh($myconfig); |
|
1653 |
my $query = qq|SELECT curr FROM currencies WHERE id = (SELECT curr FROM defaults)|; |
|
1654 |
|
|
1655 |
my ($defaultcurrency) = selectrow_query($self, $dbh, $query); |
|
1651 | 1656 |
|
1652 | 1657 |
$main::lxdebug->leave_sub(); |
1653 | 1658 |
|
1654 |
return $currencies[0];
|
|
1659 |
return $defaultcurrency;
|
|
1655 | 1660 |
} |
1656 | 1661 |
|
1657 | 1662 |
sub set_payment_options { |
... | ... | |
2191 | 2196 |
|
2192 | 2197 |
$key = "all_currencies" unless ($key); |
2193 | 2198 |
|
2194 |
my $query = qq|SELECT curr AS currency FROM defaults|; |
|
2195 |
|
|
2196 |
$self->{$key} = [split(/\:/ , selectfirst_hashref_query($self, $dbh, $query)->{currency})]; |
|
2199 |
$self->{$key} = [$self->get_all_currencies()]; |
|
2197 | 2200 |
|
2198 | 2201 |
$main::lxdebug->leave_sub(); |
2199 | 2202 |
} |
... | ... | |
2704 | 2707 |
$query = |
2705 | 2708 |
qq|SELECT |
2706 | 2709 |
a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid, |
2707 |
a.duedate, a.ordnumber, a.taxincluded, a.curr AS currency, a.notes,
|
|
2710 |
a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.curr FROM currencies cu WHERE cu.id=a.curr) AS currency, a.notes,
|
|
2708 | 2711 |
a.intnotes, a.department_id, a.amount AS oldinvtotal, |
2709 | 2712 |
a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type, |
2710 | 2713 |
a.globalproject_id, ${extra_columns} |
... | ... | |
2722 | 2725 |
$self->{$key} = $ref->{$key}; |
2723 | 2726 |
} |
2724 | 2727 |
|
2725 |
# remove any trailing whitespace |
|
2726 |
$self->{currency} =~ s/\s*$//; |
|
2727 |
|
|
2728 | 2728 |
my $transdate = "current_date"; |
2729 | 2729 |
if ($self->{transdate}) { |
2730 | 2730 |
$transdate = $dbh->quote($self->{transdate}); |
... | ... | |
2808 | 2808 |
} |
2809 | 2809 |
|
2810 | 2810 |
$sth->finish; |
2811 |
#check das: |
|
2811 | 2812 |
$query = |
2812 | 2813 |
qq|SELECT |
2813 |
d.curr AS currencies, d.closedto, d.revtrans, |
|
2814 |
d.closedto, d.revtrans, |
|
2815 |
(SELECT cu.curr FROM currencies cu WHERE cu.id=d.curr) AS defaultcurrency, |
|
2814 | 2816 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
2815 | 2817 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
2816 | 2818 |
FROM defaults d|; |
... | ... | |
2822 | 2824 |
# get date |
2823 | 2825 |
$query = |
2824 | 2826 |
qq|SELECT |
2825 |
current_date AS transdate, d.curr AS currencies, d.closedto, d.revtrans, |
|
2827 |
current_date AS transdate, d.closedto, d.revtrans, |
|
2828 |
(SELECT cu.curr FROM currencies cu WHERE cu.id=d.curr) AS defaultcurrency, |
|
2826 | 2829 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
2827 | 2830 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
2828 | 2831 |
FROM defaults d|; |
... | ... | |
2832 | 2835 |
if ($self->{"$self->{vc}_id"}) { |
2833 | 2836 |
|
2834 | 2837 |
# only setup currency |
2835 |
($self->{currency}) = split(/:/, $self->{currencies}) if !$self->{currency};
|
|
2838 |
($self->{currency}) = $self->{defaultcurrency} if !$self->{currency};
|
|
2836 | 2839 |
|
2837 | 2840 |
} else { |
2838 | 2841 |
|
... | ... | |
2857 | 2860 |
my ($arap, $where); |
2858 | 2861 |
|
2859 | 2862 |
$table = $table eq "customer" ? "customer" : "vendor"; |
2860 |
my %column_map = ("a.curr" => "currency", |
|
2861 |
"a.${table}_id" => "${table}_id", |
|
2863 |
my %column_map = ("a.${table}_id" => "${table}_id", |
|
2862 | 2864 |
"a.department_id" => "department_id", |
2863 | 2865 |
"d.description" => "department", |
2864 | 2866 |
"ct.name" => $table, |
2865 |
"ct.curr" => "cv_curr",
|
|
2867 |
"cu.curr" => "currency",
|
|
2866 | 2868 |
"current_date + ct.terms" => "duedate", |
2867 | 2869 |
); |
2868 | 2870 |
|
2869 | 2871 |
if ($self->{type} =~ /delivery_order/) { |
2870 | 2872 |
$arap = 'delivery_orders'; |
2871 |
delete $column_map{"a.curr"}; |
|
2872 |
delete $column_map{"ct.curr"}; |
|
2873 |
delete $column_map{"cu.currency"}; |
|
2873 | 2874 |
|
2874 | 2875 |
} elsif ($self->{type} =~ /_order/) { |
2875 | 2876 |
$arap = 'oe'; |
... | ... | |
2898 | 2899 |
FROM $arap a |
2899 | 2900 |
LEFT JOIN $table ct ON (a.${table}_id = ct.id) |
2900 | 2901 |
LEFT JOIN department d ON (a.department_id = d.id) |
2902 |
LEFT JOIN currencies cu ON (cu.id=ct.curr) |
|
2901 | 2903 |
WHERE a.id = ?|; |
2902 | 2904 |
my $ref = selectfirst_hashref_query($self, $dbh, $query, $trans_id); |
2903 | 2905 |
|
2904 | 2906 |
map { $self->{$_} = $ref->{$_} } values %column_map; |
2905 | 2907 |
|
2906 |
# remove any trailing whitespace |
|
2907 |
$self->{currency} =~ s/\s*$// if $self->{currency}; |
|
2908 |
$self->{cv_curr} =~ s/\s*$// if $self->{cv_curr}; |
|
2909 |
|
|
2910 |
# if customer/vendor currency is set use this |
|
2911 |
$self->{currency} = $self->{cv_curr} if $self->{cv_curr}; |
|
2912 |
|
|
2913 | 2908 |
$main::lxdebug->leave_sub(); |
2914 | 2909 |
} |
2915 | 2910 |
|
SL/IR.pm | ||
---|---|---|
57 | 57 |
# connect to database, turn off autocommit |
58 | 58 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); |
59 | 59 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
60 |
my $defaultcurrency = $form->{defaultcurrency}; |
|
60 | 61 |
|
61 | 62 |
my $ic_cvar_configs = CVar->get_configs(module => 'IC', |
62 | 63 |
dbh => $dbh); |
... | ... | |
70 | 71 |
|
71 | 72 |
my $all_units = AM->retrieve_units($myconfig, $form); |
72 | 73 |
|
74 |
#markierung |
|
73 | 75 |
if (!$payments_only) { |
74 | 76 |
if ($form->{id}) { |
75 | 77 |
&reverse_invoice($dbh, $form); |
76 | 78 |
} else { |
77 | 79 |
($form->{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('glid')|); |
78 |
do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber) VALUES (?, '')|, $form->{id});
|
|
80 |
do_query($form, $dbh, qq|INSERT INTO ap (id, invnumber, curr) VALUES (?, '', (SELECT id FROM currencies WHERE curr=?))|, $form->{id}, $form->{currency});
|
|
79 | 81 |
} |
80 | 82 |
} |
81 | 83 |
|
82 |
my ($currencies) = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|); |
|
83 |
my $defaultcurrency = (split m/:/, $currencies)[0]; |
|
84 |
|
|
85 | 84 |
if ($form->{currency} eq $defaultcurrency) { |
86 | 85 |
$form->{exchangerate} = 1; |
87 | 86 |
} else { |
... | ... | |
686 | 685 |
orddate = ?, quodate = ?, vendor_id = ?, amount = ?, |
687 | 686 |
netamount = ?, paid = ?, duedate = ?, |
688 | 687 |
invoice = ?, taxzone_id = ?, notes = ?, taxincluded = ?, |
689 |
intnotes = ?, curr = ?, storno_id = ?, storno = ?,
|
|
688 |
intnotes = ?, storno_id = ?, storno = ?,
|
|
690 | 689 |
cp_id = ?, employee_id = ?, department_id = ?, |
691 | 690 |
globalproject_id = ?, direct_debit = ? |
692 | 691 |
WHERE id = ?|; |
... | ... | |
695 | 694 |
conv_date($form->{orddate}), conv_date($form->{quodate}), conv_i($form->{vendor_id}), $amount, |
696 | 695 |
$netamount, $form->{paid}, conv_date($form->{duedate}), |
697 | 696 |
'1', $taxzone_id, $form->{notes}, $form->{taxincluded} ? 't' : 'f', |
698 |
$form->{intnotes}, $form->{currency}, conv_i($form->{storno_id}), $form->{storno} ? 't' : 'f',
|
|
697 |
$form->{intnotes}, conv_i($form->{storno_id}), $form->{storno} ? 't' : 'f', |
|
699 | 698 |
conv_i($form->{cp_id}), conv_i($form->{employee_id}), conv_i($form->{department_id}), |
700 | 699 |
conv_i($form->{globalproject_id}), |
701 | 700 |
$form->{direct_debit} ? 't' : 'f', |
... | ... | |
924 | 923 |
(SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno, |
925 | 924 |
(SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno, |
926 | 925 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
927 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
928 |
d.curr AS currencies |
|
926 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
929 | 927 |
$q_invdate |
930 | 928 |
FROM defaults d|; |
931 | 929 |
$ref = selectfirst_hashref_query($form, $dbh, $query); |
... | ... | |
942 | 940 |
$query = qq|SELECT cp_id, invnumber, transdate AS invdate, duedate, |
943 | 941 |
orddate, quodate, globalproject_id, |
944 | 942 |
ordnumber, quonumber, paid, taxincluded, notes, taxzone_id, storno, gldate, |
945 |
intnotes, curr AS currency, direct_debit
|
|
943 |
intnotes, (SELECT cu.curr FROM currencies cu WHERE cu.id=ap.curr) AS currency, direct_debit
|
|
946 | 944 |
FROM ap |
947 | 945 |
WHERE id = ?|; |
948 | 946 |
$ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id})); |
949 | 947 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
950 | 948 |
|
951 |
# remove any trailing whitespace |
|
952 |
$form->{currency} =~ s/\s*$//; |
|
953 |
|
|
954 | 949 |
$form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "sell"); |
955 | 950 |
|
956 | 951 |
# get shipto |
... | ... | |
1092 | 1087 |
v.id AS vendor_id, v.name AS vendor, v.discount as vendor_discount, |
1093 | 1088 |
v.creditlimit, v.terms, v.notes AS intnotes, |
1094 | 1089 |
v.email, v.cc, v.bcc, v.language_id, v.payment_id, |
1095 |
v.street, v.zipcode, v.city, v.country, v.taxzone_id, v.curr, v.direct_debit,
|
|
1090 |
v.street, v.zipcode, v.city, v.country, v.taxzone_id, (SELECT cu.curr FROM currencies cu WHERE cu.id=v.curr) AS curr, v.direct_debit,
|
|
1096 | 1091 |
$duedate + COALESCE(pt.terms_netto, 0) AS duedate, |
1097 | 1092 |
b.description AS business |
1098 | 1093 |
FROM vendor v |
... | ... | |
1102 | 1097 |
my $ref = selectfirst_hashref_query($form, $dbh, $query, @values); |
1103 | 1098 |
map { $params->{$_} = $ref->{$_} } keys %$ref; |
1104 | 1099 |
|
1105 |
# remove any trailing whitespace |
|
1106 |
$form->{curr} =~ s/\s*$//; |
|
1107 |
|
|
1108 |
# use vendor currency if not empty |
|
1109 |
$form->{currency} = $form->{curr} if $form->{curr}; |
|
1100 |
# use vendor currency |
|
1101 |
$form->{currency} = $form->{curr}; |
|
1110 | 1102 |
|
1111 | 1103 |
$params->{creditremaining} = $params->{creditlimit}; |
1112 | 1104 |
|
... | ... | |
1392 | 1384 |
# fax and phone and email as vendor* |
1393 | 1385 |
my $query = |
1394 | 1386 |
qq|SELECT ct.*, cp.*, ct.notes as vendornotes, phone as vendorphone, fax as vendorfax, email as vendoremail, |
1395 |
ct.curr AS currency
|
|
1387 |
(SELECT cu.curr FROM currencies cu WHERE cu.id=ct.curr) AS currency
|
|
1396 | 1388 |
FROM vendor ct |
1397 | 1389 |
LEFT JOIN contacts cp ON (ct.id = cp.cp_cv_id) |
1398 | 1390 |
WHERE (ct.id = ?) $contact |
... | ... | |
1411 | 1403 |
} |
1412 | 1404 |
|
1413 | 1405 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
1414 |
# remove any trailing whitespace |
|
1415 |
$form->{currency} =~ s/\s*$// if ($form->{currency}); |
|
1416 | 1406 |
|
1417 | 1407 |
my $custom_variables = CVar->get_custom_variables('dbh' => $dbh, |
1418 | 1408 |
'module' => 'CT', |
SL/IS.pm | ||
---|---|---|
458 | 458 |
my $query = |
459 | 459 |
qq|SELECT ct.*, cp.*, ct.notes as customernotes, |
460 | 460 |
ct.phone AS customerphone, ct.fax AS customerfax, ct.email AS customeremail, |
461 |
ct.curr AS currency
|
|
461 |
(SELECT cu.curr FROM currencies cu WHERE cu.id=ct.curr) AS currency
|
|
462 | 462 |
FROM customer ct |
463 | 463 |
LEFT JOIN contacts cp on ct.id = cp.cp_cv_id |
464 | 464 |
WHERE (ct.id = ?) $where |
... | ... | |
478 | 478 |
|
479 | 479 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
480 | 480 |
|
481 |
# remove any trailing whitespace |
|
482 |
$form->{currency} =~ s/\s*$// if ($form->{currency}); |
|
483 |
|
|
484 | 481 |
if ($form->{delivery_customer_id}) { |
485 | 482 |
$query = |
486 | 483 |
qq|SELECT *, notes as customernotes |
... | ... | |
536 | 533 |
} |
537 | 534 |
|
538 | 535 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
536 |
my $defaultcurrency = $form->{defaultcurrency}; |
|
537 |
|
|
539 | 538 |
# Seit neuestem wird die department_id schon übergeben UND $form->department nicht mehr |
540 | 539 |
# korrekt zusammengebaut. Sehr wahrscheinlich beim Umstieg auf T8 kaputt gegangen |
541 | 540 |
# Ich lass den Code von 2005 erstmal noch stehen ;-) jb 03-2011 |
... | ... | |
556 | 555 |
$query = qq|SELECT nextval('glid')|; |
557 | 556 |
($form->{"id"}) = selectrow_query($form, $dbh, $query); |
558 | 557 |
|
559 |
$query = qq|INSERT INTO ar (id, invnumber) VALUES (?, ?)|;
|
|
560 |
do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}); |
|
558 |
$query = qq|INSERT INTO ar (id, invnumber, curr) VALUES (?, ?, (SELECT id FROM currencies WHERE curr=?))|;
|
|
559 |
do_query($form, $dbh, $query, $form->{"id"}, $form->{"id"}, $form->{currency});
|
|
561 | 560 |
|
562 | 561 |
if (!$form->{invnumber}) { |
563 | 562 |
$form->{invnumber} = |
... | ... | |
570 | 569 |
my ($netamount, $invoicediff) = (0, 0); |
571 | 570 |
my ($amount, $linetotal, $lastincomeaccno); |
572 | 571 |
|
573 |
my ($currencies) = selectfirst_array_query($form, $dbh, qq|SELECT curr FROM defaults|); |
|
574 |
my $defaultcurrency = (split m/:/, $currencies)[0]; |
|
575 |
|
|
576 | 572 |
if ($form->{currency} eq $defaultcurrency) { |
577 | 573 |
$form->{exchangerate} = 1; |
578 | 574 |
} else { |
... | ... | |
1085 | 1081 |
amount = ?, netamount = ?, paid = ?, |
1086 | 1082 |
duedate = ?, deliverydate = ?, invoice = ?, shippingpoint = ?, |
1087 | 1083 |
shipvia = ?, terms = ?, notes = ?, intnotes = ?, |
1088 |
curr = ?, department_id = ?, payment_id = ?, taxincluded = ?, |
|
1084 |
curr = (SELECT id FROM currencies WHERE curr= ?), |
|
1085 |
department_id = ?, payment_id = ?, taxincluded = ?, |
|
1089 | 1086 |
type = ?, language_id = ?, taxzone_id = ?, shipto_id = ?, |
1090 | 1087 |
employee_id = ?, salesman_id = ?, storno_id = ?, storno = ?, |
1091 | 1088 |
cp_id = ?, marge_total = ?, marge_percent = ?, |
... | ... | |
1558 | 1555 |
(SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno, |
1559 | 1556 |
(SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno, |
1560 | 1557 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
1561 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
1562 |
d.curr AS currencies |
|
1558 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
1563 | 1559 |
${query_transdate} |
1564 | 1560 |
FROM defaults d|; |
1565 | 1561 |
|
... | ... | |
1578 | 1574 |
a.orddate, a.quodate, a.globalproject_id, |
1579 | 1575 |
a.transdate AS invdate, a.deliverydate, a.paid, a.storno, a.gldate, |
1580 | 1576 |
a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes, a.taxzone_id, |
1581 |
a.duedate, a.taxincluded, a.curr AS currency, a.shipto_id, a.cp_id,
|
|
1577 |
a.duedate, a.taxincluded, (SELECT cu.curr FROM currencies cu WHERE cu.id=a.curr) AS currency, a.shipto_id, a.cp_id,
|
|
1582 | 1578 |
a.employee_id, a.salesman_id, a.payment_id, |
1583 | 1579 |
a.language_id, a.delivery_customer_id, a.delivery_vendor_id, a.type, |
1584 | 1580 |
a.transaction_description, a.donumber, a.invnumber_for_credit_note, |
... | ... | |
1590 | 1586 |
$ref = selectfirst_hashref_query($form, $dbh, $query, $id); |
1591 | 1587 |
map { $form->{$_} = $ref->{$_} } keys %{ $ref }; |
1592 | 1588 |
|
1593 |
# remove any trailing whitespace |
|
1594 |
$form->{currency} =~ s/\s*$//; |
|
1595 |
|
|
1596 | 1589 |
$form->{exchangerate} = $form->get_exchangerate($dbh, $form->{currency}, $form->{invdate}, "buy"); |
1597 | 1590 |
|
1598 | 1591 |
# get shipto |
... | ... | |
1757 | 1750 |
c.id AS customer_id, c.name AS customer, c.discount as customer_discount, c.creditlimit, c.terms, |
1758 | 1751 |
c.email, c.cc, c.bcc, c.language_id, c.payment_id, |
1759 | 1752 |
c.street, c.zipcode, c.city, c.country, |
1760 |
c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, c.curr,
|
|
1753 |
c.notes AS intnotes, c.klass as customer_klass, c.taxzone_id, c.salesman_id, (SELECT cu.curr FROM currencies cu WHERE cu.id=c.curr) AS curr,
|
|
1761 | 1754 |
c.taxincluded_checked, c.direct_debit, |
1762 | 1755 |
$duedate + COALESCE(pt.terms_netto, 0) AS duedate, |
1763 | 1756 |
b.discount AS tradediscount, b.description AS business |
... | ... | |
1772 | 1765 |
|
1773 | 1766 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
1774 | 1767 |
|
1775 |
# remove any trailing whitespace |
|
1776 |
$form->{curr} =~ s/\s*$//; |
|
1777 |
|
|
1778 |
# use customer currency if not empty |
|
1779 |
$form->{currency} = $form->{curr} if $form->{curr}; |
|
1768 |
# use customer currency |
|
1769 |
$form->{currency} = $form->{curr}; |
|
1780 | 1770 |
|
1781 | 1771 |
$query = |
1782 | 1772 |
qq|SELECT sum(amount - paid) AS dunning_amount |
SL/OE.pm | ||
---|---|---|
311 | 311 |
$query = qq|SELECT nextval('id')|; |
312 | 312 |
($form->{id}) = selectrow_query($form, $dbh, $query); |
313 | 313 |
|
314 |
$query = qq|INSERT INTO oe (id, ordnumber, employee_id) VALUES (?, '', ?)|;
|
|
314 |
$query = qq|INSERT INTO oe (id, ordnumber, employee_id, curr) VALUES (?, '', ?, (SELECT curr FROM defaults))|;
|
|
315 | 315 |
do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}); |
316 | 316 |
} |
317 | 317 |
|
... | ... | |
494 | 494 |
qq|UPDATE oe SET |
495 | 495 |
ordnumber = ?, quonumber = ?, cusordnumber = ?, transdate = ?, vendor_id = ?, |
496 | 496 |
customer_id = ?, amount = ?, netamount = ?, reqdate = ?, taxincluded = ?, |
497 |
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, curr = ?, closed = ?,
|
|
497 |
shippingpoint = ?, shipvia = ?, notes = ?, intnotes = ?, curr = (SELECT id FROM currencies WHERE curr=?), closed = ?,
|
|
498 | 498 |
delivered = ?, proforma = ?, quotation = ?, department_id = ?, language_id = ?, |
499 | 499 |
taxzone_id = ?, shipto_id = ?, payment_id = ?, delivery_vendor_id = ?, delivery_customer_id = ?, |
500 | 500 |
globalproject_id = ?, employee_id = ?, salesman_id = ?, cp_id = ?, transaction_description = ?, marge_total = ?, marge_percent = ? |
... | ... | |
506 | 506 |
$amount, $netamount, conv_date($reqdate), |
507 | 507 |
$form->{taxincluded} ? 't' : 'f', $form->{shippingpoint}, |
508 | 508 |
$form->{shipvia}, $form->{notes}, $form->{intnotes}, |
509 |
substr($form->{currency}, 0, 3), $form->{closed} ? 't' : 'f',
|
|
509 |
$form->{currency}, $form->{closed} ? 't' : 'f',
|
|
510 | 510 |
$form->{delivered} ? "t" : "f", $form->{proforma} ? 't' : 'f', |
511 | 511 |
$quotation, conv_i($form->{department_id}), |
512 | 512 |
conv_i($form->{language_id}), conv_i($form->{taxzone_id}), |
... | ... | |
759 | 759 |
(SELECT c.accno FROM chart c WHERE d.income_accno_id = c.id) AS income_accno, |
760 | 760 |
(SELECT c.accno FROM chart c WHERE d.expense_accno_id = c.id) AS expense_accno, |
761 | 761 |
(SELECT c.accno FROM chart c WHERE d.fxgain_accno_id = c.id) AS fxgain_accno, |
762 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno, |
|
763 |
d.curr AS currencies |
|
762 |
(SELECT c.accno FROM chart c WHERE d.fxloss_accno_id = c.id) AS fxloss_accno |
|
764 | 763 |
$query_add |
765 | 764 |
FROM defaults d|; |
766 | 765 |
my $ref = selectfirst_hashref_query($form, $dbh, $query); |
767 | 766 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
768 | 767 |
|
769 |
($form->{currency}) = split(/:/, $form->{currencies}) unless ($form->{currency});
|
|
768 |
$form->{currency} = $form->get_default_currency($myconfig);
|
|
770 | 769 |
|
771 | 770 |
# set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure |
772 | 771 |
# we come from invoices, feel free. |
... | ... | |
785 | 784 |
$query = |
786 | 785 |
qq|SELECT o.cp_id, o.ordnumber, o.transdate, o.reqdate, |
787 | 786 |
o.taxincluded, o.shippingpoint, o.shipvia, o.notes, o.intnotes, |
788 |
o.curr AS currency, e.name AS employee, o.employee_id, o.salesman_id,
|
|
787 |
(SELECT cu.curr FROM currencies cu WHERE cu.id=o.curr) AS currency, e.name AS employee, o.employee_id, o.salesman_id,
|
|
789 | 788 |
o.${vc}_id, cv.name AS ${vc}, o.amount AS invtotal, |
790 | 789 |
o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber, |
791 | 790 |
d.description AS department, o.payment_id, o.language_id, o.taxzone_id, |
... | ... | |
807 | 806 |
if ($ref) { |
808 | 807 |
map { $form->{$_} = $ref->{$_} } keys %$ref; |
809 | 808 |
|
810 |
# remove any trailing whitespace |
|
811 |
$form->{currency} =~ s/\s*$//; |
|
812 |
|
|
813 | 809 |
$form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"}; |
814 | 810 |
|
815 | 811 |
# set all entries for multiple ids blank that yield different information |
bin/mozilla/cp.pl | ||
---|---|---|
109 | 109 |
# geben und hier reinparsen, oder besser multibox oder html auslagern? |
110 | 110 |
# Antwort: form->currency wird mit oldcurrency oder curr[0] überschrieben |
111 | 111 |
# Wofür macht das Sinn? |
112 |
@curr = split(/:/, $form->{currencies}); |
|
113 |
chomp $curr[0]; |
|
112 |
@curr = $form->get_all_currencies(); |
|
114 | 113 |
$form->{defaultcurrency} = $form->{currency} = $form->{oldcurrency} = |
115 |
$curr[0];
|
|
114 |
$form->get_default_currency(\%myconfig);
|
|
116 | 115 |
|
117 | 116 |
# Entsprechend präventiv die Auswahlliste für Währungen |
118 | 117 |
# auch mit value= zusammenbauen (s.a. oben bugfix 1771) |
bin/mozilla/ic.pl | ||
---|---|---|
1489 | 1489 |
IC->create_links("IC", \%myconfig, \%$form); |
1490 | 1490 |
|
1491 | 1491 |
# currencies |
1492 |
map({ $form->{selectcurrency} .= "<option>$_\n" } |
|
1493 |
split(/:/, $form->{currencies})); |
|
1492 |
map({ $form->{selectcurrency} .= "<option>$_\n" } $::form->get_all_currencies()); |
|
1494 | 1493 |
|
1495 | 1494 |
# parts and assemblies have the same links |
1496 | 1495 |
my $item = $form->{item}; |
bin/mozilla/ir.pl | ||
---|---|---|
149 | 149 |
$form->{currency} = $currency; |
150 | 150 |
} |
151 | 151 |
|
152 |
my @curr = split(/:/, $form->{currencies}); #seems to be missing
|
|
152 |
my @curr = $form->get_all_currencies();
|
|
153 | 153 |
map { $form->{selectcurrency} .= "<option>$_\n" } @curr; |
154 | 154 |
|
155 | 155 |
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}"; |
templates/webpages/am/edit_defaults.html | ||
---|---|---|
150 | 150 |
<input type="hidden" name="rowcount" value="[% CURRENCIES.size %]"> |
151 | 151 |
<th align="right">[% 'Currencies' | $T8 %]</th> |
152 | 152 |
<td colspan="3">[% FOREACH row = CURRENCIES %]<input name="curr_[% loop.count %]" size="3" value="[% HTML.escape(row.curr) %]"> |
153 |
<input type=hidden name="old_curr_[% loop.count %]" value="[% HTML.escape(defaults_curr) %]">
|
|
153 |
<input type=hidden name="old_curr_[% loop.count %]" value="[% HTML.escape(row.curr) %]">
|
|
154 | 154 |
[% END %] |
155 | 155 |
<input name="new_curr" size="3" value=""> |
156 | 156 |
</td> |
Auch abrufbar als: Unified diff
Nutzung der Tabelle currencies
Dieser Commmit passt den Code an, um die Tabelle currencies zu nutzen.