@@ -747,24 +768,15 @@ sub form_header {
- $vclabel |
- $vc |
- {vc}_id value=$form->{"$form->{vc}_id"}>
- {vc}"}">
- |
- . $locale->text('Contact Person') . qq| |
- $contact |
-
+ $vc
+ $contact
$creditremaining
$business
$dunning
$taxzone
$department
- | . $locale->text('Currency') . qq| |
- |
-
- {defaultcurrency}>
+ $currencies
$exchangerate
@@ -774,7 +786,11 @@ sub form_header {
| . $locale->text('Ship via') . qq| |
|
- |;
+
+
+ | . $locale->text('Transaction description') . qq| |
+ |
+ |;
#
#
#
@@ -801,6 +817,7 @@ print qq|
$openclosed
$employee
+ $salesmen
$ordnumber
| . $locale->text('Project Number') . qq| |
@@ -891,7 +908,8 @@ sub form_footer {
$tax .= qq|
- $form->{"${item}_description"} |
+ $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|% |
$form->{"${item}_total"} |
|;
@@ -930,7 +948,8 @@ sub form_footer {
$tax .= qq|
- Enthaltene $form->{"${item}_description"} |
+ Enthaltene $form->{"${item}_description"} |
+ . $form->{"${item}_rate"} * 100 .qq|% |
$form->{"${item}_total"} |
@@ -962,10 +981,10 @@ sub form_footer {
$notes |
$intnotes |
- | . $locale->text('Payment Terms') . qq| |
- |
-
+ |
+ $payments
+
+
|
$taxincluded
@@ -1017,14 +1036,12 @@ sub form_footer {
print $webdav_list;
}
- print qq|
-{jscalendar}>
-|;
+
print qq|
|
|;
- &print_options;
+ print_options();
print qq|
|
@@ -1048,6 +1065,12 @@ sub form_footer {
if (($form->{id})) {
print qq|
+
+
| . $locale->text("Workflow $form->{type}") . qq|
@@ -1105,26 +1128,17 @@ sub form_footer {
|;
}
+ $form->hide_form("saved_xyznumber");
+
print qq|
{rowcount}>
-{path}>
{login}>
{password}>
-|;
-# button for saving history
-print qq|
- {id}
- . qq|); name=history id=history value=|
- . $locale->text('history')
- . qq|>|;
-# /button for saving history
-
-qq|
+
@@ -1141,9 +1155,17 @@ sub update {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
$form->{update} = 1;
-
+
+ if($form->{payment_id}) {
+ $payment_id = $form->{payment_id};
+ }
+
&check_name($form->{vc});
-
+
+ if($form->{payment_id} eq "") {
+ $form->{payment_id} = $payment_id;
+ }
+
$buysell = 'buy';
$buysell = 'sell' if ($form->{vc} eq 'vendor');
$form->{exchangerate} = $exchangerate
@@ -1295,7 +1317,7 @@ sub search {
$form->{vc} = 'customer';
$ordlabel = $locale->text('Order Number');
$ordnumber = 'ordnumber';
- $employee = $locale->text('Salesperson');
+ $employee = $locale->text('Employee');
}
if ($form->{type} eq 'sales_quotation') {
@@ -1310,27 +1332,13 @@ sub search {
$form->all_vc(\%myconfig, $form->{vc},
($form->{vc} eq 'customer') ? "AR" : "AP");
- map { $vc .= "\n";
map {
$form->{selectdepartment} .=
- "$_->{description}--$_->{id}\n"
+ "$_->{description}--$_->{id}\n"
} (@{ $form->{all_departments} });
}
@@ -1355,37 +1363,31 @@ sub search {
}
# use JavaScript Calendar or not
- $form->{jsscript} = $jscalendar;
+ $form->{jsscript} = 1;
$jsscript = "";
- if ($form->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
-
- text('button') . qq|> |
- |;
- $button2 = qq|
-
- text('button') . qq|> |
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
- "transdateto", "BL", "trigger4");
- } else {
- # without JavaScript Calendar
- $button1 = qq|
- | |;
- $button2 = qq|
- | |;
- }
+ $button1 = qq|
+
+ text('button') . qq|> |
+ |;
+ $button2 = qq|
+
+ text('button') . qq|> |
+ |;
+
+ #write Trigger
+ $jsscript =
+ Form->write_trigger(\%myconfig, "2", "transdatefrom", "BR", "trigger3",
+ "transdateto", "BL", "trigger4");
+
+ my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
- "all" => 1 });
+ "all" => 1 },
+ "employees" => "ALL_EMPLOYEES",
+ $vc => "ALL_" . uc($vc));
my %labels = ();
my @values = ("");
@@ -1397,6 +1399,41 @@ sub search {
NTI($cgi->popup_menu('-name' => 'project_id', '-values' => \@values,
'-labels' => \%labels));
+ #employees
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
+ }
+
+ my $employee_block = qq|
+
+ | . $locale->text('Employee') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'employee_id',
+ '-values' => \@values,
+ '-labels' => \%labels)) . qq|
+ |
+
|;
+
+ %labels = ();
+ @values = ("");
+
+ foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) {
+ push(@values, $item->{name}.qq|--|.$item->{"id"});
+ $labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"};
+ }
+
+ my $vc_label = $form->{vc} eq "customer" ? $locale->text('Customer') : $locale->text('Vendor');
+ $vc =
+ $myconfig{vclimit} <= scalar(@values)
+ ? qq|{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">|
+ : NTI($cgi->popup_menu('-name' => "$form->{vc}",
+ '-default' => $form->{"old$form->{vc}"},
+ '-onChange' => 'document.getElementById(\'update_button\').click();',
+ '-values' => \@values,
+ '-labels' => \%labels));
$form->header;
print qq|
@@ -1413,7 +1450,7 @@ sub search {
- $vclabel |
+ $vc_label |
$vc |
$department
@@ -1421,6 +1458,11 @@ sub search {
$ordlabel |
|
+ $employee_block
+
+ | . $locale->text('Transaction description') . qq| |
+ |
+
| . $locale->text("Project Number") . qq| |
$projectnumber |
@@ -1453,7 +1495,7 @@ sub search {
. $locale->text('Required by') . qq|
- $vclabel |
+ $vc_label |
$employee |
|
. $locale->text('Ship via') . qq| |
@@ -1466,8 +1508,12 @@ sub search {
. $locale->text('Tax') . qq|
|
. $locale->text('Total') . qq| |
+
+
|
. $locale->text('Project Number') . qq| |
+ |
+ . $locale->text('Transaction description') . qq| |
|
@@ -1486,7 +1532,6 @@ $jsscript
-{path}>
{login}>
{password}>
{vc}>
@@ -1506,35 +1551,35 @@ $jsscript
sub orders {
$lxdebug->enter_sub();
- # split vendor / customer
- ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
- split(/--/, $form->{ $form->{vc} });
-
- OE->transactions(\%myconfig, \%$form);
-
$ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
- $number = $form->escape($form->{$ordnumber});
- $name = $form->escape($form->{ $form->{vc} });
- $department = $form->escape($form->{department});
-
# 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";
+ my @fields =
+ qw(type vc login password transdatefrom transdateto
+ open closed notdelivered delivered department
+ transaction_description);
+ push @fields, $form->{vc};
+ $href = "$form->{script}?action=orders&"
+ . join("&", map { "${_}=" . E($form->{$_}) } @fields)
+ . "&${ordnumber}=" . E($form->{$ordnumber});
+ $callback = $href;
- # construct callback
- $number = $form->escape($form->{$ordnumber}, 1);
- $name = $form->escape($form->{ $form->{vc} }, 1);
- $department = $form->escape($form->{department}, 1);
+ # split vendor / customer
+ ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) =
+ split(/--/, $form->{ $form->{vc} });
- $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";
+ OE->transactions(\%myconfig, \%$form);
- @columns =
- $form->sort_columns("transdate", "reqdate", "id", "$ordnumber",
- "name", "netamount", "tax", "amount",
- "curr", "employee", "shipvia", "globalprojectnumber",
- "open", "closed", "delivered");
+ @columns = (
+ "transdate", "reqdate",
+ "id", "$ordnumber",
+ "name", "netamount",
+ "tax", "amount",
+ "curr", "employee",
+ "shipvia", "globalprojectnumber",
+ "transaction_description", "open",
+ "closed", "delivered"
+ );
$form->{l_open} = $form->{l_closed} = "Y"
if ($form->{open} && $form->{closed});
@@ -1574,11 +1619,10 @@ sub orders {
if ($form->{vc} eq 'customer') {
if ($form->{type} eq 'sales_order') {
$form->{title} = $locale->text('Sales Orders');
- $employee = $locale->text('Salesperson');
} else {
$form->{title} = $locale->text('Quotations');
- $employee = $locale->text('Employee');
}
+ $employee = $locale->text('Employee');
$name = $locale->text('Customer');
}
@@ -1629,6 +1673,9 @@ sub orders {
$column_header{employee} =
qq| | $employee | |;
+ $column_header{transaction_description} =
+ qq||
+ . $locale->text("Transaction description") . qq| | |;
$column_header{ids} = qq| | |;
@@ -1725,13 +1772,13 @@ sub orders {
$subtotalamount += $oe->{amount};
$column_data{ids} =
- qq| | |;
+ qq| | |;
$column_data{id} = "$oe->{id} | ";
$column_data{transdate} = "$oe->{transdate} | ";
$column_data{reqdate} = "$oe->{reqdate} | ";
$column_data{$ordnumber} =
- "{path}&action=$action&type=$form->{type}&id=$oe->{id}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber} | ";
+ "{type}&id=$oe->{id}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}&callback=$callback_escaped>$oe->{$ordnumber} | ";
$column_data{name} = "$oe->{name} | ";
$column_data{employee} = "$oe->{employee} | ";
@@ -1748,6 +1795,7 @@ sub orders {
$column_data{"delivered"} = "" .
($oe->{"delivered"} ? $locale->text("Yes") : $locale->text("No")) .
" | ";
+ $column_data{transaction_description} = "" . H($oe->{transaction_description}) . " | ";
$i++;
$i %= 2;
@@ -1799,7 +1847,6 @@ sub orders {
if ($form->{type} =~ /sales_order/) {
print qq|
-
@@ -1822,7 +1869,6 @@ sub orders {
{type}>
{vc}>
-{path}>
{login}>
{password}>
@@ -1877,6 +1923,10 @@ sub save_and_close {
$form->isblank("transdate", $locale->text('Quotation Date missing!'));
}
+ my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+ $form->{$idx} =~ s/^\s*//g;
+ $form->{$idx} =~ s/\s*$//g;
+
$msg = ucfirst $form->{vc};
$form->isblank($form->{vc}, $locale->text($msg . " missing!"));
@@ -1887,9 +1937,16 @@ sub save_and_close {
if ($form->{currency} ne $form->{defaultcurrency});
&validate_items;
-
+
+ if($form->{payment_id}) {
+ $payment_id = $form->{payment_id};
+ }
+
# if the name changed get new values
if (&check_name($form->{vc})) {
+ if($form->{payment_id} eq "") {
+ $form->{payment_id} = $payment_id;
+ }
&update;
exit;
}
@@ -1935,17 +1992,19 @@ sub save_and_close {
}
relink_accounts();
+
+ $form->error($err) if (!OE->save(\%myconfig, \%$form));
+
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
- $form->redirect(
- $form->{label} . " $form->{$ordnumber} " . $locale->text('saved!'))
- if (OE->save(\%myconfig, \%$form));
- $form->error($err);
+ $form->redirect($form->{label} . " $form->{$ordnumber} " .
+ $locale->text('saved!'));
$lxdebug->leave_sub();
}
@@ -1959,6 +2018,10 @@ sub save {
$form->isblank("transdate", $locale->text('Quotation Date missing!'));
}
+ my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber";
+ $form->{$idx} =~ s/^\s*//g;
+ $form->{$idx} =~ s/\s*$//g;
+
$msg = ucfirst $form->{vc};
$form->isblank($form->{vc}, $locale->text($msg . " missing!"));
@@ -1969,9 +2032,16 @@ sub save {
if ($form->{currency} ne $form->{defaultcurrency});
&validate_items;
-
+
+ if($form->{payment_id}) {
+ $payment_id = $form->{payment_id};
+ }
+
# if the name changed get new values
if (&check_name($form->{vc})) {
+ if($form->{payment_id} eq "") {
+ $form->{payment_id} = $payment_id;
+ }
&update;
exit;
}
@@ -2015,14 +2085,17 @@ sub save {
unless $form->{$ordnumber};
relink_accounts();
+
+ OE->save(\%myconfig, \%$form);
+
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
- OE->save(\%myconfig, \%$form);
$form->{simple_save} = 1;
if(!$form->{print_and_save}) {
set_headings("edit");
@@ -2064,8 +2137,11 @@ sub delete {
$msg $form->{$ordnumber}
+
+
|