Revision fb37acdc
Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt
SL/AP.pm | ||
---|---|---|
48 | 48 |
my ($null, $taxrate, $amount); |
49 | 49 |
my $exchangerate = 0; |
50 | 50 |
|
51 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
|
52 |
|
|
51 | 53 |
($null, $form->{department_id}) = split(/--/, $form->{department}); |
52 | 54 |
$form->{department_id} *= 1; |
53 | 55 |
|
SL/AR.pm | ||
---|---|---|
50 | 50 |
my @values; |
51 | 51 |
|
52 | 52 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); |
53 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
|
53 | 54 |
|
54 | 55 |
# set exchangerate |
55 | 56 |
$form->{exchangerate} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 : |
... | ... | |
147 | 148 |
|
148 | 149 |
# update exchangerate |
149 | 150 |
$form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, $form->{exchangerate}, 0) |
150 |
if ($form->{currency} ne $form->{defaultcurrency}) && $form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, 'buy'); |
|
151 |
if ($form->{currency} ne $form->{defaultcurrency}) && !$form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, 'buy');
|
|
151 | 152 |
|
152 | 153 |
if (!$payments_only) { |
153 | 154 |
$query = |
SL/Form.pm | ||
---|---|---|
1127 | 1127 |
if ($curr eq '') { |
1128 | 1128 |
$main::lxdebug->leave_sub(); |
1129 | 1129 |
return; |
1130 |
} |
|
1131 |
my $query = qq|SELECT curr FROM defaults|; |
|
1132 |
|
|
1133 |
my ($currency) = selectrow_query($self, $dbh, $query); |
|
1134 |
my ($defaultcurrency) = split m/:/, $currency; |
|
1135 |
|
|
1136 |
|
|
1137 |
if ($curr eq $defaultcurrency) { |
|
1138 |
$main::lxdebug->leave_sub(); |
|
1139 |
return; |
|
1130 | 1140 |
} |
1131 | 1141 |
|
1132 | 1142 |
my $query = qq|SELECT e.curr FROM exchangerate e |
... | ... | |
1134 | 1144 |
FOR UPDATE|; |
1135 | 1145 |
my $sth = prepare_execute_query($self, $dbh, $query, $curr, $transdate); |
1136 | 1146 |
|
1147 |
if ($buy == 0) { |
|
1148 |
$buy = ""; |
|
1149 |
} |
|
1150 |
if ($sell == 0) { |
|
1151 |
$sell = ""; |
|
1152 |
} |
|
1153 |
|
|
1154 |
$buy = conv_i($buy, "NULL"); |
|
1155 |
$sell = conv_i($sell, "NULL"); |
|
1156 |
|
|
1137 | 1157 |
my $set; |
1138 | 1158 |
if ($buy != 0 && $sell != 0) { |
1139 | 1159 |
$set = "buy = $buy, sell = $sell"; |
... | ... | |
1148 | 1168 |
SET $set |
1149 | 1169 |
WHERE curr = ? |
1150 | 1170 |
AND transdate = ?|; |
1171 |
|
|
1151 | 1172 |
} else { |
1152 | 1173 |
$query = qq|INSERT INTO exchangerate (curr, buy, sell, transdate) |
1153 | 1174 |
VALUES (?, $buy, $sell, ?)|; |
... | ... | |
1165 | 1186 |
|
1166 | 1187 |
my $dbh = $self->dbconnect($myconfig); |
1167 | 1188 |
|
1168 |
my ($buy, $sell) = (0, 0); |
|
1189 |
my ($buy, $sell); |
|
1190 |
|
|
1169 | 1191 |
$buy = $rate if $fld eq 'buy'; |
1170 | 1192 |
$sell = $rate if $fld eq 'sell'; |
1171 | 1193 |
|
1194 |
|
|
1172 | 1195 |
$self->update_exchangerate($dbh, $currency, $transdate, $buy, $sell); |
1173 | 1196 |
|
1197 |
|
|
1174 | 1198 |
$dbh->disconnect; |
1175 | 1199 |
|
1176 | 1200 |
$main::lxdebug->leave_sub(); |
... | ... | |
1186 | 1210 |
return 1; |
1187 | 1211 |
} |
1188 | 1212 |
|
1213 |
my $query = qq|SELECT curr FROM defaults|; |
|
1214 |
|
|
1215 |
my ($currency) = selectrow_query($self, $dbh, $query); |
|
1216 |
my ($defaultcurrency) = split m/:/, $currency; |
|
1217 |
|
|
1218 |
if ($currency eq $defaultcurrency) { |
|
1219 |
$main::lxdebug->leave_sub(); |
|
1220 |
return 1; |
|
1221 |
} |
|
1222 |
|
|
1189 | 1223 |
my $query = qq|SELECT e.$fld FROM exchangerate e |
1190 | 1224 |
WHERE e.curr = ? AND e.transdate = ?|; |
1191 | 1225 |
my ($exchangerate) = selectrow_query($self, $dbh, $query, $curr, $transdate); |
1192 | 1226 |
|
1193 |
if (!$exchangerate) { |
|
1194 |
$exchangerate = 1; |
|
1195 |
} |
|
1227 |
|
|
1196 | 1228 |
|
1197 | 1229 |
$main::lxdebug->leave_sub(); |
1198 | 1230 |
|
... | ... | |
1209 | 1241 |
return ""; |
1210 | 1242 |
} |
1211 | 1243 |
|
1212 |
my $dbh = $self->dbconnect($myconfig); |
|
1244 |
my ($defaultcurrency) = $self->get_default_currency($myconfig); |
|
1245 |
|
|
1246 |
if ($currency eq $defaultcurrency) { |
|
1247 |
$main::lxdebug->leave_sub(); |
|
1248 |
return 1; |
|
1249 |
} |
|
1213 | 1250 |
|
1251 |
my $dbh = $self->get_standard_dbh($myconfig); |
|
1214 | 1252 |
my $query = qq|SELECT e.$fld FROM exchangerate e |
1215 | 1253 |
WHERE e.curr = ? AND e.transdate = ?|; |
1254 |
|
|
1216 | 1255 |
my ($exchangerate) = selectrow_query($self, $dbh, $query, $currency, $transdate); |
1217 |
$dbh->disconnect(); |
|
1218 | 1256 |
|
1219 |
$exchangerate = 1 if ($exchangerate == 0); |
|
1220 | 1257 |
$exchangerate = 1 if ($exchangerate eq ""); |
1221 | 1258 |
|
1222 | 1259 |
$main::lxdebug->leave_sub(); |
... | ... | |
1224 | 1261 |
return $exchangerate; |
1225 | 1262 |
} |
1226 | 1263 |
|
1264 |
sub get_default_currency { |
|
1265 |
$main::lxdebug->enter_sub(); |
|
1266 |
|
|
1267 |
my ($self, $myconfig) = @_; |
|
1268 |
my $dbh = $self->get_standard_dbh($myconfig); |
|
1269 |
|
|
1270 |
my $query = qq|SELECT curr FROM defaults|; |
|
1271 |
|
|
1272 |
my ($curr) = selectrow_query($self, $dbh, $query); |
|
1273 |
my ($defaultcurrency) = split m/:/, $curr; |
|
1274 |
|
|
1275 |
$main::lxdebug->leave_sub(); |
|
1276 |
|
|
1277 |
return $defaultcurrency; |
|
1278 |
} |
|
1279 |
|
|
1280 |
|
|
1227 | 1281 |
sub set_payment_options { |
1228 | 1282 |
$main::lxdebug->enter_sub(); |
1229 | 1283 |
|
SL/IR.pm | ||
---|---|---|
46 | 46 |
|
47 | 47 |
# connect to database, turn off autocommit |
48 | 48 |
my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig); |
49 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
|
49 | 50 |
|
50 | 51 |
my ($query, $sth, @values, $project_id); |
51 | 52 |
my ($allocated, $taxrate, $taxamount, $taxdiff, $item); |
SL/IS.pm | ||
---|---|---|
492 | 492 |
if (!$form->{employee_id}) { |
493 | 493 |
$form->get_employee($dbh); |
494 | 494 |
} |
495 |
|
|
496 |
$form->{defaultcurrency} = $form->get_default_currency($myconfig); |
|
495 | 497 |
|
496 | 498 |
($null, $form->{department_id}) = split(/--/, $form->{department}); |
497 | 499 |
|
SL/RP.pm | ||
---|---|---|
980 | 980 |
$project |
981 | 981 |
AND ac.amount > 0 |
982 | 982 |
AND c.accno = ?) AS credit |; |
983 |
|
|
983 | 984 |
$drcr = prepare_query($form, $dbh, $q_drcr); |
984 | 985 |
|
985 | 986 |
if ($form->{project_id}) { |
bin/mozilla/ap.pl | ||
---|---|---|
213 | 213 |
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; |
214 | 214 |
$readonly = ($form->{radier}) ? "" : $readonly; |
215 | 215 |
|
216 |
$form->{exchangerate} = $exchangerate |
|
217 |
if ( |
|
218 |
$form->{forex} = ( |
|
219 |
$exchangerate = |
|
220 |
$form->check_exchangerate( |
|
221 |
\%myconfig, $form->{currency}, $form->{transdate}, 'sell' |
|
222 |
))); |
|
223 |
|
|
224 |
|
|
216 | 225 |
# format amounts |
217 | 226 |
$form->{exchangerate} = |
218 | 227 |
$form->format_amount(\%myconfig, $form->{exchangerate}); |
219 |
|
|
228 |
if ($form->{exchangerate} == 0) { |
|
229 |
$form->{exchangerate} = ""; |
|
230 |
} |
|
220 | 231 |
$form->{creditlimit} = |
221 | 232 |
$form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); |
222 | 233 |
$form->{creditremaining} = |
... | ... | |
647 | 658 |
} |
648 | 659 |
$form->{"exchangerate_$i"} = |
649 | 660 |
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); |
661 |
if ($form->{"exchangerate_$i"} == 0) { |
|
662 |
$form->{"exchangerate_$i"} = ""; |
|
663 |
} |
|
650 | 664 |
|
651 | 665 |
$exchangerate = qq| |; |
652 | 666 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
bin/mozilla/ar.pl | ||
---|---|---|
232 | 232 |
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; |
233 | 233 |
} |
234 | 234 |
|
235 |
$form->{exchangerate} = $exchangerate |
|
236 |
if ( |
|
237 |
$form->{forex} = ( |
|
238 |
$exchangerate = |
|
239 |
$form->check_exchangerate( |
|
240 |
\%myconfig, $form->{currency}, $form->{transdate}, 'buy' |
|
241 |
))); |
|
242 |
|
|
235 | 243 |
# format amounts |
236 | 244 |
$form->{exchangerate} = |
237 | 245 |
$form->format_amount(\%myconfig, $form->{exchangerate}); |
238 | 246 |
|
247 |
if ($form->{exchangerate} == 0) { |
|
248 |
$form->{exchangerate} = ""; |
|
249 |
} |
|
250 |
|
|
239 | 251 |
$form->{creditlimit} = |
240 | 252 |
$form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); |
241 | 253 |
$form->{creditremaining} = |
... | ... | |
678 | 690 |
$form->{"exchangerate_$i"} = |
679 | 691 |
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); |
680 | 692 |
|
693 |
if ($form->{"exchangerate_$i"} == 0) { |
|
694 |
$form->{"exchangerate_$i"} = ""; |
|
695 |
} |
|
696 |
|
|
681 | 697 |
$exchangerate = qq| |; |
682 | 698 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
683 | 699 |
if ($form->{"forex_$i"}) { |
bin/mozilla/is.pl | ||
---|---|---|
302 | 302 |
} |
303 | 303 |
} |
304 | 304 |
} |
305 |
|
|
305 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
306 | 306 |
$form->{radier} = |
307 | 307 |
($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; |
308 | 308 |
|
... | ... | |
1031 | 1031 |
$form->{"exchangerate_$i"} = |
1032 | 1032 |
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); |
1033 | 1033 |
|
1034 |
if ($form->{"exchangerate_$i"} == 0) { |
|
1035 |
$form->{"exchangerate_$i"} = ""; |
|
1036 |
} |
|
1034 | 1037 |
$exchangerate = qq| |; |
1035 | 1038 |
if ($form->{currency} ne $form->{defaultcurrency}) { |
1036 | 1039 |
if ($form->{"forex_$i"}) { |
... | ... | |
1379 | 1382 |
|
1380 | 1383 |
sub post_payment { |
1381 | 1384 |
$lxdebug->enter_sub(); |
1385 |
|
|
1386 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
1382 | 1387 |
for $i (1 .. $form->{paidaccounts}) { |
1383 | 1388 |
if ($form->{"paid_$i"}) { |
1384 | 1389 |
$datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); |
... | ... | |
1410 | 1415 |
|
1411 | 1416 |
sub post { |
1412 | 1417 |
$lxdebug->enter_sub(); |
1418 |
|
|
1419 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
1413 | 1420 |
$form->isblank("invdate", $locale->text('Invoice Date missing!')); |
1414 | 1421 |
$form->isblank("customer", $locale->text('Customer missing!')); |
1415 | 1422 |
|
bin/mozilla/oe.pl | ||
---|---|---|
331 | 331 |
$form->{salesman_id} = $form->{old_salesman_id}; |
332 | 332 |
} |
333 | 333 |
|
334 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
335 |
|
|
334 | 336 |
map { $form->{$_} =~ s/\"/"/g } |
335 | 337 |
qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname |
336 | 338 |
shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact |
... | ... | |
570 | 572 |
$form->{exchangerate} = |
571 | 573 |
$form->format_amount(\%myconfig, $form->{exchangerate}); |
572 | 574 |
|
575 |
if (!$form->{exchangerate}) { |
|
576 |
$form->{exchangerate} = ""; |
|
577 |
} |
|
578 |
|
|
573 | 579 |
if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) { |
574 | 580 |
$creditwarning = 1; |
575 | 581 |
} else { |
... | ... | |
1924 | 1930 |
sub save_and_close { |
1925 | 1931 |
$lxdebug->enter_sub(); |
1926 | 1932 |
|
1933 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
1934 |
|
|
1935 |
|
|
1927 | 1936 |
if ($form->{type} =~ /_order$/) { |
1928 | 1937 |
$form->isblank("transdate", $locale->text('Order Date missing!')); |
1929 | 1938 |
} else { |
... | ... | |
2019 | 2028 |
sub save { |
2020 | 2029 |
$lxdebug->enter_sub(); |
2021 | 2030 |
|
2031 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
2032 |
|
|
2033 |
|
|
2022 | 2034 |
if ($form->{type} =~ /_order$/) { |
2023 | 2035 |
$form->isblank("transdate", $locale->text('Order Date missing!')); |
2024 | 2036 |
} else { |
... | ... | |
2270 | 2282 |
$form->{rowcount}--; |
2271 | 2283 |
$form->{shipto} = 1; |
2272 | 2284 |
|
2285 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
|
2286 |
|
|
2273 | 2287 |
if ($form->{type} =~ /_order$/) { |
2274 | 2288 |
$form->{exchangerate} = $exchangerate; |
2275 | 2289 |
&create_backorder; |
Auch abrufbar als: Unified diff
Probleme mit mehreren Währungen und Wechselkursen behoben.