return $rc;
}
-sub warehouses {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT id, description
- FROM warehouse
- ORDER BY 2|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
- push @{ $form->{ALL} }, $ref;
- }
-
- $sth->finish;
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub get_warehouse {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- my $query = qq|SELECT w.description
- FROM warehouse w
- WHERE w.id = $form->{id}|;
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ref = $sth->fetchrow_hashref(NAME_lc);
-
- map { $form->{$_} = $ref->{$_} } keys %$ref;
-
- $sth->finish;
-
- # see if it is in use
- $query = qq|SELECT count(*) FROM inventory i
- WHERE i.warehouse_id = $form->{id}|;
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{orphaned}) = $sth->fetchrow_array;
- $form->{orphaned} = !$form->{orphaned};
- $sth->finish;
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub save_warehouse {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- $form->{description} =~ s/\'/\'\'/g;
-
- if ($form->{id}) {
- $query = qq|UPDATE warehouse SET
- description = '$form->{description}'
- WHERE id = $form->{id}|;
- } else {
- $query = qq|INSERT INTO warehouse
- (description)
- VALUES ('$form->{description}')|;
- }
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_warehouse {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- # connect to database
- my $dbh = $form->dbconnect($myconfig);
-
- $query = qq|DELETE FROM warehouse
- WHERE id = $form->{id}|;
- $dbh->do($query) || $form->dberror($query);
-
- $dbh->disconnect;
-
- $main::lxdebug->leave_sub();
-}
-
sub departments {
$main::lxdebug->enter_sub();
WHERE o.quotation = '$quotation'
$department|;
- # build query if type eq (ship|receive)_order
- if ($form->{type} =~ /(ship|receive)_order/) {
- my ($warehouse, $warehouse_id) = split /--/, $form->{warehouse};
-
- $query = qq|SELECT DISTINCT ON (o.id) o.id, o.ordnumber, o.transdate,
- o.reqdate, o.amount, ct.name, o.netamount, o.$form->{vc}_id,
- ex.$rate AS exchangerate,
- o.closed, o.quonumber, o.shippingpoint, o.shipvia,
- e.name AS employee
- FROM oe o
- JOIN $form->{vc} ct ON (o.$form->{vc}_id = ct.id)
- JOIN orderitems oi ON (oi.trans_id = o.id)
- JOIN parts p ON (p.id = oi.parts_id)
- LEFT JOIN employee e ON (o.employee_id = e.id)
- LEFT JOIN exchangerate ex ON (ex.curr = o.curr
- AND ex.transdate = o.transdate)
- WHERE o.quotation = '0'
- AND (p.inventory_accno_id > 0 OR p.assembly = '1')
- AND oi.qty <> oi.ship
- $department|;
-
- if ($warehouse_id && $form->{type} eq 'ship_order') {
- $query .= qq|
- AND i.warehouse_id = $warehouse_id
- AND i.qty >= (oi.qty - oi.ship)
- |;
- }
-
- }
-
if ($form->{"$form->{vc}_id"}) {
$query .= qq| AND o.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
} else {
push @partsgroup, [$i, $partsgroup];
}
- # if there is a warehouse limit picking
- if ($form->{warehouse_id} && $form->{formname} =~ /(pick|packing)_list/) {
-
- # run query to check for inventory
- $query = qq|SELECT sum(i.qty) AS qty
- FROM inventory i
- WHERE i.parts_id = ?
- AND i.warehouse_id = ?|;
- $sth = $dbh->prepare($query) || $form->dberror($query);
-
- for $i (1 .. $form->{rowcount}) {
- $sth->execute($form->{"id_$i"}, $form->{warehouse_id}) || $form->dberror;
-
- ($qty) = $sth->fetchrow_array;
- $sth->finish;
-
- $form->{"qty_$i"} = 0 if $qty == 0;
-
- if ($form->parse_amount($myconfig, $form->{"ship_$i"}) > $qty) {
- $form->{"ship_$i"} = $form->format_amount($myconfig, $qty);
- }
- }
- }
-
my $sameitem = "";
foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) {
$i = $item->[0];
$lxdebug->leave_sub();
}
-sub add_warehouse {
- $lxdebug->enter_sub();
-
- $form->{title} = "Add";
-
- $form->{callback} =
- "$form->{script}?action=add_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
-
- &warehouse_header;
- &form_footer;
-
- $lxdebug->leave_sub();
-}
-
-sub edit_warehouse {
- $lxdebug->enter_sub();
-
- $form->{title} = "Edit";
-
- AM->get_warehouse(\%myconfig, \%$form);
-
- &warehouse_header;
- &form_footer;
-
- $lxdebug->leave_sub();
-}
-
-sub list_warehouse {
- $lxdebug->enter_sub();
-
- AM->warehouses(\%myconfig, \%$form);
-
- $form->{callback} =
- "$form->{script}?action=list_warehouse&path=$form->{path}&login=$form->{login}&password=$form->{password}";
-
- $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Warehouses');
-
- @column_index = qw(description);
-
- $column_header{description} =
- qq|<th class=listheading width=100%>|
- . $locale->text('Description')
- . qq|</th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- foreach $ref (@{ $form->{ALL} }) {
-
- $i++;
- $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- $column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_warehouse&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=warehouse>
-
-<input type=hidden name=path value=$form->{path}>
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-<input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">
-
- </form>
-
- </body>
- </html>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub warehouse_header {
- $lxdebug->enter_sub();
-
- $form->{title} = $locale->text("$form->{title} Warehouse");
-
- # $locale->text('Add Warehouse')
- # $locale->text('Edit Warehouse')
-
- $form->{description} =~ s/\"/"/g;
-
- if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
- $description =
- qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
- } else {
- $description =
- qq|<input name=description size=60 value="$form->{description}">|;
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=warehouse>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td>$description</td>
- </tr>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $lxdebug->leave_sub();
-}
-
-sub save_warehouse {
- $lxdebug->enter_sub();
-
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_warehouse(\%myconfig, \%$form);
- $form->redirect($locale->text('Warehouse saved!'));
-
- $lxdebug->leave_sub();
-}
-
-sub delete_warehouse {
- $lxdebug->enter_sub();
-
- AM->delete_warehouse(\%myconfig, \%$form);
- $form->redirect($locale->text('Warehouse deleted!'));
-
- $lxdebug->leave_sub();
-}
-
sub continue {
$lxdebug->enter_sub();
}
($form->{employee}) = split /--/, $form->{employee};
- ($form->{warehouse}, $form->{warehouse_id}) = split /--/, $form->{warehouse};
# create the form variables
if ($order) {
}
}
- if ($form->{type} =~ /(sales|ship)_(order|quotation)/) {
+ if ($form->{type} =~ /sales_(order|quotation)/) {
IS->get_customer(\%myconfig, \%$form);
#quote all_vendor Bug 133
<th align=right>$vclabel</th>
<td colspan=3>$vc</td>
</tr>
- $warehouse
$department
<tr>
<th align=right>$ordlabel</th>
$number = $form->escape($form->{$ordnumber});
$name = $form->escape($form->{ $form->{vc} });
$department = $form->escape($form->{department});
- $warehouse = $form->escape($form->{warehouse});
# construct href
$href =
- "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department&warehouse=$warehouse";
+ "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
# construct callback
$number = $form->escape($form->{$ordnumber}, 1);
$name = $form->escape($form->{ $form->{vc} }, 1);
$department = $form->escape($form->{department}, 1);
- $warehouse = $form->escape($form->{warehouse}, 1);
$callback =
- "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department&warehouse=$warehouse";
+ "$form->{script}?path=$form->{path}&action=orders&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&transdatefrom=$form->{transdatefrom}&transdateto=$form->{transdateto}&open=$form->{open}&closed=$form->{closed}¬delivered=$form->{notdelivered}&delivered=$form->{delivered}&$ordnumber=$number&$form->{vc}=$name&department=$department";
@columns =
$form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
$option = $locale->text(ucfirst $form->{vc});
$option .= " : $form->{$form->{vc}}";
}
- if ($form->{warehouse}) {
- ($warehouse) = split /--/, $form->{warehouse};
- $option .= "\n<br>" if ($option);
- $option .= $locale->text('Warehouse');
- $option .= " : $warehouse";
- }
if ($form->{department}) {
$option .= "\n<br>" if ($option);
($department) = split /--/, $form->{department};
}
$action = "edit";
- $action = "ship_receive" if ($form->{type} =~ /(ship|receive)_order/);
-
- $warehouse = $form->escape($form->{warehouse});
foreach $oe (@{ $form->{OE} }) {
$form->{rowcount} = ++$j;
$column_data{reqdate} = "<td>$oe->{reqdate} </td>";
$column_data{$ordnumber} =
- "<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>";
+ "<td><a href=oe.pl?path=$form->{path}&action=$action&type=$form->{type}&id=$oe->{id}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber}</a></td>";
$column_data{name} = "<td>$oe->{name}</td>";
$column_data{employee} = "<td>$oe->{employee} </td>";
. $locale->text('Continue') . qq|">
<input type="hidden" name="nextsub" value="edit">
<input type="hidden" name="type" value="$form->{type}">
- <input type="hidden" name="warehouse" value="$warehouse">
<input type="hidden" name="vc" value="$form->{vc}">
<input type="hidden" name="login" value="$form->{login}">
<input type="hidden" name="password" value="$form->{password}">
<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
-|;
- if ($form->{type} !~ /(ship|receive)_order/) {
- print qq|
-<input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">|;
- }
-
- print qq|
</form>
</body>
'Add User' => 'Benutzer erfassen',
'Add Vendor' => 'Lieferant erfassen',
'Add Vendor Invoice' => 'Einkaufsrechnung erfassen',
- 'Add Warehouse' => 'Lager erfassen',
'Add and edit %s' => '%s hinzufügen und bearbeiten',
'Add unit' => 'Einheit hinzufügen',
'Address' => 'Adresse',
'Edit User' => 'Benutzerdaten bearbeiten',
'Edit Vendor' => 'Lieferant editieren',
'Edit Vendor Invoice' => 'Einkaufsrechnung bearbeiten',
- 'Edit Warehouse' => 'Lager bearbeiten',
'Edit the purchase_order' => 'Bearbeiten des Lieferantenauftrags',
'Edit the request_quotation' => 'Bearbeiten der Preisanfrage',
'Edit the sales_order' => 'Bearbeiten des Auftrags',
'View License' => 'Lizenz ansehen',
'Von Konto: ' => 'von Konto: ',
'WEBDAV-Zugriff' => 'WEBDAV-Zugriff',
- 'Warehouse' => 'Lager',
- 'Warehouse deleted!' => 'Das Lager wurde gelöscht.',
- 'Warehouse saved!' => 'Das Lager wurde gespeichert.',
- 'Warehouses' => 'Lager',
'Warnings during template upgrade' => 'Warnungen bei Aktualisierung der Dokumentenvorlagen',
'Weight' => 'Gewicht',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Add Payment Terms' => 'Zahlungskonditionen hinzufügen',
'Add Printer' => 'Drucker hinzufügen',
'Add SIC' => 'SIC erfassen',
- 'Add Warehouse' => 'Lager erfassen',
'Add and edit %s' => '%s hinzufügen und bearbeiten',
'Address' => 'Adresse',
'Article Code' => 'Artikelkürzel',
'Edit Printer' => 'Drucker bearbeiten',
'Edit SIC' => 'SIC bearbeiten',
'Edit Template' => 'Vorlage bearbeiten',
- 'Edit Warehouse' => 'Lager bearbeiten',
'Enforce transaction reversal for all dates' => 'Gegenbuchungen für jeden Zeitraum aktualisieren',
'Enter longdescription' => 'Langtext eingeben',
'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere Währungen mit bis zu drei Buchstaben pro Währung und Währungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
'Value' => 'Wert',
'Variable' => 'Variable',
- 'Warehouse deleted!' => 'Das Lager wurde gelöscht.',
- 'Warehouse saved!' => 'Das Lager wurde gespeichert.',
- 'Warehouses' => 'Lager',
'Year End' => 'Jahresende',
'Yes' => 'Ja',
'You can use the following strings in the long description and all translations. They will be replaced by their actual values by Lx-Office before they\'re output.' => 'Sie können im Langtext und allen Übersetzungen die folgenden Variablen benutzen, die vor der Ausgabe von Lx-Office automatisch ersetzt werden:',
'add_printer' => 'add_printer',
'add_sic' => 'add_sic',
'add_unit' => 'add_unit',
- 'add_warehouse' => 'add_warehouse',
'audit_control' => 'audit_control',
'backup' => 'backup',
'buchungsgruppe_header' => 'buchungsgruppe_header',
'delete_payment' => 'delete_payment',
'delete_printer' => 'delete_printer',
'delete_sic' => 'delete_sic',
- 'delete_warehouse' => 'delete_warehouse',
'delivery_customer_selection' => 'delivery_customer_selection',
'department_header' => 'department_header',
'display_form' => 'display_form',
'edit_sic' => 'edit_sic',
'edit_template' => 'edit_template',
'edit_units' => 'edit_units',
- 'edit_warehouse' => 'edit_warehouse',
'employee_selection_internal' => 'employee_selection_internal',
'form_footer' => 'form_footer',
'format_dates' => 'format_dates',
'list_payment' => 'list_payment',
'list_printer' => 'list_printer',
'list_sic' => 'list_sic',
- 'list_warehouse' => 'list_warehouse',
'part_selection_internal' => 'part_selection_internal',
'payment_header' => 'payment_header',
'printer_header' => 'printer_header',
'save_sic' => 'save_sic',
'save_template' => 'save_template',
'save_unit' => 'save_unit',
- 'save_warehouse' => 'save_warehouse',
'select_employee' => 'select_employee',
'select_employee_internal' => 'select_employee_internal',
'select_part' => 'select_part',
'swap_payment_terms' => 'swap_payment_terms',
'swap_units' => 'swap_units',
'vendor_selection' => 'vendor_selection',
- 'warehouse_header' => 'warehouse_header',
'erfassen' => 'add',
'konto_erfassen' => 'add_account',
'weiter' => 'continue',
' Date missing!' => ' Datum fehlt!',
' missing!' => ' fehlt!',
'*/' => '*/',
- 'Add' => 'Erfassen',
'Add Exchangerate' => 'Wechselkurs erfassen',
'Add Purchase Order' => 'Lieferantenauftrag erfassen',
'Add Quotation' => 'Angebot erfassen',
'Vendor Number' => 'Lieferantennummer',
'Vendor missing!' => 'Lieferant fehlt!',
'Vendor not on file!' => 'Lieferant ist nicht in der Datenbank!',
- 'Warehouse' => 'Lager',
'What type of item is this?' => 'Was ist dieser Artikel?',
'Workflow purchase_order' => 'Workflow Lieferantenauftrag',
'Workflow request_quotation' => 'Workflow Preisanfrage',
'vendor_invoice' => 'vendor_invoice',
'vendor_selection' => 'vendor_selection',
'yes' => 'yes',
- 'erfassen' => 'add',
'weiter' => 'continue',
'löschen' => 'delete',
'email' => 'e_mail',
action=edit_units
unit_type=service
-#[System--Warehouses]
-#module=menu.pl
-#action=acc_menu
-#target=acc_menu
-#submenu=1
-
-#[System--Warehouses--Add Warehouse]
-#module=am.pl
-#action=add_warehouse
-#
-#[System--Warehouses--List Warehouses]
-#module=am.pl
-#action=list_warehouse
[System--Departments]
module=menu.pl