use Encode;
sub read {
+ my ($class, $file_name) = @_;
+
read_config 'config/lx_office.conf.default' => %::lx_office_conf;
_decode_recursively(\%::lx_office_conf);
- if (-f 'config/lx_office.conf') {
- read_config 'config/lx_office.conf' => my %local_conf;
+ $file_name ||= 'config/lx_office.conf';
+
+ if (-f $file_name) {
+ read_config $file_name => my %local_conf;
_decode_recursively(\%local_conf);
_flat_merge(\%::lx_office_conf, \%local_conf);
}
my @values;
my $query =
- qq|SELECT cus.name,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | .
+ qq|SELECT cus.name,cus.customernumber,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | .
qq|FROM invoice i | .
qq|join ar on (i.trans_id = ar.id) | .
qq|join parts p on (i.parts_id = p.id) | .
$where .= " AND ar.customer_id = ?";
push(@values, $form->{customer_id});
};
+ if ($form->{customernumber}) {
+ $where .= qq| AND cus.customernumber = ? |;
+ push(@values, $form->{customernumber});
+ }
if ($form->{partnumber}) {
$where .= qq| AND (p.partnumber ILIKE ?)|;
push(@values, '%' . $form->{partnumber} . '%');
marge_total marge_percent globalprojectnumber customernumber country ustid taxzone payment_terms charts customertype);
my @hidden_variables = map { "l_${_}" } @columns;
- push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto employee_id salesman_id);
+ push @hidden_variables, "l_subtotal", qw(open closed customer invnumber ordnumber transaction_description notes project_id transdatefrom transdateto employee_id salesman_id business_id);
$href = build_std_url('action=ar_transactions', grep { $form->{$_} } @hidden_variables);
use POSIX qw(strftime);
use YAML;
+use SL::DB::DeliveryOrder;
use SL::DO;
use SL::IR;
use SL::IS;
sub save {
$main::lxdebug->enter_sub();
+ my (%params) = @_;
+
check_do_access();
my $form = $main::form;
# /saving the history
$form->{simple_save} = 1;
- if(!$form->{print_and_save}) {
+ if (!$params{no_redirect} && !$form->{print_and_save}) {
set_headings("edit");
update();
::end_of_request();
sub transfer_in {
$main::lxdebug->enter_sub();
+ save(no_redirect => 1);
+
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
if (@{ $form->{ERRORS} }) {
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
+ set_headings('edit');
update();
$main::lxdebug->leave_sub();
DO->transfer_in_out('direction' => 'in',
'requests' => \@all_requests);
- $form->{delivered} = 1;
+ SL::DB::DeliveryOrder->new(id => $form->{id})->load->update_attributes(delivered => 1);
- save();
+ $form->{callback} = 'do.pl?action=edit&type=purchase_delivery_order&id=' . $form->escape($form->{id});
+ $form->redirect;
$main::lxdebug->leave_sub();
}
sub transfer_out {
$main::lxdebug->enter_sub();
+ save(no_redirect => 1);
+
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
next if (0 == $row_sum_base_qty);
- my $do_base_qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
+ my $do_base_qty = $form->{"qty_$i"} * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
# if ($do_base_qty != $row_sum_base_qty) {
# push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
if (@{ $form->{ERRORS} }) {
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
+ set_headings('edit');
update();
$main::lxdebug->leave_sub();
DO->transfer_in_out('direction' => 'out',
'requests' => \@all_requests);
- $form->{delivered} = 1;
+ SL::DB::DeliveryOrder->new(id => $form->{id})->load->update_attributes(delivered => 1);
- save();
+ $form->{callback} = 'do.pl?action=edit&type=sales_delivery_order&id=' . $form->escape($form->{id});
+ $form->redirect;
$main::lxdebug->leave_sub();
}
if ( $form->{customer} =~ /--/ ) {
# Felddaten kommen aus Dropdownbox
($form->{customername}, $form->{customer_id}) = split(/--/, $form->{customer});
- } else {
- # Felddaten kommen aus Freitextfeld
+ } elsif ($form->{customer}) {
+ # es wurde ein Wert im Freitextfeld übergeben, auf Eindeutigkeit überprüfen
# check_name wird mit no_select => 1 ausgeführt, ist die Abfrage nicht eindeutig kommt ein Fehler
# und die Abfrage muß erneut ausgeführt werden
# Nichts führt, daher diese Zwischenlösung
&check_name('customer', no_select => 1);
-
+
# $form->{customer_id} wurde schon von check_name gesetzt
$form->{customername} = $form->{customer};
};
+ # ist $form->{customer} leer passiert hier nichts weiter
# decimalplaces überprüfen oder auf Default 2 setzen
$form->{decimalplaces} = 2 unless $form->{decimalplaces} > 0 && $form->{decimalplaces} < 6;
$form->{title} = $locale->text('Sales Report');
@columns =
- qw(description invnumber partnumber parts_id transdate qty unit sellprice sellprice_total discount lastcost lastcost_total marge_total marge_percent);
+ qw(description invnumber transdate customernumber partnumber transdate qty unit sellprice sellprice_total discount lastcost lastcost_total marge_total marge_percent);
# hidden variables für pdf/csv export übergeben
# einmal mit l_ um zu bestimmen welche Spalten ausgegeben werden sollen
# einmal optionen für die Überschrift (z.B. transdatefrom, partnumber, ...)
- my @hidden_variables = (qw(l_headers l_subtotal l_total transdatefrom transdateto decimalplaces customer customername customer_id department partnumber description project_id), "$form->{db}number", map { "l_$_" } @columns);
+ my @hidden_variables = (qw(l_headers l_subtotal l_total l_customernumber transdatefrom transdateto decimalplaces customer customername customer_id department partnumber description project_id customernumber), "$form->{db}number", map { "l_$_" } @columns);
my @hidden_nondefault = grep({ $form->{$_} } @hidden_variables);
# Variablen werden dann als Hidden Variable mitgegeben, z.B.
# <input type="hidden" name="report_generator_hidden_transdateto" value="21.05.2010">
'lastcost' => { 'text' => $locale->text('Purchase price'), },
'marge_total' => { 'text' => $locale->text('Sales margin'), },
'marge_percent' => { 'text' => $locale->text('Sales margin %'), },
+ 'customernumber' => { 'text' => $locale->text('Customer Number'), },
);
my %column_alignment = map { $_ => 'right' } qw(lastcost sellprice sellprice_total lastcost_total unit discount marge_total marge_percent qty);
if ($form->{customer}) {
push @options, $locale->text('Customer') . " : $form->{customername}";
}
+ if ($form->{customernumber}) {
+ push @options, $locale->text('Customer Number') . " : $form->{customernumber}";
+ }
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
$name = 'name';
};
- if ($form->{l_subtotal} eq 'Y' ) {
+ if ($form->{l_subtotal} eq 'Y') {
push @{ $row_set }, create_subtotal_row_invoice(\%subtotals2, \@columns, \%column_alignment, \@subtotal_columns, 'listsubsortsubtotal', $ar->{$name}) ;
push @{ $row_set }, insert_empty_row();
};
- Dokumentensystem -> viele Zahlenwerte sind nun auch in nicht fromatierter Form (alos ungerundet und mit . als Dezimaltrennzeichen) in den Dokumenten verfügbar.
Variabelenerweiterung: _nofmt, siehe doc/dokumentenvorlagen-und-variablen.html
+ - Bedienung -> Eingabe beliebiger mathematischer Funktionen bestehend aus +-*/() in alle Zahlenfelder
+ das ermoeglicht z.B. die nettopreisangabe "100/1,19", was dann als "84,033613" gespeichert wird.
+ Berücksichtigt das beim Benutzer eingestellte Zahlenformat.
+
+
Liste gefixter Bugs aus dem Bugtracker:
- - Bugfix 1613: Status teilweise
+ - Bugfix 1613: Abteilung wird bei Verkaufsrechnungen nicht gespeichert
- Bugfix 1642: Lieferantenrabatt wird korrekt gespeichert, aber nicht mehr angezeigt
- Bugfix 1626: Beim Festlegen der Standardkonten kann beim Warenbestand eine Überschrift ausgewählt werden.
- Bugfix 1584: Summen und Saldenliste: Export to PDF/CSV in EÜR Modus falsch
our %lx_office_conf;
-# this is a cleaned up version of am.pl
-# it lacks redirection, some html setup and most of the authentication process.
-# it is assumed that anyone with physical access and execution rights on this script
-# won't be hindered by authentication anyway.
sub lxinit {
my $login = $lx_office_conf{task_server}->{login};
sub gd_preconfig {
my $self = shift;
- SL::LxOfficeConf->read;
+ SL::LxOfficeConf->read($self->{configfile});
die "Missing section [task_server] in config file" unless $lx_office_conf{task_server};
die "Missing key 'login' in section [task_server] in config file" unless $lx_office_conf{task_server}->{login};
-%]
</td>
</tr>
+ <tr>
+ <th align="right" nowrap>[% 'Customer Number' | $T8 %]</th>
+ <td><input name="customernumber" size="20"></td>
+ </tr>
<tr>
<th align=right nowrap>[% 'Department' | $T8 %]</th>
<td>
<td align=right><input name="l_headers" class=checkbox type=checkbox value="Y" checked></td>
<td nowrap>[% 'Headings' | $T8 %]</td>
</tr>
+ <tr>
+ <td align=right><input name="l_customernumber" class=checkbox type=checkbox value=Y checked></td>
+ <td nowrap>[% 'Customer Number' | $T8 %]</td>
+ </tr>
<tr>
<th align="right" nowrap>[% 'Decimalplaces' | $T8 %]</th>
<td colspan="4"><input name="decimalplaces" size="2" value="2"></td>