Revision 0270c3d5
Von Sven Schöling vor fast 19 Jahren hinzugefügt
bin/mozilla/oe.pl | ||
---|---|---|
1 |
#===================================================================== |
|
1 |
# #=====================================================================
|
|
2 | 2 |
# LX-Office ERP |
3 | 3 |
# Copyright (C) 2004 |
4 | 4 |
# Based on SQL-Ledger Version 2.1.9 |
... | ... | |
77 | 77 |
sub edit { |
78 | 78 |
$lxdebug->enter_sub(); |
79 | 79 |
|
80 |
# editing without stuff to edit? try adding it first |
|
81 |
if ($form->{rowcount}) { |
|
82 |
map {$id++ if $form->{"id_$_"}} (1 .. $form->{rowcount}); |
|
83 |
if (!$id) { |
|
84 |
# reset rowcount |
|
85 |
undef $form->{rowcount}; |
|
86 |
&add; |
|
87 |
return; |
|
88 |
} |
|
89 |
} else { |
|
90 |
if (!$form->{id}) { |
|
91 |
&add; |
|
92 |
return; |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
80 | 96 |
if ($form->{type} eq 'purchase_order') { |
81 | 97 |
$form->{title} = $locale->text('Edit Purchase Order'); |
82 | 98 |
$form->{heading} = $locale->text('Purchase Order'); |
... | ... | |
121 | 137 |
|
122 | 138 |
OE->retrieve(\%myconfig, \%$form); |
123 | 139 |
|
140 |
# if multiple rowcounts (== collective order) then check if the |
|
141 |
# there were more than one customer (in that case OE::retrieve removes |
|
142 |
# the content from the field) |
|
143 |
if ($form->{rowcount} && $form->{type} eq 'sales_order' && $form->{customer} eq '') { |
|
144 |
# $main::lxdebug->message(0, "Detected Edit order with concurrent customers"); |
|
145 |
$form->error($locale->text('Collective Orders only work for orders from one customer!')); |
|
146 |
} |
|
147 |
|
|
124 | 148 |
$taxincluded = $form->{taxincluded}; |
125 | 149 |
$form->{shipto} = 1 if $form->{id}; |
126 | 150 |
|
... | ... | |
197 | 221 |
$form->{media} = "screen"; |
198 | 222 |
$form->{formname} = $form->{type}; |
199 | 223 |
|
200 |
if ($form->{id}) { |
|
201 |
|
|
202 | 224 |
map { $form->{$_} =~ s/\"/"/g } |
203 | 225 |
qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact); |
204 | 226 |
|
205 | 227 |
foreach $ref (@{ $form->{form_details} }) { |
206 |
$i++; |
|
207 |
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; |
|
208 |
$form->{"discount_$i"} = |
|
209 |
$form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); |
|
228 |
$form->{rowcount} = ++$i; |
|
210 | 229 |
|
211 |
($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); |
|
212 |
$dec = length $dec; |
|
213 |
$decimalplaces = ($dec > 2) ? $dec : 2; |
|
214 |
|
|
215 |
$form->{"sellprice_$i"} = |
|
216 |
$form->format_amount(\%myconfig, $form->{"sellprice_$i"}, |
|
217 |
$decimalplaces); |
|
218 |
|
|
219 |
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); |
|
220 |
$dec_qty = length $dec_qty; |
|
221 |
|
|
222 |
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); |
|
223 |
|
|
224 |
map { $form->{"${_}_$i"} =~ s/\"/"/g } |
|
225 |
qw(partnumber description unit); |
|
226 |
$form->{rowcount} = $i; |
|
230 |
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; |
|
227 | 231 |
} |
228 |
} elsif ($form->{rowcount}) { |
|
232 |
|
|
229 | 233 |
for my $i (1 .. $form->{rowcount}) { |
230 | 234 |
$form->{"discount_$i"} = |
231 | 235 |
$form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); |
232 | 236 |
|
233 |
($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); |
|
237 |
($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
|
|
234 | 238 |
$dec = length $dec; |
235 | 239 |
$decimalplaces = ($dec > 2) ? $dec : 2; |
236 | 240 |
|
... | ... | |
245 | 249 |
map { $form->{"${_}_$i"} =~ s/\"/"/g } |
246 | 250 |
qw(partnumber description unit); |
247 | 251 |
} |
248 |
} |
|
249 | 252 |
|
250 | 253 |
$lxdebug->leave_sub(); |
251 | 254 |
} |
... | ... | |
860 | 863 |
. $locale->text('Order') . qq|"> |
861 | 864 |
|; |
862 | 865 |
} |
866 |
} elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount}) { |
|
867 |
print qq| |
|
868 |
<br>Workflow $form->{heading}<br> |
|
869 |
<input class=submit type=submit name=action value="| |
|
870 |
. $locale->text('Save as new') . qq|"> |
|
871 |
<input class=submit type=submit name=action value="| |
|
872 |
. $locale->text('Invoice') . qq|"> |
|
873 |
|; |
|
863 | 874 |
} |
875 |
|
|
864 | 876 |
|
865 | 877 |
if ($form->{menubar}) { |
866 | 878 |
require "$form->{path}/menu.pl"; |
... | ... | |
1312 | 1324 |
} |
1313 | 1325 |
} |
1314 | 1326 |
|
1327 |
# only show checkboxes if gotten here via sales_order form. |
|
1328 |
if ($form->{type} =~ /sales_order/) { |
|
1329 |
unshift @column_index, "ids"; |
|
1330 |
} |
|
1331 |
|
|
1315 | 1332 |
if ($form->{l_subtotal} eq 'Y') { |
1316 | 1333 |
$callback .= "&l_subtotal=Y"; |
1317 | 1334 |
$href .= "&l_subtotal=Y"; |
... | ... | |
1384 | 1401 |
$column_header{employee} = |
1385 | 1402 |
qq|<th><a class=listheading href=$href&sort=employee>$employee</a></th>|; |
1386 | 1403 |
|
1404 |
$column_header{ids} = qq|<th></th>|; |
|
1405 |
|
|
1387 | 1406 |
if ($form->{ $form->{vc} }) { |
1388 | 1407 |
$option = $locale->text(ucfirst $form->{vc}); |
1389 | 1408 |
$option .= " : $form->{$form->{vc}}"; |
... | ... | |
1423 | 1442 |
print qq| |
1424 | 1443 |
<body> |
1425 | 1444 |
|
1445 |
<form method="post" action="oe.pl"> |
|
1426 | 1446 |
<table width=100%> |
1427 | 1447 |
<tr> |
1428 | 1448 |
<th class=listtop>$form->{title}</th> |
... | ... | |
1443 | 1463 |
|; |
1444 | 1464 |
|
1445 | 1465 |
# add sort and escape callback |
1446 |
$callback = $form->escape($callback . "&sort=$form->{sort}"); |
|
1466 |
$callback_escaped = $form->escape($callback . "&sort=$form->{sort}");
|
|
1447 | 1467 |
|
1448 | 1468 |
if (@{ $form->{OE} }) { |
1449 | 1469 |
$sameitem = $form->{OE}->[0]->{ $form->{sort} }; |
... | ... | |
1455 | 1475 |
$warehouse = $form->escape($form->{warehouse}); |
1456 | 1476 |
|
1457 | 1477 |
foreach $oe (@{ $form->{OE} }) { |
1478 |
$form->{rowcount} = ++$j; |
|
1458 | 1479 |
|
1459 | 1480 |
if ($form->{l_subtotal} eq 'Y') { |
1460 | 1481 |
if ($sameitem ne $oe->{ $form->{sort} }) { |
... | ... | |
1483 | 1504 |
$subtotalnetamount += $oe->{netamount}; |
1484 | 1505 |
$subtotalamount += $oe->{amount}; |
1485 | 1506 |
|
1507 |
$column_data{ids} = qq|<td><input name="id_$j" class=checkbox type=checkbox><input type="hidden" name="trans_id_$j" value="$oe->{id}"></td>|; |
|
1486 | 1508 |
$column_data{id} = "<td>$oe->{id}</td>"; |
1487 | 1509 |
$column_data{transdate} = "<td>$oe->{transdate} </td>"; |
1488 | 1510 |
$column_data{reqdate} = "<td>$oe->{reqdate} </td>"; |
1489 | 1511 |
|
1490 | 1512 |
$column_data{$ordnumber} = |
1491 |
"<td><a href=oe.pl?path=$form->{path}&action=$action&type=$form->{type}&id=$oe->{id}&warehouse=$warehouse&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback>$oe->{$ordnumber}</a></td>"; |
|
1513 |
"<td><a href=oe.pl?path=$form->{path}&action=$action&type=$form->{type}&id=$oe->{id}&warehouse=$warehouse&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber}</a></td>";
|
|
1492 | 1514 |
$column_data{name} = "<td>$oe->{name}</td>"; |
1493 | 1515 |
|
1494 | 1516 |
$column_data{employee} = "<td>$oe->{employee} </td>"; |
... | ... | |
1546 | 1568 |
<tr> |
1547 | 1569 |
<td><hr size=3 noshade></td> |
1548 | 1570 |
</tr> |
1549 |
</table> |
|
1571 |
</table>|; |
|
1572 |
|
|
1573 |
# multiple invoice edit button only if gotten there via sales_order form. |
|
1574 |
|
|
1575 |
if ($form->{type} =~ /sales_order/) { |
|
1576 |
print qq| |
|
1577 |
<input type="hidden" name="path" value="$form->{path}"> |
|
1578 |
<input class"submit" type="submit" name="action" value="| |
|
1579 |
. $locale->text('Continue') .qq|"> |
|
1580 |
<input type="hidden" name="nextsub" value="edit"> |
|
1581 |
<input type="hidden" name="type" value="$form->{type}"> |
|
1582 |
<input type="hidden" name="warehouse" value="$warehouse"> |
|
1583 |
<input type="hidden" name="vc" value="$form->{vc}"> |
|
1584 |
<input type="hidden" name="login" value="$form->{login}"> |
|
1585 |
<input type="hidden" name="password" value="$form->{password}"> |
|
1586 |
<input type="hidden" name="callback" value="$callback"> |
|
1587 |
<input type="hidden" name="rowcount" value="$form->{rowcount}">|; |
|
1588 |
} |
|
1589 |
|
|
1590 |
print qq| |
|
1591 |
</form> |
|
1550 | 1592 |
|
1551 | 1593 |
<br> |
1552 | 1594 |
<form method=post action=$form->{script}> |
... | ... | |
1751 | 1793 |
$lxdebug->enter_sub(); |
1752 | 1794 |
|
1753 | 1795 |
if ($form->{type} =~ /_order$/) { |
1754 |
$form->isblank("ordnumber", $locale->text('Order Number missing!')); |
|
1755 |
$form->isblank("transdate", $locale->text('Order Date missing!')); |
|
1796 |
# these checks only apply if the items don't bring their own ordnumbers/transdates. |
|
1797 |
# The if clause ensures that by searching for empty ordnumber_#/transdate_# fields. |
|
1798 |
$form->isblank("ordnumber", $locale->text('Order Number missing!')) if ( +{ map { $form->{"ordnumber_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} ); |
|
1799 |
$form->isblank("transdate", $locale->text('Order Date missing!')) if ( +{ map { $form->{"transdate_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} ); |
|
1756 | 1800 |
|
1757 | 1801 |
} else { |
1758 | 1802 |
$form->isblank("quonumber", $locale->text('Quotation Number missing!')); |
... | ... | |
1788 | 1832 |
|
1789 | 1833 |
# close orders/quotations |
1790 | 1834 |
$form->{closed} = 1; |
1791 |
OE->save(\%myconfig, \%$form); |
|
1835 |
|
|
1836 |
# save order iff one ordnumber has been given |
|
1837 |
# if not it's most likely a collective order, which can't be saved back |
|
1838 |
# so they just have to be closed |
|
1839 |
if ($form->{ordnumber} ne '') { |
|
1840 |
OE->save(\%myconfig, \%$form); |
|
1841 |
} else { |
|
1842 |
OE->close_orders(\%myconfig, \%$form); |
|
1843 |
} |
|
1792 | 1844 |
|
1793 | 1845 |
$form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig); |
1794 | 1846 |
$form->{duedate} = |
Auch abrufbar als: Unified diff
Feature Sammelauftraege fuer Antivir
- Kann jetzt mehrere Auftraege in der Suchmaske anwaehlen und zusammenfassen zu einem Sammelauftrag.
- Kann diesen Sammelauftrag als neu speichern und eine Rechnung dafuer ausstellen.
- Kann die folgende Rechnung wiederum speichern und buchen.
- Wird Sammelauftraege mit nur einem Auftrag abfangen und wie gehabt als einzelnen behandeln.
- Wird soviele Daten wie moeglich im Header des Sammelauftrags beibehalten, wobei customer, ordnumber und transdate eindeutig sein muessen.
- transdate und ordnumber werden bei Bedarf ueberschrieben, nicht eindeutiger customer wird mit Fehlermeldung quittiert
Zusaetzlich:
- Bugfix in Form::get_exchangerate, genauso gefixt wie in Form::check_exchangerate
- neue Routine OE:close_orders, die genau das tut.
- Der Versuch oe::edit ohne eine id aufzurufen wird nun auf oe::add umgeleitet