1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
6 #############################################################################
7 # Veraendert 2005-01-05 - Marco Welter <mawe@linux-studio.de> - Neue Optik #
8 #############################################################################
9 # SQL-Ledger, Accounting
10 # Copyright (c) 1998-2002
12 # Author: Dieter Simader
13 # Email: dsimader@sql-ledger.org
14 # Web: http://www.sql-ledger.org
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #######################################################################
32 # common routines used in is, ir but not in oe
34 #######################################################################
37 use List::Util qw(max);
43 require "bin/mozilla/common.pl";
47 # any custom scripts for this one
48 if (-f "bin/mozilla/custom_invoice_io.pl") {
49 eval { require "bin/mozilla/custom_invoice_io.pl"; };
51 if (-f "bin/mozilla/$::myconfig{login}_invoice_io.pl") {
52 eval { require "bin/mozilla/$::myconfig{login}_invoice_io.pl"; };
59 # this is for our long dates
60 # $locale->text('January')
61 # $locale->text('February')
62 # $locale->text('March')
63 # $locale->text('April')
64 # $locale->text('May ')
65 # $locale->text('June')
66 # $locale->text('July')
67 # $locale->text('August')
68 # $locale->text('September')
69 # $locale->text('October')
70 # $locale->text('November')
71 # $locale->text('December')
73 # this is for our short month
74 # $locale->text('Jan')
75 # $locale->text('Feb')
76 # $locale->text('Mar')
77 # $locale->text('Apr')
78 # $locale->text('May')
79 # $locale->text('Jun')
80 # $locale->text('Jul')
81 # $locale->text('Aug')
82 # $locale->text('Sep')
83 # $locale->text('Oct')
84 # $locale->text('Nov')
85 # $locale->text('Dec')
92 $main::lxdebug->enter_sub();
94 my $form = $main::form;
95 my %myconfig = %main::myconfig;
97 $main::auth->assert('part_service_assembly_edit | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
98 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | '.
99 'purchase_delivery_order_edit | sales_delivery_order_edit | part_service_assembly_details');
102 retrieve_partunits() if ($form->{type} =~ /_delivery_order$/);
104 my $new_rowcount = $form->{"rowcount"} * 1 + 1;
105 $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"};
107 $form->language_payment(\%myconfig);
109 # if we have a display_form
110 if ($form->{display_form}) {
111 call_sub($form->{"display_form"});
115 Common::webdav_folder($form);
117 # if ( $form->{print_and_post}
118 # && $form->{second_run}
119 # && ($form->{action} eq "display_form")) {
120 # for (keys %$form) { $old_form->{$_} = $form->{$_} }
121 # $old_form->{rowcount}++;
123 # #$form->{rowcount}--;
124 # #$form->{rowcount}--;
126 # $form->{print_and_post} = 0;
128 # &print_form($old_form);
129 # ::end_of_request();
132 # $form->{action} = "";
133 # $form->{resubmit} = 0;
135 # if ($form->{print_and_post} && !$form->{second_run}) {
136 # $form->{second_run} = 1;
137 # $form->{action} = "display_form";
138 # $form->{rowcount}--;
139 # my $rowcount = $form->{rowcount};
141 # $form->{resubmit} = 1;
149 my $numrows = ++$form->{rowcount};
150 my $subroutine = "display_row";
152 if ($form->{item} =~ /(part|service)/) {
153 #set preisgruppenanzahl
154 $numrows = $form->{price_rows};
155 $subroutine = "price_row";
157 &{$subroutine}($numrows);
159 $numrows = ++$form->{makemodel_rows};
160 $subroutine = "makemodel_row";
162 if ($form->{item} eq 'assembly') {
163 $numrows = $form->{price_rows};
164 $subroutine = "price_row";
166 &{$subroutine}($numrows);
168 $numrows = ++$form->{makemodel_rows};
169 $subroutine = "makemodel_row";
171 # assemblies are built from components, they aren't purchased from a vendor
172 # also the lastcost_$i from makemodel conflicted with the component lastcost_$i
173 # so we don't need the makemodel rows for assemblies
174 # create makemodel rows
175 # &{$subroutine}($numrows);
177 $numrows = ++$form->{assembly_rows};
178 $subroutine = "assembly_row";
182 &{$subroutine}($numrows) if $numrows;
187 $main::lxdebug->leave_sub();